@aztec/end-to-end 1.0.0-nightly.20250613 → 1.0.0-nightly.20250614
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/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -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 +1 -8
- package/dest/e2e_epochs/epochs_test.d.ts +13 -4
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +56 -8
- package/dest/fixtures/utils.d.ts +11 -0
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +30 -2
- package/package.json +35 -35
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -6
- package/src/e2e_epochs/epochs_test.ts +75 -14
- package/src/fixtures/utils.ts +45 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blacklist_token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,eAAe,EACpB,EAAE,EACF,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"blacklist_token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,eAAe,EACpB,EAAE,EACF,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,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|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { Fr, computeSecretHash, createLogger } from '@aztec/aztec.js';
|
|
3
|
-
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
4
3
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
5
4
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
6
5
|
import { jest } from '@jest/globals';
|
|
@@ -105,15 +104,9 @@ export class BlacklistTokenContractTest {
|
|
|
105
104
|
async teardown() {
|
|
106
105
|
await this.snapshotManager.teardown();
|
|
107
106
|
}
|
|
108
|
-
#toBoundedVec(arr, maxLen) {
|
|
109
|
-
return {
|
|
110
|
-
len: arr.length,
|
|
111
|
-
storage: arr.concat(new Array(maxLen - arr.length).fill(new Fr(0)))
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
107
|
async addPendingShieldNoteToPXE(contract, recipient, amount, secretHash, txHash) {
|
|
115
108
|
const txEffects = await this.pxe.getTxEffect(txHash);
|
|
116
|
-
await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash,
|
|
109
|
+
await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash, txEffects.data.noteHashes, txEffects.data.nullifiers[0], recipient).simulate();
|
|
117
110
|
}
|
|
118
111
|
async applyMintSnapshot() {
|
|
119
112
|
await this.snapshotManager.snapshot('mint', async ()=>{
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { type Logger } from '@aztec/aztec.js';
|
|
1
|
+
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { Fr, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
3
3
|
import type { ViemClient } from '@aztec/ethereum';
|
|
4
4
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
5
|
import { ChainMonitor, type Delayer } from '@aztec/ethereum/test';
|
|
6
|
+
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
6
7
|
import { ProverNode } from '@aztec/prover-node';
|
|
7
8
|
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
8
9
|
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
@@ -10,7 +11,9 @@ import { type EndToEndContext, type SetupOptions } from '../fixtures/utils.js';
|
|
|
10
11
|
export declare const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
11
12
|
export declare const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
12
13
|
export declare const ARCHIVER_POLL_INTERVAL = 50;
|
|
13
|
-
export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs' | 'l1PublishRetryIntervalMS' | 'txPropagationMaxQueryAttempts' | 'proverNodeConfig' | 'ethereumSlotDuration' | 'aztecSlotDuration'
|
|
14
|
+
export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs' | 'l1PublishRetryIntervalMS' | 'txPropagationMaxQueryAttempts' | 'proverNodeConfig' | 'ethereumSlotDuration' | 'aztecSlotDuration' | 'initialValidators' | 'mockGossipSubNetwork' | 'disableAnvilTestWatcher'>> & {
|
|
15
|
+
numberOfAccounts?: number;
|
|
16
|
+
};
|
|
14
17
|
/**
|
|
15
18
|
* Tests building of epochs using fast block times and short epochs.
|
|
16
19
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -40,7 +43,11 @@ export declare class EpochsTestContext {
|
|
|
40
43
|
setup(opts?: EpochsTestOpts): Promise<void>;
|
|
41
44
|
teardown(): Promise<void>;
|
|
42
45
|
createProverNode(): Promise<ProverNode>;
|
|
43
|
-
createNonValidatorNode(): Promise<AztecNodeService>;
|
|
46
|
+
createNonValidatorNode(opts?: Partial<AztecNodeConfig>): Promise<AztecNodeService>;
|
|
47
|
+
createValidatorNode(privateKeys: `0x${string}`[], opts?: Partial<AztecNodeConfig> & {
|
|
48
|
+
dontStartSequencer?: boolean;
|
|
49
|
+
}): Promise<AztecNodeService>;
|
|
50
|
+
private createNode;
|
|
44
51
|
private getNextPrivateKey;
|
|
45
52
|
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
|
|
46
53
|
waitUntilEpochStarts(epoch: number): Promise<bigint>;
|
|
@@ -52,6 +59,8 @@ export declare class EpochsTestContext {
|
|
|
52
59
|
waitUntilEndOfProofSubmissionWindow(epochNumber: number | bigint): Promise<void>;
|
|
53
60
|
/** Waits for the aztec node to sync to the target block number. */
|
|
54
61
|
waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalised' | 'historic'): Promise<void>;
|
|
62
|
+
/** Registers the SpamContract on the given wallet. */
|
|
63
|
+
registerSpamContract(wallet: Wallet, salt?: Fr): Promise<SpamContract>;
|
|
55
64
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
56
65
|
verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean): Promise<void>;
|
|
57
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,EAAE,EACF,KAAK,MAAM,EAEX,KAAK,MAAM,EAKZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,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,MAAM,CAAC;IAC5B,qBAAqB,EAAG,MAAM,CAAC;WAElB,KAAK,CAAC,IAAI,GAAE,cAAmB;WAMrC,gBAAgB,CAAC,IAAI,GAAE,cAAmB;;;;;;IAS3C,KAAK,CAAC,IAAI,GAAE,cAAmB;IA4E/B,QAAQ;IAOR,gBAAgB;IAgBtB,sBAAsB,CAAC,IAAI,GAAE,OAAO,CAAC,eAAe,CAAM;IAK1D,mBAAmB,CACxB,WAAW,EAAE,KAAK,MAAM,EAAE,EAAE,EAC5B,IAAI,GAAE,OAAO,CAAC,eAAe,CAAC,GAAG;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAO;YAM1D,UAAU;IA+BxB,OAAO,CAAC,iBAAiB;IAKzB,0FAA0F;IAC7E,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAO/C,sDAAsD;IACzC,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK;IAShE,iEAAiE;IACpD,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,SAAK;IAUjE,4EAA4E;IAC/D,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAO7E,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU;IAoB7F,sDAAsD;IACzC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,KAAU;IAYhE,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;CAUtF"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { Fr, MerkleTreeId, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
2
|
+
import { Fr, MerkleTreeId, getContractInstanceFromDeployParams, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
4
|
import { ChainMonitor, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
5
5
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
6
6
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
7
|
+
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
8
|
+
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
7
9
|
import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
8
10
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
9
11
|
import { join } from 'path';
|
|
@@ -53,7 +55,8 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
53
55
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
54
56
|
// Set up system without any account nor protocol contracts
|
|
55
57
|
// and with faster block times and shorter epochs.
|
|
56
|
-
const context = await setup(0, {
|
|
58
|
+
const context = await setup(opts.numberOfAccounts ?? 0, {
|
|
59
|
+
automineL1Setup: true,
|
|
57
60
|
checkIntervalMs: 50,
|
|
58
61
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
59
62
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
@@ -91,8 +94,8 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
91
94
|
// This is hideous.
|
|
92
95
|
// We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
|
|
93
96
|
this.proverDelayer = context.proverNode ? context.proverNode.publisher.l1TxUtils.delayer : undefined;
|
|
94
|
-
this.sequencerDelayer = context.sequencer.sequencer.publisher.l1TxUtils.delayer;
|
|
95
|
-
if (context.proverNode && !this.proverDelayer || !this.sequencerDelayer) {
|
|
97
|
+
this.sequencerDelayer = context.sequencer ? context.sequencer.sequencer.publisher.l1TxUtils.delayer : undefined;
|
|
98
|
+
if (context.proverNode && !this.proverDelayer || context.sequencer && !this.sequencerDelayer) {
|
|
96
99
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
97
100
|
}
|
|
98
101
|
// Constants used for time calculation
|
|
@@ -126,13 +129,44 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
126
129
|
this.proverNodes.push(proverNode);
|
|
127
130
|
return proverNode;
|
|
128
131
|
}
|
|
129
|
-
|
|
132
|
+
createNonValidatorNode(opts = {}) {
|
|
130
133
|
this.logger.warn('Creating and syncing a node without a validator...');
|
|
134
|
+
return this.createNode({
|
|
135
|
+
...opts,
|
|
136
|
+
disableValidator: true
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
createValidatorNode(privateKeys, opts = {}) {
|
|
140
|
+
this.logger.warn('Creating and syncing a validator node...');
|
|
141
|
+
return this.createNode({
|
|
142
|
+
...opts,
|
|
143
|
+
disableValidator: false,
|
|
144
|
+
validatorPrivateKeys: privateKeys
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async createNode(opts = {}) {
|
|
131
148
|
const suffix = (this.nodes.length + 1).toString();
|
|
149
|
+
const { mockGossipSubNetwork } = this.context;
|
|
150
|
+
const resolvedConfig = {
|
|
151
|
+
...this.context.config,
|
|
152
|
+
...opts
|
|
153
|
+
};
|
|
154
|
+
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
155
|
+
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
132
156
|
const node = await withLogNameSuffix(suffix, ()=>AztecNodeService.createAndSync({
|
|
133
|
-
...
|
|
134
|
-
|
|
135
|
-
|
|
157
|
+
...resolvedConfig,
|
|
158
|
+
dataDirectory: join(this.context.config.dataDirectory, randomBytes(8).toString('hex')),
|
|
159
|
+
validatorPrivateKeys: opts.validatorPrivateKeys,
|
|
160
|
+
p2pEnabled,
|
|
161
|
+
p2pIp
|
|
162
|
+
}, {
|
|
163
|
+
dateProvider: this.context.dateProvider,
|
|
164
|
+
p2pClientDeps: {
|
|
165
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
prefilledPublicData: this.context.prefilledPublicData,
|
|
169
|
+
...opts
|
|
136
170
|
}));
|
|
137
171
|
this.nodes.push(node);
|
|
138
172
|
return node;
|
|
@@ -186,6 +220,20 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
186
220
|
}
|
|
187
221
|
}
|
|
188
222
|
}
|
|
223
|
+
/** Registers the SpamContract on the given wallet. */ async registerSpamContract(wallet, salt = Fr.ZERO) {
|
|
224
|
+
const instance = await getContractInstanceFromDeployParams(SpamContract.artifact, {
|
|
225
|
+
constructorArgs: [],
|
|
226
|
+
constructorArtifact: undefined,
|
|
227
|
+
salt,
|
|
228
|
+
publicKeys: undefined,
|
|
229
|
+
deployer: undefined
|
|
230
|
+
});
|
|
231
|
+
await wallet.registerContract({
|
|
232
|
+
artifact: SpamContract.artifact,
|
|
233
|
+
instance
|
|
234
|
+
});
|
|
235
|
+
return SpamContract.at(instance.address, wallet);
|
|
236
|
+
}
|
|
189
237
|
/** Verifies whether the given block number is found on the aztec node. */ async verifyHistoricBlock(blockNumber, expectedSuccess) {
|
|
190
238
|
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
191
239
|
// at a particular block, so we know whether that historic block is available or has been
|
package/dest/fixtures/utils.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { startAnvil } from '@aztec/ethereum/test';
|
|
|
8
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
9
9
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
10
10
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
11
|
+
import { MockGossipSubNetwork } from '@aztec/p2p/test-helpers';
|
|
11
12
|
import { type ProverNode, type ProverNodeConfig } from '@aztec/prover-node';
|
|
12
13
|
import { type PXEService, type PXEServiceConfig } from '@aztec/pxe/server';
|
|
13
14
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
@@ -79,6 +80,12 @@ export type SetupOptions = {
|
|
|
79
80
|
genesisPublicData?: PublicDataTreeLeaf[];
|
|
80
81
|
/** Specific config for the prover node, if set. */
|
|
81
82
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
83
|
+
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
84
|
+
mockGossipSubNetwork?: boolean;
|
|
85
|
+
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
86
|
+
disableAnvilTestWatcher?: boolean;
|
|
87
|
+
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
88
|
+
automineL1Setup?: boolean;
|
|
82
89
|
} & Partial<AztecNodeConfig>;
|
|
83
90
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
84
91
|
export type EndToEndContext = {
|
|
@@ -114,6 +121,10 @@ export type EndToEndContext = {
|
|
|
114
121
|
blobSink: BlobSinkServer | undefined;
|
|
115
122
|
/** Telemetry client */
|
|
116
123
|
telemetryClient: TelemetryClient | undefined;
|
|
124
|
+
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
125
|
+
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
126
|
+
/** Prefilled public data used for setting up nodes. */
|
|
127
|
+
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
117
128
|
/** Function to stop the started services. */
|
|
118
129
|
teardown: () => Promise<void>;
|
|
119
130
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,KA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/B,MAAM,EAAE,CAAC,EAAE,EACX,eAAe,EAAE,CAAC,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EACnE,aAAa,EAAE,CAAC,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,CAAC,EAAE,EACX,aAAa,EAAE,CAAC,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,0BAK3C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,kEAQ/C;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,SAAK,EAAE,WAAW,SAAI,iBAS/G;AAED,wBAAgB,uBAAuB,CACrC,oBAAoB,EAAE,KAAK,MAAM,EAAE,EACnC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,EACpF,SAAS,EAAE,SAAS,EACpB,mBAAmB,GAAE,kBAAkB,EAAO,uBA6C/C;AAWD,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,KAAK,MAAM,EAAE,EACzB,aAAa,EAAE,GAAG,8BAKnB"}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -19,6 +19,7 @@ import { retryUntil } from '@aztec/foundation/retry';
|
|
|
19
19
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
20
20
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
21
21
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
22
|
+
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
22
23
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
23
24
|
import { createProverNode } from '@aztec/prover-node';
|
|
24
25
|
import { createPXEServiceWithSimulator, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
@@ -163,6 +164,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
163
164
|
wallets: wallets.slice(0, numberOfAccounts),
|
|
164
165
|
logger,
|
|
165
166
|
cheatCodes,
|
|
167
|
+
prefilledPublicData: undefined,
|
|
168
|
+
mockGossipSubNetwork: undefined,
|
|
166
169
|
watcher: undefined,
|
|
167
170
|
dateProvider: undefined,
|
|
168
171
|
blobSink: undefined,
|
|
@@ -248,6 +251,11 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
248
251
|
}
|
|
249
252
|
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts);
|
|
250
253
|
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address), opts.initialAccountFeeJuice, opts.genesisPublicData);
|
|
254
|
+
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
255
|
+
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
256
|
+
if (enableAutomine) {
|
|
257
|
+
await ethCheatCodes.setAutomine(true);
|
|
258
|
+
}
|
|
251
259
|
const deployL1ContractsValues = opts.deployL1ContractsValues ?? await setupL1Contracts(config.l1RpcUrls, publisherHdAccount, logger, {
|
|
252
260
|
...opts,
|
|
253
261
|
genesisArchiveRoot,
|
|
@@ -279,14 +287,21 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
279
287
|
});
|
|
280
288
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
281
289
|
}
|
|
290
|
+
if (enableAutomine) {
|
|
291
|
+
await ethCheatCodes.setAutomine(false);
|
|
292
|
+
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
293
|
+
}
|
|
282
294
|
if (opts.l2StartTime) {
|
|
283
295
|
// This should only be used in synching test or when you need to have a stable
|
|
284
296
|
// timestamp for the first l2 block.
|
|
285
297
|
await ethCheatCodes.warp(opts.l2StartTime);
|
|
286
298
|
}
|
|
287
299
|
const dateProvider = new TestDateProvider();
|
|
300
|
+
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
288
301
|
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
289
|
-
|
|
302
|
+
if (!opts.disableAnvilTestWatcher) {
|
|
303
|
+
await watcher.start();
|
|
304
|
+
}
|
|
290
305
|
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
291
306
|
// Blob sink service - blobs get posted here and served from here
|
|
292
307
|
const blobSinkPort = await getPort();
|
|
@@ -315,10 +330,21 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
315
330
|
const blobSinkClient = createBlobSinkClient(config, {
|
|
316
331
|
logger: createLogger('node:blob-sink:client')
|
|
317
332
|
});
|
|
333
|
+
let mockGossipSubNetwork;
|
|
334
|
+
let p2pClientDeps = undefined;
|
|
335
|
+
if (opts.mockGossipSubNetwork) {
|
|
336
|
+
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
337
|
+
p2pClientDeps = {
|
|
338
|
+
p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
342
|
+
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
318
343
|
const aztecNode = await AztecNodeService.createAndSync(config, {
|
|
319
344
|
dateProvider,
|
|
320
345
|
blobSinkClient,
|
|
321
|
-
telemetry
|
|
346
|
+
telemetry,
|
|
347
|
+
p2pClientDeps
|
|
322
348
|
}, {
|
|
323
349
|
prefilledPublicData
|
|
324
350
|
});
|
|
@@ -377,6 +403,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
377
403
|
deployL1ContractsValues,
|
|
378
404
|
initialFundedAccounts,
|
|
379
405
|
logger,
|
|
406
|
+
mockGossipSubNetwork,
|
|
407
|
+
prefilledPublicData,
|
|
380
408
|
proverNode,
|
|
381
409
|
pxe,
|
|
382
410
|
sequencer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250614",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,40 +25,40 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "1.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "1.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "1.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "1.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "1.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "1.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "1.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "1.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "1.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "1.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "1.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "1.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "1.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "1.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "1.0.0-nightly.
|
|
46
|
-
"@aztec/noir-contracts.js": "1.0.0-nightly.
|
|
47
|
-
"@aztec/noir-noirc_abi": "1.0.0-nightly.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.
|
|
49
|
-
"@aztec/noir-test-contracts.js": "1.0.0-nightly.
|
|
50
|
-
"@aztec/p2p": "1.0.0-nightly.
|
|
51
|
-
"@aztec/protocol-contracts": "1.0.0-nightly.
|
|
52
|
-
"@aztec/prover-client": "1.0.0-nightly.
|
|
53
|
-
"@aztec/prover-node": "1.0.0-nightly.
|
|
54
|
-
"@aztec/pxe": "1.0.0-nightly.
|
|
55
|
-
"@aztec/sequencer-client": "1.0.0-nightly.
|
|
56
|
-
"@aztec/simulator": "1.0.0-nightly.
|
|
57
|
-
"@aztec/slasher": "1.0.0-nightly.
|
|
58
|
-
"@aztec/stdlib": "1.0.0-nightly.
|
|
59
|
-
"@aztec/telemetry-client": "1.0.0-nightly.
|
|
60
|
-
"@aztec/validator-client": "1.0.0-nightly.
|
|
61
|
-
"@aztec/world-state": "1.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "1.0.0-nightly.20250614",
|
|
29
|
+
"@aztec/archiver": "1.0.0-nightly.20250614",
|
|
30
|
+
"@aztec/aztec": "1.0.0-nightly.20250614",
|
|
31
|
+
"@aztec/aztec-node": "1.0.0-nightly.20250614",
|
|
32
|
+
"@aztec/aztec.js": "1.0.0-nightly.20250614",
|
|
33
|
+
"@aztec/bb-prover": "1.0.0-nightly.20250614",
|
|
34
|
+
"@aztec/blob-lib": "1.0.0-nightly.20250614",
|
|
35
|
+
"@aztec/blob-sink": "1.0.0-nightly.20250614",
|
|
36
|
+
"@aztec/bot": "1.0.0-nightly.20250614",
|
|
37
|
+
"@aztec/cli": "1.0.0-nightly.20250614",
|
|
38
|
+
"@aztec/constants": "1.0.0-nightly.20250614",
|
|
39
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250614",
|
|
40
|
+
"@aztec/epoch-cache": "1.0.0-nightly.20250614",
|
|
41
|
+
"@aztec/ethereum": "1.0.0-nightly.20250614",
|
|
42
|
+
"@aztec/foundation": "1.0.0-nightly.20250614",
|
|
43
|
+
"@aztec/kv-store": "1.0.0-nightly.20250614",
|
|
44
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250614",
|
|
45
|
+
"@aztec/merkle-tree": "1.0.0-nightly.20250614",
|
|
46
|
+
"@aztec/noir-contracts.js": "1.0.0-nightly.20250614",
|
|
47
|
+
"@aztec/noir-noirc_abi": "1.0.0-nightly.20250614",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.20250614",
|
|
49
|
+
"@aztec/noir-test-contracts.js": "1.0.0-nightly.20250614",
|
|
50
|
+
"@aztec/p2p": "1.0.0-nightly.20250614",
|
|
51
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250614",
|
|
52
|
+
"@aztec/prover-client": "1.0.0-nightly.20250614",
|
|
53
|
+
"@aztec/prover-node": "1.0.0-nightly.20250614",
|
|
54
|
+
"@aztec/pxe": "1.0.0-nightly.20250614",
|
|
55
|
+
"@aztec/sequencer-client": "1.0.0-nightly.20250614",
|
|
56
|
+
"@aztec/simulator": "1.0.0-nightly.20250614",
|
|
57
|
+
"@aztec/slasher": "1.0.0-nightly.20250614",
|
|
58
|
+
"@aztec/stdlib": "1.0.0-nightly.20250614",
|
|
59
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250614",
|
|
60
|
+
"@aztec/validator-client": "1.0.0-nightly.20250614",
|
|
61
|
+
"@aztec/world-state": "1.0.0-nightly.20250614",
|
|
62
62
|
"@iarna/toml": "^2.2.5",
|
|
63
63
|
"@jest/globals": "^29.5.0",
|
|
64
64
|
"@noble/curves": "^1.0.0",
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
computeSecretHash,
|
|
11
11
|
createLogger,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
|
-
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
14
13
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
15
14
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
16
15
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
@@ -162,10 +161,6 @@ export class BlacklistTokenContractTest {
|
|
|
162
161
|
await this.snapshotManager.teardown();
|
|
163
162
|
}
|
|
164
163
|
|
|
165
|
-
#toBoundedVec(arr: Fr[], maxLen: number) {
|
|
166
|
-
return { len: arr.length, storage: arr.concat(new Array(maxLen - arr.length).fill(new Fr(0))) };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
164
|
async addPendingShieldNoteToPXE(
|
|
170
165
|
contract: TokenBlacklistContract,
|
|
171
166
|
recipient: AztecAddress,
|
|
@@ -180,7 +175,7 @@ export class BlacklistTokenContractTest {
|
|
|
180
175
|
amount,
|
|
181
176
|
secretHash,
|
|
182
177
|
txHash.hash,
|
|
183
|
-
|
|
178
|
+
txEffects!.data.noteHashes,
|
|
184
179
|
txEffects!.data.nullifiers[0],
|
|
185
180
|
recipient,
|
|
186
181
|
)
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
1
|
+
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import {
|
|
3
|
+
Fr,
|
|
4
|
+
type Logger,
|
|
5
|
+
MerkleTreeId,
|
|
6
|
+
type Wallet,
|
|
7
|
+
getContractInstanceFromDeployParams,
|
|
8
|
+
getTimestampRangeForEpoch,
|
|
9
|
+
retryUntil,
|
|
10
|
+
sleep,
|
|
11
|
+
} from '@aztec/aztec.js';
|
|
3
12
|
import type { ViemClient } from '@aztec/ethereum';
|
|
4
13
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
14
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
6
15
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
7
16
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
17
|
+
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
18
|
+
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
8
19
|
import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
|
|
9
20
|
import type { TestProverNode } from '@aztec/prover-node/test';
|
|
10
21
|
import type { SequencerPublisher } from '@aztec/sequencer-client';
|
|
@@ -40,8 +51,11 @@ export type EpochsTestOpts = Partial<
|
|
|
40
51
|
| 'proverNodeConfig'
|
|
41
52
|
| 'ethereumSlotDuration'
|
|
42
53
|
| 'aztecSlotDuration'
|
|
54
|
+
| 'initialValidators'
|
|
55
|
+
| 'mockGossipSubNetwork'
|
|
56
|
+
| 'disableAnvilTestWatcher'
|
|
43
57
|
>
|
|
44
|
-
|
|
58
|
+
> & { numberOfAccounts?: number };
|
|
45
59
|
|
|
46
60
|
/**
|
|
47
61
|
* Tests building of epochs using fast block times and short epochs.
|
|
@@ -90,7 +104,8 @@ export class EpochsTestContext {
|
|
|
90
104
|
|
|
91
105
|
// Set up system without any account nor protocol contracts
|
|
92
106
|
// and with faster block times and shorter epochs.
|
|
93
|
-
const context = await setup(0, {
|
|
107
|
+
const context = await setup(opts.numberOfAccounts ?? 0, {
|
|
108
|
+
automineL1Setup: true,
|
|
94
109
|
checkIntervalMs: 50,
|
|
95
110
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
96
111
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
@@ -129,11 +144,14 @@ export class EpochsTestContext {
|
|
|
129
144
|
this.proverDelayer = context.proverNode
|
|
130
145
|
? (((context.proverNode as TestProverNode).publisher as ProverNodePublisher).l1TxUtils as DelayedTxUtils).delayer!
|
|
131
146
|
: undefined!;
|
|
132
|
-
this.sequencerDelayer =
|
|
133
|
-
(
|
|
134
|
-
|
|
147
|
+
this.sequencerDelayer = context.sequencer
|
|
148
|
+
? (
|
|
149
|
+
((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher)
|
|
150
|
+
.l1TxUtils as DelayedTxUtils
|
|
151
|
+
).delayer!
|
|
152
|
+
: undefined!;
|
|
135
153
|
|
|
136
|
-
if ((context.proverNode && !this.proverDelayer) || !this.sequencerDelayer) {
|
|
154
|
+
if ((context.proverNode && !this.proverDelayer) || (context.sequencer && !this.sequencerDelayer)) {
|
|
137
155
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
138
156
|
}
|
|
139
157
|
|
|
@@ -176,15 +194,45 @@ export class EpochsTestContext {
|
|
|
176
194
|
return proverNode;
|
|
177
195
|
}
|
|
178
196
|
|
|
179
|
-
public
|
|
197
|
+
public createNonValidatorNode(opts: Partial<AztecNodeConfig> = {}) {
|
|
180
198
|
this.logger.warn('Creating and syncing a node without a validator...');
|
|
199
|
+
return this.createNode({ ...opts, disableValidator: true });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
public createValidatorNode(
|
|
203
|
+
privateKeys: `0x${string}`[],
|
|
204
|
+
opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {},
|
|
205
|
+
) {
|
|
206
|
+
this.logger.warn('Creating and syncing a validator node...');
|
|
207
|
+
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: privateKeys });
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private async createNode(opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {}) {
|
|
181
211
|
const suffix = (this.nodes.length + 1).toString();
|
|
212
|
+
const { mockGossipSubNetwork } = this.context;
|
|
213
|
+
const resolvedConfig = { ...this.context.config, ...opts };
|
|
214
|
+
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
215
|
+
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
182
216
|
const node = await withLogNameSuffix(suffix, () =>
|
|
183
|
-
AztecNodeService.createAndSync(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
217
|
+
AztecNodeService.createAndSync(
|
|
218
|
+
{
|
|
219
|
+
...resolvedConfig,
|
|
220
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
221
|
+
validatorPrivateKeys: opts.validatorPrivateKeys,
|
|
222
|
+
p2pEnabled,
|
|
223
|
+
p2pIp,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
dateProvider: this.context.dateProvider,
|
|
227
|
+
p2pClientDeps: {
|
|
228
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
prefilledPublicData: this.context.prefilledPublicData,
|
|
233
|
+
...opts,
|
|
234
|
+
},
|
|
235
|
+
),
|
|
188
236
|
);
|
|
189
237
|
this.nodes.push(node);
|
|
190
238
|
return node;
|
|
@@ -253,6 +301,19 @@ export class EpochsTestContext {
|
|
|
253
301
|
}
|
|
254
302
|
}
|
|
255
303
|
|
|
304
|
+
/** Registers the SpamContract on the given wallet. */
|
|
305
|
+
public async registerSpamContract(wallet: Wallet, salt = Fr.ZERO) {
|
|
306
|
+
const instance = await getContractInstanceFromDeployParams(SpamContract.artifact, {
|
|
307
|
+
constructorArgs: [],
|
|
308
|
+
constructorArtifact: undefined,
|
|
309
|
+
salt,
|
|
310
|
+
publicKeys: undefined,
|
|
311
|
+
deployer: undefined,
|
|
312
|
+
});
|
|
313
|
+
await wallet.registerContract({ artifact: SpamContract.artifact, instance });
|
|
314
|
+
return SpamContract.at(instance.address, wallet);
|
|
315
|
+
}
|
|
316
|
+
|
|
256
317
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
257
318
|
public async verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean) {
|
|
258
319
|
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -51,6 +51,8 @@ import { TestDateProvider } from '@aztec/foundation/timer';
|
|
|
51
51
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
52
52
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
53
53
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
54
|
+
import type { P2PClientDeps } from '@aztec/p2p';
|
|
55
|
+
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
54
56
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
55
57
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
56
58
|
import {
|
|
@@ -66,6 +68,7 @@ import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
|
66
68
|
import { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
|
|
67
69
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
68
70
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
71
|
+
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
69
72
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
70
73
|
import {
|
|
71
74
|
type TelemetryClient,
|
|
@@ -250,6 +253,8 @@ async function setupWithRemoteEnvironment(
|
|
|
250
253
|
wallets: wallets.slice(0, numberOfAccounts),
|
|
251
254
|
logger,
|
|
252
255
|
cheatCodes,
|
|
256
|
+
prefilledPublicData: undefined,
|
|
257
|
+
mockGossipSubNetwork: undefined,
|
|
253
258
|
watcher: undefined,
|
|
254
259
|
dateProvider: undefined,
|
|
255
260
|
blobSink: undefined,
|
|
@@ -292,6 +297,12 @@ export type SetupOptions = {
|
|
|
292
297
|
genesisPublicData?: PublicDataTreeLeaf[];
|
|
293
298
|
/** Specific config for the prover node, if set. */
|
|
294
299
|
proverNodeConfig?: Partial<ProverNodeConfig>;
|
|
300
|
+
/** Whether to use a mock gossip sub network for p2p clients. */
|
|
301
|
+
mockGossipSubNetwork?: boolean;
|
|
302
|
+
/** Whether to disable the anvil test watcher (can still be manually started) */
|
|
303
|
+
disableAnvilTestWatcher?: boolean;
|
|
304
|
+
/** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
|
|
305
|
+
automineL1Setup?: boolean;
|
|
295
306
|
} & Partial<AztecNodeConfig>;
|
|
296
307
|
|
|
297
308
|
/** Context for an end-to-end test as returned by the `setup` function */
|
|
@@ -328,6 +339,10 @@ export type EndToEndContext = {
|
|
|
328
339
|
blobSink: BlobSinkServer | undefined;
|
|
329
340
|
/** Telemetry client */
|
|
330
341
|
telemetryClient: TelemetryClient | undefined;
|
|
342
|
+
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
343
|
+
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
344
|
+
/** Prefilled public data used for setting up nodes. */
|
|
345
|
+
prefilledPublicData: PublicDataTreeLeaf[] | undefined;
|
|
331
346
|
/** Function to stop the started services. */
|
|
332
347
|
teardown: () => Promise<void>;
|
|
333
348
|
};
|
|
@@ -427,6 +442,12 @@ export async function setup(
|
|
|
427
442
|
opts.genesisPublicData,
|
|
428
443
|
);
|
|
429
444
|
|
|
445
|
+
const wasAutomining = await ethCheatCodes.isAutoMining();
|
|
446
|
+
const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
|
|
447
|
+
if (enableAutomine) {
|
|
448
|
+
await ethCheatCodes.setAutomine(true);
|
|
449
|
+
}
|
|
450
|
+
|
|
430
451
|
const deployL1ContractsValues =
|
|
431
452
|
opts.deployL1ContractsValues ??
|
|
432
453
|
(await setupL1Contracts(
|
|
@@ -468,6 +489,11 @@ export async function setup(
|
|
|
468
489
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
469
490
|
}
|
|
470
491
|
|
|
492
|
+
if (enableAutomine) {
|
|
493
|
+
await ethCheatCodes.setAutomine(false);
|
|
494
|
+
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
495
|
+
}
|
|
496
|
+
|
|
471
497
|
if (opts.l2StartTime) {
|
|
472
498
|
// This should only be used in synching test or when you need to have a stable
|
|
473
499
|
// timestamp for the first l2 block.
|
|
@@ -475,6 +501,7 @@ export async function setup(
|
|
|
475
501
|
}
|
|
476
502
|
|
|
477
503
|
const dateProvider = new TestDateProvider();
|
|
504
|
+
dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
|
|
478
505
|
|
|
479
506
|
const watcher = new AnvilTestWatcher(
|
|
480
507
|
new EthCheatCodesWithState(config.l1RpcUrls),
|
|
@@ -482,8 +509,9 @@ export async function setup(
|
|
|
482
509
|
deployL1ContractsValues.l1Client,
|
|
483
510
|
dateProvider,
|
|
484
511
|
);
|
|
485
|
-
|
|
486
|
-
|
|
512
|
+
if (!opts.disableAnvilTestWatcher) {
|
|
513
|
+
await watcher.start();
|
|
514
|
+
}
|
|
487
515
|
|
|
488
516
|
const telemetry = getTelemetryClient(opts.telemetryConfig);
|
|
489
517
|
|
|
@@ -519,9 +547,20 @@ export async function setup(
|
|
|
519
547
|
config.l1PublishRetryIntervalMS = 100;
|
|
520
548
|
|
|
521
549
|
const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
|
|
550
|
+
|
|
551
|
+
let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
552
|
+
let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
|
|
553
|
+
|
|
554
|
+
if (opts.mockGossipSubNetwork) {
|
|
555
|
+
mockGossipSubNetwork = new MockGossipSubNetwork();
|
|
556
|
+
p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
|
|
560
|
+
config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
|
|
522
561
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
523
|
-
config,
|
|
524
|
-
{ dateProvider, blobSinkClient, telemetry },
|
|
562
|
+
config, // REFACTOR: createAndSync mutates this config
|
|
563
|
+
{ dateProvider, blobSinkClient, telemetry, p2pClientDeps },
|
|
525
564
|
{ prefilledPublicData },
|
|
526
565
|
);
|
|
527
566
|
const sequencer = aztecNode.getSequencer();
|
|
@@ -595,6 +634,8 @@ export async function setup(
|
|
|
595
634
|
deployL1ContractsValues,
|
|
596
635
|
initialFundedAccounts,
|
|
597
636
|
logger,
|
|
637
|
+
mockGossipSubNetwork,
|
|
638
|
+
prefilledPublicData,
|
|
598
639
|
proverNode,
|
|
599
640
|
pxe,
|
|
600
641
|
sequencer,
|