@aztec/end-to-end 0.0.1-commit.04852196a → 0.0.1-commit.04d373f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dest/bench/client_flows/benchmark.d.ts +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +17 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +27 -38
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +2 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +5 -4
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +14 -5
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +15 -4
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +39 -7
- package/dest/e2e_deploy_contract/deploy_test.d.ts +3 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -1
- package/dest/e2e_epochs/epochs_test.d.ts +25 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +88 -14
- package/dest/e2e_fees/fees_test.d.ts +5 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +32 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +2 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +5 -3
- package/dest/e2e_p2p/p2p_network.d.ts +10 -9
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +46 -27
- package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +42 -13
- package/dest/e2e_p2p/shared.d.ts +16 -12
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +57 -57
- package/dest/e2e_token_contract/token_contract_test.d.ts +3 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +4 -2
- package/dest/fixtures/authwit_proxy.d.ts +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +6 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +9 -13
- package/dest/fixtures/fixtures.d.ts +73 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +68 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +2 -2
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +43 -11
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +135 -26
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +8 -8
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +2 -5
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +4 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +9 -5
- package/dest/shared/gas_portal_test_harness.d.ts +8 -5
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +17 -8
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +55 -34
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +24 -12
- package/dest/simulators/token_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +73 -41
- package/dest/spartan/tx_metrics.d.ts +18 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +73 -20
- package/dest/spartan/utils/config.d.ts +9 -32
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +1 -0
- package/dest/spartan/utils/index.d.ts +2 -1
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +2 -0
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +25 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +146 -87
- package/dest/test-wallet/utils.d.ts +3 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +2 -7
- package/dest/test-wallet/wallet_worker_script.js +2 -2
- package/dest/test-wallet/worker_wallet.d.ts +5 -4
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +5 -1
- package/dest/test-wallet/worker_wallet_schema.d.ts +110 -224
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +14 -2
- package/package.json +46 -42
- package/src/bench/client_flows/benchmark.ts +19 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +64 -53
- package/src/bench/utils.ts +2 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +24 -10
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +49 -11
- package/src/e2e_deploy_contract/deploy_test.ts +3 -2
- package/src/e2e_epochs/epochs_test.ts +99 -11
- package/src/e2e_fees/fees_test.ts +37 -4
- package/src/e2e_nested_contract/nested_contract_test.ts +3 -1
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -3
- package/src/e2e_p2p/p2p_network.ts +57 -39
- package/src/e2e_p2p/reqresp/utils.ts +51 -12
- package/src/e2e_p2p/shared.ts +57 -72
- package/src/e2e_token_contract/token_contract_test.ts +12 -2
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +15 -18
- package/src/fixtures/fixtures.ts +86 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +171 -31
- package/src/fixtures/setup_p2p_test.ts +13 -9
- package/src/fixtures/token_utils.ts +1 -4
- package/src/fixtures/utils.ts +2 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +0 -2
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/shared/cross_chain_test_harness.ts +14 -4
- package/src/shared/gas_portal_test_harness.ts +20 -10
- package/src/shared/uniswap_l1_l2.ts +71 -46
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +28 -12
- package/src/simulators/token_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +98 -37
- package/src/spartan/tx_metrics.ts +81 -23
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +3 -0
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +174 -104
- package/src/test-wallet/utils.ts +3 -7
- package/src/test-wallet/wallet_worker_script.ts +2 -2
- package/src/test-wallet/worker_wallet.ts +9 -4
- package/src/test-wallet/worker_wallet_schema.ts +2 -2
|
@@ -14,7 +14,7 @@ import path from 'path';
|
|
|
14
14
|
|
|
15
15
|
import { getBootNodeUdpPort, shouldCollectMetrics } from '../../fixtures/fixtures.js';
|
|
16
16
|
import { createNodes } from '../../fixtures/setup_p2p_test.js';
|
|
17
|
-
import { P2PNetworkTest
|
|
17
|
+
import { P2PNetworkTest } from '../p2p_network.js';
|
|
18
18
|
import { prepareTransactions } from '../shared.js';
|
|
19
19
|
|
|
20
20
|
// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
|
|
@@ -49,6 +49,10 @@ export async function createReqrespTest(options: ReqrespOptions = {}): Promise<P
|
|
|
49
49
|
...(disableStatusHandshake ? { p2pDisableStatusHandshake: true } : {}),
|
|
50
50
|
listenAddress: '127.0.0.1',
|
|
51
51
|
aztecEpochDuration: 64, // stable committee
|
|
52
|
+
// Pipelining: target-slot is one ahead of build-slot; inboxLag sources L1->L2
|
|
53
|
+
// messages from the previous checkpoint to avoid L1ToL2MessagesNotReadyError.
|
|
54
|
+
enableProposerPipelining: true,
|
|
55
|
+
inboxLag: 2,
|
|
52
56
|
},
|
|
53
57
|
});
|
|
54
58
|
await t.setup();
|
|
@@ -91,7 +95,7 @@ export async function runReqrespTxTest(params: {
|
|
|
91
95
|
t.bootstrapNodeEnr,
|
|
92
96
|
NUM_VALIDATORS,
|
|
93
97
|
BOOT_NODE_UDP_PORT,
|
|
94
|
-
t.
|
|
98
|
+
t.genesis,
|
|
95
99
|
dataDir,
|
|
96
100
|
shouldCollectMetrics(),
|
|
97
101
|
);
|
|
@@ -125,7 +129,15 @@ export async function runReqrespTxTest(params: {
|
|
|
125
129
|
t.ctx.dateProvider.setTime(Number(timestamp) * 1000);
|
|
126
130
|
const startSlotTimestamp = BigInt(timestamp);
|
|
127
131
|
|
|
128
|
-
|
|
132
|
+
// Under pipelining the active builder during wallclock slot S targets slot S+1, so
|
|
133
|
+
// we must address the proposer of S+1 (not S) for batch 0. Shift the proposer lookup
|
|
134
|
+
// window by the pipelining offset so we always send to the currently-building proposer.
|
|
135
|
+
const proposerSlotOffset = t.ctx.aztecNodeConfig.enableProposerPipelining ? 1 : 0;
|
|
136
|
+
const { proposerIndexes, nodesToTurnOffTxGossip } = await getProposerIndexes(
|
|
137
|
+
t,
|
|
138
|
+
startSlotTimestamp,
|
|
139
|
+
proposerSlotOffset,
|
|
140
|
+
);
|
|
129
141
|
t.logger.info(`Turning off tx gossip for nodes: ${nodesToTurnOffTxGossip.map(getNodePort)}`);
|
|
130
142
|
t.logger.info(`Sending txs to proposer nodes: ${proposerIndexes.map(getNodePort)}`);
|
|
131
143
|
|
|
@@ -149,6 +161,13 @@ export async function runReqrespTxTest(params: {
|
|
|
149
161
|
const submittedTxs = await Promise.all(
|
|
150
162
|
txBatches.map(async (batch, batchIndex) => {
|
|
151
163
|
const proposerNode = nodes[proposerIndexes[batchIndex]];
|
|
164
|
+
for (const tx of batch) {
|
|
165
|
+
t.logger.info(`Tx ${tx.getTxHash().toString()} base64: ${tx.toBuffer().toString('base64')}`);
|
|
166
|
+
}
|
|
167
|
+
const txHashes = batch.map(tx => tx.getTxHash().toString());
|
|
168
|
+
t.logger.info(
|
|
169
|
+
`Sending batch ${batchIndex} to proposer ${getNodePort(proposerIndexes[batchIndex])}: ${txHashes.join(', ')}`,
|
|
170
|
+
);
|
|
152
171
|
await Promise.all(
|
|
153
172
|
batch.map(async tx => {
|
|
154
173
|
try {
|
|
@@ -163,12 +182,23 @@ export async function runReqrespTxTest(params: {
|
|
|
163
182
|
}),
|
|
164
183
|
);
|
|
165
184
|
|
|
185
|
+
// Log pool state per node after sending
|
|
186
|
+
for (let i = 0; i < NUM_VALIDATORS; i++) {
|
|
187
|
+
const count = await nodes[i].getPendingTxCount();
|
|
188
|
+
t.logger.info(`Node ${getNodePort(i)} pool has ${count} pending txs`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Use the test's own aztecSlotDuration (not the env default that p2p_network's
|
|
192
|
+
// WAIT_FOR_TX_TIMEOUT is derived from) so the timeout scales with this test's 36s slot.
|
|
193
|
+
// Under pipelining the round-trip is roughly build-slot + target-slot + L1 publish, so
|
|
194
|
+
// budget for >= 3 slots.
|
|
195
|
+
const waitForTxTimeout = t.ctx.aztecNodeConfig.aztecSlotDuration * 4.5;
|
|
166
196
|
t.logger.info('Waiting for all transactions to be mined');
|
|
167
197
|
await Promise.all(
|
|
168
198
|
submittedTxs.flatMap((batch, batchIndex) =>
|
|
169
199
|
batch.map(async (submittedTx, txIndex) => {
|
|
170
200
|
t.logger.info(`Waiting for tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} to be mined`);
|
|
171
|
-
await waitForTx(submittedTx.node, submittedTx.txHash, { timeout:
|
|
201
|
+
await waitForTx(submittedTx.node, submittedTx.txHash, { timeout: waitForTxTimeout });
|
|
172
202
|
t.logger.info(`Tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} has been mined`);
|
|
173
203
|
}),
|
|
174
204
|
),
|
|
@@ -178,20 +208,29 @@ export async function runReqrespTxTest(params: {
|
|
|
178
208
|
|
|
179
209
|
// Assert that multiple blocks were built for at least one slot
|
|
180
210
|
t.logger.info('Verifying multiple blocks for at least one checkpoint');
|
|
181
|
-
|
|
182
|
-
|
|
211
|
+
// Wait for L1 checkpoint sync, which may lag behind P2P block propagation.
|
|
212
|
+
const checkpoints = await retryUntil(
|
|
213
|
+
async () => {
|
|
214
|
+
const cps = await nodes[0].getCheckpoints(CheckpointNumber(1), 50, { includeBlocks: true });
|
|
215
|
+
return cps.length > 0 && cps.some(cp => (cp.blocks?.length ?? 0) >= 2) ? cps : undefined;
|
|
216
|
+
},
|
|
217
|
+
'waiting for multi-block checkpoint to sync from L1',
|
|
218
|
+
30,
|
|
219
|
+
1,
|
|
220
|
+
);
|
|
183
221
|
|
|
184
222
|
let mbpsFound = false;
|
|
185
|
-
let expectedBlockNumber = checkpoints[0].
|
|
223
|
+
let expectedBlockNumber = checkpoints[0].blocks![0].number;
|
|
186
224
|
|
|
187
225
|
for (const published of checkpoints) {
|
|
188
|
-
const
|
|
226
|
+
const blocks = published.blocks!;
|
|
227
|
+
const blockCount = blocks.length;
|
|
189
228
|
mbpsFound = mbpsFound || blockCount >= 2;
|
|
190
229
|
|
|
191
230
|
for (let i = 0; i < blockCount; i++) {
|
|
192
|
-
const block =
|
|
231
|
+
const block = blocks[i];
|
|
193
232
|
expect(block.indexWithinCheckpoint).toBe(i);
|
|
194
|
-
expect(block.checkpointNumber).toBe(published.
|
|
233
|
+
expect(block.checkpointNumber).toBe(published.number);
|
|
195
234
|
expect(block.number).toBe(expectedBlockNumber);
|
|
196
235
|
expectedBlockNumber++;
|
|
197
236
|
}
|
|
@@ -201,7 +240,7 @@ export async function runReqrespTxTest(params: {
|
|
|
201
240
|
return nodes;
|
|
202
241
|
}
|
|
203
242
|
|
|
204
|
-
async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint) {
|
|
243
|
+
async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint, slotOffset = 0) {
|
|
205
244
|
// Get the nodes for the next set of slots
|
|
206
245
|
const rollupContract = new RollupContract(
|
|
207
246
|
t.ctx.deployL1ContractsValues.l1Client,
|
|
@@ -213,7 +252,7 @@ async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint)
|
|
|
213
252
|
|
|
214
253
|
const proposers = await Promise.all(
|
|
215
254
|
Array.from({ length: 3 }, async (_, i) => {
|
|
216
|
-
const slot = SlotNumber(startSlot + i);
|
|
255
|
+
const slot = SlotNumber(startSlot + slotOffset + i);
|
|
217
256
|
const slotTimestamp = await rollupContract.getTimestampForSlot(slot);
|
|
218
257
|
return await rollupContract.getProposerAt(slotTimestamp);
|
|
219
258
|
}),
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -7,11 +7,7 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
7
7
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
8
8
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
9
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
10
|
-
import type {
|
|
11
|
-
EmpireSlashingProposerContract,
|
|
12
|
-
RollupContract,
|
|
13
|
-
TallySlashingProposerContract,
|
|
14
|
-
} from '@aztec/ethereum/contracts';
|
|
10
|
+
import type { RollupContract, SlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
15
11
|
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
16
12
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
17
13
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -22,8 +18,8 @@ import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.j
|
|
|
22
18
|
import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
23
19
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
24
20
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
25
|
-
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
26
21
|
|
|
22
|
+
import { SchnorrHardcodedKeyAccountContract } from '../fixtures/schnorr_hardcoded_account_contract.js';
|
|
27
23
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
28
24
|
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
29
25
|
import { type ProvenTx, proveInteraction } from '../test-wallet/utils.js';
|
|
@@ -60,10 +56,17 @@ export const submitTransactions = async (
|
|
|
60
56
|
rpcConfig.proverEnabled = false;
|
|
61
57
|
const wallet = await TestWallet.create(
|
|
62
58
|
node,
|
|
63
|
-
|
|
59
|
+
// Use checkpointed chain tip to avoid anchoring on provisional blocks that the archiver can prune
|
|
60
|
+
// when their slot ends without a checkpoint landing on L1.
|
|
61
|
+
{ ...getPXEConfig(), proverEnabled: false, syncChainTip: 'checkpointed' },
|
|
64
62
|
{ loggerActorLabel: 'pxe-tx' },
|
|
65
63
|
);
|
|
66
|
-
const
|
|
64
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
65
|
+
const fundedAccountManager = await wallet.createAccount({
|
|
66
|
+
secret: fundedAccount.secret,
|
|
67
|
+
salt: fundedAccount.salt,
|
|
68
|
+
contract,
|
|
69
|
+
});
|
|
67
70
|
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
68
71
|
};
|
|
69
72
|
|
|
@@ -78,10 +81,15 @@ export async function prepareTransactions(
|
|
|
78
81
|
|
|
79
82
|
const wallet = await TestWallet.create(
|
|
80
83
|
node,
|
|
81
|
-
{ ...getPXEConfig(), proverEnabled: false },
|
|
84
|
+
{ ...getPXEConfig(), proverEnabled: false, syncChainTip: 'checkpointed' },
|
|
82
85
|
{ loggerActorLabel: 'pxe-tx' },
|
|
83
86
|
);
|
|
84
|
-
const
|
|
87
|
+
const accountContract = new SchnorrHardcodedKeyAccountContract();
|
|
88
|
+
const fundedAccountManager = await wallet.createAccount({
|
|
89
|
+
secret: fundedAccount.secret,
|
|
90
|
+
salt: fundedAccount.salt,
|
|
91
|
+
contract: accountContract,
|
|
92
|
+
});
|
|
85
93
|
|
|
86
94
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
87
95
|
salt: Fr.random(),
|
|
@@ -99,7 +107,7 @@ export async function prepareTransactions(
|
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
export function awaitProposalExecution(
|
|
102
|
-
slashingProposer:
|
|
110
|
+
slashingProposer: SlashingProposerContract,
|
|
103
111
|
timeoutSeconds: number,
|
|
104
112
|
logger: Logger,
|
|
105
113
|
): Promise<bigint> {
|
|
@@ -109,24 +117,12 @@ export function awaitProposalExecution(
|
|
|
109
117
|
reject(new Error(`Timeout waiting for proposal execution after ${timeoutSeconds}s`));
|
|
110
118
|
}, timeoutSeconds * 1000);
|
|
111
119
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
logger.warn(`Proposal ${args.payload} from round ${args.round} executed`);
|
|
115
|
-
clearTimeout(timeout);
|
|
116
|
-
unwatch();
|
|
117
|
-
resolve(args.round);
|
|
118
|
-
});
|
|
119
|
-
} else if (slashingProposer.type === 'tally') {
|
|
120
|
-
const unwatch = slashingProposer.listenToRoundExecuted(args => {
|
|
121
|
-
logger.warn(`Slash from round ${args.round} executed`);
|
|
122
|
-
clearTimeout(timeout);
|
|
123
|
-
unwatch();
|
|
124
|
-
resolve(args.round);
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
120
|
+
const unwatch = slashingProposer.listenToRoundExecuted(args => {
|
|
121
|
+
logger.warn(`Slash from round ${args.round} executed`);
|
|
127
122
|
clearTimeout(timeout);
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
unwatch();
|
|
124
|
+
resolve(args.round);
|
|
125
|
+
});
|
|
130
126
|
});
|
|
131
127
|
}
|
|
132
128
|
|
|
@@ -152,11 +148,14 @@ export async function awaitCommitteeExists({
|
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
/**
|
|
155
|
-
* Advance epochs until we find one where the target proposer is selected for at least one slot
|
|
156
|
-
*
|
|
157
|
-
*
|
|
151
|
+
* Advance epochs until we find one where the target proposer is selected for at least one slot,
|
|
152
|
+
* then stop one epoch before it. This leaves time for the caller to start sequencers before
|
|
153
|
+
* warping to the target epoch, avoiding the race where the target epoch passes before sequencers
|
|
154
|
+
* are ready.
|
|
155
|
+
*
|
|
156
|
+
* Returns the target epoch number so the caller can warp to it after starting sequencers.
|
|
158
157
|
*/
|
|
159
|
-
export async function
|
|
158
|
+
export async function advanceToEpochBeforeProposer({
|
|
160
159
|
epochCache,
|
|
161
160
|
cheatCodes,
|
|
162
161
|
targetProposer,
|
|
@@ -168,25 +167,32 @@ export async function awaitEpochWithProposer({
|
|
|
168
167
|
targetProposer: EthAddress;
|
|
169
168
|
logger: Logger;
|
|
170
169
|
maxAttempts?: number;
|
|
171
|
-
}): Promise<
|
|
170
|
+
}): Promise<{ targetEpoch: EpochNumber }> {
|
|
172
171
|
const { epochDuration } = await cheatCodes.getConfig();
|
|
173
172
|
|
|
174
173
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
175
174
|
const currentEpoch = await cheatCodes.getEpoch();
|
|
176
|
-
|
|
175
|
+
// Check the NEXT epoch's slots so we stay one epoch before the target,
|
|
176
|
+
// giving the caller time to start sequencers before the target epoch arrives.
|
|
177
|
+
const nextEpoch = Number(currentEpoch) + 1;
|
|
178
|
+
const startSlot = nextEpoch * Number(epochDuration);
|
|
177
179
|
const endSlot = startSlot + Number(epochDuration);
|
|
178
180
|
|
|
179
|
-
logger.info(
|
|
181
|
+
logger.info(
|
|
182
|
+
`Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
|
|
183
|
+
);
|
|
180
184
|
|
|
181
185
|
for (let s = startSlot; s < endSlot; s++) {
|
|
182
186
|
const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
|
|
183
187
|
if (proposer && proposer.equals(targetProposer)) {
|
|
184
|
-
logger.warn(
|
|
185
|
-
|
|
188
|
+
logger.warn(
|
|
189
|
+
`Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
|
|
190
|
+
);
|
|
191
|
+
return { targetEpoch: EpochNumber(nextEpoch) };
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
|
|
189
|
-
logger.info(`Target proposer not found in epoch ${
|
|
195
|
+
logger.info(`Target proposer not found in epoch ${nextEpoch}, advancing to next epoch`);
|
|
190
196
|
await cheatCodes.advanceToNextEpoch();
|
|
191
197
|
}
|
|
192
198
|
|
|
@@ -235,7 +241,6 @@ export async function awaitCommitteeKicked({
|
|
|
235
241
|
rollup,
|
|
236
242
|
cheatCodes,
|
|
237
243
|
committee,
|
|
238
|
-
slashFactory,
|
|
239
244
|
slashingProposer,
|
|
240
245
|
slashingRoundSize,
|
|
241
246
|
aztecSlotDuration,
|
|
@@ -246,8 +251,7 @@ export async function awaitCommitteeKicked({
|
|
|
246
251
|
rollup: RollupContract;
|
|
247
252
|
cheatCodes: RollupCheatCodes;
|
|
248
253
|
committee: readonly `0x${string}`[];
|
|
249
|
-
|
|
250
|
-
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
254
|
+
slashingProposer: SlashingProposerContract | undefined;
|
|
251
255
|
slashingRoundSize: number;
|
|
252
256
|
aztecSlotDuration: number;
|
|
253
257
|
aztecEpochDuration: number;
|
|
@@ -260,36 +264,14 @@ export async function awaitCommitteeKicked({
|
|
|
260
264
|
|
|
261
265
|
await cheatCodes.debugRollup();
|
|
262
266
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
272
|
-
return events.length > 0 ? events : undefined;
|
|
273
|
-
},
|
|
274
|
-
'slash payload created',
|
|
275
|
-
120,
|
|
276
|
-
1,
|
|
277
|
-
);
|
|
278
|
-
expect(slashPayloadEvents.length).toBe(1);
|
|
279
|
-
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
280
|
-
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
281
|
-
committee.length,
|
|
282
|
-
);
|
|
283
|
-
} else {
|
|
284
|
-
// Use the slash offset to ensure we are in the right epoch for tally
|
|
285
|
-
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
286
|
-
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
287
|
-
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
288
|
-
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
289
|
-
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
290
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
291
|
-
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
|
|
292
|
-
}
|
|
267
|
+
// Use the slash offset to ensure we are in the right epoch for tally
|
|
268
|
+
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
269
|
+
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
270
|
+
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
271
|
+
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
272
|
+
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
273
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
274
|
+
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
|
|
293
275
|
|
|
294
276
|
const attestersPre = await rollup.getAttesters();
|
|
295
277
|
expect(attestersPre.length).toBe(committee.length);
|
|
@@ -299,7 +281,10 @@ export async function awaitCommitteeKicked({
|
|
|
299
281
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
300
282
|
}
|
|
301
283
|
|
|
302
|
-
|
|
284
|
+
// Allow up to four round-lengths so that under proposer pipelining, where individual rounds
|
|
285
|
+
// sometimes fail to gather quorum because parts of the committee miss votes due to chain-state
|
|
286
|
+
// races, we still see a later round execute the slash.
|
|
287
|
+
const timeout = slashingRoundSize * 4 * aztecSlotDuration + 30;
|
|
303
288
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
304
289
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
305
290
|
|
|
@@ -7,7 +7,15 @@ import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAcc
|
|
|
7
7
|
|
|
8
8
|
import { jest } from '@jest/globals';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
type EndToEndContext,
|
|
12
|
+
type SetupOptions,
|
|
13
|
+
deployAccounts,
|
|
14
|
+
ensureAuthRegistryPublished,
|
|
15
|
+
publicDeployAccounts,
|
|
16
|
+
setup,
|
|
17
|
+
teardown,
|
|
18
|
+
} from '../fixtures/setup.js';
|
|
11
19
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
12
20
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
13
21
|
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
@@ -77,6 +85,7 @@ export class TokenContractTest {
|
|
|
77
85
|
[this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map(acc => acc.address);
|
|
78
86
|
|
|
79
87
|
this.logger.info('Applying base setup - deploying token contract');
|
|
88
|
+
await ensureAuthRegistryPublished(this.wallet, this.adminAddress);
|
|
80
89
|
this.logger.verbose(`Public deploy accounts...`);
|
|
81
90
|
await publicDeployAccounts(this.wallet, [this.adminAddress, this.account1Address]);
|
|
82
91
|
|
|
@@ -115,8 +124,9 @@ export class TokenContractTest {
|
|
|
115
124
|
);
|
|
116
125
|
}
|
|
117
126
|
|
|
118
|
-
async setup() {
|
|
127
|
+
async setup(opts: Partial<SetupOptions> = {}) {
|
|
119
128
|
this.context = await setup(0, {
|
|
129
|
+
...opts,
|
|
120
130
|
metricsPort: this.metricsPort,
|
|
121
131
|
fundSponsoredFPC: true,
|
|
122
132
|
skipAccountDeployment: true,
|
|
@@ -17,6 +17,10 @@ async function buildProxyCall(proxy: GenericProxyContract, action: ContractFunct
|
|
|
17
17
|
return proxy.methods.forward_private_3(call.to, call.selector, call.args);
|
|
18
18
|
} else if (argCount === 4) {
|
|
19
19
|
return proxy.methods.forward_private_4(call.to, call.selector, call.args);
|
|
20
|
+
} else if (argCount === 5) {
|
|
21
|
+
return proxy.methods.forward_private_5(call.to, call.selector, call.args);
|
|
22
|
+
} else if (argCount === 6) {
|
|
23
|
+
return proxy.methods.forward_private_6(call.to, call.selector, call.args);
|
|
20
24
|
}
|
|
21
25
|
throw new Error(`No forward_private_${argCount} method on proxy`);
|
|
22
26
|
}
|
|
@@ -4,12 +4,7 @@ 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';
|
|
6
6
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
7
|
-
import {
|
|
8
|
-
BBCircuitVerifier,
|
|
9
|
-
type ClientProtocolCircuitVerifier,
|
|
10
|
-
QueuedIVCVerifier,
|
|
11
|
-
TestCircuitVerifier,
|
|
12
|
-
} from '@aztec/bb-prover';
|
|
7
|
+
import type { ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
13
8
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
9
|
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
15
10
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -29,6 +24,7 @@ import { getACVMConfig } from './get_acvm_config.js';
|
|
|
29
24
|
import { getBBConfig } from './get_bb_config.js';
|
|
30
25
|
import {
|
|
31
26
|
type EndToEndContext,
|
|
27
|
+
type SetupOptions,
|
|
32
28
|
deployAccounts,
|
|
33
29
|
getPrivateKeyFromIndex,
|
|
34
30
|
getSponsoredFPCAddress,
|
|
@@ -68,7 +64,10 @@ export class FullProverTest {
|
|
|
68
64
|
private provenComponents: ProvenSetup[] = [];
|
|
69
65
|
private bbConfigCleanup?: () => Promise<void>;
|
|
70
66
|
private acvmConfigCleanup?: () => Promise<void>;
|
|
71
|
-
|
|
67
|
+
/** Returns the proof verifier from the prover node (for test assertions). */
|
|
68
|
+
get circuitProofVerifier(): ClientProtocolCircuitVerifier | undefined {
|
|
69
|
+
return this.proverAztecNode?.getProofVerifier();
|
|
70
|
+
}
|
|
72
71
|
provenAsset!: TokenContract;
|
|
73
72
|
context!: EndToEndContext;
|
|
74
73
|
private proverAztecNode!: AztecNodeService;
|
|
@@ -106,15 +105,13 @@ export class FullProverTest {
|
|
|
106
105
|
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
107
106
|
|
|
108
107
|
this.logger.info('Applying base setup: deploying token contract');
|
|
109
|
-
const {
|
|
110
|
-
receipt: { contract: asset, instance },
|
|
111
|
-
} = await TokenContract.deploy(
|
|
108
|
+
const { contract: asset, instance } = await TokenContract.deploy(
|
|
112
109
|
this.wallet,
|
|
113
110
|
this.accounts[0],
|
|
114
111
|
FullProverTest.TOKEN_NAME,
|
|
115
112
|
FullProverTest.TOKEN_SYMBOL,
|
|
116
113
|
FullProverTest.TOKEN_DECIMALS,
|
|
117
|
-
).send({ from: this.accounts[0]
|
|
114
|
+
).send({ from: this.accounts[0] });
|
|
118
115
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
119
116
|
|
|
120
117
|
this.fakeProofsAsset = asset;
|
|
@@ -128,9 +125,10 @@ export class FullProverTest {
|
|
|
128
125
|
);
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
async setup() {
|
|
128
|
+
async setup(opts: Partial<SetupOptions> = {}) {
|
|
132
129
|
this.logger.info('Setting up subsystems from fresh');
|
|
133
130
|
this.context = await setup(0, {
|
|
131
|
+
...opts,
|
|
134
132
|
startProverNode: true,
|
|
135
133
|
coinbase: this.coinbase,
|
|
136
134
|
fundSponsoredFPC: true,
|
|
@@ -170,9 +168,6 @@ export class FullProverTest {
|
|
|
170
168
|
|
|
171
169
|
await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
|
|
172
170
|
|
|
173
|
-
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
174
|
-
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
175
|
-
|
|
176
171
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
177
172
|
await this.aztecNodeAdmin.setConfig({
|
|
178
173
|
realProofs: true,
|
|
@@ -180,7 +175,6 @@ export class FullProverTest {
|
|
|
180
175
|
});
|
|
181
176
|
} else {
|
|
182
177
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
183
|
-
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
184
178
|
await this.aztecNodeAdmin.setConfig({
|
|
185
179
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
186
180
|
});
|
|
@@ -231,8 +225,11 @@ export class FullProverTest {
|
|
|
231
225
|
|
|
232
226
|
this.logger.verbose('Starting prover node');
|
|
233
227
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
234
|
-
const {
|
|
228
|
+
const { genesis } = await getGenesisValues(
|
|
235
229
|
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
230
|
+
undefined,
|
|
231
|
+
undefined,
|
|
232
|
+
this.context.genesis!.genesisTimestamp,
|
|
236
233
|
);
|
|
237
234
|
|
|
238
235
|
const proverNodeConfig: Parameters<typeof AztecNodeService.createAndSync>[0] = {
|
|
@@ -260,7 +257,7 @@ export class FullProverTest {
|
|
|
260
257
|
this.proverAztecNode = await AztecNodeService.createAndSync(
|
|
261
258
|
proverNodeConfig,
|
|
262
259
|
{ dateProvider: this.context.dateProvider, p2pClientDeps: { rpcTxProviders: [this.aztecNode] } },
|
|
263
|
-
{
|
|
260
|
+
{ genesis },
|
|
264
261
|
);
|
|
265
262
|
this.logger.warn(`Proofs are now enabled`, { realProofs: this.realProofs });
|
|
266
263
|
return this;
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
3
|
+
|
|
1
4
|
export const METRICS_PORT = 4318;
|
|
2
5
|
|
|
6
|
+
/** Default fee padding applied to predicted min fees in e2e tests. */
|
|
7
|
+
export const DEFAULT_MIN_FEE_PADDING = 5;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Large fee padding for txs that may be mined significantly later than when they were created,
|
|
11
|
+
* such as cloned txs in throughput/capacity benchmarks, where fees may spike between creation and mining.
|
|
12
|
+
*/
|
|
13
|
+
export const LARGE_MIN_FEE_PADDING = 15;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fee padding used by tests running under proposer pipelining. Under pipelining the fee-asset
|
|
17
|
+
* price modifier evolves faster across the build/publish gap, so client-set maxFeesPerGas (sized
|
|
18
|
+
* for the default 5x padding) was getting bumped past by the time the tx mined a few slots later.
|
|
19
|
+
* Observed worst case in CI: fee evolved ~20x between PXE snapshot and inclusion, exceeding even
|
|
20
|
+
* LARGE_MIN_FEE_PADDING (15x).
|
|
21
|
+
*/
|
|
22
|
+
export const PIPELINED_FEE_PADDING = 30;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Setup option preset that opts a test into proposer pipelining. Use with `setup()`:
|
|
26
|
+
*
|
|
27
|
+
* await setup(N, { ...PIPELINING_SETUP_OPTS, ...otherOpts });
|
|
28
|
+
*
|
|
29
|
+
* The preset sets:
|
|
30
|
+
* - `enableProposerPipelining: true` so the sequencer builds for `slot + 1`.
|
|
31
|
+
* - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
|
|
32
|
+
* avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
|
|
33
|
+
* - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
|
|
34
|
+
* (otherwise the chain stalls on alternating slots).
|
|
35
|
+
* - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
|
|
36
|
+
* default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
|
|
37
|
+
* - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
|
|
38
|
+
*/
|
|
39
|
+
export const PIPELINING_SETUP_OPTS = {
|
|
40
|
+
enableProposerPipelining: true,
|
|
41
|
+
inboxLag: 2,
|
|
42
|
+
minTxsPerBlock: 0,
|
|
43
|
+
aztecSlotDuration: 12,
|
|
44
|
+
ethereumSlotDuration: 4,
|
|
45
|
+
walletMinFeePadding: PIPELINED_FEE_PADDING,
|
|
46
|
+
} as const;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Setup option preset that opts a test into the deterministic AutomineSequencer path.
|
|
50
|
+
* Use only for single-sequencer tests that don't exercise block-building or consensus
|
|
51
|
+
* (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `e2e_p2p/*`,
|
|
52
|
+
* `e2e_epochs/*`, `e2e_slashing/*`, `e2e_block_building`, or any multi-validator suite.
|
|
53
|
+
*
|
|
54
|
+
* await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
|
|
55
|
+
*
|
|
56
|
+
* The preset:
|
|
57
|
+
* - Swaps the production Sequencer for an AutomineSequencer that builds one block per
|
|
58
|
+
* submitted tx, publishes synchronously to L1, and owns all time control through a
|
|
59
|
+
* serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
|
|
60
|
+
* - Disables the validator client and AnvilTestWatcher (the AutomineSequencer needs
|
|
61
|
+
* neither).
|
|
62
|
+
* - Disables proposer pipelining and uses `inboxLag: 1` (synchronous, non-pipelined).
|
|
63
|
+
* - Switches anvil into automine mode at setup time (no interval mining); each L1 tx
|
|
64
|
+
* mines an L1 block immediately.
|
|
65
|
+
*
|
|
66
|
+
* Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
|
|
67
|
+
*/
|
|
68
|
+
export const AUTOMINE_E2E_OPTS = {
|
|
69
|
+
useAutomineSequencer: true,
|
|
70
|
+
disableAnvilTestWatcher: true,
|
|
71
|
+
enableProposerPipelining: false,
|
|
72
|
+
inboxLag: 1,
|
|
73
|
+
minTxsPerBlock: 0,
|
|
74
|
+
aztecSlotDuration: 12,
|
|
75
|
+
ethereumSlotDuration: 4,
|
|
76
|
+
walletMinFeePadding: PIPELINED_FEE_PADDING,
|
|
77
|
+
} as const;
|
|
78
|
+
|
|
79
|
+
/** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */
|
|
80
|
+
export async function getPaddedMaxFeesPerGas(node: AztecNode, padding = DEFAULT_MIN_FEE_PADDING): Promise<GasFees> {
|
|
81
|
+
const predicted = await node.getPredictedMinFees();
|
|
82
|
+
const worstCase =
|
|
83
|
+
predicted.length > 0
|
|
84
|
+
? predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst))
|
|
85
|
+
: await node.getCurrentMinFees();
|
|
86
|
+
return worstCase.mul(1 + padding);
|
|
87
|
+
}
|
|
88
|
+
|
|
3
89
|
export const shouldCollectMetrics = () => {
|
|
4
90
|
if (process.env.COLLECT_METRICS) {
|
|
5
91
|
return METRICS_PORT;
|
|
@@ -13,8 +13,10 @@ const {
|
|
|
13
13
|
BB_SKIP_CLEANUP = '',
|
|
14
14
|
TEMP_DIR = tmpdir(),
|
|
15
15
|
BB_WORKING_DIRECTORY = '',
|
|
16
|
-
BB_NUM_IVC_VERIFIERS = '
|
|
16
|
+
BB_NUM_IVC_VERIFIERS = '8',
|
|
17
17
|
BB_IVC_CONCURRENCY = '1',
|
|
18
|
+
BB_CHONK_VERIFY_MAX_BATCH = '16',
|
|
19
|
+
BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
|
|
18
20
|
} = process.env;
|
|
19
21
|
|
|
20
22
|
export const getBBConfig = async (
|
|
@@ -41,16 +43,15 @@ export const getBBConfig = async (
|
|
|
41
43
|
const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
|
|
42
44
|
const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
|
|
43
45
|
|
|
44
|
-
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
45
|
-
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
46
|
-
|
|
47
46
|
return {
|
|
48
47
|
bbSkipCleanup,
|
|
49
48
|
bbBinaryPath,
|
|
50
49
|
bbWorkingDirectory,
|
|
51
50
|
cleanup,
|
|
52
|
-
numConcurrentIVCVerifiers:
|
|
53
|
-
bbIVCConcurrency:
|
|
51
|
+
numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
|
|
52
|
+
bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
|
|
53
|
+
bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
|
|
54
|
+
bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
|
|
54
55
|
};
|
|
55
56
|
} catch (err) {
|
|
56
57
|
logger.error(`Native BB not available, error: ${err}`);
|
package/src/fixtures/ha_setup.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { privateKeyToAccount } from 'viem/accounts';
|
|
|
11
11
|
*/
|
|
12
12
|
export interface HADatabaseConfig {
|
|
13
13
|
/** PostgreSQL connection URL */
|
|
14
|
-
databaseUrl: string
|
|
14
|
+
databaseUrl: SecretValue<string>;
|
|
15
15
|
/** Node ID for HA coordination */
|
|
16
16
|
nodeId: string;
|
|
17
17
|
/** Enable HA signing */
|
|
@@ -28,7 +28,9 @@ export interface HADatabaseConfig {
|
|
|
28
28
|
* Get database configuration from environment variables
|
|
29
29
|
*/
|
|
30
30
|
export function createHADatabaseConfig(nodeId: string): HADatabaseConfig {
|
|
31
|
-
const databaseUrl =
|
|
31
|
+
const databaseUrl = new SecretValue(
|
|
32
|
+
process.env.DATABASE_URL || 'postgresql://aztec:aztec@localhost:5432/aztec_ha_test',
|
|
33
|
+
);
|
|
32
34
|
|
|
33
35
|
return {
|
|
34
36
|
databaseUrl,
|