@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +60 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -27
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -43
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +66 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
- 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 +34 -53
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -6
- package/dest/e2e_epochs/epochs_test.d.ts +56 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +222 -42
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts +16 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +87 -88
- package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +132 -0
- package/dest/e2e_p2p/p2p_network.d.ts +56 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +154 -125
- package/dest/e2e_p2p/shared.d.ts +41 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +146 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +51 -24
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +8 -15
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +14 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +8 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +120 -104
- package/dest/fixtures/token_utils.d.ts +4 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +24 -7
- package/dest/fixtures/utils.d.ts +65 -22
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +439 -318
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +42 -0
- package/dest/shared/cross_chain_test_harness.d.ts +28 -18
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +97 -41
- package/dest/shared/gas_portal_test_harness.d.ts +23 -18
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +43 -25
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +5 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +136 -90
- package/dest/simulators/lending_simulator.d.ts +5 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +11 -15
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -22
- package/dest/spartan/utils.d.ts +60 -307
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +200 -115
- package/package.json +60 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +26 -52
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
- package/src/e2e_deploy_contract/deploy_test.ts +11 -8
- package/src/e2e_epochs/epochs_test.ts +276 -54
- package/src/e2e_fees/bridging_race.notest.ts +75 -0
- package/src/e2e_fees/fees_test.ts +121 -108
- package/src/e2e_l1_publisher/write_json.ts +74 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
- package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
- package/src/e2e_p2p/p2p_network.ts +212 -144
- package/src/e2e_p2p/shared.ts +234 -14
- package/src/e2e_token_contract/token_contract_test.ts +42 -38
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +2 -10
- package/src/fixtures/get_bb_config.ts +15 -11
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +5 -6
- package/src/fixtures/setup_p2p_test.ts +112 -30
- package/src/fixtures/snapshot_manager.ts +150 -102
- package/src/fixtures/token_utils.ts +33 -8
- package/src/fixtures/utils.ts +530 -352
- package/src/fixtures/web3signer.ts +46 -0
- package/src/guides/up_quick_start.sh +4 -4
- package/src/shared/cross_chain_test_harness.ts +92 -52
- package/src/shared/gas_portal_test_harness.ts +47 -31
- package/src/shared/uniswap_l1_l2.ts +127 -124
- package/src/simulators/lending_simulator.ts +11 -15
- package/src/simulators/token_simulator.ts +17 -12
- package/src/spartan/DEVELOP.md +116 -0
- package/src/spartan/setup_test_wallets.ts +144 -29
- package/src/spartan/utils.ts +194 -116
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { deployFundedSchnorrAccounts, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { BatchCall, DefaultWaitForProvenOpts, EthAddress, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js';
|
|
5
|
+
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
6
|
+
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
6
7
|
import { createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
7
|
-
import {
|
|
8
|
+
import { createExtendedL1Client, deployMulticall3, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
8
9
|
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
9
10
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
11
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
10
12
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
13
|
+
import { tryRmDir } from '@aztec/foundation/fs';
|
|
11
14
|
import { createLogger } from '@aztec/foundation/log';
|
|
12
15
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
13
16
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
14
17
|
import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
18
|
+
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
15
19
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
16
20
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
17
21
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
@@ -20,13 +24,13 @@ import fs from 'fs/promises';
|
|
|
20
24
|
import getPort from 'get-port';
|
|
21
25
|
import { tmpdir } from 'os';
|
|
22
26
|
import path, { join } from 'path';
|
|
23
|
-
import { getContract } from 'viem';
|
|
24
27
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
25
|
-
import {
|
|
28
|
+
import { foundry } from 'viem/chains';
|
|
29
|
+
import { MNEMONIC, TEST_MAX_TX_POOL_SIZE, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
26
30
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
27
31
|
import { getBBConfig } from './get_bb_config.js';
|
|
28
32
|
import { setupL1Contracts } from './setup_l1_contracts.js';
|
|
29
|
-
import { createAndSyncProverNode, getLogger, getPrivateKeyFromIndex } from './utils.js';
|
|
33
|
+
import { createAndSyncProverNode, getLogger, getPrivateKeyFromIndex, getSponsoredFPCAddress } from './utils.js';
|
|
30
34
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
31
35
|
export function createSnapshotManager(testName, dataPath, config = {}, deployL1ContractsArgs = {
|
|
32
36
|
initialValidators: []
|
|
@@ -176,28 +180,19 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
176
180
|
if (!context) {
|
|
177
181
|
return;
|
|
178
182
|
}
|
|
183
|
+
const logger = getLogger();
|
|
179
184
|
try {
|
|
180
|
-
|
|
181
|
-
await context.proverNode
|
|
182
|
-
await context.aztecNode
|
|
185
|
+
logger.info('Tearing down subsystems');
|
|
186
|
+
await tryStop(context.proverNode);
|
|
187
|
+
await tryStop(context.aztecNode);
|
|
183
188
|
await context.acvmConfig?.cleanup();
|
|
184
189
|
await context.bbConfig?.cleanup();
|
|
185
|
-
await context.anvil
|
|
186
|
-
await context.watcher
|
|
187
|
-
await context.blobSink
|
|
188
|
-
|
|
189
|
-
try {
|
|
190
|
-
await fs.rm(context.directoryToCleanup, {
|
|
191
|
-
recursive: true,
|
|
192
|
-
force: true,
|
|
193
|
-
maxRetries: 3
|
|
194
|
-
});
|
|
195
|
-
} catch (err) {
|
|
196
|
-
getLogger().warn(`Failed to delete tmp directory ${context.directoryToCleanup}: ${err}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
190
|
+
await tryStop(context.anvil);
|
|
191
|
+
await tryStop(context.watcher);
|
|
192
|
+
await tryStop(context.blobSink);
|
|
193
|
+
await tryRmDir(context.directoryToCleanup, logger);
|
|
199
194
|
} catch (err) {
|
|
200
|
-
|
|
195
|
+
logger.error('Error during teardown', err);
|
|
201
196
|
}
|
|
202
197
|
}
|
|
203
198
|
/**
|
|
@@ -209,6 +204,9 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
209
204
|
}) {
|
|
210
205
|
logger.verbose(`Initializing state...`);
|
|
211
206
|
const blobSinkPort = await getPort();
|
|
207
|
+
// Default to no slashing
|
|
208
|
+
opts.slasherFlavor ??= 'none';
|
|
209
|
+
deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;
|
|
212
210
|
// Fetch the AztecNode config.
|
|
213
211
|
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
|
|
214
212
|
const aztecNodeConfig = {
|
|
@@ -216,6 +214,15 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
216
214
|
...opts
|
|
217
215
|
};
|
|
218
216
|
aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
217
|
+
aztecNodeConfig.maxTxPoolSize = opts.maxTxPoolSize ?? TEST_MAX_TX_POOL_SIZE;
|
|
218
|
+
// Only enable proving if specifically requested.
|
|
219
|
+
aztecNodeConfig.realProofs = !!opts.realProofs;
|
|
220
|
+
// Only enforce the time table if requested
|
|
221
|
+
aztecNodeConfig.enforceTimeTable = !!opts.enforceTimeTable;
|
|
222
|
+
// Only set the target committee size if it is explicitly set
|
|
223
|
+
aztecNodeConfig.aztecTargetCommitteeSize = opts.aztecTargetCommitteeSize ?? 0;
|
|
224
|
+
aztecNodeConfig.listenAddress = '127.0.0.1';
|
|
225
|
+
deployL1ContractsArgs.aztecTargetCommitteeSize ??= aztecNodeConfig.aztecTargetCommitteeSize;
|
|
219
226
|
// Create a temp directory for all ephemeral state and cleanup afterwards
|
|
220
227
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
221
228
|
await fs.mkdir(directoryToCleanup, {
|
|
@@ -226,16 +233,25 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
226
233
|
} else {
|
|
227
234
|
aztecNodeConfig.dataDirectory = statePath;
|
|
228
235
|
}
|
|
229
|
-
aztecNodeConfig.blobSinkUrl = `http://
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
port: blobSinkPort,
|
|
233
|
-
dataStoreConfig: {
|
|
234
|
-
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
235
|
-
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
|
|
236
|
-
}
|
|
236
|
+
aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
|
|
237
|
+
const hdAccount = mnemonicToAccount(MNEMONIC, {
|
|
238
|
+
addressIndex: 0
|
|
237
239
|
});
|
|
238
|
-
|
|
240
|
+
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
241
|
+
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
242
|
+
const l1Client = createExtendedL1Client([
|
|
243
|
+
aztecNodeConfig.l1RpcUrls[0]
|
|
244
|
+
], hdAccount, foundry);
|
|
245
|
+
const validatorPrivKey = getPrivateKeyFromIndex(0);
|
|
246
|
+
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
247
|
+
aztecNodeConfig.publisherPrivateKeys = [
|
|
248
|
+
new SecretValue(`0x${publisherPrivKey.toString('hex')}`)
|
|
249
|
+
];
|
|
250
|
+
aztecNodeConfig.validatorPrivateKeys = new SecretValue([
|
|
251
|
+
`0x${validatorPrivKey.toString('hex')}`
|
|
252
|
+
]);
|
|
253
|
+
aztecNodeConfig.coinbase = opts.coinbase ?? EthAddress.fromString(`${hdAccount.address}`);
|
|
254
|
+
logger.info(`Setting up environment with config`, aztecNodeConfig);
|
|
239
255
|
// Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
|
|
240
256
|
logger.verbose('Starting anvil...');
|
|
241
257
|
const res = await startAnvil({
|
|
@@ -245,57 +261,30 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
245
261
|
aztecNodeConfig.l1RpcUrls = [
|
|
246
262
|
res.rpcUrl
|
|
247
263
|
];
|
|
264
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
248
265
|
// Deploy our L1 contracts.
|
|
249
266
|
logger.verbose('Deploying L1 contracts...');
|
|
250
|
-
const hdAccount = mnemonicToAccount(MNEMONIC, {
|
|
251
|
-
accountIndex: 0
|
|
252
|
-
});
|
|
253
|
-
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
254
|
-
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
255
|
-
const validatorPrivKey = getPrivateKeyFromIndex(0);
|
|
256
|
-
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
257
|
-
aztecNodeConfig.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
|
|
258
|
-
aztecNodeConfig.validatorPrivateKey = `0x${validatorPrivKey.toString('hex')}`;
|
|
259
|
-
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
260
267
|
if (opts.l1StartTime) {
|
|
261
|
-
await ethCheatCodes.warp(opts.l1StartTime
|
|
268
|
+
await ethCheatCodes.warp(opts.l1StartTime, {
|
|
269
|
+
resetBlockInterval: true
|
|
270
|
+
});
|
|
262
271
|
}
|
|
263
272
|
const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
|
|
264
|
-
const
|
|
273
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
274
|
+
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address).concat(sponsoredFPCAddress), opts.initialAccountFeeJuice);
|
|
275
|
+
await deployMulticall3(l1Client, logger);
|
|
265
276
|
const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
|
|
266
277
|
...getL1ContractsConfigEnvVars(),
|
|
267
278
|
genesisArchiveRoot,
|
|
268
|
-
|
|
279
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
269
280
|
salt: opts.salt,
|
|
270
281
|
...deployL1ContractsArgs,
|
|
271
282
|
initialValidators: opts.initialValidators
|
|
272
283
|
});
|
|
273
284
|
aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
274
|
-
aztecNodeConfig.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const rewardDistributor = getContract({
|
|
278
|
-
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
279
|
-
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
280
|
-
client: deployL1ContractsValues.publicClient
|
|
281
|
-
});
|
|
282
|
-
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
283
|
-
const mintAmount = 10_000n * blockReward;
|
|
284
|
-
const feeJuice = getContract({
|
|
285
|
-
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
286
|
-
abi: l1Artifacts.feeAsset.contractAbi,
|
|
287
|
-
client: deployL1ContractsValues.walletClient
|
|
288
|
-
});
|
|
289
|
-
const rewardDistributorMintTxHash = await feeJuice.write.mint([
|
|
290
|
-
rewardDistributor.address,
|
|
291
|
-
mintAmount
|
|
292
|
-
], {});
|
|
293
|
-
await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
|
|
294
|
-
hash: rewardDistributorMintTxHash
|
|
295
|
-
});
|
|
296
|
-
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
297
|
-
}
|
|
298
|
-
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.publicClient);
|
|
285
|
+
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
286
|
+
const dateProvider = new TestDateProvider();
|
|
287
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
299
288
|
await watcher.start();
|
|
300
289
|
const acvmConfig = await getACVMConfig(logger);
|
|
301
290
|
if (acvmConfig) {
|
|
@@ -308,8 +297,17 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
308
297
|
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
309
298
|
}
|
|
310
299
|
const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
311
|
-
|
|
312
|
-
const
|
|
300
|
+
// Setup blob sink service
|
|
301
|
+
const blobSink = await createBlobSinkServer({
|
|
302
|
+
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
303
|
+
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
304
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
305
|
+
port: blobSinkPort,
|
|
306
|
+
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
307
|
+
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb
|
|
308
|
+
}, telemetry);
|
|
309
|
+
await blobSink.start();
|
|
310
|
+
logger.info('Creating and synching an aztec node...');
|
|
313
311
|
const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
|
|
314
312
|
telemetry,
|
|
315
313
|
dateProvider
|
|
@@ -318,12 +316,18 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
318
316
|
});
|
|
319
317
|
let proverNode = undefined;
|
|
320
318
|
if (opts.startProverNode) {
|
|
321
|
-
logger.verbose('Creating and syncing a simulated prover node...');
|
|
322
|
-
proverNode = await createAndSyncProverNode(`0x${proverNodePrivateKey.toString('hex')}`, aztecNodeConfig,
|
|
319
|
+
logger.verbose('Creating and syncing a simulated prover node with p2p disabled...');
|
|
320
|
+
proverNode = await createAndSyncProverNode(`0x${proverNodePrivateKey.toString('hex')}`, aztecNodeConfig, {
|
|
321
|
+
...aztecNodeConfig.proverNodeConfig,
|
|
322
|
+
dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')),
|
|
323
|
+
p2pEnabled: false
|
|
324
|
+
}, aztecNode, prefilledPublicData);
|
|
323
325
|
}
|
|
324
326
|
logger.verbose('Creating pxe...');
|
|
325
327
|
const pxeConfig = getPXEServiceConfig();
|
|
326
328
|
pxeConfig.dataDirectory = statePath ?? path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
329
|
+
// Only enable proving if specifically requested.
|
|
330
|
+
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
327
331
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
328
332
|
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
329
333
|
if (statePath) {
|
|
@@ -335,6 +339,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
335
339
|
anvil,
|
|
336
340
|
aztecNode,
|
|
337
341
|
pxe,
|
|
342
|
+
sequencer: aztecNode.getSequencer(),
|
|
338
343
|
acvmConfig,
|
|
339
344
|
bbConfig,
|
|
340
345
|
deployL1ContractsValues,
|
|
@@ -361,16 +366,9 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
361
366
|
const aztecNodeConfig = JSON.parse(readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'), reviver);
|
|
362
367
|
aztecNodeConfig.dataDirectory = statePath;
|
|
363
368
|
aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
|
|
369
|
+
aztecNodeConfig.listenAddress = '127.0.0.1';
|
|
364
370
|
const initialFundedAccounts = JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
|
|
365
371
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address));
|
|
366
|
-
const blobSink = await createBlobSinkServer({
|
|
367
|
-
port: blobSinkPort,
|
|
368
|
-
dataStoreConfig: {
|
|
369
|
-
dataDirectory: statePath,
|
|
370
|
-
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
await blobSink.start();
|
|
374
372
|
// Start anvil. We go via a wrapper script to ensure if the parent dies, anvil dies.
|
|
375
373
|
const { anvil, rpcUrl } = await startAnvil();
|
|
376
374
|
aztecNodeConfig.l1RpcUrls = [
|
|
@@ -392,12 +390,21 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
392
390
|
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
393
391
|
}
|
|
394
392
|
logger.verbose('Creating ETH clients...');
|
|
395
|
-
const
|
|
396
|
-
const
|
|
393
|
+
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
394
|
+
const dateProvider = new TestDateProvider();
|
|
395
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), aztecNodeConfig.l1Contracts.rollupAddress, l1Client, dateProvider);
|
|
397
396
|
await watcher.start();
|
|
398
|
-
logger.verbose('Creating aztec node...');
|
|
399
397
|
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
400
|
-
const
|
|
398
|
+
const blobSink = await createBlobSinkServer({
|
|
399
|
+
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
400
|
+
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
401
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
402
|
+
port: blobSinkPort,
|
|
403
|
+
dataDirectory: statePath,
|
|
404
|
+
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb
|
|
405
|
+
}, telemetry);
|
|
406
|
+
await blobSink.start();
|
|
407
|
+
logger.verbose('Creating aztec node...');
|
|
401
408
|
const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
|
|
402
409
|
telemetry,
|
|
403
410
|
dateProvider
|
|
@@ -409,7 +416,11 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
409
416
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
410
417
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
411
418
|
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
412
|
-
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, aztecNodeConfig,
|
|
419
|
+
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, aztecNodeConfig, {
|
|
420
|
+
...aztecNodeConfig.proverNodeConfig,
|
|
421
|
+
dataDirectory: path.join(directoryToCleanup, randomBytes(8).toString('hex')),
|
|
422
|
+
p2pEnabled: false
|
|
423
|
+
}, aztecNode, prefilledPublicData);
|
|
413
424
|
}
|
|
414
425
|
logger.verbose('Creating pxe...');
|
|
415
426
|
const pxeConfig = getPXEServiceConfig();
|
|
@@ -421,13 +432,14 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
421
432
|
anvil,
|
|
422
433
|
aztecNode,
|
|
423
434
|
pxe,
|
|
435
|
+
sequencer: aztecNode.getSequencer(),
|
|
424
436
|
acvmConfig,
|
|
425
437
|
bbConfig,
|
|
426
438
|
proverNode,
|
|
427
439
|
deployL1ContractsValues: {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
440
|
+
l1Client,
|
|
441
|
+
l1ContractAddresses: aztecNodeConfig.l1Contracts,
|
|
442
|
+
rollupVersion: aztecNodeConfig.rollupVersion
|
|
431
443
|
},
|
|
432
444
|
watcher,
|
|
433
445
|
cheatCodes,
|
|
@@ -446,9 +458,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
446
458
|
}
|
|
447
459
|
logger.verbose('Deploying accounts funded with fee juice...');
|
|
448
460
|
const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
449
|
-
await deployFundedSchnorrAccounts(pxe, deployedAccounts,
|
|
450
|
-
proven: waitUntilProven
|
|
451
|
-
});
|
|
461
|
+
await deployFundedSchnorrAccounts(pxe, deployedAccounts, undefined, waitUntilProven ? DefaultWaitForProvenOpts : undefined);
|
|
452
462
|
return {
|
|
453
463
|
deployedAccounts
|
|
454
464
|
};
|
|
@@ -458,22 +468,28 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
458
468
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
459
469
|
* @param sender - Wallet to send the deployment tx.
|
|
460
470
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
461
|
-
|
|
471
|
+
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
472
|
+
* @param pxeOrNode - PXE or AztecNode to wait for proven.
|
|
473
|
+
*/ export async function publicDeployAccounts(sender, accountsToDeploy, waitUntilProven = false, pxeOrNode) {
|
|
462
474
|
const accountAddressesToDeploy = accountsToDeploy.map((a)=>'address' in a ? a.address : a);
|
|
463
475
|
const instances = (await Promise.all(accountAddressesToDeploy.map((account)=>sender.getContractMetadata(account)))).map((metadata)=>metadata.contractInstance);
|
|
464
476
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
465
477
|
const alreadyRegistered = (await sender.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
466
|
-
const
|
|
478
|
+
const calls = await Promise.all([
|
|
467
479
|
...!alreadyRegistered ? [
|
|
468
|
-
|
|
480
|
+
publishContractClass(sender, SchnorrAccountContractArtifact)
|
|
469
481
|
] : [],
|
|
470
|
-
...instances.map((instance)=>
|
|
482
|
+
...instances.map((instance)=>publishInstance(sender, instance))
|
|
471
483
|
]);
|
|
472
|
-
const calls = await Promise.all(fns.map((fn)=>fn.request()));
|
|
473
|
-
const capsules = fns.map((fn)=>fn.getCapsules()).flat();
|
|
474
484
|
const batch = new BatchCall(sender, calls);
|
|
475
|
-
batch.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
485
|
+
const txReceipt = await batch.send({
|
|
486
|
+
from: accountAddressesToDeploy[0]
|
|
487
|
+
}).wait();
|
|
488
|
+
if (waitUntilProven) {
|
|
489
|
+
if (!pxeOrNode) {
|
|
490
|
+
throw new Error('Need to provide a PXE or AztecNode to wait for proven.');
|
|
491
|
+
} else {
|
|
492
|
+
await waitForProven(pxeOrNode, txReceipt);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
479
495
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AztecAddress, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
|
-
export declare function deployToken(adminWallet: Wallet, initialAdminBalance: bigint, logger: Logger): Promise<TokenContract>;
|
|
4
|
-
export declare function mintTokensToPrivate(token: TokenContract, minterWallet: Wallet, recipient: AztecAddress, amount: bigint): Promise<void>;
|
|
3
|
+
export declare function deployToken(adminWallet: Wallet, deployerAddress: AztecAddress, initialAdminBalance: bigint, logger: Logger): Promise<TokenContract>;
|
|
4
|
+
export declare function mintTokensToPrivate(token: TokenContract, minter: AztecAddress, minterWallet: Wallet, recipient: AztecAddress, amount: bigint): Promise<void>;
|
|
5
5
|
export declare function expectTokenBalance(wallet: Wallet, token: TokenContract, owner: AztecAddress, expectedBalance: bigint, logger: Logger): Promise<void>;
|
|
6
|
+
export declare function mintNotes(sender: Wallet, minter: AztecAddress, recipient: AztecAddress, asset: TokenContract, noteAmounts: bigint[]): Promise<bigint>;
|
|
6
7
|
//# sourceMappingURL=token_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/token_utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token_utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/token_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,YAAY,EAC7B,mBAAmB,EAAE,MAAM,EAC3B,MAAM,EAAE,MAAM,0BAef;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,MAAM,iBAIf;AAGD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,iBAOf;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,YAAY,EACvB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { BatchCall } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
|
-
|
|
3
|
+
// docs:start:token_utils
|
|
4
|
+
export async function deployToken(adminWallet, deployerAddress, initialAdminBalance, logger) {
|
|
4
5
|
logger.info(`Deploying Token contract...`);
|
|
5
|
-
const contract = await TokenContract.deploy(adminWallet,
|
|
6
|
+
const contract = await TokenContract.deploy(adminWallet, deployerAddress, 'TokenName', 'TokenSymbol', 18).send({
|
|
7
|
+
from: deployerAddress
|
|
8
|
+
}).deployed();
|
|
6
9
|
if (initialAdminBalance > 0n) {
|
|
7
10
|
// Minter is minting to herself so contract as minter is the same as contract as recipient
|
|
8
|
-
await mintTokensToPrivate(contract,
|
|
11
|
+
await mintTokensToPrivate(contract, deployerAddress, adminWallet, deployerAddress, initialAdminBalance);
|
|
9
12
|
}
|
|
10
13
|
logger.info('L2 contract deployed');
|
|
11
14
|
return contract;
|
|
12
15
|
}
|
|
13
|
-
export async function mintTokensToPrivate(token, minterWallet, recipient, amount) {
|
|
16
|
+
export async function mintTokensToPrivate(token, minter, minterWallet, recipient, amount) {
|
|
14
17
|
const tokenAsMinter = await TokenContract.at(token.address, minterWallet);
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
await tokenAsMinter.methods.mint_to_private(recipient, amount).send({
|
|
19
|
+
from: minter
|
|
20
|
+
}).wait();
|
|
17
21
|
}
|
|
18
22
|
// docs:end:token_utils
|
|
19
23
|
export async function expectTokenBalance(wallet, token, owner, expectedBalance, logger) {
|
|
@@ -25,3 +29,16 @@ export async function expectTokenBalance(wallet, token, owner, expectedBalance,
|
|
|
25
29
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
26
30
|
expect(balance).toBe(expectedBalance);
|
|
27
31
|
}
|
|
32
|
+
export async function mintNotes(sender, minter, recipient, asset, noteAmounts) {
|
|
33
|
+
// We can only mint 4 notes at a time, since that's the maximum number of calls our entrypoints allow
|
|
34
|
+
// TODO(#13024): mint as many notes as possible in a single tx
|
|
35
|
+
const notesPerIteration = 4;
|
|
36
|
+
for(let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration){
|
|
37
|
+
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
38
|
+
const actions = toMint.map((amt)=>asset.methods.mint_to_private(recipient, amt));
|
|
39
|
+
await new BatchCall(sender, actions).send({
|
|
40
|
+
from: minter
|
|
41
|
+
}).wait();
|
|
42
|
+
}
|
|
43
|
+
return noteAmounts.reduce((prev, curr)=>prev + curr, 0n);
|
|
44
|
+
}
|
package/dest/fixtures/utils.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
4
2
|
import { type AztecNodeConfig } from '@aztec/aztec-node';
|
|
5
|
-
import { type AccountWalletWithSecretKey,
|
|
6
|
-
import
|
|
3
|
+
import { type AccountWalletWithSecretKey, type AztecAddress, type AztecNode, type ContractMethod, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
4
|
+
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
7
5
|
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
8
|
-
import { type DeployL1ContractsArgs,
|
|
9
|
-
import { startAnvil } from '@aztec/ethereum/test';
|
|
10
|
-
import {
|
|
6
|
+
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType, type Operator } from '@aztec/ethereum';
|
|
7
|
+
import { EthCheatCodes, startAnvil } from '@aztec/ethereum/test';
|
|
8
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
11
9
|
import { Fr } from '@aztec/foundation/fields';
|
|
12
10
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
13
|
-
import {
|
|
11
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
12
|
+
import { MockGossipSubNetwork } from '@aztec/p2p/test-helpers';
|
|
13
|
+
import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps } from '@aztec/prover-node';
|
|
14
14
|
import { type PXEService, type PXEServiceConfig } from '@aztec/pxe/server';
|
|
15
15
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
16
|
+
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
17
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
16
18
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
17
19
|
import { type TelemetryClient, type TelemetryClientConfig } from '@aztec/telemetry-client';
|
|
18
|
-
import { type Chain, type HDAccount, type
|
|
20
|
+
import { type Chain, type HDAccount, type PrivateKeyAccount } from 'viem';
|
|
19
21
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
20
22
|
export { startAnvil };
|
|
21
23
|
export declare const getPrivateKeyFromIndex: (index: number) => Buffer | null;
|
|
@@ -24,13 +26,11 @@ export declare const setupL1Contracts: (l1RpcUrls: string[], account: HDAccount
|
|
|
24
26
|
* Sets up Private eXecution Environment (PXE).
|
|
25
27
|
* @param aztecNode - An instance of Aztec Node.
|
|
26
28
|
* @param opts - Partial configuration for the PXE service.
|
|
27
|
-
* @param firstPrivKey - The private key of the first account to be created.
|
|
28
29
|
* @param logger - The logger to be used.
|
|
29
30
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
30
|
-
* @
|
|
31
|
-
* @returns Private eXecution Environment (PXE), accounts, wallets and logger.
|
|
31
|
+
* @returns Private eXecution Environment (PXE), logger and teardown function.
|
|
32
32
|
*/
|
|
33
|
-
export declare function setupPXEService(aztecNode: AztecNode, opts?: Partial<PXEServiceConfig>, logger?: Logger, useLogSuffix?: boolean
|
|
33
|
+
export declare function setupPXEService(aztecNode: AztecNode, opts?: Partial<PXEServiceConfig>, logger?: Logger, useLogSuffix?: boolean): Promise<{
|
|
34
34
|
/**
|
|
35
35
|
* The PXE instance.
|
|
36
36
|
*/
|
|
@@ -63,7 +63,9 @@ export type SetupOptions = {
|
|
|
63
63
|
/** Salt to use in L1 contract deployment */
|
|
64
64
|
salt?: number;
|
|
65
65
|
/** An initial set of validators */
|
|
66
|
-
initialValidators?:
|
|
66
|
+
initialValidators?: (Operator & {
|
|
67
|
+
privateKey: `0x${string}`;
|
|
68
|
+
})[];
|
|
67
69
|
/** Anvil Start time */
|
|
68
70
|
l1StartTime?: number;
|
|
69
71
|
/** The anvil time where we should at the earliest be seeing L2 blocks */
|
|
@@ -78,11 +80,27 @@ export type SetupOptions = {
|
|
|
78
80
|
};
|
|
79
81
|
/** Public data that will be inserted in the tree in genesis */
|
|
80
82
|
genesisPublicData?: PublicDataTreeLeaf[];
|
|
83
|
+
/** Specific config for the prover node, if set. */
|
|
84
|
+
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
85
|
+
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
86
|
+
mockGossipSubNetwork?: boolean;
|
|
87
|
+
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
88
|
+
disableAnvilTestWatcher?: boolean;
|
|
89
|
+
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
90
|
+
automineL1Setup?: boolean;
|
|
91
|
+
/** How many accounts to seed and unlock in anvil. */
|
|
92
|
+
anvilAccounts?: number;
|
|
93
|
+
/** Port to start anvil (defaults to 8545) */
|
|
94
|
+
anvilPort?: number;
|
|
95
|
+
/** Key to use for publishing L1 contracts */
|
|
96
|
+
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
81
97
|
} & Partial<AztecNodeConfig>;
|
|
82
98
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
83
99
|
export type EndToEndContext = {
|
|
84
100
|
/** The Aztec Node service or client a connected to it. */
|
|
85
101
|
aztecNode: AztecNode;
|
|
102
|
+
/** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
|
|
103
|
+
aztecNodeAdmin?: AztecNodeAdmin;
|
|
86
104
|
/** The prover node service (only set if startProverNode is true) */
|
|
87
105
|
proverNode: ProverNode | undefined;
|
|
88
106
|
/** A client to the sequencer service (undefined if connected to remote environment) */
|
|
@@ -95,14 +113,17 @@ export type EndToEndContext = {
|
|
|
95
113
|
config: AztecNodeConfig;
|
|
96
114
|
/** The data for the initial funded accounts. */
|
|
97
115
|
initialFundedAccounts: InitialAccountData[];
|
|
116
|
+
wallets: AccountWalletWithSecretKey[];
|
|
98
117
|
/** The first wallet to be used. */
|
|
99
118
|
wallet: AccountWalletWithSecretKey;
|
|
100
|
-
/** The
|
|
101
|
-
|
|
119
|
+
/** The accounts to be used. */
|
|
120
|
+
accounts: AztecAddress[];
|
|
102
121
|
/** Logger instance named as the current test. */
|
|
103
122
|
logger: Logger;
|
|
104
123
|
/** The cheat codes. */
|
|
105
124
|
cheatCodes: CheatCodes;
|
|
125
|
+
/** The cheat codes for L1 */
|
|
126
|
+
ethCheatCodes: EthCheatCodes;
|
|
106
127
|
/** The anvil test watcher (undefined if connected to remote environment) */
|
|
107
128
|
watcher: AnvilTestWatcher | undefined;
|
|
108
129
|
/** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
|
|
@@ -111,6 +132,10 @@ export type EndToEndContext = {
|
|
|
111
132
|
blobSink: BlobSinkServer | undefined;
|
|
112
133
|
/** Telemetry client */
|
|
113
134
|
telemetryClient: TelemetryClient | undefined;
|
|
135
|
+
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
136
|
+
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
137
|
+
/** Prefilled public data used for setting up nodes. */
|
|
138
|
+
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
114
139
|
/** Function to stop the started services. */
|
|
115
140
|
teardown: () => Promise<void>;
|
|
116
141
|
};
|
|
@@ -127,7 +152,7 @@ export declare function setup(numberOfAccounts?: number, opts?: SetupOptions, px
|
|
|
127
152
|
* @param sender - Wallet to send the deployment tx.
|
|
128
153
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
129
154
|
*/
|
|
130
|
-
export declare function
|
|
155
|
+
export declare function ensureAccountContractsPublished(sender: Wallet, accountsToDeploy: Wallet[]): Promise<void>;
|
|
131
156
|
/**
|
|
132
157
|
* Sets the timestamp of the next block.
|
|
133
158
|
* @param rpcUrl - rpc url of the blockchain instance to connect to
|
|
@@ -140,16 +165,34 @@ export declare function setNextBlockTimestamp(rpcUrl: string, timestamp: number)
|
|
|
140
165
|
*/
|
|
141
166
|
export declare function getLogger(): Logger;
|
|
142
167
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
143
|
-
export declare function getBalancesFn(symbol: string, method: ContractMethod, logger: any): (...addresses: (AztecAddress | {
|
|
168
|
+
export declare function getBalancesFn(symbol: string, method: ContractMethod, from: AztecAddress, logger: any): (...addresses: (AztecAddress | {
|
|
144
169
|
address: AztecAddress;
|
|
145
170
|
})[]) => Promise<bigint[]>;
|
|
146
171
|
export declare function expectMapping<K, V>(fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedOutputs: V[]): Promise<void>;
|
|
147
172
|
export declare function expectMappingDelta<K, V extends number | bigint>(initialValues: V[], fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedDiffs: V[]): Promise<void>;
|
|
148
173
|
/**
|
|
149
|
-
*
|
|
174
|
+
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
175
|
+
* but by conventions its address is computed with a salt of 0.
|
|
176
|
+
* @returns The address of the sponsored FPC contract
|
|
177
|
+
*/
|
|
178
|
+
export declare function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress>;
|
|
179
|
+
/**
|
|
180
|
+
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
181
|
+
* but by conventions its address is computed with a salt of 0.
|
|
182
|
+
* @returns The address of the sponsored FPC contract
|
|
183
|
+
*/
|
|
184
|
+
export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
|
|
185
|
+
/**
|
|
186
|
+
* Deploy a sponsored FPC contract to a running instance.
|
|
187
|
+
*/
|
|
188
|
+
export declare function setupSponsoredFPC(pxe: PXE): Promise<ContractInstanceWithAddress>;
|
|
189
|
+
/**
|
|
190
|
+
* Registers the SponsoredFPC in this PXE instance
|
|
191
|
+
* @param pxe - The pxe client
|
|
150
192
|
*/
|
|
151
|
-
export declare function
|
|
193
|
+
export declare function registerSponsoredFPC(pxe: PXE): Promise<void>;
|
|
152
194
|
export declare function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec?: number, intervalSec?: number): Promise<void>;
|
|
153
|
-
export declare function createAndSyncProverNode(proverNodePrivateKey: `0x${string}`, aztecNodeConfig: AztecNodeConfig,
|
|
154
|
-
|
|
195
|
+
export declare function createAndSyncProverNode(proverNodePrivateKey: `0x${string}`, aztecNodeConfig: AztecNodeConfig, proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & {
|
|
196
|
+
dontStart?: boolean;
|
|
197
|
+
}, aztecNode: AztecNode | undefined, prefilledPublicData?: PublicDataTreeLeaf[], proverNodeDeps?: ProverNodeDeps): Promise<ProverNode>;
|
|
155
198
|
//# sourceMappingURL=utils.d.ts.map
|