@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec
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 +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +10 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +58 -33
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +5 -27
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -6
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- 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 +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
- 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 +6 -4
- 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 +11 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +17 -14
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +2 -2
- package/dest/e2e_fees/fees_test.d.ts +8 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +16 -10
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -4
- 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 +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 -3
- 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 +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts +219 -13
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +15 -11
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +2 -2
- package/dest/fixtures/e2e_prover_test.d.ts +5 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +23 -22
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +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/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -10
- package/dest/fixtures/snapshot_manager.d.ts +6 -8
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +34 -46
- package/dest/fixtures/token_utils.d.ts +5 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/fixtures/utils.d.ts +21 -19
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +56 -85
- 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/index.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +5 -14
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts +2 -12
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/index.d.ts +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +4 -3
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +15 -13
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +2 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +5 -3
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +5 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +45 -10
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +55 -20
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +203 -60
- package/package.json +42 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +82 -34
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +11 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +17 -12
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +37 -23
- package/src/e2e_fees/bridging_race.notest.ts +2 -2
- package/src/e2e_fees/fees_test.ts +22 -13
- package/src/e2e_l1_publisher/write_json.ts +5 -4
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -4
- package/src/e2e_p2p/p2p_network.ts +16 -19
- package/src/e2e_p2p/shared.ts +13 -6
- package/src/e2e_token_contract/token_contract_test.ts +2 -2
- package/src/fixtures/e2e_prover_test.ts +22 -25
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +23 -9
- package/src/fixtures/snapshot_manager.ts +51 -65
- package/src/fixtures/token_utils.ts +4 -4
- package/src/fixtures/utils.ts +91 -131
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +1 -1
- package/src/shared/cross_chain_test_harness.ts +5 -2
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/uniswap_l1_l2.ts +19 -21
- package/src/simulators/lending_simulator.ts +6 -4
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +49 -12
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +267 -51
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/src/fixtures/setup_l1_contracts.ts +0 -26
|
@@ -2,6 +2,7 @@
|
|
|
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
7
|
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
|
|
7
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
@@ -40,6 +41,7 @@ export async function createNodes(
|
|
|
40
41
|
dataDirectory?: string,
|
|
41
42
|
metricsPort?: number,
|
|
42
43
|
indexOffset = 0,
|
|
44
|
+
validatorsPerNode = 1,
|
|
43
45
|
): Promise<AztecNodeService[]> {
|
|
44
46
|
const nodePromises: Promise<AztecNodeService>[] = [];
|
|
45
47
|
const loggerIdStorage = new AsyncLocalStorage<string>();
|
|
@@ -52,13 +54,18 @@ export async function createNodes(
|
|
|
52
54
|
// We run on ports from the bootnode upwards
|
|
53
55
|
const port = bootNodePort + 1 + index;
|
|
54
56
|
|
|
57
|
+
// Determine validator indices for this node
|
|
58
|
+
const validatorIndices = validatorsPerNode === 1 ? index : range(validatorsPerNode, validatorsPerNode * index);
|
|
59
|
+
|
|
60
|
+
// Assign data directory
|
|
55
61
|
const dataDir = dataDirectory ? `${dataDirectory}-${index}` : undefined;
|
|
62
|
+
|
|
56
63
|
const nodePromise = createNode(
|
|
57
64
|
config,
|
|
58
65
|
dateProvider,
|
|
59
66
|
port,
|
|
60
67
|
bootstrapNodeEnr,
|
|
61
|
-
|
|
68
|
+
validatorIndices,
|
|
62
69
|
prefilledPublicData,
|
|
63
70
|
dataDir,
|
|
64
71
|
metricsPort,
|
|
@@ -84,7 +91,7 @@ export async function createNode(
|
|
|
84
91
|
dateProvider: DateProvider,
|
|
85
92
|
tcpPort: number,
|
|
86
93
|
bootstrapNode: string | undefined,
|
|
87
|
-
addressIndex: number,
|
|
94
|
+
addressIndex: number | number[],
|
|
88
95
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
89
96
|
dataDirectory?: string,
|
|
90
97
|
metricsPort?: number,
|
|
@@ -92,7 +99,7 @@ export async function createNode(
|
|
|
92
99
|
) {
|
|
93
100
|
const createNode = async () => {
|
|
94
101
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
95
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
102
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
96
103
|
return await AztecNodeService.createAndSync(
|
|
97
104
|
validatorConfig,
|
|
98
105
|
{ telemetry, dateProvider },
|
|
@@ -121,7 +128,7 @@ export async function createNonValidatorNode(
|
|
|
121
128
|
validatorPrivateKeys: undefined,
|
|
122
129
|
publisherPrivateKeys: [],
|
|
123
130
|
};
|
|
124
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
131
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
125
132
|
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
|
|
126
133
|
};
|
|
127
134
|
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
@@ -140,7 +147,7 @@ export async function createProverNode(
|
|
|
140
147
|
) {
|
|
141
148
|
const createProverNode = async () => {
|
|
142
149
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
143
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
150
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
144
151
|
|
|
145
152
|
const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
|
|
146
153
|
config,
|
|
@@ -188,16 +195,23 @@ export async function createValidatorConfig(
|
|
|
188
195
|
config: AztecNodeConfig,
|
|
189
196
|
bootstrapNodeEnr?: string,
|
|
190
197
|
port?: number,
|
|
191
|
-
addressIndex: number = 1,
|
|
198
|
+
addressIndex: number | number[] = 1,
|
|
192
199
|
dataDirectory?: string,
|
|
193
200
|
) {
|
|
194
|
-
const
|
|
201
|
+
const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
|
|
202
|
+
if (addressIndices.length === 0) {
|
|
203
|
+
throw new Error('At least one address index must be provided to create a validator config');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const attesterPrivateKeys = addressIndices.map(index =>
|
|
207
|
+
bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
|
|
208
|
+
);
|
|
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
|
-
publisherPrivateKeys: [new SecretValue(
|
|
213
|
+
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
214
|
+
publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
|
|
201
215
|
};
|
|
202
216
|
|
|
203
217
|
return nodeConfig;
|
|
@@ -9,22 +9,25 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
9
9
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
10
10
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
11
11
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
-
import {
|
|
12
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
13
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
14
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
15
|
+
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
13
16
|
import {
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getL1ContractsConfigEnvVars,
|
|
19
|
-
} from '@aztec/ethereum';
|
|
17
|
+
type DeployAztecL1ContractsArgs,
|
|
18
|
+
type DeployAztecL1ContractsReturnType,
|
|
19
|
+
deployAztecL1Contracts,
|
|
20
|
+
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
20
21
|
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
21
22
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
22
23
|
import { SecretValue } from '@aztec/foundation/config';
|
|
23
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
24
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
24
25
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
25
26
|
import { createLogger } from '@aztec/foundation/log';
|
|
26
27
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
27
28
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
29
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
30
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
28
31
|
import type { ProverNode } from '@aztec/prover-node';
|
|
29
32
|
import { getPXEConfig } from '@aztec/pxe/server';
|
|
30
33
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
@@ -37,23 +40,22 @@ import type { Anvil } from '@viem/anvil';
|
|
|
37
40
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
38
41
|
import { copySync, removeSync } from 'fs-extra/esm';
|
|
39
42
|
import fs from 'fs/promises';
|
|
40
|
-
import getPort from 'get-port';
|
|
41
43
|
import { tmpdir } from 'os';
|
|
42
44
|
import path, { join } from 'path';
|
|
43
45
|
import type { Hex } from 'viem';
|
|
44
46
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
45
47
|
import { foundry } from 'viem/chains';
|
|
46
48
|
|
|
47
|
-
import { MNEMONIC,
|
|
49
|
+
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
48
50
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
49
51
|
import { getBBConfig } from './get_bb_config.js';
|
|
50
|
-
import { setupL1Contracts } from './setup_l1_contracts.js';
|
|
51
52
|
import {
|
|
52
53
|
type SetupOptions,
|
|
53
54
|
createAndSyncProverNode,
|
|
54
55
|
getLogger,
|
|
55
56
|
getPrivateKeyFromIndex,
|
|
56
57
|
getSponsoredFPCAddress,
|
|
58
|
+
setupSharedBlobStorage,
|
|
57
59
|
} from './utils.js';
|
|
58
60
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
59
61
|
|
|
@@ -64,13 +66,12 @@ export type SubsystemsContext = {
|
|
|
64
66
|
aztecNode: AztecNodeService;
|
|
65
67
|
aztecNodeConfig: AztecNodeConfig;
|
|
66
68
|
wallet: TestWallet;
|
|
67
|
-
deployL1ContractsValues:
|
|
69
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
68
70
|
proverNode?: ProverNode;
|
|
69
71
|
watcher: AnvilTestWatcher;
|
|
70
72
|
cheatCodes: CheatCodes;
|
|
71
73
|
sequencer: SequencerClient;
|
|
72
74
|
dateProvider: TestDateProvider;
|
|
73
|
-
blobSink: BlobSinkServer;
|
|
74
75
|
initialFundedAccounts: InitialAccountData[];
|
|
75
76
|
directoryToCleanup?: string;
|
|
76
77
|
};
|
|
@@ -86,7 +87,7 @@ export function createSnapshotManager(
|
|
|
86
87
|
testName: string,
|
|
87
88
|
dataPath?: string,
|
|
88
89
|
config: Partial<SetupOptions> = {},
|
|
89
|
-
deployL1ContractsArgs: Partial<
|
|
90
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
|
|
90
91
|
initialValidators: [],
|
|
91
92
|
},
|
|
92
93
|
) {
|
|
@@ -115,7 +116,7 @@ class MockSnapshotManager implements ISnapshotManager {
|
|
|
115
116
|
constructor(
|
|
116
117
|
testName: string,
|
|
117
118
|
private config: Partial<AztecNodeConfig> = {},
|
|
118
|
-
private deployL1ContractsArgs: Partial<
|
|
119
|
+
private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
119
120
|
) {
|
|
120
121
|
this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
|
|
121
122
|
this.logger.warn(`No data path given, will not persist any snapshots.`);
|
|
@@ -163,7 +164,7 @@ class SnapshotManager implements ISnapshotManager {
|
|
|
163
164
|
testName: string,
|
|
164
165
|
private dataPath: string,
|
|
165
166
|
private config: Partial<SetupOptions> = {},
|
|
166
|
-
private deployL1ContractsArgs: Partial<
|
|
167
|
+
private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
167
168
|
) {
|
|
168
169
|
this.livePath = join(this.dataPath, 'live', testName);
|
|
169
170
|
this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
|
|
@@ -273,7 +274,6 @@ async function teardown(context: SubsystemsContext | undefined) {
|
|
|
273
274
|
await context.bbConfig?.cleanup();
|
|
274
275
|
await tryStop(context.anvil);
|
|
275
276
|
await tryStop(context.watcher);
|
|
276
|
-
await tryStop(context.blobSink);
|
|
277
277
|
await tryRmDir(context.directoryToCleanup, logger);
|
|
278
278
|
} catch (err) {
|
|
279
279
|
logger.error('Error during teardown', err);
|
|
@@ -289,14 +289,12 @@ async function setupFromFresh(
|
|
|
289
289
|
statePath: string | undefined,
|
|
290
290
|
logger: Logger,
|
|
291
291
|
{ numberOfInitialFundedAccounts = 10, ...opts }: SetupOptions = {},
|
|
292
|
-
deployL1ContractsArgs: Partial<
|
|
292
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
|
|
293
293
|
initialValidators: [],
|
|
294
294
|
},
|
|
295
295
|
): Promise<SubsystemsContext> {
|
|
296
296
|
logger.verbose(`Initializing state...`);
|
|
297
297
|
|
|
298
|
-
const blobSinkPort = await getPort();
|
|
299
|
-
|
|
300
298
|
// Default to no slashing
|
|
301
299
|
opts.slasherFlavor ??= 'none';
|
|
302
300
|
deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;
|
|
@@ -305,7 +303,7 @@ async function setupFromFresh(
|
|
|
305
303
|
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
|
|
306
304
|
const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
307
305
|
aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
308
|
-
aztecNodeConfig.
|
|
306
|
+
aztecNodeConfig.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
|
|
309
307
|
// Only enable proving if specifically requested.
|
|
310
308
|
aztecNodeConfig.realProofs = !!opts.realProofs;
|
|
311
309
|
// Only enforce the time table if requested
|
|
@@ -324,18 +322,20 @@ async function setupFromFresh(
|
|
|
324
322
|
} else {
|
|
325
323
|
aztecNodeConfig.dataDirectory = statePath;
|
|
326
324
|
}
|
|
327
|
-
|
|
325
|
+
|
|
326
|
+
await setupSharedBlobStorage(aztecNodeConfig);
|
|
328
327
|
|
|
329
328
|
const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
|
|
330
329
|
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
331
330
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
331
|
+
const publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` satisfies `0x${string}`;
|
|
332
332
|
|
|
333
333
|
const l1Client = createExtendedL1Client([aztecNodeConfig.l1RpcUrls[0]], hdAccount, foundry);
|
|
334
334
|
|
|
335
335
|
const validatorPrivKey = getPrivateKeyFromIndex(0);
|
|
336
336
|
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
337
337
|
|
|
338
|
-
aztecNodeConfig.publisherPrivateKeys = [new SecretValue
|
|
338
|
+
aztecNodeConfig.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
339
339
|
aztecNodeConfig.validatorPrivateKeys = new SecretValue([`0x${validatorPrivKey!.toString('hex')}`]);
|
|
340
340
|
aztecNodeConfig.coinbase = opts.coinbase ?? EthAddress.fromString(`${hdAccount.address}`);
|
|
341
341
|
|
|
@@ -351,7 +351,7 @@ async function setupFromFresh(
|
|
|
351
351
|
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
352
352
|
|
|
353
353
|
// Deploy our L1 contracts.
|
|
354
|
-
logger.verbose('Deploying L1 contracts...');
|
|
354
|
+
logger.verbose('Deploying Aztec L1 contracts...');
|
|
355
355
|
if (opts.l1StartTime) {
|
|
356
356
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
357
357
|
}
|
|
@@ -363,16 +363,28 @@ async function setupFromFresh(
|
|
|
363
363
|
opts.initialAccountFeeJuice,
|
|
364
364
|
);
|
|
365
365
|
|
|
366
|
+
const vkTreeRoot = getVKTreeRoot();
|
|
366
367
|
await deployMulticall3(l1Client, logger);
|
|
367
368
|
|
|
368
|
-
|
|
369
|
+
// Define args, defaulted to our environment variables.
|
|
370
|
+
const args: DeployAztecL1ContractsArgs = {
|
|
369
371
|
...getL1ContractsConfigEnvVars(),
|
|
370
|
-
genesisArchiveRoot,
|
|
371
|
-
feeJuicePortalInitialBalance: fundingNeeded,
|
|
372
|
-
salt: opts.salt,
|
|
373
372
|
...deployL1ContractsArgs,
|
|
373
|
+
vkTreeRoot,
|
|
374
|
+
genesisArchiveRoot,
|
|
375
|
+
protocolContractsHash,
|
|
374
376
|
initialValidators: opts.initialValidators,
|
|
375
|
-
|
|
377
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
378
|
+
realVerifier: false,
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
const deployL1ContractsValues = await deployAztecL1Contracts(
|
|
382
|
+
aztecNodeConfig.l1RpcUrls[0],
|
|
383
|
+
publisherPrivKeyHex,
|
|
384
|
+
foundry.id,
|
|
385
|
+
args,
|
|
386
|
+
);
|
|
387
|
+
|
|
376
388
|
aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
377
389
|
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
378
390
|
|
|
@@ -396,26 +408,14 @@ async function setupFromFresh(
|
|
|
396
408
|
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
397
409
|
}
|
|
398
410
|
|
|
399
|
-
const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
const blobSink = await createBlobSinkServer(
|
|
403
|
-
{
|
|
404
|
-
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
405
|
-
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
406
|
-
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
407
|
-
port: blobSinkPort,
|
|
408
|
-
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
409
|
-
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
|
|
410
|
-
},
|
|
411
|
-
telemetry,
|
|
412
|
-
);
|
|
413
|
-
await blobSink.start();
|
|
411
|
+
const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
412
|
+
|
|
413
|
+
const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
|
|
414
414
|
|
|
415
415
|
logger.info('Creating and synching an aztec node...');
|
|
416
416
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
417
417
|
aztecNodeConfig,
|
|
418
|
-
{ telemetry, dateProvider },
|
|
418
|
+
{ telemetry, dateProvider, blobClient },
|
|
419
419
|
{ prefilledPublicData },
|
|
420
420
|
);
|
|
421
421
|
|
|
@@ -461,7 +461,6 @@ async function setupFromFresh(
|
|
|
461
461
|
watcher,
|
|
462
462
|
cheatCodes,
|
|
463
463
|
dateProvider,
|
|
464
|
-
blobSink,
|
|
465
464
|
initialFundedAccounts,
|
|
466
465
|
directoryToCleanup,
|
|
467
466
|
};
|
|
@@ -476,18 +475,16 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
476
475
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
477
476
|
await fs.mkdir(directoryToCleanup, { recursive: true });
|
|
478
477
|
|
|
479
|
-
// Run the blob sink on a random port
|
|
480
|
-
const blobSinkPort = await getPort();
|
|
481
|
-
|
|
482
478
|
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
|
|
483
479
|
const aztecNodeConfig: AztecNodeConfig & SetupOptions = JSON.parse(
|
|
484
480
|
readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'),
|
|
485
481
|
reviver,
|
|
486
482
|
);
|
|
487
483
|
aztecNodeConfig.dataDirectory = statePath;
|
|
488
|
-
aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
|
|
489
484
|
aztecNodeConfig.listenAddress = '127.0.0.1';
|
|
490
485
|
|
|
486
|
+
await setupSharedBlobStorage(aztecNodeConfig);
|
|
487
|
+
|
|
491
488
|
const initialFundedAccounts: InitialAccountData[] =
|
|
492
489
|
JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
|
|
493
490
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
|
|
@@ -526,24 +523,14 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
526
523
|
);
|
|
527
524
|
await watcher.start();
|
|
528
525
|
|
|
529
|
-
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
533
|
-
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
534
|
-
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
535
|
-
port: blobSinkPort,
|
|
536
|
-
dataDirectory: statePath,
|
|
537
|
-
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
|
|
538
|
-
},
|
|
539
|
-
telemetry,
|
|
540
|
-
);
|
|
541
|
-
await blobSink.start();
|
|
526
|
+
const telemetry = await initTelemetryClient(getTelemetryConfig());
|
|
527
|
+
|
|
528
|
+
const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('node:blob-client:client'));
|
|
542
529
|
|
|
543
530
|
logger.verbose('Creating aztec node...');
|
|
544
531
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
545
532
|
aztecNodeConfig,
|
|
546
|
-
{ telemetry, dateProvider },
|
|
533
|
+
{ telemetry, dateProvider, blobClient },
|
|
547
534
|
{ prefilledPublicData },
|
|
548
535
|
);
|
|
549
536
|
|
|
@@ -588,7 +575,6 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
588
575
|
watcher,
|
|
589
576
|
cheatCodes,
|
|
590
577
|
dateProvider,
|
|
591
|
-
blobSink,
|
|
592
578
|
initialFundedAccounts,
|
|
593
579
|
directoryToCleanup,
|
|
594
580
|
};
|
|
@@ -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)
|
|
9
|
+
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
10
|
.send({ from: admin })
|
|
11
|
-
.
|
|
11
|
+
.wait();
|
|
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(
|
|
@@ -36,7 +36,7 @@ export async function expectTokenBalance(
|
|
|
36
36
|
logger: Logger,
|
|
37
37
|
) {
|
|
38
38
|
// Then check the balance
|
|
39
|
-
const contractWithWallet =
|
|
39
|
+
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
40
40
|
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
41
41
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
42
42
|
expect(balance).toBe(expectedBalance);
|