@aztec/end-to-end 0.0.1-commit.9593d84 → 0.0.1-commit.96bb3f7
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/client_flows_benchmark.d.ts +3 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -4
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +5 -5
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +18 -11
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +14 -7
- 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 +36 -19
- 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 +14 -12
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- 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 +7 -4
- 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 +2 -5
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -6
- package/dest/e2e_p2p/p2p_network.d.ts +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +11 -9
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +4 -4
- package/dest/fixtures/e2e_prover_test.d.ts +3 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +6 -10
- 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.js +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/setup_p2p_test.js +3 -3
- 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 +27 -44
- package/dest/fixtures/utils.d.ts +17 -463
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +45 -77
- 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/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/shared/cross_chain_test_harness.d.ts +5 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts +2 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- 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 +43 -23
- package/dest/simulators/lending_simulator.d.ts +2 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +2 -1
- 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 +45 -10
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +203 -60
- package/package.json +40 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +8 -5
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +22 -14
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +53 -31
- package/src/e2e_epochs/epochs_test.ts +34 -21
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +13 -9
- package/src/e2e_l1_publisher/write_json.ts +2 -5
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -7
- package/src/e2e_p2p/p2p_network.ts +10 -17
- package/src/e2e_p2p/shared.ts +11 -6
- package/src/fixtures/e2e_prover_test.ts +7 -10
- 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 +3 -3
- package/src/fixtures/snapshot_manager.ts +44 -63
- package/src/fixtures/utils.ts +74 -139
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/shared/cross_chain_test_harness.ts +6 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +53 -67
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +9 -2
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +267 -51
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- 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/e2e_p2p/shared.ts
CHANGED
|
@@ -6,9 +6,14 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
6
6
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
7
|
import { Tx, TxStatus } from '@aztec/aztec.js/tx';
|
|
8
8
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
EmpireSlashingProposerContract,
|
|
11
|
+
RollupContract,
|
|
12
|
+
TallySlashingProposerContract,
|
|
13
|
+
} from '@aztec/ethereum/contracts';
|
|
10
14
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
11
15
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
16
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
17
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
13
18
|
import { pluralize } from '@aztec/foundation/string';
|
|
14
19
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
@@ -133,7 +138,7 @@ export async function awaitCommitteeExists({
|
|
|
133
138
|
logger: Logger;
|
|
134
139
|
}): Promise<readonly `0x${string}`[]> {
|
|
135
140
|
logger.info(`Waiting for committee to be set`);
|
|
136
|
-
let committee:
|
|
141
|
+
let committee: EthAddress[] | undefined;
|
|
137
142
|
await retryUntil(
|
|
138
143
|
async () => {
|
|
139
144
|
committee = await rollup.getCurrentEpochCommittee();
|
|
@@ -142,7 +147,7 @@ export async function awaitCommitteeExists({
|
|
|
142
147
|
'non-empty committee',
|
|
143
148
|
60,
|
|
144
149
|
);
|
|
145
|
-
return committee
|
|
150
|
+
return committee!.map(c => c.toString() as `0x${string}`);
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
export async function awaitOffenseDetected({
|
|
@@ -214,9 +219,9 @@ export async function awaitCommitteeKicked({
|
|
|
214
219
|
|
|
215
220
|
if (slashingProposer.type === 'empire') {
|
|
216
221
|
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
217
|
-
const targetEpoch =
|
|
222
|
+
const targetEpoch = EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1);
|
|
218
223
|
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
219
|
-
await cheatCodes.advanceToEpoch(
|
|
224
|
+
await cheatCodes.advanceToEpoch(targetEpoch);
|
|
220
225
|
|
|
221
226
|
const slashPayloadEvents = await retryUntil(
|
|
222
227
|
async () => {
|
|
@@ -271,7 +276,7 @@ export async function awaitCommitteeKicked({
|
|
|
271
276
|
logger.info(`Advancing to check current committee`);
|
|
272
277
|
await cheatCodes.debugRollup();
|
|
273
278
|
await cheatCodes.advanceToEpoch(
|
|
274
|
-
EpochNumber
|
|
279
|
+
EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1),
|
|
275
280
|
);
|
|
276
281
|
await cheatCodes.debugRollup();
|
|
277
282
|
|
|
@@ -11,9 +11,8 @@ import {
|
|
|
11
11
|
TestCircuitVerifier,
|
|
12
12
|
} from '@aztec/bb-prover';
|
|
13
13
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
|
-
import {
|
|
15
|
-
import type {
|
|
16
|
-
import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
14
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
15
|
+
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
17
16
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
18
17
|
import { SecretValue } from '@aztec/foundation/config';
|
|
19
18
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
@@ -69,7 +68,6 @@ export class FullProverTest {
|
|
|
69
68
|
aztecNode!: AztecNode;
|
|
70
69
|
aztecNodeAdmin!: AztecNodeAdmin;
|
|
71
70
|
cheatCodes!: CheatCodes;
|
|
72
|
-
blobSink!: BlobSinkServer;
|
|
73
71
|
private provenComponents: ProvenSetup[] = [];
|
|
74
72
|
private bbConfigCleanup?: () => Promise<void>;
|
|
75
73
|
private acvmConfigCleanup?: () => Promise<void>;
|
|
@@ -78,7 +76,7 @@ export class FullProverTest {
|
|
|
78
76
|
private context!: SubsystemsContext;
|
|
79
77
|
private proverNode!: ProverNode;
|
|
80
78
|
private simulatedProverNode!: ProverNode;
|
|
81
|
-
public l1Contracts!:
|
|
79
|
+
public l1Contracts!: DeployAztecL1ContractsReturnType;
|
|
82
80
|
public proverAddress!: EthAddress;
|
|
83
81
|
|
|
84
82
|
constructor(
|
|
@@ -91,7 +89,7 @@ export class FullProverTest {
|
|
|
91
89
|
this.snapshotManager = createSnapshotManager(
|
|
92
90
|
`full_prover_integration/${testName}`,
|
|
93
91
|
dataPath,
|
|
94
|
-
{ startProverNode: true,
|
|
92
|
+
{ startProverNode: true, coinbase },
|
|
95
93
|
{
|
|
96
94
|
realVerifier: realProofs,
|
|
97
95
|
},
|
|
@@ -169,11 +167,11 @@ export class FullProverTest {
|
|
|
169
167
|
aztecNode: this.aztecNode,
|
|
170
168
|
deployL1ContractsValues: this.l1Contracts,
|
|
171
169
|
cheatCodes: this.cheatCodes,
|
|
172
|
-
blobSink: this.blobSink,
|
|
173
170
|
} = this.context);
|
|
174
171
|
this.aztecNodeAdmin = this.context.aztecNode;
|
|
175
172
|
|
|
176
|
-
const
|
|
173
|
+
const config = this.context.aztecNodeConfig;
|
|
174
|
+
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
177
175
|
|
|
178
176
|
// Configure a full prover PXE
|
|
179
177
|
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
|
|
@@ -243,7 +241,7 @@ export class FullProverTest {
|
|
|
243
241
|
this.logger.verbose('Starting archiver for new prover node');
|
|
244
242
|
const archiver = await createArchiver(
|
|
245
243
|
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
246
|
-
{
|
|
244
|
+
{ blobClient, dateProvider: this.context.dateProvider },
|
|
247
245
|
{ blockUntilSync: true },
|
|
248
246
|
);
|
|
249
247
|
|
|
@@ -283,7 +281,6 @@ export class FullProverTest {
|
|
|
283
281
|
{
|
|
284
282
|
aztecNodeTxProvider: this.aztecNode,
|
|
285
283
|
archiver: archiver as Archiver,
|
|
286
|
-
blobSinkClient,
|
|
287
284
|
},
|
|
288
285
|
{ prefilledPublicData },
|
|
289
286
|
);
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const shouldCollectMetrics = () => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
11
|
-
export const
|
|
11
|
+
export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
|
|
12
12
|
|
|
13
13
|
export const MNEMONIC = 'test test test test test test test test test test test junk';
|
|
14
14
|
export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
|
|
@@ -22,8 +22,5 @@ export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_s
|
|
|
22
22
|
export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
|
|
23
23
|
export const NO_L1_TO_L2_MSG_ERROR =
|
|
24
24
|
/No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
|
|
25
|
-
export const STATIC_CALL_STATE_MODIFICATION_ERROR =
|
|
26
|
-
/Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
|
|
25
|
+
export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
|
|
27
26
|
export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
|
|
28
|
-
|
|
29
|
-
export const DEFAULT_BLOB_SINK_PORT = '5052';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
4
4
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
5
5
|
|
|
6
6
|
import { promises as fs } from 'fs';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
5
|
import { tryJsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
6
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
5
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -99,7 +99,7 @@ export async function createNode(
|
|
|
99
99
|
) {
|
|
100
100
|
const createNode = async () => {
|
|
101
101
|
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
102
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
102
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
103
103
|
return await AztecNodeService.createAndSync(
|
|
104
104
|
validatorConfig,
|
|
105
105
|
{ telemetry, dateProvider },
|
|
@@ -128,7 +128,7 @@ export async function createNonValidatorNode(
|
|
|
128
128
|
validatorPrivateKeys: undefined,
|
|
129
129
|
publisherPrivateKeys: [],
|
|
130
130
|
};
|
|
131
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
131
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
132
132
|
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
|
|
133
133
|
};
|
|
134
134
|
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
@@ -147,7 +147,7 @@ export async function createProverNode(
|
|
|
147
147
|
) {
|
|
148
148
|
const createProverNode = async () => {
|
|
149
149
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
150
|
-
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
150
|
+
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
151
151
|
|
|
152
152
|
const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
|
|
153
153
|
config,
|
|
@@ -9,22 +9,24 @@ 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 { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
13
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
14
|
+
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
13
15
|
import {
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getL1ContractsConfigEnvVars,
|
|
19
|
-
} from '@aztec/ethereum';
|
|
16
|
+
type DeployAztecL1ContractsArgs,
|
|
17
|
+
type DeployAztecL1ContractsReturnType,
|
|
18
|
+
deployAztecL1Contracts,
|
|
19
|
+
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
20
20
|
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
21
21
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
22
22
|
import { SecretValue } from '@aztec/foundation/config';
|
|
23
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
23
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
24
24
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
25
25
|
import { createLogger } from '@aztec/foundation/log';
|
|
26
26
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
27
27
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
28
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
29
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
28
30
|
import type { ProverNode } from '@aztec/prover-node';
|
|
29
31
|
import { getPXEConfig } from '@aztec/pxe/server';
|
|
30
32
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
@@ -37,23 +39,22 @@ import type { Anvil } from '@viem/anvil';
|
|
|
37
39
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
38
40
|
import { copySync, removeSync } from 'fs-extra/esm';
|
|
39
41
|
import fs from 'fs/promises';
|
|
40
|
-
import getPort from 'get-port';
|
|
41
42
|
import { tmpdir } from 'os';
|
|
42
43
|
import path, { join } from 'path';
|
|
43
44
|
import type { Hex } from 'viem';
|
|
44
45
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
45
46
|
import { foundry } from 'viem/chains';
|
|
46
47
|
|
|
47
|
-
import { MNEMONIC,
|
|
48
|
+
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
48
49
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
49
50
|
import { getBBConfig } from './get_bb_config.js';
|
|
50
|
-
import { setupL1Contracts } from './setup_l1_contracts.js';
|
|
51
51
|
import {
|
|
52
52
|
type SetupOptions,
|
|
53
53
|
createAndSyncProverNode,
|
|
54
54
|
getLogger,
|
|
55
55
|
getPrivateKeyFromIndex,
|
|
56
56
|
getSponsoredFPCAddress,
|
|
57
|
+
setupSharedBlobStorage,
|
|
57
58
|
} from './utils.js';
|
|
58
59
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
59
60
|
|
|
@@ -64,13 +65,12 @@ export type SubsystemsContext = {
|
|
|
64
65
|
aztecNode: AztecNodeService;
|
|
65
66
|
aztecNodeConfig: AztecNodeConfig;
|
|
66
67
|
wallet: TestWallet;
|
|
67
|
-
deployL1ContractsValues:
|
|
68
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
68
69
|
proverNode?: ProverNode;
|
|
69
70
|
watcher: AnvilTestWatcher;
|
|
70
71
|
cheatCodes: CheatCodes;
|
|
71
72
|
sequencer: SequencerClient;
|
|
72
73
|
dateProvider: TestDateProvider;
|
|
73
|
-
blobSink: BlobSinkServer;
|
|
74
74
|
initialFundedAccounts: InitialAccountData[];
|
|
75
75
|
directoryToCleanup?: string;
|
|
76
76
|
};
|
|
@@ -86,7 +86,7 @@ export function createSnapshotManager(
|
|
|
86
86
|
testName: string,
|
|
87
87
|
dataPath?: string,
|
|
88
88
|
config: Partial<SetupOptions> = {},
|
|
89
|
-
deployL1ContractsArgs: Partial<
|
|
89
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
|
|
90
90
|
initialValidators: [],
|
|
91
91
|
},
|
|
92
92
|
) {
|
|
@@ -115,7 +115,7 @@ class MockSnapshotManager implements ISnapshotManager {
|
|
|
115
115
|
constructor(
|
|
116
116
|
testName: string,
|
|
117
117
|
private config: Partial<AztecNodeConfig> = {},
|
|
118
|
-
private deployL1ContractsArgs: Partial<
|
|
118
|
+
private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
119
119
|
) {
|
|
120
120
|
this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
|
|
121
121
|
this.logger.warn(`No data path given, will not persist any snapshots.`);
|
|
@@ -163,7 +163,7 @@ class SnapshotManager implements ISnapshotManager {
|
|
|
163
163
|
testName: string,
|
|
164
164
|
private dataPath: string,
|
|
165
165
|
private config: Partial<SetupOptions> = {},
|
|
166
|
-
private deployL1ContractsArgs: Partial<
|
|
166
|
+
private deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
167
167
|
) {
|
|
168
168
|
this.livePath = join(this.dataPath, 'live', testName);
|
|
169
169
|
this.logger = createLogger(`e2e:snapshot_manager:${testName}`);
|
|
@@ -273,7 +273,6 @@ async function teardown(context: SubsystemsContext | undefined) {
|
|
|
273
273
|
await context.bbConfig?.cleanup();
|
|
274
274
|
await tryStop(context.anvil);
|
|
275
275
|
await tryStop(context.watcher);
|
|
276
|
-
await tryStop(context.blobSink);
|
|
277
276
|
await tryRmDir(context.directoryToCleanup, logger);
|
|
278
277
|
} catch (err) {
|
|
279
278
|
logger.error('Error during teardown', err);
|
|
@@ -289,14 +288,12 @@ async function setupFromFresh(
|
|
|
289
288
|
statePath: string | undefined,
|
|
290
289
|
logger: Logger,
|
|
291
290
|
{ numberOfInitialFundedAccounts = 10, ...opts }: SetupOptions = {},
|
|
292
|
-
deployL1ContractsArgs: Partial<
|
|
291
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {
|
|
293
292
|
initialValidators: [],
|
|
294
293
|
},
|
|
295
294
|
): Promise<SubsystemsContext> {
|
|
296
295
|
logger.verbose(`Initializing state...`);
|
|
297
296
|
|
|
298
|
-
const blobSinkPort = await getPort();
|
|
299
|
-
|
|
300
297
|
// Default to no slashing
|
|
301
298
|
opts.slasherFlavor ??= 'none';
|
|
302
299
|
deployL1ContractsArgs.slasherFlavor ??= opts.slasherFlavor;
|
|
@@ -305,7 +302,7 @@ async function setupFromFresh(
|
|
|
305
302
|
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
|
|
306
303
|
const aztecNodeConfig: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
307
304
|
aztecNodeConfig.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
308
|
-
aztecNodeConfig.
|
|
305
|
+
aztecNodeConfig.maxPendingTxCount = opts.maxPendingTxCount ?? TEST_MAX_PENDING_TX_POOL_COUNT;
|
|
309
306
|
// Only enable proving if specifically requested.
|
|
310
307
|
aztecNodeConfig.realProofs = !!opts.realProofs;
|
|
311
308
|
// Only enforce the time table if requested
|
|
@@ -324,18 +321,20 @@ async function setupFromFresh(
|
|
|
324
321
|
} else {
|
|
325
322
|
aztecNodeConfig.dataDirectory = statePath;
|
|
326
323
|
}
|
|
327
|
-
|
|
324
|
+
|
|
325
|
+
await setupSharedBlobStorage(aztecNodeConfig);
|
|
328
326
|
|
|
329
327
|
const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
|
|
330
328
|
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
331
329
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
330
|
+
const publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` satisfies `0x${string}`;
|
|
332
331
|
|
|
333
332
|
const l1Client = createExtendedL1Client([aztecNodeConfig.l1RpcUrls[0]], hdAccount, foundry);
|
|
334
333
|
|
|
335
334
|
const validatorPrivKey = getPrivateKeyFromIndex(0);
|
|
336
335
|
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
337
336
|
|
|
338
|
-
aztecNodeConfig.publisherPrivateKeys = [new SecretValue
|
|
337
|
+
aztecNodeConfig.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
339
338
|
aztecNodeConfig.validatorPrivateKeys = new SecretValue([`0x${validatorPrivKey!.toString('hex')}`]);
|
|
340
339
|
aztecNodeConfig.coinbase = opts.coinbase ?? EthAddress.fromString(`${hdAccount.address}`);
|
|
341
340
|
|
|
@@ -351,7 +350,7 @@ async function setupFromFresh(
|
|
|
351
350
|
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
352
351
|
|
|
353
352
|
// Deploy our L1 contracts.
|
|
354
|
-
logger.verbose('Deploying L1 contracts...');
|
|
353
|
+
logger.verbose('Deploying Aztec L1 contracts...');
|
|
355
354
|
if (opts.l1StartTime) {
|
|
356
355
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
357
356
|
}
|
|
@@ -363,16 +362,28 @@ async function setupFromFresh(
|
|
|
363
362
|
opts.initialAccountFeeJuice,
|
|
364
363
|
);
|
|
365
364
|
|
|
365
|
+
const vkTreeRoot = getVKTreeRoot();
|
|
366
366
|
await deployMulticall3(l1Client, logger);
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
// Define args, defaulted to our environment variables.
|
|
369
|
+
const args: DeployAztecL1ContractsArgs = {
|
|
369
370
|
...getL1ContractsConfigEnvVars(),
|
|
370
|
-
genesisArchiveRoot,
|
|
371
|
-
feeJuicePortalInitialBalance: fundingNeeded,
|
|
372
|
-
salt: opts.salt,
|
|
373
371
|
...deployL1ContractsArgs,
|
|
372
|
+
vkTreeRoot,
|
|
373
|
+
genesisArchiveRoot,
|
|
374
|
+
protocolContractsHash,
|
|
374
375
|
initialValidators: opts.initialValidators,
|
|
375
|
-
|
|
376
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
377
|
+
realVerifier: false,
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const deployL1ContractsValues = await deployAztecL1Contracts(
|
|
381
|
+
aztecNodeConfig.l1RpcUrls[0],
|
|
382
|
+
publisherPrivKeyHex,
|
|
383
|
+
foundry.id,
|
|
384
|
+
args,
|
|
385
|
+
);
|
|
386
|
+
|
|
376
387
|
aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
377
388
|
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
378
389
|
|
|
@@ -396,21 +407,7 @@ async function setupFromFresh(
|
|
|
396
407
|
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
397
408
|
}
|
|
398
409
|
|
|
399
|
-
const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
400
|
-
|
|
401
|
-
// Setup blob sink service
|
|
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();
|
|
410
|
+
const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
414
411
|
|
|
415
412
|
logger.info('Creating and synching an aztec node...');
|
|
416
413
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
@@ -461,7 +458,6 @@ async function setupFromFresh(
|
|
|
461
458
|
watcher,
|
|
462
459
|
cheatCodes,
|
|
463
460
|
dateProvider,
|
|
464
|
-
blobSink,
|
|
465
461
|
initialFundedAccounts,
|
|
466
462
|
directoryToCleanup,
|
|
467
463
|
};
|
|
@@ -476,18 +472,16 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
476
472
|
const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
477
473
|
await fs.mkdir(directoryToCleanup, { recursive: true });
|
|
478
474
|
|
|
479
|
-
// Run the blob sink on a random port
|
|
480
|
-
const blobSinkPort = await getPort();
|
|
481
|
-
|
|
482
475
|
// TODO: For some reason this is currently the union of a bunch of subsystems. That needs fixing.
|
|
483
476
|
const aztecNodeConfig: AztecNodeConfig & SetupOptions = JSON.parse(
|
|
484
477
|
readFileSync(`${statePath}/aztec_node_config.json`, 'utf-8'),
|
|
485
478
|
reviver,
|
|
486
479
|
);
|
|
487
480
|
aztecNodeConfig.dataDirectory = statePath;
|
|
488
|
-
aztecNodeConfig.blobSinkUrl = `http://127.0.0.1:${blobSinkPort}`;
|
|
489
481
|
aztecNodeConfig.listenAddress = '127.0.0.1';
|
|
490
482
|
|
|
483
|
+
await setupSharedBlobStorage(aztecNodeConfig);
|
|
484
|
+
|
|
491
485
|
const initialFundedAccounts: InitialAccountData[] =
|
|
492
486
|
JSON.parse(readFileSync(`${statePath}/accounts.json`, 'utf-8'), reviver) || [];
|
|
493
487
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
|
|
@@ -526,19 +520,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
526
520
|
);
|
|
527
521
|
await watcher.start();
|
|
528
522
|
|
|
529
|
-
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
530
|
-
const blobSink = await createBlobSinkServer(
|
|
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();
|
|
523
|
+
const telemetry = await initTelemetryClient(getTelemetryConfig());
|
|
542
524
|
|
|
543
525
|
logger.verbose('Creating aztec node...');
|
|
544
526
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
@@ -588,7 +570,6 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
588
570
|
watcher,
|
|
589
571
|
cheatCodes,
|
|
590
572
|
dateProvider,
|
|
591
|
-
blobSink,
|
|
592
573
|
initialFundedAccounts,
|
|
593
574
|
directoryToCleanup,
|
|
594
575
|
};
|