@aztec/end-to-end 0.85.0 → 0.86.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.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -7
- package/dest/bench/client_flows/data_extractor.js +12 -7
- 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_cross_chain_messaging/cross_chain_messaging_test.js +11 -11
- package/dest/e2e_epochs/epochs_test.d.ts +2 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +4 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +22 -10
- package/dest/e2e_p2p/p2p_network.d.ts +67 -72
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +20 -61
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +9 -9
- package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -11
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +24 -23
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +3 -17
- package/dest/shared/cross_chain_test_harness.d.ts +7 -11
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +6 -11
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -10
- package/dest/shared/uniswap_l1_l2.d.ts +3 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -19
- package/dest/spartan/setup_test_wallets.js +3 -3
- package/package.json +34 -35
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
- package/src/bench/client_flows/data_extractor.ts +10 -6
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
- package/src/e2e_epochs/epochs_test.ts +4 -3
- package/src/e2e_fees/fees_test.ts +32 -10
- package/src/e2e_p2p/p2p_network.ts +28 -74
- package/src/e2e_prover/e2e_prover_test.ts +9 -14
- package/src/fixtures/l1_to_l2_messaging.ts +5 -14
- package/src/fixtures/setup_l1_contracts.ts +1 -2
- package/src/fixtures/snapshot_manager.ts +9 -11
- package/src/fixtures/utils.ts +24 -25
- package/src/shared/capture_private_execution_steps.ts +3 -19
- package/src/shared/cross_chain_test_harness.ts +14 -31
- package/src/shared/gas_portal_test_harness.ts +9 -14
- package/src/shared/uniswap_l1_l2.ts +25 -43
- package/src/spartan/setup_test_wallets.ts +3 -3
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createLogger,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
13
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
14
|
-
import { type
|
|
14
|
+
import { type ExtendedViemWalletClient, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
15
15
|
import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
16
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
17
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
@@ -39,7 +39,7 @@ export class CrossChainMessagingTest {
|
|
|
39
39
|
pxe!: PXE;
|
|
40
40
|
aztecNodeConfig!: AztecNodeConfig;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
l1Client!: ExtendedViemWalletClient | undefined;
|
|
43
43
|
|
|
44
44
|
user1Wallet!: AccountWallet;
|
|
45
45
|
user2Wallet!: AccountWallet;
|
|
@@ -109,22 +109,19 @@ export class CrossChainMessagingTest {
|
|
|
109
109
|
this.logger.verbose(`Public deploy accounts...`);
|
|
110
110
|
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 3));
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
113
113
|
|
|
114
|
-
const underlyingERC20Address = await deployL1Contract(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
['Underlying', 'UND', walletClient.account.address],
|
|
120
|
-
).then(({ address }) => address);
|
|
114
|
+
const underlyingERC20Address = await deployL1Contract(this.l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
115
|
+
'Underlying',
|
|
116
|
+
'UND',
|
|
117
|
+
this.l1Client.account.address,
|
|
118
|
+
]).then(({ address }) => address);
|
|
121
119
|
|
|
122
120
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
123
121
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
124
122
|
this.aztecNode,
|
|
125
123
|
this.pxe,
|
|
126
|
-
|
|
127
|
-
walletClient,
|
|
124
|
+
this.l1Client,
|
|
128
125
|
this.wallets[0],
|
|
129
126
|
this.logger,
|
|
130
127
|
underlyingERC20Address,
|
|
@@ -143,17 +140,17 @@ export class CrossChainMessagingTest {
|
|
|
143
140
|
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
144
141
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
145
142
|
|
|
146
|
-
const
|
|
143
|
+
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
147
144
|
|
|
148
145
|
const inbox = getContract({
|
|
149
146
|
address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
|
|
150
147
|
abi: InboxAbi,
|
|
151
|
-
client:
|
|
148
|
+
client: l1Client,
|
|
152
149
|
});
|
|
153
150
|
const outbox = getContract({
|
|
154
151
|
address: this.aztecNodeConfig.l1Contracts.outboxAddress.toString(),
|
|
155
152
|
abi: OutboxAbi,
|
|
156
|
-
client:
|
|
153
|
+
client: l1Client,
|
|
157
154
|
});
|
|
158
155
|
|
|
159
156
|
this.crossChainTestHarness = new CrossChainTestHarness(
|
|
@@ -165,13 +162,12 @@ export class CrossChainMessagingTest {
|
|
|
165
162
|
this.ethAccount,
|
|
166
163
|
tokenPortalAddress,
|
|
167
164
|
crossChainContext.underlying,
|
|
168
|
-
|
|
169
|
-
walletClient,
|
|
165
|
+
l1Client,
|
|
170
166
|
this.aztecNodeConfig.l1Contracts,
|
|
171
167
|
this.user1Wallet,
|
|
172
168
|
);
|
|
173
169
|
|
|
174
|
-
this.
|
|
170
|
+
this.l1Client = l1Client;
|
|
175
171
|
this.inbox = inbox;
|
|
176
172
|
this.outbox = outbox;
|
|
177
173
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
2
|
import { Fr, type Logger, MerkleTreeId, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
3
|
+
import type { ViemClient } from '@aztec/ethereum';
|
|
3
4
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
5
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
5
6
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
@@ -12,7 +13,7 @@ import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
|
12
13
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
13
14
|
|
|
14
15
|
import { join } from 'path';
|
|
15
|
-
import type { Hex
|
|
16
|
+
import type { Hex } from 'viem';
|
|
16
17
|
|
|
17
18
|
import {
|
|
18
19
|
type EndToEndContext,
|
|
@@ -40,7 +41,7 @@ export type EpochsTestOpts = Partial<
|
|
|
40
41
|
*/
|
|
41
42
|
export class EpochsTestContext {
|
|
42
43
|
public context!: EndToEndContext;
|
|
43
|
-
public l1Client!:
|
|
44
|
+
public l1Client!: ViemClient;
|
|
44
45
|
public rollup!: RollupContract;
|
|
45
46
|
public constants!: L1RollupConstants;
|
|
46
47
|
public logger!: Logger;
|
|
@@ -92,7 +93,7 @@ export class EpochsTestContext {
|
|
|
92
93
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
93
94
|
this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
|
|
94
95
|
this.logger = context.logger;
|
|
95
|
-
this.l1Client = context.deployL1ContractsValues.
|
|
96
|
+
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
96
97
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
97
98
|
|
|
98
99
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
@@ -10,7 +10,13 @@ import {
|
|
|
10
10
|
} from '@aztec/aztec.js';
|
|
11
11
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
12
12
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type DeployL1ContractsArgs,
|
|
15
|
+
RollupContract,
|
|
16
|
+
createExtendedL1Client,
|
|
17
|
+
getPublicClient,
|
|
18
|
+
l1Artifacts,
|
|
19
|
+
} from '@aztec/ethereum';
|
|
14
20
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
15
21
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
22
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -140,6 +146,26 @@ export class FeesTest {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
|
|
149
|
+
async getBlockRewards() {
|
|
150
|
+
const rewardDistributor = getContract({
|
|
151
|
+
address: this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
152
|
+
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
153
|
+
client: this.context.deployL1ContractsValues.l1Client,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
157
|
+
|
|
158
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
159
|
+
EthAddress.fromString(rewardDistributor.address),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
163
|
+
const sequencerBlockRewards = toDistribute / 2n;
|
|
164
|
+
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
165
|
+
|
|
166
|
+
return { sequencerBlockRewards, proverBlockRewards };
|
|
167
|
+
}
|
|
168
|
+
|
|
143
169
|
async mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint) {
|
|
144
170
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, address);
|
|
145
171
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
@@ -209,8 +235,7 @@ export class FeesTest {
|
|
|
209
235
|
aztecNode: context.aztecNode,
|
|
210
236
|
aztecNodeAdmin: context.aztecNode,
|
|
211
237
|
pxeService: context.pxe,
|
|
212
|
-
|
|
213
|
-
walletClient: context.deployL1ContractsValues.walletClient,
|
|
238
|
+
l1Client: context.deployL1ContractsValues.l1Client,
|
|
214
239
|
wallet: this.aliceWallet,
|
|
215
240
|
logger: this.logger,
|
|
216
241
|
});
|
|
@@ -269,21 +294,18 @@ export class FeesTest {
|
|
|
269
294
|
this.bananaFPC = bananaFPC;
|
|
270
295
|
|
|
271
296
|
this.getCoinbaseBalance = async () => {
|
|
272
|
-
const
|
|
297
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
273
298
|
const gasL1 = getContract({
|
|
274
299
|
address: data.l1FeeJuiceAddress.toString(),
|
|
275
300
|
abi: TestERC20Abi,
|
|
276
|
-
client:
|
|
301
|
+
client: l1Client,
|
|
277
302
|
});
|
|
278
303
|
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
279
304
|
};
|
|
280
305
|
|
|
281
306
|
this.getCoinbaseSequencerRewards = async () => {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
285
|
-
});
|
|
286
|
-
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
307
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
308
|
+
const rollup = new RollupContract(l1Client, data.rollupAddress);
|
|
287
309
|
return await rollup.getSequencerRewards(this.coinbase);
|
|
288
310
|
};
|
|
289
311
|
|
|
@@ -2,8 +2,13 @@ import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
type ExtendedViemWalletClient,
|
|
7
|
+
L1TxUtils,
|
|
8
|
+
RollupContract,
|
|
9
|
+
getExpectedAddress,
|
|
10
|
+
getL1ContractsConfigEnvVars,
|
|
11
|
+
} from '@aztec/ethereum';
|
|
7
12
|
import { ChainMonitor, EthCheatCodesWithState } from '@aztec/ethereum/test';
|
|
8
13
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
9
14
|
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -66,10 +71,6 @@ export class P2PNetworkTest {
|
|
|
66
71
|
|
|
67
72
|
public bootstrapNode?: BootstrapNode;
|
|
68
73
|
|
|
69
|
-
private cleanupInterval: NodeJS.Timeout | undefined = undefined;
|
|
70
|
-
|
|
71
|
-
private gasUtils: L1TxUtilsWithBlobs | undefined = undefined;
|
|
72
|
-
|
|
73
74
|
constructor(
|
|
74
75
|
testName: string,
|
|
75
76
|
public bootstrapNodeEnr: string,
|
|
@@ -147,32 +148,6 @@ export class P2PNetworkTest {
|
|
|
147
148
|
return this.deployedAccounts[0];
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
/**
|
|
151
|
-
* Start a loop to sync the mock system time with the L1 block time
|
|
152
|
-
*/
|
|
153
|
-
public startSyncMockSystemTimeInterval() {
|
|
154
|
-
this.cleanupInterval = setInterval(() => {
|
|
155
|
-
void this.syncMockSystemTime().catch(err => this.logger.error('Error syncing mock system time', err));
|
|
156
|
-
}, l1ContractsConfig.aztecSlotDuration * 1000);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* When using fake timers, we need to keep the system and anvil clocks in sync.
|
|
161
|
-
*/
|
|
162
|
-
public async syncMockSystemTime() {
|
|
163
|
-
this.logger.info('Syncing mock system time');
|
|
164
|
-
const { dateProvider, deployL1ContractsValues } = this.ctx!;
|
|
165
|
-
// Send a tx and only update the time after the tx is mined, as eth time is not continuous
|
|
166
|
-
const { receipt } = await this.gasUtils!.sendAndMonitorTransaction({
|
|
167
|
-
to: this.baseAccount.address,
|
|
168
|
-
data: '0x',
|
|
169
|
-
value: 1n,
|
|
170
|
-
});
|
|
171
|
-
const timestamp = await deployL1ContractsValues.publicClient.getBlock({ blockNumber: receipt.blockNumber });
|
|
172
|
-
this.logger.info(`Timestamp: ${timestamp.timestamp}`);
|
|
173
|
-
dateProvider.setTime(Number(timestamp.timestamp) * 1000);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
151
|
async addBootstrapNode() {
|
|
177
152
|
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
|
|
178
153
|
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
@@ -215,14 +190,13 @@ export class P2PNetworkTest {
|
|
|
215
190
|
|
|
216
191
|
async applyBaseSnapshots() {
|
|
217
192
|
await this.addBootstrapNode();
|
|
218
|
-
|
|
219
193
|
await this.snapshotManager.snapshot(
|
|
220
194
|
'add-validators',
|
|
221
195
|
async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider }) => {
|
|
222
196
|
const rollup = getContract({
|
|
223
197
|
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
224
198
|
abi: RollupAbi,
|
|
225
|
-
client: deployL1ContractsValues.
|
|
199
|
+
client: deployL1ContractsValues.l1Client,
|
|
226
200
|
});
|
|
227
201
|
|
|
228
202
|
this.logger.verbose(`Adding ${this.numberOfNodes} validators`);
|
|
@@ -230,26 +204,23 @@ export class P2PNetworkTest {
|
|
|
230
204
|
const stakingAsset = getContract({
|
|
231
205
|
address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
232
206
|
abi: TestERC20Abi,
|
|
233
|
-
client: deployL1ContractsValues.
|
|
207
|
+
client: deployL1ContractsValues.l1Client,
|
|
234
208
|
});
|
|
235
209
|
|
|
236
210
|
const stakeNeeded = l1ContractsConfig.minimumStake * BigInt(this.numberOfNodes);
|
|
237
211
|
await Promise.all(
|
|
238
212
|
[
|
|
239
|
-
await stakingAsset.write.mint(
|
|
240
|
-
[deployL1ContractsValues.walletClient.account.address, stakeNeeded],
|
|
241
|
-
{} as any,
|
|
242
|
-
),
|
|
213
|
+
await stakingAsset.write.mint([deployL1ContractsValues.l1Client.account.address, stakeNeeded], {} as any),
|
|
243
214
|
await stakingAsset.write.approve(
|
|
244
215
|
[deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(), stakeNeeded],
|
|
245
216
|
{} as any,
|
|
246
217
|
),
|
|
247
|
-
].map(txHash => deployL1ContractsValues.
|
|
218
|
+
].map(txHash => deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash })),
|
|
248
219
|
);
|
|
249
220
|
|
|
250
221
|
const { validators } = this.getValidators();
|
|
251
222
|
this.validators = validators;
|
|
252
|
-
await deployL1ContractsValues.
|
|
223
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
253
224
|
hash: await rollup.write.cheat__InitialiseValidatorSet([this.validators]),
|
|
254
225
|
});
|
|
255
226
|
|
|
@@ -263,13 +234,7 @@ export class P2PNetworkTest {
|
|
|
263
234
|
}
|
|
264
235
|
|
|
265
236
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
266
|
-
await deployL1ContractsValues.
|
|
267
|
-
hash: await deployL1ContractsValues.walletClient.sendTransaction({
|
|
268
|
-
to: this.baseAccount.address,
|
|
269
|
-
value: 1n,
|
|
270
|
-
account: this.baseAccount,
|
|
271
|
-
}),
|
|
272
|
-
});
|
|
237
|
+
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
273
238
|
|
|
274
239
|
// Set the system time in the node, only after we have warped the time and waited for a block
|
|
275
240
|
// Time is only set in the NEXT block
|
|
@@ -315,14 +280,8 @@ export class P2PNetworkTest {
|
|
|
315
280
|
'remove-inital-validator',
|
|
316
281
|
async ({ deployL1ContractsValues, aztecNode, dateProvider }) => {
|
|
317
282
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
318
|
-
const receipt = await deployL1ContractsValues.
|
|
319
|
-
|
|
320
|
-
to: this.baseAccount.address,
|
|
321
|
-
value: 1n,
|
|
322
|
-
account: this.baseAccount,
|
|
323
|
-
}),
|
|
324
|
-
});
|
|
325
|
-
const block = await deployL1ContractsValues.publicClient.getBlock({
|
|
283
|
+
const { receipt } = await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
284
|
+
const block = await deployL1ContractsValues.l1Client.getBlock({
|
|
326
285
|
blockNumber: receipt.blockNumber,
|
|
327
286
|
});
|
|
328
287
|
dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
@@ -332,6 +291,18 @@ export class P2PNetworkTest {
|
|
|
332
291
|
);
|
|
333
292
|
}
|
|
334
293
|
|
|
294
|
+
async sendDummyTx() {
|
|
295
|
+
return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private async _sendDummyTx(l1Client: ExtendedViemWalletClient) {
|
|
299
|
+
const l1TxUtils = new L1TxUtils(l1Client);
|
|
300
|
+
return await l1TxUtils.sendAndMonitorTransaction({
|
|
301
|
+
to: l1Client.account!.address,
|
|
302
|
+
value: 1n,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
335
306
|
async setup() {
|
|
336
307
|
this.ctx = await this.snapshotManager.setup();
|
|
337
308
|
|
|
@@ -341,22 +312,8 @@ export class P2PNetworkTest {
|
|
|
341
312
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
342
313
|
this.prefilledPublicData = prefilledPublicData;
|
|
343
314
|
|
|
344
|
-
this.startSyncMockSystemTimeInterval();
|
|
345
|
-
|
|
346
|
-
this.gasUtils = new L1TxUtilsWithBlobs(
|
|
347
|
-
this.ctx.deployL1ContractsValues.publicClient,
|
|
348
|
-
this.ctx.deployL1ContractsValues.walletClient,
|
|
349
|
-
this.logger,
|
|
350
|
-
{
|
|
351
|
-
gasLimitBufferPercentage: 20,
|
|
352
|
-
maxGwei: 500n,
|
|
353
|
-
maxAttempts: 3,
|
|
354
|
-
checkIntervalMs: 100,
|
|
355
|
-
stallTimeMs: 1000,
|
|
356
|
-
},
|
|
357
|
-
);
|
|
358
|
-
|
|
359
315
|
this.monitor = new ChainMonitor(RollupContract.getFromL1ContractsValues(this.ctx.deployL1ContractsValues)).start();
|
|
316
|
+
this.monitor.on('l1-block', ({ timestamp }) => this.ctx.dateProvider.setTime(Number(timestamp) * 1000));
|
|
360
317
|
}
|
|
361
318
|
|
|
362
319
|
async stopNodes(nodes: AztecNodeService[]) {
|
|
@@ -376,8 +333,5 @@ export class P2PNetworkTest {
|
|
|
376
333
|
this.monitor.stop();
|
|
377
334
|
await this.bootstrapNode?.stop();
|
|
378
335
|
await this.snapshotManager.teardown();
|
|
379
|
-
if (this.cleanupInterval) {
|
|
380
|
-
clearInterval(this.cleanupInterval);
|
|
381
|
-
}
|
|
382
336
|
}
|
|
383
337
|
}
|
|
@@ -282,7 +282,7 @@ export class FullProverTest {
|
|
|
282
282
|
this.logger.verbose('Starting prover node');
|
|
283
283
|
const proverConfig: ProverNodeConfig = {
|
|
284
284
|
...this.context.aztecNodeConfig,
|
|
285
|
-
|
|
285
|
+
proverCoordinationNodeUrls: [],
|
|
286
286
|
dataDirectory: undefined,
|
|
287
287
|
proverId: this.proverAddress.toField(),
|
|
288
288
|
realProofs: this.realProofs,
|
|
@@ -291,9 +291,9 @@ export class FullProverTest {
|
|
|
291
291
|
proverNodeMaxPendingJobs: 100,
|
|
292
292
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
293
293
|
proverNodePollingIntervalMs: 100,
|
|
294
|
-
txGatheringTimeoutMs: 60000,
|
|
295
294
|
txGatheringIntervalMs: 1000,
|
|
296
|
-
|
|
295
|
+
txGatheringBatchSize: 10,
|
|
296
|
+
txGatheringMaxParallelRequestsPerNode: 100,
|
|
297
297
|
};
|
|
298
298
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
299
299
|
const { prefilledPublicData } = await getGenesisValues(
|
|
@@ -308,7 +308,7 @@ export class FullProverTest {
|
|
|
308
308
|
},
|
|
309
309
|
{ prefilledPublicData },
|
|
310
310
|
);
|
|
311
|
-
this.proverNode.start();
|
|
311
|
+
await this.proverNode.start();
|
|
312
312
|
|
|
313
313
|
this.logger.warn(`Proofs are now enabled`);
|
|
314
314
|
return this;
|
|
@@ -316,10 +316,10 @@ export class FullProverTest {
|
|
|
316
316
|
|
|
317
317
|
private async mintL1ERC20(recipient: Hex, amount: bigint) {
|
|
318
318
|
const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
|
|
319
|
-
const client = this.context.deployL1ContractsValues.
|
|
319
|
+
const client = this.context.deployL1ContractsValues.l1Client;
|
|
320
320
|
const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
|
|
321
321
|
const hash = await erc20.write.mint([recipient, amount]);
|
|
322
|
-
await this.context.deployL1ContractsValues.
|
|
322
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
snapshot = <T>(
|
|
@@ -399,19 +399,14 @@ export class FullProverTest {
|
|
|
399
399
|
throw new Error('No verifier');
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
const {
|
|
402
|
+
const { l1Client, l1ContractAddresses } = this.context.deployL1ContractsValues;
|
|
403
403
|
const rollup = getContract({
|
|
404
404
|
abi: RollupAbi,
|
|
405
405
|
address: l1ContractAddresses.rollupAddress.toString(),
|
|
406
|
-
client:
|
|
406
|
+
client: l1Client,
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
-
const { address: verifierAddress } = await deployL1Contract(
|
|
410
|
-
walletClient,
|
|
411
|
-
publicClient,
|
|
412
|
-
HonkVerifierAbi,
|
|
413
|
-
HonkVerifierBytecode,
|
|
414
|
-
);
|
|
409
|
+
const { address: verifierAddress } = await deployL1Contract(l1Client, HonkVerifierAbi, HonkVerifierBytecode);
|
|
415
410
|
this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
|
|
416
411
|
|
|
417
412
|
await rollup.write.setEpochVerifier([verifierAddress.toString()]);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type L1ContractAddresses,
|
|
3
|
-
RollupContract,
|
|
4
|
-
type ViemPublicClient,
|
|
5
|
-
type ViemWalletClient,
|
|
6
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
|
|
7
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
8
3
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
9
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -14,23 +9,19 @@ import { decodeEventLog, getContract } from 'viem';
|
|
|
14
9
|
export async function sendL1ToL2Message(
|
|
15
10
|
message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
|
|
16
11
|
ctx: {
|
|
17
|
-
|
|
18
|
-
publicClient: ViemPublicClient;
|
|
12
|
+
l1Client: ExtendedViemWalletClient;
|
|
19
13
|
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
20
14
|
},
|
|
21
15
|
) {
|
|
22
16
|
const inbox = getContract({
|
|
23
17
|
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
24
18
|
abi: InboxAbi,
|
|
25
|
-
client: ctx.
|
|
19
|
+
client: ctx.l1Client,
|
|
26
20
|
});
|
|
27
21
|
|
|
28
22
|
const { recipient, content, secretHash } = message;
|
|
29
23
|
|
|
30
|
-
const version = await new RollupContract(
|
|
31
|
-
ctx.publicClient,
|
|
32
|
-
ctx.l1ContractAddresses.rollupAddress.toString(),
|
|
33
|
-
).getVersion();
|
|
24
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
34
25
|
|
|
35
26
|
// We inject the message to Inbox
|
|
36
27
|
const txHash = await inbox.write.sendL2Message([
|
|
@@ -40,7 +31,7 @@ export async function sendL1ToL2Message(
|
|
|
40
31
|
]);
|
|
41
32
|
|
|
42
33
|
// We check that the message was correctly injected by checking the emitted event
|
|
43
|
-
const txReceipt = await ctx.
|
|
34
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
|
|
44
35
|
|
|
45
36
|
// Exactly 1 event should be emitted in the transaction
|
|
46
37
|
expect(txReceipt.logs.length).toBe(1);
|
|
@@ -12,8 +12,7 @@ export const setupL1Contracts = async (
|
|
|
12
12
|
l1RpcUrl: string,
|
|
13
13
|
account: HDAccount | PrivateKeyAccount,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | '
|
|
16
|
-
L1ContractsConfig,
|
|
15
|
+
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'initialValidators'> & L1ContractsConfig,
|
|
17
16
|
) => {
|
|
18
17
|
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
18
|
vkTreeRoot: getVKTreeRoot(),
|
|
@@ -20,7 +20,7 @@ import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/serv
|
|
|
20
20
|
import {
|
|
21
21
|
type DeployL1ContractsArgs,
|
|
22
22
|
type DeployL1ContractsReturnType,
|
|
23
|
-
|
|
23
|
+
createExtendedL1Client,
|
|
24
24
|
getL1ContractsConfigEnvVars,
|
|
25
25
|
l1Artifacts,
|
|
26
26
|
} from '@aztec/ethereum';
|
|
@@ -348,7 +348,7 @@ async function setupFromFresh(
|
|
|
348
348
|
|
|
349
349
|
const initialFundedAccounts = await generateSchnorrAccounts(numberOfInitialFundedAccounts);
|
|
350
350
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
351
|
-
const { genesisArchiveRoot,
|
|
351
|
+
const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
|
|
352
352
|
initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
353
353
|
opts.initialAccountFeeJuice,
|
|
354
354
|
);
|
|
@@ -356,7 +356,6 @@ async function setupFromFresh(
|
|
|
356
356
|
const deployL1ContractsValues = await setupL1Contracts(aztecNodeConfig.l1RpcUrls[0], hdAccount, logger, {
|
|
357
357
|
...getL1ContractsConfigEnvVars(),
|
|
358
358
|
genesisArchiveRoot,
|
|
359
|
-
genesisBlockHash,
|
|
360
359
|
feeJuicePortalInitialBalance: fundingNeeded,
|
|
361
360
|
salt: opts.salt,
|
|
362
361
|
...deployL1ContractsArgs,
|
|
@@ -371,7 +370,7 @@ async function setupFromFresh(
|
|
|
371
370
|
const rewardDistributor = getContract({
|
|
372
371
|
address: deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
373
372
|
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
374
|
-
client: deployL1ContractsValues.
|
|
373
|
+
client: deployL1ContractsValues.l1Client,
|
|
375
374
|
});
|
|
376
375
|
|
|
377
376
|
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
@@ -380,18 +379,18 @@ async function setupFromFresh(
|
|
|
380
379
|
const feeJuice = getContract({
|
|
381
380
|
address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
|
|
382
381
|
abi: l1Artifacts.feeAsset.contractAbi,
|
|
383
|
-
client: deployL1ContractsValues.
|
|
382
|
+
client: deployL1ContractsValues.l1Client,
|
|
384
383
|
});
|
|
385
384
|
|
|
386
385
|
const rewardDistributorMintTxHash = await feeJuice.write.mint([rewardDistributor.address, mintAmount], {} as any);
|
|
387
|
-
await deployL1ContractsValues.
|
|
386
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
|
|
388
387
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
const watcher = new AnvilTestWatcher(
|
|
392
391
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
393
392
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
394
|
-
deployL1ContractsValues.
|
|
393
|
+
deployL1ContractsValues.l1Client,
|
|
395
394
|
);
|
|
396
395
|
await watcher.start();
|
|
397
396
|
|
|
@@ -522,12 +521,12 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
522
521
|
}
|
|
523
522
|
|
|
524
523
|
logger.verbose('Creating ETH clients...');
|
|
525
|
-
const
|
|
524
|
+
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
526
525
|
|
|
527
526
|
const watcher = new AnvilTestWatcher(
|
|
528
527
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
529
528
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
530
|
-
|
|
529
|
+
l1Client,
|
|
531
530
|
);
|
|
532
531
|
await watcher.start();
|
|
533
532
|
|
|
@@ -583,8 +582,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
583
582
|
bbConfig,
|
|
584
583
|
proverNode,
|
|
585
584
|
deployL1ContractsValues: {
|
|
586
|
-
|
|
587
|
-
publicClient,
|
|
585
|
+
l1Client,
|
|
588
586
|
l1ContractAddresses: aztecNodeConfig.l1Contracts,
|
|
589
587
|
},
|
|
590
588
|
watcher,
|