@aztec/end-to-end 0.0.1-commit.5daedc8 → 0.0.1-commit.6230efd
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 +5 -3
- package/dest/bench/utils.d.ts +2 -2
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -6
- 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 +2 -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 +13 -11
- 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 +4 -1
- 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 +10 -8
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- 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 -9
- 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 +34 -46
- package/dest/fixtures/utils.d.ts +20 -463
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +50 -78
- 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/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 +1 -1
- 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/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 +4 -2
- 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 +1 -1
- 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 +43 -10
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +148 -38
- package/package.json +40 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +7 -4
- package/src/bench/utils.ts +11 -7
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -9
- package/src/e2e_epochs/epochs_test.ts +33 -20
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +10 -4
- 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 +9 -16
- package/src/e2e_p2p/shared.ts +5 -1
- package/src/fixtures/e2e_prover_test.ts +8 -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 +51 -65
- package/src/fixtures/utils.ts +79 -138
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/shared/cross_chain_test_harness.ts +5 -2
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +8 -10
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +2 -1
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +207 -31
- 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/src/fixtures/setup_l1_contracts.ts +0 -26
package/src/fixtures/utils.ts
CHANGED
|
@@ -5,26 +5,23 @@ import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec
|
|
|
5
5
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
6
6
|
import { BatchCall, type ContractMethod } from '@aztec/aztec.js/contracts';
|
|
7
7
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
8
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
8
9
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
9
10
|
import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
10
11
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
11
12
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { type BlobClientInterface, createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
14
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
15
|
+
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
16
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
17
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
18
|
+
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
15
19
|
import {
|
|
16
|
-
type
|
|
17
|
-
type DeployL1ContractsReturnType,
|
|
18
|
-
FeeAssetArtifact,
|
|
19
|
-
NULL_KEY,
|
|
20
|
+
type DeployAztecL1ContractsReturnType,
|
|
20
21
|
type Operator,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
deployMulticall3,
|
|
25
|
-
getL1ContractsConfigEnvVars,
|
|
26
|
-
isAnvilTestChain,
|
|
27
|
-
} from '@aztec/ethereum';
|
|
22
|
+
type ZKPassportArgs,
|
|
23
|
+
deployAztecL1Contracts,
|
|
24
|
+
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
28
25
|
import {
|
|
29
26
|
DelayedTxUtils,
|
|
30
27
|
EthCheatCodes,
|
|
@@ -32,11 +29,9 @@ import {
|
|
|
32
29
|
createDelayedL1TxUtilsFromViemWallet,
|
|
33
30
|
startAnvil,
|
|
34
31
|
} from '@aztec/ethereum/test';
|
|
35
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
32
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
36
33
|
import { SecretValue } from '@aztec/foundation/config';
|
|
37
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
38
34
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
39
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
40
35
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
41
36
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
42
37
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -72,13 +67,19 @@ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/serv
|
|
|
72
67
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
73
68
|
|
|
74
69
|
import type { Anvil } from '@viem/anvil';
|
|
70
|
+
import { randomBytes } from 'crypto';
|
|
75
71
|
import fs from 'fs/promises';
|
|
76
|
-
import getPort from 'get-port';
|
|
77
72
|
import { tmpdir } from 'os';
|
|
78
73
|
import * as path from 'path';
|
|
79
|
-
import
|
|
80
|
-
import {
|
|
81
|
-
|
|
74
|
+
import type { Hex } from 'viem';
|
|
75
|
+
import {
|
|
76
|
+
type HDAccount,
|
|
77
|
+
type PrivateKeyAccount,
|
|
78
|
+
generatePrivateKey,
|
|
79
|
+
mnemonicToAccount,
|
|
80
|
+
privateKeyToAccount,
|
|
81
|
+
} from 'viem/accounts';
|
|
82
|
+
import { type Chain, foundry } from 'viem/chains';
|
|
82
83
|
|
|
83
84
|
import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
84
85
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
@@ -88,14 +89,24 @@ import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
|
88
89
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
89
90
|
export { startAnvil };
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Sets up shared blob storage using FileStore in the data directory.
|
|
94
|
+
*/
|
|
95
|
+
export async function setupSharedBlobStorage(config: { dataDirectory?: string } & Record<string, any>): Promise<void> {
|
|
96
|
+
const sharedBlobPath = path.join(config.dataDirectory!, 'shared-blobs');
|
|
97
|
+
await fs.mkdir(sharedBlobPath, { recursive: true });
|
|
98
|
+
config.blobFileStoreUrls = [`file://${sharedBlobPath}`];
|
|
99
|
+
config.blobFileStoreUploadUrl = `file://${sharedBlobPath}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
const { AZTEC_NODE_URL = '' } = process.env;
|
|
92
103
|
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
93
104
|
|
|
94
105
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
95
|
-
function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
106
|
+
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
96
107
|
if (!telemetry) {
|
|
97
108
|
const config = { ...getTelemetryConfig(), ...partialConfig };
|
|
98
|
-
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
|
|
109
|
+
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
|
|
99
110
|
}
|
|
100
111
|
return telemetry;
|
|
101
112
|
}
|
|
@@ -111,37 +122,6 @@ export const getPrivateKeyFromIndex = (index: number): Buffer | null => {
|
|
|
111
122
|
return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
|
|
112
123
|
};
|
|
113
124
|
|
|
114
|
-
export const setupL1Contracts = async (
|
|
115
|
-
l1RpcUrls: string[],
|
|
116
|
-
account: HDAccount | PrivateKeyAccount,
|
|
117
|
-
logger: Logger,
|
|
118
|
-
args: Partial<DeployL1ContractsArgs> = {},
|
|
119
|
-
chain: Chain = foundry,
|
|
120
|
-
) => {
|
|
121
|
-
const l1Data = await deployL1Contracts(
|
|
122
|
-
l1RpcUrls,
|
|
123
|
-
account,
|
|
124
|
-
chain,
|
|
125
|
-
logger,
|
|
126
|
-
{
|
|
127
|
-
vkTreeRoot: getVKTreeRoot(),
|
|
128
|
-
protocolContractsHash,
|
|
129
|
-
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
130
|
-
salt: args.salt,
|
|
131
|
-
initialValidators: args.initialValidators,
|
|
132
|
-
...getL1ContractsConfigEnvVars(),
|
|
133
|
-
realVerifier: false,
|
|
134
|
-
...args,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
priorityFeeBumpPercentage: 0,
|
|
138
|
-
priorityFeeRetryBumpPercentage: 0,
|
|
139
|
-
},
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
return l1Data;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
125
|
/**
|
|
146
126
|
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
147
127
|
* @param aztecNode - An instance of Aztec Node.
|
|
@@ -218,7 +198,7 @@ async function setupWithRemoteEnvironment(
|
|
|
218
198
|
|
|
219
199
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
220
200
|
|
|
221
|
-
const deployL1ContractsValues:
|
|
201
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
|
|
222
202
|
l1ContractAddresses,
|
|
223
203
|
l1Client,
|
|
224
204
|
rollupVersion,
|
|
@@ -260,8 +240,8 @@ async function setupWithRemoteEnvironment(
|
|
|
260
240
|
mockGossipSubNetwork: undefined,
|
|
261
241
|
watcher: undefined,
|
|
262
242
|
dateProvider: undefined,
|
|
263
|
-
blobSink: undefined,
|
|
264
243
|
telemetryClient: undefined,
|
|
244
|
+
blobClient: undefined,
|
|
265
245
|
teardown,
|
|
266
246
|
};
|
|
267
247
|
}
|
|
@@ -273,17 +253,13 @@ export type SetupOptions = {
|
|
|
273
253
|
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
274
254
|
metricsPort?: number | undefined;
|
|
275
255
|
/** Previously deployed contracts on L1 */
|
|
276
|
-
deployL1ContractsValues?:
|
|
277
|
-
/** Whether to skip deployment of protocol contracts (auth registry, etc) */
|
|
278
|
-
skipProtocolContracts?: boolean;
|
|
256
|
+
deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
|
|
279
257
|
/** Initial fee juice for default accounts */
|
|
280
258
|
initialAccountFeeJuice?: Fr;
|
|
281
259
|
/** Number of initial accounts funded with fee juice */
|
|
282
260
|
numberOfInitialFundedAccounts?: number;
|
|
283
261
|
/** Data of the initial funded accounts */
|
|
284
262
|
initialFundedAccounts?: InitialAccountData[];
|
|
285
|
-
/** Salt to use in L1 contract deployment */
|
|
286
|
-
salt?: number;
|
|
287
263
|
/** An initial set of validators */
|
|
288
264
|
initialValidators?: (Operator & { privateKey: `0x${string}` })[];
|
|
289
265
|
/** Anvil Start time */
|
|
@@ -292,8 +268,6 @@ export type SetupOptions = {
|
|
|
292
268
|
l2StartTime?: number;
|
|
293
269
|
/** Whether to start a prover node */
|
|
294
270
|
startProverNode?: boolean;
|
|
295
|
-
/** Whether to fund the rewardDistributor */
|
|
296
|
-
fundRewardDistributor?: boolean;
|
|
297
271
|
/** Manual config for the telemetry client */
|
|
298
272
|
telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
|
|
299
273
|
/** Public data that will be inserted in the tree in genesis */
|
|
@@ -312,6 +286,8 @@ export type SetupOptions = {
|
|
|
312
286
|
anvilPort?: number;
|
|
313
287
|
/** Key to use for publishing L1 contracts */
|
|
314
288
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
289
|
+
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
290
|
+
zkPassportArgs?: ZKPassportArgs;
|
|
315
291
|
} & Partial<AztecNodeConfig>;
|
|
316
292
|
|
|
317
293
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -324,8 +300,8 @@ export type EndToEndContext = {
|
|
|
324
300
|
proverNode: ProverNode | undefined;
|
|
325
301
|
/** A client to the sequencer service (undefined if connected to remote environment) */
|
|
326
302
|
sequencer: SequencerClient | undefined;
|
|
327
|
-
/** Return values from
|
|
328
|
-
deployL1ContractsValues:
|
|
303
|
+
/** Return values from deployAztecL1Contracts function. */
|
|
304
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
329
305
|
/** The Aztec Node configuration. */
|
|
330
306
|
config: AztecNodeConfig;
|
|
331
307
|
/** The data for the initial funded accounts. */
|
|
@@ -344,14 +320,14 @@ export type EndToEndContext = {
|
|
|
344
320
|
watcher: AnvilTestWatcher | undefined;
|
|
345
321
|
/** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
|
|
346
322
|
dateProvider: TestDateProvider | undefined;
|
|
347
|
-
/** The blob sink (undefined if connected to remote environment) */
|
|
348
|
-
blobSink: BlobSinkServer | undefined;
|
|
349
323
|
/** Telemetry client */
|
|
350
324
|
telemetryClient: TelemetryClient | undefined;
|
|
351
325
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
352
326
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
353
327
|
/** Prefilled public data used for setting up nodes. */
|
|
354
328
|
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
329
|
+
/** The blob client client used for blob storage (undefined if connected to remote environment) */
|
|
330
|
+
blobClient: BlobClientInterface | undefined;
|
|
355
331
|
/** Function to stop the started services. */
|
|
356
332
|
teardown: () => Promise<void>;
|
|
357
333
|
};
|
|
@@ -429,27 +405,32 @@ export async function setup(
|
|
|
429
405
|
await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
|
|
430
406
|
}
|
|
431
407
|
|
|
432
|
-
let
|
|
433
|
-
let publisherHdAccount = undefined;
|
|
408
|
+
let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
|
|
409
|
+
let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
|
|
434
410
|
|
|
435
411
|
if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
|
|
436
|
-
|
|
412
|
+
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
413
|
+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
437
414
|
} else if (
|
|
438
415
|
config.publisherPrivateKeys &&
|
|
439
416
|
config.publisherPrivateKeys.length > 0 &&
|
|
440
417
|
config.publisherPrivateKeys[0].getValue() != NULL_KEY
|
|
441
418
|
) {
|
|
442
|
-
|
|
419
|
+
publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
|
|
420
|
+
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
443
421
|
} else if (!MNEMONIC) {
|
|
444
422
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
445
423
|
} else {
|
|
446
424
|
publisherHdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
|
|
447
425
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
448
|
-
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
449
|
-
|
|
426
|
+
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
427
|
+
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
428
|
+
config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
450
429
|
}
|
|
451
430
|
|
|
452
|
-
config.coinbase
|
|
431
|
+
if (config.coinbase === undefined) {
|
|
432
|
+
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
433
|
+
}
|
|
453
434
|
|
|
454
435
|
if (AZTEC_NODE_URL) {
|
|
455
436
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
@@ -472,51 +453,26 @@ export async function setup(
|
|
|
472
453
|
}
|
|
473
454
|
|
|
474
455
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
456
|
+
|
|
457
|
+
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
|
|
458
|
+
config.l1RpcUrls[0],
|
|
459
|
+
publisherPrivKeyHex!,
|
|
460
|
+
chain.id,
|
|
461
|
+
{
|
|
462
|
+
...getL1ContractsConfigEnvVars(),
|
|
463
|
+
...opts,
|
|
464
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
465
|
+
protocolContractsHash,
|
|
466
|
+
genesisArchiveRoot,
|
|
467
|
+
initialValidators: opts.initialValidators,
|
|
468
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
469
|
+
realVerifier: false,
|
|
470
|
+
},
|
|
471
|
+
);
|
|
491
472
|
|
|
492
473
|
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
493
474
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
494
475
|
|
|
495
|
-
if (opts.fundRewardDistributor) {
|
|
496
|
-
// Mints block rewards for 10000 blocks to the rewardDistributor contract
|
|
497
|
-
|
|
498
|
-
const rollup = new RollupContract(
|
|
499
|
-
deployL1ContractsValues.l1Client,
|
|
500
|
-
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
501
|
-
);
|
|
502
|
-
|
|
503
|
-
const blockReward = await rollup.getCheckpointReward();
|
|
504
|
-
const mintAmount = 10_000n * (blockReward as bigint);
|
|
505
|
-
|
|
506
|
-
const feeJuice = getContract({
|
|
507
|
-
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
508
|
-
abi: FeeAssetArtifact.contractAbi,
|
|
509
|
-
client: deployL1ContractsValues.l1Client,
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
const rewardDistributorMintTxHash = await feeJuice.write.mint(
|
|
513
|
-
[deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(), mintAmount],
|
|
514
|
-
{} as any,
|
|
515
|
-
);
|
|
516
|
-
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
|
|
517
|
-
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
476
|
if (enableAutomine) {
|
|
521
477
|
await ethCheatCodes.setAutomine(false);
|
|
522
478
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
@@ -539,23 +495,9 @@ export async function setup(
|
|
|
539
495
|
await watcher.start();
|
|
540
496
|
}
|
|
541
497
|
|
|
542
|
-
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
498
|
+
const telemetry = await getTelemetryClient(opts.telemetryConfig);
|
|
543
499
|
|
|
544
|
-
|
|
545
|
-
const blobSinkPort = await getPort();
|
|
546
|
-
const blobSink = await createBlobSinkServer(
|
|
547
|
-
{
|
|
548
|
-
l1ChainId: config.l1ChainId,
|
|
549
|
-
l1RpcUrls: config.l1RpcUrls,
|
|
550
|
-
l1Contracts: config.l1Contracts,
|
|
551
|
-
port: blobSinkPort,
|
|
552
|
-
dataDirectory: config.dataDirectory,
|
|
553
|
-
dataStoreMapSizeKb: config.dataStoreMapSizeKb,
|
|
554
|
-
},
|
|
555
|
-
telemetry,
|
|
556
|
-
);
|
|
557
|
-
await blobSink.start();
|
|
558
|
-
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
500
|
+
await setupSharedBlobStorage(config);
|
|
559
501
|
|
|
560
502
|
logger.verbose('Creating and synching an aztec node', config);
|
|
561
503
|
|
|
@@ -571,7 +513,7 @@ export async function setup(
|
|
|
571
513
|
config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
572
514
|
}
|
|
573
515
|
|
|
574
|
-
const
|
|
516
|
+
const blobClient = await createBlobClientWithFileStores(config, createLogger('node:blob-client:client'));
|
|
575
517
|
|
|
576
518
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
577
519
|
let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
|
|
@@ -611,7 +553,7 @@ export async function setup(
|
|
|
611
553
|
|
|
612
554
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
613
555
|
config, // REFACTOR: createAndSync mutates this config
|
|
614
|
-
{ dateProvider,
|
|
556
|
+
{ dateProvider, blobClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
|
|
615
557
|
{ prefilledPublicData },
|
|
616
558
|
);
|
|
617
559
|
const sequencerClient = aztecNode.getSequencer();
|
|
@@ -699,7 +641,6 @@ export async function setup(
|
|
|
699
641
|
await tryStop(watcher, logger);
|
|
700
642
|
await tryStop(anvil, logger);
|
|
701
643
|
|
|
702
|
-
await tryStop(blobSink, logger);
|
|
703
644
|
await tryRmDir(directoryToCleanup, logger);
|
|
704
645
|
} catch (err) {
|
|
705
646
|
logger.error(`Error during e2e test teardown`, err);
|
|
@@ -709,7 +650,6 @@ export async function setup(
|
|
|
709
650
|
return {
|
|
710
651
|
aztecNode,
|
|
711
652
|
aztecNodeAdmin: aztecNode,
|
|
712
|
-
blobSink,
|
|
713
653
|
cheatCodes,
|
|
714
654
|
ethCheatCodes,
|
|
715
655
|
config,
|
|
@@ -726,6 +666,7 @@ export async function setup(
|
|
|
726
666
|
wallet,
|
|
727
667
|
accounts,
|
|
728
668
|
watcher,
|
|
669
|
+
blobClient,
|
|
729
670
|
};
|
|
730
671
|
} catch (err) {
|
|
731
672
|
// TODO: Just hoisted anvil for now to ensure cleanup. Prob need to hoist the rest.
|
|
@@ -876,7 +817,7 @@ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
|
876
817
|
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
877
818
|
}
|
|
878
819
|
|
|
879
|
-
export async function waitForProvenChain(node: AztecNode, targetBlock?:
|
|
820
|
+
export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
|
|
880
821
|
targetBlock ??= await node.getBlockNumber();
|
|
881
822
|
|
|
882
823
|
await retryUntil(
|
|
@@ -904,13 +845,13 @@ export function createAndSyncProverNode(
|
|
|
904
845
|
stop: () => Promise.resolve(),
|
|
905
846
|
};
|
|
906
847
|
|
|
907
|
-
const
|
|
848
|
+
const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
|
|
908
849
|
|
|
909
850
|
// Creating temp store and archiver for simulated prover node
|
|
910
851
|
const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
|
|
911
852
|
const archiver = await createArchiver(
|
|
912
853
|
archiverConfig,
|
|
913
|
-
{
|
|
854
|
+
{ blobClient, dateProvider: proverNodeDeps.dateProvider },
|
|
914
855
|
{ blockUntilSync: true },
|
|
915
856
|
);
|
|
916
857
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
1
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
2
2
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
3
|
import { sleep } from '@aztec/foundation/sleep';
|
|
4
4
|
import { RemoteSigner } from '@aztec/node-keystore';
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from '@aztec/telemetry-client';
|
|
8
8
|
import { OTelPinoStream } from '@aztec/telemetry-client/otel-pino-stream';
|
|
9
9
|
|
|
10
|
-
export function getEndToEndTestTelemetryClient(metricsPort?: number): TelemetryClient {
|
|
10
|
+
export async function getEndToEndTestTelemetryClient(metricsPort?: number): Promise<TelemetryClient> {
|
|
11
11
|
if (metricsPort) {
|
|
12
12
|
const otelStream = new OTelPinoStream({ levels });
|
|
13
13
|
registerLoggingStream(otelStream);
|
|
14
14
|
}
|
|
15
|
-
return initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
|
|
15
|
+
return await initTelemetryClient(getEndToEndTestTelemetryConfig(metricsPort));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -13,7 +13,10 @@ import type { AztecNode } from '@aztec/aztec.js/node';
|
|
|
13
13
|
import type { SiblingPath } from '@aztec/aztec.js/trees';
|
|
14
14
|
import type { TxReceipt } from '@aztec/aztec.js/tx';
|
|
15
15
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
16
|
-
import {
|
|
16
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
17
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
18
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
19
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
17
20
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
18
21
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
19
22
|
import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
|
|
@@ -321,7 +324,7 @@ export class CrossChainTestHarness {
|
|
|
321
324
|
|
|
322
325
|
withdrawFundsFromBridgeOnL1(
|
|
323
326
|
amount: bigint,
|
|
324
|
-
blockNumber:
|
|
327
|
+
blockNumber: BlockNumber,
|
|
325
328
|
messageIndex: bigint,
|
|
326
329
|
siblingPath: SiblingPath<number>,
|
|
327
330
|
) {
|
|
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
4
4
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
6
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
|
-
import type { ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
7
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
8
8
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
9
9
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
10
10
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
@@ -5,14 +5,12 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
5
5
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
6
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
7
7
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '@aztec/ethereum';
|
|
15
|
-
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
8
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
9
|
+
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
10
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
11
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
12
|
+
import { extractEvent } from '@aztec/ethereum/utils';
|
|
13
|
+
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
16
14
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
17
15
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
18
16
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
@@ -49,7 +47,7 @@ export type UniswapSetupContext = {
|
|
|
49
47
|
/** The sponsor wallet. */
|
|
50
48
|
sponsorAddress: AztecAddress;
|
|
51
49
|
/** */
|
|
52
|
-
deployL1ContractsValues:
|
|
50
|
+
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
53
51
|
/** Cheat codes instance. */
|
|
54
52
|
cheatCodes: CheatCodes;
|
|
55
53
|
};
|
|
@@ -79,7 +77,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
79
77
|
let daiCrossChainHarness: CrossChainTestHarness;
|
|
80
78
|
let wethCrossChainHarness: CrossChainTestHarness;
|
|
81
79
|
|
|
82
|
-
let deployL1ContractsValues:
|
|
80
|
+
let deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
83
81
|
let rollup: RollupContract;
|
|
84
82
|
let uniswapPortal: GetContractReturnType<typeof UniswapPortalAbi, ExtendedViemWalletClient>;
|
|
85
83
|
let uniswapPortalAddress: EthAddress;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
|
-
import type { RollupContract } from '@aztec/ethereum';
|
|
5
|
+
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
6
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
|
-
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
7
|
+
import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
|
|
8
8
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
10
10
|
|
package/src/spartan/DEVELOP.md
CHANGED
|
@@ -61,10 +61,17 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
|
|
|
61
61
|
- the containers for the aztec infrastructure (validators, provers, etc)
|
|
62
62
|
|
|
63
63
|
# Deploy Metrics
|
|
64
|
+
|
|
64
65
|
```bash
|
|
65
66
|
./spartan/bootstrap.sh metrics-kind
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
# Install Chaos Mesh
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./spartan/bootstrap.sh chaos-mesh
|
|
73
|
+
```
|
|
74
|
+
|
|
68
75
|
# Deploy stuff
|
|
69
76
|
|
|
70
77
|
```bash
|
|
@@ -6,7 +6,8 @@ import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.j
|
|
|
6
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
7
|
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
8
8
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { createEthereumChain
|
|
9
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
10
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
11
|
import type { Logger } from '@aztec/foundation/log';
|
|
11
12
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
12
13
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|