@aztec/end-to-end 1.0.0-nightly.20250708 → 1.0.0-staging.0
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 +2 -2
- package/dest/bench/utils.js +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 -1
- package/dest/e2e_epochs/epochs_test.d.ts +2 -15
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +3 -59
- 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 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +2 -5
- package/dest/e2e_p2p/shared.d.ts +1 -1
- package/dest/e2e_p2p/shared.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/e2e_prover_test.js +1 -2
- package/dest/fixtures/setup_p2p_test.d.ts +0 -2
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +1 -27
- 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 +4 -7
- package/dest/fixtures/utils.d.ts +4 -16
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +16 -67
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +0 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +6 -70
- package/dest/spartan/utils.d.ts +2 -21
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +4 -6
- package/package.json +35 -35
- package/src/bench/client_flows/client_flows_benchmark.ts +2 -2
- package/src/bench/utils.ts +1 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +22 -90
- package/src/e2e_fees/fees_test.ts +2 -2
- package/src/e2e_p2p/p2p_network.ts +2 -3
- package/src/e2e_p2p/shared.ts +1 -1
- package/src/fixtures/e2e_prover_test.ts +2 -3
- package/src/fixtures/setup_p2p_test.ts +1 -39
- package/src/fixtures/snapshot_manager.ts +4 -4
- package/src/fixtures/utils.ts +19 -82
- package/src/shared/uniswap_l1_l2.ts +1 -1
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +4 -81
- package/src/spartan/utils.ts +3 -7
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type Wallet,
|
|
16
16
|
createLogger,
|
|
17
17
|
} from '@aztec/aztec.js';
|
|
18
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
18
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
19
19
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
20
20
|
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
21
21
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
@@ -145,7 +145,7 @@ export class ClientFlowsBenchmark {
|
|
|
145
145
|
await context.aztecNode.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
|
|
146
146
|
|
|
147
147
|
const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
|
|
148
|
-
this.chainMonitor = new ChainMonitor(rollupContract,
|
|
148
|
+
this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
|
|
149
149
|
|
|
150
150
|
return this;
|
|
151
151
|
}
|
package/src/bench/utils.ts
CHANGED
|
@@ -160,7 +160,7 @@ export async function createNewPXE(node: AztecNode, contract: BenchmarkingContra
|
|
|
160
160
|
const l1Contracts = await node.getL1ContractAddresses();
|
|
161
161
|
const { l1ChainId, rollupVersion } = await node.getNodeInfo();
|
|
162
162
|
const pxeConfig = {
|
|
163
|
-
l2BlockBatchSize:
|
|
163
|
+
l2BlockBatchSize: 200,
|
|
164
164
|
l2BlockPollingIntervalMS: 100,
|
|
165
165
|
dataDirectory: undefined,
|
|
166
166
|
dataStoreMapSizeKB: 1024 * 1024,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type PXE,
|
|
11
11
|
createLogger,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
13
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
14
14
|
import {
|
|
15
15
|
type DeployL1ContractsReturnType,
|
|
16
16
|
type ExtendedViemWalletClient,
|
|
@@ -19,14 +19,9 @@ import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
|
19
19
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
20
20
|
import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
|
|
21
21
|
import type { TestProverNode } from '@aztec/prover-node/test';
|
|
22
|
-
import {
|
|
23
|
-
type SequencerClient,
|
|
24
|
-
type SequencerEvents,
|
|
25
|
-
type SequencerPublisher,
|
|
26
|
-
SequencerState,
|
|
27
|
-
} from '@aztec/sequencer-client';
|
|
22
|
+
import type { SequencerPublisher } from '@aztec/sequencer-client';
|
|
28
23
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
29
|
-
import type {
|
|
24
|
+
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
30
25
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
31
26
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
32
27
|
|
|
@@ -46,15 +41,23 @@ export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
|
46
41
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
47
42
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
48
43
|
|
|
49
|
-
export type EpochsTestOpts = Partial<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
export type EpochsTestOpts = Partial<
|
|
45
|
+
Pick<
|
|
46
|
+
SetupOptions,
|
|
47
|
+
| 'startProverNode'
|
|
48
|
+
| 'aztecProofSubmissionEpochs'
|
|
49
|
+
| 'aztecEpochDuration'
|
|
50
|
+
| 'proverTestDelayMs'
|
|
51
|
+
| 'l1PublishRetryIntervalMS'
|
|
52
|
+
| 'txPropagationMaxQueryAttempts'
|
|
53
|
+
| 'proverNodeConfig'
|
|
54
|
+
| 'ethereumSlotDuration'
|
|
55
|
+
| 'aztecSlotDuration'
|
|
56
|
+
| 'initialValidators'
|
|
57
|
+
| 'mockGossipSubNetwork'
|
|
58
|
+
| 'disableAnvilTestWatcher'
|
|
59
|
+
>
|
|
60
|
+
> & { numberOfAccounts?: number };
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
* Tests building of epochs using fast block times and short epochs.
|
|
@@ -137,7 +140,7 @@ export class EpochsTestContext {
|
|
|
137
140
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
138
141
|
|
|
139
142
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
140
|
-
this.monitor = new ChainMonitor(this.rollup,
|
|
143
|
+
this.monitor = new ChainMonitor(this.rollup, this.logger).start();
|
|
141
144
|
|
|
142
145
|
// This is hideous.
|
|
143
146
|
// We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
|
|
@@ -201,15 +204,13 @@ export class EpochsTestContext {
|
|
|
201
204
|
|
|
202
205
|
public createValidatorNode(
|
|
203
206
|
privateKeys: `0x${string}`[],
|
|
204
|
-
opts: Partial<AztecNodeConfig> & {
|
|
207
|
+
opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {},
|
|
205
208
|
) {
|
|
206
209
|
this.logger.warn('Creating and syncing a validator node...');
|
|
207
210
|
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
|
|
208
211
|
}
|
|
209
212
|
|
|
210
|
-
private async createNode(
|
|
211
|
-
opts: Partial<AztecNodeConfig> & { txDelayerMaxInclusionTimeIntoSlot?: number; dontStartSequencer?: boolean } = {},
|
|
212
|
-
) {
|
|
213
|
+
private async createNode(opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {}) {
|
|
213
214
|
const suffix = (this.nodes.length + 1).toString();
|
|
214
215
|
const { mockGossipSubNetwork } = this.context;
|
|
215
216
|
const resolvedConfig = { ...this.context.config, ...opts };
|
|
@@ -236,22 +237,6 @@ export class EpochsTestContext {
|
|
|
236
237
|
},
|
|
237
238
|
),
|
|
238
239
|
);
|
|
239
|
-
|
|
240
|
-
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
241
|
-
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
242
|
-
// which directly exposes the delayer and sets any test config.
|
|
243
|
-
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
244
|
-
this.logger.info(
|
|
245
|
-
`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`,
|
|
246
|
-
);
|
|
247
|
-
const sequencer = node.getSequencer() as TestSequencerClient;
|
|
248
|
-
const publisher = sequencer.sequencer.publisher;
|
|
249
|
-
const dateProvider = this.context.dateProvider!;
|
|
250
|
-
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, dateProvider, this.L1_BLOCK_TIME_IN_S);
|
|
251
|
-
delayed.delayer!.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
252
|
-
publisher.l1TxUtils = delayed;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
240
|
this.nodes.push(node);
|
|
256
241
|
return node;
|
|
257
242
|
}
|
|
@@ -343,7 +328,6 @@ export class EpochsTestContext {
|
|
|
343
328
|
privateKeyToAccount(this.getNextPrivateKey()),
|
|
344
329
|
this.l1Client.chain,
|
|
345
330
|
),
|
|
346
|
-
this.context.dateProvider!,
|
|
347
331
|
{ ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
|
|
348
332
|
);
|
|
349
333
|
expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
|
|
@@ -361,56 +345,4 @@ export class EpochsTestContext {
|
|
|
361
345
|
.catch(_ => false);
|
|
362
346
|
expect(result).toBe(expectedSuccess);
|
|
363
347
|
}
|
|
364
|
-
|
|
365
|
-
public watchSequencerEvents(
|
|
366
|
-
sequencers: SequencerClient[],
|
|
367
|
-
getMetadata: (i: number) => Record<string, any> = () => ({}),
|
|
368
|
-
) {
|
|
369
|
-
const stateChanges: TrackedSequencerEvent[] = [];
|
|
370
|
-
const failEvents: TrackedSequencerEvent[] = [];
|
|
371
|
-
|
|
372
|
-
// Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
|
|
373
|
-
// due to lack of txs available.
|
|
374
|
-
const failEventsKeys: (keyof SequencerEvents)[] = [
|
|
375
|
-
'block-build-failed',
|
|
376
|
-
'block-publish-failed',
|
|
377
|
-
'proposer-rollup-check-failed',
|
|
378
|
-
];
|
|
379
|
-
|
|
380
|
-
const makeEvent = (
|
|
381
|
-
i: number,
|
|
382
|
-
eventName: keyof SequencerEvents,
|
|
383
|
-
args: Parameters<SequencerEvents[keyof SequencerEvents]>[0],
|
|
384
|
-
) =>
|
|
385
|
-
({
|
|
386
|
-
...args,
|
|
387
|
-
type: eventName,
|
|
388
|
-
sequencerIndex: i + 2,
|
|
389
|
-
...getMetadata(i),
|
|
390
|
-
}) as TrackedSequencerEvent;
|
|
391
|
-
|
|
392
|
-
sequencers.forEach((sequencer, i) => {
|
|
393
|
-
const sequencerIndex = i + 2;
|
|
394
|
-
sequencer.getSequencer().on('state-changed', (args: Parameters<SequencerEvents['state-changed']>[0]) => {
|
|
395
|
-
const noisyStates = [SequencerState.IDLE, SequencerState.PROPOSER_CHECK, SequencerState.SYNCHRONIZING];
|
|
396
|
-
if (!noisyStates.includes(args.newState)) {
|
|
397
|
-
const evt = makeEvent(i, 'state-changed', args);
|
|
398
|
-
stateChanges.push(evt);
|
|
399
|
-
this.logger.verbose(
|
|
400
|
-
`Sequencer ${sequencerIndex} transitioned from state ${args.oldState} to state ${args.newState}`,
|
|
401
|
-
evt,
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
failEventsKeys.forEach(eventName => {
|
|
406
|
-
sequencer.getSequencer().on(eventName, (args: Parameters<SequencerEvents[typeof eventName]>[0]) => {
|
|
407
|
-
const evt = makeEvent(i, eventName, args);
|
|
408
|
-
failEvents.push(evt);
|
|
409
|
-
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, evt);
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
return { failEvents, stateChanges };
|
|
415
|
-
}
|
|
416
348
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
createLogger,
|
|
9
9
|
sleep,
|
|
10
10
|
} from '@aztec/aztec.js';
|
|
11
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
11
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
12
12
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
13
13
|
import {
|
|
14
14
|
type DeployL1ContractsArgs,
|
|
@@ -125,7 +125,7 @@ export class FeesTest {
|
|
|
125
125
|
await context.aztecNode.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
|
|
126
126
|
|
|
127
127
|
const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
|
|
128
|
-
this.chainMonitor = new ChainMonitor(rollupContract,
|
|
128
|
+
this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
|
|
129
129
|
|
|
130
130
|
return this;
|
|
131
131
|
}
|
|
@@ -254,7 +254,7 @@ export class P2PNetworkTest {
|
|
|
254
254
|
]),
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
-
const timestamp = await cheatCodes.rollup.advanceToEpoch(2n
|
|
257
|
+
const timestamp = await cheatCodes.rollup.advanceToEpoch(2n);
|
|
258
258
|
|
|
259
259
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
260
260
|
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
@@ -335,8 +335,7 @@ export class P2PNetworkTest {
|
|
|
335
335
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
336
336
|
this.prefilledPublicData = prefilledPublicData;
|
|
337
337
|
|
|
338
|
-
|
|
339
|
-
this.monitor = new ChainMonitor(rollupContract, this.ctx.dateProvider).start();
|
|
338
|
+
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
|
|
340
339
|
this.monitor.on('l1-block', ({ timestamp }) => this.ctx.dateProvider.setTime(Number(timestamp) * 1000));
|
|
341
340
|
}
|
|
342
341
|
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getContractInstanceFromDeployParams,
|
|
11
11
|
retryUntil,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
|
-
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
13
|
+
import type { RollupCheatCodes } from '@aztec/aztec.js/testing';
|
|
14
14
|
import type { RollupContract, ViemClient } from '@aztec/ethereum';
|
|
15
15
|
import { timesAsync } from '@aztec/foundation/collection';
|
|
16
16
|
import type { SlashFactoryAbi } from '@aztec/l1-artifacts/SlashFactoryAbi';
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type PXE,
|
|
15
15
|
createLogger,
|
|
16
16
|
} from '@aztec/aztec.js';
|
|
17
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
17
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
18
18
|
import {
|
|
19
19
|
BBCircuitVerifier,
|
|
20
20
|
type ClientProtocolCircuitVerifier,
|
|
@@ -291,7 +291,7 @@ export class FullProverTest {
|
|
|
291
291
|
this.logger.verbose('Starting prover node');
|
|
292
292
|
const proverConfig: ProverNodeConfig = {
|
|
293
293
|
...this.context.aztecNodeConfig,
|
|
294
|
-
|
|
294
|
+
proverCoordinationNodeUrls: [],
|
|
295
295
|
dataDirectory: undefined,
|
|
296
296
|
proverId: this.proverAddress.toField(),
|
|
297
297
|
realProofs: this.realProofs,
|
|
@@ -303,7 +303,6 @@ export class FullProverTest {
|
|
|
303
303
|
txGatheringIntervalMs: 1000,
|
|
304
304
|
txGatheringBatchSize: 10,
|
|
305
305
|
txGatheringMaxParallelRequestsPerNode: 100,
|
|
306
|
-
txGatheringTimeoutMs: 24_000,
|
|
307
306
|
proverNodeFailedEpochStore: undefined,
|
|
308
307
|
};
|
|
309
308
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
@@ -5,9 +5,7 @@ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
|
5
5
|
import type { SentTx } from '@aztec/aztec.js';
|
|
6
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
7
7
|
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
|
|
8
|
-
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
8
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
-
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
11
9
|
import type { PXEService } from '@aztec/pxe/server';
|
|
12
10
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
13
11
|
|
|
@@ -15,7 +13,7 @@ import getPort from 'get-port';
|
|
|
15
13
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
16
14
|
|
|
17
15
|
import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
18
|
-
import {
|
|
16
|
+
import { getPrivateKeyFromIndex } from './utils.js';
|
|
19
17
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
20
18
|
|
|
21
19
|
// Setup snapshots will create a node with index 0, and run extra bootstrap with
|
|
@@ -103,42 +101,6 @@ export async function createNode(
|
|
|
103
101
|
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
export async function createProverNode(
|
|
107
|
-
config: AztecNodeConfig,
|
|
108
|
-
tcpPort: number,
|
|
109
|
-
bootstrapNode: string | undefined,
|
|
110
|
-
addressIndex: number,
|
|
111
|
-
proverNodeDeps: ProverNodeDeps & Required<Pick<ProverNodeDeps, 'dateProvider'>>,
|
|
112
|
-
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
113
|
-
dataDirectory?: string,
|
|
114
|
-
metricsPort?: number,
|
|
115
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
116
|
-
) {
|
|
117
|
-
const createProverNode = async () => {
|
|
118
|
-
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
119
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
120
|
-
|
|
121
|
-
const proverConfig: Partial<ProverNodeConfig> = {
|
|
122
|
-
p2pIp: `127.0.0.1`,
|
|
123
|
-
p2pPort: tcpPort ?? (await getPort()),
|
|
124
|
-
p2pEnabled: true,
|
|
125
|
-
peerCheckIntervalMS: TEST_PEER_CHECK_INTERVAL_MS,
|
|
126
|
-
blockCheckIntervalMS: 1000,
|
|
127
|
-
bootstrapNodes: bootstrapNode ? [bootstrapNode] : [],
|
|
128
|
-
};
|
|
129
|
-
const aztecNodeRpcTxProvider = undefined;
|
|
130
|
-
return await createAndSyncProverNode(
|
|
131
|
-
bufferToHex(proverNodePrivateKey),
|
|
132
|
-
config,
|
|
133
|
-
{ ...proverConfig, dataDirectory },
|
|
134
|
-
aztecNodeRpcTxProvider,
|
|
135
|
-
prefilledPublicData,
|
|
136
|
-
{ ...proverNodeDeps, telemetry },
|
|
137
|
-
);
|
|
138
|
-
};
|
|
139
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
104
|
export async function createValidatorConfig(
|
|
143
105
|
config: AztecNodeConfig,
|
|
144
106
|
bootstrapNodeEnr?: string,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
waitForProven,
|
|
16
16
|
} from '@aztec/aztec.js';
|
|
17
17
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
18
|
-
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
18
|
+
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
19
19
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
20
20
|
import {
|
|
21
21
|
type DeployL1ContractsArgs,
|
|
@@ -348,7 +348,7 @@ async function setupFromFresh(
|
|
|
348
348
|
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
349
349
|
|
|
350
350
|
if (opts.l1StartTime) {
|
|
351
|
-
await ethCheatCodes.warp(opts.l1StartTime
|
|
351
|
+
await ethCheatCodes.warp(opts.l1StartTime);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
|
|
@@ -443,11 +443,11 @@ async function setupFromFresh(
|
|
|
443
443
|
|
|
444
444
|
let proverNode: ProverNode | undefined = undefined;
|
|
445
445
|
if (opts.startProverNode) {
|
|
446
|
-
logger.verbose('Creating and syncing a simulated prover node
|
|
446
|
+
logger.verbose('Creating and syncing a simulated prover node...');
|
|
447
447
|
proverNode = await createAndSyncProverNode(
|
|
448
448
|
`0x${proverNodePrivateKey!.toString('hex')}`,
|
|
449
449
|
aztecNodeConfig,
|
|
450
|
-
{ dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex'))
|
|
450
|
+
{ dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
|
|
451
451
|
aztecNode,
|
|
452
452
|
prefilledPublicData,
|
|
453
453
|
);
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
10
10
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
11
11
|
import {
|
|
12
|
-
AccountManager,
|
|
13
12
|
type AccountWalletWithSecretKey,
|
|
14
13
|
type AztecAddress,
|
|
15
14
|
type AztecNode,
|
|
@@ -22,11 +21,10 @@ import {
|
|
|
22
21
|
createLogger,
|
|
23
22
|
createPXEClient,
|
|
24
23
|
makeFetch,
|
|
25
|
-
sleep,
|
|
26
24
|
waitForPXE,
|
|
27
25
|
} from '@aztec/aztec.js';
|
|
28
26
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
29
|
-
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
27
|
+
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
30
28
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
31
29
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
32
30
|
import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
@@ -57,7 +55,7 @@ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
|
57
55
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
58
56
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
59
57
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
60
|
-
import { type ProverNode, type ProverNodeConfig,
|
|
58
|
+
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
61
59
|
import {
|
|
62
60
|
type PXEService,
|
|
63
61
|
type PXEServiceConfig,
|
|
@@ -68,11 +66,7 @@ import type { SequencerClient } from '@aztec/sequencer-client';
|
|
|
68
66
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
69
67
|
import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
70
68
|
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
71
|
-
import {
|
|
72
|
-
type ContractInstanceWithAddress,
|
|
73
|
-
getContractClassFromArtifact,
|
|
74
|
-
getContractInstanceFromDeployParams,
|
|
75
|
-
} from '@aztec/stdlib/contract';
|
|
69
|
+
import { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
76
70
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
77
71
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
78
72
|
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
@@ -420,7 +414,7 @@ export async function setup(
|
|
|
420
414
|
}
|
|
421
415
|
|
|
422
416
|
if (opts.l1StartTime) {
|
|
423
|
-
await ethCheatCodes.warp(opts.l1StartTime
|
|
417
|
+
await ethCheatCodes.warp(opts.l1StartTime);
|
|
424
418
|
}
|
|
425
419
|
|
|
426
420
|
let publisherPrivKey = undefined;
|
|
@@ -509,7 +503,7 @@ export async function setup(
|
|
|
509
503
|
if (opts.l2StartTime) {
|
|
510
504
|
// This should only be used in synching test or when you need to have a stable
|
|
511
505
|
// timestamp for the first l2 block.
|
|
512
|
-
await ethCheatCodes.warp(opts.l2StartTime
|
|
506
|
+
await ethCheatCodes.warp(opts.l2StartTime);
|
|
513
507
|
}
|
|
514
508
|
|
|
515
509
|
const dateProvider = new TestDateProvider();
|
|
@@ -568,20 +562,6 @@ export async function setup(
|
|
|
568
562
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
569
563
|
}
|
|
570
564
|
|
|
571
|
-
// Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
|
|
572
|
-
// To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
|
|
573
|
-
// For account deployments, we set minTxsPerBlock=1 and deploy accounts sequentially for guaranteed success.
|
|
574
|
-
// If no accounts need deployment, we await an empty block to confirm network progression. After either path
|
|
575
|
-
// completes, we restore the original minTxsPerBlock setting. The deployment and waiting for empty block is
|
|
576
|
-
// handled by the if-else branches on line 632.
|
|
577
|
-
// For more details on why the tx would be dropped see `validate_include_by_timestamp` function in
|
|
578
|
-
// `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`.
|
|
579
|
-
const originalMinTxsPerBlock = config.minTxsPerBlock;
|
|
580
|
-
if (originalMinTxsPerBlock === undefined) {
|
|
581
|
-
throw new Error('minTxsPerBlock is undefined in e2e test setup');
|
|
582
|
-
}
|
|
583
|
-
config.minTxsPerBlock = numberOfAccounts === 0 ? 0 : 1;
|
|
584
|
-
|
|
585
565
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
586
566
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
587
567
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
@@ -589,15 +569,11 @@ export async function setup(
|
|
|
589
569
|
{ dateProvider, blobSinkClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
|
|
590
570
|
{ prefilledPublicData },
|
|
591
571
|
);
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
if (
|
|
595
|
-
const publisher = (
|
|
596
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(
|
|
597
|
-
publisher.l1TxUtils,
|
|
598
|
-
dateProvider,
|
|
599
|
-
config.ethereumSlotDuration,
|
|
600
|
-
);
|
|
572
|
+
const sequencer = aztecNode.getSequencer();
|
|
573
|
+
|
|
574
|
+
if (sequencer) {
|
|
575
|
+
const publisher = (sequencer as TestSequencerClient).sequencer.publisher;
|
|
576
|
+
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration);
|
|
601
577
|
}
|
|
602
578
|
|
|
603
579
|
let proverNode: ProverNode | undefined = undefined;
|
|
@@ -628,27 +604,9 @@ export async function setup(
|
|
|
628
604
|
// We need to advance to epoch 2 such that the committee is set up.
|
|
629
605
|
logger.info(`Advancing to epoch 2`);
|
|
630
606
|
await cheatCodes.rollup.advanceToEpoch(2n, { updateDateProvider: dateProvider });
|
|
631
|
-
await cheatCodes.rollup.setupEpoch();
|
|
632
|
-
await cheatCodes.rollup.debugRollup();
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// Below we continue with what we described in the long comment on line 571.
|
|
636
|
-
let accountManagers: AccountManager[] = [];
|
|
637
|
-
if (numberOfAccounts === 0) {
|
|
638
|
-
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
639
|
-
while ((await pxe.getBlockNumber()) === 0) {
|
|
640
|
-
await sleep(2000);
|
|
641
|
-
}
|
|
642
|
-
} else {
|
|
643
|
-
logger.info(
|
|
644
|
-
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
|
|
645
|
-
);
|
|
646
|
-
accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
647
607
|
}
|
|
648
608
|
|
|
649
|
-
|
|
650
|
-
sequencerClient!.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
|
|
651
|
-
|
|
609
|
+
const accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
652
610
|
const wallets = await Promise.all(accountManagers.map(account => account.getWallet()));
|
|
653
611
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
654
612
|
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
@@ -695,7 +653,7 @@ export async function setup(
|
|
|
695
653
|
prefilledPublicData,
|
|
696
654
|
proverNode,
|
|
697
655
|
pxe,
|
|
698
|
-
sequencer
|
|
656
|
+
sequencer,
|
|
699
657
|
teardown,
|
|
700
658
|
telemetryClient: telemetry,
|
|
701
659
|
wallet: wallets[0],
|
|
@@ -821,26 +779,15 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
821
779
|
expect(diffs).toEqual(expectedDiffs);
|
|
822
780
|
}
|
|
823
781
|
|
|
824
|
-
/**
|
|
825
|
-
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
826
|
-
* but by conventions its address is computed with a salt of 0.
|
|
827
|
-
* @returns The address of the sponsored FPC contract
|
|
828
|
-
*/
|
|
829
|
-
export function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress> {
|
|
830
|
-
return Promise.resolve(
|
|
831
|
-
getContractInstanceFromDeployParams(SponsoredFPCContract.artifact, {
|
|
832
|
-
salt: new Fr(SPONSORED_FPC_SALT),
|
|
833
|
-
}),
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
782
|
/**
|
|
838
783
|
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
839
784
|
* but by conventions its address is computed with a salt of 0.
|
|
840
785
|
* @returns The address of the sponsored FPC contract
|
|
841
786
|
*/
|
|
842
787
|
export async function getSponsoredFPCAddress() {
|
|
843
|
-
const sponsoredFPCInstance = await
|
|
788
|
+
const sponsoredFPCInstance = await getContractInstanceFromDeployParams(SponsoredFPCContract.artifact, {
|
|
789
|
+
salt: new Fr(SPONSORED_FPC_SALT),
|
|
790
|
+
});
|
|
844
791
|
return sponsoredFPCInstance.address;
|
|
845
792
|
}
|
|
846
793
|
|
|
@@ -857,14 +804,6 @@ export async function setupSponsoredFPC(pxe: PXE) {
|
|
|
857
804
|
return instance;
|
|
858
805
|
}
|
|
859
806
|
|
|
860
|
-
/**
|
|
861
|
-
* Registers the SponsoredFPC in this PXE instance
|
|
862
|
-
* @param pxe - The pxe client
|
|
863
|
-
*/
|
|
864
|
-
export async function registerSponsoredFPC(pxe: PXE): Promise<void> {
|
|
865
|
-
await pxe.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
|
|
866
|
-
}
|
|
867
|
-
|
|
868
807
|
export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
|
|
869
808
|
targetBlock ??= await node.getBlockNumber();
|
|
870
809
|
|
|
@@ -880,14 +819,13 @@ export function createAndSyncProverNode(
|
|
|
880
819
|
proverNodePrivateKey: `0x${string}`,
|
|
881
820
|
aztecNodeConfig: AztecNodeConfig,
|
|
882
821
|
proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
|
|
883
|
-
aztecNode: AztecNode
|
|
822
|
+
aztecNode: AztecNode,
|
|
884
823
|
prefilledPublicData: PublicDataTreeLeaf[] = [],
|
|
885
|
-
proverNodeDeps: ProverNodeDeps = {},
|
|
886
824
|
) {
|
|
887
825
|
return withLogNameSuffix('prover-node', async () => {
|
|
888
826
|
// Disable stopping the aztec node as the prover coordination test will kill it otherwise
|
|
889
827
|
// This is only required when stopping the prover node for testing
|
|
890
|
-
const aztecNodeTxProvider =
|
|
828
|
+
const aztecNodeTxProvider = {
|
|
891
829
|
getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
|
|
892
830
|
getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
|
|
893
831
|
stop: () => Promise.resolve(),
|
|
@@ -902,7 +840,7 @@ export function createAndSyncProverNode(
|
|
|
902
840
|
// Prover node config is for simulated proofs
|
|
903
841
|
const proverConfig: ProverNodeConfig = {
|
|
904
842
|
...aztecNodeConfig,
|
|
905
|
-
|
|
843
|
+
proverCoordinationNodeUrls: [],
|
|
906
844
|
realProofs: false,
|
|
907
845
|
proverAgentCount: 2,
|
|
908
846
|
publisherPrivateKey: new SecretValue(proverNodePrivateKey),
|
|
@@ -912,7 +850,6 @@ export function createAndSyncProverNode(
|
|
|
912
850
|
txGatheringIntervalMs: 1000,
|
|
913
851
|
txGatheringBatchSize: 10,
|
|
914
852
|
txGatheringMaxParallelRequestsPerNode: 10,
|
|
915
|
-
txGatheringTimeoutMs: 24_000,
|
|
916
853
|
proverNodeFailedEpochStore: undefined,
|
|
917
854
|
...proverNodeConfig,
|
|
918
855
|
};
|
|
@@ -921,7 +858,7 @@ export function createAndSyncProverNode(
|
|
|
921
858
|
|
|
922
859
|
const proverNode = await createProverNode(
|
|
923
860
|
proverConfig,
|
|
924
|
-
{
|
|
861
|
+
{ aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
925
862
|
{ prefilledPublicData },
|
|
926
863
|
);
|
|
927
864
|
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
computeAuthWitMessageHash,
|
|
10
10
|
generateClaimSecret,
|
|
11
11
|
} from '@aztec/aztec.js';
|
|
12
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
13
13
|
import {
|
|
14
14
|
type DeployL1ContractsReturnType,
|
|
15
15
|
type ExtendedViemWalletClient,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Convenience struct to hold an account's address and secret that can easily be passed around.
|
|
2
2
|
import { AztecAddress, Fr } from '@aztec/aztec.js';
|
|
3
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
|
+
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
4
4
|
import type { RollupContract } from '@aztec/ethereum';
|
|
5
5
|
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
6
6
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|