@aztec/end-to-end 0.0.1-commit.7b97ef96e → 0.0.1-commit.7cbc774
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/README.md +27 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +17 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +33 -36
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +8 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +5 -4
- 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 +28 -19
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +15 -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 +39 -7
- package/dest/e2e_deploy_contract/deploy_test.d.ts +3 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -1
- package/dest/e2e_epochs/epochs_test.d.ts +25 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +88 -14
- package/dest/e2e_fees/fees_test.d.ts +5 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +45 -12
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +5 -3
- package/dest/e2e_p2p/p2p_network.d.ts +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +65 -43
- package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +42 -13
- package/dest/e2e_p2p/shared.d.ts +25 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +73 -50
- package/dest/e2e_token_contract/token_contract_test.d.ts +3 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +15 -13
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +6 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +13 -17
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +73 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +68 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +2 -2
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +45 -14
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +138 -29
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +8 -8
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +2 -5
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +4 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +22 -18
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +19 -10
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +60 -39
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +26 -14
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +72 -39
- package/dest/spartan/tx_metrics.d.ts +18 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +74 -21
- package/dest/spartan/utils/config.d.ts +10 -30
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +3 -1
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +4 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +11 -11
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +25 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +146 -87
- package/dest/test-wallet/utils.d.ts +3 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +2 -7
- package/dest/test-wallet/wallet_worker_script.js +42 -34
- package/dest/test-wallet/worker_wallet.d.ts +5 -4
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +56 -4
- package/dest/test-wallet/worker_wallet_schema.d.ts +110 -224
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +14 -2
- package/package.json +49 -46
- package/src/bench/client_flows/benchmark.ts +19 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +60 -41
- package/src/bench/utils.ts +9 -3
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +42 -24
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +49 -11
- package/src/e2e_deploy_contract/deploy_test.ts +3 -2
- package/src/e2e_epochs/epochs_test.ts +99 -11
- package/src/e2e_fees/fees_test.ts +50 -10
- package/src/e2e_nested_contract/nested_contract_test.ts +9 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -3
- package/src/e2e_p2p/p2p_network.ts +82 -60
- package/src/e2e_p2p/reqresp/utils.ts +51 -12
- package/src/e2e_p2p/shared.ts +92 -64
- package/src/e2e_token_contract/token_contract_test.ts +28 -10
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +22 -19
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +86 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +179 -38
- package/src/fixtures/setup_p2p_test.ts +13 -9
- package/src/fixtures/token_utils.ts +1 -2
- package/src/fixtures/utils.ts +2 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +0 -2
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/shared/cross_chain_test_harness.ts +27 -13
- package/src/shared/gas_portal_test_harness.ts +21 -11
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/submit-transactions.ts +1 -4
- package/src/shared/uniswap_l1_l2.ts +77 -50
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +32 -14
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +91 -37
- package/src/spartan/tx_metrics.ts +82 -24
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +6 -0
- package/src/spartan/utils/nodes.ts +17 -12
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +174 -104
- package/src/test-wallet/utils.ts +3 -7
- package/src/test-wallet/wallet_worker_script.ts +48 -31
- package/src/test-wallet/worker_wallet.ts +60 -7
- package/src/test-wallet/worker_wallet_schema.ts +2 -2
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
4
5
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
5
6
|
import {
|
|
6
7
|
BatchCall,
|
|
7
8
|
type ContractFunctionInteraction,
|
|
8
9
|
type ContractMethod,
|
|
10
|
+
type DeployOptions,
|
|
11
|
+
type InteractionWaitOptions,
|
|
9
12
|
getContractClassFromArtifact,
|
|
10
13
|
waitForProven,
|
|
11
14
|
} from '@aztec/aztec.js/contracts';
|
|
@@ -14,7 +17,7 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
14
17
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
15
18
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
16
19
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
17
|
-
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
20
|
+
import { AnvilTestWatcher, type AnvilTestWatcherOpts, CheatCodes } from '@aztec/aztec/testing';
|
|
18
21
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
19
22
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
20
23
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,6 +33,7 @@ import {
|
|
|
30
33
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
31
34
|
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
32
35
|
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
36
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
33
37
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
34
38
|
import { SecretValue } from '@aztec/foundation/config';
|
|
35
39
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -44,13 +48,16 @@ import type { P2PClientDeps } from '@aztec/p2p';
|
|
|
44
48
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
45
49
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
46
50
|
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
47
|
-
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
51
|
+
import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
|
|
48
52
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
53
|
+
import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
54
|
+
import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
|
|
55
|
+
import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
|
|
49
56
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
50
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
57
|
+
import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
51
58
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
52
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
53
59
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
60
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
54
61
|
import {
|
|
55
62
|
type TelemetryClient,
|
|
56
63
|
type TelemetryClientConfig,
|
|
@@ -61,7 +68,6 @@ import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
|
61
68
|
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
62
69
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
63
70
|
|
|
64
|
-
import type { Anvil } from '@viem/anvil';
|
|
65
71
|
import fs from 'fs/promises';
|
|
66
72
|
import { tmpdir } from 'os';
|
|
67
73
|
import path from 'path';
|
|
@@ -178,14 +184,22 @@ export type SetupOptions = {
|
|
|
178
184
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
179
185
|
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
180
186
|
mockGossipSubNetwork?: boolean;
|
|
187
|
+
/** Whether to add simulated latency to the mock gossipsub network (in ms) */
|
|
188
|
+
mockGossipSubNetworkLatency?: number;
|
|
181
189
|
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
182
190
|
disableAnvilTestWatcher?: boolean;
|
|
191
|
+
anvilTestWatcherOpts?: AnvilTestWatcherOpts;
|
|
183
192
|
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
184
193
|
automineL1Setup?: boolean;
|
|
185
194
|
/** How many accounts to seed and unlock in anvil. */
|
|
186
195
|
anvilAccounts?: number;
|
|
187
196
|
/** Port to start anvil (defaults to 8545) */
|
|
188
197
|
anvilPort?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
200
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
201
|
+
*/
|
|
202
|
+
anvilSlotsInAnEpoch?: number;
|
|
189
203
|
/** Key to use for publishing L1 contracts */
|
|
190
204
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
191
205
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -196,8 +210,16 @@ export type SetupOptions = {
|
|
|
196
210
|
skipAccountDeployment?: boolean;
|
|
197
211
|
/** L1 contracts deployment arguments. */
|
|
198
212
|
l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
|
|
199
|
-
/** Wallet minimum fee padding multiplier
|
|
213
|
+
/** Wallet minimum fee padding multiplier */
|
|
200
214
|
walletMinFeePadding?: number;
|
|
215
|
+
/** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
|
|
216
|
+
* Use for tests that create their own validator nodes and don't need the initial sequencer. */
|
|
217
|
+
skipInitialSequencer?: boolean;
|
|
218
|
+
/** Whether to swap the production Sequencer for the minimal AutomineSequencer.
|
|
219
|
+
* Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
|
|
220
|
+
useAutomineSequencer?: boolean;
|
|
221
|
+
/** Options forwarded to PXE creation (e.g. execution hooks). */
|
|
222
|
+
pxeCreationOptions?: PXECreationOptions;
|
|
201
223
|
} & Partial<AztecNodeConfig>;
|
|
202
224
|
|
|
203
225
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -205,7 +227,7 @@ export type EndToEndContext = {
|
|
|
205
227
|
/** The Anvil instance (only set if anvil was started locally). */
|
|
206
228
|
anvil: Anvil | undefined;
|
|
207
229
|
/** The Aztec Node service or client a connected to it. */
|
|
208
|
-
aztecNode: AztecNode;
|
|
230
|
+
aztecNode: AztecNode & AztecNodeDebug;
|
|
209
231
|
/** The Aztec Node as a service. */
|
|
210
232
|
aztecNodeService: AztecNodeService;
|
|
211
233
|
/** Client to the Aztec Node admin interface. */
|
|
@@ -244,8 +266,8 @@ export type EndToEndContext = {
|
|
|
244
266
|
sequencerDelayer: Delayer | undefined;
|
|
245
267
|
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
246
268
|
proverDelayer: Delayer | undefined;
|
|
247
|
-
/**
|
|
248
|
-
|
|
269
|
+
/** Genesis data used for setting up nodes. */
|
|
270
|
+
genesis: GenesisData | undefined;
|
|
249
271
|
/** ACVM config (only set if running locally). */
|
|
250
272
|
acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
|
|
251
273
|
/** BB config (only set if running locally). */
|
|
@@ -256,6 +278,32 @@ export type EndToEndContext = {
|
|
|
256
278
|
teardown: () => Promise<void>;
|
|
257
279
|
};
|
|
258
280
|
|
|
281
|
+
/**
|
|
282
|
+
* When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
|
|
283
|
+
* aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
|
|
284
|
+
* actually swapped in the correct version.
|
|
285
|
+
*/
|
|
286
|
+
function assertContractArtifactsVersion() {
|
|
287
|
+
const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
288
|
+
if (!expected) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const { aztecVersion } = SponsoredFPCContract.artifact;
|
|
292
|
+
// TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
|
|
293
|
+
if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
|
|
294
|
+
createLogger('e2e:setup').info(
|
|
295
|
+
`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
|
|
296
|
+
);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (aztecVersion !== expected) {
|
|
300
|
+
throw new Error(
|
|
301
|
+
`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
|
|
302
|
+
`The legacy artifact resolver may not have swapped in the correct version.`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
259
307
|
/**
|
|
260
308
|
* Sets up the environment for the end-to-end tests.
|
|
261
309
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
@@ -268,10 +316,11 @@ export async function setup(
|
|
|
268
316
|
pxeOpts: Partial<PXEConfig> = {},
|
|
269
317
|
chain: Chain = foundry,
|
|
270
318
|
): Promise<EndToEndContext> {
|
|
319
|
+
assertContractArtifactsVersion();
|
|
271
320
|
let anvil: Anvil | undefined;
|
|
272
321
|
try {
|
|
273
322
|
opts.aztecTargetCommitteeSize ??= 0;
|
|
274
|
-
opts.
|
|
323
|
+
opts.slasherEnabled ??= false;
|
|
275
324
|
|
|
276
325
|
const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
|
|
277
326
|
// use initialValidators for the node config
|
|
@@ -298,6 +347,8 @@ export async function setup(
|
|
|
298
347
|
config.dataDirectory = directoryToCleanup;
|
|
299
348
|
}
|
|
300
349
|
|
|
350
|
+
const dateProvider = new TestDateProvider();
|
|
351
|
+
|
|
301
352
|
if (!config.l1RpcUrls?.length) {
|
|
302
353
|
if (!isAnvilTestChain(chain.id)) {
|
|
303
354
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
@@ -306,6 +357,8 @@ export async function setup(
|
|
|
306
357
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
307
358
|
accounts: opts.anvilAccounts,
|
|
308
359
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
360
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
361
|
+
dateProvider,
|
|
309
362
|
});
|
|
310
363
|
anvil = res.anvil;
|
|
311
364
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -317,8 +370,6 @@ export async function setup(
|
|
|
317
370
|
logger.info(`Logging metrics to ${filename}`);
|
|
318
371
|
setupMetricsLogger(filename);
|
|
319
372
|
}
|
|
320
|
-
|
|
321
|
-
const dateProvider = new TestDateProvider();
|
|
322
373
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
323
374
|
|
|
324
375
|
if (opts.stateLoad) {
|
|
@@ -368,10 +419,12 @@ export async function setup(
|
|
|
368
419
|
addressesToFund.push(sponsoredFPCAddress);
|
|
369
420
|
}
|
|
370
421
|
|
|
371
|
-
const
|
|
422
|
+
const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
|
|
423
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
372
424
|
addressesToFund,
|
|
373
425
|
opts.initialAccountFeeJuice,
|
|
374
426
|
opts.genesisPublicData,
|
|
427
|
+
genesisTimestamp,
|
|
375
428
|
);
|
|
376
429
|
|
|
377
430
|
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
@@ -406,19 +459,38 @@ export async function setup(
|
|
|
406
459
|
},
|
|
407
460
|
);
|
|
408
461
|
|
|
409
|
-
config
|
|
462
|
+
Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
|
|
410
463
|
config.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
411
464
|
|
|
465
|
+
// Propagate L1-contracts-config overrides back to the node config so the archiver's
|
|
466
|
+
// `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
|
|
467
|
+
// Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
|
|
468
|
+
// but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
|
|
469
|
+
// `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
|
|
470
|
+
// `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
|
|
471
|
+
// Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
|
|
472
|
+
// by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
|
|
473
|
+
// as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
|
|
474
|
+
// in this function and crash `setupSharedBlobStorage`.
|
|
475
|
+
if (opts.l1ContractsArgs) {
|
|
476
|
+
for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
|
|
477
|
+
if (value !== undefined) {
|
|
478
|
+
(config as unknown as Record<string, unknown>)[key] = value;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
412
483
|
if (enableAutomine) {
|
|
413
484
|
await ethCheatCodes.setAutomine(false);
|
|
414
485
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
415
486
|
}
|
|
416
487
|
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
|
|
421
|
-
|
|
488
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
489
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
490
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
491
|
+
if (!anvil) {
|
|
492
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
493
|
+
}
|
|
422
494
|
|
|
423
495
|
if (opts.l2StartTime) {
|
|
424
496
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
@@ -429,6 +501,7 @@ export async function setup(
|
|
|
429
501
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
430
502
|
deployL1ContractsValues.l1Client,
|
|
431
503
|
dateProvider,
|
|
504
|
+
opts.anvilTestWatcherOpts,
|
|
432
505
|
);
|
|
433
506
|
if (!opts.disableAnvilTestWatcher) {
|
|
434
507
|
await watcher.start();
|
|
@@ -456,10 +529,10 @@ export async function setup(
|
|
|
456
529
|
}
|
|
457
530
|
|
|
458
531
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
459
|
-
let p2pClientDeps: P2PClientDeps
|
|
532
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
460
533
|
|
|
461
534
|
if (opts.mockGossipSubNetwork) {
|
|
462
|
-
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
535
|
+
mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
|
|
463
536
|
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
464
537
|
}
|
|
465
538
|
|
|
@@ -476,7 +549,11 @@ export async function setup(
|
|
|
476
549
|
const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
|
|
477
550
|
// Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
|
|
478
551
|
const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
|
|
479
|
-
|
|
552
|
+
// Under proposer pipelining the sequencer builds during slot N-1 for slot N. A tx submitted at
|
|
553
|
+
// slot N start is too late -- it arrives after the build. Forcing minTxsPerBlock=1 then stalls
|
|
554
|
+
// the chain on alternating slots, so allow empty checkpoints under pipelining.
|
|
555
|
+
const accountsDeployMinTxs = config.enableProposerPipelining ? 0 : 1;
|
|
556
|
+
config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
|
|
480
557
|
|
|
481
558
|
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
482
559
|
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
@@ -487,11 +564,22 @@ export async function setup(
|
|
|
487
564
|
}
|
|
488
565
|
}
|
|
489
566
|
|
|
567
|
+
// When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
|
|
568
|
+
// We apply these overrides to a copy so they don't leak into the returned config.
|
|
569
|
+
// Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
|
|
570
|
+
const initialNodeConfig = opts.skipInitialSequencer
|
|
571
|
+
? {
|
|
572
|
+
...config,
|
|
573
|
+
disableValidator: true,
|
|
574
|
+
...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
|
|
575
|
+
}
|
|
576
|
+
: config;
|
|
577
|
+
|
|
490
578
|
const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
|
|
491
579
|
AztecNodeService.createAndSync(
|
|
492
|
-
|
|
580
|
+
initialNodeConfig,
|
|
493
581
|
{ dateProvider, telemetry: telemetryClient, p2pClientDeps },
|
|
494
|
-
{
|
|
582
|
+
{ genesis, dontStartSequencer: opts.skipInitialSequencer },
|
|
495
583
|
),
|
|
496
584
|
);
|
|
497
585
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
@@ -503,7 +591,7 @@ export async function setup(
|
|
|
503
591
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
504
592
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
505
593
|
|
|
506
|
-
const p2pClientDeps: Partial<P2PClientDeps
|
|
594
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
507
595
|
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
508
596
|
rpcTxProviders: [aztecNodeService],
|
|
509
597
|
};
|
|
@@ -516,7 +604,7 @@ export async function setup(
|
|
|
516
604
|
dataDirectory: proverNodeDataDirectory,
|
|
517
605
|
},
|
|
518
606
|
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
519
|
-
{
|
|
607
|
+
{ genesis },
|
|
520
608
|
));
|
|
521
609
|
}
|
|
522
610
|
|
|
@@ -528,13 +616,21 @@ export async function setup(
|
|
|
528
616
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
529
617
|
// For tests we only want proving enabled if specifically requested
|
|
530
618
|
pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
|
|
531
|
-
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
619
|
+
const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
|
|
620
|
+
loggerActorLabel: 'pxe-0',
|
|
621
|
+
...opts.pxeCreationOptions,
|
|
622
|
+
});
|
|
532
623
|
|
|
533
624
|
if (opts.walletMinFeePadding !== undefined) {
|
|
534
625
|
wallet.setMinFeePadding(opts.walletMinFeePadding);
|
|
535
626
|
}
|
|
536
627
|
|
|
537
|
-
const cheatCodes = await CheatCodes.create(
|
|
628
|
+
const cheatCodes = await CheatCodes.create(
|
|
629
|
+
config.l1RpcUrls,
|
|
630
|
+
aztecNodeService,
|
|
631
|
+
dateProvider,
|
|
632
|
+
aztecNodeService.getAutomineSequencer(),
|
|
633
|
+
);
|
|
538
634
|
|
|
539
635
|
if (
|
|
540
636
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -552,7 +648,9 @@ export async function setup(
|
|
|
552
648
|
|
|
553
649
|
let accounts: AztecAddress[] = [];
|
|
554
650
|
|
|
555
|
-
if (
|
|
651
|
+
if (opts.skipInitialSequencer) {
|
|
652
|
+
logger.info('Sequencer not started on initial node, skipping block progression');
|
|
653
|
+
} else if (shouldDeployAccounts) {
|
|
556
654
|
logger.info(
|
|
557
655
|
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
|
|
558
656
|
);
|
|
@@ -561,6 +659,11 @@ export async function setup(
|
|
|
561
659
|
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
562
660
|
} else if (needsEmptyBlock) {
|
|
563
661
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
662
|
+
// AutomineSequencer only builds on tx arrival; explicitly request an empty block.
|
|
663
|
+
const automine = aztecNodeService.getAutomineSequencer();
|
|
664
|
+
if (automine) {
|
|
665
|
+
await automine.buildEmptyBlock();
|
|
666
|
+
}
|
|
564
667
|
while ((await aztecNodeService.getBlockNumber()) === 0) {
|
|
565
668
|
await sleep(2000);
|
|
566
669
|
}
|
|
@@ -621,7 +724,7 @@ export async function setup(
|
|
|
621
724
|
initialFundedAccounts,
|
|
622
725
|
logger,
|
|
623
726
|
mockGossipSubNetwork,
|
|
624
|
-
|
|
727
|
+
genesis,
|
|
625
728
|
proverNode,
|
|
626
729
|
sequencerDelayer,
|
|
627
730
|
proverDelayer,
|
|
@@ -701,7 +804,7 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
701
804
|
targetBlock ??= await node.getBlockNumber();
|
|
702
805
|
|
|
703
806
|
await retryUntil(
|
|
704
|
-
async () => (await node.
|
|
807
|
+
async () => (await node.getBlockNumber('proven')) >= targetBlock,
|
|
705
808
|
'proven chain status',
|
|
706
809
|
timeoutSec,
|
|
707
810
|
intervalSec,
|
|
@@ -719,9 +822,9 @@ export function createAndSyncProverNode(
|
|
|
719
822
|
deps: {
|
|
720
823
|
telemetry?: TelemetryClient;
|
|
721
824
|
dateProvider: DateProvider;
|
|
722
|
-
p2pClientDeps?: P2PClientDeps
|
|
825
|
+
p2pClientDeps?: P2PClientDeps;
|
|
723
826
|
},
|
|
724
|
-
options: {
|
|
827
|
+
options: { genesis?: GenesisData; dontStart?: boolean },
|
|
725
828
|
): Promise<{ proverNode: AztecNodeService }> {
|
|
726
829
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
727
830
|
const proverNode = await AztecNodeService.createAndSync(
|
|
@@ -734,7 +837,7 @@ export function createAndSyncProverNode(
|
|
|
734
837
|
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
735
838
|
},
|
|
736
839
|
deps,
|
|
737
|
-
{
|
|
840
|
+
{ genesis: options.genesis, dontStartProverNode: options.dontStart },
|
|
738
841
|
);
|
|
739
842
|
|
|
740
843
|
if (!proverNode.getProverNode()) {
|
|
@@ -754,7 +857,9 @@ export function getBalancesFn(
|
|
|
754
857
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
755
858
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
756
859
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
757
|
-
const b = await Promise.all(
|
|
860
|
+
const b = await Promise.all(
|
|
861
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
862
|
+
);
|
|
758
863
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
759
864
|
logger.verbose(debugString);
|
|
760
865
|
return b;
|
|
@@ -789,6 +894,41 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
789
894
|
expect(diffs).toEqual(expectedDiffs);
|
|
790
895
|
}
|
|
791
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Registers the auth_registry contract class and publishes its standard instance if not already
|
|
899
|
+
* present, and registers the artifact with PXE. Publishing is required before exercising the public
|
|
900
|
+
* authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
|
|
901
|
+
* required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
|
|
902
|
+
* surface as generic "Assertion failed:" and tests that match on the real message fail).
|
|
903
|
+
*/
|
|
904
|
+
export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
|
|
905
|
+
const { instance, contractClass } = await getStandardAuthRegistry();
|
|
906
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
907
|
+
await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
|
|
908
|
+
}
|
|
909
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
910
|
+
await publishInstance(wallet, instance).send({ from });
|
|
911
|
+
}
|
|
912
|
+
await wallet.registerContract(instance, AuthRegistryArtifact);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Registers the public_checks contract class and publishes its standard instance if not already
|
|
917
|
+
* present, and registers the artifact with PXE. Required for any contract that calls
|
|
918
|
+
* `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
|
|
919
|
+
* deployed PublicChecks contract via an enqueued public call).
|
|
920
|
+
*/
|
|
921
|
+
export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
|
|
922
|
+
const { instance, contractClass } = await getStandardPublicChecks();
|
|
923
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
924
|
+
await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
|
|
925
|
+
}
|
|
926
|
+
if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
|
|
927
|
+
await publishInstance(wallet, instance).send({ from });
|
|
928
|
+
}
|
|
929
|
+
await wallet.registerContract(instance, PublicChecksArtifact);
|
|
930
|
+
}
|
|
931
|
+
|
|
792
932
|
/**
|
|
793
933
|
* Registers the contract class used for test accounts and publicly deploys the instances requested.
|
|
794
934
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
@@ -823,7 +963,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
823
963
|
* Returns deployed account data that can be used by tests.
|
|
824
964
|
*/
|
|
825
965
|
export const deployAccounts =
|
|
826
|
-
(numberOfAccounts: number, logger: Logger) =>
|
|
966
|
+
(numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<InteractionWaitOptions>>) =>
|
|
827
967
|
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
828
968
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
829
969
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
@@ -840,8 +980,9 @@ export const deployAccounts =
|
|
|
840
980
|
);
|
|
841
981
|
const deployMethod = await accountManager.getDeployMethod();
|
|
842
982
|
await deployMethod.send({
|
|
843
|
-
from:
|
|
983
|
+
from: NO_FROM,
|
|
844
984
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
985
|
+
...deployOptions,
|
|
845
986
|
});
|
|
846
987
|
}
|
|
847
988
|
|
|
@@ -872,7 +1013,7 @@ export async function publicDeployAccounts(
|
|
|
872
1013
|
|
|
873
1014
|
const batch = new BatchCall(wallet, calls);
|
|
874
1015
|
|
|
875
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
1016
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
876
1017
|
if (waitUntilProven) {
|
|
877
1018
|
if (!node) {
|
|
878
1019
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -7,7 +7,7 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
7
7
|
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
8
8
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
9
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
-
import type {
|
|
10
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
11
11
|
|
|
12
12
|
import getPort from 'get-port';
|
|
13
13
|
|
|
@@ -40,7 +40,7 @@ export async function createNodes(
|
|
|
40
40
|
bootstrapNodeEnr: string,
|
|
41
41
|
numNodes: number,
|
|
42
42
|
bootNodePort: number,
|
|
43
|
-
|
|
43
|
+
genesis?: GenesisData,
|
|
44
44
|
dataDirectory?: string,
|
|
45
45
|
metricsPort?: number,
|
|
46
46
|
indexOffset = 0,
|
|
@@ -65,7 +65,7 @@ export async function createNodes(
|
|
|
65
65
|
port,
|
|
66
66
|
bootstrapNodeEnr,
|
|
67
67
|
validatorIndices,
|
|
68
|
-
|
|
68
|
+
genesis,
|
|
69
69
|
dataDir,
|
|
70
70
|
metricsPort,
|
|
71
71
|
);
|
|
@@ -88,6 +88,10 @@ export type CreateNodeConfig = AztecNodeConfig & {
|
|
|
88
88
|
dontStartSequencer?: boolean;
|
|
89
89
|
/** Override the private key (instead of deriving from addressIndex). */
|
|
90
90
|
validatorPrivateKey?: `0x${string}`;
|
|
91
|
+
/** Corrupt only the block proposal at this indexWithinCheckpoint (testing only). */
|
|
92
|
+
invalidBlockProposalIndexWithinCheckpoint?: number;
|
|
93
|
+
/** Accept proposal gossip regardless of slot timing (testing only). */
|
|
94
|
+
skipProposalSlotValidation?: boolean;
|
|
91
95
|
};
|
|
92
96
|
|
|
93
97
|
/** Creates a P2P enabled instance of Aztec Node Service with a validator. */
|
|
@@ -97,7 +101,7 @@ export async function createNode(
|
|
|
97
101
|
tcpPort: number,
|
|
98
102
|
bootstrapNode: string | undefined,
|
|
99
103
|
addressIndex: number | number[],
|
|
100
|
-
|
|
104
|
+
genesis?: GenesisData,
|
|
101
105
|
dataDirectory?: string,
|
|
102
106
|
metricsPort?: number,
|
|
103
107
|
) {
|
|
@@ -108,7 +112,7 @@ export async function createNode(
|
|
|
108
112
|
return await AztecNodeService.createAndSync(
|
|
109
113
|
validatorConfig,
|
|
110
114
|
{ telemetry, dateProvider },
|
|
111
|
-
{
|
|
115
|
+
{ genesis, dontStartSequencer: config.dontStartSequencer },
|
|
112
116
|
);
|
|
113
117
|
});
|
|
114
118
|
}
|
|
@@ -119,7 +123,7 @@ export async function createNonValidatorNode(
|
|
|
119
123
|
dateProvider: DateProvider,
|
|
120
124
|
tcpPort: number,
|
|
121
125
|
bootstrapNode: string | undefined,
|
|
122
|
-
|
|
126
|
+
genesis?: GenesisData,
|
|
123
127
|
dataDirectory?: string,
|
|
124
128
|
metricsPort?: number,
|
|
125
129
|
) {
|
|
@@ -133,7 +137,7 @@ export async function createNonValidatorNode(
|
|
|
133
137
|
sequencerPublisherPrivateKeys: [],
|
|
134
138
|
};
|
|
135
139
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
136
|
-
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, {
|
|
140
|
+
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { genesis });
|
|
137
141
|
});
|
|
138
142
|
}
|
|
139
143
|
|
|
@@ -143,7 +147,7 @@ export async function createProverNode(
|
|
|
143
147
|
bootstrapNode: string | undefined,
|
|
144
148
|
addressIndex: number,
|
|
145
149
|
deps: { dateProvider: DateProvider },
|
|
146
|
-
|
|
150
|
+
genesis?: GenesisData,
|
|
147
151
|
dataDirectory?: string,
|
|
148
152
|
metricsPort?: number,
|
|
149
153
|
): Promise<{ proverNode: AztecNodeService }> {
|
|
@@ -159,7 +163,7 @@ export async function createProverNode(
|
|
|
159
163
|
{ ...config, ...p2pConfig },
|
|
160
164
|
{ dataDirectory },
|
|
161
165
|
{ ...deps, telemetry },
|
|
162
|
-
{
|
|
166
|
+
{ genesis },
|
|
163
167
|
);
|
|
164
168
|
});
|
|
165
169
|
}
|
|
@@ -8,7 +8,6 @@ export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAd
|
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
9
|
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
10
|
from: admin,
|
|
11
|
-
wait: { returnReceipt: true },
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
if (initialAdminBalance > 0n) {
|
|
@@ -39,7 +38,7 @@ export async function expectTokenBalance(
|
|
|
39
38
|
) {
|
|
40
39
|
// Then check the balance
|
|
41
40
|
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
42
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
41
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
43
42
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
44
43
|
expect(balance).toBe(expectedBalance);
|
|
45
44
|
}
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a JSON-RPC client that connects to a remote wallet service.
|
|
7
|
+
* The returned object implements the {@link Wallet} interface, proxying all calls over HTTP to the specified URL.
|
|
8
|
+
*/
|
|
9
|
+
export function createWalletClient(url: string): Wallet {
|
|
10
|
+
return createSafeJsonRpcClient<Wallet>(url, WalletSchema, {
|
|
11
|
+
namespaceMethods: 'wallet',
|
|
12
|
+
fetch: makeFetch([1, 2, 3], false),
|
|
13
|
+
});
|
|
14
|
+
}
|