@aztec/end-to-end 0.0.1-commit.3d8f95d → 0.0.1-commit.3f296a7d2
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 +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +21 -13
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- 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 +22 -12
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +11 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +58 -36
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +18 -11
- 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 -6
- package/dest/e2e_p2p/p2p_network.d.ts +5 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +24 -7
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +45 -8
- package/dest/e2e_p2p/shared.d.ts +22 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +35 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +19 -9
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +7 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +36 -45
- 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 +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -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 +1 -1
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +3 -1
- package/dest/fixtures/setup.d.ts +32 -11
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +67 -88
- package/dest/fixtures/setup_p2p_test.d.ts +6 -3
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +12 -9
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -4
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- 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 +14 -17
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- 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 +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +59 -16
- package/dest/spartan/tx_metrics.js +1 -1
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +7 -1
- 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 +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -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 +9 -9
- 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 +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +213 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +42 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +39 -34
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +27 -14
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +76 -64
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +14 -22
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/p2p_network.ts +32 -6
- package/src/e2e_p2p/reqresp/utils.ts +57 -8
- package/src/e2e_p2p/shared.ts +57 -3
- package/src/e2e_token_contract/token_contract_test.ts +25 -8
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +42 -52
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +3 -1
- package/src/fixtures/setup.ts +90 -116
- package/src/fixtures/setup_p2p_test.ts +9 -17
- package/src/fixtures/token_utils.ts +6 -3
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +3 -2
- package/src/shared/uniswap_l1_l2.ts +36 -29
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +104 -18
- package/src/spartan/tx_metrics.ts +1 -1
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +301 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
|
-
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
4
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
5
5
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
6
|
import {
|
|
7
7
|
BatchCall,
|
|
@@ -16,7 +16,6 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
16
16
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
17
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
18
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
20
19
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
21
20
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
22
21
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,13 +29,9 @@ import {
|
|
|
30
29
|
type ZKPassportArgs,
|
|
31
30
|
deployAztecL1Contracts,
|
|
32
31
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
EthCheatCodesWithState,
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
32
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
33
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
34
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
40
35
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
36
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
37
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -45,20 +40,17 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
|
45
40
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
41
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
42
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
43
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
44
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
45
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
46
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
47
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
48
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
55
49
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
56
50
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
58
51
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
52
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
60
53
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
61
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
62
54
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
63
55
|
import {
|
|
64
56
|
type TelemetryClient,
|
|
@@ -67,10 +59,9 @@ import {
|
|
|
67
59
|
initTelemetryClient,
|
|
68
60
|
} from '@aztec/telemetry-client';
|
|
69
61
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
70
|
-
import {
|
|
62
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
71
63
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
64
|
|
|
73
|
-
import type { Anvil } from '@viem/anvil';
|
|
74
65
|
import fs from 'fs/promises';
|
|
75
66
|
import { tmpdir } from 'os';
|
|
76
67
|
import path from 'path';
|
|
@@ -84,6 +75,7 @@ import {
|
|
|
84
75
|
} from 'viem/accounts';
|
|
85
76
|
import { type Chain, foundry } from 'viem/chains';
|
|
86
77
|
|
|
78
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
87
79
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
88
80
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
89
81
|
import { getBBConfig } from './get_bb_config.js';
|
|
@@ -194,6 +186,11 @@ export type SetupOptions = {
|
|
|
194
186
|
anvilAccounts?: number;
|
|
195
187
|
/** Port to start anvil (defaults to 8545) */
|
|
196
188
|
anvilPort?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
191
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
192
|
+
*/
|
|
193
|
+
anvilSlotsInAnEpoch?: number;
|
|
197
194
|
/** Key to use for publishing L1 contracts */
|
|
198
195
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
199
196
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -218,8 +215,8 @@ export type EndToEndContext = {
|
|
|
218
215
|
aztecNodeService: AztecNodeService;
|
|
219
216
|
/** Client to the Aztec Node admin interface. */
|
|
220
217
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
221
|
-
/** The prover node
|
|
222
|
-
proverNode:
|
|
218
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
219
|
+
proverNode: AztecNodeService | undefined;
|
|
223
220
|
/** A client to the sequencer service. */
|
|
224
221
|
sequencer: SequencerClient | undefined;
|
|
225
222
|
/** Return values from deployAztecL1Contracts function. */
|
|
@@ -248,6 +245,10 @@ export type EndToEndContext = {
|
|
|
248
245
|
telemetryClient: TelemetryClient;
|
|
249
246
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
250
247
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
248
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
249
|
+
sequencerDelayer: Delayer | undefined;
|
|
250
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
251
|
+
proverDelayer: Delayer | undefined;
|
|
251
252
|
/** Prefilled public data used for setting up nodes. */
|
|
252
253
|
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
253
254
|
/** ACVM config (only set if running locally). */
|
|
@@ -287,8 +288,12 @@ export async function setup(
|
|
|
287
288
|
config.realProofs = !!opts.realProofs;
|
|
288
289
|
// Only enforce the time table if requested
|
|
289
290
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
291
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
292
|
+
config.enableDelayer = true;
|
|
290
293
|
config.listenAddress = '127.0.0.1';
|
|
291
294
|
|
|
295
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
296
|
+
|
|
292
297
|
const logger = getLogger();
|
|
293
298
|
|
|
294
299
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -298,6 +303,8 @@ export async function setup(
|
|
|
298
303
|
config.dataDirectory = directoryToCleanup;
|
|
299
304
|
}
|
|
300
305
|
|
|
306
|
+
const dateProvider = new TestDateProvider();
|
|
307
|
+
|
|
301
308
|
if (!config.l1RpcUrls?.length) {
|
|
302
309
|
if (!isAnvilTestChain(chain.id)) {
|
|
303
310
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
@@ -306,6 +313,8 @@ export async function setup(
|
|
|
306
313
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
307
314
|
accounts: opts.anvilAccounts,
|
|
308
315
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
316
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
317
|
+
dateProvider,
|
|
309
318
|
});
|
|
310
319
|
anvil = res.anvil;
|
|
311
320
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -317,8 +326,6 @@ export async function setup(
|
|
|
317
326
|
logger.info(`Logging metrics to ${filename}`);
|
|
318
327
|
setupMetricsLogger(filename);
|
|
319
328
|
}
|
|
320
|
-
|
|
321
|
-
const dateProvider = new TestDateProvider();
|
|
322
329
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
323
330
|
|
|
324
331
|
if (opts.stateLoad) {
|
|
@@ -336,11 +343,11 @@ export async function setup(
|
|
|
336
343
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
337
344
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
338
345
|
} else if (
|
|
339
|
-
config.
|
|
340
|
-
config.
|
|
341
|
-
config.
|
|
346
|
+
config.sequencerPublisherPrivateKeys &&
|
|
347
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
348
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
342
349
|
) {
|
|
343
|
-
publisherPrivKeyHex = config.
|
|
350
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
344
351
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
345
352
|
} else if (!MNEMONIC) {
|
|
346
353
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -349,7 +356,7 @@ export async function setup(
|
|
|
349
356
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
350
357
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
351
358
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
352
|
-
config.
|
|
359
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
353
360
|
}
|
|
354
361
|
|
|
355
362
|
if (config.coinbase === undefined) {
|
|
@@ -412,7 +419,13 @@ export async function setup(
|
|
|
412
419
|
if (enableAutomine) {
|
|
413
420
|
await ethCheatCodes.setAutomine(false);
|
|
414
421
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
415
|
-
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
425
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
426
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
427
|
+
if (!anvil) {
|
|
428
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
416
429
|
}
|
|
417
430
|
|
|
418
431
|
if (opts.l2StartTime) {
|
|
@@ -451,7 +464,7 @@ export async function setup(
|
|
|
451
464
|
}
|
|
452
465
|
|
|
453
466
|
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
454
|
-
let p2pClientDeps: P2PClientDeps
|
|
467
|
+
let p2pClientDeps: P2PClientDeps | undefined = undefined;
|
|
455
468
|
|
|
456
469
|
if (opts.mockGossipSubNetwork) {
|
|
457
470
|
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
@@ -491,36 +504,33 @@ export async function setup(
|
|
|
491
504
|
);
|
|
492
505
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
493
506
|
|
|
494
|
-
|
|
495
|
-
const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
|
|
496
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
let proverNode: ProverNode | undefined = undefined;
|
|
507
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
500
508
|
if (opts.startProverNode) {
|
|
501
509
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
502
510
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
503
511
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
504
512
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
513
|
+
|
|
514
|
+
const p2pClientDeps: Partial<P2PClientDeps> = {
|
|
515
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
516
|
+
rpcTxProviders: [aztecNodeService],
|
|
509
517
|
};
|
|
510
|
-
|
|
518
|
+
|
|
519
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
511
520
|
proverNodePrivateKeyHex,
|
|
512
521
|
config,
|
|
513
|
-
proverNodeConfig,
|
|
514
|
-
aztecNodeService,
|
|
515
|
-
prefilledPublicData,
|
|
516
522
|
{
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
: undefined,
|
|
523
|
+
...config.proverNodeConfig,
|
|
524
|
+
dataDirectory: proverNodeDataDirectory,
|
|
520
525
|
},
|
|
521
|
-
|
|
526
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
527
|
+
{ prefilledPublicData },
|
|
528
|
+
));
|
|
522
529
|
}
|
|
523
530
|
|
|
531
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
532
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
533
|
+
|
|
524
534
|
logger.verbose('Creating a pxe...');
|
|
525
535
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
526
536
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
@@ -621,6 +631,8 @@ export async function setup(
|
|
|
621
631
|
mockGossipSubNetwork,
|
|
622
632
|
prefilledPublicData,
|
|
623
633
|
proverNode,
|
|
634
|
+
sequencerDelayer,
|
|
635
|
+
proverDelayer,
|
|
624
636
|
sequencer: sequencerClient,
|
|
625
637
|
teardown,
|
|
626
638
|
telemetryClient,
|
|
@@ -704,93 +716,55 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
704
716
|
);
|
|
705
717
|
}
|
|
706
718
|
|
|
719
|
+
/**
|
|
720
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
721
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
722
|
+
*/
|
|
707
723
|
export function createAndSyncProverNode(
|
|
708
724
|
proverNodePrivateKey: `0x${string}`,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
725
|
+
baseConfig: AztecNodeConfig,
|
|
726
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
727
|
+
deps: {
|
|
728
|
+
telemetry?: TelemetryClient;
|
|
729
|
+
dateProvider: DateProvider;
|
|
730
|
+
p2pClientDeps?: P2PClientDeps;
|
|
731
|
+
},
|
|
732
|
+
options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
|
|
733
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
715
734
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
{ blobClient, dateProvider: proverNodeDeps.dateProvider },
|
|
728
|
-
{ blockUntilSync: true },
|
|
729
|
-
);
|
|
730
|
-
|
|
731
|
-
const proverConfig: ProverNodeConfig = {
|
|
732
|
-
...aztecNodeConfig,
|
|
733
|
-
txCollectionNodeRpcUrls: [],
|
|
734
|
-
realProofs: false,
|
|
735
|
-
proverAgentCount: 2,
|
|
736
|
-
publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
737
|
-
proverNodeMaxPendingJobs: 10,
|
|
738
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
739
|
-
proverNodePollingIntervalMs: 200,
|
|
740
|
-
txGatheringIntervalMs: 1000,
|
|
741
|
-
txGatheringBatchSize: 10,
|
|
742
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
743
|
-
txGatheringTimeoutMs: 24_000,
|
|
744
|
-
proverNodeFailedEpochStore: undefined,
|
|
745
|
-
proverId: EthAddress.fromNumber(1),
|
|
746
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
747
|
-
...proverNodeConfig,
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
const l1TxUtils = createDelayedL1TxUtils(
|
|
751
|
-
aztecNodeConfig,
|
|
752
|
-
proverNodePrivateKey,
|
|
753
|
-
'prover-node',
|
|
754
|
-
proverNodeDeps.dateProvider,
|
|
735
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
736
|
+
{
|
|
737
|
+
...baseConfig,
|
|
738
|
+
...configOverrides,
|
|
739
|
+
p2pPort: 0,
|
|
740
|
+
enableProverNode: true,
|
|
741
|
+
disableValidator: true,
|
|
742
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
743
|
+
},
|
|
744
|
+
deps,
|
|
745
|
+
{ ...options, dontStartProverNode: options.dontStart },
|
|
755
746
|
);
|
|
756
747
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
{ ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
760
|
-
{ prefilledPublicData },
|
|
761
|
-
);
|
|
762
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
763
|
-
if (!proverNodeConfig.dontStart) {
|
|
764
|
-
await proverNode.start();
|
|
748
|
+
if (!proverNode.getProverNode()) {
|
|
749
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
765
750
|
}
|
|
766
|
-
return proverNode;
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
751
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
logName: string,
|
|
774
|
-
dateProvider?: DateProvider,
|
|
775
|
-
) {
|
|
776
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
777
|
-
|
|
778
|
-
const log = createLogger(logName);
|
|
779
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
780
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
781
|
-
return l1TxUtils;
|
|
752
|
+
getLogger().info(`Created and synced prover node`);
|
|
753
|
+
return { proverNode };
|
|
754
|
+
});
|
|
782
755
|
}
|
|
783
756
|
|
|
784
757
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
785
758
|
export function getBalancesFn(
|
|
786
759
|
symbol: string,
|
|
787
760
|
method: ContractMethod,
|
|
788
|
-
from: AztecAddress,
|
|
789
761
|
logger: any,
|
|
790
762
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
791
763
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
792
764
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
793
|
-
const b = await Promise.all(
|
|
765
|
+
const b = await Promise.all(
|
|
766
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
767
|
+
);
|
|
794
768
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
795
769
|
logger.verbose(debugString);
|
|
796
770
|
return b;
|
|
@@ -876,7 +850,7 @@ export const deployAccounts =
|
|
|
876
850
|
);
|
|
877
851
|
const deployMethod = await accountManager.getDeployMethod();
|
|
878
852
|
await deployMethod.send({
|
|
879
|
-
from:
|
|
853
|
+
from: NO_FROM,
|
|
880
854
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
881
855
|
});
|
|
882
856
|
}
|
|
@@ -908,7 +882,7 @@ export async function publicDeployAccounts(
|
|
|
908
882
|
|
|
909
883
|
const batch = new BatchCall(wallet, calls);
|
|
910
884
|
|
|
911
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
885
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
912
886
|
if (waitUntilProven) {
|
|
913
887
|
if (!node) {
|
|
914
888
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -7,7 +7,6 @@ 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 { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
11
10
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
12
11
|
|
|
13
12
|
import getPort from 'get-port';
|
|
@@ -131,7 +130,7 @@ export async function createNonValidatorNode(
|
|
|
131
130
|
...p2pConfig,
|
|
132
131
|
disableValidator: true,
|
|
133
132
|
validatorPrivateKeys: undefined,
|
|
134
|
-
|
|
133
|
+
sequencerPublisherPrivateKeys: [],
|
|
135
134
|
};
|
|
136
135
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
137
136
|
return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
|
|
@@ -143,31 +142,24 @@ export async function createProverNode(
|
|
|
143
142
|
tcpPort: number,
|
|
144
143
|
bootstrapNode: string | undefined,
|
|
145
144
|
addressIndex: number,
|
|
146
|
-
|
|
145
|
+
deps: { dateProvider: DateProvider },
|
|
147
146
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
148
147
|
dataDirectory?: string,
|
|
149
148
|
metricsPort?: number,
|
|
150
|
-
) {
|
|
149
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
151
150
|
const actorIndex = proverCounter++;
|
|
152
151
|
return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
|
|
153
152
|
const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
|
|
154
153
|
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
|
|
155
154
|
|
|
156
|
-
const
|
|
157
|
-
config,
|
|
158
|
-
bootstrapNode,
|
|
159
|
-
tcpPort,
|
|
160
|
-
dataDirectory,
|
|
161
|
-
);
|
|
155
|
+
const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
|
|
162
156
|
|
|
163
|
-
const aztecNodeRpcTxProvider = undefined;
|
|
164
157
|
return await createAndSyncProverNode(
|
|
165
158
|
bufferToHex(proverNodePrivateKey),
|
|
166
|
-
config,
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
prefilledPublicData,
|
|
170
|
-
{ ...proverNodeDeps, telemetry },
|
|
159
|
+
{ ...config, ...p2pConfig },
|
|
160
|
+
{ dataDirectory },
|
|
161
|
+
{ ...deps, telemetry },
|
|
162
|
+
{ prefilledPublicData: prefilledPublicData ?? [] },
|
|
171
163
|
);
|
|
172
164
|
});
|
|
173
165
|
}
|
|
@@ -215,7 +207,7 @@ export async function createValidatorConfig(
|
|
|
215
207
|
...config,
|
|
216
208
|
...p2pConfig,
|
|
217
209
|
validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
|
|
218
|
-
|
|
210
|
+
sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
|
|
219
211
|
};
|
|
220
212
|
|
|
221
213
|
return nodeConfig;
|
|
@@ -6,7 +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 {
|
|
9
|
+
const {
|
|
10
|
+
receipt: { contract, instance },
|
|
11
|
+
} = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
12
|
from: admin,
|
|
11
13
|
wait: { returnReceipt: true },
|
|
12
14
|
});
|
|
@@ -25,8 +27,9 @@ export async function mintTokensToPrivate(
|
|
|
25
27
|
minter: AztecAddress,
|
|
26
28
|
recipient: AztecAddress,
|
|
27
29
|
amount: bigint,
|
|
30
|
+
additionalScopes?: AztecAddress[],
|
|
28
31
|
) {
|
|
29
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter });
|
|
32
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export async function expectTokenBalance(
|
|
@@ -38,7 +41,7 @@ export async function expectTokenBalance(
|
|
|
38
41
|
) {
|
|
39
42
|
// Then check the balance
|
|
40
43
|
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
41
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
44
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
42
45
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
43
46
|
expect(balance).toBe(expectedBalance);
|
|
44
47
|
}
|
|
@@ -23,6 +23,8 @@ aztec-wallet create-account -a alice -f test0
|
|
|
23
23
|
aztec-wallet create-account -a bob -f test0
|
|
24
24
|
# docs:end:declare-accounts
|
|
25
25
|
|
|
26
|
+
aztec-wallet bridge-fee-juice 1000000000000000000000 accounts:alice --mint --no-wait
|
|
27
|
+
|
|
26
28
|
DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
|
|
27
29
|
TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
|
|
28
30
|
echo "Deployed contract at $TOKEN_ADDRESS"
|
|
@@ -38,9 +40,7 @@ fi
|
|
|
38
40
|
|
|
39
41
|
TRANSFER_AMOUNT=42
|
|
40
42
|
|
|
41
|
-
aztec-wallet
|
|
42
|
-
|
|
43
|
-
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
|
|
43
|
+
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 0 -f alice --payment method=fee_juice,claim
|
|
44
44
|
|
|
45
45
|
# Test end result
|
|
46
46
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
@@ -73,22 +73,26 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// deploy l2 token
|
|
76
|
-
const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
|
|
76
|
+
const { contract: token } = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
|
|
77
|
+
from: owner,
|
|
78
|
+
});
|
|
77
79
|
|
|
78
80
|
// deploy l2 token bridge and attach to the portal
|
|
79
|
-
const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
|
|
81
|
+
const { contract: bridge } = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
|
|
82
|
+
from: owner,
|
|
83
|
+
});
|
|
80
84
|
|
|
81
|
-
if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
|
|
85
|
+
if ((await token.methods.get_admin().simulate({ from: owner })).result !== owner.toBigInt()) {
|
|
82
86
|
throw new Error(`Token admin is not ${owner}`);
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
if (!(await bridge.methods.get_config().simulate({ from: owner })).token.equals(token.address)) {
|
|
89
|
+
if (!(await bridge.methods.get_config().simulate({ from: owner })).result.token.equals(token.address)) {
|
|
86
90
|
throw new Error(`Bridge token is not ${token.address}`);
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
// make the bridge a minter on the token:
|
|
90
94
|
await token.methods.set_minter(bridge.address, true).send({ from: owner });
|
|
91
|
-
if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
|
|
95
|
+
if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })).result === 1n) {
|
|
92
96
|
throw new Error(`Bridge is not a minter`);
|
|
93
97
|
}
|
|
94
98
|
|
|
@@ -269,7 +273,7 @@ export class CrossChainTestHarness {
|
|
|
269
273
|
authwitNonce: Fr = Fr.ZERO,
|
|
270
274
|
authWitness: AuthWitness,
|
|
271
275
|
): Promise<TxReceipt> {
|
|
272
|
-
const withdrawReceipt = await this.l2Bridge.methods
|
|
276
|
+
const { receipt: withdrawReceipt } = await this.l2Bridge.methods
|
|
273
277
|
.exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
274
278
|
.send({ authWitnesses: [authWitness], from: this.ownerAddress });
|
|
275
279
|
|
|
@@ -277,7 +281,7 @@ export class CrossChainTestHarness {
|
|
|
277
281
|
}
|
|
278
282
|
|
|
279
283
|
async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
|
|
280
|
-
const withdrawReceipt = await this.l2Bridge.methods
|
|
284
|
+
const { receipt: withdrawReceipt } = await this.l2Bridge.methods
|
|
281
285
|
.exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
282
286
|
.send({ from: this.ownerAddress });
|
|
283
287
|
|
|
@@ -285,7 +289,7 @@ export class CrossChainTestHarness {
|
|
|
285
289
|
}
|
|
286
290
|
|
|
287
291
|
async getL2PrivateBalanceOf(owner: AztecAddress) {
|
|
288
|
-
return await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner });
|
|
292
|
+
return (await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner })).result;
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
async expectPrivateBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
|
@@ -295,7 +299,7 @@ export class CrossChainTestHarness {
|
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
async getL2PublicBalanceOf(owner: AztecAddress) {
|
|
298
|
-
return await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress });
|
|
302
|
+
return (await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress })).result;
|
|
299
303
|
}
|
|
300
304
|
|
|
301
305
|
async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
|
@@ -131,7 +131,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
async getL2PublicBalanceOf(owner: AztecAddress) {
|
|
134
|
-
return await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner });
|
|
134
|
+
return (await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner })).result;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
package/src/shared/index.ts
CHANGED
package/src/shared/jest_setup.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
2
|
|
|
3
|
-
import { beforeEach, expect } from '@jest/globals';
|
|
3
|
+
import { afterAll, afterEach, beforeEach, expect } from '@jest/globals';
|
|
4
|
+
import { readlinkSync } from 'fs';
|
|
4
5
|
import { basename } from 'path';
|
|
5
6
|
|
|
7
|
+
import { EluMonitor } from '../fixtures/elu_monitor.js';
|
|
8
|
+
|
|
9
|
+
const eluMonitor = process.env.ELU_MONITOR_FILE
|
|
10
|
+
? new EluMonitor(process.env.ELU_MONITOR_FILE, Number(process.env.ELU_MONITOR_INTERVAL_MS) || undefined)
|
|
11
|
+
: undefined;
|
|
12
|
+
|
|
13
|
+
if (eluMonitor) {
|
|
14
|
+
process.on('exit', () => eluMonitor.stop());
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
beforeEach(() => {
|
|
7
18
|
const { testPath, currentTestName } = expect.getState();
|
|
8
19
|
if (!testPath || !currentTestName) {
|
|
@@ -10,4 +21,43 @@ beforeEach(() => {
|
|
|
10
21
|
}
|
|
11
22
|
const logger = createLogger(`e2e:${basename(testPath).replace('.test.ts', '')}`);
|
|
12
23
|
logger.info(`Running test: ${currentTestName}`);
|
|
24
|
+
eluMonitor?.startTest(currentTestName);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
eluMonitor?.stopTest();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Log leaked handles after all tests complete. This runs after test-level afterAll hooks,
|
|
32
|
+
// so any handles still alive at this point were not properly cleaned up during teardown.
|
|
33
|
+
// This diagnostic helps identify the source of exit hangs without masking them.
|
|
34
|
+
afterAll(() => {
|
|
35
|
+
const handles = (process as any)._getActiveHandles();
|
|
36
|
+
if (handles.length > 0) {
|
|
37
|
+
const details = handles.map((h: any) => {
|
|
38
|
+
const type = h?.constructor?.name ?? typeof h;
|
|
39
|
+
const fd = h?.fd ?? h?._handle?.fd ?? '?';
|
|
40
|
+
const destroyed = h?.destroyed ?? '?';
|
|
41
|
+
const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : '?';
|
|
42
|
+
const localAddr = h?.localAddress ?? '';
|
|
43
|
+
const remoteAddr = h?.remoteAddress ?? '';
|
|
44
|
+
const localPort = h?.localPort ?? '';
|
|
45
|
+
const remotePort = h?.remotePort ?? '';
|
|
46
|
+
const proto = Object.getPrototypeOf(h)?.constructor?.name ?? '?';
|
|
47
|
+
const keys = Object.keys(h).slice(0, 10).join(',');
|
|
48
|
+
let fdTarget = '';
|
|
49
|
+
if (typeof fd === 'number') {
|
|
50
|
+
try {
|
|
51
|
+
fdTarget = ` -> ${readlinkSync(`/proc/self/fd/${fd}`)}`;
|
|
52
|
+
} catch {
|
|
53
|
+
// ignore
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return ` ${type}(fd=${fd}, destroyed=${destroyed}, hasRef=${hasRef}${fdTarget}) proto=${proto} addr=${localAddr}:${localPort}->${remoteAddr}:${remotePort} keys=[${keys}]`;
|
|
57
|
+
});
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
`\n[jest_setup] WARNING: ${handles.length} handle(s) still active after teardown:\n${details.join('\n')}\n` +
|
|
60
|
+
`These may prevent Jest from exiting. Investigate and fix the leak.\n\n`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
13
63
|
});
|