@aztec/end-to-end 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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/benchmark.d.ts +17 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +38 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +23 -17
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +143 -136
- 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/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +7 -27
- package/dest/bench/utils.d.ts +8 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +33 -19
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +12 -10
- 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 +120 -117
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +33 -16
- 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 +124 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +7 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +20 -14
- package/dest/e2e_epochs/epochs_test.d.ts +49 -16
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +188 -64
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +5 -7
- package/dest/e2e_fees/fees_test.d.ts +25 -18
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +162 -141
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +18 -19
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +32 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +11 -9
- package/dest/e2e_p2p/p2p_network.d.ts +237 -28
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +176 -129
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +206 -0
- package/dest/e2e_p2p/shared.d.ts +44 -15
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +102 -68
- 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 +20 -11
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +103 -93
- 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 +19 -24
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +126 -145
- 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 +75 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +73 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- 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 +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- 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/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 +37 -0
- package/dest/fixtures/setup.d.ts +272 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +735 -0
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +57 -38
- package/dest/fixtures/token_utils.d.ts +6 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +13 -9
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- 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/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/index.d.ts +1 -1
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +9 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +34 -30
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +21 -12
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- 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 +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +87 -50
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +11 -4
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +32 -18
- 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 +18 -6
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +159 -30
- package/dest/spartan/tx_metrics.d.ts +102 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +475 -0
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +19 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- 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/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/dest/test-wallet/test_wallet.d.ts +85 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +273 -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 +66 -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 +53 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +56 -46
- package/src/bench/client_flows/benchmark.ts +43 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +203 -206
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +38 -22
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +141 -152
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +180 -127
- package/src/e2e_deploy_contract/deploy_test.ts +25 -17
- package/src/e2e_epochs/epochs_test.ts +254 -116
- package/src/e2e_fees/bridging_race.notest.ts +6 -12
- package/src/e2e_fees/fees_test.ts +215 -229
- package/src/e2e_l1_publisher/write_json.ts +20 -19
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +38 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +12 -10
- package/src/e2e_p2p/p2p_network.ts +246 -201
- package/src/e2e_p2p/reqresp/utils.ts +274 -0
- package/src/e2e_p2p/shared.ts +132 -82
- 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 +129 -117
- 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 +154 -199
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +95 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +188 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +1056 -0
- package/src/fixtures/setup_p2p_test.ts +70 -56
- package/src/fixtures/token_utils.ts +9 -8
- package/src/fixtures/utils.ts +29 -947
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- 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 +4 -6
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +37 -40
- package/src/shared/gas_portal_test_harness.ts +24 -14
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +142 -114
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +39 -19
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +234 -32
- package/src/spartan/tx_metrics.ts +434 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -942
- package/src/test-wallet/test_wallet.ts +376 -0
- package/src/test-wallet/utils.ts +108 -0
- package/src/test-wallet/wallet_worker_script.ts +63 -0
- package/src/test-wallet/worker_wallet.ts +218 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- 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/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
|
+
import { range } from '@aztec/foundation/array';
|
|
5
6
|
import { SecretValue } from '@aztec/foundation/config';
|
|
6
|
-
import {
|
|
7
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
7
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
8
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
9
|
-
import type {
|
|
10
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
11
|
|
|
12
12
|
import getPort from 'get-port';
|
|
13
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
14
13
|
|
|
15
14
|
import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
16
15
|
import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
|
|
@@ -21,6 +20,11 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
21
20
|
// to avoid running validators with the same key
|
|
22
21
|
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
23
22
|
|
|
23
|
+
// Global counters for actor naming (start at 1)
|
|
24
|
+
let validatorCounter = 1;
|
|
25
|
+
let nodeCounter = 1;
|
|
26
|
+
let proverCounter = 1;
|
|
27
|
+
|
|
24
28
|
export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
|
|
25
29
|
const privateKeys: `0x${string}`[] = [];
|
|
26
30
|
// Do not start from 0 as it is used during setup
|
|
@@ -36,33 +40,34 @@ export async function createNodes(
|
|
|
36
40
|
bootstrapNodeEnr: string,
|
|
37
41
|
numNodes: number,
|
|
38
42
|
bootNodePort: number,
|
|
39
|
-
|
|
43
|
+
genesis?: GenesisData,
|
|
40
44
|
dataDirectory?: string,
|
|
41
45
|
metricsPort?: number,
|
|
42
46
|
indexOffset = 0,
|
|
47
|
+
validatorsPerNode = 1,
|
|
43
48
|
): Promise<AztecNodeService[]> {
|
|
44
49
|
const nodePromises: Promise<AztecNodeService>[] = [];
|
|
45
|
-
const loggerIdStorage = new AsyncLocalStorage<string>();
|
|
46
|
-
const logNameHandler = (module: string) =>
|
|
47
|
-
loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
|
|
48
|
-
addLogNameHandler(logNameHandler);
|
|
49
50
|
|
|
50
51
|
for (let i = 0; i < numNodes; i++) {
|
|
51
52
|
const index = indexOffset + i;
|
|
52
53
|
// We run on ports from the bootnode upwards
|
|
53
54
|
const port = bootNodePort + 1 + index;
|
|
54
55
|
|
|
56
|
+
// Determine validator indices for this node
|
|
57
|
+
const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
|
|
58
|
+
|
|
59
|
+
// Assign data directory
|
|
55
60
|
const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
|
|
61
|
+
|
|
56
62
|
const nodePromise = createNode(
|
|
57
63
|
config,
|
|
58
64
|
dateProvider,
|
|
59
65
|
port,
|
|
60
66
|
bootstrapNodeEnr,
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
validatorIndices,
|
|
68
|
+
genesis,
|
|
63
69
|
dataDir,
|
|
64
70
|
metricsPort,
|
|
65
|
-
loggerIdStorage,
|
|
66
71
|
);
|
|
67
72
|
nodePromises.push(nodePromise);
|
|
68
73
|
}
|
|
@@ -74,32 +79,42 @@ export async function createNodes(
|
|
|
74
79
|
throw new Error('Sequencer not found');
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
removeLogNameHandler(logNameHandler);
|
|
78
82
|
return nodes;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
/**
|
|
85
|
+
/** Extended config type for createNode with test-specific overrides. */
|
|
86
|
+
export type CreateNodeConfig = AztecNodeConfig & {
|
|
87
|
+
/** Whether to skip starting the sequencer. */
|
|
88
|
+
dontStartSequencer?: boolean;
|
|
89
|
+
/** Override the private key (instead of deriving from addressIndex). */
|
|
90
|
+
validatorPrivateKey?: `0x${string}`;
|
|
91
|
+
/** Corrupt only the block proposal at this indexWithinCheckpoint (testing only). */
|
|
92
|
+
invalidBlockProposalIndexWithinCheckpoint?: number;
|
|
93
|
+
/** Accept proposal gossip regardless of slot timing (testing only). */
|
|
94
|
+
skipProposalSlotValidation?: boolean;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */
|
|
82
98
|
export async function createNode(
|
|
83
|
-
config:
|
|
99
|
+
config: CreateNodeConfig,
|
|
84
100
|
dateProvider: DateProvider,
|
|
85
101
|
tcpPort: number,
|
|
86
102
|
bootstrapNode: string | undefined,
|
|
87
|
-
addressIndex: number,
|
|
88
|
-
|
|
103
|
+
addressIndex: number | number[],
|
|
104
|
+
genesis?: GenesisData,
|
|
89
105
|
dataDirectory?: string,
|
|
90
106
|
metricsPort?: number,
|
|
91
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
92
107
|
) {
|
|
93
|
-
const
|
|
108
|
+
const actorIndex = validatorCounter++;
|
|
109
|
+
return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
|
|
94
110
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
95
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
111
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
96
112
|
return await AztecNodeService.createAndSync(
|
|
97
113
|
validatorConfig,
|
|
98
114
|
{ telemetry, dateProvider },
|
|
99
|
-
{
|
|
115
|
+
{ genesis, dontStartSequencer: config.dontStartSequencer },
|
|
100
116
|
);
|
|
101
|
-
};
|
|
102
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
117
|
+
});
|
|
103
118
|
}
|
|
104
119
|
|
|
105
120
|
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
@@ -108,23 +123,22 @@ export async function createNonValidatorNode(
|
|
|
108
123
|
dateProvider: DateProvider,
|
|
109
124
|
tcpPort: number,
|
|
110
125
|
bootstrapNode: string | undefined,
|
|
111
|
-
|
|
126
|
+
genesis?: GenesisData,
|
|
112
127
|
dataDirectory?: string,
|
|
113
128
|
metricsPort?: number,
|
|
114
|
-
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
115
129
|
) {
|
|
116
|
-
const
|
|
130
|
+
const actorIndex = nodeCounter++;
|
|
131
|
+
return await withLoggerBindings({ actor: `node-${actorIndex}` }, async () => {
|
|
117
132
|
const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
|
|
118
133
|
const config: AztecNodeConfig = {
|
|
119
134
|
...p2pConfig,
|
|
120
135
|
disableValidator: true,
|
|
121
136
|
validatorPrivateKeys: undefined,
|
|
122
|
-
|
|
137
|
+
sequencerPublisherPrivateKeys: [],
|
|
123
138
|
};
|
|
124
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
125
|
-
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, {
|
|
126
|
-
};
|
|
127
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
139
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
140
|
+
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { genesis });
|
|
141
|
+
});
|
|
128
142
|
}
|
|
129
143
|
|
|
130
144
|
export async function createProverNode(
|
|
@@ -132,34 +146,26 @@ export async function createProverNode(
|
|
|
132
146
|
tcpPort: number,
|
|
133
147
|
bootstrapNode: string | undefined,
|
|
134
148
|
addressIndex: number,
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
deps: { dateProvider: DateProvider },
|
|
150
|
+
genesis?: GenesisData,
|
|
137
151
|
dataDirectory?: string,
|
|
138
152
|
metricsPort?: number,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
154
|
+
const actorIndex = proverCounter++;
|
|
155
|
+
return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
|
|
142
156
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
143
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
157
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
144
158
|
|
|
145
|
-
const
|
|
146
|
-
config,
|
|
147
|
-
bootstrapNode,
|
|
148
|
-
tcpPort,
|
|
149
|
-
dataDirectory,
|
|
150
|
-
);
|
|
159
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
151
160
|
|
|
152
|
-
const aztecNodeRpcTxProvider = undefined;
|
|
153
161
|
return await createAndSyncProverNode(
|
|
154
162
|
bufferToHex(proverNodePrivateKey),
|
|
155
|
-
config,
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{ ...proverNodeDeps, telemetry },
|
|
163
|
+
{ ...config, ...p2pConfig },
|
|
164
|
+
{ dataDirectory },
|
|
165
|
+
{ ...deps, telemetry },
|
|
166
|
+
{ genesis },
|
|
160
167
|
);
|
|
161
|
-
};
|
|
162
|
-
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
|
|
168
|
+
});
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
export async function createP2PConfig(
|
|
@@ -185,19 +191,27 @@ export async function createP2PConfig(
|
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
export async function createValidatorConfig(
|
|
188
|
-
config:
|
|
194
|
+
config: CreateNodeConfig,
|
|
189
195
|
bootstrapNodeEnr?: string,
|
|
190
196
|
port?: number,
|
|
191
|
-
addressIndex: number = 1,
|
|
197
|
+
addressIndex: number | number[] = 1,
|
|
192
198
|
dataDirectory?: string,
|
|
193
199
|
) {
|
|
194
|
-
const
|
|
200
|
+
const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
|
|
201
|
+
if (addressIndices.length === 0 && !config.validatorPrivateKey) {
|
|
202
|
+
throw new Error('At least one address index must be provided to create a validator config');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Use override private key if provided, otherwise derive from address indices
|
|
206
|
+
const attesterPrivateKeys = config.validatorPrivateKey
|
|
207
|
+
? [config.validatorPrivateKey]
|
|
208
|
+
: addressIndices.map(index => bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!));
|
|
195
209
|
const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
|
|
196
210
|
const nodeConfig: AztecNodeConfig = {
|
|
197
211
|
...config,
|
|
198
212
|
...p2pConfig,
|
|
199
|
-
validatorPrivateKeys: new SecretValue(
|
|
200
|
-
|
|
213
|
+
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
214
|
+
sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
|
|
201
215
|
};
|
|
202
216
|
|
|
203
217
|
return nodeConfig;
|
|
@@ -6,9 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
6
6
|
|
|
7
7
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
|
-
const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
|
+
from: admin,
|
|
11
|
+
});
|
|
12
12
|
|
|
13
13
|
if (initialAdminBalance > 0n) {
|
|
14
14
|
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
@@ -16,7 +16,7 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
|
|
|
16
16
|
|
|
17
17
|
logger.info('L2 contract deployed');
|
|
18
18
|
|
|
19
|
-
return contract;
|
|
19
|
+
return { contract, instance };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export async function mintTokensToPrivate(
|
|
@@ -24,8 +24,9 @@ export async function mintTokensToPrivate(
|
|
|
24
24
|
minter: AztecAddress,
|
|
25
25
|
recipient: AztecAddress,
|
|
26
26
|
amount: bigint,
|
|
27
|
+
additionalScopes?: AztecAddress[],
|
|
27
28
|
) {
|
|
28
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter })
|
|
29
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export async function expectTokenBalance(
|
|
@@ -36,8 +37,8 @@ export async function expectTokenBalance(
|
|
|
36
37
|
logger: Logger,
|
|
37
38
|
) {
|
|
38
39
|
// Then check the balance
|
|
39
|
-
const contractWithWallet =
|
|
40
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
40
|
+
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
41
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
41
42
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
42
43
|
expect(balance).toBe(expectedBalance);
|
|
43
44
|
}
|
|
@@ -55,7 +56,7 @@ export async function mintNotes(
|
|
|
55
56
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
56
57
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
57
58
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
|
58
|
-
await new BatchCall(wallet, actions).send({ from: minter })
|
|
59
|
+
await new BatchCall(wallet, actions).send({ from: minter });
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
|