@aztec/end-to-end 5.0.0-rc.2 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -27
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +17 -24
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +22 -28
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +3 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +16 -4
- package/dest/bench/utils.d.ts +1 -1
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.d.ts +10 -7
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +30 -11
- package/dest/fixtures/fixtures.d.ts +9 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +11 -7
- package/dest/fixtures/ha_setup.d.ts +3 -3
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +4 -1
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +34 -9
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +165 -160
- package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
- package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
- package/dest/fixtures/standard_contracts_genesis.js +25 -0
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_service.js +1 -1
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +9 -1
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +26 -1
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -15
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/shared/cross_chain_test_harness.d.ts +3 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +24 -16
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -5
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +158 -47
- package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.js +74 -26
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +9 -6
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +121 -45
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +13 -7
- package/dest/spartan/tx_metrics.d.ts +10 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +32 -0
- package/dest/test-wallet/test_wallet.d.ts +23 -4
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +20 -4
- package/dest/test-wallet/utils.d.ts +36 -1
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +64 -4
- package/dest/test-wallet/wallet_worker_script.js +5 -2
- package/dest/test-wallet/worker_wallet.d.ts +5 -5
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +2 -2
- package/dest/test-wallet/worker_wallet_schema.js +2 -1
- package/package.json +40 -40
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +19 -39
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -43
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +3 -1
- package/src/bench/client_flows/client_flows_benchmark.ts +17 -4
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/e2e_prover_test.ts +36 -20
- package/src/fixtures/fixtures.ts +11 -7
- package/src/fixtures/ha_setup.ts +7 -3
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +204 -162
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_service.ts +2 -2
- package/src/infra/README.md +12 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +26 -0
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -14
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +22 -13
- package/src/shared/gas_portal_test_harness.ts +13 -5
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +152 -48
- package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
- package/src/single-node/README.md +66 -0
- package/src/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.ts +100 -38
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +11 -7
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +132 -47
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +19 -7
- package/src/spartan/tx_metrics.ts +26 -0
- package/src/test-wallet/test_wallet.ts +28 -6
- package/src/test-wallet/utils.ts +102 -5
- package/src/test-wallet/wallet_worker_script.ts +6 -3
- package/src/test-wallet/worker_wallet.ts +5 -9
- package/src/test-wallet/worker_wallet_schema.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -59
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -42
- package/dest/e2e_epochs/epochs_test.d.ts +0 -137
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -485
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -89
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -57
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -22
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -138
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -100
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -257
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_deploy_contract/deploy_test.ts +0 -73
- package/src/e2e_epochs/epochs_test.ts +0 -596
- package/src/e2e_l1_publisher/write_json.ts +0 -78
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -51
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -181
- package/src/e2e_p2p/shared.ts +0 -391
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
package/src/fixtures/ha_setup.ts
CHANGED
|
@@ -18,8 +18,8 @@ export interface HADatabaseConfig {
|
|
|
18
18
|
haSigningEnabled: boolean;
|
|
19
19
|
/** Polling interval in ms */
|
|
20
20
|
pollingIntervalMs: number;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/** How long to wait for a peer node's in-progress signing in ms */
|
|
22
|
+
peerSigningTimeoutMs: number;
|
|
23
23
|
/** Max stuck duties age in ms */
|
|
24
24
|
maxStuckDutiesAgeMs: number;
|
|
25
25
|
}
|
|
@@ -37,7 +37,7 @@ export function createHADatabaseConfig(nodeId: string): HADatabaseConfig {
|
|
|
37
37
|
nodeId,
|
|
38
38
|
haSigningEnabled: true,
|
|
39
39
|
pollingIntervalMs: 100,
|
|
40
|
-
|
|
40
|
+
peerSigningTimeoutMs: 3000,
|
|
41
41
|
maxStuckDutiesAgeMs: 72000,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -54,6 +54,10 @@ export function setupHADatabase(databaseUrl: string, logger?: Logger): Pool {
|
|
|
54
54
|
// Migrations are already run by docker-compose entrypoint before tests start
|
|
55
55
|
const pool = new Pool({ connectionString: databaseUrl });
|
|
56
56
|
|
|
57
|
+
// pg-pool re-emits idle-client errors on the pool; with no listener the emit throws - in production this crashes
|
|
58
|
+
// the validator process.
|
|
59
|
+
pool.on('error', (err: Error) => logger?.warn(`HA database pool error: ${err.message}`));
|
|
60
|
+
|
|
57
61
|
logger?.info('Connected to HA database (migrations should already be applied)');
|
|
58
62
|
|
|
59
63
|
return pool;
|
package/src/fixtures/index.ts
CHANGED
package/src/fixtures/setup.ts
CHANGED
|
@@ -22,22 +22,22 @@ import {
|
|
|
22
22
|
deployAztecL1Contracts,
|
|
23
23
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
24
24
|
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
25
|
-
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
25
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
|
|
26
26
|
import type { Anvil } from '@aztec/ethereum/test';
|
|
27
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
27
28
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
28
29
|
import { SecretValue } from '@aztec/foundation/config';
|
|
29
30
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
30
31
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
31
32
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
32
33
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
33
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
34
34
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
35
35
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
36
36
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
37
37
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
38
38
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
39
39
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
40
|
-
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
40
|
+
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
41
41
|
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
42
42
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
43
43
|
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
@@ -77,6 +77,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
|
|
|
77
77
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
78
78
|
import { getBBConfig } from './get_bb_config.js';
|
|
79
79
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
80
|
+
import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
|
|
81
|
+
import { testSpan } from './timing.js';
|
|
80
82
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
81
83
|
|
|
82
84
|
export { startAnvil };
|
|
@@ -152,7 +154,7 @@ export async function setupPXEAndGetWallet(
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
/** Options for the e2e tests setup */
|
|
155
|
-
export type SetupOptions = {
|
|
157
|
+
export type SetupOptions<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
156
158
|
/** State load */
|
|
157
159
|
stateLoad?: string;
|
|
158
160
|
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
@@ -184,8 +186,26 @@ export type SetupOptions = {
|
|
|
184
186
|
mockGossipSubNetwork?: boolean;
|
|
185
187
|
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
186
188
|
mockGossipSubNetworkLatency?: number;
|
|
187
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Whether to mine the L1 setup txs (Multicall3 + rollup contract deployment) under anvil automine
|
|
191
|
+
* instead of waiting on the block interval. Defaults to `true` (set in `setupInner`); only suites
|
|
192
|
+
* that assert on genesis-relative L1 timing need to opt out with `false`.
|
|
193
|
+
*/
|
|
188
194
|
automineL1Setup?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Hook invoked after the Aztec L1 rollup contracts are deployed but BEFORE the node/sequencer
|
|
197
|
+
* start, while anvil automine is still enabled (when `automineL1Setup` is true, the default).
|
|
198
|
+
* Deploy extra L1 contracts a test needs here (e.g. a cross-chain token portal + ERC20) so they
|
|
199
|
+
* mine instantly under automine instead of paying the L1 block interval once the node is running
|
|
200
|
+
* (and racing the live sequencer/archiver). The resolved value is exposed on the returned context
|
|
201
|
+
* as `extraL1DeployResult`. The hook receives setup's L1 deployer client (the same one used to
|
|
202
|
+
* deploy Multicall3).
|
|
203
|
+
*/
|
|
204
|
+
deployExtraL1Contracts?: (deps: {
|
|
205
|
+
l1Client: ExtendedViemWalletClient;
|
|
206
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
207
|
+
logger: Logger;
|
|
208
|
+
}) => Promise<TDeployExtraL1ContractsReturnType>;
|
|
189
209
|
/** How many accounts to seed and unlock in anvil. */
|
|
190
210
|
anvilAccounts?: number;
|
|
191
211
|
/** Port to start anvil (defaults to 8545) */
|
|
@@ -202,10 +222,13 @@ export type SetupOptions = {
|
|
|
202
222
|
/** Whether to fund the sponsored FPC in genesis (defaults to false). */
|
|
203
223
|
fundSponsoredFPC?: boolean;
|
|
204
224
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
225
|
+
* Compute extra addresses to fund at genesis from the accounts setup just generated (passed as the
|
|
226
|
+
* argument). Runs after the default accounts are created and before genesis values are computed, so a
|
|
227
|
+
* test can genesis-fund a contract whose address derives from a default account (e.g. an FPC whose
|
|
228
|
+
* admin is the first account) instead of bridging fee juice to it during setup. Each returned address
|
|
229
|
+
* is funded with the same fee juice as an initial account and included in the L1 portal `fundingNeeded`.
|
|
207
230
|
*/
|
|
208
|
-
|
|
231
|
+
computeExtraGenesisFundedAddresses?: (defaultAccounts: InitialAccountData[]) => Promise<AztecAddress[]>;
|
|
209
232
|
/** L1 contracts deployment arguments. */
|
|
210
233
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
211
234
|
/** Wallet minimum fee padding multiplier */
|
|
@@ -221,7 +244,7 @@ export type SetupOptions = {
|
|
|
221
244
|
} & Partial<AztecNodeConfig>;
|
|
222
245
|
|
|
223
246
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
224
|
-
export type EndToEndContext = {
|
|
247
|
+
export type EndToEndContext<TDeployExtraL1ContractsReturnType = unknown> = {
|
|
225
248
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
226
249
|
anvil: Anvil | undefined;
|
|
227
250
|
/** The Aztec Node service or client a connected to it. */
|
|
@@ -264,6 +287,8 @@ export type EndToEndContext = {
|
|
|
264
287
|
proverDelayer: Delayer | undefined;
|
|
265
288
|
/** Genesis data used for setting up nodes. */
|
|
266
289
|
genesis: GenesisData | undefined;
|
|
290
|
+
/** Resolved value of the `deployExtraL1Contracts` setup hook, if one was provided. */
|
|
291
|
+
extraL1DeployResult: TDeployExtraL1ContractsReturnType;
|
|
267
292
|
/** ACVM config (only set if running locally). */
|
|
268
293
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
269
294
|
/** BB config (only set if running locally). */
|
|
@@ -300,48 +325,49 @@ function assertContractArtifactsVersion() {
|
|
|
300
325
|
}
|
|
301
326
|
}
|
|
302
327
|
|
|
303
|
-
/**
|
|
304
|
-
* Records a function-level timing span into the shared collector installed by the e2e timing
|
|
305
|
-
* environment. No-op unless TEST_TIMING_FILE is set (the env only installs the collector then). The
|
|
306
|
-
* span is tagged with the name of the currently running test so the env can attribute it to the
|
|
307
|
-
* right line; `null` during beforeAll/afterAll lands it on the suite-scoped line.
|
|
308
|
-
*/
|
|
309
|
-
function recordFnSpan(kind: 'setup' | 'teardown', ms: number) {
|
|
310
|
-
const collector = (globalThis as { __e2eTimings?: { current: string | null; fnSpans: unknown[] } }).__e2eTimings;
|
|
311
|
-
collector?.fnSpans.push({ name: collector.current, kind, ms });
|
|
312
|
-
}
|
|
313
|
-
|
|
314
328
|
/**
|
|
315
329
|
* Sets up the environment for the end-to-end tests.
|
|
316
330
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
317
331
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
318
332
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
319
333
|
*/
|
|
320
|
-
export
|
|
334
|
+
export function setup<TDeployExtraL1ContractsReturnType = unknown>(
|
|
321
335
|
numberOfAccounts = 1,
|
|
322
|
-
opts: SetupOptions = {},
|
|
336
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType> = {},
|
|
323
337
|
pxeOpts: Partial<PXEConfig> = {},
|
|
324
338
|
chain: Chain = foundry,
|
|
325
|
-
): Promise<EndToEndContext
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
339
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
340
|
+
// Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
|
|
341
|
+
// swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
|
|
342
|
+
// (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
|
|
343
|
+
const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
|
|
344
|
+
return testSpan(`setup:env:${proverMode}`, async () => {
|
|
345
|
+
const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
|
|
346
|
+
if (process.env.EXIT_E2E_AFTER_SETUP) {
|
|
347
|
+
ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
|
|
348
|
+
throw new Error('EXIT_E2E_AFTER_SETUP');
|
|
349
|
+
}
|
|
350
|
+
return ctx;
|
|
351
|
+
});
|
|
332
352
|
}
|
|
333
353
|
|
|
334
|
-
async function setupInner(
|
|
354
|
+
async function setupInner<TDeployExtraL1ContractsReturnType = unknown>(
|
|
335
355
|
numberOfAccounts: number,
|
|
336
|
-
opts: SetupOptions
|
|
356
|
+
opts: SetupOptions<TDeployExtraL1ContractsReturnType>,
|
|
337
357
|
pxeOpts: Partial<PXEConfig>,
|
|
338
358
|
chain: Chain,
|
|
339
|
-
): Promise<EndToEndContext
|
|
359
|
+
): Promise<EndToEndContext<TDeployExtraL1ContractsReturnType>> {
|
|
340
360
|
assertContractArtifactsVersion();
|
|
361
|
+
const logger = getLogger();
|
|
341
362
|
let anvil: Anvil | undefined;
|
|
342
363
|
try {
|
|
343
364
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
344
365
|
opts.slasherEnabled ??= false;
|
|
366
|
+
// Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
|
|
367
|
+
// waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
|
|
368
|
+
// assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
|
|
369
|
+
opts.automineL1Setup ??= true;
|
|
370
|
+
logger.trace('Starting e2e test setup');
|
|
345
371
|
|
|
346
372
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
347
373
|
// use initialValidators for the node config
|
|
@@ -357,8 +383,6 @@ async function setupInner(
|
|
|
357
383
|
|
|
358
384
|
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
359
385
|
|
|
360
|
-
const logger = getLogger();
|
|
361
|
-
|
|
362
386
|
// Create a temp directory for any services that need it and cleanup later
|
|
363
387
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
364
388
|
await fs.mkdir(directoryToCleanup, { recursive: true });
|
|
@@ -372,16 +396,19 @@ async function setupInner(
|
|
|
372
396
|
if (!isAnvilTestChain(chain.id)) {
|
|
373
397
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
374
398
|
}
|
|
375
|
-
const res = await
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
399
|
+
const res = await testSpan('setup:env:anvil', () =>
|
|
400
|
+
startAnvil({
|
|
401
|
+
l1BlockTime: opts.ethereumSlotDuration,
|
|
402
|
+
accounts: opts.anvilAccounts,
|
|
403
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
404
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
405
|
+
dateProvider,
|
|
406
|
+
}),
|
|
407
|
+
);
|
|
382
408
|
anvil = res.anvil;
|
|
383
409
|
config.l1RpcUrls = [res.rpcUrl];
|
|
384
410
|
}
|
|
411
|
+
logger.trace('Started anvil and L1 RPC client');
|
|
385
412
|
|
|
386
413
|
// Enable logging metrics to a local file named after the test suite
|
|
387
414
|
if (isMetricsLoggingRequested()) {
|
|
@@ -398,6 +425,7 @@ async function setupInner(
|
|
|
398
425
|
if (opts.l1StartTime) {
|
|
399
426
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
400
427
|
}
|
|
428
|
+
logger.trace('Initialized L1 cheat codes and applied state/time overrides');
|
|
401
429
|
|
|
402
430
|
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
|
|
403
431
|
let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
|
|
@@ -425,6 +453,7 @@ async function setupInner(
|
|
|
425
453
|
if (config.coinbase === undefined) {
|
|
426
454
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
427
455
|
}
|
|
456
|
+
logger.trace('Resolved L1 publisher account');
|
|
428
457
|
|
|
429
458
|
// The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
|
|
430
459
|
// funded at genesis so they are immediately usable.
|
|
@@ -439,13 +468,29 @@ async function setupInner(
|
|
|
439
468
|
addressesToFund.push(sponsoredFPCAddress);
|
|
440
469
|
}
|
|
441
470
|
|
|
471
|
+
// Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
|
|
472
|
+
// by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
|
|
473
|
+
if (opts.computeExtraGenesisFundedAddresses) {
|
|
474
|
+
addressesToFund.push(...(await opts.computeExtraGenesisFundedAddresses(defaultAccounts)));
|
|
475
|
+
}
|
|
476
|
+
logger.trace('Generated test accounts to fund at genesis');
|
|
477
|
+
|
|
478
|
+
// Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
|
|
479
|
+
// helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
|
|
480
|
+
// contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
|
|
481
|
+
// must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
|
|
482
|
+
config.testPreloadStandardContracts = true;
|
|
483
|
+
const standardContractNullifiers = await getStandardContractGenesisNullifiers();
|
|
484
|
+
|
|
442
485
|
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
443
486
|
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
444
487
|
addressesToFund,
|
|
445
488
|
opts.initialAccountFeeJuice,
|
|
446
489
|
opts.genesisPublicData,
|
|
447
490
|
genesisTimestamp,
|
|
491
|
+
standardContractNullifiers,
|
|
448
492
|
);
|
|
493
|
+
logger.trace('Computed genesis values');
|
|
449
494
|
|
|
450
495
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
451
496
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
@@ -455,18 +500,21 @@ async function setupInner(
|
|
|
455
500
|
|
|
456
501
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
|
|
457
502
|
|
|
503
|
+
// Warm both KZG trusted setups (ours + anvil's) in parallel
|
|
504
|
+
if (anvil && isAnvilTestChain(chain.id)) {
|
|
505
|
+
await warmBlobKzg(l1Client, logger);
|
|
506
|
+
}
|
|
507
|
+
|
|
458
508
|
// Deploy Multicall3 if running locally
|
|
459
509
|
await deployMulticall3(l1Client, logger);
|
|
460
510
|
|
|
461
511
|
// Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
|
|
462
512
|
// This is necessary because deployMulticall3 sends multiple transactions and viem may cache a stale nonce
|
|
463
513
|
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
514
|
+
logger.trace('Deployed Multicall3');
|
|
464
515
|
|
|
465
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await
|
|
466
|
-
config.l1RpcUrls[0],
|
|
467
|
-
publisherPrivKeyHex!,
|
|
468
|
-
chain.id,
|
|
469
|
-
{
|
|
516
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await testSpan('setup:env:l1-deploy', () =>
|
|
517
|
+
deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex!, chain.id, {
|
|
470
518
|
...getL1ContractsConfigEnvVars(),
|
|
471
519
|
...opts,
|
|
472
520
|
...opts.l1ContractsArgs,
|
|
@@ -476,7 +524,7 @@ async function setupInner(
|
|
|
476
524
|
initialValidators: opts.initialValidators,
|
|
477
525
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
478
526
|
realVerifier: false,
|
|
479
|
-
},
|
|
527
|
+
}),
|
|
480
528
|
);
|
|
481
529
|
|
|
482
530
|
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
@@ -500,9 +548,23 @@ async function setupInner(
|
|
|
500
548
|
}
|
|
501
549
|
}
|
|
502
550
|
|
|
551
|
+
// Deploy any test-specific L1 contracts while automine is still on and before the node starts,
|
|
552
|
+
// so they mine instantly rather than paying the L1 block interval once the sequencer is live.
|
|
553
|
+
let extraL1DeployResult: TDeployExtraL1ContractsReturnType = undefined as TDeployExtraL1ContractsReturnType;
|
|
554
|
+
if (opts.deployExtraL1Contracts) {
|
|
555
|
+
logger.trace('Running deployExtraL1Contracts hook');
|
|
556
|
+
extraL1DeployResult = await opts.deployExtraL1Contracts({
|
|
557
|
+
l1Client,
|
|
558
|
+
deployL1ContractsValues,
|
|
559
|
+
logger,
|
|
560
|
+
});
|
|
561
|
+
// The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
|
|
562
|
+
// stale cached nonce for later transactions on the publisher account.
|
|
563
|
+
await l1Client.getTransactionCount({ address: l1Client.account.address });
|
|
564
|
+
}
|
|
565
|
+
|
|
503
566
|
if (enableAutomine) {
|
|
504
|
-
await ethCheatCodes.
|
|
505
|
-
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
567
|
+
await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
|
|
506
568
|
}
|
|
507
569
|
|
|
508
570
|
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
@@ -515,27 +577,34 @@ async function setupInner(
|
|
|
515
577
|
if (opts.l2StartTime) {
|
|
516
578
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
517
579
|
}
|
|
580
|
+
logger.trace('Deployed L1 rollup contracts');
|
|
581
|
+
|
|
582
|
+
// These boot steps are independent and write disjoint config keys, so run them concurrently:
|
|
583
|
+
// telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
|
|
584
|
+
// and the ACVM/BB config resolvers write their own acvm*/bb* keys.
|
|
585
|
+
const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
|
|
586
|
+
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
587
|
+
opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
|
|
588
|
+
setupSharedBlobStorage(config),
|
|
589
|
+
getACVMConfig(logger),
|
|
590
|
+
getBBConfig(logger),
|
|
591
|
+
]);
|
|
592
|
+
logger.trace('Created telemetry client');
|
|
593
|
+
logger.trace('Set up shared blob storage');
|
|
518
594
|
|
|
519
|
-
// Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
|
|
520
|
-
const telemetryClient = opts.metricsPort
|
|
521
|
-
? await getEndToEndTestTelemetryClient(opts.metricsPort)
|
|
522
|
-
: await getTelemetryClient(opts.telemetryConfig);
|
|
523
|
-
|
|
524
|
-
await setupSharedBlobStorage(config);
|
|
525
|
-
|
|
526
|
-
logger.verbose('Creating and synching an aztec node', config);
|
|
527
|
-
|
|
528
|
-
const acvmConfig = await getACVMConfig(logger);
|
|
529
595
|
if (acvmConfig) {
|
|
530
596
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
531
597
|
config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
|
|
532
598
|
}
|
|
599
|
+
logger.trace('Resolved ACVM config');
|
|
533
600
|
|
|
534
|
-
const bbConfig = await getBBConfig(logger);
|
|
535
601
|
if (bbConfig) {
|
|
536
602
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
537
603
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
538
604
|
}
|
|
605
|
+
logger.trace('Resolved Barretenberg config');
|
|
606
|
+
|
|
607
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
539
608
|
|
|
540
609
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
541
610
|
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
@@ -545,27 +614,6 @@ async function setupInner(
|
|
|
545
614
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
546
615
|
}
|
|
547
616
|
|
|
548
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
549
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
550
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
551
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
552
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
553
|
-
}
|
|
554
|
-
const originalBuildCheckpointIfEmpty = config.buildCheckpointIfEmpty ?? false;
|
|
555
|
-
|
|
556
|
-
// Allow an empty checkpoint so the empty block can be built; leave untouched when not advancing.
|
|
557
|
-
const advancePastGenesis = (opts.advancePastGenesis ?? true) && !opts.skipInitialSequencer;
|
|
558
|
-
config.minTxsPerBlock = advancePastGenesis ? 0 : originalMinTxsPerBlock;
|
|
559
|
-
// Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at slot N
|
|
560
|
-
// start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on alternating
|
|
561
|
-
// slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) while advancing past genesis.
|
|
562
|
-
// Automine is unaffected: its runBuild clamps mempool builds to Math.max(minTxsPerBlock ?? 1, 1) and
|
|
563
|
-
// still requires minValidTxs: 1.
|
|
564
|
-
const shouldTemporarilyBuildEmptyCheckpoints = advancePastGenesis && config.useAutomineSequencer !== true;
|
|
565
|
-
if (shouldTemporarilyBuildEmptyCheckpoints) {
|
|
566
|
-
config.buildCheckpointIfEmpty = true;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
617
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
570
618
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
571
619
|
|
|
@@ -585,15 +633,19 @@ async function setupInner(
|
|
|
585
633
|
...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
|
|
586
634
|
}
|
|
587
635
|
: config;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
636
|
+
logger.trace('Prepared aztec node config');
|
|
637
|
+
|
|
638
|
+
const aztecNodeService = await testSpan('setup:env:sequencer-start', () =>
|
|
639
|
+
withLoggerBindings({ actor: 'node-0' }, () =>
|
|
640
|
+
createAztecNodeService(
|
|
641
|
+
initialNodeConfig,
|
|
642
|
+
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
643
|
+
{ genesis, dontStartSequencer: opts.skipInitialSequencer },
|
|
644
|
+
),
|
|
594
645
|
),
|
|
595
646
|
);
|
|
596
647
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
648
|
+
logger.trace('Created and synced aztec node');
|
|
597
649
|
|
|
598
650
|
let proverNode: AztecNodeService | undefined = undefined;
|
|
599
651
|
if (opts.startProverNode) {
|
|
@@ -607,16 +659,19 @@ async function setupInner(
|
|
|
607
659
|
rpcTxProviders: [aztecNodeService],
|
|
608
660
|
};
|
|
609
661
|
|
|
610
|
-
({ proverNode } = await
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
662
|
+
({ proverNode } = await testSpan('setup:env:prover-node', () =>
|
|
663
|
+
createAndSyncProverNode(
|
|
664
|
+
proverNodePrivateKeyHex,
|
|
665
|
+
config,
|
|
666
|
+
{
|
|
667
|
+
...config.proverNodeConfig,
|
|
668
|
+
dataDirectory: proverNodeDataDirectory,
|
|
669
|
+
},
|
|
670
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
671
|
+
{ genesis },
|
|
672
|
+
),
|
|
619
673
|
));
|
|
674
|
+
logger.trace('Created prover node');
|
|
620
675
|
}
|
|
621
676
|
|
|
622
677
|
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
@@ -627,18 +682,22 @@ async function setupInner(
|
|
|
627
682
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
628
683
|
// For tests we only want proving enabled if specifically requested
|
|
629
684
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
630
|
-
const wallet = await
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
685
|
+
const wallet = await testSpan('setup:env:pxe', () =>
|
|
686
|
+
TestWallet.create(aztecNodeService, pxeConfig, {
|
|
687
|
+
loggerActorLabel: 'pxe-0',
|
|
688
|
+
// In-process node implements the debug API, so register public function signatures for named traces.
|
|
689
|
+
nodeDebug: aztecNodeService,
|
|
690
|
+
...opts.pxeCreationOptions,
|
|
691
|
+
}),
|
|
692
|
+
);
|
|
636
693
|
|
|
637
694
|
if (opts.walletMinFeePadding !== undefined) {
|
|
638
695
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
639
696
|
}
|
|
697
|
+
logger.trace('Created PXE and test wallet');
|
|
640
698
|
|
|
641
699
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
|
|
700
|
+
logger.trace('Created cheat codes');
|
|
642
701
|
|
|
643
702
|
if (
|
|
644
703
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -652,6 +711,7 @@ async function setupInner(
|
|
|
652
711
|
);
|
|
653
712
|
await cheatCodes.rollup.setupEpoch();
|
|
654
713
|
await cheatCodes.rollup.debugRollup();
|
|
714
|
+
logger.trace('Advanced chain to set up validator committee');
|
|
655
715
|
}
|
|
656
716
|
|
|
657
717
|
let accounts: AztecAddress[] = [];
|
|
@@ -660,66 +720,39 @@ async function setupInner(
|
|
|
660
720
|
// + a simulated store call) with no on-chain tx, independent of the sequencer.
|
|
661
721
|
if (numberOfAccounts > 0) {
|
|
662
722
|
logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
|
|
663
|
-
await createFundedInitializerlessAccounts(wallet, defaultAccounts);
|
|
723
|
+
await testSpan('wallet:create', () => createFundedInitializerlessAccounts(wallet, defaultAccounts));
|
|
664
724
|
accounts = defaultAccounts.map(a => a.address);
|
|
665
725
|
}
|
|
726
|
+
logger.trace('Created funded test accounts');
|
|
666
727
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
await automine.buildEmptyBlock();
|
|
674
|
-
}
|
|
675
|
-
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
676
|
-
await sleep(2000);
|
|
677
|
-
}
|
|
678
|
-
} else if (opts.skipInitialSequencer) {
|
|
679
|
-
logger.info('Sequencer not started on initial node, skipping block progression');
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
// Now we restore the original minTxsPerBlock setting if we changed it.
|
|
683
|
-
if (sequencerClient) {
|
|
684
|
-
const sequencer = sequencerClient.getSequencer();
|
|
685
|
-
if (config.minTxsPerBlock !== originalMinTxsPerBlock) {
|
|
686
|
-
sequencer.updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
|
|
687
|
-
}
|
|
688
|
-
if (shouldTemporarilyBuildEmptyCheckpoints) {
|
|
689
|
-
sequencer.updateConfig({ buildCheckpointIfEmpty: originalBuildCheckpointIfEmpty });
|
|
690
|
-
config.buildCheckpointIfEmpty = originalBuildCheckpointIfEmpty;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
const teardown = async () => {
|
|
695
|
-
const teardownStart = performance.now();
|
|
696
|
-
try {
|
|
697
|
-
await tryStop(wallet, logger);
|
|
698
|
-
await tryStop(aztecNodeService, logger);
|
|
699
|
-
await tryStop(proverNode, logger);
|
|
728
|
+
const teardown = () =>
|
|
729
|
+
testSpan('teardown:env', async () => {
|
|
730
|
+
try {
|
|
731
|
+
await tryStop(wallet, logger);
|
|
732
|
+
await tryStop(aztecNodeService, logger);
|
|
733
|
+
await tryStop(proverNode, logger);
|
|
700
734
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
735
|
+
if (acvmConfig?.cleanup) {
|
|
736
|
+
await acvmConfig.cleanup();
|
|
737
|
+
}
|
|
704
738
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
739
|
+
if (bbConfig?.cleanup) {
|
|
740
|
+
await bbConfig.cleanup();
|
|
741
|
+
}
|
|
708
742
|
|
|
709
|
-
|
|
743
|
+
await tryStop(anvil, logger);
|
|
710
744
|
|
|
711
|
-
|
|
712
|
-
} catch (err) {
|
|
713
|
-
logger.error(`Error during e2e test teardown`, err);
|
|
714
|
-
} finally {
|
|
715
|
-
try {
|
|
716
|
-
await telemetryClient.stop();
|
|
745
|
+
await tryRmDir(directoryToCleanup, logger);
|
|
717
746
|
} catch (err) {
|
|
718
|
-
logger.error(`Error during
|
|
747
|
+
logger.error(`Error during e2e test teardown`, err);
|
|
748
|
+
} finally {
|
|
749
|
+
try {
|
|
750
|
+
await telemetryClient.stop();
|
|
751
|
+
} catch (err) {
|
|
752
|
+
logger.error(`Error during telemetry client stop`, err);
|
|
753
|
+
}
|
|
719
754
|
}
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
};
|
|
755
|
+
});
|
|
723
756
|
|
|
724
757
|
return {
|
|
725
758
|
anvil,
|
|
@@ -736,6 +769,7 @@ async function setupInner(
|
|
|
736
769
|
logger,
|
|
737
770
|
mockGossipSubNetwork,
|
|
738
771
|
genesis,
|
|
772
|
+
extraL1DeployResult,
|
|
739
773
|
proverNode,
|
|
740
774
|
sequencerDelayer,
|
|
741
775
|
proverDelayer,
|
|
@@ -810,7 +844,12 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
|
810
844
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
811
845
|
}
|
|
812
846
|
|
|
813
|
-
export async function waitForProvenChain(
|
|
847
|
+
export async function waitForProvenChain(
|
|
848
|
+
node: AztecNode,
|
|
849
|
+
targetBlock?: BlockNumber,
|
|
850
|
+
timeoutSec = 60,
|
|
851
|
+
intervalSec = 0.25,
|
|
852
|
+
) {
|
|
814
853
|
targetBlock ??= await node.getBlockNumber();
|
|
815
854
|
|
|
816
855
|
await retryUntil(
|
|
@@ -833,6 +872,7 @@ export function createAndSyncProverNode(
|
|
|
833
872
|
telemetry?: TelemetryClient;
|
|
834
873
|
dateProvider: DateProvider;
|
|
835
874
|
p2pClientDeps?: P2PClientDeps;
|
|
875
|
+
proverNodeDeps?: Partial<ProverNodeDeps>;
|
|
836
876
|
},
|
|
837
877
|
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
838
878
|
): Promise<{ proverNode: AztecNodeService }> {
|
|
@@ -912,14 +952,16 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
912
952
|
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
913
953
|
*/
|
|
914
954
|
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
await
|
|
921
|
-
|
|
922
|
-
|
|
955
|
+
await testSpan('setup:auth-registry', async () => {
|
|
956
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
957
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
958
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
959
|
+
}
|
|
960
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
961
|
+
await publishInstance(wallet, instance).send({ from });
|
|
962
|
+
}
|
|
963
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
964
|
+
});
|
|
923
965
|
}
|
|
924
966
|
|
|
925
967
|
/**
|