@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +10 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +58 -33
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +5 -27
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -6
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
- 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 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +11 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +17 -14
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +2 -2
- package/dest/e2e_fees/fees_test.d.ts +8 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +16 -10
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -4
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts +219 -13
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +15 -11
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +2 -2
- package/dest/fixtures/e2e_prover_test.d.ts +5 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +23 -22
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -10
- package/dest/fixtures/snapshot_manager.d.ts +6 -8
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +34 -46
- package/dest/fixtures/token_utils.d.ts +5 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/fixtures/utils.d.ts +21 -19
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +56 -85
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +5 -14
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts +2 -12
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/index.d.ts +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +4 -3
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +15 -13
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +2 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +5 -3
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +5 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +45 -10
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +55 -20
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +203 -60
- package/package.json +42 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +82 -34
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +11 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +17 -12
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +37 -23
- package/src/e2e_fees/bridging_race.notest.ts +2 -2
- package/src/e2e_fees/fees_test.ts +22 -13
- package/src/e2e_l1_publisher/write_json.ts +5 -4
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -4
- package/src/e2e_p2p/p2p_network.ts +16 -19
- package/src/e2e_p2p/shared.ts +13 -6
- package/src/e2e_token_contract/token_contract_test.ts +2 -2
- package/src/fixtures/e2e_prover_test.ts +22 -25
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +23 -9
- package/src/fixtures/snapshot_manager.ts +51 -65
- package/src/fixtures/token_utils.ts +4 -4
- package/src/fixtures/utils.ts +91 -131
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +1 -1
- package/src/shared/cross_chain_test_harness.ts +5 -2
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/uniswap_l1_l2.ts +19 -21
- package/src/simulators/lending_simulator.ts +6 -4
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +49 -12
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +267 -51
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/src/fixtures/setup_l1_contracts.ts +0 -26
|
@@ -5,11 +5,14 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
6
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
7
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import {
|
|
8
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
9
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
|
+
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
11
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
9
12
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
10
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
13
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
13
16
|
import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
14
17
|
import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
|
|
15
18
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
@@ -20,6 +23,7 @@ import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contract
|
|
|
20
23
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
21
24
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
22
25
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
26
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
23
27
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
24
28
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
25
29
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
@@ -69,15 +73,21 @@ export class ClientFlowsBenchmark {
|
|
|
69
73
|
public feeJuiceContract!: FeeJuiceContract;
|
|
70
74
|
// Asset in which fees are paid via FPC
|
|
71
75
|
public bananaCoin!: BananaCoin;
|
|
76
|
+
public bananaCoinInstance!: ContractInstanceWithAddress;
|
|
72
77
|
public bananaFPC!: FPCContract;
|
|
78
|
+
public bananaFPCInstance!: ContractInstanceWithAddress;
|
|
73
79
|
// Random asset we want to trade
|
|
74
80
|
public candyBarCoin!: TokenContract;
|
|
81
|
+
public candyBarCoinInstance!: ContractInstanceWithAddress;
|
|
75
82
|
// AMM contract
|
|
76
83
|
public amm!: AMMContract;
|
|
84
|
+
public ammInstance!: ContractInstanceWithAddress;
|
|
77
85
|
// Liquidity token for AMM
|
|
78
86
|
public liquidityToken!: TokenContract;
|
|
87
|
+
public liquidityTokenInstance!: ContractInstanceWithAddress;
|
|
79
88
|
// Sponsored FPC contract
|
|
80
89
|
public sponsoredFPC!: SponsoredFPCContract;
|
|
90
|
+
public sponsoredFPCInstance!: ContractInstanceWithAddress;
|
|
81
91
|
|
|
82
92
|
// PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
|
|
83
93
|
public userWallet!: TestWallet;
|
|
@@ -116,7 +126,7 @@ export class ClientFlowsBenchmark {
|
|
|
116
126
|
|
|
117
127
|
private proxyLogger: ProxyLogger;
|
|
118
128
|
|
|
119
|
-
constructor(testName?: string, setupOptions: Partial<SetupOptions &
|
|
129
|
+
constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
|
|
120
130
|
this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
|
|
121
131
|
this.snapshotManager = createSnapshotManager(
|
|
122
132
|
`bench_client_flows${testName ? `/${testName}` : ''}`,
|
|
@@ -204,7 +214,7 @@ export class ClientFlowsBenchmark {
|
|
|
204
214
|
this.sequencerAddress = sequencerAddress;
|
|
205
215
|
|
|
206
216
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
207
|
-
this.feeJuiceContract =
|
|
217
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
|
|
208
218
|
this.coinbase = EthAddress.random();
|
|
209
219
|
|
|
210
220
|
const userPXEConfig = getPXEConfig();
|
|
@@ -229,7 +239,7 @@ export class ClientFlowsBenchmark {
|
|
|
229
239
|
async (_data, context) => {
|
|
230
240
|
this.context = context;
|
|
231
241
|
|
|
232
|
-
this.feeJuiceContract =
|
|
242
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
|
|
233
243
|
|
|
234
244
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
235
245
|
aztecNode: context.aztecNode,
|
|
@@ -246,14 +256,22 @@ export class ClientFlowsBenchmark {
|
|
|
246
256
|
await this.snapshotManager.snapshot(
|
|
247
257
|
'deploy_banana_token',
|
|
248
258
|
async () => {
|
|
249
|
-
const bananaCoin = await BananaCoin.deploy(
|
|
259
|
+
const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
|
|
260
|
+
this.adminWallet,
|
|
261
|
+
this.adminAddress,
|
|
262
|
+
'BC',
|
|
263
|
+
'BC',
|
|
264
|
+
18n,
|
|
265
|
+
)
|
|
250
266
|
.send({ from: this.adminAddress })
|
|
251
|
-
.
|
|
267
|
+
.wait();
|
|
252
268
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
253
|
-
return { bananaCoinAddress: bananaCoin.address };
|
|
269
|
+
return { bananaCoinAddress: bananaCoin.address, bananaCoinInstance };
|
|
254
270
|
},
|
|
255
|
-
|
|
256
|
-
this.bananaCoin =
|
|
271
|
+
({ bananaCoinAddress, bananaCoinInstance }) => {
|
|
272
|
+
this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.adminWallet);
|
|
273
|
+
this.bananaCoinInstance = bananaCoinInstance;
|
|
274
|
+
return Promise.resolve();
|
|
257
275
|
},
|
|
258
276
|
);
|
|
259
277
|
}
|
|
@@ -262,14 +280,22 @@ export class ClientFlowsBenchmark {
|
|
|
262
280
|
await this.snapshotManager.snapshot(
|
|
263
281
|
'deploy_candy_bar_token',
|
|
264
282
|
async () => {
|
|
265
|
-
const candyBarCoin = await TokenContract.deploy(
|
|
283
|
+
const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
|
|
284
|
+
this.adminWallet,
|
|
285
|
+
this.adminAddress,
|
|
286
|
+
'CBC',
|
|
287
|
+
'CBC',
|
|
288
|
+
18n,
|
|
289
|
+
)
|
|
266
290
|
.send({ from: this.adminAddress })
|
|
267
|
-
.
|
|
291
|
+
.wait();
|
|
268
292
|
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
269
|
-
return { candyBarCoinAddress: candyBarCoin.address };
|
|
293
|
+
return { candyBarCoinAddress: candyBarCoin.address, candyBarCoinInstance };
|
|
270
294
|
},
|
|
271
|
-
|
|
272
|
-
this.candyBarCoin =
|
|
295
|
+
({ candyBarCoinAddress, candyBarCoinInstance }) => {
|
|
296
|
+
this.candyBarCoin = TokenContract.at(candyBarCoinAddress, this.adminWallet);
|
|
297
|
+
this.candyBarCoinInstance = candyBarCoinInstance;
|
|
298
|
+
return Promise.resolve();
|
|
273
299
|
},
|
|
274
300
|
);
|
|
275
301
|
}
|
|
@@ -282,18 +308,24 @@ export class ClientFlowsBenchmark {
|
|
|
282
308
|
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
283
309
|
|
|
284
310
|
const bananaCoin = this.bananaCoin;
|
|
285
|
-
const bananaFPC = await FPCContract.deploy(
|
|
311
|
+
const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
|
|
312
|
+
this.adminWallet,
|
|
313
|
+
bananaCoin.address,
|
|
314
|
+
this.adminAddress,
|
|
315
|
+
)
|
|
286
316
|
.send({ from: this.adminAddress })
|
|
287
|
-
.
|
|
317
|
+
.wait();
|
|
288
318
|
|
|
289
319
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
290
320
|
|
|
291
321
|
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
|
|
292
322
|
|
|
293
|
-
return { bananaFPCAddress: bananaFPC.address };
|
|
323
|
+
return { bananaFPCAddress: bananaFPC.address, bananaFPCInstance };
|
|
294
324
|
},
|
|
295
|
-
|
|
296
|
-
this.bananaFPC =
|
|
325
|
+
data => {
|
|
326
|
+
this.bananaFPC = FPCContract.at(data.bananaFPCAddress, this.adminWallet);
|
|
327
|
+
this.bananaFPCInstance = data.bananaFPCInstance;
|
|
328
|
+
return Promise.resolve();
|
|
297
329
|
},
|
|
298
330
|
);
|
|
299
331
|
}
|
|
@@ -302,12 +334,14 @@ export class ClientFlowsBenchmark {
|
|
|
302
334
|
await this.snapshotManager.snapshot(
|
|
303
335
|
'deploy_sponsored_fpc',
|
|
304
336
|
async () => {
|
|
305
|
-
const
|
|
306
|
-
this.logger.info(`SponsoredFPC at ${
|
|
307
|
-
return { sponsoredFPCAddress:
|
|
337
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
|
|
338
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
339
|
+
return { sponsoredFPCAddress: sponsoredFPCInstance.address, sponsoredFPCInstance };
|
|
308
340
|
},
|
|
309
|
-
|
|
310
|
-
this.sponsoredFPC =
|
|
341
|
+
({ sponsoredFPCAddress, sponsoredFPCInstance }) => {
|
|
342
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
|
|
343
|
+
this.sponsoredFPCInstance = sponsoredFPCInstance;
|
|
344
|
+
return Promise.resolve();
|
|
311
345
|
},
|
|
312
346
|
);
|
|
313
347
|
}
|
|
@@ -361,24 +395,38 @@ export class ClientFlowsBenchmark {
|
|
|
361
395
|
await this.snapshotManager.snapshot(
|
|
362
396
|
'deploy_amm',
|
|
363
397
|
async () => {
|
|
364
|
-
const liquidityToken = await TokenContract.deploy(
|
|
398
|
+
const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
|
|
399
|
+
this.adminWallet,
|
|
400
|
+
this.adminAddress,
|
|
401
|
+
'LPT',
|
|
402
|
+
'LPT',
|
|
403
|
+
18n,
|
|
404
|
+
)
|
|
365
405
|
.send({ from: this.adminAddress })
|
|
366
|
-
.
|
|
367
|
-
const amm = await AMMContract.deploy(
|
|
406
|
+
.wait();
|
|
407
|
+
const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
|
|
368
408
|
this.adminWallet,
|
|
369
409
|
this.bananaCoin.address,
|
|
370
410
|
this.candyBarCoin.address,
|
|
371
411
|
liquidityToken.address,
|
|
372
412
|
)
|
|
373
413
|
.send({ from: this.adminAddress })
|
|
374
|
-
.
|
|
414
|
+
.wait();
|
|
375
415
|
this.logger.info(`AMM deployed at ${amm.address}`);
|
|
376
416
|
await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
|
|
377
|
-
return {
|
|
417
|
+
return {
|
|
418
|
+
ammAddress: amm.address,
|
|
419
|
+
ammInstance,
|
|
420
|
+
liquidityTokenAddress: liquidityToken.address,
|
|
421
|
+
liquidityTokenInstance,
|
|
422
|
+
};
|
|
378
423
|
},
|
|
379
|
-
|
|
380
|
-
this.liquidityToken =
|
|
381
|
-
this.
|
|
424
|
+
({ ammAddress, ammInstance, liquidityTokenAddress, liquidityTokenInstance }) => {
|
|
425
|
+
this.liquidityToken = TokenContract.at(liquidityTokenAddress, this.adminWallet);
|
|
426
|
+
this.liquidityTokenInstance = liquidityTokenInstance;
|
|
427
|
+
this.amm = AMMContract.at(ammAddress, this.adminWallet);
|
|
428
|
+
this.ammInstance = ammInstance;
|
|
429
|
+
return Promise.resolve();
|
|
382
430
|
},
|
|
383
431
|
);
|
|
384
432
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
|
|
3
|
-
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
1
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
4
2
|
import { createLogger, logger } from '@aztec/foundation/log';
|
|
5
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
6
4
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
@@ -11,26 +9,7 @@ import { Decoder } from 'msgpackr';
|
|
|
11
9
|
import { readFile, readdir, writeFile } from 'node:fs/promises';
|
|
12
10
|
import { join } from 'node:path';
|
|
13
11
|
|
|
14
|
-
import { type Log,
|
|
15
|
-
|
|
16
|
-
type NativeProverConfig = { bbBinaryPath?: string; bbWorkingDirectory?: string };
|
|
17
|
-
|
|
18
|
-
async function createProver(config: NativeProverConfig = {}, log: Logger) {
|
|
19
|
-
const simulator = new WASMSimulator();
|
|
20
|
-
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
21
|
-
return { prover: new BBWASMBundlePrivateKernelProver(simulator, 16, log), type: 'wasm' as ProverType };
|
|
22
|
-
} else {
|
|
23
|
-
const bbConfig = config as Required<NativeProverConfig>;
|
|
24
|
-
return {
|
|
25
|
-
prover: await BBNativePrivateKernelProver.new(
|
|
26
|
-
{ bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
|
|
27
|
-
simulator,
|
|
28
|
-
log,
|
|
29
|
-
),
|
|
30
|
-
type: 'native' as ProverType,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
12
|
+
import { type Log, ProxyLogger, generateBenchmark } from './benchmark.js';
|
|
34
13
|
|
|
35
14
|
async function main() {
|
|
36
15
|
ProxyLogger.create();
|
|
@@ -41,10 +20,9 @@ async function main() {
|
|
|
41
20
|
}
|
|
42
21
|
const flows = await readdir(ivcFolder);
|
|
43
22
|
logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
23
|
+
const simulator = new WASMSimulator();
|
|
24
|
+
const log = proxyLogger.createLogger('bb:prover');
|
|
25
|
+
const prover = new BBBundlePrivateKernelProver(simulator, log);
|
|
48
26
|
|
|
49
27
|
const userLog = createLogger('chonk_flows:data_processor');
|
|
50
28
|
|
|
@@ -96,7 +74,7 @@ async function main() {
|
|
|
96
74
|
if (!(profile.stats.timings as ProvingTimings).proving) {
|
|
97
75
|
(profile.stats.timings as ProvingTimings).proving = provingTime;
|
|
98
76
|
}
|
|
99
|
-
const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps,
|
|
77
|
+
const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, 'native', error);
|
|
100
78
|
await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
|
|
101
79
|
proxyLogger.flushLogs();
|
|
102
80
|
}
|
package/src/bench/utils.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
3
|
import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { mean, stdDev, times } from '@aztec/foundation/collection';
|
|
4
5
|
import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
|
|
@@ -103,19 +104,22 @@ function getMetricValues(points: BenchmarkDataPoint[]) {
|
|
|
103
104
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
104
105
|
* @returns A BatchCall instance.
|
|
105
106
|
*/
|
|
106
|
-
function makeCall(
|
|
107
|
+
async function makeCall(
|
|
107
108
|
index: number,
|
|
108
109
|
context: EndToEndContext,
|
|
109
110
|
contract: BenchmarkingContract,
|
|
110
111
|
heavyPublicCompute: boolean,
|
|
111
112
|
) {
|
|
112
|
-
const [owner] = context.accounts;
|
|
113
113
|
if (heavyPublicCompute) {
|
|
114
114
|
return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
|
|
115
115
|
} else {
|
|
116
|
+
// We use random address for the new note owner because we can emit at most UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN
|
|
117
|
+
// logs for a given sender-recipient-contract tuple.
|
|
118
|
+
const ownerOfNewNote = await AztecAddress.random();
|
|
119
|
+
const [ownerOfBalance] = context.accounts;
|
|
116
120
|
return new BatchCall(context.wallet, [
|
|
117
|
-
contract.methods.create_note(
|
|
118
|
-
contract.methods.increment_balance(
|
|
121
|
+
contract.methods.create_note(ownerOfNewNote, index + 1),
|
|
122
|
+
contract.methods.increment_balance(ownerOfBalance, index + 1),
|
|
119
123
|
]);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
@@ -129,13 +133,13 @@ function makeCall(
|
|
|
129
133
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
130
134
|
* @returns Array of sent txs.
|
|
131
135
|
*/
|
|
132
|
-
export function sendTxs(
|
|
136
|
+
export async function sendTxs(
|
|
133
137
|
txCount: number,
|
|
134
138
|
context: EndToEndContext,
|
|
135
139
|
contract: BenchmarkingContract,
|
|
136
140
|
heavyPublicCompute: boolean = false,
|
|
137
|
-
): SentTx[] {
|
|
138
|
-
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
141
|
+
): Promise<SentTx[]> {
|
|
142
|
+
const calls = await Promise.all(times(txCount, index => makeCall(index, context, contract, heavyPublicCompute)));
|
|
139
143
|
context.logger.info(`Creating ${txCount} txs`);
|
|
140
144
|
const [from] = context.accounts;
|
|
141
145
|
context.logger.info(`Sending ${txCount} txs`);
|
|
@@ -130,7 +130,7 @@ export class BlacklistTokenContractTest {
|
|
|
130
130
|
},
|
|
131
131
|
async ({ tokenContractAddress, badAccountAddress }) => {
|
|
132
132
|
// Restore the token contract state.
|
|
133
|
-
this.asset =
|
|
133
|
+
this.asset = TokenBlacklistContract.at(tokenContractAddress, this.wallet);
|
|
134
134
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
135
135
|
|
|
136
136
|
this.tokenSim = new TokenSimulator(
|
|
@@ -141,7 +141,7 @@ export class BlacklistTokenContractTest {
|
|
|
141
141
|
[this.adminAddress, this.otherAddress, this.blacklistedAddress],
|
|
142
142
|
);
|
|
143
143
|
|
|
144
|
-
this.badAccount =
|
|
144
|
+
this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
145
145
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
146
146
|
|
|
147
147
|
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
@@ -3,13 +3,13 @@ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
4
4
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
5
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '@aztec/ethereum';
|
|
6
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
7
|
+
import type {
|
|
8
|
+
DeployAztecL1ContractsArgs,
|
|
9
|
+
DeployAztecL1ContractsReturnType,
|
|
10
|
+
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
11
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
12
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
13
13
|
import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
14
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
15
15
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
@@ -54,9 +54,13 @@ export class CrossChainMessagingTest {
|
|
|
54
54
|
outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
|
|
55
55
|
cheatCodes!: CheatCodes;
|
|
56
56
|
|
|
57
|
-
deployL1ContractsValues!:
|
|
57
|
+
deployL1ContractsValues!: DeployAztecL1ContractsReturnType;
|
|
58
58
|
|
|
59
|
-
constructor(
|
|
59
|
+
constructor(
|
|
60
|
+
testName: string,
|
|
61
|
+
opts: SetupOptions = {},
|
|
62
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
63
|
+
) {
|
|
60
64
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
61
65
|
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
|
|
62
66
|
initialValidators: [],
|
|
@@ -134,9 +138,9 @@ export class CrossChainMessagingTest {
|
|
|
134
138
|
|
|
135
139
|
return this.crossChainTestHarness.toCrossChainContext();
|
|
136
140
|
},
|
|
137
|
-
|
|
138
|
-
this.l2Token =
|
|
139
|
-
this.l2Bridge =
|
|
141
|
+
crossChainContext => {
|
|
142
|
+
this.l2Token = TokenContract.at(crossChainContext.l2Token, this.wallet);
|
|
143
|
+
this.l2Bridge = TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
|
|
140
144
|
|
|
141
145
|
// There is an issue with the reviver so we are getting strings sometimes. Working around it here.
|
|
142
146
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
@@ -172,6 +176,7 @@ export class CrossChainMessagingTest {
|
|
|
172
176
|
this.l1Client = l1Client;
|
|
173
177
|
this.inbox = inbox;
|
|
174
178
|
this.outbox = outbox;
|
|
179
|
+
return Promise.resolve();
|
|
175
180
|
},
|
|
176
181
|
);
|
|
177
182
|
}
|
|
@@ -73,6 +73,6 @@ export class DeployTest {
|
|
|
73
73
|
export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
|
|
74
74
|
|
|
75
75
|
export type ContractArtifactClass<T extends ContractBase> = {
|
|
76
|
-
at(address: AztecAddress, wallet: Wallet):
|
|
76
|
+
at(address: AztecAddress, wallet: Wallet): T;
|
|
77
77
|
artifact: ContractArtifact;
|
|
78
78
|
};
|
|
@@ -6,11 +6,14 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
6
6
|
import { MerkleTreeId } from '@aztec/aztec.js/trees';
|
|
7
7
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
8
8
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
9
|
-
import {
|
|
9
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
10
11
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
11
12
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
13
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
14
|
+
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
12
15
|
import { SecretValue } from '@aztec/foundation/config';
|
|
13
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
16
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
17
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
15
18
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
19
|
import { sleep } from '@aztec/foundation/sleep';
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
SequencerState,
|
|
26
29
|
} from '@aztec/sequencer-client';
|
|
27
30
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
28
|
-
import {
|
|
31
|
+
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
29
32
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
30
33
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
31
34
|
|
|
@@ -94,12 +97,24 @@ export class EpochsTestContext {
|
|
|
94
97
|
const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
|
|
95
98
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
96
99
|
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
97
|
-
|
|
100
|
+
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
101
|
+
return {
|
|
102
|
+
l1PublishingTime,
|
|
103
|
+
ethereumSlotDuration,
|
|
104
|
+
aztecSlotDuration,
|
|
105
|
+
aztecEpochDuration,
|
|
106
|
+
aztecProofSubmissionEpochs,
|
|
107
|
+
};
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
public async setup(opts: EpochsTestOpts = {}) {
|
|
101
|
-
const {
|
|
102
|
-
|
|
111
|
+
const {
|
|
112
|
+
ethereumSlotDuration,
|
|
113
|
+
aztecSlotDuration,
|
|
114
|
+
aztecEpochDuration,
|
|
115
|
+
aztecProofSubmissionEpochs,
|
|
116
|
+
l1PublishingTime,
|
|
117
|
+
} = EpochsTestContext.getSlotDurations(opts);
|
|
103
118
|
|
|
104
119
|
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
105
120
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
@@ -111,8 +126,6 @@ export class EpochsTestContext {
|
|
|
111
126
|
checkIntervalMs: 50,
|
|
112
127
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
113
128
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
114
|
-
skipProtocolContracts: true,
|
|
115
|
-
salt: 1,
|
|
116
129
|
aztecEpochDuration,
|
|
117
130
|
aztecSlotDuration,
|
|
118
131
|
ethereumSlotDuration,
|
|
@@ -129,6 +142,7 @@ export class EpochsTestContext {
|
|
|
129
142
|
worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
|
|
130
143
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
131
144
|
slasherFlavor: 'none',
|
|
145
|
+
l1PublishingTime,
|
|
132
146
|
...opts,
|
|
133
147
|
});
|
|
134
148
|
|
|
@@ -279,7 +293,7 @@ export class EpochsTestContext {
|
|
|
279
293
|
|
|
280
294
|
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
|
|
281
295
|
public async waitUntilEpochStarts(epoch: number) {
|
|
282
|
-
const [start] = getTimestampRangeForEpoch(
|
|
296
|
+
const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
|
|
283
297
|
this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
|
|
284
298
|
await waitUntilL1Timestamp(
|
|
285
299
|
this.l1Client,
|
|
@@ -290,30 +304,30 @@ export class EpochsTestContext {
|
|
|
290
304
|
return start;
|
|
291
305
|
}
|
|
292
306
|
|
|
293
|
-
/** Waits until the given
|
|
294
|
-
public async
|
|
307
|
+
/** Waits until the given checkpoint number is mined. */
|
|
308
|
+
public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
295
309
|
await retryUntil(
|
|
296
|
-
() => Promise.resolve(target <= this.monitor.
|
|
297
|
-
`Wait until
|
|
310
|
+
() => Promise.resolve(target <= this.monitor.checkpointNumber),
|
|
311
|
+
`Wait until checkpoint ${target}`,
|
|
298
312
|
timeout,
|
|
299
313
|
0.1,
|
|
300
314
|
);
|
|
301
315
|
}
|
|
302
316
|
|
|
303
|
-
/** Waits until the given
|
|
304
|
-
public async
|
|
317
|
+
/** Waits until the given checkpoint number is marked as proven. */
|
|
318
|
+
public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
305
319
|
await retryUntil(
|
|
306
|
-
() => Promise.resolve(
|
|
307
|
-
`Wait proven
|
|
320
|
+
() => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
|
|
321
|
+
`Wait proven checkpoint ${target}`,
|
|
308
322
|
timeout,
|
|
309
323
|
0.1,
|
|
310
324
|
);
|
|
311
|
-
return this.monitor.
|
|
325
|
+
return this.monitor.provenCheckpointNumber;
|
|
312
326
|
}
|
|
313
327
|
|
|
314
328
|
/** Waits until the last slot of the proof submission window for a given epoch. */
|
|
315
329
|
public async waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint) {
|
|
316
|
-
const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
|
|
330
|
+
const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
|
|
317
331
|
const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
|
|
318
332
|
const date = new Date(Number(oneSlotBefore) * 1000);
|
|
319
333
|
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
@@ -323,7 +337,7 @@ export class EpochsTestContext {
|
|
|
323
337
|
}
|
|
324
338
|
|
|
325
339
|
/** Waits for the aztec node to sync to the target block number. */
|
|
326
|
-
public async waitForNodeToSync(blockNumber:
|
|
340
|
+
public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
|
|
327
341
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
328
342
|
let synched = false;
|
|
329
343
|
while (!synched) {
|
|
@@ -372,7 +386,7 @@ export class EpochsTestContext {
|
|
|
372
386
|
}
|
|
373
387
|
|
|
374
388
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
375
|
-
public async verifyHistoricBlock(blockNumber:
|
|
389
|
+
public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
|
|
376
390
|
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
377
391
|
// at a particular block, so we know whether that historic block is available or has been
|
|
378
392
|
// pruned. Note that `getBlock` would not work here, since it only hits the archiver.
|
|
@@ -390,11 +404,11 @@ export class EpochsTestContext {
|
|
|
390
404
|
const stateChanges: TrackedSequencerEvent[] = [];
|
|
391
405
|
const failEvents: TrackedSequencerEvent[] = [];
|
|
392
406
|
|
|
393
|
-
// Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
|
|
407
|
+
// Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
|
|
394
408
|
// due to lack of txs available.
|
|
395
409
|
const failEventsKeys: (keyof SequencerEvents)[] = [
|
|
396
410
|
'block-build-failed',
|
|
397
|
-
'
|
|
411
|
+
'checkpoint-publish-failed',
|
|
398
412
|
'proposer-rollup-check-failed',
|
|
399
413
|
];
|
|
400
414
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
-
import { Fq } from '@aztec/foundation/
|
|
4
|
+
import { Fq } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
@@ -60,7 +60,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
60
60
|
const origApprove = l1TokenManager.approve.bind(l1TokenManager);
|
|
61
61
|
l1TokenManager.approve = async (amount: bigint, address: Hex, addressName = '') => {
|
|
62
62
|
await origApprove(amount, address, addressName);
|
|
63
|
-
const sleepTime = (Number(t.chainMonitor.
|
|
63
|
+
const sleepTime = (Number(t.chainMonitor.checkpointTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
|
|
64
64
|
logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
|
|
65
65
|
await sleep(sleepTime);
|
|
66
66
|
};
|