@aztec/end-to-end 0.0.1-commit.9593d84 → 0.0.1-commit.96bb3f7
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 +3 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -4
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +5 -5
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +18 -11
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +14 -7
- 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 +36 -19
- 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 +14 -12
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- 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 +7 -4
- 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 +2 -5
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
- package/dest/e2e_p2p/p2p_network.d.ts +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +11 -9
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +4 -4
- package/dest/fixtures/e2e_prover_test.d.ts +3 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +6 -10
- 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.js +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/setup_p2p_test.js +3 -3
- 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 +27 -44
- package/dest/fixtures/utils.d.ts +17 -463
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +45 -77
- 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/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +5 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts +2 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +43 -23
- package/dest/simulators/lending_simulator.d.ts +2 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +2 -1
- 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 +45 -10
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +203 -60
- package/package.json +40 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +8 -5
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +22 -14
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +53 -31
- package/src/e2e_epochs/epochs_test.ts +34 -21
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +13 -9
- package/src/e2e_l1_publisher/write_json.ts +2 -5
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -7
- package/src/e2e_p2p/p2p_network.ts +10 -17
- package/src/e2e_p2p/shared.ts +11 -6
- package/src/fixtures/e2e_prover_test.ts +7 -10
- 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 +3 -3
- package/src/fixtures/snapshot_manager.ts +44 -63
- package/src/fixtures/utils.ts +74 -139
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/shared/cross_chain_test_harness.ts +6 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +53 -67
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +9 -2
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +267 -51
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization';
|
|
3
|
+
import { waitForProven } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
|
|
4
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
7
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
7
8
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '@aztec/
|
|
15
|
-
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
9
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
|
+
import type { DeployAztecL1ContractsReturnType } 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
|
+
import { extractEvent } from '@aztec/ethereum/utils';
|
|
14
|
+
import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
15
|
+
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
16
16
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
17
17
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
18
18
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
@@ -22,7 +22,7 @@ import type { TestWallet } from '@aztec/test-wallet/server';
|
|
|
22
22
|
import { jest } from '@jest/globals';
|
|
23
23
|
import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
|
|
24
24
|
|
|
25
|
-
import { ensureAccountContractsPublished } from '../fixtures/utils.js';
|
|
25
|
+
import { type EndToEndContext, ensureAccountContractsPublished } from '../fixtures/utils.js';
|
|
26
26
|
import { CrossChainTestHarness } from './cross_chain_test_harness.js';
|
|
27
27
|
|
|
28
28
|
// PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
|
|
@@ -34,28 +34,8 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
|
|
|
34
34
|
|
|
35
35
|
const TIMEOUT = 360_000;
|
|
36
36
|
|
|
37
|
-
/** Objects to be returned by the uniswap setup function */
|
|
38
|
-
export type UniswapSetupContext = {
|
|
39
|
-
/** Aztec Node instance */
|
|
40
|
-
aztecNode: AztecNode;
|
|
41
|
-
/** Logger instance named as the current test. */
|
|
42
|
-
logger: Logger;
|
|
43
|
-
/** The L1 wallet client, extended with public actions. */
|
|
44
|
-
l1Client: ExtendedViemWalletClient;
|
|
45
|
-
/** The wallet. */
|
|
46
|
-
wallet: TestWallet;
|
|
47
|
-
/** The owner address. */
|
|
48
|
-
ownerAddress: AztecAddress;
|
|
49
|
-
/** The sponsor wallet. */
|
|
50
|
-
sponsorAddress: AztecAddress;
|
|
51
|
-
/** */
|
|
52
|
-
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
53
|
-
/** Cheat codes instance. */
|
|
54
|
-
cheatCodes: CheatCodes;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
37
|
export const uniswapL1L2TestSuite = (
|
|
58
|
-
setup: () => Promise<
|
|
38
|
+
setup: () => Promise<EndToEndContext>,
|
|
59
39
|
cleanup: () => Promise<void>,
|
|
60
40
|
expectedForkBlockNumber = 17514288,
|
|
61
41
|
) => {
|
|
@@ -79,7 +59,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
79
59
|
let daiCrossChainHarness: CrossChainTestHarness;
|
|
80
60
|
let wethCrossChainHarness: CrossChainTestHarness;
|
|
81
61
|
|
|
82
|
-
let deployL1ContractsValues:
|
|
62
|
+
let deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
83
63
|
let rollup: RollupContract;
|
|
84
64
|
let uniswapPortal: GetContractReturnType<typeof UniswapPortalAbi, ExtendedViemWalletClient>;
|
|
85
65
|
let uniswapPortalAddress: EthAddress;
|
|
@@ -92,8 +72,19 @@ export const uniswapL1L2TestSuite = (
|
|
|
92
72
|
let cheatCodes: CheatCodes;
|
|
93
73
|
let version: number;
|
|
94
74
|
beforeAll(async () => {
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
const t = await setup();
|
|
76
|
+
({
|
|
77
|
+
aztecNode,
|
|
78
|
+
logger,
|
|
79
|
+
deployL1ContractsValues,
|
|
80
|
+
cheatCodes,
|
|
81
|
+
wallet,
|
|
82
|
+
accounts: [ownerAddress, sponsorAddress],
|
|
83
|
+
} = t);
|
|
84
|
+
|
|
85
|
+
l1Client = deployL1ContractsValues.l1Client;
|
|
86
|
+
|
|
87
|
+
t.watcher?.setIsMarkingAsProven(false);
|
|
97
88
|
|
|
98
89
|
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
99
90
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
@@ -261,24 +252,19 @@ export const uniswapL1L2TestSuite = (
|
|
|
261
252
|
// ensure that uniswap contract didn't eat the funds.
|
|
262
253
|
await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
|
|
263
254
|
|
|
264
|
-
// Since the outbox is only consumable when the
|
|
265
|
-
|
|
255
|
+
// Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
|
|
256
|
+
const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber!);
|
|
257
|
+
const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
|
|
258
|
+
await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
|
|
259
|
+
await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
|
|
266
260
|
|
|
267
261
|
// 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
|
|
268
262
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
269
263
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
|
|
270
264
|
daiCrossChainHarness.tokenPortalAddress,
|
|
271
265
|
);
|
|
272
|
-
const swapResult = await computeL2ToL1MembershipWitness(
|
|
273
|
-
|
|
274
|
-
l2UniswapInteractionReceipt.blockNumber!,
|
|
275
|
-
swapPrivateLeaf,
|
|
276
|
-
);
|
|
277
|
-
const withdrawResult = await computeL2ToL1MembershipWitness(
|
|
278
|
-
aztecNode,
|
|
279
|
-
l2UniswapInteractionReceipt.blockNumber!,
|
|
280
|
-
withdrawLeaf,
|
|
281
|
-
);
|
|
266
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
|
|
267
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
|
|
282
268
|
|
|
283
269
|
const swapPrivateL2MessageIndex = swapResult!.leafIndex;
|
|
284
270
|
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
@@ -287,7 +273,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
287
273
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
288
274
|
|
|
289
275
|
const withdrawMessageMetadata = {
|
|
290
|
-
|
|
276
|
+
_epoch: BigInt(epoch),
|
|
291
277
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
292
278
|
_path: withdrawSiblingPath
|
|
293
279
|
.toBufferArray()
|
|
@@ -295,7 +281,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
295
281
|
};
|
|
296
282
|
|
|
297
283
|
const swapPrivateMessageMetadata = {
|
|
298
|
-
|
|
284
|
+
_epoch: BigInt(epoch),
|
|
299
285
|
_leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
300
286
|
_path: swapPrivateSiblingPath
|
|
301
287
|
.toBufferArray()
|
|
@@ -506,7 +492,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
506
492
|
// );
|
|
507
493
|
|
|
508
494
|
// const withdrawMessageMetadata = {
|
|
509
|
-
//
|
|
495
|
+
// _epoch: epoch,
|
|
510
496
|
// _leafIndex: BigInt(withdrawL2MessageIndex),
|
|
511
497
|
// _path: withdrawSiblingPath
|
|
512
498
|
// .toBufferArray()
|
|
@@ -514,7 +500,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
514
500
|
// };
|
|
515
501
|
|
|
516
502
|
// const swapPrivateMessageMetadata = {
|
|
517
|
-
//
|
|
503
|
+
// _epoch: epoch,
|
|
518
504
|
// _leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
519
505
|
// _path: swapPrivateSiblingPath
|
|
520
506
|
// .toBufferArray()
|
|
@@ -858,12 +844,11 @@ export const uniswapL1L2TestSuite = (
|
|
|
858
844
|
chainId: new Fr(l1Client.chain.id),
|
|
859
845
|
});
|
|
860
846
|
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
aztecNode,
|
|
864
|
-
withdrawReceipt.blockNumber!,
|
|
865
|
-
withdrawLeaf,
|
|
847
|
+
const epoch = await rollup.getEpochNumberForCheckpoint(
|
|
848
|
+
CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
|
|
866
849
|
);
|
|
850
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
|
|
851
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
|
|
867
852
|
|
|
868
853
|
const swapPrivateL2MessageIndex = swapResult!.leafIndex;
|
|
869
854
|
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
@@ -872,7 +857,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
872
857
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
873
858
|
|
|
874
859
|
const withdrawMessageMetadata = {
|
|
875
|
-
|
|
860
|
+
_epoch: BigInt(epoch),
|
|
876
861
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
877
862
|
_path: withdrawSiblingPath
|
|
878
863
|
.toBufferArray()
|
|
@@ -880,7 +865,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
880
865
|
};
|
|
881
866
|
|
|
882
867
|
const swapPrivateMessageMetadata = {
|
|
883
|
-
|
|
868
|
+
_epoch: BigInt(epoch),
|
|
884
869
|
_leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
885
870
|
_path: swapPrivateSiblingPath
|
|
886
871
|
.toBufferArray()
|
|
@@ -890,8 +875,9 @@ export const uniswapL1L2TestSuite = (
|
|
|
890
875
|
// ensure that user's funds were burnt
|
|
891
876
|
await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
|
|
892
877
|
|
|
893
|
-
// Since the outbox is only consumable when the
|
|
894
|
-
await cheatCodes.rollup.
|
|
878
|
+
// Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
|
|
879
|
+
await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
|
|
880
|
+
await waitForProven(aztecNode, withdrawReceipt, { provenTimeout: 300 });
|
|
895
881
|
|
|
896
882
|
// On L1 call swap_public!
|
|
897
883
|
logger.info('call swap_public on L1');
|
|
@@ -993,12 +979,11 @@ export const uniswapL1L2TestSuite = (
|
|
|
993
979
|
chainId: new Fr(l1Client.chain.id),
|
|
994
980
|
});
|
|
995
981
|
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
aztecNode,
|
|
999
|
-
withdrawReceipt.blockNumber!,
|
|
1000
|
-
withdrawLeaf,
|
|
982
|
+
const epoch = await rollup.getEpochNumberForCheckpoint(
|
|
983
|
+
CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
|
|
1001
984
|
);
|
|
985
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
|
|
986
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
|
|
1002
987
|
|
|
1003
988
|
const swapPublicL2MessageIndex = swapResult!.leafIndex;
|
|
1004
989
|
const swapPublicSiblingPath = swapResult!.siblingPath;
|
|
@@ -1007,7 +992,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
1007
992
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
1008
993
|
|
|
1009
994
|
const withdrawMessageMetadata = {
|
|
1010
|
-
|
|
995
|
+
_epoch: BigInt(epoch),
|
|
1011
996
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
1012
997
|
_path: withdrawSiblingPath
|
|
1013
998
|
.toBufferArray()
|
|
@@ -1015,7 +1000,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
1015
1000
|
};
|
|
1016
1001
|
|
|
1017
1002
|
const swapPublicMessageMetadata = {
|
|
1018
|
-
|
|
1003
|
+
_epoch: BigInt(epoch),
|
|
1019
1004
|
_leafIndex: BigInt(swapPublicL2MessageIndex),
|
|
1020
1005
|
_path: swapPublicSiblingPath
|
|
1021
1006
|
.toBufferArray()
|
|
@@ -1025,8 +1010,9 @@ export const uniswapL1L2TestSuite = (
|
|
|
1025
1010
|
// check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
|
|
1026
1011
|
await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
|
|
1027
1012
|
|
|
1028
|
-
// Since the outbox is only consumable when the
|
|
1029
|
-
await cheatCodes.rollup.
|
|
1013
|
+
// Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
|
|
1014
|
+
await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
|
|
1015
|
+
await waitForProven(aztecNode, withdrawReceipt, { provenTimeout: 300 });
|
|
1030
1016
|
|
|
1031
1017
|
// Call swap_private on L1
|
|
1032
1018
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
|
-
import type { RollupContract } from '@aztec/ethereum';
|
|
5
|
+
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
6
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
|
-
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
7
|
+
import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
|
|
8
8
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
10
10
|
|
package/src/spartan/DEVELOP.md
CHANGED
|
@@ -61,10 +61,17 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
|
|
|
61
61
|
- the containers for the aztec infrastructure (validators, provers, etc)
|
|
62
62
|
|
|
63
63
|
# Deploy Metrics
|
|
64
|
+
|
|
64
65
|
```bash
|
|
65
66
|
./spartan/bootstrap.sh metrics-kind
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
# Install Chaos Mesh
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./spartan/bootstrap.sh chaos-mesh
|
|
73
|
+
```
|
|
74
|
+
|
|
68
75
|
# Deploy stuff
|
|
69
76
|
|
|
70
77
|
```bash
|
|
@@ -6,7 +6,8 @@ import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.j
|
|
|
6
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
7
|
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
8
8
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { createEthereumChain
|
|
9
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
10
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
11
|
import type { Logger } from '@aztec/foundation/log';
|
|
11
12
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
12
13
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -314,11 +315,17 @@ export async function performTransfers({
|
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
|
|
318
|
+
export type WalletWrapper = {
|
|
319
|
+
wallet: TestWallet;
|
|
320
|
+
aztecNode: AztecNode;
|
|
321
|
+
cleanup: () => Promise<void>;
|
|
322
|
+
};
|
|
323
|
+
|
|
317
324
|
export async function createWalletAndAztecNodeClient(
|
|
318
325
|
nodeUrl: string,
|
|
319
326
|
proverEnabled: boolean,
|
|
320
327
|
logger: Logger,
|
|
321
|
-
): Promise<
|
|
328
|
+
): Promise<WalletWrapper> {
|
|
322
329
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
323
330
|
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
324
331
|
const pxeConfig = {
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
3
|
+
import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
4
|
+
|
|
5
|
+
import { createHistogram } from 'perf_hooks';
|
|
6
|
+
|
|
7
|
+
export type TxInclusionData = {
|
|
8
|
+
txHash: string;
|
|
9
|
+
sentAt: number;
|
|
10
|
+
minedAt: number;
|
|
11
|
+
attestedAt: number;
|
|
12
|
+
blocknumber: number;
|
|
13
|
+
priorityFee: number;
|
|
14
|
+
totalFee: number;
|
|
15
|
+
positionInBlock: number;
|
|
16
|
+
group: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class TxInclusionMetrics {
|
|
20
|
+
private data = new Map<string, TxInclusionData>();
|
|
21
|
+
private groups = new Set<string>();
|
|
22
|
+
private blocks = new Map<number, Promise<L2Block>>();
|
|
23
|
+
|
|
24
|
+
constructor(private aztecNode: AztecNode) {}
|
|
25
|
+
|
|
26
|
+
recordSentTx(tx: Tx, group: string): void {
|
|
27
|
+
const txHash = tx.getTxHash().toString();
|
|
28
|
+
const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
|
|
29
|
+
|
|
30
|
+
this.data.set(txHash, {
|
|
31
|
+
txHash,
|
|
32
|
+
sentAt: Math.trunc(Date.now() / 1000),
|
|
33
|
+
minedAt: -1,
|
|
34
|
+
attestedAt: -1,
|
|
35
|
+
blocknumber: -1,
|
|
36
|
+
priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
|
|
37
|
+
totalFee: -1,
|
|
38
|
+
positionInBlock: -1,
|
|
39
|
+
group,
|
|
40
|
+
});
|
|
41
|
+
this.groups.add(group);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
|
|
45
|
+
const { status, txHash, blockNumber } = txReceipt;
|
|
46
|
+
if (status !== TxStatus.SUCCESS || !blockNumber) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!this.blocks.has(blockNumber)) {
|
|
51
|
+
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber) as Promise<L2Block>);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const block = await this.blocks.get(blockNumber)!;
|
|
55
|
+
const data = this.data.get(txHash.toString())!;
|
|
56
|
+
data.blocknumber = blockNumber;
|
|
57
|
+
data.minedAt = Number(block.header.globalVariables.timestamp);
|
|
58
|
+
data.attestedAt = -1;
|
|
59
|
+
data.totalFee = Number(txReceipt.transactionFee ?? 0n);
|
|
60
|
+
data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public inclusionTimeInSeconds(group: string): {
|
|
64
|
+
count: number;
|
|
65
|
+
group: string;
|
|
66
|
+
min: number;
|
|
67
|
+
mean: number;
|
|
68
|
+
max: number;
|
|
69
|
+
median: number;
|
|
70
|
+
p99: number;
|
|
71
|
+
} {
|
|
72
|
+
const histogram = createHistogram({});
|
|
73
|
+
for (const tx of this.data.values()) {
|
|
74
|
+
if (!tx.blocknumber || tx.group !== group) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
histogram.record(tx.minedAt - tx.sentAt);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (histogram.count === 0) {
|
|
82
|
+
return {
|
|
83
|
+
group,
|
|
84
|
+
count: 0,
|
|
85
|
+
mean: 0,
|
|
86
|
+
max: 0,
|
|
87
|
+
median: 0,
|
|
88
|
+
min: 0,
|
|
89
|
+
p99: 0,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
group,
|
|
95
|
+
count: histogram.count,
|
|
96
|
+
mean: histogram.mean,
|
|
97
|
+
max: histogram.max,
|
|
98
|
+
median: histogram.percentile(50),
|
|
99
|
+
min: histogram.min,
|
|
100
|
+
p99: histogram.percentile(99),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
|
|
105
|
+
const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
|
|
106
|
+
for (const group of this.groups) {
|
|
107
|
+
const stats = this.inclusionTimeInSeconds(group);
|
|
108
|
+
|
|
109
|
+
data.push(
|
|
110
|
+
{
|
|
111
|
+
name: `${group}/avg_inclusion`,
|
|
112
|
+
unit: 's',
|
|
113
|
+
value: stats.mean,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: `${group}/median_inclusion`,
|
|
117
|
+
unit: 's',
|
|
118
|
+
value: stats.median,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: `${group}/p99_inclusion`,
|
|
122
|
+
unit: 's',
|
|
123
|
+
value: stats.p99,
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
}
|