@aztec/end-to-end 3.0.0-canary.a9708bd → 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 +9 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +19 -13
- 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 +26 -33
- 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_multi_validator/utils.js +3 -9
- 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 +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
- package/dest/e2e_p2p/p2p_network.d.ts +22 -8
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +36 -15
- package/dest/e2e_p2p/shared.d.ts +12 -13
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +54 -54
- 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 +42 -51
- 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 +10 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +38 -20
- 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 +60 -47
- 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 +26 -28
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +83 -109
- 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/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 +68 -3
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +312 -49
- package/package.json +39 -38
- 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 +22 -19
- package/src/e2e_fees/bridging_race.notest.ts +14 -9
- package/src/e2e_fees/fees_test.ts +29 -40
- package/src/e2e_l1_publisher/write_json.ts +8 -6
- package/src/e2e_multi_validator/utils.ts +4 -10
- package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
- package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
- package/src/e2e_p2p/p2p_network.ts +110 -71
- package/src/e2e_p2p/shared.ts +57 -56
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +52 -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 +60 -27
- package/src/fixtures/snapshot_manager.ts +80 -72
- package/src/fixtures/token_utils.ts +13 -21
- package/src/fixtures/utils.ts +95 -145
- package/src/fixtures/web3signer.ts +63 -0
- 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 +373 -48
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { Fq } from '@aztec/foundation/fields';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
4
5
|
import { jest } from '@jest/globals';
|
|
5
6
|
import { FeesTest } from './fees_test.js';
|
|
6
7
|
jest.setTimeout(300_000);
|
|
@@ -18,22 +19,24 @@ describe('e2e_fees bridging_race', ()=>{
|
|
|
18
19
|
await t.applyInitialAccountsSnapshot();
|
|
19
20
|
await t.applyPublicDeployAccountsSnapshot();
|
|
20
21
|
await t.applySetupFeeJuiceSnapshot();
|
|
21
|
-
({
|
|
22
|
+
({ wallet, logger } = await t.setup());
|
|
22
23
|
});
|
|
23
24
|
afterAll(async ()=>{
|
|
24
25
|
await t.teardown();
|
|
25
26
|
});
|
|
26
27
|
let logger;
|
|
27
|
-
let pxe;
|
|
28
28
|
let bobsAddress;
|
|
29
|
+
let wallet;
|
|
29
30
|
beforeEach(async ()=>{
|
|
30
31
|
const bobsSecretKey = Fr.random();
|
|
31
32
|
const bobsPrivateSigningKey = Fq.random();
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const bobsSalt = Fr.random();
|
|
34
|
+
const bobsAccountManager = await wallet.createAccount({
|
|
35
|
+
secret: bobsSecretKey,
|
|
36
|
+
salt: bobsSalt,
|
|
37
|
+
contract: new SchnorrAccountContract(bobsPrivateSigningKey)
|
|
38
|
+
});
|
|
39
|
+
bobsAddress = bobsAccountManager.address;
|
|
37
40
|
});
|
|
38
41
|
it('Alice bridges funds to Bob', async ()=>{
|
|
39
42
|
// Tweak the token manager so the bridging happens immediately before the end of the current L2 slot
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
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';
|
|
2
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
5
|
import { type DeployL1ContractsArgs, RollupContract } from '@aztec/ethereum';
|
|
4
6
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
@@ -10,6 +12,7 @@ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
|
10
12
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
11
13
|
import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
12
14
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
15
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
13
16
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
14
17
|
import { type BalancesFn, type SetupOptions } from '../fixtures/utils.js';
|
|
15
18
|
import { type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
@@ -26,15 +29,12 @@ import { type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.j
|
|
|
26
29
|
export declare class FeesTest {
|
|
27
30
|
private numberOfAccounts;
|
|
28
31
|
private snapshotManager;
|
|
29
|
-
private wallets;
|
|
30
32
|
private accounts;
|
|
31
33
|
logger: Logger;
|
|
32
|
-
pxe: PXE;
|
|
33
34
|
aztecNode: AztecNode;
|
|
34
35
|
cheatCodes: CheatCodes;
|
|
35
|
-
|
|
36
|
+
wallet: TestWallet;
|
|
36
37
|
aliceAddress: AztecAddress;
|
|
37
|
-
bobWallet: AccountWallet;
|
|
38
38
|
bobAddress: AztecAddress;
|
|
39
39
|
sequencerAddress: AztecAddress;
|
|
40
40
|
coinbase: EthAddress;
|
|
@@ -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,YAA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AE,OAAO,EAAE,YAAY;IAajD,kBAAkB;IAOzB,4BAA4B;IAsB5B,iCAAiC;IAMjC,0BAA0B;IA2B1B,8BAA8B;IA6BvB,qBAAqB;IAoErB,8BAA8B;IAoB9B,yBAAyB;IAczB,gCAAgC;CAS9C"}
|
|
@@ -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);
|
|
@@ -105,9 +100,10 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
105
100
|
}
|
|
106
101
|
async getBlockRewards() {
|
|
107
102
|
const blockReward = await this.rollupContract.getBlockReward();
|
|
108
|
-
const
|
|
103
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
104
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(EthAddress.fromString(rewardConfig.rewardDistributor));
|
|
109
105
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
110
|
-
const sequencerBlockRewards = toDistribute /
|
|
106
|
+
const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
|
|
111
107
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
112
108
|
return {
|
|
113
109
|
sequencerBlockRewards,
|
|
@@ -125,7 +121,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
125
121
|
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
126
122
|
from: this.aliceAddress
|
|
127
123
|
});
|
|
128
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress,
|
|
124
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
129
125
|
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
130
126
|
from: this.aliceAddress
|
|
131
127
|
});
|
|
@@ -138,45 +134,42 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
138
134
|
await this.applyDeployBananaTokenSnapshot();
|
|
139
135
|
}
|
|
140
136
|
async applyInitialAccountsSnapshot() {
|
|
141
|
-
await this.snapshotManager.snapshot('initial_accounts', deployAccounts(this.numberOfAccounts, this.logger), async ({ deployedAccounts }, {
|
|
142
|
-
this.
|
|
137
|
+
await this.snapshotManager.snapshot('initial_accounts', deployAccounts(this.numberOfAccounts, this.logger), async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes })=>{
|
|
138
|
+
this.wallet = wallet;
|
|
143
139
|
this.aztecNode = aztecNode;
|
|
144
140
|
this.gasSettings = GasSettings.default({
|
|
145
141
|
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
146
142
|
});
|
|
147
|
-
this.cheatCodes =
|
|
148
|
-
this.
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
152
|
-
[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);
|
|
153
147
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
154
148
|
this.fpcAdmin = this.aliceAddress;
|
|
155
149
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
156
|
-
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.
|
|
150
|
+
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
157
151
|
});
|
|
158
152
|
}
|
|
159
153
|
async applyPublicDeployAccountsSnapshot() {
|
|
160
|
-
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.
|
|
154
|
+
await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.wallet, this.accounts));
|
|
161
155
|
}
|
|
162
156
|
async applySetupFeeJuiceSnapshot() {
|
|
163
157
|
await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
|
|
164
158
|
this.context = context;
|
|
165
|
-
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.
|
|
159
|
+
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
166
160
|
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
167
161
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
168
162
|
aztecNode: context.aztecNode,
|
|
169
163
|
aztecNodeAdmin: context.aztecNode,
|
|
170
|
-
pxeService: context.pxe,
|
|
171
164
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
172
|
-
wallet: this.
|
|
165
|
+
wallet: this.wallet,
|
|
173
166
|
logger: this.logger
|
|
174
167
|
});
|
|
175
168
|
});
|
|
176
169
|
}
|
|
177
170
|
async applyDeployBananaTokenSnapshot() {
|
|
178
171
|
await this.snapshotManager.snapshot('deploy_banana_token', async ()=>{
|
|
179
|
-
const bananaCoin = await BananaCoin.deploy(this.
|
|
172
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
180
173
|
from: this.aliceAddress
|
|
181
174
|
}).deployed();
|
|
182
175
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
@@ -184,7 +177,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
184
177
|
bananaCoinAddress: bananaCoin.address
|
|
185
178
|
};
|
|
186
179
|
}, async ({ bananaCoinAddress })=>{
|
|
187
|
-
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.
|
|
180
|
+
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
|
|
188
181
|
const logger = this.logger;
|
|
189
182
|
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, logger);
|
|
190
183
|
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, logger);
|
|
@@ -193,9 +186,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
193
186
|
async applyFPCSetupSnapshot() {
|
|
194
187
|
await this.snapshotManager.snapshot('fpc_setup', async (context)=>{
|
|
195
188
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
196
|
-
expect((await context.
|
|
189
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
197
190
|
const bananaCoin = this.bananaCoin;
|
|
198
|
-
const bananaFPC = await FPCContract.deploy(this.
|
|
191
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
199
192
|
from: this.aliceAddress
|
|
200
193
|
}).deployed();
|
|
201
194
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
@@ -207,7 +200,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
207
200
|
rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress
|
|
208
201
|
};
|
|
209
202
|
}, async (data, context)=>{
|
|
210
|
-
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.
|
|
203
|
+
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
211
204
|
this.bananaFPC = bananaFPC;
|
|
212
205
|
this.getCoinbaseBalance = async ()=>{
|
|
213
206
|
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
@@ -224,7 +217,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
224
217
|
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
225
218
|
};
|
|
226
219
|
this.getProverFee = async (blockNumber)=>{
|
|
227
|
-
const block = await this.
|
|
220
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
228
221
|
// @todo @lherskind As we deal with #13601
|
|
229
222
|
// Right now the value is from `FeeLib.sol`
|
|
230
223
|
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
@@ -241,14 +234,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
241
234
|
async applySponsoredFPCSetupSnapshot() {
|
|
242
235
|
await this.snapshotManager.snapshot('sponsored_fpc_setup', async (context)=>{
|
|
243
236
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
244
|
-
expect((await context.
|
|
245
|
-
const sponsoredFPC = await setupSponsoredFPC(
|
|
237
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
238
|
+
const sponsoredFPC = await setupSponsoredFPC(this.wallet);
|
|
246
239
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
247
240
|
return {
|
|
248
241
|
sponsoredFPCAddress: sponsoredFPC.address
|
|
249
242
|
};
|
|
250
243
|
}, async (data)=>{
|
|
251
|
-
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.
|
|
244
|
+
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
252
245
|
});
|
|
253
246
|
}
|
|
254
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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AED,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"}
|
|
@@ -130,9 +130,7 @@ export async function createKeyFile3(fileName, validatorAddress, publisher1Key,
|
|
|
130
130
|
schemaVersion: 1,
|
|
131
131
|
validators: [
|
|
132
132
|
{
|
|
133
|
-
attester:
|
|
134
|
-
address: validatorAddress.toChecksumString()
|
|
135
|
-
},
|
|
133
|
+
attester: validatorAddress.toChecksumString(),
|
|
136
134
|
coinbase: coinbase.toChecksumString(),
|
|
137
135
|
publisher: [
|
|
138
136
|
publisher1Key,
|
|
@@ -155,9 +153,7 @@ export async function createKeyFile4(fileName, validator1Address, validator2Addr
|
|
|
155
153
|
},
|
|
156
154
|
validators: [
|
|
157
155
|
{
|
|
158
|
-
attester:
|
|
159
|
-
address: validator1Address.toChecksumString()
|
|
160
|
-
},
|
|
156
|
+
attester: validator1Address.toChecksumString(),
|
|
161
157
|
coinbase: coinbase1.toChecksumString(),
|
|
162
158
|
publisher: {
|
|
163
159
|
mnemonic: mnemonic,
|
|
@@ -168,9 +164,7 @@ export async function createKeyFile4(fileName, validator1Address, validator2Addr
|
|
|
168
164
|
feeRecipient: feeRecipient1.toString()
|
|
169
165
|
},
|
|
170
166
|
{
|
|
171
|
-
attester:
|
|
172
|
-
address: validator2Address.toChecksumString()
|
|
173
|
-
},
|
|
167
|
+
attester: validator2Address.toChecksumString(),
|
|
174
168
|
coinbase: coinbase2.toChecksumString(),
|
|
175
169
|
publisher: [
|
|
176
170
|
publisher2Key,
|
|
@@ -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...`);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { RollupContract } from '@aztec/ethereum';
|
|
4
|
+
import 'jest-extended';
|
|
5
|
+
import { P2PNetworkTest } from './p2p_network.js';
|
|
6
|
+
export declare class P2PInactivityTest {
|
|
7
|
+
readonly test: P2PNetworkTest;
|
|
8
|
+
nodes: AztecNodeService[];
|
|
9
|
+
activeNodes: AztecNodeService[];
|
|
10
|
+
inactiveNodes: AztecNodeService[];
|
|
11
|
+
rollup: RollupContract;
|
|
12
|
+
offlineValidators: EthAddress[];
|
|
13
|
+
private dataDir;
|
|
14
|
+
private inactiveNodeCount;
|
|
15
|
+
private keepInitialNode;
|
|
16
|
+
constructor(test: P2PNetworkTest, opts: {
|
|
17
|
+
inactiveNodeCount: number;
|
|
18
|
+
keepInitialNode?: boolean;
|
|
19
|
+
});
|
|
20
|
+
static create(testName: string, opts: {
|
|
21
|
+
slashInactivityConsecutiveEpochThreshold: number;
|
|
22
|
+
inactiveNodeCount: number;
|
|
23
|
+
keepInitialNode?: boolean;
|
|
24
|
+
}): Promise<P2PInactivityTest>;
|
|
25
|
+
setup(): Promise<this>;
|
|
26
|
+
teardown(): Promise<void>;
|
|
27
|
+
get ctx(): import("../fixtures/snapshot_manager.js").SubsystemsContext;
|
|
28
|
+
get logger(): import("@aztec/foundation/log").Logger;
|
|
29
|
+
get slashingAmount(): bigint;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=inactivity_slash_test.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import 'jest-extended';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { createNodes } from '../fixtures/setup_p2p_test.js';
|
|
6
|
+
import { P2PNetworkTest } from './p2p_network.js';
|
|
7
|
+
const NUM_NODES = 6;
|
|
8
|
+
const NUM_VALIDATORS = NUM_NODES;
|
|
9
|
+
const COMMITTEE_SIZE = NUM_VALIDATORS;
|
|
10
|
+
const SLASHING_QUORUM = 3;
|
|
11
|
+
const EPOCH_DURATION = 2;
|
|
12
|
+
const SLASHING_ROUND_SIZE_IN_EPOCHS = 2;
|
|
13
|
+
const BOOT_NODE_UDP_PORT = 4500;
|
|
14
|
+
const ETHEREUM_SLOT_DURATION = process.env.CI ? 8 : 4;
|
|
15
|
+
const AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION * 2;
|
|
16
|
+
const SLASHING_UNIT = BigInt(1e18);
|
|
17
|
+
const SLASHING_AMOUNT = SLASHING_UNIT * 3n;
|
|
18
|
+
// How many epochs it may take to set everything up, so we dont slash during this period
|
|
19
|
+
const SETUP_EPOCH_DURATION = 5;
|
|
20
|
+
export class P2PInactivityTest {
|
|
21
|
+
test;
|
|
22
|
+
nodes;
|
|
23
|
+
activeNodes;
|
|
24
|
+
inactiveNodes;
|
|
25
|
+
rollup;
|
|
26
|
+
offlineValidators;
|
|
27
|
+
dataDir;
|
|
28
|
+
inactiveNodeCount;
|
|
29
|
+
keepInitialNode;
|
|
30
|
+
constructor(test, opts){
|
|
31
|
+
this.test = test;
|
|
32
|
+
this.dataDir = fs.mkdtempSync(path.join(os.tmpdir(), test.testName));
|
|
33
|
+
this.inactiveNodeCount = opts.inactiveNodeCount;
|
|
34
|
+
this.keepInitialNode = opts.keepInitialNode ?? false;
|
|
35
|
+
}
|
|
36
|
+
static async create(testName, opts) {
|
|
37
|
+
const test = await P2PNetworkTest.create({
|
|
38
|
+
testName,
|
|
39
|
+
numberOfNodes: 0,
|
|
40
|
+
numberOfValidators: NUM_VALIDATORS,
|
|
41
|
+
basePort: BOOT_NODE_UDP_PORT,
|
|
42
|
+
startProverNode: true,
|
|
43
|
+
initialConfig: {
|
|
44
|
+
proverNodeConfig: {
|
|
45
|
+
proverNodeEpochProvingDelayMs: AZTEC_SLOT_DURATION * 1000
|
|
46
|
+
},
|
|
47
|
+
aztecTargetCommitteeSize: COMMITTEE_SIZE,
|
|
48
|
+
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
49
|
+
ethereumSlotDuration: ETHEREUM_SLOT_DURATION,
|
|
50
|
+
aztecProofSubmissionEpochs: 1024,
|
|
51
|
+
listenAddress: '127.0.0.1',
|
|
52
|
+
minTxsPerBlock: 0,
|
|
53
|
+
aztecEpochDuration: EPOCH_DURATION,
|
|
54
|
+
validatorReexecute: false,
|
|
55
|
+
sentinelEnabled: true,
|
|
56
|
+
slashingQuorum: SLASHING_QUORUM,
|
|
57
|
+
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE_IN_EPOCHS,
|
|
58
|
+
slashInactivityTargetPercentage: 0.8,
|
|
59
|
+
slashGracePeriodL2Slots: SETUP_EPOCH_DURATION * EPOCH_DURATION,
|
|
60
|
+
slashAmountSmall: SLASHING_UNIT,
|
|
61
|
+
slashAmountMedium: SLASHING_UNIT * 2n,
|
|
62
|
+
slashAmountLarge: SLASHING_UNIT * 3n,
|
|
63
|
+
...opts
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return new P2PInactivityTest(test, opts);
|
|
67
|
+
}
|
|
68
|
+
async setup() {
|
|
69
|
+
await this.test.applyBaseSnapshots();
|
|
70
|
+
await this.test.setup();
|
|
71
|
+
// Set slashing penalties for inactivity
|
|
72
|
+
const { rollup } = await this.test.getContracts();
|
|
73
|
+
const [activationThreshold, ejectionThreshold, localEjectionThreshold] = await Promise.all([
|
|
74
|
+
rollup.getActivationThreshold(),
|
|
75
|
+
rollup.getEjectionThreshold(),
|
|
76
|
+
rollup.getLocalEjectionThreshold()
|
|
77
|
+
]);
|
|
78
|
+
const biggestEjection = ejectionThreshold > localEjectionThreshold ? ejectionThreshold : localEjectionThreshold;
|
|
79
|
+
expect(activationThreshold - SLASHING_AMOUNT).toBeLessThan(biggestEjection);
|
|
80
|
+
this.test.ctx.aztecNodeConfig.slashInactivityPenalty = SLASHING_AMOUNT;
|
|
81
|
+
this.rollup = rollup;
|
|
82
|
+
if (!this.keepInitialNode) {
|
|
83
|
+
await this.test.ctx.aztecNode.stop();
|
|
84
|
+
}
|
|
85
|
+
// Create all active nodes
|
|
86
|
+
this.activeNodes = await createNodes(this.test.ctx.aztecNodeConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode), BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, Number(this.keepInitialNode));
|
|
87
|
+
// And the ones with an initially disabled sequencer
|
|
88
|
+
const inactiveConfig = {
|
|
89
|
+
...this.test.ctx.aztecNodeConfig,
|
|
90
|
+
dontStartSequencer: true
|
|
91
|
+
};
|
|
92
|
+
this.inactiveNodes = await createNodes(inactiveConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, this.inactiveNodeCount, BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, NUM_NODES - this.inactiveNodeCount);
|
|
93
|
+
this.nodes = [
|
|
94
|
+
...this.keepInitialNode ? [
|
|
95
|
+
this.test.ctx.aztecNode
|
|
96
|
+
] : [],
|
|
97
|
+
...this.activeNodes,
|
|
98
|
+
...this.inactiveNodes
|
|
99
|
+
];
|
|
100
|
+
if (this.nodes.length !== NUM_NODES) {
|
|
101
|
+
throw new Error(`Expected ${NUM_NODES} nodes but got ${this.nodes.length}`);
|
|
102
|
+
}
|
|
103
|
+
this.offlineValidators = this.test.validators.slice(this.test.validators.length - this.inactiveNodeCount).map((a)=>a.attester);
|
|
104
|
+
this.test.logger.warn(`Setup complete. Offline validators are ${this.offlineValidators.join(', ')}.`, {
|
|
105
|
+
validators: this.test.validators,
|
|
106
|
+
offlineValidators: this.offlineValidators
|
|
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);
|
|
111
|
+
this.test.logger.warn(`Advancing to epoch ${SETUP_EPOCH_DURATION + 1} to start slashing`);
|
|
112
|
+
await this.test.ctx.cheatCodes.rollup.advanceToEpoch(SETUP_EPOCH_DURATION + 1);
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
async teardown() {
|
|
116
|
+
await this.test.stopNodes(this.nodes);
|
|
117
|
+
await this.test.teardown();
|
|
118
|
+
for(let i = 0; i < NUM_NODES; i++){
|
|
119
|
+
fs.rmSync(`${this.dataDir}-${i}`, {
|
|
120
|
+
recursive: true,
|
|
121
|
+
force: true,
|
|
122
|
+
maxRetries: 3
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
get ctx() {
|
|
127
|
+
return this.test.ctx;
|
|
128
|
+
}
|
|
129
|
+
get logger() {
|
|
130
|
+
return this.test.logger;
|
|
131
|
+
}
|
|
132
|
+
get slashingAmount() {
|
|
133
|
+
return SLASHING_AMOUNT;
|
|
134
|
+
}
|
|
135
|
+
}
|