@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +60 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -27
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -43
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +66 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +34 -53
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -6
- package/dest/e2e_epochs/epochs_test.d.ts +56 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +222 -42
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts +16 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +87 -88
- package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +132 -0
- package/dest/e2e_p2p/p2p_network.d.ts +56 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +154 -125
- package/dest/e2e_p2p/shared.d.ts +41 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +146 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +51 -24
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +8 -15
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +14 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +8 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +120 -104
- package/dest/fixtures/token_utils.d.ts +4 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +24 -7
- package/dest/fixtures/utils.d.ts +65 -22
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +439 -318
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +42 -0
- package/dest/shared/cross_chain_test_harness.d.ts +28 -18
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +97 -41
- package/dest/shared/gas_portal_test_harness.d.ts +23 -18
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +43 -25
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +5 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +136 -90
- package/dest/simulators/lending_simulator.d.ts +5 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +11 -15
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -22
- package/dest/spartan/utils.d.ts +60 -307
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +200 -115
- package/package.json +60 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +26 -52
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
- package/src/e2e_deploy_contract/deploy_test.ts +11 -8
- package/src/e2e_epochs/epochs_test.ts +276 -54
- package/src/e2e_fees/bridging_race.notest.ts +75 -0
- package/src/e2e_fees/fees_test.ts +121 -108
- package/src/e2e_l1_publisher/write_json.ts +74 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
- package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
- package/src/e2e_p2p/p2p_network.ts +212 -144
- package/src/e2e_p2p/shared.ts +234 -14
- package/src/e2e_token_contract/token_contract_test.ts +42 -38
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +2 -10
- package/src/fixtures/get_bb_config.ts +15 -11
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +5 -6
- package/src/fixtures/setup_p2p_test.ts +112 -30
- package/src/fixtures/snapshot_manager.ts +150 -102
- package/src/fixtures/token_utils.ts +33 -8
- package/src/fixtures/utils.ts +530 -352
- package/src/fixtures/web3signer.ts +46 -0
- package/src/guides/up_quick_start.sh +4 -4
- package/src/shared/cross_chain_test_harness.ts +92 -52
- package/src/shared/gas_portal_test_harness.ts +47 -31
- package/src/shared/uniswap_l1_l2.ts +127 -124
- package/src/simulators/lending_simulator.ts +11 -15
- package/src/simulators/token_simulator.ts +17 -12
- package/src/spartan/DEVELOP.md +116 -0
- package/src/spartan/setup_test_wallets.ts +144 -29
- package/src/spartan/utils.ts +194 -116
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
export declare const METRICS_PORT = 4318;
|
|
4
2
|
export declare const shouldCollectMetrics: () => 4318 | undefined;
|
|
5
3
|
export declare const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
4
|
+
export declare const TEST_MAX_TX_POOL_SIZE: number;
|
|
6
5
|
export declare const MNEMONIC = "test test test test test test test test test test test junk";
|
|
7
|
-
export declare const privateKey: Buffer
|
|
8
|
-
export declare const privateKey2: Buffer
|
|
9
|
-
export declare const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow
|
|
10
|
-
export declare const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow
|
|
6
|
+
export declare const privateKey: Buffer<ArrayBuffer>;
|
|
7
|
+
export declare const privateKey2: Buffer<ArrayBuffer>;
|
|
8
|
+
export declare const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with overflow";
|
|
9
|
+
export declare const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow";
|
|
11
10
|
export declare const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
12
11
|
export declare const DUPLICATE_NULLIFIER_ERROR: RegExp;
|
|
13
12
|
export declare const NO_L1_TO_L2_MSG_ERROR: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,qBAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,qBAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,wDAAwD,CAAC;AAC1F,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AACpF,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AACvE,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAC+B,CAAC;AACjF,eAAO,MAAM,8BAA8B,QAAkE,CAAC;AAE9G,eAAO,MAAM,sBAAsB,SAAS,CAAC"}
|
|
@@ -6,15 +6,16 @@ export const shouldCollectMetrics = ()=>{
|
|
|
6
6
|
return undefined;
|
|
7
7
|
};
|
|
8
8
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
9
|
+
export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
|
|
9
10
|
export const MNEMONIC = 'test test test test test test test test test test test junk';
|
|
10
11
|
export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
|
|
11
12
|
export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
|
|
12
13
|
/// Common errors
|
|
13
|
-
export const U128_UNDERFLOW_ERROR =
|
|
14
|
-
export const U128_OVERFLOW_ERROR =
|
|
14
|
+
export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
|
|
15
|
+
export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
|
|
15
16
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
16
17
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
17
|
-
export const DUPLICATE_NULLIFIER_ERROR = /dropped|
|
|
18
|
+
export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
|
|
18
19
|
export const NO_L1_TO_L2_MSG_ERROR = /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
|
|
19
20
|
export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
|
|
20
21
|
export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAyBA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
2
2
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
+
import { tryRmDir } from '@aztec/foundation/fs';
|
|
3
4
|
import { promises as fs } from 'fs';
|
|
4
5
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
5
6
|
const { NOIR_RELEASE_DIR = 'noir-repo/target/release', TEMP_DIR = '/tmp', ACVM_BINARY_PATH = '', ACVM_WORKING_DIRECTORY = '', ACVM_FORCE_WASM = '' } = process.env;
|
|
@@ -18,20 +19,7 @@ export async function getACVMConfig(logger) {
|
|
|
18
19
|
});
|
|
19
20
|
logger.verbose(`Using native ACVM binary at ${acvmBinaryPath} with working directory ${acvmWorkingDirectory}`);
|
|
20
21
|
const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
|
|
21
|
-
const cleanup =
|
|
22
|
-
if (directoryToCleanup) {
|
|
23
|
-
try {
|
|
24
|
-
logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
|
|
25
|
-
await fs.rm(directoryToCleanup, {
|
|
26
|
-
recursive: true,
|
|
27
|
-
force: true,
|
|
28
|
-
maxRetries: 3
|
|
29
|
-
});
|
|
30
|
-
} catch (err) {
|
|
31
|
-
logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
22
|
+
const cleanup = ()=>tryRmDir(directoryToCleanup, logger);
|
|
35
23
|
return {
|
|
36
24
|
acvmWorkingDirectory,
|
|
37
25
|
acvmBinaryPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiBjD,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,KACb,OAAO,CAAC,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAqCnE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { fileURLToPath } from '@aztec/aztec.js';
|
|
2
|
+
import { tryRmDir } from '@aztec/foundation/fs';
|
|
2
3
|
import fs from 'node:fs/promises';
|
|
3
4
|
import { tmpdir } from 'node:os';
|
|
4
5
|
import path from 'path';
|
|
5
|
-
const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '' } = process.env;
|
|
6
|
+
const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '', BB_NUM_IVC_VERIFIERS = '1', BB_IVC_CONCURRENCY = '1' } = process.env;
|
|
6
7
|
export const getBBConfig = async (logger)=>{
|
|
7
8
|
try {
|
|
8
9
|
const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
|
|
@@ -22,24 +23,16 @@ export const getBBConfig = async (logger)=>{
|
|
|
22
23
|
'1',
|
|
23
24
|
'true'
|
|
24
25
|
].includes(BB_SKIP_CLEANUP);
|
|
25
|
-
const cleanup =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
await fs.rm(directoryToCleanup, {
|
|
29
|
-
recursive: true,
|
|
30
|
-
force: true,
|
|
31
|
-
maxRetries: 3
|
|
32
|
-
});
|
|
33
|
-
} catch (err) {
|
|
34
|
-
logger.warn(`Failed to delete bb working directory at ${directoryToCleanup}: ${err}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
26
|
+
const cleanup = bbSkipCleanup ? ()=>Promise.resolve() : ()=>tryRmDir(directoryToCleanup);
|
|
27
|
+
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
28
|
+
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
38
29
|
return {
|
|
39
30
|
bbSkipCleanup,
|
|
40
31
|
bbBinaryPath,
|
|
41
32
|
bbWorkingDirectory,
|
|
42
|
-
cleanup
|
|
33
|
+
cleanup,
|
|
34
|
+
numConcurrentIVCVerifiers: numIvcVerifiers,
|
|
35
|
+
bbIVCConcurrency: ivcConcurrency
|
|
43
36
|
};
|
|
44
37
|
} catch (err) {
|
|
45
38
|
logger.error(`Native BB not available, error: ${err}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses } from '@aztec/ethereum';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
export declare function sendL1ToL2Message(message: {
|
|
@@ -6,8 +6,11 @@ export declare function sendL1ToL2Message(message: {
|
|
|
6
6
|
content: Fr;
|
|
7
7
|
secretHash: Fr;
|
|
8
8
|
}, ctx: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
l1Client: ExtendedViemWalletClient;
|
|
10
|
+
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
msgHash: Fr;
|
|
13
|
+
globalLeafIndex: Fr;
|
|
14
|
+
txReceipt: import("viem").TransactionReceipt;
|
|
15
|
+
}>;
|
|
13
16
|
//# sourceMappingURL=l1_to_l2_messaging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/fixtures/l1_to_l2_messaging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAkB,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,QAAQ,EAAE,wBAAwB,CAAC;IACnC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;CAClF;;;;GAgEF"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { RollupContract } from '@aztec/ethereum';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { tryJsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
4
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
3
|
-
import { expect } from '@jest/globals';
|
|
4
5
|
import { decodeEventLog, getContract } from 'viem';
|
|
6
|
+
import { getLogger } from './utils.js';
|
|
5
7
|
export async function sendL1ToL2Message(message, ctx) {
|
|
8
|
+
const logger = getLogger();
|
|
6
9
|
const inbox = getContract({
|
|
7
10
|
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
8
11
|
abi: InboxAbi,
|
|
9
|
-
client: ctx.
|
|
12
|
+
client: ctx.l1Client
|
|
10
13
|
});
|
|
11
14
|
const { recipient, content, secretHash } = message;
|
|
12
|
-
const version =
|
|
15
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
13
16
|
// We inject the message to Inbox
|
|
14
17
|
const txHash = await inbox.write.sendL2Message([
|
|
15
18
|
{
|
|
@@ -18,24 +21,47 @@ export async function sendL1ToL2Message(message, ctx) {
|
|
|
18
21
|
},
|
|
19
22
|
content.toString(),
|
|
20
23
|
secretHash.toString()
|
|
21
|
-
]
|
|
24
|
+
], {
|
|
25
|
+
gas: 1_000_000n
|
|
26
|
+
});
|
|
27
|
+
logger.info(`L1 to L2 message sent in tx ${txHash}`);
|
|
22
28
|
// We check that the message was correctly injected by checking the emitted event
|
|
23
|
-
const txReceipt = await ctx.
|
|
29
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({
|
|
24
30
|
hash: txHash
|
|
25
31
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (txReceipt.status !== 'success') {
|
|
33
|
+
throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
|
|
34
|
+
}
|
|
35
|
+
logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
|
|
36
|
+
if (txReceipt.transactionHash !== txHash) {
|
|
37
|
+
throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
|
|
38
|
+
}
|
|
39
|
+
// Filter for MessageSent events from the Inbox contract by trying to decode each log
|
|
40
|
+
const messageSentLogs = txReceipt.logs.filter((log)=>log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase()).map((log)=>{
|
|
41
|
+
try {
|
|
42
|
+
const decoded = decodeEventLog({
|
|
43
|
+
abi: InboxAbi,
|
|
44
|
+
data: log.data,
|
|
45
|
+
topics: log.topics
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
log,
|
|
49
|
+
decoded
|
|
50
|
+
};
|
|
51
|
+
} catch {
|
|
52
|
+
return null; // Not a decodable event from this ABI
|
|
53
|
+
}
|
|
54
|
+
}).filter((item)=>item !== null && item.decoded.eventName === 'MessageSent');
|
|
55
|
+
if (messageSentLogs.length !== 1) {
|
|
56
|
+
throw new Error(`Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map((item)=>item.log))}`);
|
|
57
|
+
}
|
|
58
|
+
// We already have the decoded event
|
|
59
|
+
const topics = messageSentLogs[0].decoded;
|
|
35
60
|
const receivedMsgHash = topics.args.hash;
|
|
36
61
|
const receivedGlobalLeafIndex = topics.args.index;
|
|
37
|
-
return
|
|
38
|
-
Fr.fromHexString(receivedMsgHash),
|
|
39
|
-
new Fr(receivedGlobalLeafIndex)
|
|
40
|
-
|
|
62
|
+
return {
|
|
63
|
+
msgHash: Fr.fromHexString(receivedMsgHash),
|
|
64
|
+
globalLeafIndex: new Fr(receivedGlobalLeafIndex),
|
|
65
|
+
txReceipt
|
|
66
|
+
};
|
|
41
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
+
import { type DeployL1ContractsArgs, type L1ContractsConfig } from '@aztec/ethereum';
|
|
3
3
|
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
4
4
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
5
|
-
export declare const setupL1Contracts: (l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: Logger, args: Pick<DeployL1ContractsArgs,
|
|
5
|
+
export declare const setupL1Contracts: (l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, logger: Logger, args: Pick<DeployL1ContractsArgs, "genesisArchiveRoot" | "initialValidators"> & L1ContractsConfig) => Promise<import("@aztec/ethereum").DeployL1ContractsReturnType>;
|
|
6
6
|
//# sourceMappingURL=setup_l1_contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAIxG,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,SAAS,SAAS,GAAG,iBAAiB,EACtC,QAAQ,MAAM,EACd,MAAM,IAAI,CAAC,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,GAAG,iBAAiB,mEAWlG,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { deployL1Contracts } from '@aztec/
|
|
1
|
+
import { deployL1Contracts } from '@aztec/ethereum';
|
|
2
2
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
|
-
import {
|
|
3
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
4
4
|
import { foundry } from 'viem/chains';
|
|
5
5
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
6
6
|
export const setupL1Contracts = async (l1RpcUrl, account, logger, args)=>{
|
|
7
7
|
const l1Data = await deployL1Contracts([
|
|
8
8
|
l1RpcUrl
|
|
9
9
|
], account, foundry, logger, {
|
|
10
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
11
10
|
vkTreeRoot: getVKTreeRoot(),
|
|
12
11
|
protocolContractTreeRoot,
|
|
13
12
|
salt: undefined,
|
|
13
|
+
realVerifier: false,
|
|
14
14
|
...args
|
|
15
15
|
});
|
|
16
16
|
return l1Data;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
/**
|
|
3
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
4
3
|
*/
|
|
5
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
6
5
|
import type { SentTx } from '@aztec/aztec.js';
|
|
7
6
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
7
|
+
import type { ProverNodeDeps } from '@aztec/prover-node';
|
|
8
8
|
import type { PXEService } from '@aztec/pxe/server';
|
|
9
9
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
10
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 1001;
|
|
11
|
+
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
13
12
|
export interface NodeContext {
|
|
14
13
|
node: AztecNodeService;
|
|
15
14
|
pxeService: PXEService;
|
|
16
15
|
txs: SentTx[];
|
|
17
16
|
}
|
|
18
17
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
19
|
-
export declare function createNodes(config: AztecNodeConfig
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export declare function createNodes(config: AztecNodeConfig & {
|
|
19
|
+
dontStartSequencer?: boolean;
|
|
20
|
+
}, dateProvider: DateProvider, bootstrapNodeEnr: string, numNodes: number, bootNodePort: number, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, indexOffset?: number): Promise<AztecNodeService[]>;
|
|
21
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator */
|
|
22
|
+
export declare function createNode(config: AztecNodeConfig & {
|
|
23
|
+
dontStartSequencer?: boolean;
|
|
24
|
+
}, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, loggerIdStorage?: AsyncLocalStorage<string>): Promise<AztecNodeService>;
|
|
25
|
+
/** Creates a P2P enabled instance of Aztec Node Service without a validator */
|
|
26
|
+
export declare function createNonValidatorNode(baseConfig: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, loggerIdStorage?: AsyncLocalStorage<string>): Promise<AztecNodeService>;
|
|
27
|
+
export declare function createProverNode(config: AztecNodeConfig, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number, proverNodeDeps: ProverNodeDeps & Required<Pick<ProverNodeDeps, 'dateProvider'>>, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, loggerIdStorage?: AsyncLocalStorage<string>): Promise<import("@aztec/prover-node").ProverNode>;
|
|
28
|
+
export declare function createP2PConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
29
|
+
export declare function createValidatorConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, addressIndex?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
22
30
|
//# sourceMappingURL=setup_p2p_test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"
|
|
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;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AASrD,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,EAAE,CAO7F;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,eAAe,GAAG;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,E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,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,EACpB,eAAe,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,oDAwB5C;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,eAAe,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,MAAU,EACxB,aAAa,CAAC,EAAE,MAAM,4BAYvB"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/ import { AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
4
5
|
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
|
|
6
|
+
import { bufferToHex } from '@aztec/foundation/string';
|
|
5
7
|
import getPort from 'get-port';
|
|
6
8
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
7
9
|
import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
8
|
-
import { getPrivateKeyFromIndex } from './utils.js';
|
|
10
|
+
import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
|
|
9
11
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
10
|
-
// Setup snapshots will create a node with index 0,
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
export const ATTESTER_PRIVATE_KEYS_START_INDEX =
|
|
12
|
+
// Setup snapshots will create a node with index 0, and run extra bootstrap with
|
|
13
|
+
// index 1, and prover node with index 2, so all of our loops here need to start from 3
|
|
14
|
+
// to avoid running validators with the same key
|
|
15
|
+
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
14
16
|
export function generatePrivateKeys(startIndex, numberOfKeys) {
|
|
15
17
|
const privateKeys = [];
|
|
16
18
|
// Do not start from 0 as it is used during setup
|
|
@@ -19,48 +21,83 @@ export function generatePrivateKeys(startIndex, numberOfKeys) {
|
|
|
19
21
|
}
|
|
20
22
|
return privateKeys;
|
|
21
23
|
}
|
|
22
|
-
export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNodes, bootNodePort, prefilledPublicData, dataDirectory, metricsPort) {
|
|
24
|
+
export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNodes, bootNodePort, prefilledPublicData, dataDirectory, metricsPort, indexOffset = 0) {
|
|
23
25
|
const nodePromises = [];
|
|
24
26
|
const loggerIdStorage = new AsyncLocalStorage();
|
|
25
27
|
const logNameHandler = (module)=>loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
|
|
26
28
|
addLogNameHandler(logNameHandler);
|
|
27
29
|
for(let i = 0; i < numNodes; i++){
|
|
30
|
+
const index = indexOffset + i;
|
|
28
31
|
// We run on ports from the bootnode upwards
|
|
29
|
-
const port = bootNodePort +
|
|
30
|
-
const dataDir = dataDirectory ? `${dataDirectory}-${
|
|
31
|
-
const nodePromise = createNode(config, dateProvider, port, bootstrapNodeEnr,
|
|
32
|
+
const port = bootNodePort + 1 + index;
|
|
33
|
+
const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
|
|
34
|
+
const nodePromise = createNode(config, dateProvider, port, bootstrapNodeEnr, index, prefilledPublicData, dataDir, metricsPort, loggerIdStorage);
|
|
32
35
|
nodePromises.push(nodePromise);
|
|
33
36
|
}
|
|
34
37
|
const nodes = await Promise.all(nodePromises);
|
|
38
|
+
// Sanity check that we have a sequencer if required
|
|
39
|
+
const seqClient = nodes[0].getSequencer();
|
|
40
|
+
if (!seqClient && config.disableValidator === false) {
|
|
41
|
+
throw new Error('Sequencer not found');
|
|
42
|
+
}
|
|
35
43
|
removeLogNameHandler(logNameHandler);
|
|
36
44
|
return nodes;
|
|
37
45
|
}
|
|
38
|
-
|
|
39
|
-
export async function createNode(config, dateProvider, tcpPort, bootstrapNode, accountIndex, prefilledPublicData, dataDirectory, metricsPort, loggerIdStorage) {
|
|
46
|
+
/** Creates a P2P enabled instance of Aztec Node Service with a validator */ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex, prefilledPublicData, dataDirectory, metricsPort, loggerIdStorage) {
|
|
40
47
|
const createNode = async ()=>{
|
|
41
|
-
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort,
|
|
48
|
+
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
42
49
|
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
43
50
|
return await AztecNodeService.createAndSync(validatorConfig, {
|
|
44
51
|
telemetry,
|
|
45
52
|
dateProvider
|
|
53
|
+
}, {
|
|
54
|
+
prefilledPublicData,
|
|
55
|
+
dontStartSequencer: config.dontStartSequencer
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
59
|
+
}
|
|
60
|
+
/** Creates a P2P enabled instance of Aztec Node Service without a validator */ export async function createNonValidatorNode(baseConfig, dateProvider, tcpPort, bootstrapNode, prefilledPublicData, dataDirectory, metricsPort, loggerIdStorage) {
|
|
61
|
+
const createNode = async ()=>{
|
|
62
|
+
const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
|
|
63
|
+
const config = {
|
|
64
|
+
...p2pConfig,
|
|
65
|
+
disableValidator: true,
|
|
66
|
+
validatorPrivateKeys: undefined,
|
|
67
|
+
publisherPrivateKeys: []
|
|
68
|
+
};
|
|
69
|
+
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
70
|
+
return await AztecNodeService.createAndSync(config, {
|
|
71
|
+
telemetry,
|
|
72
|
+
dateProvider
|
|
46
73
|
}, {
|
|
47
74
|
prefilledPublicData
|
|
48
75
|
});
|
|
49
76
|
};
|
|
50
77
|
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
51
78
|
}
|
|
52
|
-
export async function
|
|
79
|
+
export async function createProverNode(config, tcpPort, bootstrapNode, addressIndex, proverNodeDeps, prefilledPublicData, dataDirectory, metricsPort, loggerIdStorage) {
|
|
80
|
+
const createProverNode = async ()=>{
|
|
81
|
+
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex);
|
|
82
|
+
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
83
|
+
const proverConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
84
|
+
const aztecNodeRpcTxProvider = undefined;
|
|
85
|
+
return await createAndSyncProverNode(bufferToHex(proverNodePrivateKey), config, {
|
|
86
|
+
...proverConfig,
|
|
87
|
+
dataDirectory
|
|
88
|
+
}, aztecNodeRpcTxProvider, prefilledPublicData, {
|
|
89
|
+
...proverNodeDeps,
|
|
90
|
+
telemetry
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
|
|
94
|
+
}
|
|
95
|
+
export async function createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory) {
|
|
53
96
|
port = port ?? await getPort();
|
|
54
|
-
const attesterPrivateKey = `0x${getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + accountIndex).toString('hex')}`;
|
|
55
|
-
const proposerPrivateKey = `0x${getPrivateKeyFromIndex(PROPOSER_PRIVATE_KEYS_START_INDEX + accountIndex).toString('hex')}`;
|
|
56
|
-
config.validatorPrivateKey = attesterPrivateKey;
|
|
57
|
-
config.publisherPrivateKey = proposerPrivateKey;
|
|
58
97
|
const nodeConfig = {
|
|
59
98
|
...config,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
tcpAnnounceAddress: `127.0.0.1:${port}`,
|
|
63
|
-
udpAnnounceAddress: `127.0.0.1:${port}`,
|
|
99
|
+
p2pIp: `127.0.0.1`,
|
|
100
|
+
p2pPort: port,
|
|
64
101
|
p2pEnabled: true,
|
|
65
102
|
peerCheckIntervalMS: TEST_PEER_CHECK_INTERVAL_MS,
|
|
66
103
|
blockCheckIntervalMS: 1000,
|
|
@@ -71,3 +108,18 @@ export async function createValidatorConfig(config, bootstrapNodeEnr, port, acco
|
|
|
71
108
|
};
|
|
72
109
|
return nodeConfig;
|
|
73
110
|
}
|
|
111
|
+
export async function createValidatorConfig(config, bootstrapNodeEnr, port, addressIndex = 1, dataDirectory) {
|
|
112
|
+
const attesterPrivateKey = bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex));
|
|
113
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
|
|
114
|
+
const nodeConfig = {
|
|
115
|
+
...config,
|
|
116
|
+
...p2pConfig,
|
|
117
|
+
validatorPrivateKeys: new SecretValue([
|
|
118
|
+
attesterPrivateKey
|
|
119
|
+
]),
|
|
120
|
+
publisherPrivateKeys: [
|
|
121
|
+
new SecretValue(attesterPrivateKey)
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
return nodeConfig;
|
|
125
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import {
|
|
3
|
+
import { type AztecAddress, type AztecNode, type CompleteAddress, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
4
|
+
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
4
5
|
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
5
|
-
import { type DeployL1ContractsArgs } from '@aztec/ethereum';
|
|
6
|
+
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
6
7
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
7
8
|
import type { ProverNode } from '@aztec/prover-node';
|
|
8
9
|
import { type PXEService } from '@aztec/pxe/server';
|
|
10
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
9
11
|
import type { Anvil } from '@viem/anvil';
|
|
10
12
|
import { type SetupOptions } from './utils.js';
|
|
11
13
|
export type SubsystemsContext = {
|
|
@@ -19,6 +21,7 @@ export type SubsystemsContext = {
|
|
|
19
21
|
proverNode?: ProverNode;
|
|
20
22
|
watcher: AnvilTestWatcher;
|
|
21
23
|
cheatCodes: CheatCodes;
|
|
24
|
+
sequencer: SequencerClient;
|
|
22
25
|
dateProvider: TestDateProvider;
|
|
23
26
|
blobSink: BlobSinkServer;
|
|
24
27
|
initialFundedAccounts: InitialAccountData[];
|
|
@@ -81,7 +84,9 @@ export declare const deployAccounts: (numberOfAccounts: number, logger: Logger,
|
|
|
81
84
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
82
85
|
* @param sender - Wallet to send the deployment tx.
|
|
83
86
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
87
|
+
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
88
|
+
* @param pxeOrNode - PXE or AztecNode to wait for proven.
|
|
84
89
|
*/
|
|
85
|
-
export declare function publicDeployAccounts(sender: Wallet, accountsToDeploy: (CompleteAddress | AztecAddress)[], waitUntilProven?: boolean): Promise<void>;
|
|
90
|
+
export declare function publicDeployAccounts(sender: Wallet, accountsToDeploy: (CompleteAddress | AztecAddress)[], waitUntilProven?: boolean, pxeOrNode?: PXE | AztecNode): Promise<void>;
|
|
86
91
|
export {};
|
|
87
92
|
//# sourceMappingURL=snapshot_manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"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