@aztec/end-to-end 4.0.0-devnet.1-patch.1 → 4.0.0-devnet.2-patch.0
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 +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -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 +10 -0
- package/dest/e2e_epochs/epochs_test.d.ts +9 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +53 -34
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -5
- package/dest/e2e_p2p/p2p_network.js +2 -2
- 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 +32 -8
- package/dest/e2e_token_contract/token_contract_test.d.ts +3 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +10 -0
- 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 +3 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +27 -34
- 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/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 +26 -9
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +54 -80
- 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/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/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/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -23
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +28 -0
- 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/index.d.ts +2 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +1 -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/test-wallet/test_wallet.d.ts +4 -3
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +5 -4
- 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 +40 -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 +103 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +271 -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 +40 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +2 -6
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -0
- package/src/e2e_epochs/epochs_test.ts +66 -66
- package/src/e2e_fees/fees_test.ts +4 -19
- package/src/e2e_p2p/p2p_network.ts +2 -2
- package/src/e2e_p2p/reqresp/utils.ts +36 -8
- package/src/e2e_token_contract/token_contract_test.ts +9 -0
- 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 +25 -35
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/ha_setup.ts +3 -1
- package/src/fixtures/setup.ts +71 -108
- package/src/fixtures/setup_p2p_test.ts +9 -17
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/index.ts +1 -0
- package/src/shared/mock_state_view.ts +188 -0
- package/src/simulators/token_simulator.ts +1 -29
- package/src/spartan/setup_test_wallets.ts +40 -0
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/index.ts +1 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/test-wallet/test_wallet.ts +13 -3
- package/src/test-wallet/wallet_worker_script.ts +43 -0
- package/src/test-wallet/worker_wallet.ts +165 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
4
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
@@ -11,13 +11,11 @@ import {
|
|
|
11
11
|
TestCircuitVerifier,
|
|
12
12
|
} from '@aztec/bb-prover';
|
|
13
13
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
15
14
|
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
16
15
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
17
16
|
import { SecretValue } from '@aztec/foundation/config';
|
|
18
17
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
19
18
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
20
|
-
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
21
19
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
22
20
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
21
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -73,8 +71,8 @@ export class FullProverTest {
|
|
|
73
71
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
74
72
|
provenAsset!: TokenContract;
|
|
75
73
|
context!: EndToEndContext;
|
|
76
|
-
private
|
|
77
|
-
private
|
|
74
|
+
private proverAztecNode!: AztecNodeService;
|
|
75
|
+
private simulatedProverAztecNode!: AztecNodeService;
|
|
78
76
|
public l1Contracts!: DeployAztecL1ContractsReturnType;
|
|
79
77
|
public proverAddress!: EthAddress;
|
|
80
78
|
private minNumberOfTxsPerBlock: number;
|
|
@@ -146,7 +144,7 @@ export class FullProverTest {
|
|
|
146
144
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
147
145
|
this.context.watcher.setIsMarkingAsProven(false);
|
|
148
146
|
|
|
149
|
-
this.
|
|
147
|
+
this.simulatedProverAztecNode = this.context.proverNode!;
|
|
150
148
|
({
|
|
151
149
|
aztecNode: this.aztecNode,
|
|
152
150
|
deployL1ContractsValues: this.l1Contracts,
|
|
@@ -155,7 +153,6 @@ export class FullProverTest {
|
|
|
155
153
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
156
154
|
|
|
157
155
|
const config = this.context.aztecNodeConfig;
|
|
158
|
-
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
159
156
|
|
|
160
157
|
// Configure a full prover PXE
|
|
161
158
|
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
|
|
@@ -217,20 +214,13 @@ export class FullProverTest {
|
|
|
217
214
|
this.provenWallet = provenWallet;
|
|
218
215
|
this.logger.info(`Full prover PXE started`);
|
|
219
216
|
|
|
220
|
-
// Shutdown the current, simulated prover node
|
|
217
|
+
// Shutdown the current, simulated prover node (by stopping its hosting aztec node)
|
|
221
218
|
this.logger.verbose('Shutting down simulated prover node');
|
|
222
|
-
await this.
|
|
223
|
-
|
|
224
|
-
// Creating temp store and archiver for fully proven prover node
|
|
225
|
-
this.logger.verbose('Starting archiver for new prover node');
|
|
226
|
-
const archiver = await createArchiver(
|
|
227
|
-
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
228
|
-
{ blobClient, dateProvider: this.context.dateProvider },
|
|
229
|
-
{ blockUntilSync: true },
|
|
230
|
-
);
|
|
219
|
+
await this.simulatedProverAztecNode.stop();
|
|
231
220
|
|
|
232
221
|
// The simulated prover node (now shutdown) used private key index 2
|
|
233
222
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
223
|
+
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey!.toString('hex')}` as const;
|
|
234
224
|
const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey!).toString());
|
|
235
225
|
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
236
226
|
|
|
@@ -238,14 +228,21 @@ export class FullProverTest {
|
|
|
238
228
|
await this.mintFeeJuice(proverNodeSenderAddress);
|
|
239
229
|
|
|
240
230
|
this.logger.verbose('Starting prover node');
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
231
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
232
|
+
const { prefilledPublicData } = await getGenesisValues(
|
|
233
|
+
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const proverNodeConfig: Parameters<typeof AztecNodeService.createAndSync>[0] = {
|
|
237
|
+
...config,
|
|
238
|
+
enableProverNode: true,
|
|
239
|
+
disableValidator: true,
|
|
244
240
|
dataDirectory: undefined,
|
|
241
|
+
txCollectionNodeRpcUrls: [],
|
|
245
242
|
proverId: this.proverAddress,
|
|
246
243
|
realProofs: this.realProofs,
|
|
247
244
|
proverAgentCount: 2,
|
|
248
|
-
|
|
245
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKeyHex)],
|
|
249
246
|
proverNodeMaxPendingJobs: 100,
|
|
250
247
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
251
248
|
proverNodePollingIntervalMs: 100,
|
|
@@ -255,21 +252,14 @@ export class FullProverTest {
|
|
|
255
252
|
txGatheringTimeoutMs: 24_000,
|
|
256
253
|
proverNodeFailedEpochStore: undefined,
|
|
257
254
|
proverNodeEpochProvingDelayMs: undefined,
|
|
255
|
+
validatorPrivateKeys: new SecretValue([]),
|
|
258
256
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.proverNode = await createProverNode(
|
|
264
|
-
proverConfig,
|
|
265
|
-
{
|
|
266
|
-
aztecNodeTxProvider: this.aztecNode,
|
|
267
|
-
archiver: archiver as Archiver,
|
|
268
|
-
},
|
|
257
|
+
|
|
258
|
+
this.proverAztecNode = await AztecNodeService.createAndSync(
|
|
259
|
+
proverNodeConfig,
|
|
260
|
+
{ dateProvider: this.context.dateProvider, p2pClientDeps: { rpcTxProviders: [this.aztecNode] } },
|
|
269
261
|
{ prefilledPublicData },
|
|
270
262
|
);
|
|
271
|
-
await this.proverNode.start();
|
|
272
|
-
|
|
273
263
|
this.logger.warn(`Proofs are now enabled`, { realProofs: this.realProofs });
|
|
274
264
|
return this;
|
|
275
265
|
}
|
|
@@ -289,8 +279,8 @@ export class FullProverTest {
|
|
|
289
279
|
await this.provenComponents[i].teardown();
|
|
290
280
|
}
|
|
291
281
|
|
|
292
|
-
// clean up the full prover node
|
|
293
|
-
await this.
|
|
282
|
+
// clean up the full prover node (by stopping its hosting aztec node)
|
|
283
|
+
await this.proverAztecNode.stop();
|
|
294
284
|
|
|
295
285
|
await Barretenberg.destroySingleton();
|
|
296
286
|
await this.bbConfigCleanup?.();
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -7,6 +7,16 @@ export const shouldCollectMetrics = () => {
|
|
|
7
7
|
return undefined;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
/** Returns the boot node UDP port from environment variable or default value. */
|
|
11
|
+
export function getBootNodeUdpPort(): number {
|
|
12
|
+
return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Returns the anvil port from environment variable or default value. */
|
|
16
|
+
export function getAnvilPort(): number {
|
|
17
|
+
return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
11
21
|
export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
|
|
12
22
|
|
package/src/fixtures/ha_setup.ts
CHANGED
|
@@ -69,8 +69,10 @@ export async function cleanupHADatabase(pool: Pool, logger?: Logger): Promise<vo
|
|
|
69
69
|
try {
|
|
70
70
|
// Drop all HA tables
|
|
71
71
|
await pool.query('DROP TABLE IF EXISTS validator_duties CASCADE');
|
|
72
|
-
await pool.query('DROP TABLE IF EXISTS slashing_protection CASCADE');
|
|
73
72
|
await pool.query('DROP TABLE IF EXISTS schema_version CASCADE');
|
|
73
|
+
// Drop migration tracking table (node-pg-migrate uses 'pgmigrations' by default)
|
|
74
|
+
// This ensures migrations will run fresh on next startup
|
|
75
|
+
await pool.query('DROP TABLE IF EXISTS pgmigrations CASCADE');
|
|
74
76
|
|
|
75
77
|
logger?.info('HA database cleaned up successfully');
|
|
76
78
|
} catch (error) {
|
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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';
|
|
5
4
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
6
5
|
import {
|
|
@@ -16,7 +15,6 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
16
15
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
16
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
17
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
20
18
|
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
21
19
|
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
22
20
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -30,13 +28,8 @@ import {
|
|
|
30
28
|
type ZKPassportArgs,
|
|
31
29
|
deployAztecL1Contracts,
|
|
32
30
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
EthCheatCodes,
|
|
36
|
-
EthCheatCodesWithState,
|
|
37
|
-
createDelayedL1TxUtilsFromViemWallet,
|
|
38
|
-
startAnvil,
|
|
39
|
-
} from '@aztec/ethereum/test';
|
|
31
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
32
|
+
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
40
33
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
41
34
|
import { SecretValue } from '@aztec/foundation/config';
|
|
42
35
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -45,16 +38,14 @@ import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
|
45
38
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
46
39
|
import { sleep } from '@aztec/foundation/sleep';
|
|
47
40
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
48
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
49
41
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
50
42
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
51
43
|
import type { P2PClientDeps } from '@aztec/p2p';
|
|
52
44
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
53
45
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
54
|
-
import
|
|
46
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
55
47
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
56
48
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
58
49
|
import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
59
50
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
60
51
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
@@ -219,8 +210,8 @@ export type EndToEndContext = {
|
|
|
219
210
|
aztecNodeService: AztecNodeService;
|
|
220
211
|
/** Client to the Aztec Node admin interface. */
|
|
221
212
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
222
|
-
/** The prover node
|
|
223
|
-
proverNode:
|
|
213
|
+
/** The aztec node running the prover node subsystem (only set if startProverNode is true). */
|
|
214
|
+
proverNode: AztecNodeService | undefined;
|
|
224
215
|
/** A client to the sequencer service. */
|
|
225
216
|
sequencer: SequencerClient | undefined;
|
|
226
217
|
/** Return values from deployAztecL1Contracts function. */
|
|
@@ -249,6 +240,10 @@ export type EndToEndContext = {
|
|
|
249
240
|
telemetryClient: TelemetryClient;
|
|
250
241
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
251
242
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
243
|
+
/** Delayer for sequencer L1 txs (only when enableDelayer is true). */
|
|
244
|
+
sequencerDelayer: Delayer | undefined;
|
|
245
|
+
/** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
|
|
246
|
+
proverDelayer: Delayer | undefined;
|
|
252
247
|
/** Prefilled public data used for setting up nodes. */
|
|
253
248
|
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
254
249
|
/** ACVM config (only set if running locally). */
|
|
@@ -288,8 +283,12 @@ export async function setup(
|
|
|
288
283
|
config.realProofs = !!opts.realProofs;
|
|
289
284
|
// Only enforce the time table if requested
|
|
290
285
|
config.enforceTimeTable = !!opts.enforceTimeTable;
|
|
286
|
+
// Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
|
|
287
|
+
config.enableDelayer = true;
|
|
291
288
|
config.listenAddress = '127.0.0.1';
|
|
292
289
|
|
|
290
|
+
config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
|
|
291
|
+
|
|
293
292
|
const logger = getLogger();
|
|
294
293
|
|
|
295
294
|
// Create a temp directory for any services that need it and cleanup later
|
|
@@ -337,11 +336,11 @@ export async function setup(
|
|
|
337
336
|
publisherPrivKeyHex = opts.l1PublisherKey.getValue();
|
|
338
337
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
339
338
|
} else if (
|
|
340
|
-
config.
|
|
341
|
-
config.
|
|
342
|
-
config.
|
|
339
|
+
config.sequencerPublisherPrivateKeys &&
|
|
340
|
+
config.sequencerPublisherPrivateKeys.length > 0 &&
|
|
341
|
+
config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
|
|
343
342
|
) {
|
|
344
|
-
publisherPrivKeyHex = config.
|
|
343
|
+
publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
|
|
345
344
|
publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
|
|
346
345
|
} else if (!MNEMONIC) {
|
|
347
346
|
throw new Error(`Mnemonic not provided and no publisher private key`);
|
|
@@ -350,7 +349,7 @@ export async function setup(
|
|
|
350
349
|
const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
|
|
351
350
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
352
351
|
publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
|
|
353
|
-
config.
|
|
352
|
+
config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
|
|
354
353
|
}
|
|
355
354
|
|
|
356
355
|
if (config.coinbase === undefined) {
|
|
@@ -413,9 +412,14 @@ export async function setup(
|
|
|
413
412
|
if (enableAutomine) {
|
|
414
413
|
await ethCheatCodes.setAutomine(false);
|
|
415
414
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
416
|
-
dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
|
|
417
415
|
}
|
|
418
416
|
|
|
417
|
+
// Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
|
|
418
|
+
// In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
|
|
419
|
+
// warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
|
|
420
|
+
// slot from its dateProvider and cannot propose blocks.
|
|
421
|
+
dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
|
|
422
|
+
|
|
419
423
|
if (opts.l2StartTime) {
|
|
420
424
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
421
425
|
}
|
|
@@ -492,36 +496,33 @@ export async function setup(
|
|
|
492
496
|
);
|
|
493
497
|
const sequencerClient = aztecNodeService.getSequencer();
|
|
494
498
|
|
|
495
|
-
|
|
496
|
-
const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
|
|
497
|
-
publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
let proverNode: ProverNode | undefined = undefined;
|
|
499
|
+
let proverNode: AztecNodeService | undefined = undefined;
|
|
501
500
|
if (opts.startProverNode) {
|
|
502
501
|
logger.verbose('Creating and syncing a simulated prover node...');
|
|
503
502
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
504
503
|
const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
|
|
505
504
|
const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
505
|
+
|
|
506
|
+
const p2pClientDeps: Partial<P2PClientDeps<P2PClientType.Full>> = {
|
|
507
|
+
p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
|
|
508
|
+
rpcTxProviders: [aztecNodeService],
|
|
510
509
|
};
|
|
511
|
-
|
|
510
|
+
|
|
511
|
+
({ proverNode } = await createAndSyncProverNode(
|
|
512
512
|
proverNodePrivateKeyHex,
|
|
513
513
|
config,
|
|
514
|
-
proverNodeConfig,
|
|
515
|
-
aztecNodeService,
|
|
516
|
-
prefilledPublicData,
|
|
517
514
|
{
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
: undefined,
|
|
515
|
+
...config.proverNodeConfig,
|
|
516
|
+
dataDirectory: proverNodeDataDirectory,
|
|
521
517
|
},
|
|
522
|
-
|
|
518
|
+
{ dateProvider, p2pClientDeps, telemetry: telemetryClient },
|
|
519
|
+
{ prefilledPublicData },
|
|
520
|
+
));
|
|
523
521
|
}
|
|
524
522
|
|
|
523
|
+
const sequencerDelayer = sequencerClient?.getDelayer();
|
|
524
|
+
const proverDelayer = proverNode?.getProverNode()?.getDelayer();
|
|
525
|
+
|
|
525
526
|
logger.verbose('Creating a pxe...');
|
|
526
527
|
const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
|
|
527
528
|
pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
@@ -622,6 +623,8 @@ export async function setup(
|
|
|
622
623
|
mockGossipSubNetwork,
|
|
623
624
|
prefilledPublicData,
|
|
624
625
|
proverNode,
|
|
626
|
+
sequencerDelayer,
|
|
627
|
+
proverDelayer,
|
|
625
628
|
sequencer: sequencerClient,
|
|
626
629
|
teardown,
|
|
627
630
|
telemetryClient,
|
|
@@ -705,93 +708,53 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
|
|
|
705
708
|
);
|
|
706
709
|
}
|
|
707
710
|
|
|
711
|
+
/**
|
|
712
|
+
* Creates an AztecNodeService with the prover node enabled as a subsystem.
|
|
713
|
+
* Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
|
|
714
|
+
*/
|
|
708
715
|
export function createAndSyncProverNode(
|
|
709
716
|
proverNodePrivateKey: `0x${string}`,
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
717
|
+
baseConfig: AztecNodeConfig,
|
|
718
|
+
configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
|
|
719
|
+
deps: {
|
|
720
|
+
telemetry?: TelemetryClient;
|
|
721
|
+
dateProvider: DateProvider;
|
|
722
|
+
p2pClientDeps?: P2PClientDeps<P2PClientType.Full>;
|
|
723
|
+
},
|
|
724
|
+
options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
|
|
725
|
+
): Promise<{ proverNode: AztecNodeService }> {
|
|
716
726
|
return withLoggerBindings({ actor: 'prover-0' }, async () => {
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
{ blobClient, dateProvider: proverNodeDeps.dateProvider },
|
|
729
|
-
{ blockUntilSync: true },
|
|
730
|
-
);
|
|
731
|
-
|
|
732
|
-
const proverConfig: ProverNodeConfig = {
|
|
733
|
-
...aztecNodeConfig,
|
|
734
|
-
txCollectionNodeRpcUrls: [],
|
|
735
|
-
realProofs: false,
|
|
736
|
-
proverAgentCount: 2,
|
|
737
|
-
publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
738
|
-
proverNodeMaxPendingJobs: 10,
|
|
739
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
740
|
-
proverNodePollingIntervalMs: 200,
|
|
741
|
-
txGatheringIntervalMs: 1000,
|
|
742
|
-
txGatheringBatchSize: 10,
|
|
743
|
-
txGatheringMaxParallelRequestsPerNode: 10,
|
|
744
|
-
txGatheringTimeoutMs: 24_000,
|
|
745
|
-
proverNodeFailedEpochStore: undefined,
|
|
746
|
-
proverId: EthAddress.fromNumber(1),
|
|
747
|
-
proverNodeEpochProvingDelayMs: undefined,
|
|
748
|
-
...proverNodeConfig,
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
const l1TxUtils = createDelayedL1TxUtils(
|
|
752
|
-
aztecNodeConfig,
|
|
753
|
-
proverNodePrivateKey,
|
|
754
|
-
'prover-node',
|
|
755
|
-
proverNodeDeps.dateProvider,
|
|
727
|
+
const proverNode = await AztecNodeService.createAndSync(
|
|
728
|
+
{
|
|
729
|
+
...baseConfig,
|
|
730
|
+
...configOverrides,
|
|
731
|
+
p2pPort: 0,
|
|
732
|
+
enableProverNode: true,
|
|
733
|
+
disableValidator: true,
|
|
734
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
|
|
735
|
+
},
|
|
736
|
+
deps,
|
|
737
|
+
{ ...options, dontStartProverNode: options.dontStart },
|
|
756
738
|
);
|
|
757
739
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
{ ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
|
|
761
|
-
{ prefilledPublicData },
|
|
762
|
-
);
|
|
763
|
-
getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
|
|
764
|
-
if (!proverNodeConfig.dontStart) {
|
|
765
|
-
await proverNode.start();
|
|
740
|
+
if (!proverNode.getProverNode()) {
|
|
741
|
+
throw new Error('Prover node subsystem was not created despite enableProverNode being set');
|
|
766
742
|
}
|
|
767
|
-
return proverNode;
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
743
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
logName: string,
|
|
775
|
-
dateProvider?: DateProvider,
|
|
776
|
-
) {
|
|
777
|
-
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
778
|
-
|
|
779
|
-
const log = createLogger(logName);
|
|
780
|
-
const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
|
|
781
|
-
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
782
|
-
return l1TxUtils;
|
|
744
|
+
getLogger().info(`Created and synced prover node`);
|
|
745
|
+
return { proverNode };
|
|
746
|
+
});
|
|
783
747
|
}
|
|
784
748
|
|
|
785
749
|
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
786
750
|
export function getBalancesFn(
|
|
787
751
|
symbol: string,
|
|
788
752
|
method: ContractMethod,
|
|
789
|
-
from: AztecAddress,
|
|
790
753
|
logger: any,
|
|
791
754
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
792
755
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
793
756
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
794
|
-
const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
|
|
757
|
+
const b = await Promise.all(addresses.map(address => method(address).simulate({ from: address })));
|
|
795
758
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
796
759
|
logger.verbose(debugString);
|
|
797
760
|
return b;
|
|
@@ -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;
|
|
@@ -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)
|
package/src/shared/index.ts
CHANGED