Skip to content

Commit

Permalink
Add missing prettier plugin for import ordering (#1094)
Browse files Browse the repository at this point in the history
* Add missing prettier plugin to support import order

* Format everything

* Handle type assertions in import statements in prettier
  • Loading branch information
spalladino authored Jul 17, 2023
1 parent ddcaea9 commit 3e3362c
Show file tree
Hide file tree
Showing 26 changed files with 139 additions and 47 deletions.
2 changes: 1 addition & 1 deletion yarn-project/acir-simulator/src/acvm/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
MAX_NEW_NULLIFIERS_PER_CALL,
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
MAX_READ_REQUESTS_PER_CALL,
NUM_FIELDS_PER_SHA256,
PrivateCircuitPublicInputs,
MAX_READ_REQUESTS_PER_CALL,
RETURN_VALUES_LENGTH,
} from '@aztec/circuits.js';
import { AztecAddress } from '@aztec/foundation/aztec-address';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { JsonRpcServer } from '@aztec/foundation/json-rpc';
import { ContractData, ContractDeploymentTx, ContractPublicData, Tx, TxExecutionRequest, TxHash } from '@aztec/types';

import { foundry } from 'viem/chains';

import { AztecRPCServer, EthAddress } from '../index.js';

export const localAnvil = foundry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AztecAddress, CircuitsWasm, Fr } from '@aztec/circuits.js';
import { computeContractAddressFromPartial } from '@aztec/circuits.js/abis';
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
import { ConstantKeyPair, TestKeyStore } from '@aztec/key-store';
import { AztecNode } from '@aztec/types';

import { randomBytes } from 'crypto';
import { MockProxy, mock } from 'jest-mock-extended';

import { MemoryDB } from '../database/memory_db.js';
import { AztecRPCServer } from './aztec_rpc_server.js';
import { AztecNode } from '@aztec/types';
import { RpcServerConfig } from '../index.js';
import { AztecRPCServer } from './aztec_rpc_server.js';

