@aztec/end-to-end 0.0.1-commit.5daedc8 → 0.0.1-commit.6201a7b05
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 +27 -0
- package/dest/bench/client_flows/benchmark.d.ts +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +15 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +125 -145
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +9 -8
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +31 -19
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +11 -9
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +108 -114
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +20 -14
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +92 -71
- package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +42 -15
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +159 -59
- package/dest/e2e_fees/bridging_race.notest.js +4 -6
- package/dest/e2e_fees/fees_test.d.ts +21 -17
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +139 -147
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +14 -16
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +30 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +4 -4
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +9 -12
- package/dest/e2e_p2p/p2p_network.d.ts +25 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +175 -130
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +193 -0
- package/dest/e2e_p2p/shared.d.ts +30 -12
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +84 -67
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +100 -92
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +16 -23
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +115 -139
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +17 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +18 -3
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- 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/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
- package/dest/fixtures/setup.d.ts +246 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +625 -0
- package/dest/fixtures/setup_p2p_test.d.ts +18 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +46 -35
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -6
- package/dest/fixtures/utils.d.ts +5 -637
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +18 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +27 -27
- package/dest/shared/gas_portal_test_harness.d.ts +12 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +4 -4
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +58 -43
- package/dest/simulators/lending_simulator.d.ts +6 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +15 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +132 -43
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +438 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +45 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -220
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -782
- package/dest/test-wallet/test_wallet.d.ts +84 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +255 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +279 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +49 -45
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +166 -216
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +36 -21
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +123 -151
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -126
- package/src/e2e_deploy_contract/deploy_test.ts +22 -15
- package/src/e2e_epochs/epochs_test.ts +222 -112
- package/src/e2e_fees/bridging_race.notest.ts +5 -11
- package/src/e2e_fees/fees_test.ts +182 -230
- package/src/e2e_l1_publisher/write_json.ts +16 -16
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +35 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +10 -13
- package/src/e2e_p2p/p2p_network.ts +245 -204
- package/src/e2e_p2p/reqresp/utils.ts +257 -0
- package/src/e2e_p2p/shared.ts +111 -81
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +121 -119
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +143 -189
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +34 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +188 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +932 -0
- package/src/fixtures/setup_p2p_test.ts +51 -55
- package/src/fixtures/token_utils.ts +7 -6
- package/src/fixtures/utils.ts +27 -966
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +3 -5
- package/src/legacy-jest-resolver.cjs +135 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +30 -43
- package/src/shared/gas_portal_test_harness.ts +3 -4
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +86 -106
- package/src/simulators/lending_simulator.ts +11 -7
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +192 -28
- package/src/spartan/tx_metrics.ts +388 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -982
- package/src/test-wallet/test_wallet.ts +357 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { Archiver } from '@aztec/archiver';
|
|
1
3
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
2
5
|
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
3
6
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
@@ -6,34 +9,37 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
6
9
|
import { MerkleTreeId } from '@aztec/aztec.js/trees';
|
|
7
10
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
8
11
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
9
|
-
import {
|
|
12
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
13
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
10
14
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
15
|
+
import { Delayer, createDelayer, waitUntilL1Timestamp, wrapClientWithDelayer } from '@aztec/ethereum/l1-tx-utils';
|
|
16
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
17
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
18
|
+
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
13
19
|
import { SecretValue } from '@aztec/foundation/config';
|
|
14
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
15
|
-
import {
|
|
20
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
21
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
16
22
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
17
23
|
import { sleep } from '@aztec/foundation/sleep';
|
|
18
24
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
25
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
19
26
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
20
|
-
import {
|
|
21
|
-
import type {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
type SequencerEvents,
|
|
25
|
-
type SequencerPublisher,
|
|
26
|
-
SequencerState,
|
|
27
|
-
} from '@aztec/sequencer-client';
|
|
28
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
29
|
-
import { EthAddress, type L2BlockNumber } from '@aztec/stdlib/block';
|
|
27
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
28
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
29
|
+
import { type SequencerClient, type SequencerEvents, SequencerState } from '@aztec/sequencer-client';
|
|
30
|
+
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
30
31
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
31
32
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
33
|
+
import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
|
|
32
34
|
|
|
33
35
|
import { join } from 'path';
|
|
34
36
|
import type { Hex } from 'viem';
|
|
35
37
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
36
38
|
|
|
39
|
+
import {
|
|
40
|
+
SCHNORR_HARDCODED_PRIVATE_KEY,
|
|
41
|
+
SchnorrHardcodedKeyAccountContract,
|
|
42
|
+
} from '../fixtures/schnorr_hardcoded_account_contract.js';
|
|
37
43
|
import {
|
|
38
44
|
type EndToEndContext,
|
|
39
45
|
type SetupOptions,
|
|
@@ -41,13 +47,20 @@ import {
|
|
|
41
47
|
getPrivateKeyFromIndex,
|
|
42
48
|
setup,
|
|
43
49
|
} from '../fixtures/utils.js';
|
|
50
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
44
51
|
|
|
45
|
-
export const
|
|
52
|
+
export const WORLD_STATE_CHECKPOINT_HISTORY = 2;
|
|
46
53
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
47
54
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
48
55
|
export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
49
56
|
|
|
50
|
-
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
57
|
+
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
58
|
+
numberOfAccounts?: number;
|
|
59
|
+
pxeOpts?: Partial<PXEConfig>;
|
|
60
|
+
aztecSlotDurationInL1Slots?: number;
|
|
61
|
+
/** Skip creating/registering the hardcoded account during setup (for tests that handle accounts themselves). */
|
|
62
|
+
skipHardcodedAccount?: boolean;
|
|
63
|
+
};
|
|
51
64
|
|
|
52
65
|
export type TrackedSequencerEvent = {
|
|
53
66
|
[K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
|
|
@@ -73,7 +86,7 @@ export class EpochsTestContext {
|
|
|
73
86
|
public proverDelayer!: Delayer;
|
|
74
87
|
public sequencerDelayer!: Delayer;
|
|
75
88
|
|
|
76
|
-
public proverNodes:
|
|
89
|
+
public proverNodes: AztecNodeService[] = [];
|
|
77
90
|
public nodes: AztecNodeService[] = [];
|
|
78
91
|
|
|
79
92
|
public epochDuration!: number;
|
|
@@ -92,48 +105,76 @@ export class EpochsTestContext {
|
|
|
92
105
|
? parseInt(process.env.L1_BLOCK_TIME)
|
|
93
106
|
: DEFAULT_L1_BLOCK_TIME;
|
|
94
107
|
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
|
|
95
|
-
const aztecSlotDuration = opts.aztecSlotDuration ??
|
|
108
|
+
const aztecSlotDuration = opts.aztecSlotDuration ?? (opts.aztecSlotDurationInL1Slots ?? 2) * ethereumSlotDuration;
|
|
96
109
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
97
110
|
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
98
|
-
|
|
111
|
+
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
112
|
+
return {
|
|
113
|
+
l1PublishingTime,
|
|
114
|
+
ethereumSlotDuration,
|
|
115
|
+
aztecSlotDuration,
|
|
116
|
+
aztecEpochDuration,
|
|
117
|
+
aztecProofSubmissionEpochs,
|
|
118
|
+
};
|
|
99
119
|
}
|
|
100
120
|
|
|
101
121
|
public async setup(opts: EpochsTestOpts = {}) {
|
|
102
|
-
const {
|
|
103
|
-
|
|
122
|
+
const {
|
|
123
|
+
ethereumSlotDuration,
|
|
124
|
+
aztecSlotDuration,
|
|
125
|
+
aztecEpochDuration,
|
|
126
|
+
aztecProofSubmissionEpochs,
|
|
127
|
+
l1PublishingTime,
|
|
128
|
+
} = EpochsTestContext.getSlotDurations(opts);
|
|
104
129
|
|
|
105
130
|
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
106
131
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
107
132
|
|
|
133
|
+
// When skipInitialSequencer is set, auto-create a hardcoded account funded via genesis.
|
|
134
|
+
// This avoids needing to deploy accounts on-chain (which would require a running sequencer).
|
|
135
|
+
const useHardcodedAccount = opts.skipInitialSequencer && !opts.skipHardcodedAccount;
|
|
136
|
+
let hardcodedAccountData: InitialAccountData | undefined;
|
|
137
|
+
if (useHardcodedAccount) {
|
|
138
|
+
hardcodedAccountData = await EpochsTestContext.getHardcodedAccountData(Fr.random(), Fr.random());
|
|
139
|
+
}
|
|
140
|
+
|
|
108
141
|
// Set up system without any account nor protocol contracts
|
|
109
142
|
// and with faster block times and shorter epochs.
|
|
110
|
-
const context = await setup(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
const context = await setup(
|
|
144
|
+
useHardcodedAccount ? 0 : (opts.numberOfAccounts ?? 0),
|
|
145
|
+
{
|
|
146
|
+
automineL1Setup: true,
|
|
147
|
+
checkIntervalMs: 50,
|
|
148
|
+
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
149
|
+
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
150
|
+
aztecEpochDuration,
|
|
151
|
+
aztecSlotDuration,
|
|
152
|
+
ethereumSlotDuration,
|
|
153
|
+
aztecProofSubmissionEpochs,
|
|
154
|
+
aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
|
|
155
|
+
minTxsPerBlock: 0,
|
|
156
|
+
realProofs: false,
|
|
157
|
+
startProverNode: true,
|
|
158
|
+
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
159
|
+
proverId: EthAddress.fromNumber(1),
|
|
160
|
+
worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
|
|
161
|
+
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
162
|
+
slasherEnabled: false,
|
|
163
|
+
l1PublishingTime,
|
|
164
|
+
...opts,
|
|
165
|
+
...(hardcodedAccountData ? { initialFundedAccounts: [hardcodedAccountData], numberOfAccounts: 0 } : {}),
|
|
166
|
+
},
|
|
167
|
+
// Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
168
|
+
// Can be overridden via opts.pxeOpts.
|
|
169
|
+
{ syncChainTip: 'checkpointed', ...opts.pxeOpts },
|
|
170
|
+
);
|
|
135
171
|
|
|
136
172
|
this.context = context;
|
|
173
|
+
|
|
174
|
+
// Register the hardcoded account in PXE (local only, no on-chain deployment needed).
|
|
175
|
+
if (hardcodedAccountData) {
|
|
176
|
+
await this.registerHardcodedAccount(hardcodedAccountData);
|
|
177
|
+
}
|
|
137
178
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
138
179
|
this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
|
|
139
180
|
this.logger = context.logger;
|
|
@@ -144,17 +185,8 @@ export class EpochsTestContext {
|
|
|
144
185
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
145
186
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
146
187
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.proverDelayer = context.proverNode
|
|
150
|
-
? (((context.proverNode as TestProverNode).publisher as ProverNodePublisher).l1TxUtils as DelayedTxUtils).delayer!
|
|
151
|
-
: undefined!;
|
|
152
|
-
this.sequencerDelayer = context.sequencer
|
|
153
|
-
? (
|
|
154
|
-
((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher)
|
|
155
|
-
.l1TxUtils as DelayedTxUtils
|
|
156
|
-
).delayer!
|
|
157
|
-
: undefined!;
|
|
188
|
+
this.proverDelayer = context.proverDelayer!;
|
|
189
|
+
this.sequencerDelayer = context.sequencerDelayer!;
|
|
158
190
|
|
|
159
191
|
if ((context.proverNode && !this.proverDelayer) || (context.sequencer && !this.sequencerDelayer)) {
|
|
160
192
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
@@ -169,6 +201,8 @@ export class EpochsTestContext {
|
|
|
169
201
|
l1GenesisTime: await this.rollup.getL1GenesisTime(),
|
|
170
202
|
ethereumSlotDuration,
|
|
171
203
|
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
|
|
204
|
+
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
|
|
205
|
+
rollupManaLimit: Number(await this.rollup.getManaLimit()),
|
|
172
206
|
};
|
|
173
207
|
|
|
174
208
|
this.logger.info(
|
|
@@ -183,23 +217,64 @@ export class EpochsTestContext {
|
|
|
183
217
|
await this.context.teardown();
|
|
184
218
|
}
|
|
185
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Computes InitialAccountData for a SchnorrHardcodedKeyAccountContract.
|
|
222
|
+
* This contract has a hardcoded signing key and no initializer, so it can be used without
|
|
223
|
+
* on-chain deployment. Pass the returned data in `initialFundedAccounts` so the address
|
|
224
|
+
* gets funded with fee juice in genesis.
|
|
225
|
+
*/
|
|
226
|
+
public static async getHardcodedAccountData(secret: Fr, salt: Fr): Promise<InitialAccountData> {
|
|
227
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
228
|
+
const address = await getAccountContractAddress(contract, secret, salt);
|
|
229
|
+
const signingKey = SCHNORR_HARDCODED_PRIVATE_KEY;
|
|
230
|
+
return { secret, salt, signingKey, address };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Registers a SchnorrHardcodedKeyAccountContract in PXE. The account must have been funded
|
|
235
|
+
* at genesis (via getHardcodedAccountData). No on-chain deployment or block mining needed.
|
|
236
|
+
*/
|
|
237
|
+
public async registerHardcodedAccount(accountData: InitialAccountData) {
|
|
238
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
239
|
+
const wallet = this.context.wallet;
|
|
240
|
+
const accountManager = await (wallet as TestWallet).createAccount({
|
|
241
|
+
secret: accountData.secret,
|
|
242
|
+
salt: accountData.salt,
|
|
243
|
+
contract,
|
|
244
|
+
});
|
|
245
|
+
this.context.accounts = [accountManager.address];
|
|
246
|
+
return accountManager.address;
|
|
247
|
+
}
|
|
248
|
+
|
|
186
249
|
public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
|
|
187
250
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
188
251
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
189
|
-
const
|
|
190
|
-
const
|
|
252
|
+
const proverIndex = this.proverNodes.length + 1;
|
|
253
|
+
const { mockGossipSubNetwork } = this.context;
|
|
254
|
+
const { proverNode } = await withLoggerBindings({ actor: `prover-${proverIndex}` }, () =>
|
|
191
255
|
createAndSyncProverNode(
|
|
192
256
|
proverNodePrivateKey,
|
|
193
|
-
{ ...this.context.config },
|
|
194
257
|
{
|
|
195
|
-
|
|
196
|
-
|
|
258
|
+
...this.context.config,
|
|
259
|
+
p2pEnabled: this.context.config.p2pEnabled || mockGossipSubNetwork !== undefined,
|
|
260
|
+
proverId: EthAddress.fromNumber(proverIndex),
|
|
197
261
|
dontStart: opts.dontStart,
|
|
198
262
|
...opts,
|
|
199
263
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
264
|
+
{
|
|
265
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
dateProvider: this.context.dateProvider,
|
|
269
|
+
p2pClientDeps: {
|
|
270
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
271
|
+
rpcTxProviders: [this.context.aztecNode],
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
genesis: this.context.genesis,
|
|
276
|
+
dontStart: opts.dontStart,
|
|
277
|
+
},
|
|
203
278
|
),
|
|
204
279
|
);
|
|
205
280
|
this.proverNodes.push(proverNode);
|
|
@@ -213,26 +288,34 @@ export class EpochsTestContext {
|
|
|
213
288
|
|
|
214
289
|
public createValidatorNode(
|
|
215
290
|
privateKeys: `0x${string}`[],
|
|
216
|
-
opts: Partial<AztecNodeConfig> & {
|
|
291
|
+
opts: Partial<AztecNodeConfig> & {
|
|
292
|
+
dontStartSequencer?: boolean;
|
|
293
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
294
|
+
} = {},
|
|
217
295
|
) {
|
|
218
296
|
this.logger.warn('Creating and syncing a validator node...');
|
|
219
297
|
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
|
|
220
298
|
}
|
|
221
299
|
|
|
222
300
|
private async createNode(
|
|
223
|
-
opts: Partial<AztecNodeConfig> & {
|
|
301
|
+
opts: Partial<AztecNodeConfig> & {
|
|
302
|
+
dontStartSequencer?: boolean;
|
|
303
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
304
|
+
} = {},
|
|
224
305
|
) {
|
|
225
|
-
const
|
|
306
|
+
const nodeIndex = this.nodes.length + 1;
|
|
307
|
+
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
226
308
|
const { mockGossipSubNetwork } = this.context;
|
|
227
309
|
const resolvedConfig = { ...this.context.config, ...opts };
|
|
228
310
|
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
229
311
|
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
230
|
-
const node = await
|
|
312
|
+
const node = await withLoggerBindings({ actor: `${actorPrefix}-${nodeIndex}` }, () =>
|
|
231
313
|
AztecNodeService.createAndSync(
|
|
232
314
|
{
|
|
233
315
|
...resolvedConfig,
|
|
234
316
|
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
235
317
|
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
318
|
+
nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
|
|
236
319
|
p2pEnabled,
|
|
237
320
|
p2pIp,
|
|
238
321
|
},
|
|
@@ -241,34 +324,15 @@ export class EpochsTestContext {
|
|
|
241
324
|
p2pClientDeps: {
|
|
242
325
|
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
243
326
|
},
|
|
327
|
+
slashingProtectionDb: opts.slashingProtectionDb,
|
|
244
328
|
},
|
|
245
329
|
{
|
|
246
|
-
|
|
330
|
+
genesis: this.context.genesis,
|
|
247
331
|
...opts,
|
|
248
332
|
},
|
|
249
333
|
),
|
|
250
334
|
);
|
|
251
335
|
|
|
252
|
-
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
253
|
-
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
254
|
-
// which directly exposes the delayer and sets any test config.
|
|
255
|
-
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
256
|
-
this.logger.info(
|
|
257
|
-
`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`,
|
|
258
|
-
);
|
|
259
|
-
// Here we reach into the sequencer and hook in a tx delayer. The problem is that the sequencer's l1 utils only uses a public client, not a wallet.
|
|
260
|
-
// The delayer needs a wallet (a client that can sign), so we have to create one here.
|
|
261
|
-
const l1Client = createExtendedL1Client(
|
|
262
|
-
resolvedConfig.l1RpcUrls!,
|
|
263
|
-
resolvedConfig.publisherPrivateKeys![0]!.getValue(),
|
|
264
|
-
);
|
|
265
|
-
const sequencer = node.getSequencer() as TestSequencerClient;
|
|
266
|
-
const publisher = sequencer.sequencer.publisher;
|
|
267
|
-
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
|
|
268
|
-
delayed.delayer!.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
269
|
-
publisher.l1TxUtils = delayed;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
336
|
this.nodes.push(node);
|
|
273
337
|
return node;
|
|
274
338
|
}
|
|
@@ -291,21 +355,21 @@ export class EpochsTestContext {
|
|
|
291
355
|
return start;
|
|
292
356
|
}
|
|
293
357
|
|
|
294
|
-
/** Waits until the given
|
|
295
|
-
public async
|
|
358
|
+
/** Waits until the given checkpoint number is mined. */
|
|
359
|
+
public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
296
360
|
await retryUntil(
|
|
297
361
|
() => Promise.resolve(target <= this.monitor.checkpointNumber),
|
|
298
|
-
`Wait until
|
|
362
|
+
`Wait until checkpoint ${target}`,
|
|
299
363
|
timeout,
|
|
300
364
|
0.1,
|
|
301
365
|
);
|
|
302
366
|
}
|
|
303
367
|
|
|
304
|
-
/** Waits until the given
|
|
305
|
-
public async
|
|
368
|
+
/** Waits until the given checkpoint number is marked as proven. */
|
|
369
|
+
public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
306
370
|
await retryUntil(
|
|
307
|
-
() => Promise.resolve(
|
|
308
|
-
`Wait proven
|
|
371
|
+
() => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
|
|
372
|
+
`Wait proven checkpoint ${target}`,
|
|
309
373
|
timeout,
|
|
310
374
|
0.1,
|
|
311
375
|
);
|
|
@@ -320,11 +384,14 @@ export class EpochsTestContext {
|
|
|
320
384
|
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
321
385
|
oneSlotBefore,
|
|
322
386
|
});
|
|
323
|
-
|
|
387
|
+
// Use a timeout that accounts for the full proof submission window
|
|
388
|
+
const proofSubmissionWindowDuration =
|
|
389
|
+
this.constants.proofSubmissionEpochs * this.epochDuration * this.L2_SLOT_DURATION_IN_S;
|
|
390
|
+
await waitUntilL1Timestamp(this.l1Client, oneSlotBefore, undefined, proofSubmissionWindowDuration * 2);
|
|
324
391
|
}
|
|
325
392
|
|
|
326
393
|
/** Waits for the aztec node to sync to the target block number. */
|
|
327
|
-
public async waitForNodeToSync(blockNumber:
|
|
394
|
+
public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
|
|
328
395
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
329
396
|
let synched = false;
|
|
330
397
|
while (!synched) {
|
|
@@ -335,7 +402,7 @@ export class EpochsTestContext {
|
|
|
335
402
|
]);
|
|
336
403
|
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, { blockNumber, type, syncState, tips });
|
|
337
404
|
if (type === 'proven') {
|
|
338
|
-
synched = tips.proven.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
|
|
405
|
+
synched = tips.proven.block.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
|
|
339
406
|
} else if (type === 'finalized') {
|
|
340
407
|
synched = syncState.finalizedBlockNumber >= blockNumber;
|
|
341
408
|
} else {
|
|
@@ -357,23 +424,34 @@ export class EpochsTestContext {
|
|
|
357
424
|
return SpamContract.at(instance.address, wallet);
|
|
358
425
|
}
|
|
359
426
|
|
|
427
|
+
/** Registers the TestContract on the given wallet. */
|
|
428
|
+
public async registerTestContract(wallet: Wallet, salt = Fr.ZERO) {
|
|
429
|
+
const instance = await getContractInstanceFromInstantiationParams(TestContract.artifact, {
|
|
430
|
+
constructorArgs: [],
|
|
431
|
+
constructorArtifact: undefined,
|
|
432
|
+
salt,
|
|
433
|
+
publicKeys: undefined,
|
|
434
|
+
deployer: undefined,
|
|
435
|
+
});
|
|
436
|
+
await wallet.registerContract(instance, TestContract.artifact);
|
|
437
|
+
return TestContract.at(instance.address, wallet);
|
|
438
|
+
}
|
|
439
|
+
|
|
360
440
|
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */
|
|
361
441
|
public async createL1Client() {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
this.l1Client.chain,
|
|
367
|
-
),
|
|
368
|
-
this.context.dateProvider!,
|
|
369
|
-
{ ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
|
|
442
|
+
const rawClient = createExtendedL1Client(
|
|
443
|
+
[...this.l1Client.chain.rpcUrls.default.http],
|
|
444
|
+
privateKeyToAccount(this.getNextPrivateKey()),
|
|
445
|
+
this.l1Client.chain,
|
|
370
446
|
);
|
|
447
|
+
const delayer = createDelayer(this.context.dateProvider, { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S }, {});
|
|
448
|
+
const client = wrapClientWithDelayer(rawClient, delayer);
|
|
371
449
|
expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
|
|
372
450
|
return { client, delayer };
|
|
373
451
|
}
|
|
374
452
|
|
|
375
453
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
376
|
-
public async verifyHistoricBlock(blockNumber:
|
|
454
|
+
public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
|
|
377
455
|
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
378
456
|
// at a particular block, so we know whether that historic block is available or has been
|
|
379
457
|
// pruned. Note that `getBlock` would not work here, since it only hits the archiver.
|
|
@@ -384,6 +462,38 @@ export class EpochsTestContext {
|
|
|
384
462
|
expect(result).toBe(expectedSuccess);
|
|
385
463
|
}
|
|
386
464
|
|
|
465
|
+
/** Verifies at least one checkpoint has the target number of blocks (for MBPS validation). */
|
|
466
|
+
public async assertMultipleBlocksPerSlot(targetBlockCount: number) {
|
|
467
|
+
const archiver = (this.context.aztecNode as AztecNodeService).getBlockSource() as Archiver;
|
|
468
|
+
const checkpoints = await archiver.getCheckpoints(CheckpointNumber(1), 50);
|
|
469
|
+
|
|
470
|
+
this.logger.warn(`Retrieved ${checkpoints.length} checkpoints from archiver`, {
|
|
471
|
+
checkpoints: checkpoints.map(pc => pc.checkpoint.getStats()),
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
|
|
475
|
+
let targetFound = false;
|
|
476
|
+
|
|
477
|
+
for (const checkpoint of checkpoints) {
|
|
478
|
+
const blockCount = checkpoint.checkpoint.blocks.length;
|
|
479
|
+
targetFound = targetFound || blockCount >= targetBlockCount;
|
|
480
|
+
|
|
481
|
+
this.logger.verbose(`Checkpoint ${checkpoint.checkpoint.number} has ${blockCount} blocks`, {
|
|
482
|
+
checkpoint: checkpoint.checkpoint.getStats(),
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
for (let i = 0; i < blockCount; i++) {
|
|
486
|
+
const block = checkpoint.checkpoint.blocks[i];
|
|
487
|
+
expect(block.indexWithinCheckpoint).toBe(i);
|
|
488
|
+
expect(block.checkpointNumber).toBe(checkpoint.checkpoint.number);
|
|
489
|
+
expect(block.number).toBe(expectedBlockNumber);
|
|
490
|
+
expectedBlockNumber++;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
expect(targetFound).toBe(true);
|
|
495
|
+
}
|
|
496
|
+
|
|
387
497
|
public watchSequencerEvents(
|
|
388
498
|
sequencers: SequencerClient[],
|
|
389
499
|
getMetadata: (i: number) => Record<string, any> = () => ({}),
|
|
@@ -391,11 +501,11 @@ export class EpochsTestContext {
|
|
|
391
501
|
const stateChanges: TrackedSequencerEvent[] = [];
|
|
392
502
|
const failEvents: TrackedSequencerEvent[] = [];
|
|
393
503
|
|
|
394
|
-
// Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
|
|
504
|
+
// Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
|
|
395
505
|
// due to lack of txs available.
|
|
396
506
|
const failEventsKeys: (keyof SequencerEvents)[] = [
|
|
397
507
|
'block-build-failed',
|
|
398
|
-
'
|
|
508
|
+
'checkpoint-publish-failed',
|
|
399
509
|
'proposer-rollup-check-failed',
|
|
400
510
|
];
|
|
401
511
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
-
import { Fq } from '@aztec/foundation/
|
|
4
|
+
import { Fq } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
8
7
|
|
|
9
8
|
import { jest } from '@jest/globals';
|
|
10
9
|
import type { Hex } from 'viem';
|
|
11
10
|
|
|
11
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
12
12
|
import { FeesTest } from './fees_test.js';
|
|
13
13
|
|
|
14
14
|
jest.setTimeout(300_000);
|
|
@@ -26,11 +26,8 @@ describe('e2e_fees bridging_race', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
beforeAll(async () => {
|
|
29
|
-
await t.
|
|
30
|
-
|
|
31
|
-
await t.applySetupFeeJuiceSnapshot();
|
|
32
|
-
|
|
33
|
-
({ wallet, logger } = await t.setup());
|
|
29
|
+
await t.setup();
|
|
30
|
+
({ wallet, logger } = t);
|
|
34
31
|
});
|
|
35
32
|
|
|
36
33
|
afterAll(async () => {
|
|
@@ -70,10 +67,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
70
67
|
// Yes, we need to REFACTOR it at some point
|
|
71
68
|
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(bobsAddress);
|
|
72
69
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
73
|
-
await t.feeJuiceContract.methods
|
|
74
|
-
.claim(bobsAddress, claim.claimAmount, secret, index)
|
|
75
|
-
.send({ from: bobsAddress })
|
|
76
|
-
.wait();
|
|
70
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, claim.claimAmount, secret, index).send({ from: bobsAddress });
|
|
77
71
|
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
78
72
|
expect(balance).toEqual(claim.claimAmount);
|
|
79
73
|
});
|