@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
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 +4 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +10 -30
- package/dest/bench/utils.d.ts +3 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +17 -37
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
- 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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
- 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 +35 -35
- package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +20 -12
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +36 -27
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +14 -11
- package/dest/e2e_fees/fees_test.d.ts +13 -9
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +38 -39
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +9 -8
- package/dest/e2e_multi_validator/utils.d.ts +2 -2
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_multi_validator/utils.js +4 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
- 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 +136 -0
- package/dest/e2e_p2p/p2p_network.d.ts +238 -18
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +50 -25
- package/dest/e2e_p2p/shared.d.ts +16 -17
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +57 -56
- package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +13 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +57 -66
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts +12 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +50 -24
- package/dest/fixtures/snapshot_manager.d.ts +16 -15
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +84 -88
- package/dest/fixtures/token_utils.d.ts +10 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +17 -18
- package/dest/fixtures/utils.d.ts +44 -47
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +128 -185
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts +2 -2
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +20 -23
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +10 -17
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +11 -8
- package/dest/shared/index.d.ts +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +13 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +44 -58
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +4 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +8 -5
- package/dest/simulators/token_simulator.d.ts +4 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +22 -14
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +144 -86
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +101 -16
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +414 -52
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
- package/src/bench/client_flows/data_extractor.ts +9 -31
- package/src/bench/utils.ts +15 -39
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
- package/src/e2e_deploy_contract/deploy_test.ts +18 -36
- package/src/e2e_epochs/epochs_test.ts +59 -42
- package/src/e2e_fees/bridging_race.notest.ts +16 -11
- package/src/e2e_fees/fees_test.ts +47 -51
- package/src/e2e_l1_publisher/write_json.ts +12 -9
- package/src/e2e_multi_validator/utils.ts +5 -11
- package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +125 -89
- package/src/e2e_p2p/shared.ts +69 -60
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +65 -105
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +2 -2
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +79 -32
- package/src/fixtures/snapshot_manager.ts +120 -131
- package/src/fixtures/token_utils.ts +16 -24
- package/src/fixtures/utils.ts +175 -269
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +3 -11
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +23 -31
- package/src/shared/gas_portal_test_harness.ts +14 -21
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +80 -88
- package/src/simulators/lending_simulator.ts +9 -6
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +15 -3
- package/src/spartan/setup_test_wallets.ts +171 -127
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +543 -45
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/src/fixtures/setup_l1_contracts.ts +0 -26
package/dest/fixtures/utils.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import {
|
|
2
|
+
import { generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
3
|
import { createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
|
-
import { BatchCall
|
|
5
|
+
import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
6
6
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
7
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
8
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
9
|
+
import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
7
10
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
12
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
13
|
+
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
14
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
15
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
16
|
+
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
17
|
+
import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
12
18
|
import { DelayedTxUtils, EthCheatCodes, EthCheatCodesWithState, createDelayedL1TxUtilsFromViemWallet, startAnvil } from '@aztec/ethereum/test';
|
|
19
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
13
20
|
import { SecretValue } from '@aztec/foundation/config';
|
|
14
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
15
21
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
17
22
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
18
23
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
19
24
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
20
|
-
import {
|
|
25
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
26
|
+
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
21
27
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
22
28
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
23
29
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
24
|
-
import {
|
|
30
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
25
31
|
import { createProverNode } from '@aztec/prover-node';
|
|
26
|
-
import {
|
|
27
|
-
import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
28
|
-
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
32
|
+
import { getPXEConfig } from '@aztec/pxe/server';
|
|
29
33
|
import { getContractClassFromArtifact, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
30
34
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
31
35
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
32
36
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
37
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
|
|
33
38
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
39
|
+
import { randomBytes } from 'crypto';
|
|
34
40
|
import fs from 'fs/promises';
|
|
35
|
-
import getPort from 'get-port';
|
|
36
41
|
import { tmpdir } from 'os';
|
|
37
42
|
import * as path from 'path';
|
|
38
|
-
import { getContract } from 'viem';
|
|
39
43
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
40
44
|
import { foundry } from 'viem/chains';
|
|
41
45
|
import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
@@ -44,16 +48,28 @@ import { getBBConfig } from './get_bb_config.js';
|
|
|
44
48
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
45
49
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
46
50
|
export { startAnvil };
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Sets up shared blob storage using FileStore in the data directory.
|
|
53
|
+
*/ export async function setupSharedBlobStorage(config) {
|
|
54
|
+
const sharedBlobPath = path.join(config.dataDirectory, 'shared-blobs');
|
|
55
|
+
await fs.mkdir(sharedBlobPath, {
|
|
56
|
+
recursive: true
|
|
57
|
+
});
|
|
58
|
+
config.blobFileStoreUrls = [
|
|
59
|
+
`file://${sharedBlobPath}`
|
|
60
|
+
];
|
|
61
|
+
config.blobFileStoreUploadUrl = `file://${sharedBlobPath}`;
|
|
62
|
+
}
|
|
63
|
+
const { AZTEC_NODE_URL = '' } = process.env;
|
|
64
|
+
const getAztecUrl = ()=>AZTEC_NODE_URL;
|
|
49
65
|
let telemetry = undefined;
|
|
50
|
-
function getTelemetryClient(partialConfig = {}) {
|
|
66
|
+
async function getTelemetryClient(partialConfig = {}) {
|
|
51
67
|
if (!telemetry) {
|
|
52
68
|
const config = {
|
|
53
69
|
...getTelemetryConfig(),
|
|
54
70
|
...partialConfig
|
|
55
71
|
};
|
|
56
|
-
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
|
|
72
|
+
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
|
|
57
73
|
}
|
|
58
74
|
return telemetry;
|
|
59
75
|
}
|
|
@@ -69,47 +85,31 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
69
85
|
const privKeyRaw = hdAccount.getHdKey().privateKey;
|
|
70
86
|
return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
|
|
71
87
|
};
|
|
72
|
-
export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, chain = foundry)=>{
|
|
73
|
-
const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
|
|
74
|
-
vkTreeRoot: getVKTreeRoot(),
|
|
75
|
-
protocolContractTreeRoot,
|
|
76
|
-
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
77
|
-
salt: args.salt,
|
|
78
|
-
initialValidators: args.initialValidators,
|
|
79
|
-
...getL1ContractsConfigEnvVars(),
|
|
80
|
-
realVerifier: false,
|
|
81
|
-
...args
|
|
82
|
-
});
|
|
83
|
-
return l1Data;
|
|
84
|
-
};
|
|
85
88
|
/**
|
|
86
|
-
* Sets up Private eXecution Environment (PXE).
|
|
89
|
+
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
87
90
|
* @param aztecNode - An instance of Aztec Node.
|
|
88
|
-
* @param opts - Partial configuration for the PXE
|
|
91
|
+
* @param opts - Partial configuration for the PXE.
|
|
89
92
|
* @param logger - The logger to be used.
|
|
90
93
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
91
|
-
* @returns
|
|
92
|
-
*/ export async function
|
|
93
|
-
const
|
|
94
|
-
...
|
|
94
|
+
* @returns A test wallet, logger and teardown function.
|
|
95
|
+
*/ export async function setupPXEAndGetWallet(aztecNode, opts = {}, logger = getLogger(), useLogSuffix = false) {
|
|
96
|
+
const PXEConfig = {
|
|
97
|
+
...getPXEConfig(),
|
|
95
98
|
...opts
|
|
96
99
|
};
|
|
97
100
|
// For tests we only want proving enabled if specifically requested
|
|
98
|
-
|
|
101
|
+
PXEConfig.proverEnabled = !!opts.proverEnabled;
|
|
99
102
|
// If no data directory provided, create a temp directory and clean up afterwards
|
|
100
|
-
const configuredDataDirectory =
|
|
103
|
+
const configuredDataDirectory = PXEConfig.dataDirectory;
|
|
101
104
|
if (!configuredDataDirectory) {
|
|
102
|
-
|
|
105
|
+
PXEConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
103
106
|
}
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const simulatorWithRecorder = new SimulatorRecorderWrapper(simulator, recorder);
|
|
107
|
-
const pxe = await createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, pxeServiceConfig, {
|
|
107
|
+
const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(PXEConfig.dataDirectory);
|
|
108
|
+
const wallet = await TestWallet.create(aztecNode, PXEConfig, {
|
|
108
109
|
useLogSuffix
|
|
109
110
|
});
|
|
110
|
-
const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(pxeServiceConfig.dataDirectory);
|
|
111
111
|
return {
|
|
112
|
-
|
|
112
|
+
wallet,
|
|
113
113
|
logger,
|
|
114
114
|
teardown
|
|
115
115
|
};
|
|
@@ -127,44 +127,40 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
127
127
|
const aztecNodeUrl = getAztecUrl();
|
|
128
128
|
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
129
129
|
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
3
|
|
135
|
-
], true));
|
|
136
|
-
await waitForPXE(pxeClient, logger);
|
|
137
|
-
logger.verbose('JSON RPC client connected to PXE');
|
|
138
|
-
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
139
|
-
const { l1ContractAddresses, rollupVersion } = await pxeClient.getNodeInfo();
|
|
130
|
+
await waitForNode(aztecNode, logger);
|
|
131
|
+
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
132
|
+
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
133
|
+
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
140
134
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
141
135
|
const deployL1ContractsValues = {
|
|
142
136
|
l1ContractAddresses,
|
|
143
137
|
l1Client,
|
|
144
138
|
rollupVersion
|
|
145
139
|
};
|
|
146
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
147
|
-
const
|
|
140
|
+
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
141
|
+
const wallet = await TestWallet.create(aztecNode);
|
|
142
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
148
143
|
const teardown = ()=>Promise.resolve();
|
|
149
|
-
logger.verbose('
|
|
150
|
-
const initialFundedAccounts = await
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
|
|
144
|
+
logger.verbose('Populating wallet from already registered accounts...');
|
|
145
|
+
const initialFundedAccounts = await getInitialTestAccountsData();
|
|
146
|
+
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
147
|
+
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
154
148
|
// Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
|
|
155
149
|
}
|
|
150
|
+
const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
|
|
151
|
+
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
152
|
+
return accountManager.address;
|
|
153
|
+
}));
|
|
156
154
|
return {
|
|
157
155
|
aztecNode,
|
|
158
156
|
aztecNodeAdmin: undefined,
|
|
159
157
|
sequencer: undefined,
|
|
160
158
|
proverNode: undefined,
|
|
161
|
-
pxe: pxeClient,
|
|
162
159
|
deployL1ContractsValues,
|
|
163
160
|
config,
|
|
164
161
|
initialFundedAccounts,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
accounts: wallets.slice(0, numberOfAccounts).map((w)=>w.getAddress()),
|
|
162
|
+
wallet,
|
|
163
|
+
accounts: testAccounts,
|
|
168
164
|
logger,
|
|
169
165
|
cheatCodes,
|
|
170
166
|
ethCheatCodes,
|
|
@@ -172,7 +168,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
172
168
|
mockGossipSubNetwork: undefined,
|
|
173
169
|
watcher: undefined,
|
|
174
170
|
dateProvider: undefined,
|
|
175
|
-
blobSink: undefined,
|
|
176
171
|
telemetryClient: undefined,
|
|
177
172
|
teardown
|
|
178
173
|
};
|
|
@@ -211,8 +206,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
211
206
|
if (!isAnvilTestChain(chain.id)) {
|
|
212
207
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
213
208
|
}
|
|
214
|
-
if (
|
|
215
|
-
throw new Error(`
|
|
209
|
+
if (AZTEC_NODE_URL) {
|
|
210
|
+
throw new Error(`AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`);
|
|
216
211
|
}
|
|
217
212
|
const res = await startAnvil({
|
|
218
213
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
@@ -230,7 +225,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
230
225
|
logger.info(`Logging metrics to ${filename}`);
|
|
231
226
|
setupMetricsLogger(filename);
|
|
232
227
|
}
|
|
233
|
-
const
|
|
228
|
+
const dateProvider = new TestDateProvider();
|
|
229
|
+
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
234
230
|
if (opts.stateLoad) {
|
|
235
231
|
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
236
232
|
}
|
|
@@ -239,12 +235,14 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
239
235
|
resetBlockInterval: true
|
|
240
236
|
});
|
|
241
237
|
}
|
|
242
|
-
let
|
|
238
|
+
let publisherPrivKeyHex = undefined;
|
|
243
239
|
let publisherHdAccount = undefined;
|
|
244
240
|
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
|
|
245
|
-
|
|
241
|
+
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
242
|
+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
246
243
|
} else if (config.publisherPrivateKeys && config.publisherPrivateKeys.length > 0 && config.publisherPrivateKeys[0].getValue() != NULL_KEY) {
|
|
247
|
-
|
|
244
|
+
publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
|
|
245
|
+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
248
246
|
} else if (!MNEMONIC) {
|
|
249
247
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
250
248
|
} else {
|
|
@@ -252,13 +250,16 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
252
250
|
addressIndex: 0
|
|
253
251
|
});
|
|
254
252
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
255
|
-
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
253
|
+
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
254
|
+
publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
|
|
256
255
|
config.publisherPrivateKeys = [
|
|
257
|
-
new SecretValue(
|
|
256
|
+
new SecretValue(publisherPrivKeyHex)
|
|
258
257
|
];
|
|
259
258
|
}
|
|
260
|
-
config.coinbase
|
|
261
|
-
|
|
259
|
+
if (config.coinbase === undefined) {
|
|
260
|
+
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
261
|
+
}
|
|
262
|
+
if (AZTEC_NODE_URL) {
|
|
262
263
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
263
264
|
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
264
265
|
}
|
|
@@ -270,37 +271,22 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
270
271
|
await ethCheatCodes.setAutomine(true);
|
|
271
272
|
}
|
|
272
273
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
|
|
273
|
-
await
|
|
274
|
-
|
|
274
|
+
const deployL1ContractsValues = await deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
|
|
275
|
+
...getL1ContractsConfigEnvVars(),
|
|
275
276
|
...opts,
|
|
277
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
278
|
+
protocolContractsHash,
|
|
276
279
|
genesisArchiveRoot,
|
|
280
|
+
initialValidators: opts.initialValidators,
|
|
277
281
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
278
|
-
|
|
279
|
-
}
|
|
282
|
+
realVerifier: false
|
|
283
|
+
});
|
|
280
284
|
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
281
285
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
282
|
-
if (opts.fundRewardDistributor) {
|
|
283
|
-
// Mints block rewards for 10000 blocks to the rewardDistributor contract
|
|
284
|
-
const rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
285
|
-
const blockReward = await rollup.getBlockReward();
|
|
286
|
-
const mintAmount = 10_000n * blockReward;
|
|
287
|
-
const feeJuice = getContract({
|
|
288
|
-
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
289
|
-
abi: FeeAssetArtifact.contractAbi,
|
|
290
|
-
client: deployL1ContractsValues.l1Client
|
|
291
|
-
});
|
|
292
|
-
const rewardDistributorMintTxHash = await feeJuice.write.mint([
|
|
293
|
-
deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
294
|
-
mintAmount
|
|
295
|
-
], {});
|
|
296
|
-
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
297
|
-
hash: rewardDistributorMintTxHash
|
|
298
|
-
});
|
|
299
|
-
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
300
|
-
}
|
|
301
286
|
if (enableAutomine) {
|
|
302
287
|
await ethCheatCodes.setAutomine(false);
|
|
303
288
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
289
|
+
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
304
290
|
}
|
|
305
291
|
if (opts.l2StartTime) {
|
|
306
292
|
// This should only be used in synching test or when you need to have a stable
|
|
@@ -309,26 +295,13 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
309
295
|
resetBlockInterval: true
|
|
310
296
|
});
|
|
311
297
|
}
|
|
312
|
-
const
|
|
313
|
-
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
314
|
-
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
298
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
315
299
|
if (!opts.disableAnvilTestWatcher) {
|
|
316
300
|
await watcher.start();
|
|
317
301
|
}
|
|
318
|
-
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const blobSink = await createBlobSinkServer({
|
|
322
|
-
l1ChainId: config.l1ChainId,
|
|
323
|
-
l1RpcUrls: config.l1RpcUrls,
|
|
324
|
-
l1Contracts: config.l1Contracts,
|
|
325
|
-
port: blobSinkPort,
|
|
326
|
-
dataDirectory: config.dataDirectory,
|
|
327
|
-
dataStoreMapSizeKB: config.dataStoreMapSizeKB
|
|
328
|
-
}, telemetry);
|
|
329
|
-
await blobSink.start();
|
|
330
|
-
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
331
|
-
logger.verbose('Creating and synching an aztec node...');
|
|
302
|
+
const telemetry = await getTelemetryClient(opts.telemetryConfig);
|
|
303
|
+
await setupSharedBlobStorage(config);
|
|
304
|
+
logger.verbose('Creating and synching an aztec node', config);
|
|
332
305
|
const acvmConfig = await getACVMConfig(logger);
|
|
333
306
|
if (acvmConfig) {
|
|
334
307
|
config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
|
|
@@ -339,10 +312,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
339
312
|
config.bbBinaryPath = bbConfig.bbBinaryPath;
|
|
340
313
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
341
314
|
}
|
|
342
|
-
config.l1PublishRetryIntervalMS = 100;
|
|
343
|
-
const blobSinkClient = createBlobSinkClient(config, {
|
|
344
|
-
logger: createLogger('node:blob-sink:client')
|
|
345
|
-
});
|
|
346
315
|
let mockGossipSubNetwork;
|
|
347
316
|
let p2pClientDeps = undefined;
|
|
348
317
|
if (opts.mockGossipSubNetwork) {
|
|
@@ -380,7 +349,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
380
349
|
}
|
|
381
350
|
const aztecNode = await AztecNodeService.createAndSync(config, {
|
|
382
351
|
dateProvider,
|
|
383
|
-
blobSinkClient,
|
|
384
352
|
telemetry,
|
|
385
353
|
p2pClientDeps,
|
|
386
354
|
logger: createLogger('node:MAIN-aztec-node')
|
|
@@ -405,33 +373,31 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
405
373
|
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNode, prefilledPublicData);
|
|
406
374
|
}
|
|
407
375
|
logger.verbose('Creating a pxe...');
|
|
408
|
-
const {
|
|
409
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls,
|
|
376
|
+
const { wallet, teardown: pxeTeardown } = await setupPXEAndGetWallet(aztecNode, pxeOpts, logger);
|
|
377
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, dateProvider);
|
|
410
378
|
if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
|
|
411
|
-
// We need to advance
|
|
412
|
-
|
|
413
|
-
await cheatCodes.rollup.advanceToEpoch(2n, {
|
|
414
|
-
updateDateProvider: dateProvider
|
|
415
|
-
});
|
|
379
|
+
// We need to advance such that the committee is set up.
|
|
380
|
+
await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
|
|
416
381
|
await cheatCodes.rollup.setupEpoch();
|
|
417
382
|
await cheatCodes.rollup.debugRollup();
|
|
418
383
|
}
|
|
384
|
+
let accounts = [];
|
|
419
385
|
// Below we continue with what we described in the long comment on line 571.
|
|
420
|
-
let accountManagers = [];
|
|
421
386
|
if (numberOfAccounts === 0) {
|
|
422
387
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
423
|
-
while(await
|
|
388
|
+
while(await aztecNode.getBlockNumber() === 0){
|
|
424
389
|
await sleep(2000);
|
|
425
390
|
}
|
|
426
391
|
} else {
|
|
427
392
|
logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
|
|
428
|
-
|
|
393
|
+
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
394
|
+
const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
|
|
395
|
+
accounts = accountManagers.map((accountManager)=>accountManager.address);
|
|
429
396
|
}
|
|
430
397
|
// Now we restore the original minTxsPerBlock setting.
|
|
431
398
|
sequencerClient.getSequencer().updateConfig({
|
|
432
399
|
minTxsPerBlock: originalMinTxsPerBlock
|
|
433
400
|
});
|
|
434
|
-
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
435
401
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
436
402
|
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
437
403
|
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
@@ -449,7 +415,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
449
415
|
}
|
|
450
416
|
await tryStop(watcher, logger);
|
|
451
417
|
await tryStop(anvil, logger);
|
|
452
|
-
await tryStop(blobSink, logger);
|
|
453
418
|
await tryRmDir(directoryToCleanup, logger);
|
|
454
419
|
} catch (err) {
|
|
455
420
|
logger.error(`Error during e2e test teardown`, err);
|
|
@@ -458,7 +423,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
458
423
|
return {
|
|
459
424
|
aztecNode,
|
|
460
425
|
aztecNodeAdmin: aztecNode,
|
|
461
|
-
blobSink,
|
|
462
426
|
cheatCodes,
|
|
463
427
|
ethCheatCodes,
|
|
464
428
|
config,
|
|
@@ -469,13 +433,11 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
469
433
|
mockGossipSubNetwork,
|
|
470
434
|
prefilledPublicData,
|
|
471
435
|
proverNode,
|
|
472
|
-
pxe,
|
|
473
436
|
sequencer: sequencerClient,
|
|
474
437
|
teardown,
|
|
475
438
|
telemetryClient: telemetry,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
accounts: wallets.map((w)=>w.getAddress()),
|
|
439
|
+
wallet,
|
|
440
|
+
accounts,
|
|
479
441
|
watcher
|
|
480
442
|
};
|
|
481
443
|
} catch (err) {
|
|
@@ -489,45 +451,28 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
489
451
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
490
452
|
* @param sender - Wallet to send the deployment tx.
|
|
491
453
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
492
|
-
*/
|
|
493
|
-
export async function ensureAccountContractsPublished(sender, accountsToDeploy) {
|
|
454
|
+
*/ export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
|
|
494
455
|
// We have to check whether the accounts are already deployed. This can happen if the test runs against
|
|
495
|
-
// the
|
|
496
|
-
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (
|
|
497
|
-
const address = account.getAddress();
|
|
456
|
+
// the local network and the test accounts exist
|
|
457
|
+
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
|
|
498
458
|
return {
|
|
499
459
|
address,
|
|
500
|
-
deployed: (await
|
|
460
|
+
deployed: (await wallet.getContractMetadata(address)).isContractPublished
|
|
501
461
|
};
|
|
502
462
|
}));
|
|
503
|
-
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>
|
|
463
|
+
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.contractInstance);
|
|
504
464
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
505
|
-
if (!(await
|
|
506
|
-
await (await publishContractClass(
|
|
507
|
-
from: accountsToDeploy[0]
|
|
465
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
|
|
466
|
+
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
|
|
467
|
+
from: accountsToDeploy[0]
|
|
508
468
|
}).wait();
|
|
509
469
|
}
|
|
510
|
-
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(
|
|
511
|
-
const batch = new BatchCall(
|
|
470
|
+
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(wallet, instance)));
|
|
471
|
+
const batch = new BatchCall(wallet, requests);
|
|
512
472
|
await batch.send({
|
|
513
|
-
from: accountsToDeploy[0]
|
|
473
|
+
from: accountsToDeploy[0]
|
|
514
474
|
}).wait();
|
|
515
475
|
}
|
|
516
|
-
// docs:end:public_deploy_accounts
|
|
517
|
-
/**
|
|
518
|
-
* Sets the timestamp of the next block.
|
|
519
|
-
* @param rpcUrl - rpc url of the blockchain instance to connect to
|
|
520
|
-
* @param timestamp - the timestamp for the next block
|
|
521
|
-
*/ export async function setNextBlockTimestamp(rpcUrl, timestamp) {
|
|
522
|
-
const params = `[${timestamp}]`;
|
|
523
|
-
await fetch(rpcUrl, {
|
|
524
|
-
body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
|
|
525
|
-
method: 'POST',
|
|
526
|
-
headers: {
|
|
527
|
-
'Content-Type': 'application/json'
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
476
|
/** Returns the job name for the current test. */ function getJobName() {
|
|
532
477
|
return process.env.JOB_NAME ?? expect.getState().currentTestName?.split(' ')[0].replaceAll('/', '_') ?? 'unknown';
|
|
533
478
|
}
|
|
@@ -566,7 +511,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
566
511
|
expect(diffs).toEqual(expectedDiffs);
|
|
567
512
|
}
|
|
568
513
|
/**
|
|
569
|
-
* Computes the address of the "canonical"
|
|
514
|
+
* Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
|
|
570
515
|
* but by conventions its address is computed with a salt of 0.
|
|
571
516
|
* @returns The address of the sponsored FPC contract
|
|
572
517
|
*/ export function getSponsoredFPCInstance() {
|
|
@@ -575,7 +520,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
575
520
|
}));
|
|
576
521
|
}
|
|
577
522
|
/**
|
|
578
|
-
* Computes the address of the "canonical"
|
|
523
|
+
* Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
|
|
579
524
|
* but by conventions its address is computed with a salt of 0.
|
|
580
525
|
* @returns The address of the sponsored FPC contract
|
|
581
526
|
*/ export async function getSponsoredFPCAddress() {
|
|
@@ -584,25 +529,19 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
584
529
|
}
|
|
585
530
|
/**
|
|
586
531
|
* Deploy a sponsored FPC contract to a running instance.
|
|
587
|
-
*/ export async function setupSponsoredFPC(
|
|
532
|
+
*/ export async function setupSponsoredFPC(wallet) {
|
|
588
533
|
const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
589
534
|
salt: new Fr(SPONSORED_FPC_SALT)
|
|
590
535
|
});
|
|
591
|
-
await
|
|
592
|
-
instance,
|
|
593
|
-
artifact: SponsoredFPCContract.artifact
|
|
594
|
-
});
|
|
536
|
+
await wallet.registerContract(instance, SponsoredFPCContract.artifact);
|
|
595
537
|
getLogger().info(`SponsoredFPC: ${instance.address}`);
|
|
596
538
|
return instance;
|
|
597
539
|
}
|
|
598
540
|
/**
|
|
599
541
|
* Registers the SponsoredFPC in this PXE instance
|
|
600
|
-
* @param
|
|
601
|
-
*/ export async function registerSponsoredFPC(
|
|
602
|
-
await
|
|
603
|
-
instance: await getSponsoredFPCInstance(),
|
|
604
|
-
artifact: SponsoredFPCContract.artifact
|
|
605
|
-
});
|
|
542
|
+
* @param wallet - The wallet
|
|
543
|
+
*/ export async function registerSponsoredFPC(wallet) {
|
|
544
|
+
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
606
545
|
}
|
|
607
546
|
export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
|
|
608
547
|
targetBlock ??= await node.getBlockNumber();
|
|
@@ -617,14 +556,15 @@ export function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, p
|
|
|
617
556
|
getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
|
|
618
557
|
stop: ()=>Promise.resolve()
|
|
619
558
|
};
|
|
620
|
-
const
|
|
559
|
+
const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
|
|
621
560
|
// Creating temp store and archiver for simulated prover node
|
|
622
561
|
const archiverConfig = {
|
|
623
562
|
...aztecNodeConfig,
|
|
624
563
|
dataDirectory: proverNodeConfig.dataDirectory
|
|
625
564
|
};
|
|
626
565
|
const archiver = await createArchiver(archiverConfig, {
|
|
627
|
-
|
|
566
|
+
blobClient,
|
|
567
|
+
dateProvider: proverNodeDeps.dateProvider
|
|
628
568
|
}, {
|
|
629
569
|
blockUntilSync: true
|
|
630
570
|
});
|
|
@@ -646,6 +586,7 @@ export function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, p
|
|
|
646
586
|
txGatheringTimeoutMs: 24_000,
|
|
647
587
|
proverNodeFailedEpochStore: undefined,
|
|
648
588
|
proverId: EthAddress.fromNumber(1),
|
|
589
|
+
proverNodeEpochProvingDelayMs: undefined,
|
|
649
590
|
...proverNodeConfig
|
|
650
591
|
};
|
|
651
592
|
const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node', proverNodeDeps.dateProvider);
|
|
@@ -660,7 +601,9 @@ export function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, p
|
|
|
660
601
|
getLogger().info(`Created and synced prover node`, {
|
|
661
602
|
publisherAddress: l1TxUtils.client.account.address
|
|
662
603
|
});
|
|
663
|
-
|
|
604
|
+
if (!proverNodeConfig.dontStart) {
|
|
605
|
+
await proverNode.start();
|
|
606
|
+
}
|
|
664
607
|
return proverNode;
|
|
665
608
|
});
|
|
666
609
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function createWeb3SignerKeystore(dir: string, ...privateKeys: string[]): Promise<void>;
|
|
2
|
+
export declare function refreshWeb3Signer(url: string, ...expectedAddresses: string[]): Promise<void>;
|
|
3
|
+
export declare function getWeb3SignerTestKeystoreDir(): string;
|
|
4
|
+
export declare function getWeb3SignerUrl(): string;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViM3NpZ25lci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpeHR1cmVzL3dlYjNzaWduZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBU0Esd0JBQXNCLHdCQUF3QixDQUFDLEdBQUcsRUFBRSxNQUFNLEVBQUUsR0FBRyxXQUFXLEVBQUUsTUFBTSxFQUFFLGlCQWNuRjtBQUVELHdCQUFzQixpQkFBaUIsQ0FBQyxHQUFHLEVBQUUsTUFBTSxFQUFFLEdBQUcsaUJBQWlCLEVBQUUsTUFBTSxFQUFFLGlCQW9CbEY7QUFFRCx3QkFBZ0IsNEJBQTRCLElBQUksTUFBTSxDQU9yRDtBQUVELHdCQUFnQixnQkFBZ0IsSUFBSSxNQUFNLENBTXpDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web3signer.d.ts","sourceRoot":"","sources":["../../src/fixtures/web3signer.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,iBAcnF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,iBAoBlF;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC"}
|