@aztec/end-to-end 3.0.0-nightly.20250923 → 3.0.0-nightly.20250925
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/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -10
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
- 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 +1 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +2 -3
- package/dest/e2e_p2p/p2p_network.d.ts +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +2 -4
- package/dest/e2e_p2p/shared.d.ts +5 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +36 -32
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- 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 +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +13 -15
- package/dest/fixtures/utils.d.ts +1 -7
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +25 -53
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +3 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +26 -21
- package/package.json +37 -37
- package/src/bench/client_flows/client_flows_benchmark.ts +5 -8
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +2 -2
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +3 -3
- package/src/e2e_p2p/p2p_network.ts +55 -61
- package/src/e2e_p2p/shared.ts +40 -30
- package/src/e2e_token_contract/token_contract_test.ts +1 -1
- package/src/fixtures/e2e_prover_test.ts +1 -1
- package/src/fixtures/setup_p2p_test.ts +0 -8
- package/src/fixtures/snapshot_manager.ts +15 -16
- package/src/fixtures/utils.ts +25 -55
- package/src/shared/submit-transactions.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +20 -28
|
@@ -12,7 +12,7 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
12
12
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
13
13
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
14
14
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
15
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
15
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
16
16
|
|
|
17
17
|
import { jest } from '@jest/globals';
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-
|
|
|
12
12
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
13
13
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
14
14
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
15
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
15
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
16
16
|
|
|
17
17
|
import { getContract } from 'viem';
|
|
18
18
|
|
|
@@ -71,7 +71,7 @@ export class CrossChainMessagingTest {
|
|
|
71
71
|
this.aztecNode = this.ctx.aztecNode;
|
|
72
72
|
this.wallet = this.ctx.wallet;
|
|
73
73
|
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
74
|
-
this.cheatCodes =
|
|
74
|
+
this.cheatCodes = this.ctx.cheatCodes;
|
|
75
75
|
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
76
76
|
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
77
77
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
13
|
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
14
14
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
15
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
15
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
16
16
|
|
|
17
17
|
import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
18
18
|
|
|
@@ -2,7 +2,7 @@ import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
|
2
2
|
import { Fr, type Logger, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { Fq } from '@aztec/foundation/fields';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
5
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
6
6
|
|
|
7
7
|
import { jest } from '@jest/globals';
|
|
8
8
|
import type { Hex } from 'viem';
|
|
@@ -14,7 +14,7 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
14
14
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
15
15
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
16
16
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
17
|
-
import { TestWallet } from '@aztec/test-wallet';
|
|
17
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
18
18
|
|
|
19
19
|
import { getContract } from 'viem';
|
|
20
20
|
|
|
@@ -182,11 +182,11 @@ export class FeesTest {
|
|
|
182
182
|
await this.snapshotManager.snapshot(
|
|
183
183
|
'initial_accounts',
|
|
184
184
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
185
|
-
async ({ deployedAccounts }, { wallet, aztecNode,
|
|
185
|
+
async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
|
|
186
186
|
this.wallet = wallet;
|
|
187
187
|
this.aztecNode = aztecNode;
|
|
188
188
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
189
|
-
this.cheatCodes =
|
|
189
|
+
this.cheatCodes = cheatCodes;
|
|
190
190
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
191
191
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
192
192
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -25,7 +25,7 @@ import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
|
25
25
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
26
26
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
27
27
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
28
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
28
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
29
29
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
30
30
|
|
|
31
31
|
import getPort from 'get-port';
|
|
@@ -230,78 +230,72 @@ export class P2PNetworkTest {
|
|
|
230
230
|
|
|
231
231
|
async applyBaseSnapshots() {
|
|
232
232
|
await this.addBootstrapNode();
|
|
233
|
-
await this.snapshotManager.snapshot(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
client: deployL1ContractsValues.l1Client,
|
|
240
|
-
});
|
|
233
|
+
await this.snapshotManager.snapshot('add-validators', async ({ deployL1ContractsValues, cheatCodes }) => {
|
|
234
|
+
const rollup = getContract({
|
|
235
|
+
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
236
|
+
abi: RollupAbi,
|
|
237
|
+
client: deployL1ContractsValues.l1Client,
|
|
238
|
+
});
|
|
241
239
|
|
|
242
|
-
|
|
240
|
+
this.logger.info(`Adding ${this.numberOfValidators} validators`);
|
|
243
241
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
242
|
+
const stakingAsset = getContract({
|
|
243
|
+
address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
244
|
+
abi: TestERC20Abi,
|
|
245
|
+
client: deployL1ContractsValues.l1Client,
|
|
246
|
+
});
|
|
249
247
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
248
|
+
const { address: multiAdderAddress } = await deployL1Contract(
|
|
249
|
+
deployL1ContractsValues.l1Client,
|
|
250
|
+
MultiAdderArtifact.contractAbi,
|
|
251
|
+
MultiAdderArtifact.contractBytecode,
|
|
252
|
+
[rollup.address, deployL1ContractsValues.l1Client.account.address],
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const multiAdder = getContract({
|
|
256
|
+
address: multiAdderAddress.toString(),
|
|
257
|
+
abi: MultiAdderArtifact.contractAbi,
|
|
258
|
+
client: deployL1ContractsValues.l1Client,
|
|
259
|
+
});
|
|
262
260
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
261
|
+
const stakeNeeded = (await rollup.read.getActivationThreshold()) * BigInt(this.numberOfValidators);
|
|
262
|
+
await Promise.all(
|
|
263
|
+
[await stakingAsset.write.mint([multiAdder.address, stakeNeeded], {} as any)].map(txHash =>
|
|
264
|
+
deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash }),
|
|
265
|
+
),
|
|
266
|
+
);
|
|
269
267
|
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
const { validators } = this.getValidators();
|
|
269
|
+
this.validators = validators;
|
|
272
270
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
const gseAddress = deployL1ContractsValues.l1ContractAddresses.gseAddress!;
|
|
272
|
+
if (!gseAddress) {
|
|
273
|
+
throw new Error('GSE contract not deployed');
|
|
274
|
+
}
|
|
277
275
|
|
|
278
|
-
|
|
276
|
+
const gseContract = new GSEContract(deployL1ContractsValues.l1Client, gseAddress.toString());
|
|
279
277
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
};
|
|
278
|
+
const makeValidatorTuples = async (validator: Operator) => {
|
|
279
|
+
const registrationTuple = await gseContract.makeRegistrationTuple(validator.bn254SecretKey.getValue());
|
|
280
|
+
return {
|
|
281
|
+
attester: validator.attester.toString() as `0x${string}`,
|
|
282
|
+
withdrawer: validator.withdrawer.toString() as `0x${string}`,
|
|
283
|
+
...registrationTuple,
|
|
287
284
|
};
|
|
288
|
-
|
|
285
|
+
};
|
|
286
|
+
const validatorTuples = await Promise.all(validators.map(makeValidatorTuples));
|
|
289
287
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
288
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
289
|
+
hash: await multiAdder.write.addValidators([validatorTuples]),
|
|
290
|
+
});
|
|
293
291
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
updateDateProvider: dateProvider,
|
|
298
|
-
},
|
|
299
|
-
);
|
|
292
|
+
await cheatCodes.rollup.advanceToEpoch(
|
|
293
|
+
(await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochs()) + 1n,
|
|
294
|
+
);
|
|
300
295
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
);
|
|
296
|
+
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
297
|
+
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
298
|
+
});
|
|
305
299
|
}
|
|
306
300
|
|
|
307
301
|
async setupAccount() {
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -14,16 +14,14 @@ import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
|
14
14
|
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
15
15
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
16
16
|
import { pluralize } from '@aztec/foundation/string';
|
|
17
|
-
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
18
17
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
19
18
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
20
|
-
import {
|
|
19
|
+
import { getPXEServiceConfig, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
21
20
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
22
21
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
22
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
24
|
-
import { TestWallet } from '@aztec/test-wallet';
|
|
23
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
25
24
|
|
|
26
|
-
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
27
25
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
28
26
|
|
|
29
27
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
@@ -56,33 +54,38 @@ export const submitComplexTxsTo = async (
|
|
|
56
54
|
return txs;
|
|
57
55
|
};
|
|
58
56
|
|
|
59
|
-
// creates
|
|
60
|
-
export const
|
|
57
|
+
// creates a wallet and submit a given number of transactions through it.
|
|
58
|
+
export const submitTransactions = async (
|
|
61
59
|
logger: Logger,
|
|
62
60
|
node: AztecNodeService,
|
|
63
61
|
numTxs: number,
|
|
64
62
|
fundedAccount: InitialAccountData,
|
|
65
|
-
): Promise<
|
|
63
|
+
): Promise<SentTx[]> => {
|
|
66
64
|
const rpcConfig = getRpcConfig();
|
|
67
65
|
rpcConfig.proverEnabled = false;
|
|
68
|
-
const
|
|
69
|
-
|
|
66
|
+
const wallet = await TestWallet.create(
|
|
67
|
+
node,
|
|
68
|
+
{ ...getPXEServiceConfig(), proverEnabled: false },
|
|
69
|
+
{ useLogSuffix: true },
|
|
70
|
+
);
|
|
70
71
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
71
|
-
|
|
72
|
-
return { txs, pxeService, node };
|
|
72
|
+
return submitTxsTo(wallet, fundedAccountManager.getAddress(), numTxs, logger);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export async function
|
|
75
|
+
export async function prepareTransactions(
|
|
76
76
|
logger: Logger,
|
|
77
77
|
node: AztecNodeService,
|
|
78
78
|
numTxs: number,
|
|
79
79
|
fundedAccount: InitialAccountData,
|
|
80
|
-
): Promise<
|
|
80
|
+
): Promise<ProvenTx[]> {
|
|
81
81
|
const rpcConfig = getRpcConfig();
|
|
82
82
|
rpcConfig.proverEnabled = false;
|
|
83
|
-
const pxe = await createPXEService(node, rpcConfig, { useLogSuffix: true });
|
|
84
83
|
|
|
85
|
-
const wallet =
|
|
84
|
+
const wallet = await TestWallet.create(
|
|
85
|
+
node,
|
|
86
|
+
{ ...getPXEServiceConfig(), proverEnabled: false },
|
|
87
|
+
{ useLogSuffix: true },
|
|
88
|
+
);
|
|
86
89
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
87
90
|
|
|
88
91
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
@@ -91,14 +94,12 @@ export async function createPXEServiceAndPrepareTransactions(
|
|
|
91
94
|
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
92
95
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
return timesAsync(numTxs, async () => {
|
|
95
98
|
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: fundedAccountManager.getAddress() });
|
|
96
99
|
const txHash = tx.getTxHash();
|
|
97
100
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
98
101
|
return tx;
|
|
99
102
|
});
|
|
100
|
-
|
|
101
|
-
return { txs, pxeService: pxe, node };
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
export function awaitProposalExecution(
|
|
@@ -180,7 +181,7 @@ export async function awaitOffenseDetected({
|
|
|
180
181
|
);
|
|
181
182
|
logger.info(
|
|
182
183
|
`Hit ${offenses.length} offenses on rounds ${unique(offenses.map(o => getRoundForOffense(o, { slashingRoundSize, epochDuration })))}`,
|
|
183
|
-
offenses,
|
|
184
|
+
{ offenses },
|
|
184
185
|
);
|
|
185
186
|
return offenses;
|
|
186
187
|
}
|
|
@@ -197,8 +198,9 @@ export async function awaitCommitteeKicked({
|
|
|
197
198
|
slashingProposer,
|
|
198
199
|
slashingRoundSize,
|
|
199
200
|
aztecSlotDuration,
|
|
201
|
+
aztecEpochDuration,
|
|
200
202
|
logger,
|
|
201
|
-
|
|
203
|
+
offenseEpoch,
|
|
202
204
|
}: {
|
|
203
205
|
rollup: RollupContract;
|
|
204
206
|
cheatCodes: RollupCheatCodes;
|
|
@@ -207,21 +209,22 @@ export async function awaitCommitteeKicked({
|
|
|
207
209
|
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
208
210
|
slashingRoundSize: number;
|
|
209
211
|
aztecSlotDuration: number;
|
|
210
|
-
|
|
212
|
+
aztecEpochDuration: number;
|
|
211
213
|
logger: Logger;
|
|
214
|
+
offenseEpoch: number;
|
|
212
215
|
}) {
|
|
213
216
|
if (!slashingProposer) {
|
|
214
217
|
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
215
218
|
}
|
|
216
219
|
|
|
217
|
-
logger.info(`Advancing epochs so we start slashing`);
|
|
218
220
|
await cheatCodes.debugRollup();
|
|
219
|
-
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n, {
|
|
220
|
-
updateDateProvider: dateProvider,
|
|
221
|
-
});
|
|
222
221
|
|
|
223
|
-
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
224
222
|
if (slashingProposer.type === 'empire') {
|
|
223
|
+
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
224
|
+
const targetEpoch = (await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n;
|
|
225
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
226
|
+
await cheatCodes.advanceToEpoch(targetEpoch);
|
|
227
|
+
|
|
225
228
|
const slashPayloadEvents = await retryUntil(
|
|
226
229
|
async () => {
|
|
227
230
|
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
@@ -236,6 +239,15 @@ export async function awaitCommitteeKicked({
|
|
|
236
239
|
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
237
240
|
committee.length,
|
|
238
241
|
);
|
|
242
|
+
} else {
|
|
243
|
+
// Use the slash offset to ensure we are in the right epoch for tally
|
|
244
|
+
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
245
|
+
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
246
|
+
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
247
|
+
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
248
|
+
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
249
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
250
|
+
await cheatCodes.advanceToEpoch(targetEpoch, { offset: -aztecSlotDuration / 2 });
|
|
239
251
|
}
|
|
240
252
|
|
|
241
253
|
const attestersPre = await rollup.getAttesters();
|
|
@@ -246,7 +258,7 @@ export async function awaitCommitteeKicked({
|
|
|
246
258
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
247
259
|
}
|
|
248
260
|
|
|
249
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
261
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
|
|
250
262
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
251
263
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
252
264
|
|
|
@@ -265,9 +277,7 @@ export async function awaitCommitteeKicked({
|
|
|
265
277
|
|
|
266
278
|
logger.info(`Advancing to check current committee`);
|
|
267
279
|
await cheatCodes.debugRollup();
|
|
268
|
-
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n
|
|
269
|
-
updateDateProvider: dateProvider,
|
|
270
|
-
});
|
|
280
|
+
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n);
|
|
271
281
|
await cheatCodes.debugRollup();
|
|
272
282
|
|
|
273
283
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AztecAddress, type AztecNode, type Logger, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
|
-
import type { TestWallet } from '@aztec/test-wallet';
|
|
4
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
5
5
|
|
|
6
6
|
import { jest } from '@jest/globals';
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
|
17
17
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
18
18
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
19
19
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
20
|
-
import { TestWallet } from '@aztec/test-wallet';
|
|
20
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
21
21
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
22
22
|
|
|
23
23
|
import { type Hex, getContract } from 'viem';
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
|
-
import type { SentTx } from '@aztec/aztec.js';
|
|
6
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
7
6
|
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
|
|
8
7
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
8
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
9
|
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
11
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
12
10
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
13
11
|
|
|
14
12
|
import getPort from 'get-port';
|
|
@@ -23,12 +21,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
23
21
|
// to avoid running validators with the same key
|
|
24
22
|
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
25
23
|
|
|
26
|
-
export interface NodeContext {
|
|
27
|
-
node: AztecNodeService;
|
|
28
|
-
pxeService: PXEService;
|
|
29
|
-
txs: SentTx[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
24
|
export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
|
|
33
25
|
const privateKeys: `0x${string}`[] = [];
|
|
34
26
|
// Do not start from 0 as it is used during setup
|
|
@@ -31,11 +31,11 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
31
31
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
32
32
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
33
33
|
import type { ProverNode } from '@aztec/prover-node';
|
|
34
|
-
import {
|
|
34
|
+
import { getPXEServiceConfig } from '@aztec/pxe/server';
|
|
35
35
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
36
36
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
37
37
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
38
|
-
import { TestWallet } from '@aztec/test-wallet';
|
|
38
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
39
39
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
40
40
|
|
|
41
41
|
import type { Anvil } from '@viem/anvil';
|
|
@@ -204,7 +204,7 @@ class SnapshotManager implements ISnapshotManager {
|
|
|
204
204
|
await restore(snapshotData, context);
|
|
205
205
|
|
|
206
206
|
// Save the snapshot data.
|
|
207
|
-
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls);
|
|
207
|
+
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls, context.dateProvider);
|
|
208
208
|
const anvilStateFile = `${this.livePath}/anvil.dat`;
|
|
209
209
|
await ethCheatCodes.dumpChainState(anvilStateFile);
|
|
210
210
|
writeFileSync(`${this.livePath}/${name}.json`, JSON.stringify(snapshotData || {}, resolver));
|
|
@@ -351,7 +351,9 @@ async function setupFromFresh(
|
|
|
351
351
|
const res = await startAnvil({ l1BlockTime: opts.ethereumSlotDuration });
|
|
352
352
|
const anvil = res.anvil;
|
|
353
353
|
aztecNodeConfig.l1RpcUrls = [res.rpcUrl];
|
|
354
|
-
|
|
354
|
+
|
|
355
|
+
const dateProvider = new TestDateProvider();
|
|
356
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
355
357
|
|
|
356
358
|
// Deploy our L1 contracts.
|
|
357
359
|
logger.verbose('Deploying L1 contracts...');
|
|
@@ -380,10 +382,8 @@ async function setupFromFresh(
|
|
|
380
382
|
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
381
383
|
aztecNodeConfig.l1PublishRetryIntervalMS = 100;
|
|
382
384
|
|
|
383
|
-
const dateProvider = new TestDateProvider();
|
|
384
|
-
|
|
385
385
|
const watcher = new AnvilTestWatcher(
|
|
386
|
-
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
386
|
+
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider),
|
|
387
387
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
388
388
|
deployL1ContractsValues.l1Client,
|
|
389
389
|
dateProvider,
|
|
@@ -446,9 +446,8 @@ async function setupFromFresh(
|
|
|
446
446
|
pxeConfig.dataDirectory = statePath ?? path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
447
447
|
// Only enable proving if specifically requested.
|
|
448
448
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
449
|
-
const
|
|
450
|
-
const
|
|
451
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode);
|
|
449
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
450
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode, dateProvider);
|
|
452
451
|
|
|
453
452
|
if (statePath) {
|
|
454
453
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -504,7 +503,9 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
504
503
|
aztecNodeConfig.l1RpcUrls = [rpcUrl];
|
|
505
504
|
// Load anvil state.
|
|
506
505
|
const anvilStateFile = `${statePath}/anvil.dat`;
|
|
507
|
-
|
|
506
|
+
|
|
507
|
+
const dateProvider = new TestDateProvider();
|
|
508
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
508
509
|
await ethCheatCodes.loadChainState(anvilStateFile);
|
|
509
510
|
|
|
510
511
|
// TODO: Encapsulate this in a NativeAcvm impl.
|
|
@@ -523,9 +524,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
523
524
|
logger.verbose('Creating ETH clients...');
|
|
524
525
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
525
526
|
|
|
526
|
-
const dateProvider = new TestDateProvider();
|
|
527
527
|
const watcher = new AnvilTestWatcher(
|
|
528
|
-
|
|
528
|
+
ethCheatCodes,
|
|
529
529
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
530
530
|
l1Client,
|
|
531
531
|
dateProvider,
|
|
@@ -574,9 +574,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
574
574
|
logger.verbose('Creating pxe...');
|
|
575
575
|
const pxeConfig = getPXEServiceConfig();
|
|
576
576
|
pxeConfig.dataDirectory = statePath;
|
|
577
|
-
const
|
|
578
|
-
const
|
|
579
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode);
|
|
577
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
578
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode, dateProvider);
|
|
580
579
|
|
|
581
580
|
return {
|
|
582
581
|
aztecNodeConfig,
|