@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.2f68f620
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 +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +17 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +36 -39
- 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/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +8 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -5
- 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 +36 -17
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -5
- 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 +42 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -1
- package/dest/e2e_epochs/epochs_test.d.ts +39 -8
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +170 -52
- package/dest/e2e_fees/fees_test.d.ts +6 -3
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +50 -17
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts +14 -12
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +70 -34
- 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 +206 -0
- package/dest/e2e_p2p/shared.d.ts +37 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +93 -53
- 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 +6 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +23 -11
- 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 +9 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +40 -51
- 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 +74 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +71 -0
- 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/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 +37 -0
- package/dest/fixtures/setup.d.ts +88 -34
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +225 -180
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +43 -32
- 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 +5 -7
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- 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/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +4 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +22 -18
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +19 -10
- package/dest/shared/index.d.ts +2 -1
- 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 +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +57 -40
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +26 -14
- 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 +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -41
- package/dest/spartan/tx_metrics.d.ts +52 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +224 -21
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +11 -28
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +4 -1
- package/dest/spartan/utils/index.d.ts +6 -4
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +6 -2
- package/dest/spartan/utils/k8s.d.ts +31 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +124 -0
- package/dest/spartan/utils/nodes.d.ts +14 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +204 -33
- 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 +18 -4
- package/dest/spartan/utils/scripts.d.ts.map +1 -1
- package/dest/spartan/utils/scripts.js +19 -4
- package/dest/test-wallet/test_wallet.d.ts +85 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +273 -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 +66 -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 +53 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +52 -45
- package/src/bench/client_flows/benchmark.ts +19 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +10 -4
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
- package/src/e2e_deploy_contract/deploy_test.ts +6 -5
- package/src/e2e_epochs/epochs_test.ts +196 -77
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +57 -32
- package/src/e2e_l1_publisher/write_json.ts +1 -6
- package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
- package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
- package/src/e2e_p2p/p2p_network.ts +93 -49
- package/src/e2e_p2p/reqresp/utils.ts +274 -0
- package/src/e2e_p2p/shared.ts +117 -65
- 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 +38 -11
- 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 +50 -57
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +93 -0
- 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/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +282 -243
- package/src/fixtures/setup_p2p_test.ts +52 -52
- package/src/fixtures/token_utils.ts +3 -3
- package/src/fixtures/utils.ts +2 -0
- 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/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/shared/cross_chain_test_harness.ts +27 -13
- package/src/shared/gas_portal_test_harness.ts +21 -11
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +3 -2
- package/src/shared/uniswap_l1_l2.ts +103 -54
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +32 -14
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +146 -35
- package/src/spartan/tx_metrics.ts +208 -24
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +3 -0
- package/src/spartan/utils/index.ts +10 -1
- package/src/spartan/utils/k8s.ts +160 -0
- package/src/spartan/utils/nodes.ts +251 -31
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +43 -7
- package/src/test-wallet/test_wallet.ts +376 -0
- package/src/test-wallet/utils.ts +108 -0
- package/src/test-wallet/wallet_worker_script.ts +63 -0
- package/src/test-wallet/worker_wallet.ts +218 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
2
3
|
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
3
4
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
@@ -7,14 +8,16 @@ import { EpochCache } from '@aztec/epoch-cache';
|
|
|
7
8
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
8
9
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
9
10
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { createDelayer, waitUntilL1Timestamp, wrapClientWithDelayer } from '@aztec/ethereum/l1-tx-utils';
|
|
12
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
13
|
+
import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
12
14
|
import { SecretValue } from '@aztec/foundation/config';
|
|
13
15
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
|
-
import {
|
|
16
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
15
17
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
18
|
import { sleep } from '@aztec/foundation/sleep';
|
|
17
19
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
20
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
18
21
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
19
22
|
import { SequencerState } from '@aztec/sequencer-client';
|
|
20
23
|
import { EthAddress } from '@aztec/stdlib/block';
|
|
@@ -22,8 +25,9 @@ import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers
|
|
|
22
25
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
23
26
|
import { join } from 'path';
|
|
24
27
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
28
|
+
import { SCHNORR_HARDCODED_PRIVATE_KEY, SchnorrHardcodedKeyAccountContract } from '../fixtures/schnorr_hardcoded_account_contract.js';
|
|
25
29
|
import { createAndSyncProverNode, getPrivateKeyFromIndex, setup } from '../fixtures/utils.js';
|
|
26
|
-
export const
|
|
30
|
+
export const WORLD_STATE_CHECKPOINT_HISTORY = 2;
|
|
27
31
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
28
32
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
29
33
|
export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
@@ -54,7 +58,7 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
54
58
|
static getSlotDurations(opts = {}) {
|
|
55
59
|
const envEthereumSlotDuration = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : DEFAULT_L1_BLOCK_TIME;
|
|
56
60
|
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
|
|
57
|
-
const aztecSlotDuration = opts.aztecSlotDuration ??
|
|
61
|
+
const aztecSlotDuration = opts.aztecSlotDuration ?? (opts.aztecSlotDurationInL1Slots ?? 2) * ethereumSlotDuration;
|
|
58
62
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
59
63
|
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
60
64
|
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
@@ -70,9 +74,18 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
70
74
|
const { ethereumSlotDuration, aztecSlotDuration, aztecEpochDuration, aztecProofSubmissionEpochs, l1PublishingTime } = EpochsTestContext.getSlotDurations(opts);
|
|
71
75
|
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
72
76
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
77
|
+
// Auto-create a hardcoded account funded via genesis when:
|
|
78
|
+
// - skipInitialSequencer is set (no sequencer to deploy on-chain), or
|
|
79
|
+
// - useHardcodedAccount is explicitly requested (e.g. tight per-block gas budgets that
|
|
80
|
+
// can't fit a full account-deploy tx).
|
|
81
|
+
const useHardcodedAccount = (opts.skipInitialSequencer || opts.useHardcodedAccount) && !opts.skipHardcodedAccount;
|
|
82
|
+
let hardcodedAccountData;
|
|
83
|
+
if (useHardcodedAccount) {
|
|
84
|
+
hardcodedAccountData = await EpochsTestContext.getHardcodedAccountData(Fr.random(), Fr.random());
|
|
85
|
+
}
|
|
73
86
|
// Set up system without any account nor protocol contracts
|
|
74
87
|
// and with faster block times and shorter epochs.
|
|
75
|
-
const context = await setup(opts.numberOfAccounts ?? 0, {
|
|
88
|
+
const context = await setup(useHardcodedAccount ? 0 : opts.numberOfAccounts ?? 0, {
|
|
76
89
|
automineL1Setup: true,
|
|
77
90
|
checkIntervalMs: 50,
|
|
78
91
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
@@ -86,20 +99,29 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
86
99
|
realProofs: false,
|
|
87
100
|
startProverNode: true,
|
|
88
101
|
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
89
|
-
// We use numeric incremental prover ids for simplicity, but we can switch to
|
|
90
|
-
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
91
|
-
// Use numeric EthAddress for deterministic prover id
|
|
92
102
|
proverId: EthAddress.fromNumber(1),
|
|
93
|
-
|
|
103
|
+
worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
|
|
94
104
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
95
|
-
|
|
105
|
+
slasherEnabled: false,
|
|
96
106
|
l1PublishingTime,
|
|
97
|
-
...opts
|
|
98
|
-
|
|
107
|
+
...opts,
|
|
108
|
+
...hardcodedAccountData ? {
|
|
109
|
+
initialFundedAccounts: [
|
|
110
|
+
hardcodedAccountData
|
|
111
|
+
],
|
|
112
|
+
numberOfAccounts: 0
|
|
113
|
+
} : {}
|
|
114
|
+
}, // Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
115
|
+
// Can be overridden via opts.pxeOpts.
|
|
99
116
|
{
|
|
100
|
-
syncChainTip: 'checkpointed'
|
|
117
|
+
syncChainTip: 'checkpointed',
|
|
118
|
+
...opts.pxeOpts
|
|
101
119
|
});
|
|
102
120
|
this.context = context;
|
|
121
|
+
// Register the hardcoded account in PXE (local only, no on-chain deployment needed).
|
|
122
|
+
if (hardcodedAccountData) {
|
|
123
|
+
await this.registerHardcodedAccount(hardcodedAccountData);
|
|
124
|
+
}
|
|
103
125
|
this.proverNodes = context.proverNode ? [
|
|
104
126
|
context.proverNode
|
|
105
127
|
] : [];
|
|
@@ -114,10 +136,8 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
114
136
|
});
|
|
115
137
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
116
138
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.proverDelayer = context.proverNode ? context.proverNode.publisher.l1TxUtils.delayer : undefined;
|
|
120
|
-
this.sequencerDelayer = context.sequencer ? context.sequencer.sequencer.publisher.l1TxUtils.delayer : undefined;
|
|
139
|
+
this.proverDelayer = context.proverDelayer;
|
|
140
|
+
this.sequencerDelayer = context.sequencerDelayer;
|
|
121
141
|
if (context.proverNode && !this.proverDelayer || context.sequencer && !this.sequencerDelayer) {
|
|
122
142
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
123
143
|
}
|
|
@@ -129,7 +149,9 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
129
149
|
l1StartBlock: await this.rollup.getL1StartBlock(),
|
|
130
150
|
l1GenesisTime: await this.rollup.getL1GenesisTime(),
|
|
131
151
|
ethereumSlotDuration,
|
|
132
|
-
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs())
|
|
152
|
+
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
|
|
153
|
+
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
|
|
154
|
+
rollupManaLimit: Number(await this.rollup.getManaLimit())
|
|
133
155
|
};
|
|
134
156
|
this.logger.info(`L2 genesis at L1 block ${this.constants.l1StartBlock} (timestamp ${this.constants.l1GenesisTime})`);
|
|
135
157
|
}
|
|
@@ -139,19 +161,64 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
139
161
|
await Promise.all(this.nodes.map((node)=>tryStop(node, this.logger)));
|
|
140
162
|
await this.context.teardown();
|
|
141
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Computes InitialAccountData for a SchnorrHardcodedKeyAccountContract.
|
|
166
|
+
* This contract has a hardcoded signing key and no initializer, so it can be used without
|
|
167
|
+
* on-chain deployment. Pass the returned data in `initialFundedAccounts` so the address
|
|
168
|
+
* gets funded with fee juice in genesis.
|
|
169
|
+
*/ static async getHardcodedAccountData(secret, salt) {
|
|
170
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
171
|
+
const address = await getAccountContractAddress(contract, secret, salt);
|
|
172
|
+
const signingKey = SCHNORR_HARDCODED_PRIVATE_KEY;
|
|
173
|
+
return {
|
|
174
|
+
secret,
|
|
175
|
+
salt,
|
|
176
|
+
signingKey,
|
|
177
|
+
address
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Registers a SchnorrHardcodedKeyAccountContract in PXE. The account must have been funded
|
|
182
|
+
* at genesis (via getHardcodedAccountData). No on-chain deployment or block mining needed.
|
|
183
|
+
*/ async registerHardcodedAccount(accountData) {
|
|
184
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
185
|
+
const wallet = this.context.wallet;
|
|
186
|
+
const accountManager = await wallet.createAccount({
|
|
187
|
+
secret: accountData.secret,
|
|
188
|
+
salt: accountData.salt,
|
|
189
|
+
contract
|
|
190
|
+
});
|
|
191
|
+
this.context.accounts = [
|
|
192
|
+
accountManager.address
|
|
193
|
+
];
|
|
194
|
+
return accountManager.address;
|
|
195
|
+
}
|
|
142
196
|
async createProverNode(opts = {}) {
|
|
143
197
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
144
198
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
199
|
+
const proverIndex = this.proverNodes.length + 1;
|
|
200
|
+
const { mockGossipSubNetwork } = this.context;
|
|
201
|
+
const { proverNode } = await withLoggerBindings({
|
|
202
|
+
actor: `prover-${proverIndex}`
|
|
203
|
+
}, ()=>createAndSyncProverNode(proverNodePrivateKey, {
|
|
204
|
+
...this.context.config,
|
|
205
|
+
p2pEnabled: this.context.config.p2pEnabled || mockGossipSubNetwork !== undefined,
|
|
206
|
+
proverId: EthAddress.fromNumber(proverIndex),
|
|
151
207
|
dontStart: opts.dontStart,
|
|
152
208
|
...opts
|
|
153
|
-
},
|
|
154
|
-
|
|
209
|
+
}, {
|
|
210
|
+
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex'))
|
|
211
|
+
}, {
|
|
212
|
+
dateProvider: this.context.dateProvider,
|
|
213
|
+
p2pClientDeps: {
|
|
214
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
215
|
+
rpcTxProviders: [
|
|
216
|
+
this.context.aztecNode
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
genesis: this.context.genesis,
|
|
221
|
+
dontStart: opts.dontStart
|
|
155
222
|
}));
|
|
156
223
|
this.proverNodes.push(proverNode);
|
|
157
224
|
return proverNode;
|
|
@@ -172,7 +239,8 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
172
239
|
});
|
|
173
240
|
}
|
|
174
241
|
async createNode(opts = {}) {
|
|
175
|
-
const
|
|
242
|
+
const nodeIndex = this.nodes.length + 1;
|
|
243
|
+
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
176
244
|
const { mockGossipSubNetwork } = this.context;
|
|
177
245
|
const resolvedConfig = {
|
|
178
246
|
...this.context.config,
|
|
@@ -180,35 +248,25 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
180
248
|
};
|
|
181
249
|
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
182
250
|
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
183
|
-
const node = await
|
|
251
|
+
const node = await withLoggerBindings({
|
|
252
|
+
actor: `${actorPrefix}-${nodeIndex}`
|
|
253
|
+
}, ()=>AztecNodeService.createAndSync({
|
|
184
254
|
...resolvedConfig,
|
|
185
255
|
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
|
|
186
256
|
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
257
|
+
nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
|
|
187
258
|
p2pEnabled,
|
|
188
259
|
p2pIp
|
|
189
260
|
}, {
|
|
190
261
|
dateProvider: this.context.dateProvider,
|
|
191
262
|
p2pClientDeps: {
|
|
192
263
|
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined
|
|
193
|
-
}
|
|
264
|
+
},
|
|
265
|
+
slashingProtectionDb: opts.slashingProtectionDb
|
|
194
266
|
}, {
|
|
195
|
-
|
|
267
|
+
genesis: this.context.genesis,
|
|
196
268
|
...opts
|
|
197
269
|
}));
|
|
198
|
-
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
199
|
-
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
200
|
-
// which directly exposes the delayer and sets any test config.
|
|
201
|
-
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
202
|
-
this.logger.info(`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`);
|
|
203
|
-
// 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.
|
|
204
|
-
// The delayer needs a wallet (a client that can sign), so we have to create one here.
|
|
205
|
-
const l1Client = createExtendedL1Client(resolvedConfig.l1RpcUrls, resolvedConfig.publisherPrivateKeys[0].getValue());
|
|
206
|
-
const sequencer = node.getSequencer();
|
|
207
|
-
const publisher = sequencer.sequencer.publisher;
|
|
208
|
-
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
|
|
209
|
-
delayed.delayer.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
210
|
-
publisher.l1TxUtils = delayed;
|
|
211
|
-
}
|
|
212
270
|
this.nodes.push(node);
|
|
213
271
|
return node;
|
|
214
272
|
}
|
|
@@ -236,7 +294,9 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
236
294
|
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
237
295
|
oneSlotBefore
|
|
238
296
|
});
|
|
239
|
-
|
|
297
|
+
// Use a timeout that accounts for the full proof submission window
|
|
298
|
+
const proofSubmissionWindowDuration = this.constants.proofSubmissionEpochs * this.epochDuration * this.L2_SLOT_DURATION_IN_S;
|
|
299
|
+
await waitUntilL1Timestamp(this.l1Client, oneSlotBefore, undefined, proofSubmissionWindowDuration * 2);
|
|
240
300
|
}
|
|
241
301
|
/** Waits for the aztec node to sync to the target block number. */ async waitForNodeToSync(blockNumber, type) {
|
|
242
302
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
@@ -245,7 +305,7 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
245
305
|
await sleep(waitTime);
|
|
246
306
|
const [syncState, tips] = await Promise.all([
|
|
247
307
|
this.context.aztecNode.getWorldStateSyncStatus(),
|
|
248
|
-
await this.context.aztecNode.
|
|
308
|
+
await this.context.aztecNode.getChainTips()
|
|
249
309
|
]);
|
|
250
310
|
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, {
|
|
251
311
|
blockNumber,
|
|
@@ -273,12 +333,25 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
273
333
|
await wallet.registerContract(instance, SpamContract.artifact);
|
|
274
334
|
return SpamContract.at(instance.address, wallet);
|
|
275
335
|
}
|
|
336
|
+
/** Registers the TestContract on the given wallet. */ async registerTestContract(wallet, salt = Fr.ZERO) {
|
|
337
|
+
const instance = await getContractInstanceFromInstantiationParams(TestContract.artifact, {
|
|
338
|
+
constructorArgs: [],
|
|
339
|
+
constructorArtifact: undefined,
|
|
340
|
+
salt,
|
|
341
|
+
publicKeys: undefined,
|
|
342
|
+
deployer: undefined
|
|
343
|
+
});
|
|
344
|
+
await wallet.registerContract(instance, TestContract.artifact);
|
|
345
|
+
return TestContract.at(instance.address, wallet);
|
|
346
|
+
}
|
|
276
347
|
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */ async createL1Client() {
|
|
277
|
-
const
|
|
348
|
+
const rawClient = createExtendedL1Client([
|
|
278
349
|
...this.l1Client.chain.rpcUrls.default.http
|
|
279
|
-
], privateKeyToAccount(this.getNextPrivateKey()), this.l1Client.chain)
|
|
350
|
+
], privateKeyToAccount(this.getNextPrivateKey()), this.l1Client.chain);
|
|
351
|
+
const delayer = createDelayer(this.context.dateProvider, {
|
|
280
352
|
ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S
|
|
281
|
-
});
|
|
353
|
+
}, {});
|
|
354
|
+
const client = wrapClientWithDelayer(rawClient, delayer);
|
|
282
355
|
expect(await client.getBalance({
|
|
283
356
|
address: client.account.address
|
|
284
357
|
})).toBeGreaterThan(0n);
|
|
@@ -296,7 +369,34 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
296
369
|
]).then((_)=>true).catch((_)=>false);
|
|
297
370
|
expect(result).toBe(expectedSuccess);
|
|
298
371
|
}
|
|
299
|
-
|
|
372
|
+
/** Verifies at least one checkpoint has the target number of blocks (for MBPS validation). */ async assertMultipleBlocksPerSlot(targetBlockCount) {
|
|
373
|
+
const archiver = this.context.aztecNode.getBlockSource();
|
|
374
|
+
const checkpoints = await archiver.getCheckpoints({
|
|
375
|
+
from: CheckpointNumber(1),
|
|
376
|
+
limit: 50
|
|
377
|
+
});
|
|
378
|
+
this.logger.warn(`Retrieved ${checkpoints.length} checkpoints from archiver`, {
|
|
379
|
+
checkpoints: checkpoints.map((pc)=>pc.checkpoint.getStats())
|
|
380
|
+
});
|
|
381
|
+
let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
|
|
382
|
+
let targetFound = false;
|
|
383
|
+
for (const checkpoint of checkpoints){
|
|
384
|
+
const blockCount = checkpoint.checkpoint.blocks.length;
|
|
385
|
+
targetFound = targetFound || blockCount >= targetBlockCount;
|
|
386
|
+
this.logger.verbose(`Checkpoint ${checkpoint.checkpoint.number} has ${blockCount} blocks`, {
|
|
387
|
+
checkpoint: checkpoint.checkpoint.getStats()
|
|
388
|
+
});
|
|
389
|
+
for(let i = 0; i < blockCount; i++){
|
|
390
|
+
const block = checkpoint.checkpoint.blocks[i];
|
|
391
|
+
expect(block.indexWithinCheckpoint).toBe(i);
|
|
392
|
+
expect(block.checkpointNumber).toBe(checkpoint.checkpoint.number);
|
|
393
|
+
expect(block.number).toBe(expectedBlockNumber);
|
|
394
|
+
expectedBlockNumber++;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
expect(targetFound).toBe(true);
|
|
398
|
+
}
|
|
399
|
+
watchSequencerEvents(sequencers, getMetadata = ()=>({}), additionalFailEventKeys = []) {
|
|
300
400
|
const stateChanges = [];
|
|
301
401
|
const failEvents = [];
|
|
302
402
|
// Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
|
|
@@ -304,7 +404,12 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
304
404
|
const failEventsKeys = [
|
|
305
405
|
'block-build-failed',
|
|
306
406
|
'checkpoint-publish-failed',
|
|
307
|
-
'proposer-rollup-check-failed'
|
|
407
|
+
'proposer-rollup-check-failed',
|
|
408
|
+
'checkpoint-error',
|
|
409
|
+
'checkpoint-publish-failed',
|
|
410
|
+
'header-validation-failed',
|
|
411
|
+
'pipelined-checkpoint-discarded',
|
|
412
|
+
...additionalFailEventKeys
|
|
308
413
|
];
|
|
309
414
|
const makeEvent = (i, eventName, args)=>({
|
|
310
415
|
...args,
|
|
@@ -328,6 +433,13 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
328
433
|
});
|
|
329
434
|
failEventsKeys.forEach((eventName)=>{
|
|
330
435
|
sequencer.getSequencer().on(eventName, (args)=>{
|
|
436
|
+
// Skip benign block-build-failed events where the builder rejected the block because it
|
|
437
|
+
// could not collect enough valid txs. This is the same "not enough txs" case as
|
|
438
|
+
// block-tx-count-check-failed (which is already excluded above), just detected after we
|
|
439
|
+
// started processing txs rather than before.
|
|
440
|
+
if (eventName === 'block-build-failed' && args.reason === 'Insufficient valid txs') {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
331
443
|
const evt = makeEvent(i, eventName, args);
|
|
332
444
|
failEvents.push(evt);
|
|
333
445
|
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
|
|
@@ -339,4 +451,10 @@ export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
|
339
451
|
stateChanges
|
|
340
452
|
};
|
|
341
453
|
}
|
|
454
|
+
assertNoFailuresFromSequencers(failEvents) {
|
|
455
|
+
if (failEvents.length > 0) {
|
|
456
|
+
this.logger.error(`Failed events from sequencers`, failEvents);
|
|
457
|
+
}
|
|
458
|
+
expect(failEvents).toEqual([]);
|
|
459
|
+
}
|
|
342
460
|
}
|
|
@@ -15,10 +15,10 @@ import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
|
15
15
|
import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
16
16
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
17
17
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
19
18
|
import { type EndToEndContext, type SetupOptions } from '../fixtures/setup.js';
|
|
20
19
|
import { type BalancesFn } from '../fixtures/utils.js';
|
|
21
20
|
import { type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
21
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
22
22
|
/**
|
|
23
23
|
* Test fixture for testing fees. Provides the following setup steps:
|
|
24
24
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
@@ -60,11 +60,13 @@ export declare class FeesTest {
|
|
|
60
60
|
getBananaPublicBalanceFn: BalancesFn;
|
|
61
61
|
getBananaPrivateBalanceFn: BalancesFn;
|
|
62
62
|
getProverFee: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
63
|
+
getCommittedProverFee: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
64
|
+
getCommittedBurn: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
63
65
|
readonly ALICE_INITIAL_BANANAS: bigint;
|
|
64
66
|
readonly SUBSCRIPTION_AMOUNT: bigint;
|
|
65
67
|
readonly APP_SPONSORED_TX_GAS_LIMIT: bigint;
|
|
66
68
|
constructor(testName: string, numberOfAccounts?: number, setupOptions?: Partial<SetupOptions & DeployAztecL1ContractsArgs>);
|
|
67
|
-
setup(): Promise<this>;
|
|
69
|
+
setup(opts?: Partial<SetupOptions>): Promise<this>;
|
|
68
70
|
teardown(): Promise<void>;
|
|
69
71
|
setIsMarkingAsProven(b: boolean): void;
|
|
70
72
|
catchUpProvenChain(): Promise<void>;
|
|
@@ -76,6 +78,7 @@ export declare class FeesTest {
|
|
|
76
78
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
77
79
|
mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
|
|
78
80
|
applyBaseSetup(): Promise<void>;
|
|
81
|
+
applyEnsureAuthRegistryPublished(): Promise<void>;
|
|
79
82
|
applyInitialAccounts(): Promise<void>;
|
|
80
83
|
applyPublicDeployAccounts(): Promise<void>;
|
|
81
84
|
applySetupFeeJuice(): Promise<void>;
|
|
@@ -85,4 +88,4 @@ export declare class FeesTest {
|
|
|
85
88
|
applyFundAliceWithBananas(): Promise<void>;
|
|
86
89
|
applyFundAliceWithPrivateBananas(): Promise<void>;
|
|
87
90
|
}
|
|
88
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlc190ZXN0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZTJlX2ZlZXMvZmVlc190ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSxxQkFBcUIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsVUFBVSxFQUFpQyxNQUFNLHNCQUFzQixDQUFDO0FBRWpGLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSwwQkFBMEIsRUFBRSxNQUFNLDJDQUEyQyxDQUFDO0FBQzVGLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUNwRCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRzNELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDBDQUEwQyxDQUFDO0FBQ25GLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUF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AE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,gBAAgB,EAAG,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE,SAAgB,qBAAqB,SAAgB;IACrD,SAAgB,mBAAmB,SAAgB;IACnD,SAAgB,0BAA0B,SAAgB;IAE1D,YACE,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI,EACpB,YAAY,GAAE,OAAO,CAAC,YAAY,GAAG,0BAA0B,CAAM,EAQ9E;IAEK,KAAK,CAAC,IAAI,GAAE,OAAO,CAAC,YAAY,CAAM,iBAoB3C;IAEK,QAAQ,kBAGb;IAED,oBAAoB,CAAC,CAAC,EAAE,OAAO,QAE9B;IAEK,kBAAkB,kBAKvB;IAEK,eAAe;;;OAWpB;IAEK,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,iBAIxE;IAED,sFAAsF;IAChF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,iBAW7D;IAEY,cAAc,kBAM1B;IAEK,gCAAgC,kBAGrC;IAEK,oBAAoB,kBA2BzB;IAEK,yBAAyB,kBAG9B;IAEK,kBAAkB,kBAcvB;IAEK,sBAAsB,kBAe3B;IAEY,aAAa,kBA6EzB;IAEY,sBAAsB,kBAUlC;IAEY,yBAAyB,kBAOrC;IAEY,gCAAgC,kBAI5C;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
2
3
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
4
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
@@ -13,8 +14,8 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
13
14
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
14
15
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
15
16
|
import { getContract } from 'viem';
|
|
16
|
-
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
17
|
-
import { deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
17
|
+
import { MNEMONIC, getPaddedMaxFeesPerGas } from '../fixtures/fixtures.js';
|
|
18
|
+
import { deployAccounts, ensureAuthRegistryPublished, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
18
19
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
19
20
|
import { getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
20
21
|
import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
|
|
@@ -58,6 +59,8 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
58
59
|
getBananaPublicBalanceFn;
|
|
59
60
|
getBananaPrivateBalanceFn;
|
|
60
61
|
getProverFee;
|
|
62
|
+
getCommittedProverFee;
|
|
63
|
+
getCommittedBurn;
|
|
61
64
|
ALICE_INITIAL_BANANAS;
|
|
62
65
|
SUBSCRIPTION_AMOUNT;
|
|
63
66
|
APP_SPONSORED_TX_GAS_LIMIT;
|
|
@@ -75,16 +78,23 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
75
78
|
this.coinbase = setupOptions.coinbase;
|
|
76
79
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
77
80
|
}
|
|
78
|
-
async setup() {
|
|
81
|
+
async setup(opts = {}) {
|
|
79
82
|
this.logger.verbose('Setting up fresh context...');
|
|
83
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
84
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
80
85
|
this.context = await setup(0, {
|
|
81
86
|
startProverNode: true,
|
|
82
87
|
...this.setupOptions,
|
|
88
|
+
...opts,
|
|
83
89
|
fundSponsoredFPC: true,
|
|
84
90
|
skipAccountDeployment: true,
|
|
85
91
|
l1ContractsArgs: {
|
|
86
92
|
...this.setupOptions
|
|
87
|
-
}
|
|
93
|
+
},
|
|
94
|
+
txPublicSetupAllowListExtend: [
|
|
95
|
+
...this.setupOptions.txPublicSetupAllowListExtend ?? [],
|
|
96
|
+
...tokenAllowList
|
|
97
|
+
]
|
|
88
98
|
});
|
|
89
99
|
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
90
100
|
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
@@ -100,7 +110,7 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
100
110
|
}
|
|
101
111
|
async catchUpProvenChain() {
|
|
102
112
|
const bn = await this.aztecNode.getBlockNumber();
|
|
103
|
-
while(await this.aztecNode.
|
|
113
|
+
while(await this.aztecNode.getBlockNumber('proven') < bn){
|
|
104
114
|
await sleep(1000);
|
|
105
115
|
}
|
|
106
116
|
}
|
|
@@ -124,21 +134,26 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
124
134
|
});
|
|
125
135
|
}
|
|
126
136
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
|
|
127
|
-
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
128
|
-
from:
|
|
137
|
+
const { result: balanceBefore } = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
138
|
+
from: address
|
|
129
139
|
});
|
|
130
140
|
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
131
|
-
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
132
|
-
from:
|
|
141
|
+
const { result: balanceAfter } = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
142
|
+
from: address
|
|
133
143
|
});
|
|
134
144
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
135
145
|
}
|
|
136
146
|
async applyBaseSetup() {
|
|
137
147
|
await this.applyInitialAccounts();
|
|
148
|
+
await this.applyEnsureAuthRegistryPublished();
|
|
138
149
|
await this.applyPublicDeployAccounts();
|
|
139
150
|
await this.applySetupFeeJuice();
|
|
140
151
|
await this.applyDeployBananaToken();
|
|
141
152
|
}
|
|
153
|
+
async applyEnsureAuthRegistryPublished() {
|
|
154
|
+
this.logger.info('Ensuring AuthRegistry published');
|
|
155
|
+
await ensureAuthRegistryPublished(this.wallet, this.aliceAddress);
|
|
156
|
+
}
|
|
142
157
|
async applyInitialAccounts() {
|
|
143
158
|
this.logger.info('Applying initial accounts setup');
|
|
144
159
|
const { deployedAccounts } = await deployAccounts(this.numberOfAccounts, this.logger)({
|
|
@@ -148,8 +163,8 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
148
163
|
this.wallet = this.context.wallet;
|
|
149
164
|
this.aztecNode = this.context.aztecNodeService;
|
|
150
165
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
151
|
-
this.gasSettings = GasSettings.
|
|
152
|
-
maxFeesPerGas:
|
|
166
|
+
this.gasSettings = GasSettings.fallback({
|
|
167
|
+
maxFeesPerGas: await getPaddedMaxFeesPerGas(this.aztecNode)
|
|
153
168
|
});
|
|
154
169
|
this.cheatCodes = this.context.cheatCodes;
|
|
155
170
|
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
@@ -167,7 +182,7 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
167
182
|
async applySetupFeeJuice() {
|
|
168
183
|
this.logger.info('Applying fee juice setup');
|
|
169
184
|
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
170
|
-
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.
|
|
185
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
171
186
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
172
187
|
aztecNode: this.context.aztecNodeService,
|
|
173
188
|
aztecNodeAdmin: this.context.aztecNodeService,
|
|
@@ -178,20 +193,20 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
178
193
|
}
|
|
179
194
|
async applyDeployBananaToken() {
|
|
180
195
|
this.logger.info('Applying deploy banana token setup');
|
|
181
|
-
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
196
|
+
const { contract: bananaCoin } = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
182
197
|
from: this.aliceAddress
|
|
183
198
|
});
|
|
184
199
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
185
200
|
this.bananaCoin = bananaCoin;
|
|
186
|
-
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.
|
|
187
|
-
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.
|
|
201
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.logger);
|
|
202
|
+
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.logger);
|
|
188
203
|
}
|
|
189
204
|
async applyFPCSetup() {
|
|
190
205
|
this.logger.info('Applying FPC setup');
|
|
191
206
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
192
207
|
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
193
208
|
const bananaCoin = this.bananaCoin;
|
|
194
|
-
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
209
|
+
const { contract: bananaFPC } = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
195
210
|
from: this.aliceAddress
|
|
196
211
|
});
|
|
197
212
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
@@ -216,7 +231,7 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
216
231
|
const block = await this.aztecNode.getBlock(blockNumber);
|
|
217
232
|
// @todo @lherskind As we deal with #13601
|
|
218
233
|
// Right now the value is from `FeeLib.sol`
|
|
219
|
-
const L1_GAS_PER_EPOCH_VERIFIED =
|
|
234
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 3600000n;
|
|
220
235
|
// We round up
|
|
221
236
|
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
222
237
|
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
@@ -225,6 +240,24 @@ import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_h
|
|
|
225
240
|
const mana = block.header.totalManaUsed.toBigInt();
|
|
226
241
|
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
227
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* Reads the prover fee that the rollup actually committed for the block's checkpoint, which is what
|
|
245
|
+
* RewardLib uses to pay prover rewards. Unlike `getProverFee`, this does not re-derive the value
|
|
246
|
+
* from current L1 fees or current eth-per-fee-asset price, so it is robust to pipelined fee-asset-price
|
|
247
|
+
* drift between propose-time and reward-payout-time.
|
|
248
|
+
*/ this.getCommittedProverFee = async (blockNumber)=>{
|
|
249
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
250
|
+
const feeHeader = await this.rollupContract.getFeeHeader(BigInt(block.checkpointNumber));
|
|
251
|
+
return feeHeader.manaUsed * feeHeader.proverCost;
|
|
252
|
+
};
|
|
253
|
+
// RewardLib computes sequencerFee = checkpointFee - burn - proverFee where burn = manaUsed * congestionCost.
|
|
254
|
+
// The fixture's typical case keeps congestionCost at zero, but reading it explicitly avoids latent bugs
|
|
255
|
+
// when test load changes excess mana.
|
|
256
|
+
this.getCommittedBurn = async (blockNumber)=>{
|
|
257
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
258
|
+
const feeHeader = await this.rollupContract.getFeeHeader(BigInt(block.checkpointNumber));
|
|
259
|
+
return feeHeader.manaUsed * feeHeader.congestionCost;
|
|
260
|
+
};
|
|
228
261
|
}
|
|
229
262
|
async applySponsoredFPCSetup() {
|
|
230
263
|
this.logger.info('Applying sponsored FPC setup');
|
|
@@ -2,9 +2,10 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
|
2
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
4
4
|
import { L2Block } from '@aztec/stdlib/block';
|
|
5
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a json object that can be used to test the solidity contract.
|
|
7
8
|
* The json object must be put into
|
|
8
9
|
*/
|
|
9
|
-
export declare function writeJson(fileName: string, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
export declare function writeJson(fileName: string, checkpointHeader: CheckpointHeader, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JpdGVfanNvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2UyZV9sMV9wdWJsaXNoZXIvd3JpdGVfanNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRSxXQUFXLEVBQUUsSUFBSSxFQUE2RCxNQUFNLGlCQUFpQixDQUFDO0FBRS9HLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQU14RDs7O0dBR0c7QUFDSCx3QkFBc0IsU0FBUyxDQUM3QixRQUFRLEVBQUUsTUFBTSxFQUNoQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDbEMsS0FBSyxFQUFFLE9BQU8sRUFDZCxhQUFhLEVBQUUsRUFBRSxFQUFFLEVBQ25CLEtBQUssRUFBRSxJQUFJLEVBQUUsRUFDYixXQUFXLEVBQUUsV0FBVyxFQUN4QixnQkFBZ0IsRUFBRSxZQUFZLEVBQzlCLGVBQWUsRUFBRSxLQUFLLE1BQU0sRUFBRSxHQUM3QixPQUFPLENBQUMsSUFBSSxDQUFDLENBb0RmIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/e2e_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAA6D,MAAM,iBAAiB,CAAC;AAE/G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/e2e_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAA6D,MAAM,iBAAiB,CAAC;AAE/G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,EAAE,EAAE,EACnB,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,YAAY,EAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|