@aztec/end-to-end 0.0.0-test.0 → 0.0.1-commit.023c3e5
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/dest/bench/client_flows/benchmark.d.ts +62 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +281 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +321 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +79 -0
- package/dest/bench/utils.d.ts +16 -41
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +41 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -19
- 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 +114 -102
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
- 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 +104 -104
- package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +26 -27
- package/dest/e2e_epochs/epochs_test.d.ts +71 -22
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +260 -54
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +61 -0
- package/dest/e2e_fees/fees_test.d.ts +38 -23
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +162 -183
- package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +56 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +15 -15
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +37 -41
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
- package/dest/e2e_p2p/p2p_network.d.ts +281 -27
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +237 -175
- 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 +153 -0
- package/dest/e2e_p2p/shared.d.ts +44 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +165 -27
- package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +96 -74
- package/dest/fixtures/e2e_prover_test.d.ts +55 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.js +278 -0
- package/dest/fixtures/fixtures.d.ts +6 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +5 -5
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +3 -15
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +45 -19
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +218 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +695 -0
- package/dest/fixtures/setup_p2p_test.d.ts +15 -15
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +96 -31
- package/dest/fixtures/token_utils.d.ts +10 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +31 -12
- package/dest/fixtures/utils.d.ts +5 -153
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -552
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- 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/index.d.ts +1 -1
- 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 +44 -27
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +105 -51
- package/dest/shared/gas_portal_test_harness.d.ts +33 -25
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +51 -30
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +15 -16
- package/dest/shared/uniswap_l1_l2.d.ts +3 -25
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +176 -126
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +7 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +17 -18
- package/dest/simulators/token_simulator.d.ts +6 -3
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +27 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +233 -62
- 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 +422 -0
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -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 +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -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 +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- package/package.json +66 -58
- package/src/bench/client_flows/benchmark.ts +363 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +41 -85
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
- package/src/e2e_deploy_contract/deploy_test.ts +40 -48
- package/src/e2e_epochs/epochs_test.ts +341 -81
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +220 -258
- package/src/e2e_l1_publisher/write_json.ts +77 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +46 -59
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +341 -234
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +260 -39
- package/src/e2e_token_contract/token_contract_test.ts +115 -126
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +336 -0
- package/src/fixtures/fixtures.ts +5 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +133 -50
- package/src/fixtures/token_utils.ts +33 -15
- package/src/fixtures/utils.ts +27 -820
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +7 -15
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +103 -91
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/index.ts +1 -1
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +18 -20
- package/src/shared/uniswap_l1_l2.ts +197 -221
- package/src/simulators/lending_simulator.ts +16 -17
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +308 -95
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -582
- package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/e2e_prover/e2e_prover_test.js +0 -291
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- 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 -87
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -479
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/e2e_prover/e2e_prover_test.ts +0 -418
- package/src/fixtures/setup_l1_contracts.ts +0 -27
- package/src/fixtures/snapshot_manager.ts +0 -617
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
3
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import { MerkleTreeId } from '@aztec/aztec.js/trees';
|
|
6
|
+
import { EpochCache } from '@aztec/epoch-cache';
|
|
7
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
8
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
4
9
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
-
import { waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
10
|
+
import { ChainMonitor, DelayedTxUtils, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
11
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
12
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
13
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
15
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
17
|
+
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
18
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
19
|
+
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
20
|
+
import { SequencerState } from '@aztec/sequencer-client';
|
|
21
|
+
import { EthAddress } from '@aztec/stdlib/block';
|
|
22
|
+
import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
23
|
+
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
9
24
|
import { join } from 'path';
|
|
25
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
10
26
|
import { createAndSyncProverNode, getPrivateKeyFromIndex, setup } from '../fixtures/utils.js';
|
|
11
|
-
// This can be lowered to as much as 2s in non-CI
|
|
12
|
-
export const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8;
|
|
13
|
-
export const EPOCH_DURATION_IN_L2_SLOTS = 4;
|
|
14
|
-
export const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
15
27
|
export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
16
28
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
17
29
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
30
|
+
export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
18
31
|
/**
|
|
19
32
|
* Tests building of epochs using fast block times and short epochs.
|
|
20
33
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -26,39 +39,68 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
26
39
|
constants;
|
|
27
40
|
logger;
|
|
28
41
|
monitor;
|
|
42
|
+
epochCache;
|
|
29
43
|
proverDelayer;
|
|
30
44
|
sequencerDelayer;
|
|
31
45
|
proverNodes = [];
|
|
32
46
|
nodes = [];
|
|
47
|
+
epochDuration;
|
|
48
|
+
L1_BLOCK_TIME_IN_S;
|
|
49
|
+
L2_SLOT_DURATION_IN_S;
|
|
33
50
|
static async setup(opts = {}) {
|
|
34
51
|
const test = new EpochsTestContext();
|
|
35
52
|
await test.setup(opts);
|
|
36
53
|
return test;
|
|
37
54
|
}
|
|
55
|
+
static getSlotDurations(opts = {}) {
|
|
56
|
+
const envEthereumSlotDuration = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : DEFAULT_L1_BLOCK_TIME;
|
|
57
|
+
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
|
|
58
|
+
const aztecSlotDuration = opts.aztecSlotDuration ?? (opts.aztecSlotDurationInL1Slots ?? 2) * ethereumSlotDuration;
|
|
59
|
+
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
60
|
+
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
61
|
+
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
62
|
+
return {
|
|
63
|
+
l1PublishingTime,
|
|
64
|
+
ethereumSlotDuration,
|
|
65
|
+
aztecSlotDuration,
|
|
66
|
+
aztecEpochDuration,
|
|
67
|
+
aztecProofSubmissionEpochs
|
|
68
|
+
};
|
|
69
|
+
}
|
|
38
70
|
async setup(opts = {}) {
|
|
71
|
+
const { ethereumSlotDuration, aztecSlotDuration, aztecEpochDuration, aztecProofSubmissionEpochs, l1PublishingTime } = EpochsTestContext.getSlotDurations(opts);
|
|
72
|
+
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
73
|
+
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
39
74
|
// Set up system without any account nor protocol contracts
|
|
40
75
|
// and with faster block times and shorter epochs.
|
|
41
|
-
const context = await setup(0, {
|
|
76
|
+
const context = await setup(opts.numberOfAccounts ?? 0, {
|
|
77
|
+
automineL1Setup: true,
|
|
42
78
|
checkIntervalMs: 50,
|
|
43
79
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
44
80
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
aztecProofSubmissionWindow: EPOCH_DURATION_IN_L2_SLOTS * 2 - 1,
|
|
81
|
+
aztecEpochDuration,
|
|
82
|
+
aztecSlotDuration,
|
|
83
|
+
ethereumSlotDuration,
|
|
84
|
+
aztecProofSubmissionEpochs,
|
|
85
|
+
aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
|
|
51
86
|
minTxsPerBlock: 0,
|
|
52
87
|
realProofs: false,
|
|
53
88
|
startProverNode: true,
|
|
89
|
+
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
54
90
|
// We use numeric incremental prover ids for simplicity, but we can switch to
|
|
55
91
|
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// but not so much to hang the sequencer and timeout the teardown
|
|
59
|
-
txPropagationMaxQueryAttempts: 12,
|
|
92
|
+
// Use numeric EthAddress for deterministic prover id
|
|
93
|
+
proverId: EthAddress.fromNumber(1),
|
|
60
94
|
worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
|
|
95
|
+
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
96
|
+
slasherFlavor: 'none',
|
|
97
|
+
l1PublishingTime,
|
|
61
98
|
...opts
|
|
99
|
+
}, // Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
100
|
+
// Can be overridden via opts.pxeOpts.
|
|
101
|
+
{
|
|
102
|
+
syncChainTip: 'checkpointed',
|
|
103
|
+
...opts.pxeOpts
|
|
62
104
|
});
|
|
63
105
|
this.context = context;
|
|
64
106
|
this.proverNodes = context.proverNode ? [
|
|
@@ -68,52 +110,113 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
68
110
|
context.aztecNode
|
|
69
111
|
] : [];
|
|
70
112
|
this.logger = context.logger;
|
|
71
|
-
this.l1Client = context.deployL1ContractsValues.
|
|
113
|
+
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
72
114
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
115
|
+
this.epochCache = await EpochCache.create(this.rollup, context.config, {
|
|
116
|
+
dateProvider: context.dateProvider
|
|
117
|
+
});
|
|
73
118
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
74
|
-
this.monitor = new ChainMonitor(this.rollup, this.logger).start();
|
|
119
|
+
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
75
120
|
// This is hideous.
|
|
76
121
|
// We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
|
|
77
122
|
this.proverDelayer = context.proverNode ? context.proverNode.publisher.l1TxUtils.delayer : undefined;
|
|
78
|
-
this.sequencerDelayer = context.sequencer.sequencer.publisher.l1TxUtils.delayer;
|
|
79
|
-
if (context.proverNode && !this.proverDelayer || !this.sequencerDelayer) {
|
|
123
|
+
this.sequencerDelayer = context.sequencer ? context.sequencer.sequencer.publisher.l1TxUtils.delayer : undefined;
|
|
124
|
+
if (context.proverNode && !this.proverDelayer || context.sequencer && !this.sequencerDelayer) {
|
|
80
125
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
81
126
|
}
|
|
82
127
|
// Constants used for time calculation
|
|
128
|
+
this.epochDuration = aztecEpochDuration;
|
|
83
129
|
this.constants = {
|
|
84
|
-
epochDuration:
|
|
85
|
-
slotDuration:
|
|
130
|
+
epochDuration: aztecEpochDuration,
|
|
131
|
+
slotDuration: aztecSlotDuration,
|
|
86
132
|
l1StartBlock: await this.rollup.getL1StartBlock(),
|
|
87
133
|
l1GenesisTime: await this.rollup.getL1GenesisTime(),
|
|
88
|
-
ethereumSlotDuration
|
|
134
|
+
ethereumSlotDuration,
|
|
135
|
+
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs())
|
|
89
136
|
};
|
|
90
137
|
this.logger.info(`L2 genesis at L1 block ${this.constants.l1StartBlock} (timestamp ${this.constants.l1GenesisTime})`);
|
|
91
138
|
}
|
|
92
139
|
async teardown() {
|
|
93
|
-
this.monitor.stop();
|
|
94
|
-
await Promise.all(this.proverNodes.map((node)=>node.
|
|
95
|
-
await Promise.all(this.nodes.map((node)=>node.
|
|
140
|
+
await this.monitor.stop();
|
|
141
|
+
await Promise.all(this.proverNodes.map((node)=>tryStop(node, this.logger)));
|
|
142
|
+
await Promise.all(this.nodes.map((node)=>tryStop(node, this.logger)));
|
|
96
143
|
await this.context.teardown();
|
|
97
144
|
}
|
|
98
|
-
async createProverNode() {
|
|
145
|
+
async createProverNode(opts = {}) {
|
|
99
146
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
100
147
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
101
|
-
const
|
|
102
|
-
const proverNode = await
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
148
|
+
const proverIndex = this.proverNodes.length + 1;
|
|
149
|
+
const proverNode = await withLoggerBindings({
|
|
150
|
+
actor: `prover-${proverIndex}`
|
|
151
|
+
}, ()=>createAndSyncProverNode(proverNodePrivateKey, {
|
|
152
|
+
...this.context.config
|
|
153
|
+
}, {
|
|
154
|
+
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
|
|
155
|
+
proverId: EthAddress.fromNumber(proverIndex),
|
|
156
|
+
dontStart: opts.dontStart,
|
|
157
|
+
...opts
|
|
158
|
+
}, this.context.aztecNode, this.context.prefilledPublicData ?? [], {
|
|
159
|
+
dateProvider: this.context.dateProvider
|
|
160
|
+
}));
|
|
106
161
|
this.proverNodes.push(proverNode);
|
|
107
162
|
return proverNode;
|
|
108
163
|
}
|
|
109
|
-
|
|
164
|
+
createNonValidatorNode(opts = {}) {
|
|
110
165
|
this.logger.warn('Creating and syncing a node without a validator...');
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
166
|
+
return this.createNode({
|
|
167
|
+
...opts,
|
|
168
|
+
disableValidator: true
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
createValidatorNode(privateKeys, opts = {}) {
|
|
172
|
+
this.logger.warn('Creating and syncing a validator node...');
|
|
173
|
+
return this.createNode({
|
|
174
|
+
...opts,
|
|
175
|
+
disableValidator: false,
|
|
176
|
+
validatorPrivateKeys: new SecretValue(privateKeys)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
async createNode(opts = {}) {
|
|
180
|
+
const nodeIndex = this.nodes.length + 1;
|
|
181
|
+
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
182
|
+
const { mockGossipSubNetwork } = this.context;
|
|
183
|
+
const resolvedConfig = {
|
|
184
|
+
...this.context.config,
|
|
185
|
+
...opts
|
|
186
|
+
};
|
|
187
|
+
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
188
|
+
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
189
|
+
const node = await withLoggerBindings({
|
|
190
|
+
actor: `${actorPrefix}-${nodeIndex}`
|
|
191
|
+
}, ()=>AztecNodeService.createAndSync({
|
|
192
|
+
...resolvedConfig,
|
|
193
|
+
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
|
|
194
|
+
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
195
|
+
p2pEnabled,
|
|
196
|
+
p2pIp
|
|
197
|
+
}, {
|
|
198
|
+
dateProvider: this.context.dateProvider,
|
|
199
|
+
p2pClientDeps: {
|
|
200
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
prefilledPublicData: this.context.prefilledPublicData,
|
|
204
|
+
...opts
|
|
116
205
|
}));
|
|
206
|
+
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
207
|
+
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
208
|
+
// which directly exposes the delayer and sets any test config.
|
|
209
|
+
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
210
|
+
this.logger.info(`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`);
|
|
211
|
+
// 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.
|
|
212
|
+
// The delayer needs a wallet (a client that can sign), so we have to create one here.
|
|
213
|
+
const l1Client = createExtendedL1Client(resolvedConfig.l1RpcUrls, resolvedConfig.publisherPrivateKeys[0].getValue());
|
|
214
|
+
const sequencer = node.getSequencer();
|
|
215
|
+
const publisher = sequencer.sequencer.publisher;
|
|
216
|
+
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
|
|
217
|
+
delayed.delayer.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
218
|
+
publisher.l1TxUtils = delayed;
|
|
219
|
+
}
|
|
117
220
|
this.nodes.push(node);
|
|
118
221
|
return node;
|
|
119
222
|
}
|
|
@@ -122,34 +225,137 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
122
225
|
return `0x${key.toString('hex')}`;
|
|
123
226
|
}
|
|
124
227
|
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */ async waitUntilEpochStarts(epoch) {
|
|
125
|
-
const [start] = getTimestampRangeForEpoch(
|
|
228
|
+
const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
|
|
126
229
|
this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
|
|
127
|
-
await waitUntilL1Timestamp(this.l1Client, start - BigInt(L1_BLOCK_TIME_IN_S));
|
|
230
|
+
await waitUntilL1Timestamp(this.l1Client, start - BigInt(this.L1_BLOCK_TIME_IN_S), undefined, 30 * this.epochDuration);
|
|
128
231
|
return start;
|
|
129
232
|
}
|
|
130
|
-
/** Waits until the given
|
|
131
|
-
await retryUntil(()=>Promise.resolve(target
|
|
233
|
+
/** Waits until the given checkpoint number is mined. */ async waitUntilCheckpointNumber(target, timeout = 120) {
|
|
234
|
+
await retryUntil(()=>Promise.resolve(target <= this.monitor.checkpointNumber), `Wait until checkpoint ${target}`, timeout, 0.1);
|
|
132
235
|
}
|
|
133
|
-
/** Waits until the given
|
|
134
|
-
await retryUntil(()=>Promise.resolve(
|
|
236
|
+
/** Waits until the given checkpoint number is marked as proven. */ async waitUntilProvenCheckpointNumber(target, timeout = 120) {
|
|
237
|
+
await retryUntil(()=>Promise.resolve(target <= this.monitor.provenCheckpointNumber), `Wait proven checkpoint ${target}`, timeout, 0.1);
|
|
238
|
+
return this.monitor.provenCheckpointNumber;
|
|
239
|
+
}
|
|
240
|
+
/** Waits until the last slot of the proof submission window for a given epoch. */ async waitUntilLastSlotOfProofSubmissionWindow(epochNumber) {
|
|
241
|
+
const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
|
|
242
|
+
const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
|
|
243
|
+
const date = new Date(Number(oneSlotBefore) * 1000);
|
|
244
|
+
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
245
|
+
oneSlotBefore
|
|
246
|
+
});
|
|
247
|
+
await waitUntilL1Timestamp(this.l1Client, oneSlotBefore);
|
|
135
248
|
}
|
|
136
249
|
/** Waits for the aztec node to sync to the target block number. */ async waitForNodeToSync(blockNumber, type) {
|
|
137
250
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
138
251
|
let synched = false;
|
|
139
252
|
while(!synched){
|
|
140
253
|
await sleep(waitTime);
|
|
141
|
-
const syncState = await
|
|
142
|
-
|
|
143
|
-
|
|
254
|
+
const [syncState, tips] = await Promise.all([
|
|
255
|
+
this.context.aztecNode.getWorldStateSyncStatus(),
|
|
256
|
+
await this.context.aztecNode.getL2Tips()
|
|
257
|
+
]);
|
|
258
|
+
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, {
|
|
259
|
+
blockNumber,
|
|
260
|
+
type,
|
|
261
|
+
syncState,
|
|
262
|
+
tips
|
|
263
|
+
});
|
|
264
|
+
if (type === 'proven') {
|
|
265
|
+
synched = tips.proven.block.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
|
|
266
|
+
} else if (type === 'finalized') {
|
|
267
|
+
synched = syncState.finalizedBlockNumber >= blockNumber;
|
|
144
268
|
} else {
|
|
145
269
|
synched = syncState.oldestHistoricBlockNumber >= blockNumber;
|
|
146
270
|
}
|
|
147
271
|
}
|
|
148
272
|
}
|
|
273
|
+
/** Registers the SpamContract on the given wallet. */ async registerSpamContract(wallet, salt = Fr.ZERO) {
|
|
274
|
+
const instance = await getContractInstanceFromInstantiationParams(SpamContract.artifact, {
|
|
275
|
+
constructorArgs: [],
|
|
276
|
+
constructorArtifact: undefined,
|
|
277
|
+
salt,
|
|
278
|
+
publicKeys: undefined,
|
|
279
|
+
deployer: undefined
|
|
280
|
+
});
|
|
281
|
+
await wallet.registerContract(instance, SpamContract.artifact);
|
|
282
|
+
return SpamContract.at(instance.address, wallet);
|
|
283
|
+
}
|
|
284
|
+
/** Registers the TestContract on the given wallet. */ async registerTestContract(wallet, salt = Fr.ZERO) {
|
|
285
|
+
const instance = await getContractInstanceFromInstantiationParams(TestContract.artifact, {
|
|
286
|
+
constructorArgs: [],
|
|
287
|
+
constructorArtifact: undefined,
|
|
288
|
+
salt,
|
|
289
|
+
publicKeys: undefined,
|
|
290
|
+
deployer: undefined
|
|
291
|
+
});
|
|
292
|
+
await wallet.registerContract(instance, TestContract.artifact);
|
|
293
|
+
return TestContract.at(instance.address, wallet);
|
|
294
|
+
}
|
|
295
|
+
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */ async createL1Client() {
|
|
296
|
+
const { client, delayer } = withDelayer(createExtendedL1Client([
|
|
297
|
+
...this.l1Client.chain.rpcUrls.default.http
|
|
298
|
+
], privateKeyToAccount(this.getNextPrivateKey()), this.l1Client.chain), this.context.dateProvider, {
|
|
299
|
+
ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S
|
|
300
|
+
});
|
|
301
|
+
expect(await client.getBalance({
|
|
302
|
+
address: client.account.address
|
|
303
|
+
})).toBeGreaterThan(0n);
|
|
304
|
+
return {
|
|
305
|
+
client,
|
|
306
|
+
delayer
|
|
307
|
+
};
|
|
308
|
+
}
|
|
149
309
|
/** Verifies whether the given block number is found on the aztec node. */ async verifyHistoricBlock(blockNumber, expectedSuccess) {
|
|
150
|
-
|
|
151
|
-
|
|
310
|
+
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
311
|
+
// at a particular block, so we know whether that historic block is available or has been
|
|
312
|
+
// pruned. Note that `getBlock` would not work here, since it only hits the archiver.
|
|
313
|
+
const result = await this.context.aztecNode.findLeavesIndexes(blockNumber, MerkleTreeId.NULLIFIER_TREE, [
|
|
314
|
+
Fr.ZERO
|
|
152
315
|
]).then((_)=>true).catch((_)=>false);
|
|
153
316
|
expect(result).toBe(expectedSuccess);
|
|
154
317
|
}
|
|
318
|
+
watchSequencerEvents(sequencers, getMetadata = ()=>({})) {
|
|
319
|
+
const stateChanges = [];
|
|
320
|
+
const failEvents = [];
|
|
321
|
+
// Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
|
|
322
|
+
// due to lack of txs available.
|
|
323
|
+
const failEventsKeys = [
|
|
324
|
+
'block-build-failed',
|
|
325
|
+
'checkpoint-publish-failed',
|
|
326
|
+
'proposer-rollup-check-failed'
|
|
327
|
+
];
|
|
328
|
+
const makeEvent = (i, eventName, args)=>({
|
|
329
|
+
...args,
|
|
330
|
+
type: eventName,
|
|
331
|
+
sequencerIndex: i + 2,
|
|
332
|
+
...getMetadata(i)
|
|
333
|
+
});
|
|
334
|
+
sequencers.forEach((sequencer, i)=>{
|
|
335
|
+
const sequencerIndex = i + 2;
|
|
336
|
+
sequencer.getSequencer().on('state-changed', (args)=>{
|
|
337
|
+
const noisyStates = [
|
|
338
|
+
SequencerState.IDLE,
|
|
339
|
+
SequencerState.PROPOSER_CHECK,
|
|
340
|
+
SequencerState.SYNCHRONIZING
|
|
341
|
+
];
|
|
342
|
+
if (!noisyStates.includes(args.newState)) {
|
|
343
|
+
const evt = makeEvent(i, 'state-changed', args);
|
|
344
|
+
stateChanges.push(evt);
|
|
345
|
+
this.logger.verbose(`Sequencer ${sequencerIndex} transitioned from state ${args.oldState} to state ${args.newState}`, evt);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
failEventsKeys.forEach((eventName)=>{
|
|
349
|
+
sequencer.getSequencer().on(eventName, (args)=>{
|
|
350
|
+
const evt = makeEvent(i, eventName, args);
|
|
351
|
+
failEvents.push(evt);
|
|
352
|
+
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
return {
|
|
357
|
+
failEvents,
|
|
358
|
+
stateChanges
|
|
359
|
+
};
|
|
360
|
+
}
|
|
155
361
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridging_race.notest.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/bridging_race.notest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { Fq } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
5
|
+
import { jest } from '@jest/globals';
|
|
6
|
+
import { FeesTest } from './fees_test.js';
|
|
7
|
+
jest.setTimeout(300_000);
|
|
8
|
+
// Regression for https://github.com/AztecProtocol/aztec-packages/issues/12366
|
|
9
|
+
// Similar to e2e_fees/account_init but with no automine
|
|
10
|
+
describe('e2e_fees bridging_race', ()=>{
|
|
11
|
+
const ETHEREUM_SLOT_DURATION = 4;
|
|
12
|
+
const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
|
|
13
|
+
const t = new FeesTest('bridging_race', 1, {
|
|
14
|
+
ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
|
|
15
|
+
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
16
|
+
minTxsPerBlock: 0
|
|
17
|
+
});
|
|
18
|
+
beforeAll(async ()=>{
|
|
19
|
+
await t.setup();
|
|
20
|
+
({ wallet, logger } = t);
|
|
21
|
+
});
|
|
22
|
+
afterAll(async ()=>{
|
|
23
|
+
await t.teardown();
|
|
24
|
+
});
|
|
25
|
+
let logger;
|
|
26
|
+
let bobsAddress;
|
|
27
|
+
let wallet;
|
|
28
|
+
beforeEach(async ()=>{
|
|
29
|
+
const bobsSecretKey = Fr.random();
|
|
30
|
+
const bobsPrivateSigningKey = Fq.random();
|
|
31
|
+
const bobsSalt = Fr.random();
|
|
32
|
+
const bobsAccountManager = await wallet.createAccount({
|
|
33
|
+
secret: bobsSecretKey,
|
|
34
|
+
salt: bobsSalt,
|
|
35
|
+
contract: new SchnorrAccountContract(bobsPrivateSigningKey)
|
|
36
|
+
});
|
|
37
|
+
bobsAddress = bobsAccountManager.address;
|
|
38
|
+
});
|
|
39
|
+
it('Alice bridges funds to Bob', async ()=>{
|
|
40
|
+
// Tweak the token manager so the bridging happens immediately before the end of the current L2 slot
|
|
41
|
+
// This caused the message to be "not in state" when tried to be used
|
|
42
|
+
const l1TokenManager = t.feeJuiceBridgeTestHarness.l1TokenManager;
|
|
43
|
+
const origApprove = l1TokenManager.approve.bind(l1TokenManager);
|
|
44
|
+
l1TokenManager.approve = async (amount, address, addressName = '')=>{
|
|
45
|
+
await origApprove(amount, address, addressName);
|
|
46
|
+
const sleepTime = (Number(t.chainMonitor.checkpointTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
|
|
47
|
+
logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
|
|
48
|
+
await sleep(sleepTime);
|
|
49
|
+
};
|
|
50
|
+
// Waiting for the archiver to sync the message _before_ waiting for the mandatory 2 L2 blocks to pass fixed it
|
|
51
|
+
// This was added everywhere we wait for two blocks, which is spread across three different places in the codebase
|
|
52
|
+
// Yes, we need to REFACTOR it at some point
|
|
53
|
+
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(bobsAddress);
|
|
54
|
+
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
55
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, claim.claimAmount, secret, index).send({
|
|
56
|
+
from: bobsAddress
|
|
57
|
+
});
|
|
58
|
+
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
59
|
+
expect(balance).toEqual(claim.claimAmount);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -1,73 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { type Logger } from '@aztec/aztec.js/log';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
7
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
8
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
10
|
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
5
|
-
import { CounterContract } from '@aztec/noir-contracts.js/Counter';
|
|
6
11
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
7
12
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
13
|
+
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
8
14
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
15
|
+
import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
9
16
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
17
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
19
|
+
import { type EndToEndContext, type SetupOptions } from '../fixtures/setup.js';
|
|
20
|
+
import { type BalancesFn } from '../fixtures/utils.js';
|
|
12
21
|
import { type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
13
22
|
/**
|
|
14
|
-
* Test fixture for testing fees. Provides the following
|
|
23
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
15
24
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
16
25
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
17
26
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
18
27
|
* FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
|
|
28
|
+
* SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
|
|
19
29
|
* FundAlice: Mints private and public bananas to Alice.
|
|
20
30
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
21
31
|
*/
|
|
22
32
|
export declare class FeesTest {
|
|
23
33
|
private numberOfAccounts;
|
|
24
|
-
private
|
|
25
|
-
private
|
|
34
|
+
private setupOptions;
|
|
35
|
+
private accounts;
|
|
36
|
+
context: EndToEndContext;
|
|
26
37
|
logger: Logger;
|
|
27
|
-
pxe: PXE;
|
|
28
38
|
aztecNode: AztecNode;
|
|
39
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
29
40
|
cheatCodes: CheatCodes;
|
|
30
|
-
|
|
41
|
+
wallet: TestWallet;
|
|
31
42
|
aliceAddress: AztecAddress;
|
|
32
|
-
bobWallet: AccountWallet;
|
|
33
43
|
bobAddress: AztecAddress;
|
|
34
44
|
sequencerAddress: AztecAddress;
|
|
35
45
|
coinbase: EthAddress;
|
|
36
46
|
fpcAdmin: AztecAddress;
|
|
37
47
|
gasSettings: GasSettings;
|
|
48
|
+
rollupContract: RollupContract;
|
|
38
49
|
feeJuiceContract: FeeJuiceContract;
|
|
39
50
|
bananaCoin: BananaCoin;
|
|
40
51
|
bananaFPC: FPCContract;
|
|
52
|
+
sponsoredFPC: SponsoredFPCContract;
|
|
41
53
|
counterContract: CounterContract;
|
|
42
54
|
subscriptionContract: AppSubscriptionContract;
|
|
43
55
|
feeJuiceBridgeTestHarness: GasBridgingTestHarness;
|
|
44
|
-
context: SubsystemsContext;
|
|
45
56
|
chainMonitor: ChainMonitor;
|
|
46
57
|
getCoinbaseBalance: () => Promise<bigint>;
|
|
47
58
|
getCoinbaseSequencerRewards: () => Promise<bigint>;
|
|
48
59
|
getGasBalanceFn: BalancesFn;
|
|
49
60
|
getBananaPublicBalanceFn: BalancesFn;
|
|
50
61
|
getBananaPrivateBalanceFn: BalancesFn;
|
|
51
|
-
getProverFee: (blockNumber:
|
|
62
|
+
getProverFee: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
52
63
|
readonly ALICE_INITIAL_BANANAS: bigint;
|
|
53
64
|
readonly SUBSCRIPTION_AMOUNT: bigint;
|
|
54
65
|
readonly APP_SPONSORED_TX_GAS_LIMIT: bigint;
|
|
55
|
-
constructor(testName: string, numberOfAccounts?: number, setupOptions?: Partial<SetupOptions &
|
|
66
|
+
constructor(testName: string, numberOfAccounts?: number, setupOptions?: Partial<SetupOptions & DeployAztecL1ContractsArgs>);
|
|
56
67
|
setup(): Promise<this>;
|
|
57
68
|
teardown(): Promise<void>;
|
|
58
69
|
setIsMarkingAsProven(b: boolean): void;
|
|
59
70
|
catchUpProvenChain(): Promise<void>;
|
|
60
|
-
|
|
71
|
+
getBlockRewards(): Promise<{
|
|
72
|
+
sequencerBlockRewards: bigint;
|
|
73
|
+
proverBlockRewards: bigint;
|
|
74
|
+
}>;
|
|
75
|
+
mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress): Promise<void>;
|
|
61
76
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
62
77
|
mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
applyBaseSetup(): Promise<void>;
|
|
79
|
+
applyInitialAccounts(): Promise<void>;
|
|
80
|
+
applyPublicDeployAccounts(): Promise<void>;
|
|
81
|
+
applySetupFeeJuice(): Promise<void>;
|
|
82
|
+
applyDeployBananaToken(): Promise<void>;
|
|
83
|
+
applyFPCSetup(): Promise<void>;
|
|
84
|
+
applySponsoredFPCSetup(): Promise<void>;
|
|
69
85
|
applyFundAliceWithBananas(): Promise<void>;
|
|
70
86
|
applyFundAliceWithPrivateBananas(): Promise<void>;
|
|
71
|
-
applySetupSubscription(): Promise<void>;
|
|
72
87
|
}
|
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DQUFDLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLFlBQVksaUJBSXhFO0lBRUQsc0ZBQXNGO0lBQ2hGLGtCQUFrQixDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsT0FBTyxFQUFFLFlBQVksaUJBVzdEO0lBRVksY0FBYyxrQkFLMUI7SUFFSyxvQkFBb0Isa0JBeUJ6QjtJQUVLLHlCQUF5QixrQkFHOUI7SUFFSyxrQkFBa0Isa0JBbUJ2QjtJQUVLLHNCQUFzQixrQkFxQjNCO0lBRVksYUFBYSxrQkF3RHpCO0lBRVksc0JBQXNCLGtCQVVsQztJQUVZLHlCQUF5QixrQkFPckM7SUFFWSxnQ0FBZ0Msa0JBSTVDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE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