@aztec/end-to-end 2.1.0-rc.9 → 3.0.0-devnet.2
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 +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +16 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
- package/dest/bench/utils.d.ts +2 -11
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -34
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
- 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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
- 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 +31 -33
- package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +3 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +10 -9
- package/dest/e2e_fees/bridging_race.notest.js +12 -9
- package/dest/e2e_fees/fees_test.d.ts +5 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +23 -31
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -5
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +5 -2
- package/dest/e2e_p2p/p2p_network.d.ts +16 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +32 -10
- package/dest/e2e_p2p/shared.d.ts +11 -13
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +49 -45
- package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +8 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +40 -50
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +2 -2
- package/dest/fixtures/setup_p2p_test.d.ts +0 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +10 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +44 -34
- package/dest/fixtures/token_utils.d.ts +6 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +11 -15
- package/dest/fixtures/utils.d.ts +23 -27
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +76 -101
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +16 -5
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +16 -10
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -15
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +10 -7
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +5 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +9 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +29 -45
- package/dest/simulators/lending_simulator.d.ts +2 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +3 -2
- package/dest/simulators/token_simulator.d.ts +3 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +19 -13
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -85
- package/dest/spartan/utils.d.ts +44 -0
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +212 -20
- package/package.json +38 -37
- package/src/bench/client_flows/benchmark.ts +6 -6
- package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +9 -37
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
- package/src/e2e_deploy_contract/deploy_test.ts +17 -35
- package/src/e2e_epochs/epochs_test.ts +12 -14
- package/src/e2e_fees/bridging_race.notest.ts +14 -9
- package/src/e2e_fees/fees_test.ts +26 -38
- package/src/e2e_l1_publisher/write_json.ts +8 -6
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -3
- package/src/e2e_p2p/p2p_network.ts +105 -67
- package/src/e2e_p2p/shared.ts +50 -55
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +51 -88
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +0 -8
- package/src/fixtures/snapshot_manager.ts +61 -61
- package/src/fixtures/token_utils.ts +13 -21
- package/src/fixtures/utils.ts +87 -138
- package/src/fixtures/web3signer.ts +22 -5
- package/src/guides/up_quick_start.sh +2 -10
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +18 -29
- package/src/shared/gas_portal_test_harness.ts +12 -19
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +61 -67
- package/src/simulators/lending_simulator.ts +3 -2
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +8 -3
- package/src/spartan/setup_test_wallets.ts +133 -126
- package/src/spartan/utils.ts +268 -18
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createLogger, sleep } from '@aztec/aztec.js';
|
|
3
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
4
2
|
import { RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
3
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
6
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
7
6
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
8
7
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
9
8
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
@@ -31,15 +30,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
31
30
|
*/ export class FeesTest {
|
|
32
31
|
numberOfAccounts;
|
|
33
32
|
snapshotManager;
|
|
34
|
-
wallets;
|
|
35
33
|
accounts;
|
|
36
34
|
logger;
|
|
37
|
-
pxe;
|
|
38
35
|
aztecNode;
|
|
39
36
|
cheatCodes;
|
|
40
|
-
|
|
37
|
+
wallet;
|
|
41
38
|
aliceAddress;
|
|
42
|
-
bobWallet;
|
|
43
39
|
bobAddress;
|
|
44
40
|
sequencerAddress;
|
|
45
41
|
coinbase;
|
|
@@ -66,7 +62,6 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
66
62
|
APP_SPONSORED_TX_GAS_LIMIT;
|
|
67
63
|
constructor(testName, numberOfAccounts = 3, setupOptions = {}){
|
|
68
64
|
this.numberOfAccounts = numberOfAccounts;
|
|
69
|
-
this.wallets = [];
|
|
70
65
|
this.accounts = [];
|
|
71
66
|
this.ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
72
67
|
this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
@@ -126,7 +121,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
126
121
|
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
127
122
|
from: this.aliceAddress
|
|
128
123
|
});
|
|
129
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress,
|
|
124
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
130
125
|
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
131
126
|
from: this.aliceAddress
|
|
132
127
|
});
|
|
@@ -139,45 +134,42 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
139
134
|
await this.applyDeployBananaTokenSnapshot();
|
|
140
135
|
}
|
|
141
136
|
async applyInitialAccountsSnapshot() {
|
|
142
|
-
await this.snapshotManager.snapshot('initial_accounts', deployAccounts(this.numberOfAccounts, this.logger), async ({ deployedAccounts }, {
|
|
143
|
-
this.
|
|
137
|
+
await this.snapshotManager.snapshot('initial_accounts', deployAccounts(this.numberOfAccounts, this.logger), async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes })=>{
|
|
138
|
+
this.wallet = wallet;
|
|
144
139
|
this.aztecNode = aztecNode;
|
|
145
140
|
this.gasSettings = GasSettings.default({
|
|
146
141
|
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
147
142
|
});
|
|
148
|
-
this.cheatCodes =
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
153
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
|
|
143
|
+
this.cheatCodes = cheatCodes;
|
|
144
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
145
|
+
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
146
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
154
147
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
155
148
|
this.fpcAdmin = this.aliceAddress;
|
|
156
149
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
157
|
-
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.
|
|
150
|
+
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
158
151
|
});
|
|
159
152
|
}
|
|
160
153
|
async applyPublicDeployAccountsSnapshot() {
|
|
161
|
-
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.
|
|
154
|
+
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.wallet, this.accounts));
|
|
162
155
|
}
|
|
163
156
|
async applySetupFeeJuiceSnapshot() {
|
|
164
157
|
await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
|
|
165
158
|
this.context = context;
|
|
166
|
-
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.
|
|
159
|
+
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
167
160
|
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
168
161
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
169
162
|
aztecNode: context.aztecNode,
|
|
170
163
|
aztecNodeAdmin: context.aztecNode,
|
|
171
|
-
pxeService: context.pxe,
|
|
172
164
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
173
|
-
wallet: this.
|
|
165
|
+
wallet: this.wallet,
|
|
174
166
|
logger: this.logger
|
|
175
167
|
});
|
|
176
168
|
});
|
|
177
169
|
}
|
|
178
170
|
async applyDeployBananaTokenSnapshot() {
|
|
179
171
|
await this.snapshotManager.snapshot('deploy_banana_token', async ()=>{
|
|
180
|
-
const bananaCoin = await BananaCoin.deploy(this.
|
|
172
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
181
173
|
from: this.aliceAddress
|
|
182
174
|
}).deployed();
|
|
183
175
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
@@ -185,7 +177,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
185
177
|
bananaCoinAddress: bananaCoin.address
|
|
186
178
|
};
|
|
187
179
|
}, async ({ bananaCoinAddress })=>{
|
|
188
|
-
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.
|
|
180
|
+
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
|
|
189
181
|
const logger = this.logger;
|
|
190
182
|
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, logger);
|
|
191
183
|
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, logger);
|
|
@@ -194,9 +186,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
194
186
|
async applyFPCSetupSnapshot() {
|
|
195
187
|
await this.snapshotManager.snapshot('fpc_setup', async (context)=>{
|
|
196
188
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
197
|
-
expect((await context.
|
|
189
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
198
190
|
const bananaCoin = this.bananaCoin;
|
|
199
|
-
const bananaFPC = await FPCContract.deploy(this.
|
|
191
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
200
192
|
from: this.aliceAddress
|
|
201
193
|
}).deployed();
|
|
202
194
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
@@ -208,7 +200,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
208
200
|
rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress
|
|
209
201
|
};
|
|
210
202
|
}, async (data, context)=>{
|
|
211
|
-
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.
|
|
203
|
+
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
212
204
|
this.bananaFPC = bananaFPC;
|
|
213
205
|
this.getCoinbaseBalance = async ()=>{
|
|
214
206
|
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
@@ -225,7 +217,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
225
217
|
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
226
218
|
};
|
|
227
219
|
this.getProverFee = async (blockNumber)=>{
|
|
228
|
-
const block = await this.
|
|
220
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
229
221
|
// @todo @lherskind As we deal with #13601
|
|
230
222
|
// Right now the value is from `FeeLib.sol`
|
|
231
223
|
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
@@ -242,14 +234,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
242
234
|
async applySponsoredFPCSetupSnapshot() {
|
|
243
235
|
await this.snapshotManager.snapshot('sponsored_fpc_setup', async (context)=>{
|
|
244
236
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
245
|
-
expect((await context.
|
|
246
|
-
const sponsoredFPC = await setupSponsoredFPC(
|
|
237
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
238
|
+
const sponsoredFPC = await setupSponsoredFPC(this.wallet);
|
|
247
239
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
248
240
|
return {
|
|
249
241
|
sponsoredFPCAddress: sponsoredFPC.address
|
|
250
242
|
};
|
|
251
243
|
}, async (data)=>{
|
|
252
|
-
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.
|
|
244
|
+
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
253
245
|
});
|
|
254
246
|
}
|
|
255
247
|
async applyFundAliceWithBananas() {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { AztecAddress
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { L2Block } from '@aztec/aztec.js/block';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
4
|
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
3
5
|
/**
|
|
4
6
|
* Creates a json object that can be used to test the solidity contract.
|
|
@@ -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,EAAE,EAAE,
|
|
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,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAiC,MAAM,iBAAiB,CAAC;AAOnF;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,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,CAqDf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
2
2
|
import { writeFile } from 'fs/promises';
|
|
3
3
|
const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
4
4
|
/**
|
|
@@ -16,18 +16,18 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
16
16
|
};
|
|
17
17
|
const jsonObject = {
|
|
18
18
|
populate: {
|
|
19
|
-
l1ToL2Content: l1ToL2Content.map(asHex),
|
|
19
|
+
l1ToL2Content: l1ToL2Content.map((value)=>asHex(value)),
|
|
20
20
|
recipient: asHex(recipientAddress.toField()),
|
|
21
21
|
sender: deployerAddress
|
|
22
22
|
},
|
|
23
23
|
messages: {
|
|
24
|
-
l2ToL1Messages: block.body.txEffects.flatMap((txEffect)=>txEffect.l2ToL1Msgs).map(asHex)
|
|
24
|
+
l2ToL1Messages: block.body.txEffects.flatMap((txEffect)=>txEffect.l2ToL1Msgs).map((value)=>asHex(value))
|
|
25
25
|
},
|
|
26
26
|
block: {
|
|
27
27
|
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
28
28
|
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
29
29
|
archive: asHex(block.archive.root),
|
|
30
|
-
blobCommitments:
|
|
30
|
+
blobCommitments: getPrefixedEthBlobCommitments(blobs),
|
|
31
31
|
batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
|
|
32
32
|
blockNumber: block.number,
|
|
33
33
|
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
@@ -48,7 +48,7 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
48
48
|
},
|
|
49
49
|
totalManaUsed: block.header.totalManaUsed.toNumber()
|
|
50
50
|
},
|
|
51
|
-
headerHash: asHex(block.
|
|
51
|
+
headerHash: asHex(block.getCheckpointHeader().hash()),
|
|
52
52
|
numTxs: block.body.txEffects.length
|
|
53
53
|
}
|
|
54
54
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { EthPrivateKey } from '@aztec/node-keystore';
|
|
4
4
|
export declare function createJSONRPCSigner(keyLookup: Map<string, EthPrivateKey>, stats: Map<string, number>): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/e2e_multi_validator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/e2e_multi_validator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAW1D,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,sGA0EpG;AAGD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAmB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAmB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,UAAU,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,YAAY,iBAiB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,UAAU,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,UAAU,EACrB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,YAAY,EAC3B,aAAa,EAAE,YAAY,iBA4B5B;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAcxG;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAkB3B;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,UAAU,CAE1E"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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 type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
5
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
6
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
7
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
@@ -6,9 +9,9 @@ export declare class NestedContractTest {
|
|
|
6
9
|
private numberOfAccounts;
|
|
7
10
|
private snapshotManager;
|
|
8
11
|
logger: Logger;
|
|
9
|
-
wallet:
|
|
12
|
+
wallet: Wallet;
|
|
10
13
|
defaultAccountAddress: AztecAddress;
|
|
11
|
-
|
|
14
|
+
aztecNode: AztecNode;
|
|
12
15
|
parentContract: ParentContract;
|
|
13
16
|
childContract: ChildContract;
|
|
14
17
|
constructor(testName: string, numberOfAccounts?: number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAIzC,qBAAa,kBAAkB;IAY3B,OAAO,CAAC,gBAAgB;IAX1B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAChB,qBAAqB,EAAG,YAAY,CAAC;IACrC,SAAS,EAAG,SAAS,CAAC;IAEtB,cAAc,EAAG,cAAc,CAAC;IAChC,aAAa,EAAG,aAAa,CAAC;gBAG5B,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI;IAM9B;;;;OAIG;IACG,kBAAkB;IAsBlB,KAAK;IAIL,QAAQ;IAId,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,oBAAoB;CAkB3B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
4
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
5
4
|
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
@@ -10,7 +9,7 @@ export class NestedContractTest {
|
|
|
10
9
|
logger;
|
|
11
10
|
wallet;
|
|
12
11
|
defaultAccountAddress;
|
|
13
|
-
|
|
12
|
+
aztecNode;
|
|
14
13
|
parentContract;
|
|
15
14
|
childContract;
|
|
16
15
|
constructor(testName, numberOfAccounts = 1){
|
|
@@ -24,12 +23,11 @@ export class NestedContractTest {
|
|
|
24
23
|
* 1. Add 3 accounts.
|
|
25
24
|
* 2. Publicly deploy accounts
|
|
26
25
|
*/ async applyBaseSnapshots() {
|
|
27
|
-
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.pxe = pxe;
|
|
26
|
+
await this.snapshotManager.snapshot('accounts', deployAccounts(this.numberOfAccounts, this.logger), ({ deployedAccounts }, { wallet, aztecNode })=>{
|
|
27
|
+
this.wallet = wallet;
|
|
28
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
29
|
+
this.aztecNode = aztecNode;
|
|
30
|
+
return Promise.resolve();
|
|
33
31
|
});
|
|
34
32
|
await this.snapshotManager.snapshot('public_deploy', async ()=>{}, async ()=>{
|
|
35
33
|
this.logger.verbose(`Public deploy accounts...`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import { RollupContract } from '@aztec/ethereum';
|
|
4
4
|
import 'jest-extended';
|
|
5
5
|
import { P2PNetworkTest } from './p2p_network.js';
|
|
@@ -25,7 +25,7 @@ export declare class P2PInactivityTest {
|
|
|
25
25
|
setup(): Promise<this>;
|
|
26
26
|
teardown(): Promise<void>;
|
|
27
27
|
get ctx(): import("../fixtures/snapshot_manager.js").SubsystemsContext;
|
|
28
|
-
get logger(): import("@aztec/
|
|
28
|
+
get logger(): import("@aztec/foundation/log").Logger;
|
|
29
29
|
get slashingAmount(): bigint;
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=inactivity_slash_test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,eAAe,CAAC;AAKvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBlD,qBAAa,iBAAiB;aAaV,IAAI,EAAE,cAAc;IAZ/B,KAAK,EAAG,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAG,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,EAAG,cAAc,CAAC;IACxB,iBAAiB,EAAG,UAAU,EAAE,CAAC;IAExC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAU;gBAGf,IAAI,EAAE,cAAc,EACpC,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;WAOnD,MAAM,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QAAE,wCAAwC,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;IAgCrG,KAAK;IA4EL,QAAQ;IAQrB,IAAW,GAAG,gEAEb;IAED,IAAW,MAAM,2CAEhB;IAED,IAAW,cAAc,WAExB;CACF"}
|
|
@@ -11,8 +11,8 @@ const SLASHING_QUORUM = 3;
|
|
|
11
11
|
const EPOCH_DURATION = 2;
|
|
12
12
|
const SLASHING_ROUND_SIZE_IN_EPOCHS = 2;
|
|
13
13
|
const BOOT_NODE_UDP_PORT = 4500;
|
|
14
|
-
const ETHEREUM_SLOT_DURATION = 4;
|
|
15
|
-
const AZTEC_SLOT_DURATION =
|
|
14
|
+
const ETHEREUM_SLOT_DURATION = process.env.CI ? 8 : 4;
|
|
15
|
+
const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
|
|
16
16
|
const SLASHING_UNIT = BigInt(1e18);
|
|
17
17
|
const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
|
|
18
18
|
// How many epochs it may take to set everything up, so we dont slash during this period
|
|
@@ -105,6 +105,9 @@ export class P2PInactivityTest {
|
|
|
105
105
|
validators: this.test.validators,
|
|
106
106
|
offlineValidators: this.offlineValidators
|
|
107
107
|
});
|
|
108
|
+
// Wait for P2P mesh to be fully formed before starting slashing period
|
|
109
|
+
// This prevents race conditions where validators propose blocks before the network is ready
|
|
110
|
+
await this.test.waitForP2PMeshConnectivity(this.nodes, NUM_NODES);
|
|
108
111
|
this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
|
|
109
112
|
await this.test.ctx.cheatCodes.rollup.advanceToEpoch(SETUP_EPOCH_DURATION + 1);
|
|
110
113
|
return this;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import {
|
|
3
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
4
|
import { type EmpireSlashingProposerContract, type Operator, RollupContract, type TallySlashingProposerContract, type ViemClient } from '@aztec/ethereum';
|
|
5
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
6
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
@@ -9,6 +9,7 @@ import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
|
9
9
|
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
|
|
10
10
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
11
11
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
12
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
12
13
|
import { type GetContractReturnType } from 'viem';
|
|
13
14
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
14
15
|
import { type SetupOptions } from '../fixtures/utils.js';
|
|
@@ -33,13 +34,13 @@ export declare class P2PNetworkTest {
|
|
|
33
34
|
sign: (parameters: {
|
|
34
35
|
hash: import("viem").Hash;
|
|
35
36
|
}) => Promise<import("viem").Hex>;
|
|
36
|
-
|
|
37
|
+
signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
|
|
37
38
|
signMessage: ({ message }: {
|
|
38
39
|
message: import("viem").SignableMessage;
|
|
39
40
|
}) => Promise<import("viem").Hex>;
|
|
40
41
|
signTransaction: <serializer extends import("viem").SerializeTransactionFn<import("viem").TransactionSerializable> = import("viem").SerializeTransactionFn<import("viem").TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
|
|
41
42
|
serializer?: serializer | undefined;
|
|
42
|
-
} | undefined) => Promise<import("viem").
|
|
43
|
+
} | undefined) => Promise<import("viem").Hex>;
|
|
43
44
|
signTypedData: <const typedData extends import("viem").TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<import("viem").Hex>;
|
|
44
45
|
publicKey: import("viem").Hex;
|
|
45
46
|
source: "privateKey";
|
|
@@ -54,7 +55,7 @@ export declare class P2PNetworkTest {
|
|
|
54
55
|
validators: Operator[];
|
|
55
56
|
deployedAccounts: InitialAccountData[];
|
|
56
57
|
prefilledPublicData: PublicDataTreeLeaf[];
|
|
57
|
-
wallet?:
|
|
58
|
+
wallet?: TestWallet;
|
|
58
59
|
defaultAccountAddress?: AztecAddress;
|
|
59
60
|
spamContract?: SpamContract;
|
|
60
61
|
bootstrapNode?: BootstrapNode;
|
|
@@ -85,6 +86,17 @@ export declare class P2PNetworkTest {
|
|
|
85
86
|
private _sendDummyTx;
|
|
86
87
|
setup(): Promise<void>;
|
|
87
88
|
stopNodes(nodes: AztecNodeService[]): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Wait for P2P mesh to be fully formed across all nodes.
|
|
91
|
+
* This ensures that all nodes are connected to each other before proceeding,
|
|
92
|
+
* preventing race conditions where validators propose blocks before the network is ready.
|
|
93
|
+
*
|
|
94
|
+
* @param nodes - Array of nodes to check for P2P connectivity
|
|
95
|
+
* @param expectedNodeCount - Expected number of nodes in the network (defaults to nodes.length)
|
|
96
|
+
* @param timeoutSeconds - Maximum time to wait for connections (default: 30 seconds)
|
|
97
|
+
* @param checkIntervalSeconds - How often to check connectivity (default: 0.1 seconds)
|
|
98
|
+
*/
|
|
99
|
+
waitForP2PMeshConnectivity(nodes: AztecNodeService[], expectedNodeCount?: number, timeoutSeconds?: number, checkIntervalSeconds?: number): Promise<void>;
|
|
88
100
|
teardown(): Promise<void>;
|
|
89
101
|
getContracts(): Promise<{
|
|
90
102
|
rollup: RollupContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { GSEContract, MultiAdderArtifact, RollupContract, createL1TxUtilsFromViemWallet, deployL1Contract, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
4
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
7
8
|
import { RollupAbi, SlasherAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
8
9
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
9
10
|
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
@@ -141,7 +142,7 @@ export class P2PNetworkTest {
|
|
|
141
142
|
}
|
|
142
143
|
async applyBaseSnapshots() {
|
|
143
144
|
await this.addBootstrapNode();
|
|
144
|
-
await this.snapshotManager.snapshot('add-validators', async ({ deployL1ContractsValues,
|
|
145
|
+
await this.snapshotManager.snapshot('add-validators', async ({ deployL1ContractsValues, cheatCodes })=>{
|
|
145
146
|
const rollup = getContract({
|
|
146
147
|
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
147
148
|
abi: RollupAbi,
|
|
@@ -192,19 +193,17 @@ export class P2PNetworkTest {
|
|
|
192
193
|
validatorTuples
|
|
193
194
|
])
|
|
194
195
|
});
|
|
195
|
-
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + await rollup.read.getLagInEpochs() + 1n
|
|
196
|
-
updateDateProvider: dateProvider
|
|
197
|
-
});
|
|
196
|
+
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + await rollup.read.getLagInEpochs() + 1n);
|
|
198
197
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
199
198
|
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
200
199
|
});
|
|
201
200
|
}
|
|
202
201
|
async setupAccount() {
|
|
203
|
-
await this.snapshotManager.snapshot('setup-account', deployAccounts(1, this.logger
|
|
202
|
+
await this.snapshotManager.snapshot('setup-account', deployAccounts(1, this.logger), ({ deployedAccounts }, { wallet })=>{
|
|
204
203
|
this.deployedAccounts = deployedAccounts;
|
|
205
|
-
|
|
206
|
-
this.wallet =
|
|
207
|
-
|
|
204
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
205
|
+
this.wallet = wallet;
|
|
206
|
+
return Promise.resolve();
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
209
|
async deploySpamContract() {
|
|
@@ -268,6 +267,29 @@ export class P2PNetworkTest {
|
|
|
268
267
|
await Promise.all(nodes.map((node)=>node.stop()));
|
|
269
268
|
this.logger.info('Nodes stopped');
|
|
270
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Wait for P2P mesh to be fully formed across all nodes.
|
|
272
|
+
* This ensures that all nodes are connected to each other before proceeding,
|
|
273
|
+
* preventing race conditions where validators propose blocks before the network is ready.
|
|
274
|
+
*
|
|
275
|
+
* @param nodes - Array of nodes to check for P2P connectivity
|
|
276
|
+
* @param expectedNodeCount - Expected number of nodes in the network (defaults to nodes.length)
|
|
277
|
+
* @param timeoutSeconds - Maximum time to wait for connections (default: 30 seconds)
|
|
278
|
+
* @param checkIntervalSeconds - How often to check connectivity (default: 0.1 seconds)
|
|
279
|
+
*/ async waitForP2PMeshConnectivity(nodes, expectedNodeCount, timeoutSeconds = 30, checkIntervalSeconds = 0.1) {
|
|
280
|
+
const nodeCount = expectedNodeCount ?? nodes.length;
|
|
281
|
+
const minPeerCount = nodeCount - 1;
|
|
282
|
+
this.logger.warn(`Waiting for all ${nodeCount} nodes to connect to P2P mesh (at least ${minPeerCount} peers each)...`);
|
|
283
|
+
await Promise.all(nodes.map(async (node, index)=>{
|
|
284
|
+
const p2p = node.getP2P();
|
|
285
|
+
await retryUntil(async ()=>{
|
|
286
|
+
const peers = await p2p.getPeers();
|
|
287
|
+
// Each node should be connected to at least N-1 other nodes
|
|
288
|
+
return peers.length >= minPeerCount ? true : undefined;
|
|
289
|
+
}, `Node ${index} to connect to at least ${minPeerCount} peers`, timeoutSeconds, checkIntervalSeconds);
|
|
290
|
+
}));
|
|
291
|
+
this.logger.warn('All nodes connected to P2P mesh');
|
|
292
|
+
}
|
|
271
293
|
async teardown() {
|
|
272
294
|
await this.monitor.stop();
|
|
273
295
|
await tryStop(this.bootstrapNode, this.logger);
|
package/dest/e2e_p2p/shared.d.ts
CHANGED
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { AztecAddress
|
|
3
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { type SentTx } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
|
+
import { Tx } from '@aztec/aztec.js/tx';
|
|
4
7
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
5
8
|
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
6
|
-
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
7
9
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
8
|
-
import { PXEService } from '@aztec/pxe/server';
|
|
9
10
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
10
11
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
11
|
-
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
12
12
|
export declare const submitComplexTxsTo: (logger: Logger, from: AztecAddress, spamContract: SpamContract, numTxs: number, opts?: {
|
|
13
13
|
callPublic?: boolean;
|
|
14
14
|
}) => Promise<SentTx[]>;
|
|
15
|
-
export declare const
|
|
16
|
-
export declare function
|
|
17
|
-
pxeService: PXEService;
|
|
18
|
-
txs: ProvenTx[];
|
|
19
|
-
node: AztecNodeService;
|
|
20
|
-
}>;
|
|
15
|
+
export declare const submitTransactions: (logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData) => Promise<SentTx[]>;
|
|
16
|
+
export declare function prepareTransactions(logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData): Promise<Tx[]>;
|
|
21
17
|
export declare function awaitProposalExecution(slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract, timeoutSeconds: number, logger: Logger): Promise<bigint>;
|
|
22
18
|
export declare function awaitCommitteeExists({ rollup, logger, }: {
|
|
23
19
|
rollup: RollupContract;
|
|
24
20
|
logger: Logger;
|
|
25
21
|
}): Promise<readonly `0x${string}`[]>;
|
|
26
|
-
export declare function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount, }: {
|
|
22
|
+
export declare function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount, timeoutSeconds, }: {
|
|
27
23
|
nodeAdmin: AztecNodeAdmin;
|
|
28
24
|
logger: Logger;
|
|
29
25
|
slashingRoundSize: number;
|
|
30
26
|
epochDuration: number;
|
|
31
27
|
waitUntilOffenseCount?: number;
|
|
28
|
+
timeoutSeconds?: number;
|
|
32
29
|
}): Promise<import("@aztec/slasher").Offense[]>;
|
|
33
30
|
/**
|
|
34
31
|
* Await the committee to be slashed out of the validator set.
|
|
35
32
|
* Currently assumes that the committee is the same size as the validator set.
|
|
36
33
|
*/
|
|
37
|
-
export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger,
|
|
34
|
+
export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, aztecEpochDuration, logger, offenseEpoch, }: {
|
|
38
35
|
rollup: RollupContract;
|
|
39
36
|
cheatCodes: RollupCheatCodes;
|
|
40
37
|
committee: readonly `0x${string}`[];
|
|
@@ -42,7 +39,8 @@ export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, sl
|
|
|
42
39
|
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
43
40
|
slashingRoundSize: number;
|
|
44
41
|
aztecSlotDuration: number;
|
|
45
|
-
|
|
42
|
+
aztecEpochDuration: number;
|
|
46
43
|
logger: Logger;
|
|
44
|
+
offenseEpoch: number;
|
|
47
45
|
}): Promise<void>;
|
|
48
46
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/shared.ts"],"names":[],"mappings":"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"}
|