@aztec/end-to-end 3.0.0-devnet.2 → 3.0.0-devnet.20251212
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/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +9 -2
- 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 +8 -30
- package/dest/bench/utils.d.ts +2 -2
- 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 +3 -2
- 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 +10 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +11 -9
- 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 +5 -3
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +14 -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 +6 -2
- package/dest/e2e_p2p/p2p_network.d.ts +218 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +11 -5
- 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 +4 -2
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +18 -14
- package/dest/fixtures/fixtures.d.ts +1 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +1 -1
- 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_l1_contracts.d.ts +475 -4
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +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 +3 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +6 -4
- 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 +453 -7
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +26 -19
- 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 +3 -2
- 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 +31 -21
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +93 -33
- package/package.json +42 -40
- package/src/bench/client_flows/benchmark.ts +2 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +80 -33
- package/src/bench/client_flows/data_extractor.ts +9 -31
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -6
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +19 -16
- package/src/e2e_fees/bridging_race.notest.ts +2 -2
- package/src/e2e_fees/fees_test.ts +18 -12
- 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 +9 -3
- package/src/e2e_p2p/p2p_network.ts +15 -12
- 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 +16 -17
- package/src/fixtures/fixtures.ts +1 -2
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_l1_contracts.ts +2 -1
- package/src/fixtures/setup_p2p_test.ts +23 -9
- package/src/fixtures/snapshot_manager.ts +7 -10
- package/src/fixtures/token_utils.ts +4 -4
- package/src/fixtures/utils.ts +51 -31
- 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 +16 -19
- 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 +107 -33
|
@@ -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;
|
|
@@ -10,17 +10,14 @@ 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
12
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
deployMulticall3,
|
|
18
|
-
getL1ContractsConfigEnvVars,
|
|
19
|
-
} from '@aztec/ethereum';
|
|
13
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
14
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
15
|
+
import { deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
16
|
+
import type { DeployL1ContractsArgs, DeployL1ContractsReturnType } from '@aztec/ethereum/deploy-l1-contracts';
|
|
20
17
|
import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
21
18
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
22
19
|
import { SecretValue } from '@aztec/foundation/config';
|
|
23
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
20
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
24
21
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
25
22
|
import { createLogger } from '@aztec/foundation/log';
|
|
26
23
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
@@ -396,7 +393,7 @@ async function setupFromFresh(
|
|
|
396
393
|
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
|
|
397
394
|
}
|
|
398
395
|
|
|
399
|
-
const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
396
|
+
const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
|
|
400
397
|
|
|
401
398
|
// Setup blob sink service
|
|
402
399
|
const blobSink = await createBlobSinkServer(
|
|
@@ -526,7 +523,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
526
523
|
);
|
|
527
524
|
await watcher.start();
|
|
528
525
|
|
|
529
|
-
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
526
|
+
const telemetry = await initTelemetryClient(getTelemetryConfig());
|
|
530
527
|
const blobSink = await createBlobSinkServer(
|
|
531
528
|
{
|
|
532
529
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
@@ -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);
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -12,19 +12,18 @@ import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
|
12
12
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
13
13
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
14
14
|
import { GENESIS_ARCHIVE_ROOT, 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';
|
|
19
|
+
import { RollupContract, deployMulticall3 } from '@aztec/ethereum/contracts';
|
|
15
20
|
import {
|
|
16
21
|
type DeployL1ContractsArgs,
|
|
17
22
|
type DeployL1ContractsReturnType,
|
|
18
|
-
FeeAssetArtifact,
|
|
19
|
-
NULL_KEY,
|
|
20
23
|
type Operator,
|
|
21
|
-
RollupContract,
|
|
22
|
-
createExtendedL1Client,
|
|
23
24
|
deployL1Contracts,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
isAnvilTestChain,
|
|
27
|
-
} from '@aztec/ethereum';
|
|
25
|
+
} from '@aztec/ethereum/deploy-l1-contracts';
|
|
26
|
+
import { FeeAssetArtifact } from '@aztec/ethereum/l1-artifacts';
|
|
28
27
|
import {
|
|
29
28
|
DelayedTxUtils,
|
|
30
29
|
EthCheatCodes,
|
|
@@ -32,10 +31,11 @@ import {
|
|
|
32
31
|
createDelayedL1TxUtilsFromViemWallet,
|
|
33
32
|
startAnvil,
|
|
34
33
|
} from '@aztec/ethereum/test';
|
|
34
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
35
35
|
import { SecretValue } from '@aztec/foundation/config';
|
|
36
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
36
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
37
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
37
38
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
38
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
39
39
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
40
40
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
41
41
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -91,10 +91,10 @@ const { AZTEC_NODE_URL = '' } = process.env;
|
|
|
91
91
|
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
92
92
|
|
|
93
93
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
94
|
-
function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
94
|
+
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
95
95
|
if (!telemetry) {
|
|
96
96
|
const config = { ...getTelemetryConfig(), ...partialConfig };
|
|
97
|
-
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
|
|
97
|
+
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
|
|
98
98
|
}
|
|
99
99
|
return telemetry;
|
|
100
100
|
}
|
|
@@ -117,16 +117,26 @@ export const setupL1Contracts = async (
|
|
|
117
117
|
args: Partial<DeployL1ContractsArgs> = {},
|
|
118
118
|
chain: Chain = foundry,
|
|
119
119
|
) => {
|
|
120
|
-
const l1Data = await deployL1Contracts(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
const l1Data = await deployL1Contracts(
|
|
121
|
+
l1RpcUrls,
|
|
122
|
+
account,
|
|
123
|
+
chain,
|
|
124
|
+
logger,
|
|
125
|
+
{
|
|
126
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
127
|
+
protocolContractsHash,
|
|
128
|
+
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
129
|
+
salt: args.salt,
|
|
130
|
+
initialValidators: args.initialValidators,
|
|
131
|
+
...getL1ContractsConfigEnvVars(),
|
|
132
|
+
realVerifier: false,
|
|
133
|
+
...args,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
priorityFeeBumpPercentage: 0,
|
|
137
|
+
priorityFeeRetryBumpPercentage: 0,
|
|
138
|
+
},
|
|
139
|
+
);
|
|
130
140
|
|
|
131
141
|
return l1Data;
|
|
132
142
|
};
|
|
@@ -438,7 +448,9 @@ export async function setup(
|
|
|
438
448
|
config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
|
|
439
449
|
}
|
|
440
450
|
|
|
441
|
-
config.coinbase
|
|
451
|
+
if (config.coinbase === undefined) {
|
|
452
|
+
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
453
|
+
}
|
|
442
454
|
|
|
443
455
|
if (AZTEC_NODE_URL) {
|
|
444
456
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
@@ -489,7 +501,7 @@ export async function setup(
|
|
|
489
501
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
490
502
|
);
|
|
491
503
|
|
|
492
|
-
const blockReward = await rollup.
|
|
504
|
+
const blockReward = await rollup.getCheckpointReward();
|
|
493
505
|
const mintAmount = 10_000n * (blockReward as bigint);
|
|
494
506
|
|
|
495
507
|
const feeJuice = getContract({
|
|
@@ -528,7 +540,7 @@ export async function setup(
|
|
|
528
540
|
await watcher.start();
|
|
529
541
|
}
|
|
530
542
|
|
|
531
|
-
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
543
|
+
const telemetry = await getTelemetryClient(opts.telemetryConfig);
|
|
532
544
|
|
|
533
545
|
// Blob sink service - blobs get posted here and served from here
|
|
534
546
|
const blobSinkPort = await getPort();
|
|
@@ -636,7 +648,11 @@ export async function setup(
|
|
|
636
648
|
(opts.initialValidators && opts.initialValidators.length > 0)
|
|
637
649
|
) {
|
|
638
650
|
// We need to advance such that the committee is set up.
|
|
639
|
-
await cheatCodes.rollup.advanceToEpoch(
|
|
651
|
+
await cheatCodes.rollup.advanceToEpoch(
|
|
652
|
+
EpochNumber.fromBigInt(
|
|
653
|
+
BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
|
|
654
|
+
),
|
|
655
|
+
);
|
|
640
656
|
await cheatCodes.rollup.setupEpoch();
|
|
641
657
|
await cheatCodes.rollup.debugRollup();
|
|
642
658
|
}
|
|
@@ -728,7 +744,7 @@ export async function setup(
|
|
|
728
744
|
|
|
729
745
|
export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
|
|
730
746
|
// We have to check whether the accounts are already deployed. This can happen if the test runs against
|
|
731
|
-
// the
|
|
747
|
+
// the local network and the test accounts exist
|
|
732
748
|
const accountsAndAddresses = await Promise.all(
|
|
733
749
|
accountsToDeploy.map(async address => {
|
|
734
750
|
return {
|
|
@@ -848,7 +864,7 @@ export async function setupSponsoredFPC(wallet: Wallet) {
|
|
|
848
864
|
salt: new Fr(SPONSORED_FPC_SALT),
|
|
849
865
|
});
|
|
850
866
|
|
|
851
|
-
await wallet.registerContract(
|
|
867
|
+
await wallet.registerContract(instance, SponsoredFPCContract.artifact);
|
|
852
868
|
getLogger().info(`SponsoredFPC: ${instance.address}`);
|
|
853
869
|
return instance;
|
|
854
870
|
}
|
|
@@ -858,10 +874,10 @@ export async function setupSponsoredFPC(wallet: Wallet) {
|
|
|
858
874
|
* @param wallet - The wallet
|
|
859
875
|
*/
|
|
860
876
|
export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
861
|
-
await wallet.registerContract(
|
|
877
|
+
await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
|
|
862
878
|
}
|
|
863
879
|
|
|
864
|
-
export async function waitForProvenChain(node: AztecNode, targetBlock?:
|
|
880
|
+
export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
|
|
865
881
|
targetBlock ??= await node.getBlockNumber();
|
|
866
882
|
|
|
867
883
|
await retryUntil(
|
|
@@ -893,7 +909,11 @@ export function createAndSyncProverNode(
|
|
|
893
909
|
|
|
894
910
|
// Creating temp store and archiver for simulated prover node
|
|
895
911
|
const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
|
|
896
|
-
const archiver = await createArchiver(
|
|
912
|
+
const archiver = await createArchiver(
|
|
913
|
+
archiverConfig,
|
|
914
|
+
{ blobSinkClient, dateProvider: proverNodeDeps.dateProvider },
|
|
915
|
+
{ blockUntilSync: true },
|
|
916
|
+
);
|
|
897
917
|
|
|
898
918
|
// Prover node config is for simulated proofs
|
|
899
919
|
const proverConfig: ProverNodeConfig = {
|
|
@@ -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-contracts';
|
|
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';
|
|
@@ -43,7 +43,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
43
43
|
throw new Error('Fee Juice portal not deployed on L1');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const gasL2 =
|
|
46
|
+
const gasL2 = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
47
47
|
|
|
48
48
|
return new GasBridgingTestHarness(
|
|
49
49
|
aztecNode,
|
|
@@ -5,14 +5,11 @@ 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
|
-
extractEvent,
|
|
14
|
-
} from '@aztec/ethereum';
|
|
15
|
-
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
8
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
9
|
+
import { type DeployL1ContractsReturnType, deployL1Contract } from '@aztec/ethereum/deploy-l1-contracts';
|
|
10
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
11
|
+
import { extractEvent } from '@aztec/ethereum/utils';
|
|
12
|
+
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
16
13
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
17
14
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
18
15
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
@@ -262,7 +259,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
262
259
|
await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
|
|
263
260
|
|
|
264
261
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
265
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
262
|
+
await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
|
|
266
263
|
|
|
267
264
|
// 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
|
|
268
265
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
@@ -287,7 +284,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
287
284
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
288
285
|
|
|
289
286
|
const withdrawMessageMetadata = {
|
|
290
|
-
|
|
287
|
+
_checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
|
|
291
288
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
292
289
|
_path: withdrawSiblingPath
|
|
293
290
|
.toBufferArray()
|
|
@@ -295,7 +292,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
295
292
|
};
|
|
296
293
|
|
|
297
294
|
const swapPrivateMessageMetadata = {
|
|
298
|
-
|
|
295
|
+
_checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
|
|
299
296
|
_leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
300
297
|
_path: swapPrivateSiblingPath
|
|
301
298
|
.toBufferArray()
|
|
@@ -506,7 +503,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
506
503
|
// );
|
|
507
504
|
|
|
508
505
|
// const withdrawMessageMetadata = {
|
|
509
|
-
//
|
|
506
|
+
// _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
|
|
510
507
|
// _leafIndex: BigInt(withdrawL2MessageIndex),
|
|
511
508
|
// _path: withdrawSiblingPath
|
|
512
509
|
// .toBufferArray()
|
|
@@ -514,7 +511,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
514
511
|
// };
|
|
515
512
|
|
|
516
513
|
// const swapPrivateMessageMetadata = {
|
|
517
|
-
//
|
|
514
|
+
// _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
|
|
518
515
|
// _leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
519
516
|
// _path: swapPrivateSiblingPath
|
|
520
517
|
// .toBufferArray()
|
|
@@ -872,7 +869,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
872
869
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
873
870
|
|
|
874
871
|
const withdrawMessageMetadata = {
|
|
875
|
-
|
|
872
|
+
_checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
876
873
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
877
874
|
_path: withdrawSiblingPath
|
|
878
875
|
.toBufferArray()
|
|
@@ -880,7 +877,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
880
877
|
};
|
|
881
878
|
|
|
882
879
|
const swapPrivateMessageMetadata = {
|
|
883
|
-
|
|
880
|
+
_checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
884
881
|
_leafIndex: BigInt(swapPrivateL2MessageIndex),
|
|
885
882
|
_path: swapPrivateSiblingPath
|
|
886
883
|
.toBufferArray()
|
|
@@ -891,7 +888,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
891
888
|
await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
|
|
892
889
|
|
|
893
890
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
894
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
891
|
+
await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
|
|
895
892
|
|
|
896
893
|
// On L1 call swap_public!
|
|
897
894
|
logger.info('call swap_public on L1');
|
|
@@ -1007,7 +1004,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
1007
1004
|
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
1008
1005
|
|
|
1009
1006
|
const withdrawMessageMetadata = {
|
|
1010
|
-
|
|
1007
|
+
_checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
1011
1008
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
1012
1009
|
_path: withdrawSiblingPath
|
|
1013
1010
|
.toBufferArray()
|
|
@@ -1015,7 +1012,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
1015
1012
|
};
|
|
1016
1013
|
|
|
1017
1014
|
const swapPublicMessageMetadata = {
|
|
1018
|
-
|
|
1015
|
+
_checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
1019
1016
|
_leafIndex: BigInt(swapPublicL2MessageIndex),
|
|
1020
1017
|
_path: swapPublicSiblingPath
|
|
1021
1018
|
.toBufferArray()
|
|
@@ -1026,7 +1023,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
1026
1023
|
await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
|
|
1027
1024
|
|
|
1028
1025
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
1029
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
1026
|
+
await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
|
|
1030
1027
|
|
|
1031
1028
|
// Call swap_private on L1
|
|
1032
1029
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
@@ -2,8 +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';
|
|
6
|
-
import {
|
|
5
|
+
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
|
+
import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
|
|
7
8
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
8
9
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
9
10
|
|
|
@@ -103,7 +104,8 @@ export class LendingSimulator {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
|
|
106
|
-
const
|
|
107
|
+
const targetSlot = SlotNumber(slot + diff);
|
|
108
|
+
const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
|
|
107
109
|
const timeDiff = ts - this.time;
|
|
108
110
|
this.time = ts;
|
|
109
111
|
|
|
@@ -112,7 +114,7 @@ export class LendingSimulator {
|
|
|
112
114
|
if (dateProvider) {
|
|
113
115
|
dateProvider.setTime(this.time * 1000);
|
|
114
116
|
}
|
|
115
|
-
await this.cc.rollup.markAsProven(await this.rollup.
|
|
117
|
+
await this.cc.rollup.markAsProven(await this.rollup.getCheckpointNumber());
|
|
116
118
|
this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
|
|
117
119
|
}
|
|
118
120
|
|
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
|