@aztec/end-to-end 0.85.0 → 0.86.0-nightly.20250425
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.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -7
- package/dest/bench/client_flows/data_extractor.js +12 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +2 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -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 +11 -11
- package/dest/e2e_epochs/epochs_test.d.ts +3 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +4 -2
- package/dest/e2e_fees/fees_test.d.ts +4 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +22 -10
- package/dest/e2e_p2p/p2p_network.d.ts +67 -72
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +20 -61
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +10 -9
- package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +15 -13
- package/dest/fixtures/utils.d.ts +5 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +36 -29
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +3 -17
- package/dest/shared/cross_chain_test_harness.d.ts +7 -11
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +6 -11
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -10
- package/dest/shared/uniswap_l1_l2.d.ts +3 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -19
- package/dest/spartan/setup_test_wallets.js +3 -3
- package/package.json +34 -35
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
- package/src/bench/client_flows/data_extractor.ts +10 -6
- package/src/bench/utils.ts +2 -0
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
- package/src/e2e_epochs/epochs_test.ts +9 -5
- package/src/e2e_fees/fees_test.ts +32 -10
- package/src/e2e_p2p/p2p_network.ts +28 -74
- package/src/e2e_prover/e2e_prover_test.ts +10 -14
- package/src/fixtures/l1_to_l2_messaging.ts +5 -14
- package/src/fixtures/setup_l1_contracts.ts +1 -2
- package/src/fixtures/snapshot_manager.ts +11 -13
- package/src/fixtures/utils.ts +38 -43
- package/src/shared/capture_private_execution_steps.ts +3 -19
- package/src/shared/cross_chain_test_harness.ts +14 -31
- package/src/shared/gas_portal_test_harness.ts +9 -14
- package/src/shared/uniswap_l1_l2.ts +25 -43
- package/src/spartan/setup_test_wallets.ts +3 -3
|
@@ -2,8 +2,13 @@ import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
type ExtendedViemWalletClient,
|
|
7
|
+
L1TxUtils,
|
|
8
|
+
RollupContract,
|
|
9
|
+
getExpectedAddress,
|
|
10
|
+
getL1ContractsConfigEnvVars,
|
|
11
|
+
} from '@aztec/ethereum';
|
|
7
12
|
import { ChainMonitor, EthCheatCodesWithState } from '@aztec/ethereum/test';
|
|
8
13
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
9
14
|
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -66,10 +71,6 @@ export class P2PNetworkTest {
|
|
|
66
71
|
|
|
67
72
|
public bootstrapNode?: BootstrapNode;
|
|
68
73
|
|
|
69
|
-
private cleanupInterval: NodeJS.Timeout | undefined = undefined;
|
|
70
|
-
|
|
71
|
-
private gasUtils: L1TxUtilsWithBlobs | undefined = undefined;
|
|
72
|
-
|
|
73
74
|
constructor(
|
|
74
75
|
testName: string,
|
|
75
76
|
public bootstrapNodeEnr: string,
|
|
@@ -147,32 +148,6 @@ export class P2PNetworkTest {
|
|
|
147
148
|
return this.deployedAccounts[0];
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
/**
|
|
151
|
-
* Start a loop to sync the mock system time with the L1 block time
|
|
152
|
-
*/
|
|
153
|
-
public startSyncMockSystemTimeInterval() {
|
|
154
|
-
this.cleanupInterval = setInterval(() => {
|
|
155
|
-
void this.syncMockSystemTime().catch(err => this.logger.error('Error syncing mock system time', err));
|
|
156
|
-
}, l1ContractsConfig.aztecSlotDuration * 1000);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* When using fake timers, we need to keep the system and anvil clocks in sync.
|
|
161
|
-
*/
|
|
162
|
-
public async syncMockSystemTime() {
|
|
163
|
-
this.logger.info('Syncing mock system time');
|
|
164
|
-
const { dateProvider, deployL1ContractsValues } = this.ctx!;
|
|
165
|
-
// Send a tx and only update the time after the tx is mined, as eth time is not continuous
|
|
166
|
-
const { receipt } = await this.gasUtils!.sendAndMonitorTransaction({
|
|
167
|
-
to: this.baseAccount.address,
|
|
168
|
-
data: '0x',
|
|
169
|
-
value: 1n,
|
|
170
|
-
});
|
|
171
|
-
const timestamp = await deployL1ContractsValues.publicClient.getBlock({ blockNumber: receipt.blockNumber });
|
|
172
|
-
this.logger.info(`Timestamp: ${timestamp.timestamp}`);
|
|
173
|
-
dateProvider.setTime(Number(timestamp.timestamp) * 1000);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
151
|
async addBootstrapNode() {
|
|
177
152
|
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
|
|
178
153
|
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
@@ -215,14 +190,13 @@ export class P2PNetworkTest {
|
|
|
215
190
|
|
|
216
191
|
async applyBaseSnapshots() {
|
|
217
192
|
await this.addBootstrapNode();
|
|
218
|
-
|
|
219
193
|
await this.snapshotManager.snapshot(
|
|
220
194
|
'add-validators',
|
|
221
195
|
async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider }) => {
|
|
222
196
|
const rollup = getContract({
|
|
223
197
|
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
224
198
|
abi: RollupAbi,
|
|
225
|
-
client: deployL1ContractsValues.
|
|
199
|
+
client: deployL1ContractsValues.l1Client,
|
|
226
200
|
});
|
|
227
201
|
|
|
228
202
|
this.logger.verbose(`Adding ${this.numberOfNodes} validators`);
|
|
@@ -230,26 +204,23 @@ export class P2PNetworkTest {
|
|
|
230
204
|
const stakingAsset = getContract({
|
|
231
205
|
address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
232
206
|
abi: TestERC20Abi,
|
|
233
|
-
client: deployL1ContractsValues.
|
|
207
|
+
client: deployL1ContractsValues.l1Client,
|
|
234
208
|
});
|
|
235
209
|
|
|
236
210
|
const stakeNeeded = l1ContractsConfig.minimumStake * BigInt(this.numberOfNodes);
|
|
237
211
|
await Promise.all(
|
|
238
212
|
[
|
|
239
|
-
await stakingAsset.write.mint(
|
|
240
|
-
[deployL1ContractsValues.walletClient.account.address, stakeNeeded],
|
|
241
|
-
{} as any,
|
|
242
|
-
),
|
|
213
|
+
await stakingAsset.write.mint([deployL1ContractsValues.l1Client.account.address, stakeNeeded], {} as any),
|
|
243
214
|
await stakingAsset.write.approve(
|
|
244
215
|
[deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(), stakeNeeded],
|
|
245
216
|
{} as any,
|
|
246
217
|
),
|
|
247
|
-
].map(txHash => deployL1ContractsValues.
|
|
218
|
+
].map(txHash => deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash })),
|
|
248
219
|
);
|
|
249
220
|
|
|
250
221
|
const { validators } = this.getValidators();
|
|
251
222
|
this.validators = validators;
|
|
252
|
-
await deployL1ContractsValues.
|
|
223
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
253
224
|
hash: await rollup.write.cheat__InitialiseValidatorSet([this.validators]),
|
|
254
225
|
});
|
|
255
226
|
|
|
@@ -263,13 +234,7 @@ export class P2PNetworkTest {
|
|
|
263
234
|
}
|
|
264
235
|
|
|
265
236
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
266
|
-
await deployL1ContractsValues.
|
|
267
|
-
hash: await deployL1ContractsValues.walletClient.sendTransaction({
|
|
268
|
-
to: this.baseAccount.address,
|
|
269
|
-
value: 1n,
|
|
270
|
-
account: this.baseAccount,
|
|
271
|
-
}),
|
|
272
|
-
});
|
|
237
|
+
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
273
238
|
|
|
274
239
|
// Set the system time in the node, only after we have warped the time and waited for a block
|
|
275
240
|
// Time is only set in the NEXT block
|
|
@@ -315,14 +280,8 @@ export class P2PNetworkTest {
|
|
|
315
280
|
'remove-inital-validator',
|
|
316
281
|
async ({ deployL1ContractsValues, aztecNode, dateProvider }) => {
|
|
317
282
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
318
|
-
const receipt = await deployL1ContractsValues.
|
|
319
|
-
|
|
320
|
-
to: this.baseAccount.address,
|
|
321
|
-
value: 1n,
|
|
322
|
-
account: this.baseAccount,
|
|
323
|
-
}),
|
|
324
|
-
});
|
|
325
|
-
const block = await deployL1ContractsValues.publicClient.getBlock({
|
|
283
|
+
const { receipt } = await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
284
|
+
const block = await deployL1ContractsValues.l1Client.getBlock({
|
|
326
285
|
blockNumber: receipt.blockNumber,
|
|
327
286
|
});
|
|
328
287
|
dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
@@ -332,6 +291,18 @@ export class P2PNetworkTest {
|
|
|
332
291
|
);
|
|
333
292
|
}
|
|
334
293
|
|
|
294
|
+
async sendDummyTx() {
|
|
295
|
+
return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private async _sendDummyTx(l1Client: ExtendedViemWalletClient) {
|
|
299
|
+
const l1TxUtils = new L1TxUtils(l1Client);
|
|
300
|
+
return await l1TxUtils.sendAndMonitorTransaction({
|
|
301
|
+
to: l1Client.account!.address,
|
|
302
|
+
value: 1n,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
335
306
|
async setup() {
|
|
336
307
|
this.ctx = await this.snapshotManager.setup();
|
|
337
308
|
|
|
@@ -341,22 +312,8 @@ export class P2PNetworkTest {
|
|
|
341
312
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
342
313
|
this.prefilledPublicData = prefilledPublicData;
|
|
343
314
|
|
|
344
|
-
this.startSyncMockSystemTimeInterval();
|
|
345
|
-
|
|
346
|
-
this.gasUtils = new L1TxUtilsWithBlobs(
|
|
347
|
-
this.ctx.deployL1ContractsValues.publicClient,
|
|
348
|
-
this.ctx.deployL1ContractsValues.walletClient,
|
|
349
|
-
this.logger,
|
|
350
|
-
{
|
|
351
|
-
gasLimitBufferPercentage: 20,
|
|
352
|
-
maxGwei: 500n,
|
|
353
|
-
maxAttempts: 3,
|
|
354
|
-
checkIntervalMs: 100,
|
|
355
|
-
stallTimeMs: 1000,
|
|
356
|
-
},
|
|
357
|
-
);
|
|
358
|
-
|
|
359
315
|
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
|
|
316
|
+
this.monitor.on('l1-block', ({ timestamp }) => this.ctx.dateProvider.setTime(Number(timestamp) * 1000));
|
|
360
317
|
}
|
|
361
318
|
|
|
362
319
|
async stopNodes(nodes: AztecNodeService[]) {
|
|
@@ -376,8 +333,5 @@ export class P2PNetworkTest {
|
|
|
376
333
|
this.monitor.stop();
|
|
377
334
|
await this.bootstrapNode?.stop();
|
|
378
335
|
await this.snapshotManager.teardown();
|
|
379
|
-
if (this.cleanupInterval) {
|
|
380
|
-
clearInterval(this.cleanupInterval);
|
|
381
|
-
}
|
|
382
336
|
}
|
|
383
337
|
}
|
|
@@ -282,7 +282,7 @@ export class FullProverTest {
|
|
|
282
282
|
this.logger.verbose('Starting prover node');
|
|
283
283
|
const proverConfig: ProverNodeConfig = {
|
|
284
284
|
...this.context.aztecNodeConfig,
|
|
285
|
-
|
|
285
|
+
proverCoordinationNodeUrls: [],
|
|
286
286
|
dataDirectory: undefined,
|
|
287
287
|
proverId: this.proverAddress.toField(),
|
|
288
288
|
realProofs: this.realProofs,
|
|
@@ -291,9 +291,10 @@ export class FullProverTest {
|
|
|
291
291
|
proverNodeMaxPendingJobs: 100,
|
|
292
292
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
293
293
|
proverNodePollingIntervalMs: 100,
|
|
294
|
-
txGatheringTimeoutMs: 60000,
|
|
295
294
|
txGatheringIntervalMs: 1000,
|
|
296
|
-
|
|
295
|
+
txGatheringBatchSize: 10,
|
|
296
|
+
txGatheringMaxParallelRequestsPerNode: 100,
|
|
297
|
+
proverNodeFailedEpochStore: undefined,
|
|
297
298
|
};
|
|
298
299
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
299
300
|
const { prefilledPublicData } = await getGenesisValues(
|
|
@@ -308,7 +309,7 @@ export class FullProverTest {
|
|
|
308
309
|
},
|
|
309
310
|
{ prefilledPublicData },
|
|
310
311
|
);
|
|
311
|
-
this.proverNode.start();
|
|
312
|
+
await this.proverNode.start();
|
|
312
313
|
|
|
313
314
|
this.logger.warn(`Proofs are now enabled`);
|
|
314
315
|
return this;
|
|
@@ -316,10 +317,10 @@ export class FullProverTest {
|
|
|
316
317
|
|
|
317
318
|
private async mintL1ERC20(recipient: Hex, amount: bigint) {
|
|
318
319
|
const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
|
|
319
|
-
const client = this.context.deployL1ContractsValues.
|
|
320
|
+
const client = this.context.deployL1ContractsValues.l1Client;
|
|
320
321
|
const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
|
|
321
322
|
const hash = await erc20.write.mint([recipient, amount]);
|
|
322
|
-
await this.context.deployL1ContractsValues.
|
|
323
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
|
|
323
324
|
}
|
|
324
325
|
|
|
325
326
|
snapshot = <T>(
|
|
@@ -399,19 +400,14 @@ export class FullProverTest {
|
|
|
399
400
|
throw new Error('No verifier');
|
|
400
401
|
}
|
|
401
402
|
|
|
402
|
-
const {
|
|
403
|
+
const { l1Client, l1ContractAddresses } = this.context.deployL1ContractsValues;
|
|
403
404
|
const rollup = getContract({
|
|
404
405
|
abi: RollupAbi,
|
|
405
406
|
address: l1ContractAddresses.rollupAddress.toString(),
|
|
406
|
-
client:
|
|
407
|
+
client: l1Client,
|
|
407
408
|
});
|
|
408
409
|
|
|
409
|
-
const { address: verifierAddress } = await deployL1Contract(
|
|
410
|
-
walletClient,
|
|
411
|
-
publicClient,
|
|
412
|
-
HonkVerifierAbi,
|
|
413
|
-
HonkVerifierBytecode,
|
|
414
|
-
);
|
|
410
|
+
const { address: verifierAddress } = await deployL1Contract(l1Client, HonkVerifierAbi, HonkVerifierBytecode);
|
|
415
411
|
this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
|
|
416
412
|
|
|
417
413
|
await rollup.write.setEpochVerifier([verifierAddress.toString()]);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type L1ContractAddresses,
|
|
3
|
-
RollupContract,
|
|
4
|
-
type ViemPublicClient,
|
|
5
|
-
type ViemWalletClient,
|
|
6
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
|
|
7
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
8
3
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
9
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -14,23 +9,19 @@ import { decodeEventLog, getContract } from 'viem';
|
|
|
14
9
|
export async function sendL1ToL2Message(
|
|
15
10
|
message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
|
|
16
11
|
ctx: {
|
|
17
|
-
|
|
18
|
-
publicClient: ViemPublicClient;
|
|
12
|
+
l1Client: ExtendedViemWalletClient;
|
|
19
13
|
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
20
14
|
},
|
|
21
15
|
) {
|
|
22
16
|
const inbox = getContract({
|
|
23
17
|
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
24
18
|
abi: InboxAbi,
|
|
25
|
-
client: ctx.
|
|
19
|
+
client: ctx.l1Client,
|
|
26
20
|
});
|
|
27
21
|
|
|
28
22
|
const { recipient, content, secretHash } = message;
|
|
29
23
|
|
|
30
|
-
const version = await new RollupContract(
|
|
31
|
-
ctx.publicClient,
|
|
32
|
-
ctx.l1ContractAddresses.rollupAddress.toString(),
|
|
33
|
-
).getVersion();
|
|
24
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
34
25
|
|
|
35
26
|
// We inject the message to Inbox
|
|
36
27
|
const txHash = await inbox.write.sendL2Message([
|
|
@@ -40,7 +31,7 @@ export async function sendL1ToL2Message(
|
|
|
40
31
|
]);
|
|
41
32
|
|
|
42
33
|
// We check that the message was correctly injected by checking the emitted event
|
|
43
|
-
const txReceipt = await ctx.
|
|
34
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
|
|
44
35
|
|
|
45
36
|
// Exactly 1 event should be emitted in the transaction
|
|
46
37
|
expect(txReceipt.logs.length).toBe(1);
|
|
@@ -12,8 +12,7 @@ export const setupL1Contracts = async (
|
|
|
12
12
|
l1RpcUrl: string,
|
|
13
13
|
account: HDAccount | PrivateKeyAccount,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | '
|
|
16
|
-
L1ContractsConfig,
|
|
15
|
+
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'initialValidators'> & L1ContractsConfig,
|
|
17
16
|
) => {
|
|
18
17
|
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
18
|
vkTreeRoot: getVKTreeRoot(),
|
|
@@ -20,7 +20,7 @@ import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/serv
|
|
|
20
20
|
import {
|
|
21
21
|
type DeployL1ContractsArgs,
|
|
22
22
|
type DeployL1ContractsReturnType,
|
|
23
|
-
|
|
23
|
+
createExtendedL1Client,
|
|
24
24
|
getL1ContractsConfigEnvVars,
|
|
25
25
|
l1Artifacts,
|
|
26
26
|
} from '@aztec/ethereum';
|
|
@@ -348,7 +348,7 @@ async function setupFromFresh(
|
|
|
348
348
|
|
|
349
349
|
const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
|
|
350
350
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
351
|
-
const { genesisArchiveRoot,
|
|
351
|
+
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
|
|
352
352
|
initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
353
353
|
opts.initialAccountFeeJuice,
|
|
354
354
|
);
|
|
@@ -356,7 +356,6 @@ async function setupFromFresh(
|
|
|
356
356
|
const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
|
|
357
357
|
...getL1ContractsConfigEnvVars(),
|
|
358
358
|
genesisArchiveRoot,
|
|
359
|
-
genesisBlockHash,
|
|
360
359
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
361
360
|
salt: opts.salt,
|
|
362
361
|
...deployL1ContractsArgs,
|
|
@@ -371,7 +370,7 @@ async function setupFromFresh(
|
|
|
371
370
|
const rewardDistributor = getContract({
|
|
372
371
|
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
373
372
|
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
374
|
-
client: deployL1ContractsValues.
|
|
373
|
+
client: deployL1ContractsValues.l1Client,
|
|
375
374
|
});
|
|
376
375
|
|
|
377
376
|
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
@@ -380,18 +379,18 @@ async function setupFromFresh(
|
|
|
380
379
|
const feeJuice = getContract({
|
|
381
380
|
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
382
381
|
abi: l1Artifacts.feeAsset.contractAbi,
|
|
383
|
-
client: deployL1ContractsValues.
|
|
382
|
+
client: deployL1ContractsValues.l1Client,
|
|
384
383
|
});
|
|
385
384
|
|
|
386
385
|
const rewardDistributorMintTxHash = await feeJuice.write.mint([rewardDistributor.address, mintAmount], {} as any);
|
|
387
|
-
await deployL1ContractsValues.
|
|
386
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
|
|
388
387
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
const watcher = new AnvilTestWatcher(
|
|
392
391
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
393
392
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
394
|
-
deployL1ContractsValues.
|
|
393
|
+
deployL1ContractsValues.l1Client,
|
|
395
394
|
);
|
|
396
395
|
await watcher.start();
|
|
397
396
|
|
|
@@ -437,8 +436,8 @@ async function setupFromFresh(
|
|
|
437
436
|
proverNode = await createAndSyncProverNode(
|
|
438
437
|
`0x${proverNodePrivateKey!.toString('hex')}`,
|
|
439
438
|
aztecNodeConfig,
|
|
439
|
+
{ dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
|
|
440
440
|
aztecNode,
|
|
441
|
-
path.join(directoryToCleanup, randomBytes(8).toString('hex')),
|
|
442
441
|
prefilledPublicData,
|
|
443
442
|
);
|
|
444
443
|
}
|
|
@@ -522,12 +521,12 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
522
521
|
}
|
|
523
522
|
|
|
524
523
|
logger.verbose('Creating ETH clients...');
|
|
525
|
-
const
|
|
524
|
+
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
526
525
|
|
|
527
526
|
const watcher = new AnvilTestWatcher(
|
|
528
527
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
529
528
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
530
|
-
|
|
529
|
+
l1Client,
|
|
531
530
|
);
|
|
532
531
|
await watcher.start();
|
|
533
532
|
|
|
@@ -561,8 +560,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
561
560
|
proverNode = await createAndSyncProverNode(
|
|
562
561
|
proverNodePrivateKeyHex,
|
|
563
562
|
aztecNodeConfig,
|
|
563
|
+
{ dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')) },
|
|
564
564
|
aztecNode,
|
|
565
|
-
path.join(directoryToCleanup, randomBytes(8).toString('hex')),
|
|
566
565
|
prefilledPublicData,
|
|
567
566
|
);
|
|
568
567
|
}
|
|
@@ -583,8 +582,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
583
582
|
bbConfig,
|
|
584
583
|
proverNode,
|
|
585
584
|
deployL1ContractsValues: {
|
|
586
|
-
|
|
587
|
-
publicClient,
|
|
585
|
+
l1Client,
|
|
588
586
|
l1ContractAddresses: aztecNodeConfig.l1Contracts,
|
|
589
587
|
},
|
|
590
588
|
watcher,
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -29,14 +29,14 @@ import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee/testing';
|
|
|
29
29
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
30
30
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
31
31
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
32
|
-
import { GENESIS_ARCHIVE_ROOT,
|
|
32
|
+
import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
33
33
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
34
34
|
import {
|
|
35
35
|
type DeployL1ContractsArgs,
|
|
36
36
|
type DeployL1ContractsReturnType,
|
|
37
37
|
ForwarderContract,
|
|
38
38
|
NULL_KEY,
|
|
39
|
-
|
|
39
|
+
createExtendedL1Client,
|
|
40
40
|
deployL1Contracts,
|
|
41
41
|
getL1ContractsConfigEnvVars,
|
|
42
42
|
isAnvilTestChain,
|
|
@@ -48,6 +48,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
48
48
|
import { Fr } from '@aztec/foundation/fields';
|
|
49
49
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
50
50
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
51
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
51
52
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
52
53
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
53
54
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
@@ -125,7 +126,6 @@ export const setupL1Contracts = async (
|
|
|
125
126
|
vkTreeRoot: getVKTreeRoot(),
|
|
126
127
|
protocolContractTreeRoot,
|
|
127
128
|
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
128
|
-
genesisBlockHash: args.genesisBlockHash ?? new Fr(GENESIS_BLOCK_HASH),
|
|
129
129
|
salt: args.salt,
|
|
130
130
|
initialValidators: args.initialValidators,
|
|
131
131
|
...getL1ContractsConfigEnvVars(),
|
|
@@ -224,12 +224,11 @@ async function setupWithRemoteEnvironment(
|
|
|
224
224
|
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
225
225
|
const l1Contracts = (await pxeClient.getNodeInfo()).l1ContractAddresses;
|
|
226
226
|
|
|
227
|
-
const
|
|
227
|
+
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
228
228
|
|
|
229
229
|
const deployL1ContractsValues: DeployL1ContractsReturnType = {
|
|
230
230
|
l1ContractAddresses: l1Contracts,
|
|
231
|
-
|
|
232
|
-
publicClient,
|
|
231
|
+
l1Client,
|
|
233
232
|
};
|
|
234
233
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!);
|
|
235
234
|
const teardown = () => Promise.resolve();
|
|
@@ -296,6 +295,8 @@ export type SetupOptions = {
|
|
|
296
295
|
telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
|
|
297
296
|
/** Public data that will be inserted in the tree in genesis */
|
|
298
297
|
genesisPublicData?: PublicDataTreeLeaf[];
|
|
298
|
+
/** Specific config for the prover node, if set. */
|
|
299
|
+
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
299
300
|
} & Partial<AztecNodeConfig>;
|
|
300
301
|
|
|
301
302
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -425,7 +426,7 @@ export async function setup(
|
|
|
425
426
|
const initialFundedAccounts =
|
|
426
427
|
opts.initialFundedAccounts ??
|
|
427
428
|
(await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts));
|
|
428
|
-
const {
|
|
429
|
+
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
|
|
429
430
|
initialFundedAccounts.map(a => a.address),
|
|
430
431
|
opts.initialAccountFeeJuice,
|
|
431
432
|
opts.genesisPublicData,
|
|
@@ -437,7 +438,7 @@ export async function setup(
|
|
|
437
438
|
config.l1RpcUrls,
|
|
438
439
|
publisherHdAccount!,
|
|
439
440
|
logger,
|
|
440
|
-
{ ...opts, genesisArchiveRoot,
|
|
441
|
+
{ ...opts, genesisArchiveRoot, feeJuicePortalInitialBalance: fundingNeeded },
|
|
441
442
|
chain,
|
|
442
443
|
));
|
|
443
444
|
|
|
@@ -449,7 +450,7 @@ export async function setup(
|
|
|
449
450
|
const rewardDistributor = getContract({
|
|
450
451
|
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
451
452
|
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
452
|
-
client: deployL1ContractsValues.
|
|
453
|
+
client: deployL1ContractsValues.l1Client,
|
|
453
454
|
});
|
|
454
455
|
|
|
455
456
|
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
@@ -458,11 +459,11 @@ export async function setup(
|
|
|
458
459
|
const feeJuice = getContract({
|
|
459
460
|
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
460
461
|
abi: l1Artifacts.feeAsset.contractAbi,
|
|
461
|
-
client: deployL1ContractsValues.
|
|
462
|
+
client: deployL1ContractsValues.l1Client,
|
|
462
463
|
});
|
|
463
464
|
|
|
464
465
|
const rewardDistributorMintTxHash = await feeJuice.write.mint([rewardDistributor.address, mintAmount], {} as any);
|
|
465
|
-
await deployL1ContractsValues.
|
|
466
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
|
|
466
467
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
467
468
|
}
|
|
468
469
|
|
|
@@ -477,7 +478,7 @@ export async function setup(
|
|
|
477
478
|
const watcher = new AnvilTestWatcher(
|
|
478
479
|
new EthCheatCodesWithState(config.l1RpcUrls),
|
|
479
480
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
480
|
-
deployL1ContractsValues.
|
|
481
|
+
deployL1ContractsValues.l1Client,
|
|
481
482
|
dateProvider,
|
|
482
483
|
);
|
|
483
484
|
|
|
@@ -516,7 +517,7 @@ export async function setup(
|
|
|
516
517
|
}
|
|
517
518
|
config.l1PublishRetryIntervalMS = 100;
|
|
518
519
|
|
|
519
|
-
const blobSinkClient = createBlobSinkClient(config);
|
|
520
|
+
const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
|
|
520
521
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
521
522
|
config,
|
|
522
523
|
{ dateProvider, blobSinkClient, telemetry },
|
|
@@ -534,12 +535,9 @@ export async function setup(
|
|
|
534
535
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
535
536
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
536
537
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
aztecNode,
|
|
541
|
-
path.join(directoryToCleanup, randomBytes(8).toString('hex')),
|
|
542
|
-
);
|
|
538
|
+
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
539
|
+
const proverNodeConfig = { ...config.proverNodeConfig, dataDirectory: proverNodeDataDirectory };
|
|
540
|
+
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNode);
|
|
543
541
|
}
|
|
544
542
|
|
|
545
543
|
logger.verbose('Creating a pxe...');
|
|
@@ -779,62 +777,60 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: number,
|
|
|
779
777
|
export async function createAndSyncProverNode(
|
|
780
778
|
proverNodePrivateKey: `0x${string}`,
|
|
781
779
|
aztecNodeConfig: AztecNodeConfig,
|
|
780
|
+
proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
|
|
782
781
|
aztecNode: AztecNode,
|
|
783
|
-
dataDirectory: string,
|
|
784
782
|
prefilledPublicData: PublicDataTreeLeaf[] = [],
|
|
785
783
|
) {
|
|
786
784
|
// Disable stopping the aztec node as the prover coordination test will kill it otherwise
|
|
787
785
|
// This is only required when stopping the prover node for testing
|
|
788
|
-
const
|
|
786
|
+
const aztecNodeTxProvider = {
|
|
789
787
|
getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
|
|
790
788
|
getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
|
|
791
789
|
stop: () => Promise.resolve(),
|
|
792
790
|
};
|
|
793
791
|
|
|
794
|
-
const blobSinkClient = createBlobSinkClient(aztecNodeConfig
|
|
795
|
-
|
|
796
|
-
const archiverConfig = { ...aztecNodeConfig, dataDirectory };
|
|
797
|
-
const archiver = await createArchiver(archiverConfig, blobSinkClient, {
|
|
798
|
-
blockUntilSync: true,
|
|
792
|
+
const blobSinkClient = createBlobSinkClient(aztecNodeConfig, {
|
|
793
|
+
logger: createLogger('prover-node:blob-sink:client'),
|
|
799
794
|
});
|
|
800
795
|
|
|
796
|
+
// Creating temp store and archiver for simulated prover node
|
|
797
|
+
const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
|
|
798
|
+
const archiver = await createArchiver(archiverConfig, blobSinkClient, { blockUntilSync: true });
|
|
799
|
+
|
|
801
800
|
// Prover node config is for simulated proofs
|
|
802
801
|
const proverConfig: ProverNodeConfig = {
|
|
803
802
|
...aztecNodeConfig,
|
|
804
|
-
|
|
805
|
-
dataDirectory: undefined,
|
|
803
|
+
proverCoordinationNodeUrls: [],
|
|
806
804
|
realProofs: false,
|
|
807
805
|
proverAgentCount: 2,
|
|
808
806
|
publisherPrivateKey: proverNodePrivateKey,
|
|
809
807
|
proverNodeMaxPendingJobs: 10,
|
|
810
808
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
811
809
|
proverNodePollingIntervalMs: 200,
|
|
812
|
-
txGatheringTimeoutMs: 60000,
|
|
813
810
|
txGatheringIntervalMs: 1000,
|
|
814
|
-
|
|
811
|
+
txGatheringBatchSize: 10,
|
|
812
|
+
txGatheringMaxParallelRequestsPerNode: 10,
|
|
813
|
+
proverNodeFailedEpochStore: undefined,
|
|
814
|
+
...proverNodeConfig,
|
|
815
815
|
};
|
|
816
816
|
|
|
817
817
|
const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node');
|
|
818
818
|
|
|
819
819
|
const proverNode = await createProverNode(
|
|
820
820
|
proverConfig,
|
|
821
|
-
{
|
|
822
|
-
aztecNodeTxProvider: aztecNodeWithoutStop,
|
|
823
|
-
archiver: archiver as Archiver,
|
|
824
|
-
l1TxUtils,
|
|
825
|
-
},
|
|
821
|
+
{ aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
826
822
|
{ prefilledPublicData },
|
|
827
823
|
);
|
|
828
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.
|
|
829
|
-
proverNode.start();
|
|
824
|
+
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
825
|
+
await proverNode.start();
|
|
830
826
|
return proverNode;
|
|
831
827
|
}
|
|
832
828
|
|
|
833
829
|
function createDelayedL1TxUtils(aztecNodeConfig: AztecNodeConfig, privateKey: `0x${string}`, logName: string) {
|
|
834
|
-
const
|
|
830
|
+
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
835
831
|
|
|
836
832
|
const log = createLogger(logName);
|
|
837
|
-
const l1TxUtils = new DelayedTxUtils(
|
|
833
|
+
const l1TxUtils = new DelayedTxUtils(l1Client, log, aztecNodeConfig);
|
|
838
834
|
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
839
835
|
return l1TxUtils;
|
|
840
836
|
}
|
|
@@ -844,11 +840,10 @@ export async function createForwarderContract(
|
|
|
844
840
|
privateKey: `0x${string}`,
|
|
845
841
|
rollupAddress: Hex,
|
|
846
842
|
) {
|
|
847
|
-
const
|
|
843
|
+
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
848
844
|
const forwarderContract = await ForwarderContract.create(
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
publicClient,
|
|
845
|
+
l1Client.account.address,
|
|
846
|
+
l1Client,
|
|
852
847
|
createLogger('forwarder'),
|
|
853
848
|
rollupAddress,
|
|
854
849
|
);
|