@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,26 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { ChainMonitor } from '@aztec/aztec.js/ethereum';
|
|
3
|
-
import {
|
|
3
|
+
import { RollupContract, getExpectedAddress, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
|
+
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
4
5
|
import { EthCheatCodesWithState } from '@aztec/ethereum/test';
|
|
5
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
7
|
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
7
8
|
import { SpamContract } from '@aztec/noir-contracts.js/Spam';
|
|
8
|
-
import { createBootstrapNodeFromPrivateKey } from '@aztec/p2p/
|
|
9
|
+
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
10
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
9
11
|
import getPort from 'get-port';
|
|
10
12
|
import { getContract } from 'viem';
|
|
11
13
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
12
14
|
import { ATTESTER_PRIVATE_KEYS_START_INDEX, PROPOSER_PRIVATE_KEYS_START_INDEX, createValidatorConfig, generatePrivateKeys } from '../fixtures/setup_p2p_test.js';
|
|
13
|
-
import {
|
|
15
|
+
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
14
16
|
import { getPrivateKeyFromIndex } from '../fixtures/utils.js';
|
|
15
17
|
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
16
18
|
// Use a fixed bootstrap node private key so that we can re-use the same snapshot and the nodes can find each other
|
|
17
19
|
const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f20670603a756ad8d84f2c94263a6427c591';
|
|
18
20
|
const l1ContractsConfig = getL1ContractsConfigEnvVars();
|
|
19
21
|
export const WAIT_FOR_TX_TIMEOUT = l1ContractsConfig.aztecSlotDuration * 3;
|
|
22
|
+
export const SHORTENED_BLOCK_TIME_CONFIG = {
|
|
23
|
+
aztecSlotDuration: 12,
|
|
24
|
+
ethereumSlotDuration: 4
|
|
25
|
+
};
|
|
20
26
|
export class P2PNetworkTest {
|
|
21
|
-
|
|
27
|
+
bootstrapNodeEnr;
|
|
22
28
|
bootNodePort;
|
|
23
29
|
numberOfNodes;
|
|
30
|
+
metricsPort;
|
|
24
31
|
snapshotManager;
|
|
25
32
|
baseAccount;
|
|
26
33
|
logger;
|
|
@@ -30,22 +37,26 @@ export class P2PNetworkTest {
|
|
|
30
37
|
attesterPublicKeys;
|
|
31
38
|
proposerPrivateKeys;
|
|
32
39
|
peerIdPrivateKeys;
|
|
33
|
-
|
|
40
|
+
deployedAccounts;
|
|
41
|
+
prefilledPublicData;
|
|
34
42
|
// The re-execution test needs a wallet and a spam contract
|
|
35
43
|
wallet;
|
|
36
44
|
spamContract;
|
|
45
|
+
bootstrapNode;
|
|
37
46
|
cleanupInterval;
|
|
38
47
|
gasUtils;
|
|
39
|
-
constructor(testName,
|
|
40
|
-
metricsPort
|
|
41
|
-
this.
|
|
48
|
+
constructor(testName, bootstrapNodeEnr, bootNodePort, numberOfNodes, initialValidatorConfig, // If set enable metrics collection
|
|
49
|
+
metricsPort){
|
|
50
|
+
this.bootstrapNodeEnr = bootstrapNodeEnr;
|
|
42
51
|
this.bootNodePort = bootNodePort;
|
|
43
52
|
this.numberOfNodes = numberOfNodes;
|
|
53
|
+
this.metricsPort = metricsPort;
|
|
44
54
|
this.attesterPrivateKeys = [];
|
|
45
55
|
this.attesterPublicKeys = [];
|
|
46
56
|
this.proposerPrivateKeys = [];
|
|
47
57
|
this.peerIdPrivateKeys = [];
|
|
48
|
-
this.
|
|
58
|
+
this.deployedAccounts = [];
|
|
59
|
+
this.prefilledPublicData = [];
|
|
49
60
|
this.cleanupInterval = undefined;
|
|
50
61
|
this.gasUtils = undefined;
|
|
51
62
|
this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
|
|
@@ -54,26 +65,35 @@ export class P2PNetworkTest {
|
|
|
54
65
|
this.proposerPrivateKeys = generatePrivateKeys(PROPOSER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
55
66
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
56
67
|
this.attesterPublicKeys = this.attesterPrivateKeys.map((privateKey)=>privateKeyToAccount(privateKey).address);
|
|
57
|
-
this.bootstrapNodeEnr = bootstrapNode.getENR().encodeTxt();
|
|
58
68
|
this.snapshotManager = createSnapshotManager(`e2e_p2p_network/${testName}`, process.env.E2E_DATA_PATH, {
|
|
59
69
|
...initialValidatorConfig,
|
|
60
|
-
ethereumSlotDuration: l1ContractsConfig.ethereumSlotDuration,
|
|
70
|
+
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
71
|
+
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
72
|
+
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
73
|
+
aztecProofSubmissionWindow: initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
|
|
61
74
|
salt: 420,
|
|
62
|
-
metricsPort: metricsPort
|
|
75
|
+
metricsPort: metricsPort,
|
|
76
|
+
numberOfInitialFundedAccounts: 1
|
|
63
77
|
}, {
|
|
64
78
|
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
80
|
+
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
|
|
81
|
+
aztecProofSubmissionWindow: initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
|
|
67
82
|
initialValidators: []
|
|
68
83
|
});
|
|
69
84
|
}
|
|
70
|
-
static async create({ testName, numberOfNodes, basePort, metricsPort, initialConfig
|
|
85
|
+
static async create({ testName, numberOfNodes, basePort, metricsPort, initialConfig }) {
|
|
71
86
|
const port = basePort || await getPort();
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const bootstrapNodeEnr = bootstrapNode.getENR().encodeTxt();
|
|
87
|
+
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
|
|
88
|
+
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
|
|
75
89
|
const initialValidatorConfig = await createValidatorConfig(initialConfig ?? {}, bootstrapNodeEnr);
|
|
76
|
-
return new P2PNetworkTest(testName,
|
|
90
|
+
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfNodes, initialValidatorConfig, metricsPort);
|
|
91
|
+
}
|
|
92
|
+
get fundedAccount() {
|
|
93
|
+
if (!this.deployedAccounts[0]) {
|
|
94
|
+
throw new Error('Call snapshot t.setupAccount to create a funded account.');
|
|
95
|
+
}
|
|
96
|
+
return this.deployedAccounts[0];
|
|
77
97
|
}
|
|
78
98
|
/**
|
|
79
99
|
* Start a loop to sync the mock system time with the L1 block time
|
|
@@ -100,6 +120,12 @@ export class P2PNetworkTest {
|
|
|
100
120
|
dateProvider.setTime(Number(timestamp.timestamp) * 1000);
|
|
101
121
|
}
|
|
102
122
|
async applyBaseSnapshots() {
|
|
123
|
+
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig })=>{
|
|
124
|
+
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
125
|
+
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(BOOTSTRAP_NODE_PRIVATE_KEY, this.bootNodePort, telemetry, aztecNodeConfig);
|
|
126
|
+
// Overwrite enr with updated info
|
|
127
|
+
this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
|
|
128
|
+
});
|
|
103
129
|
await this.snapshotManager.snapshot('add-validators', async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider })=>{
|
|
104
130
|
const rollup = getContract({
|
|
105
131
|
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
@@ -149,7 +175,7 @@ export class P2PNetworkTest {
|
|
|
149
175
|
const timestamp = await rollup.read.getTimestampForSlot([
|
|
150
176
|
slotsInEpoch
|
|
151
177
|
]);
|
|
152
|
-
const cheatCodes = new EthCheatCodesWithState(aztecNodeConfig.
|
|
178
|
+
const cheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
153
179
|
try {
|
|
154
180
|
await cheatCodes.warp(Number(timestamp));
|
|
155
181
|
} catch (err) {
|
|
@@ -169,12 +195,10 @@ export class P2PNetworkTest {
|
|
|
169
195
|
});
|
|
170
196
|
}
|
|
171
197
|
async setupAccount() {
|
|
172
|
-
await this.snapshotManager.snapshot('setup-account',
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}));
|
|
177
|
-
this.wallet = wallets[0];
|
|
198
|
+
await this.snapshotManager.snapshot('setup-account', deployAccounts(1, this.logger, false), async ({ deployedAccounts }, { pxe })=>{
|
|
199
|
+
this.deployedAccounts = deployedAccounts;
|
|
200
|
+
const [account] = deployedAccounts;
|
|
201
|
+
this.wallet = await getSchnorrWalletWithSecretKey(pxe, account.secret, account.signingKey, account.salt);
|
|
178
202
|
});
|
|
179
203
|
}
|
|
180
204
|
async deploySpamContract() {
|
|
@@ -212,6 +236,7 @@ export class P2PNetworkTest {
|
|
|
212
236
|
}
|
|
213
237
|
async setup() {
|
|
214
238
|
this.ctx = await this.snapshotManager.setup();
|
|
239
|
+
this.prefilledPublicData = (await getGenesisValues(this.ctx.initialFundedAccounts.map((a)=>a.address))).prefilledPublicData;
|
|
215
240
|
this.startSyncMockSystemTimeInterval();
|
|
216
241
|
this.gasUtils = new L1TxUtilsWithBlobs(this.ctx.deployL1ContractsValues.publicClient, this.ctx.deployL1ContractsValues.walletClient, this.logger, {
|
|
217
242
|
gasLimitBufferPercentage: 20,
|
|
@@ -221,8 +246,7 @@ export class P2PNetworkTest {
|
|
|
221
246
|
checkIntervalMs: 100,
|
|
222
247
|
stallTimeMs: 1000
|
|
223
248
|
});
|
|
224
|
-
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues));
|
|
225
|
-
this.monitor.start();
|
|
249
|
+
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
|
|
226
250
|
}
|
|
227
251
|
async stopNodes(nodes) {
|
|
228
252
|
this.logger.info('Stopping nodes');
|
|
@@ -235,7 +259,7 @@ export class P2PNetworkTest {
|
|
|
235
259
|
}
|
|
236
260
|
async teardown() {
|
|
237
261
|
this.monitor.stop();
|
|
238
|
-
await this.bootstrapNode
|
|
262
|
+
await this.bootstrapNode?.stop();
|
|
239
263
|
await this.snapshotManager.teardown();
|
|
240
264
|
if (this.cleanupInterval) {
|
|
241
265
|
clearInterval(this.cleanupInterval);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
+
import { type Logger, type SentTx } from '@aztec/aztec.js';
|
|
4
|
+
import type { SpamContract } from '@aztec/noir-contracts.js/Spam';
|
|
5
|
+
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
6
|
+
export declare const submitComplexTxsTo: (logger: Logger, spamContract: SpamContract, numTxs: number, opts?: {
|
|
7
|
+
callPublic?: boolean;
|
|
8
|
+
}) => Promise<SentTx[]>;
|
|
9
|
+
export declare const createPXEServiceAndSubmitTransactions: (logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData) => Promise<NodeContext>;
|
|
10
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,kBAAkB,WACrB,MAAM,gBACA,YAAY,UAClB,MAAM,SACR;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,sBAwB/B,CAAC;AAGF,eAAO,MAAM,qCAAqC,WACxC,MAAM,QACR,gBAAgB,UACd,MAAM,iBACC,kBAAkB,KAChC,QAAQ,WAAW,CAmBrB,CAAC"}
|
package/dest/e2e_p2p/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { TxStatus } from '@aztec/aztec.js';
|
|
3
3
|
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe';
|
|
4
4
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
5
5
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
@@ -24,16 +24,15 @@ export const submitComplexTxsTo = async (logger, spamContract, numTxs, opts = {}
|
|
|
24
24
|
return txs;
|
|
25
25
|
};
|
|
26
26
|
// creates an instance of the PXE and submit a given number of transactions to it.
|
|
27
|
-
export const createPXEServiceAndSubmitTransactions = async (logger, node, numTxs)=>{
|
|
27
|
+
export const createPXEServiceAndSubmitTransactions = async (logger, node, numTxs, fundedAccount)=>{
|
|
28
28
|
const rpcConfig = getRpcConfig();
|
|
29
29
|
const pxeService = await createPXEService(node, rpcConfig, true);
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
await
|
|
33
|
-
const txs = await submitTxsTo(pxeService, numTxs, logger);
|
|
30
|
+
const account = await getSchnorrAccount(pxeService, fundedAccount.secret, fundedAccount.signingKey, fundedAccount.salt);
|
|
31
|
+
await account.register();
|
|
32
|
+
const wallet = await account.getWallet();
|
|
33
|
+
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
34
34
|
return {
|
|
35
35
|
txs,
|
|
36
|
-
account: completeAddress.address,
|
|
37
36
|
pxeService,
|
|
38
37
|
node
|
|
39
38
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
+
import { type AccountWalletWithSecretKey, type AztecNode, type CheatCodes, type CompleteAddress, type DeployL1ContractsReturnType, EthAddress, type Logger } from '@aztec/aztec.js';
|
|
3
|
+
import { type ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
4
|
+
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
5
|
+
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
|
+
import type { PXEService } from '@aztec/pxe';
|
|
7
|
+
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
8
|
+
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
9
|
+
/**
|
|
10
|
+
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
11
|
+
* However, we then setup a second PXE with a full prover instance.
|
|
12
|
+
* We configure this instance with all of the accounts and contracts.
|
|
13
|
+
* We then prove and verify transactions created via this full prover PXE.
|
|
14
|
+
*/
|
|
15
|
+
export declare class FullProverTest {
|
|
16
|
+
private minNumberOfTxsPerBlock;
|
|
17
|
+
private realProofs;
|
|
18
|
+
static TOKEN_NAME: string;
|
|
19
|
+
static TOKEN_SYMBOL: string;
|
|
20
|
+
static TOKEN_DECIMALS: bigint;
|
|
21
|
+
private snapshotManager;
|
|
22
|
+
logger: Logger;
|
|
23
|
+
deployedAccounts: InitialAccountData[];
|
|
24
|
+
wallets: AccountWalletWithSecretKey[];
|
|
25
|
+
accounts: CompleteAddress[];
|
|
26
|
+
fakeProofsAsset: TokenContract;
|
|
27
|
+
tokenSim: TokenSimulator;
|
|
28
|
+
aztecNode: AztecNode;
|
|
29
|
+
pxe: PXEService;
|
|
30
|
+
cheatCodes: CheatCodes;
|
|
31
|
+
blobSink: BlobSinkServer;
|
|
32
|
+
private provenComponents;
|
|
33
|
+
private bbConfigCleanup?;
|
|
34
|
+
private acvmConfigCleanup?;
|
|
35
|
+
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
36
|
+
provenAssets: TokenContract[];
|
|
37
|
+
private context;
|
|
38
|
+
private proverNode;
|
|
39
|
+
private simulatedProverNode;
|
|
40
|
+
l1Contracts: DeployL1ContractsReturnType;
|
|
41
|
+
proverAddress: EthAddress;
|
|
42
|
+
constructor(testName: string, minNumberOfTxsPerBlock: number, coinbase: EthAddress, realProofs?: boolean);
|
|
43
|
+
/**
|
|
44
|
+
* Adds two state shifts to snapshot manager.
|
|
45
|
+
* 1. Add 2 accounts.
|
|
46
|
+
* 2. Publicly deploy accounts, deploy token contract
|
|
47
|
+
*/
|
|
48
|
+
applyBaseSnapshots(): Promise<void>;
|
|
49
|
+
setup(): Promise<this>;
|
|
50
|
+
private mintL1ERC20;
|
|
51
|
+
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
52
|
+
teardown(): Promise<void>;
|
|
53
|
+
applyMintSnapshot(): Promise<void>;
|
|
54
|
+
deployVerifier(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=e2e_prover_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/e2e_prover/e2e_prover_test.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,UAAU,EACV,KAAK,MAAM,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK,6BAA6B,EAAuB,MAAM,kBAAkB,CAAC;AAE9G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ7C,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AASlE;;;;;GAKG;AAEH,qBAAa,cAAc;IA4BvB,OAAO,CAAC,sBAAsB;IAE9B,OAAO,CAAC,UAAU;IA7BpB,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAC5C,OAAO,EAAE,0BAA0B,EAAE,CAAM;IAC3C,QAAQ,EAAE,eAAe,EAAE,CAAM;IACjC,eAAe,EAAG,aAAa,CAAC;IAChC,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,GAAG,EAAG,UAAU,CAAC;IACjB,UAAU,EAAG,UAAU,CAAC;IACxB,QAAQ,EAAG,cAAc,CAAC;IAC1B,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAsB;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;IACrD,YAAY,EAAE,aAAa,EAAE,CAAM;IACnC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,mBAAmB,CAAc;IAClC,WAAW,EAAG,2BAA2B,CAAC;IAC1C,aAAa,EAAG,UAAU,CAAC;gBAGhC,QAAQ,EAAE,MAAM,EACR,sBAAsB,EAAE,MAAM,EACtC,QAAQ,EAAE,UAAU,EACZ,UAAU,UAAO;IAW3B;;;;OAIG;IACG,kBAAkB;IAqDlB,KAAK;YA0JG,WAAW;IAQzB,QAAQ,YACA,MAAM,SACL,CAAC,OAAO,EAAE,iBAAiB,KAAK,QAAQ,CAAC,CAAC,YACxC,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,QAAQ,IAAI,CAAC,KACtE,QAAQ,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAeR,iBAAiB;IAiDjB,cAAc;CA4BrB"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { SchnorrAccountContractArtifact, getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
1
|
+
import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { createArchiver } from '@aztec/archiver';
|
|
3
|
-
import { EthAddress,
|
|
3
|
+
import { EthAddress, createLogger, deployL1Contract } from '@aztec/aztec.js';
|
|
4
4
|
import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
5
5
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
6
6
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
7
7
|
import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
8
8
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
9
9
|
import { createProverNode } from '@aztec/prover-node';
|
|
10
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
10
11
|
import { getContract } from 'viem';
|
|
11
12
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
12
13
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
13
14
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
14
|
-
import {
|
|
15
|
+
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
15
16
|
import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
|
|
16
17
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
17
18
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
18
|
-
const SALT = 1;
|
|
19
19
|
/**
|
|
20
20
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
21
21
|
* However, we then setup a second PXE with a full prover instance.
|
|
@@ -29,7 +29,7 @@ const SALT = 1;
|
|
|
29
29
|
static TOKEN_DECIMALS = 18n;
|
|
30
30
|
snapshotManager;
|
|
31
31
|
logger;
|
|
32
|
-
|
|
32
|
+
deployedAccounts;
|
|
33
33
|
wallets;
|
|
34
34
|
accounts;
|
|
35
35
|
fakeProofsAsset;
|
|
@@ -51,7 +51,7 @@ const SALT = 1;
|
|
|
51
51
|
constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
|
|
52
52
|
this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
|
|
53
53
|
this.realProofs = realProofs;
|
|
54
|
-
this.
|
|
54
|
+
this.deployedAccounts = [];
|
|
55
55
|
this.wallets = [];
|
|
56
56
|
this.accounts = [];
|
|
57
57
|
this.provenComponents = [];
|
|
@@ -62,21 +62,16 @@ const SALT = 1;
|
|
|
62
62
|
startProverNode: true,
|
|
63
63
|
fundRewardDistributor: true,
|
|
64
64
|
coinbase
|
|
65
|
-
}, {
|
|
66
|
-
assumeProvenThrough: undefined
|
|
67
|
-
});
|
|
65
|
+
}, {});
|
|
68
66
|
}
|
|
69
67
|
/**
|
|
70
68
|
* Adds two state shifts to snapshot manager.
|
|
71
69
|
* 1. Add 2 accounts.
|
|
72
70
|
* 2. Publicly deploy accounts, deploy token contract
|
|
73
71
|
*/ async applyBaseSnapshots() {
|
|
74
|
-
await this.snapshotManager.snapshot('2_accounts',
|
|
75
|
-
this.
|
|
76
|
-
this.wallets = await Promise.all(
|
|
77
|
-
const account = await getSchnorrAccount(pxe, ak[0], ak[1], SALT);
|
|
78
|
-
return account.getWallet();
|
|
79
|
-
}));
|
|
72
|
+
await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
73
|
+
this.deployedAccounts = deployedAccounts;
|
|
74
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)));
|
|
80
75
|
this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
|
|
81
76
|
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
82
77
|
});
|
|
@@ -101,6 +96,8 @@ const SALT = 1;
|
|
|
101
96
|
}
|
|
102
97
|
async setup() {
|
|
103
98
|
this.context = await this.snapshotManager.setup();
|
|
99
|
+
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
100
|
+
this.context.watcher.setIsMarkingAsProven(false);
|
|
104
101
|
this.simulatedProverNode = this.context.proverNode;
|
|
105
102
|
({ pxe: this.pxe, aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
|
|
106
103
|
const blobSinkClient = createBlobSinkClient({
|
|
@@ -149,10 +146,10 @@ const SALT = 1;
|
|
|
149
146
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
150
147
|
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
151
148
|
for(let i = 0; i < 2; i++){
|
|
152
|
-
await result.pxe.registerAccount(this.
|
|
153
|
-
await this.pxe.registerAccount(this.
|
|
149
|
+
await result.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
|
|
150
|
+
await this.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
|
|
154
151
|
}
|
|
155
|
-
const account = await getSchnorrAccount(result.pxe, this.
|
|
152
|
+
const account = await getSchnorrAccount(result.pxe, this.deployedAccounts[0].secret, this.deployedAccounts[0].signingKey, this.deployedAccounts[0].salt);
|
|
156
153
|
await result.pxe.registerContract({
|
|
157
154
|
instance: account.getInstance(),
|
|
158
155
|
artifact: SchnorrAccountContractArtifact
|
|
@@ -188,27 +185,26 @@ const SALT = 1;
|
|
|
188
185
|
...this.context.aztecNodeConfig,
|
|
189
186
|
proverCoordinationNodeUrl: undefined,
|
|
190
187
|
dataDirectory: undefined,
|
|
191
|
-
proverId:
|
|
188
|
+
proverId: this.proverAddress.toField(),
|
|
192
189
|
realProofs: this.realProofs,
|
|
193
190
|
proverAgentCount: 2,
|
|
194
191
|
publisherPrivateKey: `0x${proverNodePrivateKey.toString('hex')}`,
|
|
195
192
|
proverNodeMaxPendingJobs: 100,
|
|
196
193
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
197
194
|
proverNodePollingIntervalMs: 100,
|
|
198
|
-
quoteProviderBasisPointFee: 100,
|
|
199
|
-
quoteProviderBondAmount: 1000n,
|
|
200
|
-
proverMinimumEscrowAmount: 3000n,
|
|
201
|
-
proverTargetEscrowAmount: 6000n,
|
|
202
195
|
txGatheringTimeoutMs: 60000,
|
|
203
196
|
txGatheringIntervalMs: 1000,
|
|
204
197
|
txGatheringMaxParallelRequests: 100
|
|
205
198
|
};
|
|
199
|
+
const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map((a)=>a.address));
|
|
206
200
|
this.proverNode = await createProverNode(proverConfig, {
|
|
207
201
|
aztecNodeTxProvider: this.aztecNode,
|
|
208
202
|
archiver: archiver,
|
|
209
203
|
blobSinkClient
|
|
204
|
+
}, {
|
|
205
|
+
prefilledPublicData
|
|
210
206
|
});
|
|
211
|
-
|
|
207
|
+
this.proverNode.start();
|
|
212
208
|
this.logger.warn(`Proofs are now enabled`);
|
|
213
209
|
return this;
|
|
214
210
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type AccountWallet, type CompleteAddress, type Logger } from '@aztec/aztec.js';
|
|
2
|
+
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
3
|
+
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
|
+
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
5
|
+
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
6
|
+
export declare class TokenContractTest {
|
|
7
|
+
static TOKEN_NAME: string;
|
|
8
|
+
static TOKEN_SYMBOL: string;
|
|
9
|
+
static TOKEN_DECIMALS: bigint;
|
|
10
|
+
private snapshotManager;
|
|
11
|
+
logger: Logger;
|
|
12
|
+
wallets: AccountWallet[];
|
|
13
|
+
accounts: CompleteAddress[];
|
|
14
|
+
asset: TokenContract;
|
|
15
|
+
tokenSim: TokenSimulator;
|
|
16
|
+
badAccount: DocsExampleContract;
|
|
17
|
+
constructor(testName: string);
|
|
18
|
+
/**
|
|
19
|
+
* Adds two state shifts to snapshot manager.
|
|
20
|
+
* 1. Add 3 accounts.
|
|
21
|
+
* 2. Publicly deploy accounts, deploy token contract and a "bad account".
|
|
22
|
+
*/
|
|
23
|
+
applyBaseSnapshots(): Promise<void>;
|
|
24
|
+
setup(): Promise<void>;
|
|
25
|
+
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
26
|
+
teardown(): Promise<void>;
|
|
27
|
+
applyMintSnapshot(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=token_contract_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIlE,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,EAAE,CAAM;IAC9B,QAAQ,EAAE,eAAe,EAAE,CAAM;IACjC,KAAK,EAAG,aAAa,CAAC;IACtB,QAAQ,EAAG,cAAc,CAAC;IAC1B,UAAU,EAAG,mBAAmB,CAAC;gBAErB,QAAQ,EAAE,MAAM;IAO5B;;;;OAIG;IACG,kBAAkB;IAgElB,KAAK;IAIX,QAAQ,YACA,MAAM,SACL,CAAC,OAAO,EAAE,iBAAiB,KAAK,QAAQ,CAAC,CAAC,YACxC,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,QAAQ,IAAI,CAAC,KACtE,QAAQ,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAIR,iBAAiB;CAyCxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { 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';
|
|
5
5
|
import { jest } from '@jest/globals';
|
|
6
|
-
import {
|
|
6
|
+
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
7
7
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
8
8
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
9
9
|
const { E2E_DATA_PATH: dataPath, METRICS_PORT: metricsPort } = process.env;
|
|
@@ -31,11 +31,8 @@ export class TokenContractTest {
|
|
|
31
31
|
*/ async applyBaseSnapshots() {
|
|
32
32
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
33
33
|
jest.setTimeout(120_000);
|
|
34
|
-
await this.snapshotManager.snapshot('3_accounts',
|
|
35
|
-
this.wallets = await Promise.all(
|
|
36
|
-
const account = await getSchnorrAccount(pxe, ak[0], ak[1], 1);
|
|
37
|
-
return account.getWallet();
|
|
38
|
-
}));
|
|
34
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
35
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
39
36
|
this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
|
|
40
37
|
});
|
|
41
38
|
await this.snapshotManager.snapshot('e2e_token_contract', async ()=>{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
export declare const METRICS_PORT = 4318;
|
|
4
|
+
export declare const shouldCollectMetrics: () => 4318 | undefined;
|
|
5
|
+
export declare const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
6
|
+
export declare const MNEMONIC = "test test test test test test test test test test test junk";
|
|
7
|
+
export declare const privateKey: Buffer;
|
|
8
|
+
export declare const privateKey2: Buffer;
|
|
9
|
+
export declare const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
|
|
10
|
+
export declare const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
|
|
11
|
+
export declare const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
12
|
+
export declare const DUPLICATE_NULLIFIER_ERROR: RegExp;
|
|
13
|
+
export declare const NO_L1_TO_L2_MSG_ERROR: RegExp;
|
|
14
|
+
export declare const STATIC_CALL_STATE_MODIFICATION_ERROR: RegExp;
|
|
15
|
+
export declare const STATIC_CONTEXT_ASSERTION_ERROR: RegExp;
|
|
16
|
+
export declare const DEFAULT_BLOB_SINK_PORT = "5052";
|
|
17
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":";;AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,QAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,QAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,uEAAuE,CAAC;AACzG,eAAO,MAAM,mBAAmB,kEAAkE,CAAC;AACnG,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAA6D,CAAC;AACpG,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAC+B,CAAC;AACjF,eAAO,MAAM,8BAA8B,QAAkE,CAAC;AAE9G,eAAO,MAAM,sBAAsB,SAAS,CAAC"}
|
|
@@ -10,8 +10,8 @@ export const MNEMONIC = 'test test test test test test test test test test test
|
|
|
10
10
|
export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
|
|
11
11
|
export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
|
|
12
12
|
/// Common errors
|
|
13
|
-
export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
|
|
14
|
-
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow '
|
|
13
|
+
export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow 'self - other'";
|
|
14
|
+
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
|
|
15
15
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
16
16
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
17
17
|
export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
+
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
3
|
+
export declare function getACVMConfig(logger: Logger): Promise<{
|
|
4
|
+
acvmWorkingDirectory: string;
|
|
5
|
+
acvmBinaryPath: string;
|
|
6
|
+
cleanup: () => Promise<void>;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
//# sourceMappingURL=get_acvm_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAM9C,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAkCA"}
|
|
@@ -20,11 +20,16 @@ export async function getACVMConfig(logger) {
|
|
|
20
20
|
const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
|
|
21
21
|
const cleanup = async ()=>{
|
|
22
22
|
if (directoryToCleanup) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
try {
|
|
24
|
+
logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
|
|
25
|
+
await fs.rm(directoryToCleanup, {
|
|
26
|
+
recursive: true,
|
|
27
|
+
force: true,
|
|
28
|
+
maxRetries: 3
|
|
29
|
+
});
|
|
30
|
+
} catch (err) {
|
|
31
|
+
logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
};
|
|
30
35
|
return {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Logger } from '@aztec/aztec.js';
|
|
2
|
+
import type { BBConfig } from '@aztec/bb-prover';
|
|
3
|
+
export declare const getBBConfig: (logger: Logger) => Promise<(BBConfig & {
|
|
4
|
+
cleanup: () => Promise<void>;
|
|
5
|
+
}) | undefined>;
|
|
6
|
+
//# sourceMappingURL=get_bb_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAcjD,eAAO,MAAM,WAAW,WACd,MAAM,KACb,QAAQ,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,QAAQ,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAoCnE,CAAC"}
|
|
@@ -24,10 +24,15 @@ export const getBBConfig = async (logger)=>{
|
|
|
24
24
|
].includes(BB_SKIP_CLEANUP);
|
|
25
25
|
const cleanup = async ()=>{
|
|
26
26
|
if (directoryToCleanup && !bbSkipCleanup) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
try {
|
|
28
|
+
await fs.rm(directoryToCleanup, {
|
|
29
|
+
recursive: true,
|
|
30
|
+
force: true,
|
|
31
|
+
maxRetries: 3
|
|
32
|
+
});
|
|
33
|
+
} catch (err) {
|
|
34
|
+
logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
};
|
|
33
38
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { L1ContractAddresses, ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
export declare function sendL1ToL2Message(message: {
|
|
5
|
+
recipient: AztecAddress;
|
|
6
|
+
content: Fr;
|
|
7
|
+
secretHash: Fr;
|
|
8
|
+
}, ctx: {
|
|
9
|
+
walletClient: ViemWalletClient;
|
|
10
|
+
publicClient: ViemPublicClient;
|
|
11
|
+
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
|
|
12
|
+
}): Promise<Fr[]>;
|
|
13
|
+
//# sourceMappingURL=l1_to_l2_messaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;CAChE,iBAmCF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Returns whether metrics logging should be enabled by default, checking env vars CI and BENCHMARK. */
|
|
2
|
+
export declare function isMetricsLoggingRequested(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Configures an NDJSON logger to output entries to a local file that have an `eventName` associated.
|
|
5
|
+
* Idempotent and automatically called by `setup` if CI or BENCHMARK env vars are set.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupMetricsLogger(filename: string): void;
|
|
8
|
+
//# sourceMappingURL=logging.d.ts.map
|