From c100bb98e5bda5cbe593b8b8c3963d432b091836 Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 1 Nov 2023 17:25:12 +0000 Subject: [PATCH 1/3] don't use @aztec/types imports on e2e --- yarn-project/aztec.js/src/index.ts | 28 +++++++++++++-- yarn-project/end-to-end/.eslintrc.cjs | 36 ++++++++++++++++++- .../benchmarks/bench_process_history.test.ts | 5 +-- .../benchmarks/bench_publish_rollup.test.ts | 2 +- .../end-to-end/src/benchmarks/utils.ts | 16 ++++++--- .../end-to-end/src/cli_docs_sandbox.test.ts | 3 +- .../end-to-end/src/e2e_2_pxes.test.ts | 24 +++++++++---- .../src/e2e_account_contracts.test.ts | 6 ++-- .../end-to-end/src/e2e_block_building.test.ts | 7 ++-- .../end-to-end/src/e2e_card_game.test.ts | 4 +-- .../end-to-end/src/e2e_cheat_codes.test.ts | 4 +-- .../src/e2e_deploy_contract.test.ts | 18 +++++++--- .../src/e2e_escrow_contract.test.ts | 13 +++++-- .../src/e2e_lending_contract.test.ts | 8 +++-- .../e2e_multiple_accounts_1_enc_key.test.ts | 11 ++++-- .../src/e2e_nested_contract.test.ts | 6 +--- .../src/e2e_non_contract_account.test.ts | 18 +++++++--- .../end-to-end/src/e2e_ordering.test.ts | 7 +--- .../end-to-end/src/e2e_p2p_network.test.ts | 19 +++++++--- .../e2e_pending_commitments_contract.test.ts | 4 +-- .../e2e_public_cross_chain_messaging.test.ts | 23 +++++++----- .../e2e_public_to_private_messaging.test.ts | 8 ++--- .../src/e2e_sandbox_example.test.ts | 4 +-- .../end-to-end/src/e2e_token_contract.test.ts | 8 +++-- .../end-to-end/src/fixtures/logging.ts | 2 +- yarn-project/end-to-end/src/fixtures/utils.ts | 12 +++++-- .../src/guides/dapp_testing.test.ts | 4 +-- .../writing_an_account_contract.test.ts | 7 ++-- yarn-project/end-to-end/src/index.ts | 7 ++-- .../src/integration_archiver_l1_to_l2.test.ts | 15 +++++--- .../src/integration_l1_publisher.test.ts | 12 ++++--- .../src/shared/cross_chain_test_harness.ts | 2 +- yarn-project/end-to-end/src/shared/index.ts | 3 ++ .../src/simulators/lending_simulator.ts | 3 +- .../src/simulators/token_simulator.ts | 3 +- 35 files changed, 236 insertions(+), 116 deletions(-) create mode 100644 yarn-project/end-to-end/src/shared/index.ts diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index 351b350fb19..f93b3dcc89a 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -9,19 +9,38 @@ export * from './wallet/index.js'; // TODO https://github.com/AztecProtocol/aztec-packages/issues/2632 --> FunctionSelector might not need to be exposed // here once the issue is resolved. -export { AztecAddress, EthAddress, Point, Fr, FunctionSelector, GrumpkinScalar } from '@aztec/circuits.js'; export { + AztecAddress, + CircuitsWasm, + EthAddress, + Point, + Fr, + FunctionSelector, + GlobalVariables, + GrumpkinScalar, + getContractDeploymentInfo, +} from '@aztec/circuits.js'; +export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg'; + +export { + AuthWitness, + AztecNode, ContractData, DeployedContract, ExtendedContractData, ExtendedNote, FunctionCall, + INITIAL_L2_BLOCK_NUM, GrumpkinPrivateKey, + L2Actor, + L2Block, L2BlockL2Logs, LogFilter, + LogType, NodeInfo, Note, PackedArguments, + PartialAddress, PublicKey, PXE, SyncStatus, @@ -33,13 +52,18 @@ export { UnencryptedL2Log, emptyFunctionCall, createAztecNodeClient, + mockTx, } from '@aztec/types'; + export { ContractArtifact } from '@aztec/foundation/abi'; -export { createDebugLogger, DebugLogger } from '@aztec/foundation/log'; +export { DebugLogger, createDebugLogger, onLog } from '@aztec/foundation/log'; export { fileURLToPath } from '@aztec/foundation/url'; export { sleep } from '@aztec/foundation/sleep'; +export { elapsed } from '@aztec/foundation/timer'; export { retry, retryUntil } from '@aztec/foundation/retry'; export * from '@aztec/foundation/crypto'; +export { to2Fields, toBigInt } from '@aztec/foundation/serialize'; +export { toBigIntBE } from '@aztec/foundation/bigint-buffer'; export { deployL1Contract, diff --git a/yarn-project/end-to-end/.eslintrc.cjs b/yarn-project/end-to-end/.eslintrc.cjs index e659927475c..5ec691b10ff 100644 --- a/yarn-project/end-to-end/.eslintrc.cjs +++ b/yarn-project/end-to-end/.eslintrc.cjs @@ -1 +1,35 @@ -module.exports = require('@aztec/foundation/eslint'); +const baseConfig = require('@aztec/foundation/eslint'); + +const e2eConfig = { + overrides: [ + { + files: ['*.ts'], + rules: { + 'no-restricted-imports': [ + 'off', + { + name: '@aztec/types/stats', + }, + ], + }, + }, + { + files: ['*.ts'], + rules: { + 'no-restricted-imports': [ + 'error', + { + name: '@aztec/types', + message: + 'Please do not import from @aztec/types directly. Instead, export the required type from @aztec/aztec.js.', + }, + ], + }, + }, + ], +}; + +module.exports = { + ...baseConfig, + overrides: [...baseConfig.overrides, ...e2eConfig.overrides], +}; diff --git a/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts index 73a9532d940..b1c22f60e7f 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_process_history.test.ts @@ -1,10 +1,7 @@ import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node'; -import { Fr, GrumpkinScalar } from '@aztec/circuits.js'; -import { sleep } from '@aztec/foundation/sleep'; -import { elapsed } from '@aztec/foundation/timer'; +import { Fr, GrumpkinScalar, INITIAL_L2_BLOCK_NUM, elapsed, sleep } from '@aztec/aztec.js'; import { BenchmarkingContract } from '@aztec/noir-contracts/types'; import { SequencerClient } from '@aztec/sequencer-client'; -import { INITIAL_L2_BLOCK_NUM } from '@aztec/types'; import { BENCHMARK_HISTORY_BLOCK_SIZE, BENCHMARK_HISTORY_CHAIN_LENGTHS, diff --git a/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts index 921c780af00..7e191cee1b3 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_publish_rollup.test.ts @@ -1,5 +1,5 @@ import { AztecNodeService } from '@aztec/aztec-node'; -import { Fr, GrumpkinScalar } from '@aztec/circuits.js'; +import { Fr, GrumpkinScalar } from '@aztec/aztec.js'; import { BenchmarkingContract } from '@aztec/noir-contracts/types'; import { SequencerClient } from '@aztec/sequencer-client'; import { BENCHMARK_BLOCK_SIZES } from '@aztec/types/stats'; diff --git a/yarn-project/end-to-end/src/benchmarks/utils.ts b/yarn-project/end-to-end/src/benchmarks/utils.ts index bb09e27a10b..7e254b34c44 100644 --- a/yarn-project/end-to-end/src/benchmarks/utils.ts +++ b/yarn-project/end-to-end/src/benchmarks/utils.ts @@ -1,11 +1,17 @@ import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node'; -import { BatchCall, SentTx } from '@aztec/aztec.js'; -import { GrumpkinScalar } from '@aztec/circuits.js'; -import { retryUntil } from '@aztec/foundation/retry'; -import { sleep } from '@aztec/foundation/sleep'; +import { + AztecNode, + BatchCall, + GrumpkinScalar, + INITIAL_L2_BLOCK_NUM, + PXE, + PartialAddress, + SentTx, + retryUntil, + sleep, +} from '@aztec/aztec.js'; import { BenchmarkingContract } from '@aztec/noir-contracts/types'; import { PXEService, createPXEService } from '@aztec/pxe'; -import { AztecNode, INITIAL_L2_BLOCK_NUM, PXE, PartialAddress } from '@aztec/types'; import { mkdirpSync } from 'fs-extra'; import { globSync } from 'glob'; diff --git a/yarn-project/end-to-end/src/cli_docs_sandbox.test.ts b/yarn-project/end-to-end/src/cli_docs_sandbox.test.ts index 8a4af3d7c4b..551a6806001 100644 --- a/yarn-project/end-to-end/src/cli_docs_sandbox.test.ts +++ b/yarn-project/end-to-end/src/cli_docs_sandbox.test.ts @@ -1,6 +1,5 @@ -import { AztecAddress, createDebugLogger, sleep } from '@aztec/aztec.js'; +import { AztecAddress, TxHash, createDebugLogger, sleep } from '@aztec/aztec.js'; import { getProgram } from '@aztec/cli'; -import { TxHash } from '@aztec/types'; import stringArgv from 'string-argv'; diff --git a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts index 8039eeb8fc3..7a7aca6b0e6 100644 --- a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts @@ -1,10 +1,20 @@ -import { AztecAddress, Note, Wallet, computeMessageSecretHash } from '@aztec/aztec.js'; -import { DebugLogger } from '@aztec/foundation/log'; -import { retryUntil } from '@aztec/foundation/retry'; -import { toBigInt } from '@aztec/foundation/serialize'; +import { + AztecAddress, + AztecNode, + CompleteAddress, + DebugLogger, + EthAddress, + ExtendedNote, + Fr, + Note, + PXE, + TxStatus, + Wallet, + computeMessageSecretHash, + retryUntil, + toBigInt, +} from '@aztec/aztec.js'; import { ChildContract, TokenContract } from '@aztec/noir-contracts/types'; -import { EthAddress, Fr, PXEService } from '@aztec/pxe'; -import { AztecNode, CompleteAddress, ExtendedNote, PXE, TxStatus } from '@aztec/types'; import { jest } from '@jest/globals'; @@ -47,7 +57,7 @@ describe('e2e_2_pxes', () => { afterEach(async () => { await teardownA(); - if (pxeB instanceof PXEService) await pxeB.stop(); + if ((pxeB as any).stop) await (pxeB as any).stop(); }); const awaitUserSynchronized = async (wallet: Wallet, owner: AztecAddress) => { diff --git a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts index aaca09892b7..22106ed4f06 100644 --- a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts +++ b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts @@ -1,15 +1,17 @@ import { AccountContract, AccountManager, + CompleteAddress, EcdsaAccountContract, Fr, + GrumpkinPrivateKey, + GrumpkinScalar, PXE, SchnorrAccountContract, SingleKeyAccountContract, Wallet, + toBigInt, } from '@aztec/aztec.js'; -import { CompleteAddress, GrumpkinPrivateKey, GrumpkinScalar } from '@aztec/circuits.js'; -import { toBigInt } from '@aztec/foundation/serialize'; import { ChildContract } from '@aztec/noir-contracts/types'; import { randomBytes } from 'crypto'; diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index 7c04c24b6b8..1a2b49aa10c 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -1,17 +1,18 @@ import { BatchCall, + CircuitsWasm, ContractDeployer, ContractFunctionInteraction, + DebugLogger, Fr, + PXE, + TxStatus, Wallet, isContractDeployed, } from '@aztec/aztec.js'; -import { CircuitsWasm } from '@aztec/circuits.js'; import { pedersenHashInputs } from '@aztec/circuits.js/barretenberg'; -import { DebugLogger } from '@aztec/foundation/log'; import { TestContractArtifact } from '@aztec/noir-contracts/artifacts'; import { TestContract, TokenContract } from '@aztec/noir-contracts/types'; -import { PXE, TxStatus } from '@aztec/types'; import times from 'lodash.times'; diff --git a/yarn-project/end-to-end/src/e2e_card_game.test.ts b/yarn-project/end-to-end/src/e2e_card_game.test.ts index dc454de91c5..2b13e560420 100644 --- a/yarn-project/end-to-end/src/e2e_card_game.test.ts +++ b/yarn-project/end-to-end/src/e2e_card_game.test.ts @@ -1,13 +1,13 @@ import { AccountWallet, AztecAddress, + DebugLogger, + PXE, Wallet, deployInitialSandboxAccounts, getSandboxAccountsWallets, } from '@aztec/aztec.js'; -import { DebugLogger } from '@aztec/foundation/log'; import { CardGameContract } from '@aztec/noir-contracts/types'; -import { PXE } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts index a13f11b2deb..959a6485807 100644 --- a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts +++ b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts @@ -1,8 +1,6 @@ -import { CheatCodes, Wallet } from '@aztec/aztec.js'; +import { CheatCodes, EthAddress, TxStatus, Wallet } from '@aztec/aztec.js'; import { RollupAbi } from '@aztec/l1-artifacts'; import { TestContract } from '@aztec/noir-contracts/types'; -import { EthAddress } from '@aztec/pxe'; -import { TxStatus } from '@aztec/types'; import { Account, Chain, HttpTransport, PublicClient, WalletClient, getAddress, getContract, parseEther } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts index 6c640a8fa55..381f29785f8 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract.test.ts @@ -1,9 +1,19 @@ -import { AztecAddress, Contract, ContractDeployer, EthAddress, Fr, Wallet, isContractDeployed } from '@aztec/aztec.js'; -import { CompleteAddress, getContractDeploymentInfo } from '@aztec/circuits.js'; -import { DebugLogger } from '@aztec/foundation/log'; +import { + AztecAddress, + CompleteAddress, + Contract, + ContractDeployer, + DebugLogger, + EthAddress, + Fr, + PXE, + TxStatus, + Wallet, + getContractDeploymentInfo, + isContractDeployed, +} from '@aztec/aztec.js'; import { TestContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts/artifacts'; import { SequencerClient } from '@aztec/sequencer-client'; -import { PXE, TxStatus } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts index 968a8a4b775..aac0dae8adc 100644 --- a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts @@ -2,15 +2,22 @@ import { AccountWallet, AztecAddress, BatchCall, + CompleteAddress, + DebugLogger, + ExtendedNote, + Fr, + GrumpkinPrivateKey, + GrumpkinScalar, Note, + PXE, + PublicKey, + TxStatus, computeMessageSecretHash, generatePublicKey, + getContractDeploymentInfo, } from '@aztec/aztec.js'; -import { CompleteAddress, Fr, GrumpkinPrivateKey, GrumpkinScalar, getContractDeploymentInfo } from '@aztec/circuits.js'; -import { DebugLogger } from '@aztec/foundation/log'; import { EscrowContractArtifact } from '@aztec/noir-contracts/artifacts'; import { EscrowContract, TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote, PXE, PublicKey, TxStatus } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 9fe151d549a..7cb444bc2d3 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -1,15 +1,17 @@ import { AccountWallet, CheatCodes, + CompleteAddress, + DebugLogger, + ExtendedNote, Fr, + Note, SentTx, + TxStatus, computeAuthWitMessageHash, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { CompleteAddress } from '@aztec/circuits.js'; -import { DebugLogger } from '@aztec/foundation/log'; import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote, Note, TxStatus } from '@aztec/types'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index 1222245d6ea..c33691c42a2 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -1,16 +1,21 @@ import { AztecAddress, + AztecNode, + CompleteAddress, + DebugLogger, + ExtendedNote, + Fr, + GrumpkinScalar, Note, + PXE, + TxStatus, Wallet, computeMessageSecretHash, generatePublicKey, getSandboxAccountsWallets, getSchnorrAccount, } from '@aztec/aztec.js'; -import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; -import { DebugLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts/types'; -import { AztecNode, CompleteAddress, ExtendedNote, PXE, TxStatus } from '@aztec/types'; import { expectsNumOfEncryptedLogsInTheLastBlockToBe, setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts index 0abd5912844..ceb9b5a2d1a 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts @@ -1,9 +1,5 @@ -import { AztecAddress, BatchCall, Fr, Wallet } from '@aztec/aztec.js'; -import { toBigIntBE } from '@aztec/foundation/bigint-buffer'; -import { DebugLogger } from '@aztec/foundation/log'; -import { toBigInt } from '@aztec/foundation/serialize'; +import { AztecAddress, BatchCall, DebugLogger, Fr, PXE, Wallet, toBigInt, toBigIntBE } from '@aztec/aztec.js'; import { ChildContract, ImportTestContract, ParentContract, TestContract } from '@aztec/noir-contracts/types'; -import { PXE } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts index f0f52a8ba3d..3844c39aac5 100644 --- a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts +++ b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts @@ -1,10 +1,18 @@ -import { SignerlessWallet, Wallet } from '@aztec/aztec.js'; -import { CircuitsWasm, Fr } from '@aztec/circuits.js'; +import { + AztecNode, + CircuitsWasm, + DebugLogger, + ExtendedNote, + Fr, + Note, + PXE, + SignerlessWallet, + TxStatus, + Wallet, + toBigInt, +} from '@aztec/aztec.js'; import { siloNullifier } from '@aztec/circuits.js/abis'; -import { DebugLogger } from '@aztec/foundation/log'; -import { toBigInt } from '@aztec/foundation/serialize'; import { TestContract } from '@aztec/noir-contracts/types'; -import { AztecNode, ExtendedNote, Note, PXE, TxStatus } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_ordering.test.ts b/yarn-project/end-to-end/src/e2e_ordering.test.ts index d0b9f902840..584fe0959a3 100644 --- a/yarn-project/end-to-end/src/e2e_ordering.test.ts +++ b/yarn-project/end-to-end/src/e2e_ordering.test.ts @@ -1,11 +1,6 @@ // Test suite for testing proper ordering of side effects -import { Wallet } from '@aztec/aztec.js'; -import { FunctionSelector } from '@aztec/circuits.js'; -import { toBigIntBE } from '@aztec/foundation/bigint-buffer'; -import { Fr } from '@aztec/foundation/fields'; -import { toBigInt } from '@aztec/foundation/serialize'; +import { Fr, FunctionSelector, PXE, TxStatus, Wallet, toBigInt, toBigIntBE } from '@aztec/aztec.js'; import { ChildContract, ParentContract } from '@aztec/noir-contracts/types'; -import { PXE, TxStatus } from '@aztec/types'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts index 73da8ffd63a..f5cb8042091 100644 --- a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts @@ -1,12 +1,21 @@ import { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node'; -import { ContractDeployer, DeploySentTx, Wallet, isContractDeployed } from '@aztec/aztec.js'; -import { AztecAddress, CompleteAddress, Fr, PublicKey, getContractDeploymentInfo } from '@aztec/circuits.js'; -import { Grumpkin } from '@aztec/circuits.js/barretenberg'; -import { DebugLogger } from '@aztec/foundation/log'; +import { + AztecAddress, + CompleteAddress, + ContractDeployer, + DebugLogger, + DeploySentTx, + Fr, + Grumpkin, + PublicKey, + TxStatus, + Wallet, + getContractDeploymentInfo, + isContractDeployed, +} from '@aztec/aztec.js'; import { TestContractArtifact } from '@aztec/noir-contracts/artifacts'; import { BootstrapNode, P2PConfig, createLibP2PPeerId } from '@aztec/p2p'; import { ConstantKeyPair, PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe'; -import { TxStatus } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts index ab302a59541..509ce526bc4 100644 --- a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts @@ -1,7 +1,5 @@ -import { AztecAddress, Fr, Wallet } from '@aztec/aztec.js'; -import { DebugLogger } from '@aztec/foundation/log'; +import { AztecAddress, AztecNode, CompleteAddress, DebugLogger, Fr, TxStatus, Wallet } from '@aztec/aztec.js'; import { PendingCommitmentsContract } from '@aztec/noir-contracts/types'; -import { AztecNode, CompleteAddress, TxStatus } from '@aztec/types'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts b/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts index d42b21af784..3c906d017fc 100644 --- a/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts +++ b/yarn-project/end-to-end/src/e2e_public_cross_chain_messaging.test.ts @@ -1,11 +1,16 @@ -import { AccountWallet, AztecAddress, computeAuthWitMessageHash } from '@aztec/aztec.js'; -import { EthAddress } from '@aztec/foundation/eth-address'; -import { Fr } from '@aztec/foundation/fields'; -import { DebugLogger } from '@aztec/foundation/log'; +import { + AccountWallet, + AztecAddress, + DebugLogger, + EthAddress, + Fr, + TxStatus, + computeAuthWitMessageHash, + sleep, +} from '@aztec/aztec.js'; import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; -import { TxStatus } from '@aztec/types'; -import { delay, setup } from './fixtures/utils.js'; +import { setup } from './fixtures/utils.js'; import { CrossChainTestHarness } from './shared/cross_chain_test_harness.js'; describe('e2e_public_cross_chain_messaging', () => { @@ -64,7 +69,7 @@ describe('e2e_public_cross_chain_messaging', () => { expect(await crossChainTestHarness.getL1BalanceOf(ethAccount)).toBe(l1TokenBalance - bridgeAmount); // Wait for the archiver to process the message - await delay(5000); /// waiting 5 seconds. + await sleep(5000); /// waiting 5 seconds. // Perform an unrelated transaction on L2 to progress the rollup. Here we mint public tokens. const unrelatedMintAmount = 99n; @@ -117,7 +122,7 @@ describe('e2e_public_cross_chain_messaging', () => { expect(await crossChainTestHarness.getL1BalanceOf(ethAccount)).toBe(l1TokenBalance - bridgeAmount); // Wait for the archiver to process the message - await delay(5000); /// waiting 5 seconds. + await sleep(5000); /// waiting 5 seconds. // Perform an unrelated transaction on L2 to progress the rollup. Here we mint public tokens. const unrelatedMintAmount = 99n; @@ -169,7 +174,7 @@ describe('e2e_public_cross_chain_messaging', () => { expect(await crossChainTestHarness.getL1BalanceOf(ethAccount)).toBe(0n); // Wait for the archiver to process the message - await delay(5000); /// waiting 5 seconds. + await sleep(5000); /// waiting 5 seconds. // Perform an unrelated transaction on L2 to progress the rollup. Here we mint public tokens. await crossChainTestHarness.mintTokensPublicOnL2(0n); diff --git a/yarn-project/end-to-end/src/e2e_public_to_private_messaging.test.ts b/yarn-project/end-to-end/src/e2e_public_to_private_messaging.test.ts index 87bfafa399f..5fed92844e4 100644 --- a/yarn-project/end-to-end/src/e2e_public_to_private_messaging.test.ts +++ b/yarn-project/end-to-end/src/e2e_public_to_private_messaging.test.ts @@ -1,8 +1,6 @@ -import { AztecAddress } from '@aztec/aztec.js'; -import { EthAddress } from '@aztec/circuits.js'; -import { DebugLogger } from '@aztec/foundation/log'; +import { AztecAddress, DebugLogger, EthAddress, sleep } from '@aztec/aztec.js'; -import { delay, setup } from './fixtures/utils.js'; +import { setup } from './fixtures/utils.js'; import { CrossChainTestHarness } from './shared/cross_chain_test_harness.js'; describe('e2e_public_to_private_messaging', () => { @@ -53,7 +51,7 @@ describe('e2e_public_to_private_messaging', () => { expect(await underlyingERC20.read.balanceOf([ethAccount.toString()])).toBe(l1TokenBalance - bridgeAmount); // Wait for the archiver to process the message - await delay(5000); /// waiting 5 seconds. + await sleep(5000); /// waiting 5 seconds. // Perform another unrelated transaction on L2 to progress the rollup. const initialBalance = 1n; diff --git a/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts b/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts index 0d1cb02d933..782e17a4619 100644 --- a/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts +++ b/yarn-project/end-to-end/src/e2e_sandbox_example.test.ts @@ -1,6 +1,8 @@ // docs:start:imports import { + ExtendedNote, Fr, + GrumpkinScalar, Note, PXE, computeMessageSecretHash, @@ -10,9 +12,7 @@ import { getSchnorrAccount, waitForSandbox, } from '@aztec/aztec.js'; -import { GrumpkinScalar } from '@aztec/circuits.js'; import { TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote } from '@aztec/types'; import { format } from 'util'; diff --git a/yarn-project/end-to-end/src/e2e_token_contract.test.ts b/yarn-project/end-to-end/src/e2e_token_contract.test.ts index 34c9a3d7bfc..327b781cdd5 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract.test.ts @@ -1,15 +1,17 @@ import { AccountWallet, + CompleteAddress, + DebugLogger, + ExtendedNote, + Fr, + FunctionSelector, Note, TxHash, TxStatus, computeAuthWitMessageHash, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { CompleteAddress, Fr, FunctionSelector } from '@aztec/circuits.js'; -import { DebugLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote } from '@aztec/types'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/fixtures/logging.ts b/yarn-project/end-to-end/src/fixtures/logging.ts index 54adc31866a..03d3caacf29 100644 --- a/yarn-project/end-to-end/src/fixtures/logging.ts +++ b/yarn-project/end-to-end/src/fixtures/logging.ts @@ -1,4 +1,4 @@ -import { onLog } from '@aztec/foundation/log'; +import { onLog } from '@aztec/aztec.js'; import { mkdirpSync } from 'fs-extra'; import { dirname } from 'path'; diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 6b405775ad3..e2056369a18 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -1,18 +1,25 @@ import { AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node'; import { AccountWalletWithPrivateKey, + AztecNode, CheatCodes, CompleteAddress, DebugLogger, + DeployL1Contracts, EthCheatCodes, + L1ContractArtifactsForDeployment, + L2BlockL2Logs, + LogType, + PXE, SentTx, createAccounts, + createAztecNodeClient, createDebugLogger, createPXEClient, + deployL1Contracts, getSandboxAccountsWallets, + retryUntil, } from '@aztec/aztec.js'; -import { DeployL1Contracts, L1ContractArtifactsForDeployment, deployL1Contracts } from '@aztec/ethereum'; -import { retryUntil } from '@aztec/foundation/retry'; import { ContractDeploymentEmitterAbi, ContractDeploymentEmitterBytecode, @@ -29,7 +36,6 @@ import { } from '@aztec/l1-artifacts'; import { PXEService, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; import { SequencerClient } from '@aztec/sequencer-client'; -import { AztecNode, L2BlockL2Logs, LogType, PXE, createAztecNodeClient } from '@aztec/types'; import * as path from 'path'; import { diff --git a/yarn-project/end-to-end/src/guides/dapp_testing.test.ts b/yarn-project/end-to-end/src/guides/dapp_testing.test.ts index d4b87f6d81f..269f4c88bd1 100644 --- a/yarn-project/end-to-end/src/guides/dapp_testing.test.ts +++ b/yarn-project/end-to-end/src/guides/dapp_testing.test.ts @@ -2,6 +2,7 @@ import { createSandbox } from '@aztec/aztec-sandbox'; import { AccountWallet, CheatCodes, + ExtendedNote, Fr, Note, PXE, @@ -9,11 +10,10 @@ import { createAccount, createPXEClient, getSandboxAccountsWallets, + toBigIntBE, waitForSandbox, } from '@aztec/aztec.js'; -import { toBigIntBE } from '@aztec/foundation/bigint-buffer'; import { TestContract, TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote } from '@aztec/types'; const { PXE_URL = 'http://localhost:8080', ETHEREUM_HOST = 'http://localhost:8545' } = process.env; diff --git a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts index e87c7af4970..abec6f2b1ed 100644 --- a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts +++ b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts @@ -1,16 +1,17 @@ import { AccountManager, + AuthWitness, AuthWitnessProvider, BaseAccountContract, CompleteAddress, + ExtendedNote, Fr, + GrumpkinPrivateKey, + GrumpkinScalar, Note, computeMessageSecretHash, } from '@aztec/aztec.js'; -import { GrumpkinPrivateKey, GrumpkinScalar } from '@aztec/circuits.js'; -import { Schnorr } from '@aztec/circuits.js/barretenberg'; import { SchnorrHardcodedAccountContractArtifact, TokenContract } from '@aztec/noir-contracts/types'; -import { AuthWitness, ExtendedNote } from '@aztec/types'; import { setup } from '../fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/index.ts b/yarn-project/end-to-end/src/index.ts index a6286441418..295e1a453f7 100644 --- a/yarn-project/end-to-end/src/index.ts +++ b/yarn-project/end-to-end/src/index.ts @@ -1,5 +1,2 @@ -// Should only export tests from the canary directory - -export { cliTestSuite } from './shared/cli.js'; -export { browserTestSuite } from './shared/browser.js'; -export { uniswapL1L2TestSuite, UniswapSetupContext } from './shared/uniswap_l1_l2.js'; +// Should only export tests from the shared directory +export * from './shared/index.js'; diff --git a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts index eb1fe393d18..648db721679 100644 --- a/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts +++ b/yarn-project/end-to-end/src/integration_archiver_l1_to_l2.test.ts @@ -1,10 +1,15 @@ import { Archiver } from '@aztec/archiver'; import { AztecNodeConfig } from '@aztec/aztec-node'; -import { AztecAddress, CompleteAddress, Wallet, computeMessageSecretHash } from '@aztec/aztec.js'; -import { DeployL1Contracts } from '@aztec/ethereum'; -import { EthAddress } from '@aztec/foundation/eth-address'; -import { Fr } from '@aztec/foundation/fields'; -import { DebugLogger } from '@aztec/foundation/log'; +import { + AztecAddress, + CompleteAddress, + DebugLogger, + DeployL1Contracts, + EthAddress, + Fr, + Wallet, + computeMessageSecretHash, +} from '@aztec/aztec.js'; import { TokenContract } from '@aztec/noir-contracts/types'; import { Chain, HttpTransport, PublicClient } from 'viem'; diff --git a/yarn-project/end-to-end/src/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/integration_l1_publisher.test.ts index 9d9a6cb337b..8a9fc751d7d 100644 --- a/yarn-project/end-to-end/src/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/integration_l1_publisher.test.ts @@ -1,7 +1,15 @@ import { getConfigEnvVars } from '@aztec/aztec-node'; import { AztecAddress, + Fr, GlobalVariables, + L2Actor, + L2Block, + createDebugLogger, + mockTx, + to2Fields, +} from '@aztec/aztec.js'; +import { KernelCircuitPublicInputs, MAX_NEW_COMMITMENTS_PER_TX, MAX_NEW_L2_TO_L1_MSGS_PER_TX, @@ -14,9 +22,6 @@ import { } from '@aztec/circuits.js'; import { fr, makeNewContractData, makeProof } from '@aztec/circuits.js/factories'; import { createEthereumChain } from '@aztec/ethereum'; -import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; -import { to2Fields } from '@aztec/foundation/serialize'; import { DecoderHelperAbi, InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts'; import { EmptyRollupProver, @@ -29,7 +34,6 @@ import { makeEmptyProcessedTx as makeEmptyProcessedTxFromHistoricTreeRoots, makeProcessedTx, } from '@aztec/sequencer-client'; -import { L2Actor, L2Block, mockTx } from '@aztec/types'; import { MerkleTreeOperations, MerkleTrees } from '@aztec/world-state'; import { beforeEach, describe, expect, it } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts index e2461928511..952190af5b0 100644 --- a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts @@ -3,6 +3,7 @@ import { AztecAddress, DebugLogger, EthAddress, + ExtendedNote, Fr, Note, PXE, @@ -21,7 +22,6 @@ import { TokenPortalBytecode, } from '@aztec/l1-artifacts'; import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts/types'; -import { ExtendedNote } from '@aztec/types'; import { Account, Chain, HttpTransport, PublicClient, WalletClient, getContract, getFunctionSelector } from 'viem'; diff --git a/yarn-project/end-to-end/src/shared/index.ts b/yarn-project/end-to-end/src/shared/index.ts new file mode 100644 index 00000000000..4c6d1eef910 --- /dev/null +++ b/yarn-project/end-to-end/src/shared/index.ts @@ -0,0 +1,3 @@ +export { cliTestSuite } from './cli.js'; +export { browserTestSuite } from './browser.js'; +export { uniswapL1L2TestSuite, UniswapSetupContext } from './uniswap_l1_l2.js'; diff --git a/yarn-project/end-to-end/src/simulators/lending_simulator.ts b/yarn-project/end-to-end/src/simulators/lending_simulator.ts index 17cfa0ddc03..159a606628f 100644 --- a/yarn-project/end-to-end/src/simulators/lending_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/lending_simulator.ts @@ -1,6 +1,5 @@ // Convenience struct to hold an account's address and secret that can easily be passed around. -import { CheatCodes } from '@aztec/aztec.js'; -import { AztecAddress, CircuitsWasm, Fr } from '@aztec/circuits.js'; +import { AztecAddress, CheatCodes, CircuitsWasm, Fr } from '@aztec/aztec.js'; import { pedersenHashInputs } from '@aztec/circuits.js/barretenberg'; import { LendingContract } from '@aztec/noir-contracts/types'; diff --git a/yarn-project/end-to-end/src/simulators/token_simulator.ts b/yarn-project/end-to-end/src/simulators/token_simulator.ts index b28c5480d6e..3701d02df5e 100644 --- a/yarn-project/end-to-end/src/simulators/token_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/token_simulator.ts @@ -1,6 +1,5 @@ /* eslint-disable jsdoc/require-jsdoc */ -import { DebugLogger } from '@aztec/aztec.js'; -import { AztecAddress } from '@aztec/circuits.js'; +import { AztecAddress, DebugLogger } from '@aztec/aztec.js'; import { TokenContract } from '@aztec/noir-contracts/types'; export class TokenSimulator { From 4cfed27e37ecb6b3f652cefbff39dd79eb1625ac Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 1 Nov 2023 17:26:33 +0000 Subject: [PATCH 2/3] add MerkleTreeId --- yarn-project/aztec.js/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index f93b3dcc89a..ee1572613ee 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -37,6 +37,7 @@ export { L2BlockL2Logs, LogFilter, LogType, + MerkleTreeId, NodeInfo, Note, PackedArguments, @@ -52,6 +53,7 @@ export { UnencryptedL2Log, emptyFunctionCall, createAztecNodeClient, + merkleTreeIds, mockTx, } from '@aztec/types'; From fd102a16b731319168ee5c63bd06d06775e82980 Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 1 Nov 2023 17:48:13 +0000 Subject: [PATCH 3/3] Schnorr dependency --- .../end-to-end/src/guides/writing_an_account_contract.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts index abec6f2b1ed..890936886fa 100644 --- a/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts +++ b/yarn-project/end-to-end/src/guides/writing_an_account_contract.test.ts @@ -9,6 +9,7 @@ import { GrumpkinPrivateKey, GrumpkinScalar, Note, + Schnorr, computeMessageSecretHash, } from '@aztec/aztec.js'; import { SchnorrHardcodedAccountContractArtifact, TokenContract } from '@aztec/noir-contracts/types';