@aztec/end-to-end 3.0.0-nightly.20250922 → 3.0.0-nightly.20250924
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 +0 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +5 -9
- package/dest/bench/utils.d.ts +1 -10
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +0 -25
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -2
- 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 +1 -3
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -2
- 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 +6 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +3 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -3
- package/dest/e2e_fees/fees_test.d.ts +1 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +1 -3
- 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 -4
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +26 -14
- package/dest/fixtures/e2e_prover_test.d.ts +0 -2
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +6 -9
- package/dest/fixtures/snapshot_manager.d.ts +0 -2
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -11
- package/dest/fixtures/utils.d.ts +12 -20
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +24 -42
- package/dest/shared/cross_chain_test_harness.d.ts +2 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -5
- package/dest/shared/gas_portal_test_harness.d.ts +5 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +5 -5
- package/dest/shared/uniswap_l1_l2.d.ts +1 -3
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +3 -4
- package/dest/spartan/setup_test_wallets.d.ts +5 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +19 -14
- package/package.json +37 -37
- package/src/bench/client_flows/client_flows_benchmark.ts +4 -8
- package/src/bench/utils.ts +1 -28
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -4
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +5 -9
- package/src/e2e_deploy_contract/deploy_test.ts +4 -5
- package/src/e2e_fees/fees_test.ts +6 -9
- package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
- package/src/e2e_p2p/p2p_network.ts +54 -60
- package/src/e2e_p2p/shared.ts +27 -15
- package/src/fixtures/e2e_prover_test.ts +7 -12
- package/src/fixtures/snapshot_manager.ts +12 -14
- package/src/fixtures/utils.ts +27 -53
- package/src/shared/cross_chain_test_harness.ts +0 -5
- package/src/shared/gas_portal_test_harness.ts +4 -6
- package/src/shared/uniswap_l1_l2.ts +1 -7
- package/src/spartan/setup_test_wallets.ts +13 -17
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
type ContractBase,
|
|
6
6
|
Fr,
|
|
7
7
|
type Logger,
|
|
8
|
-
type PXE,
|
|
9
8
|
type PublicKeys,
|
|
10
9
|
type Wallet,
|
|
11
10
|
createLogger,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
} from '@aztec/aztec.js';
|
|
14
13
|
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
15
14
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
15
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
16
16
|
|
|
17
17
|
import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
18
18
|
|
|
@@ -21,8 +21,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
21
21
|
export class DeployTest {
|
|
22
22
|
private snapshotManager: ISnapshotManager;
|
|
23
23
|
public logger: Logger;
|
|
24
|
-
public
|
|
25
|
-
public wallet!: Wallet;
|
|
24
|
+
public wallet!: TestWallet;
|
|
26
25
|
public defaultAccountAddress!: AztecAddress;
|
|
27
26
|
public aztecNode!: AztecNode;
|
|
28
27
|
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
@@ -35,7 +34,7 @@ export class DeployTest {
|
|
|
35
34
|
async setup() {
|
|
36
35
|
await this.applyInitialAccountSnapshot();
|
|
37
36
|
const context = await this.snapshotManager.setup();
|
|
38
|
-
({
|
|
37
|
+
({ aztecNode: this.aztecNode, wallet: this.wallet } = context);
|
|
39
38
|
this.aztecNodeAdmin = context.aztecNode;
|
|
40
39
|
return this;
|
|
41
40
|
}
|
|
@@ -75,7 +74,7 @@ export class DeployTest {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
async registerRandomAccount(): Promise<AztecAddress> {
|
|
78
|
-
const completeAddress = await this.
|
|
77
|
+
const completeAddress = await this.wallet.registerAccount(Fr.random(), Fr.random());
|
|
79
78
|
return completeAddress.address;
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type AztecAddress, type AztecNode, type Logger,
|
|
2
|
+
import { type AztecAddress, type AztecNode, type Logger, createLogger, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
4
|
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
@@ -52,7 +52,6 @@ export class FeesTest {
|
|
|
52
52
|
private accounts: AztecAddress[] = [];
|
|
53
53
|
|
|
54
54
|
public logger: Logger;
|
|
55
|
-
public pxe!: PXE;
|
|
56
55
|
public aztecNode!: AztecNode;
|
|
57
56
|
public cheatCodes!: CheatCodes;
|
|
58
57
|
|
|
@@ -183,12 +182,11 @@ export class FeesTest {
|
|
|
183
182
|
await this.snapshotManager.snapshot(
|
|
184
183
|
'initial_accounts',
|
|
185
184
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
186
|
-
async ({ deployedAccounts }, { wallet,
|
|
187
|
-
this.pxe = pxe;
|
|
185
|
+
async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
|
|
188
186
|
this.wallet = wallet;
|
|
189
187
|
this.aztecNode = aztecNode;
|
|
190
188
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
191
|
-
this.cheatCodes =
|
|
189
|
+
this.cheatCodes = cheatCodes;
|
|
192
190
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
193
191
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
194
192
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
@@ -238,7 +236,6 @@ export class FeesTest {
|
|
|
238
236
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
239
237
|
aztecNode: context.aztecNode,
|
|
240
238
|
aztecNodeAdmin: context.aztecNode,
|
|
241
|
-
pxeService: context.pxe,
|
|
242
239
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
243
240
|
wallet: this.wallet,
|
|
244
241
|
logger: this.logger,
|
|
@@ -281,7 +278,7 @@ export class FeesTest {
|
|
|
281
278
|
'fpc_setup',
|
|
282
279
|
async context => {
|
|
283
280
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
284
|
-
expect((await context.
|
|
281
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
285
282
|
|
|
286
283
|
const bananaCoin = this.bananaCoin;
|
|
287
284
|
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
@@ -349,9 +346,9 @@ export class FeesTest {
|
|
|
349
346
|
'sponsored_fpc_setup',
|
|
350
347
|
async context => {
|
|
351
348
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
352
|
-
expect((await context.
|
|
349
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
353
350
|
|
|
354
|
-
const sponsoredFPC = await setupSponsoredFPC(
|
|
351
|
+
const sponsoredFPC = await setupSponsoredFPC(this.wallet);
|
|
355
352
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
356
353
|
|
|
357
354
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, type AztecNode, type Logger, type
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
4
|
|
|
@@ -17,7 +17,6 @@ export class NestedContractTest {
|
|
|
17
17
|
logger: Logger;
|
|
18
18
|
wallet!: Wallet;
|
|
19
19
|
defaultAccountAddress!: AztecAddress;
|
|
20
|
-
pxe!: PXE;
|
|
21
20
|
aztecNode!: AztecNode;
|
|
22
21
|
|
|
23
22
|
parentContract!: ParentContract;
|
|
@@ -40,10 +39,9 @@ export class NestedContractTest {
|
|
|
40
39
|
await this.snapshotManager.snapshot(
|
|
41
40
|
'accounts',
|
|
42
41
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
43
|
-
({ deployedAccounts }, {
|
|
42
|
+
({ deployedAccounts }, { wallet, aztecNode }) => {
|
|
44
43
|
this.wallet = wallet;
|
|
45
44
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
46
|
-
this.pxe = pxe;
|
|
47
45
|
this.aztecNode = aztecNode;
|
|
48
46
|
return Promise.resolve();
|
|
49
47
|
},
|
|
@@ -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
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
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
|
-
import
|
|
16
|
+
import { pluralize } from '@aztec/foundation/string';
|
|
17
17
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
18
18
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
19
19
|
import { PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
@@ -157,17 +157,20 @@ export async function awaitOffenseDetected({
|
|
|
157
157
|
nodeAdmin,
|
|
158
158
|
slashingRoundSize,
|
|
159
159
|
epochDuration,
|
|
160
|
+
waitUntilOffenseCount,
|
|
160
161
|
}: {
|
|
161
162
|
nodeAdmin: AztecNodeAdmin;
|
|
162
163
|
logger: Logger;
|
|
163
164
|
slashingRoundSize: number;
|
|
164
165
|
epochDuration: number;
|
|
166
|
+
waitUntilOffenseCount?: number;
|
|
165
167
|
}) {
|
|
166
|
-
|
|
168
|
+
const targetOffenseCount = waitUntilOffenseCount ?? 1;
|
|
169
|
+
logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
|
|
167
170
|
const offenses = await retryUntil(
|
|
168
171
|
async () => {
|
|
169
172
|
const offenses = await nodeAdmin.getSlashOffenses('all');
|
|
170
|
-
if (offenses.length
|
|
173
|
+
if (offenses.length >= targetOffenseCount) {
|
|
171
174
|
return offenses;
|
|
172
175
|
}
|
|
173
176
|
},
|
|
@@ -176,7 +179,7 @@ export async function awaitOffenseDetected({
|
|
|
176
179
|
);
|
|
177
180
|
logger.info(
|
|
178
181
|
`Hit ${offenses.length} offenses on rounds ${unique(offenses.map(o => getRoundForOffense(o, { slashingRoundSize, epochDuration })))}`,
|
|
179
|
-
offenses,
|
|
182
|
+
{ offenses },
|
|
180
183
|
);
|
|
181
184
|
return offenses;
|
|
182
185
|
}
|
|
@@ -193,8 +196,9 @@ export async function awaitCommitteeKicked({
|
|
|
193
196
|
slashingProposer,
|
|
194
197
|
slashingRoundSize,
|
|
195
198
|
aztecSlotDuration,
|
|
199
|
+
aztecEpochDuration,
|
|
196
200
|
logger,
|
|
197
|
-
|
|
201
|
+
offenseEpoch,
|
|
198
202
|
}: {
|
|
199
203
|
rollup: RollupContract;
|
|
200
204
|
cheatCodes: RollupCheatCodes;
|
|
@@ -203,21 +207,22 @@ export async function awaitCommitteeKicked({
|
|
|
203
207
|
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
204
208
|
slashingRoundSize: number;
|
|
205
209
|
aztecSlotDuration: number;
|
|
206
|
-
|
|
210
|
+
aztecEpochDuration: number;
|
|
207
211
|
logger: Logger;
|
|
212
|
+
offenseEpoch: number;
|
|
208
213
|
}) {
|
|
209
214
|
if (!slashingProposer) {
|
|
210
215
|
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
211
216
|
}
|
|
212
217
|
|
|
213
|
-
logger.info(`Advancing epochs so we start slashing`);
|
|
214
218
|
await cheatCodes.debugRollup();
|
|
215
|
-
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n, {
|
|
216
|
-
updateDateProvider: dateProvider,
|
|
217
|
-
});
|
|
218
219
|
|
|
219
|
-
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
220
220
|
if (slashingProposer.type === 'empire') {
|
|
221
|
+
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
222
|
+
const targetEpoch = (await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n;
|
|
223
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
224
|
+
await cheatCodes.advanceToEpoch(targetEpoch);
|
|
225
|
+
|
|
221
226
|
const slashPayloadEvents = await retryUntil(
|
|
222
227
|
async () => {
|
|
223
228
|
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
@@ -232,6 +237,15 @@ export async function awaitCommitteeKicked({
|
|
|
232
237
|
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
233
238
|
committee.length,
|
|
234
239
|
);
|
|
240
|
+
} else {
|
|
241
|
+
// Use the slash offset to ensure we are in the right epoch for tally
|
|
242
|
+
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
243
|
+
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
244
|
+
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
245
|
+
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
246
|
+
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
247
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
248
|
+
await cheatCodes.advanceToEpoch(targetEpoch, { offset: -aztecSlotDuration / 2 });
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
const attestersPre = await rollup.getAttesters();
|
|
@@ -242,7 +256,7 @@ export async function awaitCommitteeKicked({
|
|
|
242
256
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
243
257
|
}
|
|
244
258
|
|
|
245
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
259
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
|
|
246
260
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
247
261
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
248
262
|
|
|
@@ -261,9 +275,7 @@ export async function awaitCommitteeKicked({
|
|
|
261
275
|
|
|
262
276
|
logger.info(`Advancing to check current committee`);
|
|
263
277
|
await cheatCodes.debugRollup();
|
|
264
|
-
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n
|
|
265
|
-
updateDateProvider: dateProvider,
|
|
266
|
-
});
|
|
278
|
+
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n);
|
|
267
279
|
await cheatCodes.debugRollup();
|
|
268
280
|
|
|
269
281
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
3
|
-
import { AztecAddress, type AztecNode, EthAddress, type Logger,
|
|
3
|
+
import { AztecAddress, type AztecNode, EthAddress, type Logger, createLogger } from '@aztec/aztec.js';
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
5
|
import {
|
|
6
6
|
BBCircuitVerifier,
|
|
@@ -16,7 +16,6 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
16
16
|
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
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
20
19
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
21
20
|
import { TestWallet } from '@aztec/test-wallet';
|
|
22
21
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -34,12 +33,12 @@ import {
|
|
|
34
33
|
deployAccounts,
|
|
35
34
|
publicDeployAccounts,
|
|
36
35
|
} from './snapshot_manager.js';
|
|
37
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress,
|
|
36
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEServiceAndGetWallet } from './utils.js';
|
|
38
37
|
|
|
39
38
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
40
39
|
|
|
41
40
|
type ProvenSetup = {
|
|
42
|
-
|
|
41
|
+
wallet: TestWallet;
|
|
43
42
|
teardown: () => Promise<void>;
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -63,7 +62,6 @@ export class FullProverTest {
|
|
|
63
62
|
tokenSim!: TokenSimulator;
|
|
64
63
|
aztecNode!: AztecNode;
|
|
65
64
|
aztecNodeAdmin!: AztecNodeAdmin;
|
|
66
|
-
pxe!: PXEService;
|
|
67
65
|
cheatCodes!: CheatCodes;
|
|
68
66
|
blobSink!: BlobSinkServer;
|
|
69
67
|
private provenComponents: ProvenSetup[] = [];
|
|
@@ -161,7 +159,6 @@ export class FullProverTest {
|
|
|
161
159
|
|
|
162
160
|
this.simulatedProverNode = this.context.proverNode!;
|
|
163
161
|
({
|
|
164
|
-
pxe: this.pxe,
|
|
165
162
|
aztecNode: this.aztecNode,
|
|
166
163
|
deployL1ContractsValues: this.l1Contracts,
|
|
167
164
|
cheatCodes: this.cheatCodes,
|
|
@@ -211,7 +208,7 @@ export class FullProverTest {
|
|
|
211
208
|
|
|
212
209
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
213
210
|
for (let i = 0; i < 2; i++) {
|
|
214
|
-
const
|
|
211
|
+
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEServiceAndGetWallet(
|
|
215
212
|
this.aztecNode,
|
|
216
213
|
{
|
|
217
214
|
proverEnabled: this.realProofs,
|
|
@@ -222,9 +219,7 @@ export class FullProverTest {
|
|
|
222
219
|
true,
|
|
223
220
|
);
|
|
224
221
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
225
|
-
await
|
|
226
|
-
|
|
227
|
-
const provenWallet = new TestWallet(result.pxe, this.aztecNode);
|
|
222
|
+
await provenWallet.registerContract(this.fakeProofsAsset);
|
|
228
223
|
|
|
229
224
|
for (let i = 0; i < 2; i++) {
|
|
230
225
|
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
@@ -233,8 +228,8 @@ export class FullProverTest {
|
|
|
233
228
|
|
|
234
229
|
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
235
230
|
this.provenComponents.push({
|
|
236
|
-
|
|
237
|
-
teardown:
|
|
231
|
+
wallet: provenWallet,
|
|
232
|
+
teardown: provenTeardown,
|
|
238
233
|
});
|
|
239
234
|
this.provenAssets.push(asset);
|
|
240
235
|
}
|
|
@@ -31,7 +31,7 @@ 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 { createPXEService, 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';
|
|
@@ -68,7 +68,6 @@ export type SubsystemsContext = {
|
|
|
68
68
|
bbConfig: any;
|
|
69
69
|
aztecNode: AztecNodeService;
|
|
70
70
|
aztecNodeConfig: AztecNodeConfig;
|
|
71
|
-
pxe: PXEService;
|
|
72
71
|
wallet: TestWallet;
|
|
73
72
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
74
73
|
proverNode?: ProverNode;
|
|
@@ -205,7 +204,7 @@ class SnapshotManager implements ISnapshotManager {
|
|
|
205
204
|
await restore(snapshotData, context);
|
|
206
205
|
|
|
207
206
|
// Save the snapshot data.
|
|
208
|
-
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls);
|
|
207
|
+
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls, context.dateProvider);
|
|
209
208
|
const anvilStateFile = `${this.livePath}/anvil.dat`;
|
|
210
209
|
await ethCheatCodes.dumpChainState(anvilStateFile);
|
|
211
210
|
writeFileSync(`${this.livePath}/${name}.json`, JSON.stringify(snapshotData || {}, resolver));
|
|
@@ -352,7 +351,9 @@ async function setupFromFresh(
|
|
|
352
351
|
const res = await startAnvil({ l1BlockTime: opts.ethereumSlotDuration });
|
|
353
352
|
const anvil = res.anvil;
|
|
354
353
|
aztecNodeConfig.l1RpcUrls = [res.rpcUrl];
|
|
355
|
-
|
|
354
|
+
|
|
355
|
+
const dateProvider = new TestDateProvider();
|
|
356
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
356
357
|
|
|
357
358
|
// Deploy our L1 contracts.
|
|
358
359
|
logger.verbose('Deploying L1 contracts...');
|
|
@@ -381,10 +382,8 @@ async function setupFromFresh(
|
|
|
381
382
|
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
382
383
|
aztecNodeConfig.l1PublishRetryIntervalMS = 100;
|
|
383
384
|
|
|
384
|
-
const dateProvider = new TestDateProvider();
|
|
385
|
-
|
|
386
385
|
const watcher = new AnvilTestWatcher(
|
|
387
|
-
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
386
|
+
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider),
|
|
388
387
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
389
388
|
deployL1ContractsValues.l1Client,
|
|
390
389
|
dateProvider,
|
|
@@ -449,7 +448,7 @@ async function setupFromFresh(
|
|
|
449
448
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
450
449
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
451
450
|
const wallet = new TestWallet(pxe, aztecNode);
|
|
452
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls,
|
|
451
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode, dateProvider);
|
|
453
452
|
|
|
454
453
|
if (statePath) {
|
|
455
454
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -460,7 +459,6 @@ async function setupFromFresh(
|
|
|
460
459
|
aztecNodeConfig,
|
|
461
460
|
anvil,
|
|
462
461
|
aztecNode,
|
|
463
|
-
pxe,
|
|
464
462
|
wallet,
|
|
465
463
|
sequencer: aztecNode.getSequencer()!,
|
|
466
464
|
acvmConfig,
|
|
@@ -506,7 +504,9 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
506
504
|
aztecNodeConfig.l1RpcUrls = [rpcUrl];
|
|
507
505
|
// Load anvil state.
|
|
508
506
|
const anvilStateFile = `${statePath}/anvil.dat`;
|
|
509
|
-
|
|
507
|
+
|
|
508
|
+
const dateProvider = new TestDateProvider();
|
|
509
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
510
510
|
await ethCheatCodes.loadChainState(anvilStateFile);
|
|
511
511
|
|
|
512
512
|
// TODO: Encapsulate this in a NativeAcvm impl.
|
|
@@ -525,9 +525,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
525
525
|
logger.verbose('Creating ETH clients...');
|
|
526
526
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
527
527
|
|
|
528
|
-
const dateProvider = new TestDateProvider();
|
|
529
528
|
const watcher = new AnvilTestWatcher(
|
|
530
|
-
|
|
529
|
+
ethCheatCodes,
|
|
531
530
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
532
531
|
l1Client,
|
|
533
532
|
dateProvider,
|
|
@@ -578,13 +577,12 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
578
577
|
pxeConfig.dataDirectory = statePath;
|
|
579
578
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
580
579
|
const wallet = new TestWallet(pxe, aztecNode);
|
|
581
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls,
|
|
580
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, wallet, aztecNode, dateProvider);
|
|
582
581
|
|
|
583
582
|
return {
|
|
584
583
|
aztecNodeConfig,
|
|
585
584
|
anvil,
|
|
586
585
|
aztecNode,
|
|
587
|
-
pxe,
|
|
588
586
|
wallet,
|
|
589
587
|
sequencer: aztecNode.getSequencer()!,
|
|
590
588
|
acvmConfig,
|