@aztec/end-to-end 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.17
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/README.md +2 -0
- package/dest/bench/utils.d.ts +70 -0
- package/dest/bench/utils.d.ts.map +1 -0
- package/dest/bench/utils.js +24 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +46 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +17 -17
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +47 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +27 -16
- package/dest/e2e_deploy_contract/deploy_test.d.ts +28 -0
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -0
- package/dest/e2e_deploy_contract/deploy_test.js +4 -7
- package/dest/e2e_epochs/epochs_test.d.ts +51 -0
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -0
- package/dest/e2e_epochs/epochs_test.js +155 -0
- package/dest/e2e_fees/fees_test.d.ts +73 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -0
- package/dest/e2e_fees/fees_test.js +75 -32
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +26 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -0
- package/dest/e2e_nested_contract/nested_contract_test.js +14 -12
- package/dest/e2e_p2p/p2p_network.d.ts +61 -0
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -0
- package/dest/e2e_p2p/p2p_network.js +54 -30
- package/dest/e2e_p2p/shared.d.ts +10 -0
- package/dest/e2e_p2p/shared.d.ts.map +1 -0
- package/dest/e2e_p2p/shared.js +7 -8
- package/dest/e2e_prover/e2e_prover_test.d.ts +56 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -0
- package/dest/e2e_prover/e2e_prover_test.js +20 -24
- package/dest/e2e_token_contract/token_contract_test.d.ts +29 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -0
- package/dest/e2e_token_contract/token_contract_test.js +4 -7
- package/dest/fixtures/fixtures.d.ts +17 -0
- package/dest/fixtures/fixtures.d.ts.map +1 -0
- package/dest/fixtures/fixtures.js +2 -2
- package/dest/fixtures/get_acvm_config.d.ts +8 -0
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -0
- package/dest/fixtures/get_acvm_config.js +10 -5
- package/dest/fixtures/get_bb_config.d.ts +6 -0
- package/dest/fixtures/get_bb_config.d.ts.map +1 -0
- package/dest/fixtures/get_bb_config.js +9 -4
- package/dest/fixtures/index.d.ts +6 -0
- package/dest/fixtures/index.d.ts.map +1 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +13 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/fixtures/l1_to_l2_messaging.js +1 -1
- package/dest/fixtures/logging.d.ts +8 -0
- package/dest/fixtures/logging.d.ts.map +1 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +6 -0
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -0
- package/dest/fixtures/setup_l1_contracts.js +6 -4
- package/dest/fixtures/setup_p2p_test.d.ts +22 -0
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -0
- package/dest/fixtures/setup_p2p_test.js +5 -3
- package/dest/fixtures/snapshot_manager.d.ts +87 -0
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -0
- package/dest/fixtures/snapshot_manager.js +67 -74
- package/dest/fixtures/token_utils.d.ts +6 -0
- package/dest/fixtures/token_utils.d.ts.map +1 -0
- package/dest/fixtures/token_utils.js +1 -1
- package/dest/fixtures/utils.d.ts +155 -0
- package/dest/fixtures/utils.d.ts.map +1 -0
- package/dest/fixtures/utils.js +97 -71
- package/dest/fixtures/with_telemetry_utils.d.ts +3 -0
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -0
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/quality_of_service/alert_checker.d.ts +41 -0
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -0
- package/dest/quality_of_service/alert_checker.js +4 -1
- package/dest/sample-dapp/index.js +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +124 -0
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -0
- package/dest/shared/cross_chain_test_harness.js +6 -17
- package/dest/shared/gas_portal_test_harness.d.ts +80 -0
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -0
- package/dest/shared/gas_portal_test_harness.js +11 -4
- package/dest/shared/index.d.ts +2 -0
- package/dest/shared/index.d.ts.map +1 -0
- package/dest/shared/index.js +0 -1
- package/dest/shared/jest_setup.d.ts +2 -0
- package/dest/shared/jest_setup.d.ts.map +1 -0
- package/dest/shared/submit-transactions.d.ts +4 -0
- package/dest/shared/submit-transactions.d.ts.map +1 -0
- package/dest/shared/submit-transactions.js +9 -17
- package/dest/shared/uniswap_l1_l2.d.ts +25 -0
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -0
- package/dest/shared/uniswap_l1_l2.js +5 -10
- package/dest/simulators/index.d.ts +3 -0
- package/dest/simulators/index.d.ts.map +1 -0
- package/dest/simulators/lending_simulator.d.ts +69 -0
- package/dest/simulators/lending_simulator.d.ts.map +1 -0
- package/dest/simulators/lending_simulator.js +1 -3
- package/dest/simulators/token_simulator.d.ts +29 -0
- package/dest/simulators/token_simulator.d.ts.map +1 -0
- package/dest/spartan/setup_test_wallets.d.ts +20 -0
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -0
- package/dest/spartan/setup_test_wallets.js +72 -38
- package/dest/spartan/utils.d.ts +485 -0
- package/dest/spartan/utils.d.ts.map +1 -0
- package/dest/spartan/utils.js +110 -2
- package/package.json +35 -40
- package/src/bench/utils.ts +30 -13
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +40 -30
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +34 -18
- package/src/e2e_deploy_contract/deploy_test.ts +6 -11
- package/src/e2e_epochs/epochs_test.ts +217 -0
- package/src/e2e_fees/fees_test.ts +84 -38
- package/src/e2e_nested_contract/nested_contract_test.ts +14 -16
- package/src/e2e_p2p/p2p_network.ts +67 -47
- package/src/e2e_p2p/shared.ts +16 -10
- package/src/e2e_prover/e2e_prover_test.ts +56 -37
- package/src/e2e_token_contract/token_contract_test.ts +10 -11
- package/src/fixtures/fixtures.ts +2 -2
- package/src/fixtures/get_acvm_config.ts +7 -3
- package/src/fixtures/get_bb_config.ts +6 -2
- package/src/fixtures/l1_to_l2_messaging.ts +6 -13
- package/src/fixtures/setup_l1_contracts.ts +8 -7
- package/src/fixtures/setup_p2p_test.ts +8 -6
- package/src/fixtures/snapshot_manager.ts +72 -79
- package/src/fixtures/token_utils.ts +2 -2
- package/src/fixtures/utils.ts +135 -97
- package/src/guides/up_quick_start.sh +10 -5
- package/src/quality_of_service/alert_checker.ts +6 -2
- package/src/sample-dapp/index.mjs +1 -1
- package/src/shared/cross_chain_test_harness.ts +17 -35
- package/src/shared/gas_portal_test_harness.ts +21 -11
- package/src/shared/index.ts +0 -1
- package/src/shared/submit-transactions.ts +16 -20
- package/src/shared/uniswap_l1_l2.ts +35 -26
- package/src/simulators/lending_simulator.ts +5 -6
- package/src/simulators/token_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +111 -37
- package/src/spartan/utils.ts +88 -3
- package/dest/shared/browser.js +0 -163
- package/src/shared/browser.ts +0 -272
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
|
+
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
4
5
|
import { ChainMonitor } from '@aztec/aztec.js/ethereum';
|
|
5
|
-
import {
|
|
6
|
+
import { RollupContract, getExpectedAddress, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
7
|
+
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
6
8
|
import { EthCheatCodesWithState } from '@aztec/ethereum/test';
|
|
7
9
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
8
10
|
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
9
11
|
import { SpamContract } from '@aztec/noir-contracts.js/Spam';
|
|
10
|
-
import {
|
|
11
|
-
import { createBootstrapNodeFromPrivateKey } from '@aztec/p2p/
|
|
12
|
+
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
|
|
13
|
+
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
14
|
+
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
15
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
12
16
|
|
|
13
17
|
import getPort from 'get-port';
|
|
14
18
|
import { getContract } from 'viem';
|
|
@@ -23,8 +27,8 @@ import {
|
|
|
23
27
|
import {
|
|
24
28
|
type ISnapshotManager,
|
|
25
29
|
type SubsystemsContext,
|
|
26
|
-
addAccounts,
|
|
27
30
|
createSnapshotManager,
|
|
31
|
+
deployAccounts,
|
|
28
32
|
} from '../fixtures/snapshot_manager.js';
|
|
29
33
|
import { getPrivateKeyFromIndex } from '../fixtures/utils.js';
|
|
30
34
|
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
@@ -34,6 +38,11 @@ const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f2067060
|
|
|
34
38
|
const l1ContractsConfig = getL1ContractsConfigEnvVars();
|
|
35
39
|
export const WAIT_FOR_TX_TIMEOUT = l1ContractsConfig.aztecSlotDuration * 3;
|
|
36
40
|
|
|
41
|
+
export const SHORTENED_BLOCK_TIME_CONFIG = {
|
|
42
|
+
aztecSlotDuration: 12,
|
|
43
|
+
ethereumSlotDuration: 4,
|
|
44
|
+
};
|
|
45
|
+
|
|
37
46
|
export class P2PNetworkTest {
|
|
38
47
|
private snapshotManager: ISnapshotManager;
|
|
39
48
|
private baseAccount;
|
|
@@ -47,25 +56,26 @@ export class P2PNetworkTest {
|
|
|
47
56
|
public proposerPrivateKeys: `0x${string}`[] = [];
|
|
48
57
|
public peerIdPrivateKeys: string[] = [];
|
|
49
58
|
|
|
50
|
-
public
|
|
51
|
-
|
|
59
|
+
public deployedAccounts: InitialAccountData[] = [];
|
|
60
|
+
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
52
61
|
// The re-execution test needs a wallet and a spam contract
|
|
53
62
|
public wallet?: AccountWalletWithSecretKey;
|
|
54
63
|
public spamContract?: SpamContract;
|
|
55
64
|
|
|
65
|
+
public bootstrapNode?: BootstrapNode;
|
|
66
|
+
|
|
56
67
|
private cleanupInterval: NodeJS.Timeout | undefined = undefined;
|
|
57
68
|
|
|
58
69
|
private gasUtils: L1TxUtilsWithBlobs | undefined = undefined;
|
|
59
70
|
|
|
60
71
|
constructor(
|
|
61
72
|
testName: string,
|
|
62
|
-
public
|
|
73
|
+
public bootstrapNodeEnr: string,
|
|
63
74
|
public bootNodePort: number,
|
|
64
75
|
private numberOfNodes: number,
|
|
65
76
|
initialValidatorConfig: AztecNodeConfig,
|
|
66
77
|
// If set enable metrics collection
|
|
67
|
-
metricsPort?: number,
|
|
68
|
-
assumeProvenThrough?: number,
|
|
78
|
+
private metricsPort?: number,
|
|
69
79
|
) {
|
|
70
80
|
this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
|
|
71
81
|
|
|
@@ -75,23 +85,26 @@ export class P2PNetworkTest {
|
|
|
75
85
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
76
86
|
this.attesterPublicKeys = this.attesterPrivateKeys.map(privateKey => privateKeyToAccount(privateKey).address);
|
|
77
87
|
|
|
78
|
-
this.bootstrapNodeEnr = bootstrapNode.getENR().encodeTxt();
|
|
79
|
-
|
|
80
88
|
this.snapshotManager = createSnapshotManager(
|
|
81
89
|
`e2e_p2p_network/${testName}`,
|
|
82
90
|
process.env.E2E_DATA_PATH,
|
|
83
91
|
{
|
|
84
92
|
...initialValidatorConfig,
|
|
85
|
-
ethereumSlotDuration: l1ContractsConfig.ethereumSlotDuration,
|
|
93
|
+
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
94
|
+
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
95
|
+
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
96
|
+
aztecProofSubmissionWindow:
|
|
97
|
+
initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
|
|
86
98
|
salt: 420,
|
|
87
99
|
metricsPort: metricsPort,
|
|
100
|
+
numberOfInitialFundedAccounts: 1,
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
103
|
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
105
|
+
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
106
|
+
aztecProofSubmissionWindow:
|
|
107
|
+
initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
|
|
95
108
|
initialValidators: [],
|
|
96
109
|
},
|
|
97
110
|
);
|
|
@@ -103,35 +116,31 @@ export class P2PNetworkTest {
|
|
|
103
116
|
basePort,
|
|
104
117
|
metricsPort,
|
|
105
118
|
initialConfig,
|
|
106
|
-
assumeProvenThrough,
|
|
107
119
|
}: {
|
|
108
120
|
testName: string;
|
|
109
121
|
numberOfNodes: number;
|
|
110
122
|
basePort?: number;
|
|
111
123
|
metricsPort?: number;
|
|
112
124
|
initialConfig?: Partial<AztecNodeConfig>;
|
|
113
|
-
assumeProvenThrough?: number;
|
|
114
125
|
}) {
|
|
115
126
|
const port = basePort || (await getPort());
|
|
116
127
|
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const bootstrapNodeEnr = bootstrapNode.getENR().encodeTxt();
|
|
128
|
+
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
|
|
129
|
+
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
|
|
120
130
|
|
|
121
131
|
const initialValidatorConfig = await createValidatorConfig(
|
|
122
132
|
(initialConfig ?? {}) as AztecNodeConfig,
|
|
123
133
|
bootstrapNodeEnr,
|
|
124
134
|
);
|
|
125
135
|
|
|
126
|
-
return new P2PNetworkTest(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
);
|
|
136
|
+
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfNodes, initialValidatorConfig, metricsPort);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get fundedAccount() {
|
|
140
|
+
if (!this.deployedAccounts[0]) {
|
|
141
|
+
throw new Error('Call snapshot t.setupAccount to create a funded account.');
|
|
142
|
+
}
|
|
143
|
+
return this.deployedAccounts[0];
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
/**
|
|
@@ -161,6 +170,18 @@ export class P2PNetworkTest {
|
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
async applyBaseSnapshots() {
|
|
173
|
+
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
|
|
174
|
+
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
175
|
+
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
|
|
176
|
+
BOOTSTRAP_NODE_PRIVATE_KEY,
|
|
177
|
+
this.bootNodePort,
|
|
178
|
+
telemetry,
|
|
179
|
+
aztecNodeConfig,
|
|
180
|
+
);
|
|
181
|
+
// Overwrite enr with updated info
|
|
182
|
+
this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
|
|
183
|
+
});
|
|
184
|
+
|
|
164
185
|
await this.snapshotManager.snapshot(
|
|
165
186
|
'add-validators',
|
|
166
187
|
async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider }) => {
|
|
@@ -219,7 +240,7 @@ export class P2PNetworkTest {
|
|
|
219
240
|
|
|
220
241
|
const slotsInEpoch = await rollup.read.getEpochDuration();
|
|
221
242
|
const timestamp = await rollup.read.getTimestampForSlot([slotsInEpoch]);
|
|
222
|
-
const cheatCodes = new EthCheatCodesWithState(aztecNodeConfig.
|
|
243
|
+
const cheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
223
244
|
try {
|
|
224
245
|
await cheatCodes.warp(Number(timestamp));
|
|
225
246
|
} catch (err) {
|
|
@@ -245,16 +266,11 @@ export class P2PNetworkTest {
|
|
|
245
266
|
async setupAccount() {
|
|
246
267
|
await this.snapshotManager.snapshot(
|
|
247
268
|
'setup-account',
|
|
248
|
-
|
|
249
|
-
async ({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return account.getWallet();
|
|
254
|
-
}),
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
this.wallet = wallets[0];
|
|
269
|
+
deployAccounts(1, this.logger, false),
|
|
270
|
+
async ({ deployedAccounts }, { pxe }) => {
|
|
271
|
+
this.deployedAccounts = deployedAccounts;
|
|
272
|
+
const [account] = deployedAccounts;
|
|
273
|
+
this.wallet = await getSchnorrWalletWithSecretKey(pxe, account.secret, account.signingKey, account.salt);
|
|
258
274
|
},
|
|
259
275
|
);
|
|
260
276
|
}
|
|
@@ -303,6 +319,11 @@ export class P2PNetworkTest {
|
|
|
303
319
|
|
|
304
320
|
async setup() {
|
|
305
321
|
this.ctx = await this.snapshotManager.setup();
|
|
322
|
+
|
|
323
|
+
this.prefilledPublicData = (
|
|
324
|
+
await getGenesisValues(this.ctx.initialFundedAccounts.map(a => a.address))
|
|
325
|
+
).prefilledPublicData;
|
|
326
|
+
|
|
306
327
|
this.startSyncMockSystemTimeInterval();
|
|
307
328
|
|
|
308
329
|
this.gasUtils = new L1TxUtilsWithBlobs(
|
|
@@ -319,8 +340,7 @@ export class P2PNetworkTest {
|
|
|
319
340
|
},
|
|
320
341
|
);
|
|
321
342
|
|
|
322
|
-
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues));
|
|
323
|
-
this.monitor.start();
|
|
343
|
+
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
|
|
324
344
|
}
|
|
325
345
|
|
|
326
346
|
async stopNodes(nodes: AztecNodeService[]) {
|
|
@@ -338,7 +358,7 @@ export class P2PNetworkTest {
|
|
|
338
358
|
|
|
339
359
|
async teardown() {
|
|
340
360
|
this.monitor.stop();
|
|
341
|
-
await this.bootstrapNode
|
|
361
|
+
await this.bootstrapNode?.stop();
|
|
342
362
|
await this.snapshotManager.teardown();
|
|
343
363
|
if (this.cleanupInterval) {
|
|
344
364
|
clearInterval(this.cleanupInterval);
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import { type Logger, type SentTx, TxStatus } from '@aztec/aztec.js';
|
|
5
|
+
import type { SpamContract } from '@aztec/noir-contracts.js/Spam';
|
|
5
6
|
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
8
9
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
9
10
|
|
|
10
11
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
@@ -43,18 +44,23 @@ export const createPXEServiceAndSubmitTransactions = async (
|
|
|
43
44
|
logger: Logger,
|
|
44
45
|
node: AztecNodeService,
|
|
45
46
|
numTxs: number,
|
|
47
|
+
fundedAccount: InitialAccountData,
|
|
46
48
|
): Promise<NodeContext> => {
|
|
47
49
|
const rpcConfig = getRpcConfig();
|
|
48
50
|
const pxeService = await createPXEService(node, rpcConfig, true);
|
|
49
51
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const account = await getSchnorrAccount(
|
|
53
|
+
pxeService,
|
|
54
|
+
fundedAccount.secret,
|
|
55
|
+
fundedAccount.signingKey,
|
|
56
|
+
fundedAccount.salt,
|
|
57
|
+
);
|
|
58
|
+
await account.register();
|
|
59
|
+
const wallet = await account.getWallet();
|
|
53
60
|
|
|
54
|
-
const txs = await submitTxsTo(pxeService, numTxs, logger);
|
|
61
|
+
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
55
62
|
return {
|
|
56
63
|
txs,
|
|
57
|
-
account: completeAddress.address,
|
|
58
64
|
pxeService,
|
|
59
65
|
node,
|
|
60
66
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SchnorrAccountContractArtifact,
|
|
3
|
+
getSchnorrAccount,
|
|
4
|
+
getSchnorrWalletWithSecretKey,
|
|
5
|
+
} from '@aztec/accounts/schnorr';
|
|
6
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
7
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
3
8
|
import {
|
|
4
9
|
type AccountWalletWithSecretKey,
|
|
5
10
|
type AztecNode,
|
|
6
11
|
type CheatCodes,
|
|
7
12
|
type CompleteAddress,
|
|
8
|
-
type
|
|
13
|
+
type DeployL1ContractsReturnType,
|
|
9
14
|
EthAddress,
|
|
10
|
-
type Fq,
|
|
11
|
-
Fr,
|
|
12
15
|
type Logger,
|
|
13
16
|
type PXE,
|
|
14
17
|
createLogger,
|
|
@@ -16,12 +19,13 @@ import {
|
|
|
16
19
|
} from '@aztec/aztec.js';
|
|
17
20
|
import { BBCircuitVerifier, type ClientProtocolCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
18
21
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
19
|
-
import {
|
|
22
|
+
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
20
23
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
21
24
|
import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
22
25
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
23
26
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
24
|
-
import {
|
|
27
|
+
import type { PXEService } from '@aztec/pxe';
|
|
28
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
25
29
|
|
|
26
30
|
import { type Hex, getContract } from 'viem';
|
|
27
31
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
@@ -31,8 +35,8 @@ import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
|
31
35
|
import {
|
|
32
36
|
type ISnapshotManager,
|
|
33
37
|
type SubsystemsContext,
|
|
34
|
-
addAccounts,
|
|
35
38
|
createSnapshotManager,
|
|
39
|
+
deployAccounts,
|
|
36
40
|
publicDeployAccounts,
|
|
37
41
|
} from '../fixtures/snapshot_manager.js';
|
|
38
42
|
import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
|
|
@@ -40,8 +44,6 @@ import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
|
40
44
|
|
|
41
45
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
42
46
|
|
|
43
|
-
const SALT = 1;
|
|
44
|
-
|
|
45
47
|
type ProvenSetup = {
|
|
46
48
|
pxe: PXE;
|
|
47
49
|
teardown: () => Promise<void>;
|
|
@@ -60,7 +62,7 @@ export class FullProverTest {
|
|
|
60
62
|
static TOKEN_DECIMALS = 18n;
|
|
61
63
|
private snapshotManager: ISnapshotManager;
|
|
62
64
|
logger: Logger;
|
|
63
|
-
|
|
65
|
+
deployedAccounts: InitialAccountData[] = [];
|
|
64
66
|
wallets: AccountWalletWithSecretKey[] = [];
|
|
65
67
|
accounts: CompleteAddress[] = [];
|
|
66
68
|
fakeProofsAsset!: TokenContract;
|
|
@@ -77,7 +79,7 @@ export class FullProverTest {
|
|
|
77
79
|
private context!: SubsystemsContext;
|
|
78
80
|
private proverNode!: ProverNode;
|
|
79
81
|
private simulatedProverNode!: ProverNode;
|
|
80
|
-
public l1Contracts!:
|
|
82
|
+
public l1Contracts!: DeployL1ContractsReturnType;
|
|
81
83
|
public proverAddress!: EthAddress;
|
|
82
84
|
|
|
83
85
|
constructor(
|
|
@@ -91,7 +93,7 @@ export class FullProverTest {
|
|
|
91
93
|
`full_prover_integration/${testName}`,
|
|
92
94
|
dataPath,
|
|
93
95
|
{ startProverNode: true, fundRewardDistributor: true, coinbase },
|
|
94
|
-
{
|
|
96
|
+
{},
|
|
95
97
|
);
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -101,17 +103,18 @@ export class FullProverTest {
|
|
|
101
103
|
* 2. Publicly deploy accounts, deploy token contract
|
|
102
104
|
*/
|
|
103
105
|
async applyBaseSnapshots() {
|
|
104
|
-
await this.snapshotManager.snapshot(
|
|
105
|
-
|
|
106
|
-
this.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
await this.snapshotManager.snapshot(
|
|
107
|
+
'2_accounts',
|
|
108
|
+
deployAccounts(2, this.logger),
|
|
109
|
+
async ({ deployedAccounts }, { pxe }) => {
|
|
110
|
+
this.deployedAccounts = deployedAccounts;
|
|
111
|
+
this.wallets = await Promise.all(
|
|
112
|
+
deployedAccounts.map(a => getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)),
|
|
113
|
+
);
|
|
114
|
+
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
115
|
+
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
116
|
+
},
|
|
117
|
+
);
|
|
115
118
|
|
|
116
119
|
await this.snapshotManager.snapshot(
|
|
117
120
|
'client_prover_integration',
|
|
@@ -154,6 +157,10 @@ export class FullProverTest {
|
|
|
154
157
|
|
|
155
158
|
async setup() {
|
|
156
159
|
this.context = await this.snapshotManager.setup();
|
|
160
|
+
|
|
161
|
+
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
162
|
+
this.context.watcher.setIsMarkingAsProven(false);
|
|
163
|
+
|
|
157
164
|
this.simulatedProverNode = this.context.proverNode!;
|
|
158
165
|
({
|
|
159
166
|
pxe: this.pxe,
|
|
@@ -218,11 +225,22 @@ export class FullProverTest {
|
|
|
218
225
|
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
219
226
|
|
|
220
227
|
for (let i = 0; i < 2; i++) {
|
|
221
|
-
await result.pxe.registerAccount(
|
|
222
|
-
|
|
228
|
+
await result.pxe.registerAccount(
|
|
229
|
+
this.deployedAccounts[i].secret,
|
|
230
|
+
this.wallets[i].getCompleteAddress().partialAddress,
|
|
231
|
+
);
|
|
232
|
+
await this.pxe.registerAccount(
|
|
233
|
+
this.deployedAccounts[i].secret,
|
|
234
|
+
this.wallets[i].getCompleteAddress().partialAddress,
|
|
235
|
+
);
|
|
223
236
|
}
|
|
224
237
|
|
|
225
|
-
const account = await getSchnorrAccount(
|
|
238
|
+
const account = await getSchnorrAccount(
|
|
239
|
+
result.pxe,
|
|
240
|
+
this.deployedAccounts[0].secret,
|
|
241
|
+
this.deployedAccounts[0].signingKey,
|
|
242
|
+
this.deployedAccounts[0].salt,
|
|
243
|
+
);
|
|
226
244
|
|
|
227
245
|
await result.pxe.registerContract({
|
|
228
246
|
instance: account.getInstance(),
|
|
@@ -264,27 +282,28 @@ export class FullProverTest {
|
|
|
264
282
|
...this.context.aztecNodeConfig,
|
|
265
283
|
proverCoordinationNodeUrl: undefined,
|
|
266
284
|
dataDirectory: undefined,
|
|
267
|
-
proverId:
|
|
285
|
+
proverId: this.proverAddress.toField(),
|
|
268
286
|
realProofs: this.realProofs,
|
|
269
287
|
proverAgentCount: 2,
|
|
270
288
|
publisherPrivateKey: `0x${proverNodePrivateKey!.toString('hex')}`,
|
|
271
289
|
proverNodeMaxPendingJobs: 100,
|
|
272
290
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
273
291
|
proverNodePollingIntervalMs: 100,
|
|
274
|
-
quoteProviderBasisPointFee: 100,
|
|
275
|
-
quoteProviderBondAmount: 1000n,
|
|
276
|
-
proverMinimumEscrowAmount: 3000n,
|
|
277
|
-
proverTargetEscrowAmount: 6000n,
|
|
278
292
|
txGatheringTimeoutMs: 60000,
|
|
279
293
|
txGatheringIntervalMs: 1000,
|
|
280
294
|
txGatheringMaxParallelRequests: 100,
|
|
281
295
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map(a => a.address));
|
|
297
|
+
this.proverNode = await createProverNode(
|
|
298
|
+
proverConfig,
|
|
299
|
+
{
|
|
300
|
+
aztecNodeTxProvider: this.aztecNode,
|
|
301
|
+
archiver: archiver as Archiver,
|
|
302
|
+
blobSinkClient,
|
|
303
|
+
},
|
|
304
|
+
{ prefilledPublicData },
|
|
305
|
+
);
|
|
306
|
+
this.proverNode.start();
|
|
288
307
|
|
|
289
308
|
this.logger.warn(`Proofs are now enabled`);
|
|
290
309
|
return this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { type AccountWallet, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js';
|
|
3
3
|
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -8,8 +8,8 @@ import { jest } from '@jest/globals';
|
|
|
8
8
|
import {
|
|
9
9
|
type ISnapshotManager,
|
|
10
10
|
type SubsystemsContext,
|
|
11
|
-
addAccounts,
|
|
12
11
|
createSnapshotManager,
|
|
12
|
+
deployAccounts,
|
|
13
13
|
publicDeployAccounts,
|
|
14
14
|
} from '../fixtures/snapshot_manager.js';
|
|
15
15
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
@@ -45,15 +45,14 @@ export class TokenContractTest {
|
|
|
45
45
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
46
46
|
jest.setTimeout(120_000);
|
|
47
47
|
|
|
48
|
-
await this.snapshotManager.snapshot(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
48
|
+
await this.snapshotManager.snapshot(
|
|
49
|
+
'3_accounts',
|
|
50
|
+
deployAccounts(3, this.logger),
|
|
51
|
+
async ({ deployedAccounts }, { pxe }) => {
|
|
52
|
+
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
53
|
+
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
54
|
+
},
|
|
55
|
+
);
|
|
57
56
|
|
|
58
57
|
await this.snapshotManager.snapshot(
|
|
59
58
|
'e2e_token_contract',
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -14,8 +14,8 @@ export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478c
|
|
|
14
14
|
export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
|
|
15
15
|
|
|
16
16
|
/// Common errors
|
|
17
|
-
export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
|
|
18
|
-
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow '
|
|
17
|
+
export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
|
|
18
|
+
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
|
|
19
19
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
20
20
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
21
21
|
export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
2
2
|
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
3
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
4
|
|
|
@@ -38,8 +38,12 @@ export async function getACVMConfig(logger: Logger): Promise<
|
|
|
38
38
|
|
|
39
39
|
const cleanup = async () => {
|
|
40
40
|
if (directoryToCleanup) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
try {
|
|
42
|
+
logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
|
|
43
|
+
await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
|
|
44
|
+
} catch (err) {
|
|
45
|
+
logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
|
|
46
|
+
}
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
49
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Logger, fileURLToPath } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { BBConfig } from '@aztec/bb-prover';
|
|
3
3
|
|
|
4
4
|
import fs from 'node:fs/promises';
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
@@ -38,7 +38,11 @@ export const getBBConfig = async (
|
|
|
38
38
|
|
|
39
39
|
const cleanup = async () => {
|
|
40
40
|
if (directoryToCleanup && !bbSkipCleanup) {
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
|
|
43
|
+
} catch (err) {
|
|
44
|
+
logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
48
|
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { L1ContractAddresses, ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
|
|
5
6
|
import { expect } from '@jest/globals';
|
|
6
|
-
import {
|
|
7
|
-
type Account,
|
|
8
|
-
type Chain,
|
|
9
|
-
type HttpTransport,
|
|
10
|
-
type PublicClient,
|
|
11
|
-
type WalletClient,
|
|
12
|
-
decodeEventLog,
|
|
13
|
-
getContract,
|
|
14
|
-
} from 'viem';
|
|
7
|
+
import { decodeEventLog, getContract } from 'viem';
|
|
15
8
|
|
|
16
9
|
export async function sendL1ToL2Message(
|
|
17
10
|
message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
|
|
18
11
|
ctx: {
|
|
19
|
-
walletClient:
|
|
20
|
-
publicClient:
|
|
12
|
+
walletClient: ViemWalletClient;
|
|
13
|
+
publicClient: ViemPublicClient;
|
|
21
14
|
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
|
|
22
15
|
},
|
|
23
16
|
) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Logger, deployL1Contracts } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
3
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/
|
|
2
|
+
import type { DeployL1ContractsArgs, L1ContractsConfig } from '@aztec/ethereum';
|
|
3
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
4
|
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
7
7
|
import { foundry } from 'viem/chains';
|
|
8
8
|
|
|
9
9
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
@@ -12,11 +12,12 @@ export const setupL1Contracts = async (
|
|
|
12
12
|
l1RpcUrl: string,
|
|
13
13
|
account: HDAccount | PrivateKeyAccount,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, '
|
|
15
|
+
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'genesisBlockHash' | 'initialValidators'> &
|
|
16
|
+
L1ContractsConfig,
|
|
16
17
|
) => {
|
|
17
|
-
const l1Data = await deployL1Contracts(l1RpcUrl, account, foundry, logger, {
|
|
18
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice,
|
|
19
|
-
vkTreeRoot:
|
|
18
|
+
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
|
+
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
20
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
20
21
|
protocolContractTreeRoot,
|
|
21
22
|
salt: undefined,
|
|
22
23
|
...args,
|