@aztec/end-to-end 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd
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 +27 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +24 -31
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -3
- 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 +23 -13
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- 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 +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +26 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +117 -41
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +22 -15
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts +14 -12
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +70 -34
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +49 -9
- package/dest/e2e_p2p/shared.d.ts +26 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +71 -50
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +19 -9
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +7 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +37 -49
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +16 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +16 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +2 -2
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +4 -2
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
- package/dest/fixtures/setup.d.ts +59 -31
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +97 -167
- package/dest/fixtures/setup_p2p_test.d.ts +10 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -15
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -7
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +3 -3
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +15 -22
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +100 -39
- package/dest/spartan/tx_metrics.d.ts +1 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +19 -3
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +7 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +9 -9
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +84 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +255 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +279 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +43 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +33 -20
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +8 -3
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +31 -21
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +5 -5
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +138 -67
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +25 -31
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -7
- package/src/e2e_p2p/p2p_network.ts +93 -49
- package/src/e2e_p2p/reqresp/utils.ts +63 -13
- package/src/e2e_p2p/shared.ts +90 -64
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +26 -9
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +46 -55
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +32 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +7 -3
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +147 -232
- package/src/fixtures/setup_p2p_test.ts +17 -25
- package/src/fixtures/token_utils.ts +3 -3
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +3 -5
- package/src/legacy-jest-resolver.cjs +135 -0
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -2
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +3 -2
- package/src/shared/uniswap_l1_l2.ts +37 -34
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +141 -32
- package/src/spartan/tx_metrics.ts +17 -5
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +357 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/dest/fixtures/setup.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { generateSchnorrAccounts
|
|
3
|
-
import { createArchiver } from '@aztec/archiver';
|
|
2
|
+
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
4
3
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
|
-
import {
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
5
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
6
|
import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
|
|
7
7
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
8
8
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
9
9
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
10
|
-
import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
11
10
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
13
11
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
14
12
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
15
13
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -17,7 +15,7 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
|
17
15
|
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
18
16
|
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
19
17
|
import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
20
|
-
import {
|
|
18
|
+
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
21
19
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
22
20
|
import { SecretValue } from '@aztec/foundation/config';
|
|
23
21
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -25,32 +23,30 @@ import { tryRmDir } from '@aztec/foundation/fs';
|
|
|
25
23
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
26
24
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
27
25
|
import { sleep } from '@aztec/foundation/sleep';
|
|
28
|
-
import {
|
|
26
|
+
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
29
27
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
30
28
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
31
29
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
32
30
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
33
|
-
import { createProverNode } from '@aztec/prover-node';
|
|
34
31
|
import { getPXEConfig } from '@aztec/pxe/server';
|
|
35
32
|
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
36
33
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
37
34
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
38
35
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
39
|
-
import {
|
|
36
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
40
37
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
41
38
|
import fs from 'fs/promises';
|
|
42
39
|
import { tmpdir } from 'os';
|
|
43
40
|
import path from 'path';
|
|
44
41
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
45
42
|
import { foundry } from 'viem/chains';
|
|
43
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
46
44
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
47
45
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
48
46
|
import { getBBConfig } from './get_bb_config.js';
|
|
49
47
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
50
48
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
51
49
|
export { startAnvil };
|
|
52
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
53
|
-
const getAztecUrl = ()=>AZTEC_NODE_URL;
|
|
54
50
|
let telemetry = undefined;
|
|
55
51
|
async function getTelemetryClient(partialConfig = {}) {
|
|
56
52
|
if (!telemetry) {
|
|
@@ -110,65 +106,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
110
106
|
teardown
|
|
111
107
|
};
|
|
112
108
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
|
|
115
|
-
*/ async function setupWithRemoteEnvironment(account, config, logger, numberOfAccounts) {
|
|
116
|
-
const aztecNodeUrl = getAztecUrl();
|
|
117
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
118
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
119
|
-
await waitForNode(aztecNode, logger);
|
|
120
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
121
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
122
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
123
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
124
|
-
const deployL1ContractsValues = {
|
|
125
|
-
l1ContractAddresses,
|
|
126
|
-
l1Client,
|
|
127
|
-
rollupVersion
|
|
128
|
-
};
|
|
129
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
130
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
131
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
132
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
133
|
-
}
|
|
134
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
135
|
-
const teardown = ()=>Promise.resolve();
|
|
136
|
-
logger.verbose('Populating wallet from already registered accounts...');
|
|
137
|
-
const initialFundedAccounts = await getInitialTestAccountsData();
|
|
138
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
139
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
140
|
-
}
|
|
141
|
-
const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
|
|
142
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
143
|
-
return accountManager.address;
|
|
144
|
-
}));
|
|
145
|
-
return {
|
|
146
|
-
anvil: undefined,
|
|
147
|
-
aztecNode,
|
|
148
|
-
aztecNodeService: undefined,
|
|
149
|
-
aztecNodeAdmin: undefined,
|
|
150
|
-
sequencer: undefined,
|
|
151
|
-
proverNode: undefined,
|
|
152
|
-
deployL1ContractsValues,
|
|
153
|
-
config,
|
|
154
|
-
aztecNodeConfig: config,
|
|
155
|
-
initialFundedAccounts,
|
|
156
|
-
wallet,
|
|
157
|
-
accounts: testAccounts,
|
|
158
|
-
logger,
|
|
159
|
-
cheatCodes,
|
|
160
|
-
ethCheatCodes,
|
|
161
|
-
prefilledPublicData: undefined,
|
|
162
|
-
mockGossipSubNetwork: undefined,
|
|
163
|
-
watcher: undefined,
|
|
164
|
-
dateProvider: undefined,
|
|
165
|
-
telemetryClient: undefined,
|
|
166
|
-
acvmConfig: undefined,
|
|
167
|
-
bbConfig: undefined,
|
|
168
|
-
directoryToCleanup: undefined,
|
|
169
|
-
teardown
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
109
|
/**
|
|
173
110
|
* Sets up the environment for the end-to-end tests.
|
|
174
111
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
@@ -178,7 +115,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
178
115
|
let anvil;
|
|
179
116
|
try {
|
|
180
117
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
181
|
-
opts.
|
|
118
|
+
opts.slasherEnabled ??= false;
|
|
182
119
|
const config = {
|
|
183
120
|
...getConfigEnvVars(),
|
|
184
121
|
...opts
|
|
@@ -191,7 +128,10 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
191
128
|
config.realProofs = !!opts.realProofs;
|
|
192
129
|
// Only enforce the time table if requested
|
|
193
130
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
131
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
132
|
+
config.enableDelayer = true;
|
|
194
133
|
config.listenAddress = '127.0.0.1';
|
|
134
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
195
135
|
const logger = getLogger();
|
|
196
136
|
// Create a temp directory for any services that need it and cleanup later
|
|
197
137
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
@@ -201,17 +141,17 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
201
141
|
if (!config.dataDirectory) {
|
|
202
142
|
config.dataDirectory = directoryToCleanup;
|
|
203
143
|
}
|
|
144
|
+
const dateProvider = new TestDateProvider();
|
|
204
145
|
if (!config.l1RpcUrls?.length) {
|
|
205
146
|
if (!isAnvilTestChain(chain.id)) {
|
|
206
147
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
207
148
|
}
|
|
208
|
-
if (AZTEC_NODE_URL) {
|
|
209
|
-
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`);
|
|
210
|
-
}
|
|
211
149
|
const res = await startAnvil({
|
|
212
150
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
213
151
|
accounts: opts.anvilAccounts,
|
|
214
|
-
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined)
|
|
152
|
+
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
153
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
154
|
+
dateProvider
|
|
215
155
|
});
|
|
216
156
|
anvil = res.anvil;
|
|
217
157
|
config.l1RpcUrls = [
|
|
@@ -224,7 +164,6 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
224
164
|
logger.info(`Logging metrics to ${filename}`);
|
|
225
165
|
setupMetricsLogger(filename);
|
|
226
166
|
}
|
|
227
|
-
const dateProvider = new TestDateProvider();
|
|
228
167
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
229
168
|
if (opts.stateLoad) {
|
|
230
169
|
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
@@ -239,8 +178,8 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
239
178
|
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
|
|
240
179
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
241
180
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
242
|
-
} else if (config.
|
|
243
|
-
publisherPrivKeyHex = config.
|
|
181
|
+
} else if (config.sequencerPublisherPrivateKeys && config.sequencerPublisherPrivateKeys.length > 0 && config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY) {
|
|
182
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
244
183
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
245
184
|
} else if (!MNEMONIC) {
|
|
246
185
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -251,17 +190,13 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
251
190
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
252
191
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
253
192
|
publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
|
|
254
|
-
config.
|
|
193
|
+
config.sequencerPublisherPrivateKeys = [
|
|
255
194
|
new SecretValue(publisherPrivKeyHex)
|
|
256
195
|
];
|
|
257
196
|
}
|
|
258
197
|
if (config.coinbase === undefined) {
|
|
259
198
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
260
199
|
}
|
|
261
|
-
if (AZTEC_NODE_URL) {
|
|
262
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
263
|
-
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
264
|
-
}
|
|
265
200
|
// Determine which addresses to fund in genesis
|
|
266
201
|
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
|
|
267
202
|
const addressesToFund = initialFundedAccounts.map((a)=>a.address);
|
|
@@ -270,7 +205,8 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
270
205
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
271
206
|
addressesToFund.push(sponsoredFPCAddress);
|
|
272
207
|
}
|
|
273
|
-
const
|
|
208
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
209
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
|
|
274
210
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
275
211
|
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
276
212
|
if (enableAutomine) {
|
|
@@ -300,14 +236,19 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
300
236
|
if (enableAutomine) {
|
|
301
237
|
await ethCheatCodes.setAutomine(false);
|
|
302
238
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
303
|
-
|
|
239
|
+
}
|
|
240
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
241
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
242
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
243
|
+
if (!anvil) {
|
|
244
|
+
dateProvider.setTime(await ethCheatCodes.lastBlockTimestamp() * 1000);
|
|
304
245
|
}
|
|
305
246
|
if (opts.l2StartTime) {
|
|
306
247
|
await ethCheatCodes.warp(opts.l2StartTime, {
|
|
307
248
|
resetBlockInterval: true
|
|
308
249
|
});
|
|
309
250
|
}
|
|
310
|
-
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
251
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider, opts.anvilTestWatcherOpts);
|
|
311
252
|
if (!opts.disableAnvilTestWatcher) {
|
|
312
253
|
await watcher.start();
|
|
313
254
|
}
|
|
@@ -328,7 +269,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
328
269
|
let mockGossipSubNetwork;
|
|
329
270
|
let p2pClientDeps = undefined;
|
|
330
271
|
if (opts.mockGossipSubNetwork) {
|
|
331
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
272
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
332
273
|
p2pClientDeps = {
|
|
333
274
|
p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
|
|
334
275
|
};
|
|
@@ -355,33 +296,53 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
355
296
|
]);
|
|
356
297
|
}
|
|
357
298
|
}
|
|
299
|
+
// When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
|
|
300
|
+
// We apply these overrides to a copy so they don't leak into the returned config.
|
|
301
|
+
// Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
|
|
302
|
+
const initialNodeConfig = opts.skipInitialSequencer ? {
|
|
303
|
+
...config,
|
|
304
|
+
disableValidator: true,
|
|
305
|
+
...opts.mockGossipSubNetwork ? {} : {
|
|
306
|
+
p2pEnabled: false,
|
|
307
|
+
bootstrapNodes: []
|
|
308
|
+
}
|
|
309
|
+
} : config;
|
|
358
310
|
const aztecNodeService = await withLoggerBindings({
|
|
359
311
|
actor: 'node-0'
|
|
360
|
-
}, ()=>AztecNodeService.createAndSync(
|
|
312
|
+
}, ()=>AztecNodeService.createAndSync(initialNodeConfig, {
|
|
361
313
|
dateProvider,
|
|
362
314
|
telemetry: telemetryClient,
|
|
363
315
|
p2pClientDeps
|
|
364
316
|
}, {
|
|
365
|
-
|
|
317
|
+
genesis,
|
|
318
|
+
dontStartSequencer: opts.skipInitialSequencer
|
|
366
319
|
}));
|
|
367
320
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
368
|
-
if (sequencerClient) {
|
|
369
|
-
const publisher = sequencerClient.sequencer.publisher;
|
|
370
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
371
|
-
}
|
|
372
321
|
let proverNode = undefined;
|
|
373
322
|
if (opts.startProverNode) {
|
|
374
323
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
375
324
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
376
325
|
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
|
|
377
326
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
327
|
+
const p2pClientDeps = {
|
|
328
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork),
|
|
329
|
+
rpcTxProviders: [
|
|
330
|
+
aztecNodeService
|
|
331
|
+
]
|
|
382
332
|
};
|
|
383
|
-
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config,
|
|
333
|
+
({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
|
|
334
|
+
...config.proverNodeConfig,
|
|
335
|
+
dataDirectory: proverNodeDataDirectory
|
|
336
|
+
}, {
|
|
337
|
+
dateProvider,
|
|
338
|
+
p2pClientDeps,
|
|
339
|
+
telemetry: telemetryClient
|
|
340
|
+
}, {
|
|
341
|
+
genesis
|
|
342
|
+
}));
|
|
384
343
|
}
|
|
344
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
345
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
385
346
|
logger.verbose('Creating a pxe...');
|
|
386
347
|
const pxeConfig = {
|
|
387
348
|
...getPXEConfig(),
|
|
@@ -404,7 +365,9 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
404
365
|
await cheatCodes.rollup.debugRollup();
|
|
405
366
|
}
|
|
406
367
|
let accounts = [];
|
|
407
|
-
if (
|
|
368
|
+
if (opts.skipInitialSequencer) {
|
|
369
|
+
logger.info('Sequencer not started on initial node, skipping block progression');
|
|
370
|
+
} else if (shouldDeployAccounts) {
|
|
408
371
|
logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
|
|
409
372
|
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
410
373
|
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
@@ -443,7 +406,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
443
406
|
logger.error(`Error during e2e test teardown`, err);
|
|
444
407
|
} finally{
|
|
445
408
|
try {
|
|
446
|
-
await telemetryClient
|
|
409
|
+
await telemetryClient.stop();
|
|
447
410
|
} catch (err) {
|
|
448
411
|
logger.error(`Error during telemetry client stop`, err);
|
|
449
412
|
}
|
|
@@ -463,8 +426,10 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
463
426
|
initialFundedAccounts,
|
|
464
427
|
logger,
|
|
465
428
|
mockGossipSubNetwork,
|
|
466
|
-
|
|
429
|
+
genesis,
|
|
467
430
|
proverNode,
|
|
431
|
+
sequencerDelayer,
|
|
432
|
+
proverDelayer,
|
|
468
433
|
sequencer: sequencerClient,
|
|
469
434
|
teardown,
|
|
470
435
|
telemetryClient,
|
|
@@ -523,79 +488,43 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
523
488
|
}
|
|
524
489
|
export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
|
|
525
490
|
targetBlock ??= await node.getBlockNumber();
|
|
526
|
-
await retryUntil(async ()=>await node.
|
|
491
|
+
await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
|
|
527
492
|
}
|
|
528
|
-
|
|
493
|
+
/**
|
|
494
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
495
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
496
|
+
*/ export function createAndSyncProverNode(proverNodePrivateKey, baseConfig, configOverrides, deps, options) {
|
|
529
497
|
return withLoggerBindings({
|
|
530
498
|
actor: 'prover-0'
|
|
531
499
|
}, async ()=>{
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
...aztecNodeConfig,
|
|
540
|
-
dataDirectory: proverNodeConfig.dataDirectory
|
|
541
|
-
};
|
|
542
|
-
const archiver = await createArchiver(archiverConfig, {
|
|
543
|
-
blobClient,
|
|
544
|
-
dateProvider: proverNodeDeps.dateProvider
|
|
545
|
-
}, {
|
|
546
|
-
blockUntilSync: true
|
|
547
|
-
});
|
|
548
|
-
const proverConfig = {
|
|
549
|
-
...aztecNodeConfig,
|
|
550
|
-
txCollectionNodeRpcUrls: [],
|
|
551
|
-
realProofs: false,
|
|
552
|
-
proverAgentCount: 2,
|
|
553
|
-
publisherPrivateKeys: [
|
|
500
|
+
const proverNode = await AztecNodeService.createAndSync({
|
|
501
|
+
...baseConfig,
|
|
502
|
+
...configOverrides,
|
|
503
|
+
p2pPort: 0,
|
|
504
|
+
enableProverNode: true,
|
|
505
|
+
disableValidator: true,
|
|
506
|
+
proverPublisherPrivateKeys: [
|
|
554
507
|
new SecretValue(proverNodePrivateKey)
|
|
555
|
-
]
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
txGatheringIntervalMs: 1000,
|
|
560
|
-
txGatheringBatchSize: 10,
|
|
561
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
562
|
-
txGatheringTimeoutMs: 24_000,
|
|
563
|
-
proverNodeFailedEpochStore: undefined,
|
|
564
|
-
proverId: EthAddress.fromNumber(1),
|
|
565
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
566
|
-
...proverNodeConfig
|
|
567
|
-
};
|
|
568
|
-
const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node', proverNodeDeps.dateProvider);
|
|
569
|
-
const proverNode = await createProverNode(proverConfig, {
|
|
570
|
-
...proverNodeDeps,
|
|
571
|
-
aztecNodeTxProvider,
|
|
572
|
-
archiver: archiver,
|
|
573
|
-
l1TxUtils
|
|
574
|
-
}, {
|
|
575
|
-
prefilledPublicData
|
|
508
|
+
]
|
|
509
|
+
}, deps, {
|
|
510
|
+
genesis: options.genesis,
|
|
511
|
+
dontStartProverNode: options.dontStart
|
|
576
512
|
});
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
});
|
|
580
|
-
if (!proverNodeConfig.dontStart) {
|
|
581
|
-
await proverNode.start();
|
|
513
|
+
if (!proverNode.getProverNode()) {
|
|
514
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
582
515
|
}
|
|
583
|
-
|
|
516
|
+
getLogger().info(`Created and synced prover node`);
|
|
517
|
+
return {
|
|
518
|
+
proverNode
|
|
519
|
+
};
|
|
584
520
|
});
|
|
585
521
|
}
|
|
586
|
-
function
|
|
587
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
588
|
-
const log = createLogger(logName);
|
|
589
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
590
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
591
|
-
return l1TxUtils;
|
|
592
|
-
}
|
|
593
|
-
export function getBalancesFn(symbol, method, from, logger) {
|
|
522
|
+
export function getBalancesFn(symbol, method, logger) {
|
|
594
523
|
const balances = async (...addressLikes)=>{
|
|
595
524
|
const addresses = addressLikes.map((addressLike)=>'address' in addressLike ? addressLike.address : addressLike);
|
|
596
|
-
const b = await Promise.all(addresses.map((address)=>method(address).simulate({
|
|
597
|
-
from
|
|
598
|
-
})));
|
|
525
|
+
const b = await Promise.all(addresses.map(async (address)=>(await method(address).simulate({
|
|
526
|
+
from: address
|
|
527
|
+
})).result));
|
|
599
528
|
const debugString = `${symbol} balances: ${addresses.map((address, i)=>`${address}: ${b[i]}`).join(', ')}`;
|
|
600
529
|
logger.verbose(debugString);
|
|
601
530
|
return b;
|
|
@@ -639,7 +568,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
639
568
|
/**
|
|
640
569
|
* Helper function to deploy accounts.
|
|
641
570
|
* Returns deployed account data that can be used by tests.
|
|
642
|
-
*/ export const deployAccounts = (numberOfAccounts, logger)=>async ({ wallet, initialFundedAccounts })=>{
|
|
571
|
+
*/ export const deployAccounts = (numberOfAccounts, logger, deployOptions)=>async ({ wallet, initialFundedAccounts })=>{
|
|
643
572
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
644
573
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
645
574
|
}
|
|
@@ -650,8 +579,9 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
650
579
|
const accountManager = await wallet.createSchnorrAccount(deployedAccounts[i].secret, deployedAccounts[i].salt, deployedAccounts[i].signingKey);
|
|
651
580
|
const deployMethod = await accountManager.getDeployMethod();
|
|
652
581
|
await deployMethod.send({
|
|
653
|
-
from:
|
|
654
|
-
skipClassPublication: i !== 0
|
|
582
|
+
from: NO_FROM,
|
|
583
|
+
skipClassPublication: i !== 0,
|
|
584
|
+
...deployOptions
|
|
655
585
|
});
|
|
656
586
|
}
|
|
657
587
|
return {
|
|
@@ -672,7 +602,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
672
602
|
...instances.map((instance)=>publishInstance(wallet, instance))
|
|
673
603
|
]);
|
|
674
604
|
const batch = new BatchCall(wallet, calls);
|
|
675
|
-
const txReceipt = await batch.send({
|
|
605
|
+
const { receipt: txReceipt } = await batch.send({
|
|
676
606
|
from: accountsToDeploy[0]
|
|
677
607
|
});
|
|
678
608
|
if (waitUntilProven) {
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
5
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
|
-
import type {
|
|
7
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
6
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
8
7
|
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
9
8
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
10
9
|
export declare function createNodes(config: AztecNodeConfig & {
|
|
11
10
|
dontStartSequencer?: boolean;
|
|
12
|
-
}, dateProvider: DateProvider, bootstrapNodeEnr: string, numNodes: number, bootNodePort: number,
|
|
11
|
+
}, dateProvider: DateProvider, bootstrapNodeEnr: string, numNodes: number, bootNodePort: number, genesis?: GenesisData, dataDirectory?: string, metricsPort?: number, indexOffset?: number, validatorsPerNode?: number): Promise<AztecNodeService[]>;
|
|
13
12
|
/** Extended config type for createNode with test-specific overrides. */
|
|
14
13
|
export type CreateNodeConfig = AztecNodeConfig & {
|
|
15
14
|
/** Whether to skip starting the sequencer. */
|
|
@@ -18,10 +17,14 @@ export type CreateNodeConfig = AztecNodeConfig & {
|
|
|
18
17
|
validatorPrivateKey?: `0x${string}`;
|
|
19
18
|
};
|
|
20
19
|
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */
|
|
21
|
-
export declare function createNode(config: CreateNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number | number[],
|
|
20
|
+
export declare function createNode(config: CreateNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number | number[], genesis?: GenesisData, dataDirectory?: string, metricsPort?: number): Promise<AztecNodeService>;
|
|
22
21
|
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
23
|
-
export declare function createNonValidatorNode(baseConfig: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined,
|
|
24
|
-
export declare function createProverNode(config: AztecNodeConfig, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number,
|
|
22
|
+
export declare function createNonValidatorNode(baseConfig: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, genesis?: GenesisData, dataDirectory?: string, metricsPort?: number): Promise<AztecNodeService>;
|
|
23
|
+
export declare function createProverNode(config: AztecNodeConfig, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number, deps: {
|
|
24
|
+
dateProvider: DateProvider;
|
|
25
|
+
}, genesis?: GenesisData, dataDirectory?: string, metricsPort?: number): Promise<{
|
|
26
|
+
proverNode: AztecNodeService;
|
|
27
|
+
}>;
|
|
25
28
|
export declare function createP2PConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
26
29
|
export declare function createValidatorConfig(config: CreateNodeConfig, bootstrapNodeEnr?: string, port?: number, addressIndex?: number | number[], dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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UFBTSxFQUN0QixXQUFXLENBQUMsRUFBRSxNQUFNLEdBQ25CLE9BQU8sQ0FBQztJQUFFLFVBQVUsRUFBRSxnQkFBZ0IsQ0FBQTtDQUFFLENBQUMsQ0FnQjNDO0FBRUQsd0JBQXNCLGVBQWUsQ0FDbkMsTUFBTSxFQUFFLGVBQWUsRUFDdkIsZ0JBQWdCLENBQUMsRUFBRSxNQUFNLEVBQ3pCLElBQUksQ0FBQyxFQUFFLE1BQU0sRUFDYixhQUFhLENBQUMsRUFBRSxNQUFNLDRCQWdCdkI7QUFFRCx3QkFBc0IscUJBQXFCLENBQ3pDLE1BQU0sRUFBRSxnQkFBZ0IsRUFDeEIsZ0JBQWdCLENBQUMsRUFBRSxNQUFNLEVBQ3pCLElBQUksQ0FBQyxFQUFFLE1BQU0sRUFDYixZQUFZLEdBQUUsTUFBTSxHQUFHLE1BQU0sRUFBTSxFQUNuQyxhQUFhLENBQUMsRUFBRSxNQUFNLDRCQW9CdkIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAW7D,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAOnD,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AM,EAAE,eAAe,EACvB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EACpC,OAAO,CAAC,EAAE,WAAW,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,UAAU,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAgB3C;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,4BAgBvB;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,MAAM,GAAG,MAAM,EAAM,EACnC,aAAa,CAAC,EAAE,MAAM,4BAoBvB"}
|
|
@@ -25,7 +25,7 @@ export function generatePrivateKeys(startIndex, numberOfKeys) {
|
|
|
25
25
|
}
|
|
26
26
|
return privateKeys;
|
|
27
27
|
}
|
|
28
|
-
export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNodes, bootNodePort,
|
|
28
|
+
export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNodes, bootNodePort, genesis, dataDirectory, metricsPort, indexOffset = 0, validatorsPerNode = 1) {
|
|
29
29
|
const nodePromises = [];
|
|
30
30
|
for(let i = 0; i < numNodes; i++){
|
|
31
31
|
const index = indexOffset + i;
|
|
@@ -35,7 +35,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
35
35
|
const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
|
|
36
36
|
// Assign data directory
|
|
37
37
|
const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
|
|
38
|
-
const nodePromise = createNode(config, dateProvider, port, bootstrapNodeEnr, validatorIndices,
|
|
38
|
+
const nodePromise = createNode(config, dateProvider, port, bootstrapNodeEnr, validatorIndices, genesis, dataDir, metricsPort);
|
|
39
39
|
nodePromises.push(nodePromise);
|
|
40
40
|
}
|
|
41
41
|
const nodes = await Promise.all(nodePromises);
|
|
@@ -46,7 +46,7 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
46
46
|
}
|
|
47
47
|
return nodes;
|
|
48
48
|
}
|
|
49
|
-
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex,
|
|
49
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex, genesis, dataDirectory, metricsPort) {
|
|
50
50
|
const actorIndex = validatorCounter++;
|
|
51
51
|
return await withLoggerBindings({
|
|
52
52
|
actor: `validator-${actorIndex}`
|
|
@@ -57,12 +57,12 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
57
57
|
telemetry,
|
|
58
58
|
dateProvider
|
|
59
59
|
}, {
|
|
60
|
-
|
|
60
|
+
genesis,
|
|
61
61
|
dontStartSequencer: config.dontStartSequencer
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
/** Creates a P2P enabled instance of Aztec Node Service without a validator */ export async function createNonValidatorNode(baseConfig, dateProvider, tcpPort, bootstrapNode,
|
|
65
|
+
/** Creates a P2P enabled instance of Aztec Node Service without a validator */ export async function createNonValidatorNode(baseConfig, dateProvider, tcpPort, bootstrapNode, genesis, dataDirectory, metricsPort) {
|
|
66
66
|
const actorIndex = nodeCounter++;
|
|
67
67
|
return await withLoggerBindings({
|
|
68
68
|
actor: `node-${actorIndex}`
|
|
@@ -72,32 +72,35 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
72
72
|
...p2pConfig,
|
|
73
73
|
disableValidator: true,
|
|
74
74
|
validatorPrivateKeys: undefined,
|
|
75
|
-
|
|
75
|
+
sequencerPublisherPrivateKeys: []
|
|
76
76
|
};
|
|
77
77
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
78
78
|
return await AztecNodeService.createAndSync(config, {
|
|
79
79
|
telemetry,
|
|
80
80
|
dateProvider
|
|
81
81
|
}, {
|
|
82
|
-
|
|
82
|
+
genesis
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
export async function createProverNode(config, tcpPort, bootstrapNode, addressIndex,
|
|
86
|
+
export async function createProverNode(config, tcpPort, bootstrapNode, addressIndex, deps, genesis, dataDirectory, metricsPort) {
|
|
87
87
|
const actorIndex = proverCounter++;
|
|
88
88
|
return await withLoggerBindings({
|
|
89
89
|
actor: `prover-${actorIndex}`
|
|
90
90
|
}, async ()=>{
|
|
91
91
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex);
|
|
92
92
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...
|
|
93
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
94
|
+
return await createAndSyncProverNode(bufferToHex(proverNodePrivateKey), {
|
|
95
|
+
...config,
|
|
96
|
+
...p2pConfig
|
|
97
|
+
}, {
|
|
97
98
|
dataDirectory
|
|
98
|
-
},
|
|
99
|
-
...
|
|
99
|
+
}, {
|
|
100
|
+
...deps,
|
|
100
101
|
telemetry
|
|
102
|
+
}, {
|
|
103
|
+
genesis
|
|
101
104
|
});
|
|
102
105
|
});
|
|
103
106
|
}
|
|
@@ -133,7 +136,7 @@ export async function createValidatorConfig(config, bootstrapNodeEnr, port, addr
|
|
|
133
136
|
...config,
|
|
134
137
|
...p2pConfig,
|
|
135
138
|
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
136
|
-
|
|
139
|
+
sequencerPublisherPrivateKeys: [
|
|
137
140
|
new SecretValue(attesterPrivateKeys[0])
|
|
138
141
|
]
|
|
139
142
|
};
|