describe('AztecRpcServer', function () {
let wasm: CircuitsWasm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import {
getNewContractPublicFunctions,
toContractDao,
} from '@aztec/types';

import { RpcServerConfig } from '../config/index.js';
import { ContractDataOracle } from '../contract_data_oracle/index.js';
import { Database, TxDao } from '../database/index.js';
import { KernelOracle } from '../kernel_oracle/index.js';
import { KernelProver } from '../kernel_prover/kernel_prover.js';
import { getAcirSimulator } from '../simulator/index.js';
import { Synchroniser } from '../synchroniser/index.js';
import { RpcServerConfig } from '../config/index.js';

/**
* A remote Aztec RPC Client implementation.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-rpc/src/contract_data_oracle/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AztecAddress, CircuitsWasm, MembershipWitness, VK_TREE_HEIGHT } from '@aztec/circuits.js';
import { ContractDatabase } from '@aztec/types';
import { ContractCommitmentProvider } from '@aztec/types';

import { ContractTree } from '../contract_tree/index.js';
import { ContractCommitmentProvider } from '@aztec/types';

/**
* ContractDataOracle serves as a data manager and retriever for noir contracts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
KernelCircuitPublicInputs,
MAX_NEW_COMMITMENTS_PER_TX,
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
MAX_READ_REQUESTS_PER_CALL,
MembershipWitness,
PrivateCallStackItem,
PrivateCircuitPublicInputs,
MAX_READ_REQUESTS_PER_CALL,
ReadRequestMembershipWitness,
TxRequest,
VK_TREE_HEIGHT,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-rpc/src/kernel_prover/kernel_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
Fr,
KernelCircuitPublicInputs,
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
MAX_READ_REQUESTS_PER_CALL,
MembershipWitness,
PreviousKernelData,
PrivateCallData,
PrivateCallStackItem,
MAX_READ_REQUESTS_PER_CALL,
ReadRequestMembershipWitness,
TxRequest,
VK_TREE_HEIGHT,
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/aztec-rpc/src/note_processor/note_processor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { AztecAddress, CircuitsWasm } from '@aztec/circuits.js';
import { siloNullifier } from '@aztec/circuits.js/abis';
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
import { Fr } from '@aztec/foundation/fields';
import { createDebugLogger } from '@aztec/foundation/log';
import { AztecNode, KeyStore, L2BlockContext, L2BlockL2Logs, NoteSpendingInfo, PublicKey } from '@aztec/types';

import { Database, NoteSpendingInfoDao, TxDao } from '../database/index.js';
import { getAcirSimulator } from '../simulator/index.js';
import { siloNullifier } from '@aztec/circuits.js/abis';

/**
* Contains all the decrypted data in this array so that we can later batch insert it all into the database.
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/aztec-rpc/src/simulator/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ContractCommitmentProvider, DataCommitmentProvider, L1ToL2MessageProvider, KeyStore } from '@aztec/types';
import { AcirSimulator } from '@aztec/acir-simulator';
import { ContractCommitmentProvider, DataCommitmentProvider, KeyStore, L1ToL2MessageProvider } from '@aztec/types';

import { ContractDataOracle } from '../contract_data_oracle/index.js';
import { Database } from '../database/database.js';
import { SimulatorOracle } from '../simulator_oracle/index.js';
import { AcirSimulator } from '@aztec/acir-simulator';

/**
* Helper method to create an instance of the acir simulator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { AztecAddress, CircuitsWasm, FunctionData, PartialContractAddress, TxCon
import { Signer } from '@aztec/circuits.js/barretenberg';
import { ContractAbi, encodeArguments, generateFunctionSelector } from '@aztec/foundation/abi';
import { ExecutionRequest, PackedArguments, TxExecutionRequest } from '@aztec/types';

import partition from 'lodash.partition';

import SchnorrAccountContractAbi from '../abis/schnorr_account_contract.json' assert { type: 'json' };
import { generatePublicKey } from '../index.js';
import { buildPayload, hashPayload } from './entrypoint_payload.js';
import { AccountImplementation } from './index.js';

import SchnorrAccountContractAbi from '../abis/schnorr_account_contract.json' assert { type: 'json' };

/**
* Account contract implementation that uses a single key for signing and encryption. This public key is not
* stored in the contract, but rather verified against the contract address. Note that this approach is not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { AztecAddress, CircuitsWasm, FunctionData, TxContext } from '@aztec/circ
import { Signer } from '@aztec/circuits.js/barretenberg';
import { ContractAbi, encodeArguments, generateFunctionSelector } from '@aztec/foundation/abi';
import { ExecutionRequest, PackedArguments, TxExecutionRequest } from '@aztec/types';

import partition from 'lodash.partition';
import { buildPayload, hashPayload } from './entrypoint_payload.js';
import { AccountImplementation } from './index.js';

import EcdsaAccountContractAbi from '../abis/ecdsa_account_contract.json' assert { type: 'json' };
import { buildPayload, hashPayload } from './entrypoint_payload.js';
import { AccountImplementation } from './index.js';

/**
* Account contract implementation that keeps a signing public key in storage, and is retrieved on
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuits.js/src/cbind/circuits.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import mapValues from 'lodash.mapvalues';

import { callCbind } from './cbind.js';
import {
toBuffer,
Address,
CallContext,
CircuitError,
Expand All @@ -24,7 +23,6 @@ import {
G1AffineElement,
KernelCircuitPublicInputs,
NativeAggregationState,
ReadRequestMembershipWitness,
NewContractData,
OptionallyRevealedData,
Point,
Expand All @@ -37,9 +35,11 @@ import {
PublicDataRead,
PublicDataUpdateRequest,
PublicKernelInputs,
ReadRequestMembershipWitness,
TxContext,
VerificationKeyData,
isCircuitError,
toBuffer,
} from './types.js';

interface MsgpackG1AffineElement {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuits.js/src/tests/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
MAX_PUBLIC_DATA_READS_PER_TX,
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
MAX_READ_REQUESTS_PER_CALL,
MAX_READ_REQUESTS_PER_TX,
MembershipWitness,
MergeRollupInputs,
Expand Down Expand Up @@ -75,7 +76,6 @@ import {
PublicDataRead,
PublicDataUpdateRequest,
PublicKernelInputs,
MAX_READ_REQUESTS_PER_CALL,
RETURN_VALUES_LENGTH,
ROLLUP_VK_TREE_HEIGHT,
ReadRequestMembershipWitness,
Expand Down
1 change: 1 addition & 0 deletions yarn-project/end-to-end/src/e2e_account_contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ContractAbi } from '@aztec/foundation/abi';
import { toBigInt } from '@aztec/foundation/serialize';
import { ChildAbi, EcdsaAccountContractAbi, SchnorrAccountContractAbi } from '@aztec/noir-contracts/examples';
import { PublicKey } from '@aztec/types';

import { randomBytes } from 'crypto';

import { setup } from './utils.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_deploy_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AztecNodeService } from '@aztec/aztec-node';
import { AztecRPCServer } from '@aztec/aztec-rpc';
import { AztecAddress, ContractDeployer, Fr } from '@aztec/aztec.js';
import { getContractDeploymentInfo } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';
import { TestContractAbi } from '@aztec/noir-contracts/examples';
import { TxStatus } from '@aztec/types';

import { setup } from './utils.js';
import { getContractDeploymentInfo } from '@aztec/circuits.js';

describe('e2e_deploy_contract', () => {
let aztecNode: AztecNodeService;
Expand Down
11 changes: 4 additions & 7 deletions yarn-project/foundation/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"trailingComma": "all",
"printWidth": 120,
"arrowParens": "avoid",
"importOrder": [
"^@aztec/(.*)$",
"<THIRD_PARTY_MODULES>",
"^\\.\/|\\.\\.\/"
],
"importOrder": ["^@aztec/(.*)$", "<THIRD_PARTY_MODULES>", "^\\./|\\.\\./"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
"importOrderSortSpecifiers": true,
"importOrderParserPlugins": ["importAssertions", "typescript"]
}
1 change: 1 addition & 0 deletions yarn-project/merkle-tree/src/interfaces/indexed_tree.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SiblingPath } from '@aztec/types';

import { LowLeafWitnessData } from '../index.js';
import { AppendOnlyTree } from './append_only_tree.js';

Expand Down
14 changes: 7 additions & 7 deletions yarn-project/noir-contracts/src/examples/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// TODO the verification keys in this contracts are mocked ATM
import { ContractAbi } from '@aztec/foundation/abi' assert { type: 'json' };
import { ContractAbi } from '@aztec/foundation/abi';

import TestContractJson from './test_contract.json' assert { type: 'json' };
import ZkTokenContractJson from './zk_token_contract.json' assert { type: 'json' };
import ParentJson from './parent_contract.json' assert { type: 'json' };
import ChildJson from './child_contract.json' assert { type: 'json' };
import PublicTokenContractJson from './public_token_contract.json' assert { type: 'json' };
import NonNativeTokenContractJson from './non_native_token_contract.json' assert { type: 'json' };
import EcdsaAccountContractJson from './ecdsa_account_contract.json' assert { type: 'json' };
import NonNativeTokenContractJson from './non_native_token_contract.json' assert { type: 'json' };
import ParentJson from './parent_contract.json' assert { type: 'json' };
import PendingCommitmentsContractJson from './pending_commitments_contract.json' assert { type: 'json' };
import PublicTokenContractJson from './public_token_contract.json' assert { type: 'json' };
import SchnorrAccountContractJson from './schnorr_account_contract.json' assert { type: 'json' };
import TestContractJson from './test_contract.json' assert { type: 'json' };
import UniswapContractJson from './uniswap_contract.json' assert { type: 'json' };
import PendingCommitmentsContractJson from './pending_commitments_contract.json' assert { type: 'json' };
import ZkTokenContractJson from './zk_token_contract.json' assert { type: 'json' };

export const TestContractAbi = TestContractJson as ContractAbi;
export const ZkTokenContractAbi = ZkTokenContractJson as ContractAbi;
Expand Down
1 change: 1 addition & 0 deletions yarn-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"prettier": "@aztec/foundation/prettier",
"devDependencies": {
"@monorepo-utils/workspaces-to-typescript-project-references": "^2.9.0",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"eslint": "^8.21.0",
"prettier": "^2.8.8",
"typedoc": "^0.23.26",
Expand Down
1 change: 1 addition & 0 deletions yarn-project/types/src/contract_dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ContractFunctionDao } from '@aztec/circuits.js';
import { ContractAbi, FunctionType, generateFunctionSelector } from '@aztec/foundation/abi';
import { AztecAddress } from '@aztec/foundation/aztec-address';
import { EthAddress } from '@aztec/foundation/eth-address';

import { EncodedContractFunction } from './contract_data.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CONTRACT_TREE_HEIGHT } from '@aztec/circuits.js';

import { SiblingPath } from '../sibling_path.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PRIVATE_DATA_TREE_HEIGHT } from '@aztec/circuits.js';

import { SiblingPath } from '../sibling_path.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Fr, L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/circuits.js';

import { L1ToL2MessageAndIndex } from '../l1_to_l2_message.js';
import { SiblingPath } from '../sibling_path.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env node

// Updates build manifest for a package based on a package.json

import { existsSync, readFileSync, writeFileSync } from 'fs';
import { basename, dirname, resolve, join } from 'path';
import { basename, dirname, join, resolve } from 'path';
import { cwd } from 'process';

// Update build_manifest.json with new dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env node

// Updates a package.json in the yarn-project folder based on inherits directives
// Run with --check to check for changes (exits with non-zero if any, useful for CI)

import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'fs';
import { resolve, dirname, join } from 'path';
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs';
import { dirname, join, resolve } from 'path';

const sources = {};
async function getSource(fullpath) {
Expand Down
Loading

0 comments on commit 3e3362c

Please sign in to comment.