@aztec/end-to-end 0.0.1-commit.b33fc05d0 → 0.0.1-commit.b3d3157a
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 +86 -13
- 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 +4 -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 +29 -13
- package/dest/e2e_p2p/shared.d.ts +23 -14
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +62 -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 +70 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +65 -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 +44 -11
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +157 -28
- 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 +50 -32
- 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 +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +72 -48
- 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 -35
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +2 -2
- 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 +7 -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 +6 -2
- 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 +98 -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 +4 -3
- package/src/e2e_p2p/p2p_network.ts +57 -39
- package/src/e2e_p2p/reqresp/utils.ts +30 -12
- package/src/e2e_p2p/shared.ts +60 -71
- 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 +83 -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 +186 -33
- 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 +84 -40
- 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 +69 -43
- package/src/spartan/tx_metrics.ts +81 -23
- package/src/spartan/utils/nodes.ts +2 -2
- 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 +5 -2
- package/src/test-wallet/worker_wallet.ts +10 -5
- package/src/test-wallet/worker_wallet_schema.ts +2 -2
|
@@ -2,6 +2,7 @@ import type { AztecNodeService } from '@aztec/aztec-node';
|
|
|
2
2
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
4
4
|
import { Tx } from '@aztec/aztec.js/tx';
|
|
5
|
+
import { PROPOSER_PIPELINING_SLOT_OFFSET } from '@aztec/epoch-cache';
|
|
5
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
7
|
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
8
|
import { timesAsync } from '@aztec/foundation/collection';
|
|
@@ -14,7 +15,7 @@ import path from 'path';
|
|
|
14
15
|
|
|
15
16
|
import { getBootNodeUdpPort, shouldCollectMetrics } from '../../fixtures/fixtures.js';
|
|
16
17
|
import { createNodes } from '../../fixtures/setup_p2p_test.js';
|
|
17
|
-
import { P2PNetworkTest
|
|
18
|
+
import { P2PNetworkTest } from '../p2p_network.js';
|
|
18
19
|
import { prepareTransactions } from '../shared.js';
|
|
19
20
|
|
|
20
21
|
// 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 +50,9 @@ export async function createReqrespTest(options: ReqrespOptions = {}): Promise<P
|
|
|
49
50
|
...(disableStatusHandshake ? { p2pDisableStatusHandshake: true } : {}),
|
|
50
51
|
listenAddress: '127.0.0.1',
|
|
51
52
|
aztecEpochDuration: 64, // stable committee
|
|
53
|
+
// Pipelining: target-slot is one ahead of build-slot; inboxLag sources L1->L2
|
|
54
|
+
// messages from the previous checkpoint to avoid L1ToL2MessagesNotReadyError.
|
|
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 = PROPOSER_PIPELINING_SLOT_OFFSET;
|
|
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
|
|
|
@@ -176,12 +188,17 @@ export async function runReqrespTxTest(params: {
|
|
|
176
188
|
t.logger.info(`Node ${getNodePort(i)} pool has ${count} pending txs`);
|
|
177
189
|
}
|
|
178
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;
|
|
179
196
|
t.logger.info('Waiting for all transactions to be mined');
|
|
180
197
|
await Promise.all(
|
|
181
198
|
submittedTxs.flatMap((batch, batchIndex) =>
|
|
182
199
|
batch.map(async (submittedTx, txIndex) => {
|
|
183
200
|
t.logger.info(`Waiting for tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} to be mined`);
|
|
184
|
-
await waitForTx(submittedTx.node, submittedTx.txHash, { timeout:
|
|
201
|
+
await waitForTx(submittedTx.node, submittedTx.txHash, { timeout: waitForTxTimeout });
|
|
185
202
|
t.logger.info(`Tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} has been mined`);
|
|
186
203
|
}),
|
|
187
204
|
),
|
|
@@ -194,8 +211,8 @@ export async function runReqrespTxTest(params: {
|
|
|
194
211
|
// Wait for L1 checkpoint sync, which may lag behind P2P block propagation.
|
|
195
212
|
const checkpoints = await retryUntil(
|
|
196
213
|
async () => {
|
|
197
|
-
const cps = await nodes[0].getCheckpoints(CheckpointNumber(1), 50);
|
|
198
|
-
return cps.length > 0 && cps.some(cp => cp.
|
|
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;
|
|
199
216
|
},
|
|
200
217
|
'waiting for multi-block checkpoint to sync from L1',
|
|
201
218
|
30,
|
|
@@ -203,16 +220,17 @@ export async function runReqrespTxTest(params: {
|
|
|
203
220
|
);
|
|
204
221
|
|
|
205
222
|
let mbpsFound = false;
|
|
206
|
-
let expectedBlockNumber = checkpoints[0].
|
|
223
|
+
let expectedBlockNumber = checkpoints[0].blocks![0].number;
|
|
207
224
|
|
|
208
225
|
for (const published of checkpoints) {
|
|
209
|
-
const
|
|
226
|
+
const blocks = published.blocks!;
|
|
227
|
+
const blockCount = blocks.length;
|
|
210
228
|
mbpsFound = mbpsFound || blockCount >= 2;
|
|
211
229
|
|
|
212
230
|
for (let i = 0; i < blockCount; i++) {
|
|
213
|
-
const block =
|
|
231
|
+
const block = blocks[i];
|
|
214
232
|
expect(block.indexWithinCheckpoint).toBe(i);
|
|
215
|
-
expect(block.checkpointNumber).toBe(published.
|
|
233
|
+
expect(block.checkpointNumber).toBe(published.number);
|
|
216
234
|
expect(block.number).toBe(expectedBlockNumber);
|
|
217
235
|
expectedBlockNumber++;
|
|
218
236
|
}
|
|
@@ -222,7 +240,7 @@ export async function runReqrespTxTest(params: {
|
|
|
222
240
|
return nodes;
|
|
223
241
|
}
|
|
224
242
|
|
|
225
|
-
async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint) {
|
|
243
|
+
async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint, slotOffset = 0) {
|
|
226
244
|
// Get the nodes for the next set of slots
|
|
227
245
|
const rollupContract = new RollupContract(
|
|
228
246
|
t.ctx.deployL1ContractsValues.l1Client,
|
|
@@ -234,7 +252,7 @@ async function getProposerIndexes(t: P2PNetworkTest, startSlotTimestamp: bigint)
|
|
|
234
252
|
|
|
235
253
|
const proposers = await Promise.all(
|
|
236
254
|
Array.from({ length: 3 }, async (_, i) => {
|
|
237
|
-
const slot = SlotNumber(startSlot + i);
|
|
255
|
+
const slot = SlotNumber(startSlot + slotOffset + i);
|
|
238
256
|
const slotTimestamp = await rollupContract.getTimestampForSlot(slot);
|
|
239
257
|
return await rollupContract.getProposerAt(slotTimestamp);
|
|
240
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,12 +148,21 @@ 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
|
|
156
|
-
* then stop one epoch before it. This leaves time for the caller to
|
|
157
|
-
* warping to the target epoch, avoiding the race where the target epoch
|
|
158
|
-
* are ready.
|
|
151
|
+
* Advance epochs until we find one where the target proposer is selected for a slot at least
|
|
152
|
+
* `warmupSlots` into the epoch, then stop one epoch before it. This leaves time for the caller to
|
|
153
|
+
* start sequencers before warping to the target epoch, avoiding the race where the target epoch
|
|
154
|
+
* passes before sequencers are ready.
|
|
155
|
+
*
|
|
156
|
+
* The first `warmupSlots` slots of the epoch are skipped on purpose. Callers warp to one slot
|
|
157
|
+
* before the target epoch and, under proposer pipelining, the proposer begins building one slot
|
|
158
|
+
* before its proposal slot. If the proposer were in the first slot of the epoch, that build would
|
|
159
|
+
* begin at the exact instant of the warp, leaving the freshly-started sequencer no warm-up margin;
|
|
160
|
+
* it then serializes its (often AVM-heavy) proposal past the slot boundary and honest receivers
|
|
161
|
+
* reject it as late. Picking a slot at least `warmupSlots` into the epoch guarantees that many full
|
|
162
|
+
* slots of wall-clock between the warp and the start of the proposer's build.
|
|
159
163
|
*
|
|
160
|
-
* Returns the target epoch
|
|
164
|
+
* Returns the target epoch and the concrete target slot so the caller can warp to it after starting
|
|
165
|
+
* sequencers.
|
|
161
166
|
*/
|
|
162
167
|
export async function advanceToEpochBeforeProposer({
|
|
163
168
|
epochCache,
|
|
@@ -165,13 +170,15 @@ export async function advanceToEpochBeforeProposer({
|
|
|
165
170
|
targetProposer,
|
|
166
171
|
logger,
|
|
167
172
|
maxAttempts = 20,
|
|
173
|
+
warmupSlots = 1,
|
|
168
174
|
}: {
|
|
169
175
|
epochCache: EpochCacheInterface;
|
|
170
176
|
cheatCodes: RollupCheatCodes;
|
|
171
177
|
targetProposer: EthAddress;
|
|
172
178
|
logger: Logger;
|
|
173
179
|
maxAttempts?: number;
|
|
174
|
-
|
|
180
|
+
warmupSlots?: number;
|
|
181
|
+
}): Promise<{ targetEpoch: EpochNumber; targetSlot: SlotNumber }> {
|
|
175
182
|
const { epochDuration } = await cheatCodes.getConfig();
|
|
176
183
|
|
|
177
184
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
@@ -179,8 +186,11 @@ export async function advanceToEpochBeforeProposer({
|
|
|
179
186
|
// Check the NEXT epoch's slots so we stay one epoch before the target,
|
|
180
187
|
// giving the caller time to start sequencers before the target epoch arrives.
|
|
181
188
|
const nextEpoch = Number(currentEpoch) + 1;
|
|
182
|
-
const
|
|
183
|
-
|
|
189
|
+
const epochStartSlot = nextEpoch * Number(epochDuration);
|
|
190
|
+
// Skip the first `warmupSlots` slots so the caller keeps a warm-up margin after warping to one
|
|
191
|
+
// slot before the epoch (see the doc comment above).
|
|
192
|
+
const startSlot = epochStartSlot + warmupSlots;
|
|
193
|
+
const endSlot = epochStartSlot + Number(epochDuration);
|
|
184
194
|
|
|
185
195
|
logger.info(
|
|
186
196
|
`Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
|
|
@@ -192,7 +202,7 @@ export async function advanceToEpochBeforeProposer({
|
|
|
192
202
|
logger.warn(
|
|
193
203
|
`Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
|
|
194
204
|
);
|
|
195
|
-
return { targetEpoch: EpochNumber(nextEpoch) };
|
|
205
|
+
return { targetEpoch: EpochNumber(nextEpoch), targetSlot: SlotNumber(s) };
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
|
|
@@ -245,7 +255,6 @@ export async function awaitCommitteeKicked({
|
|
|
245
255
|
rollup,
|
|
246
256
|
cheatCodes,
|
|
247
257
|
committee,
|
|
248
|
-
slashFactory,
|
|
249
258
|
slashingProposer,
|
|
250
259
|
slashingRoundSize,
|
|
251
260
|
aztecSlotDuration,
|
|
@@ -256,8 +265,7 @@ export async function awaitCommitteeKicked({
|
|
|
256
265
|
rollup: RollupContract;
|
|
257
266
|
cheatCodes: RollupCheatCodes;
|
|
258
267
|
committee: readonly `0x${string}`[];
|
|
259
|
-
|
|
260
|
-
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
268
|
+
slashingProposer: SlashingProposerContract | undefined;
|
|
261
269
|
slashingRoundSize: number;
|
|
262
270
|
aztecSlotDuration: number;
|
|
263
271
|
aztecEpochDuration: number;
|
|
@@ -270,36 +278,14 @@ export async function awaitCommitteeKicked({
|
|
|
270
278
|
|
|
271
279
|
await cheatCodes.debugRollup();
|
|
272
280
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
282
|
-
return events.length > 0 ? events : undefined;
|
|
283
|
-
},
|
|
284
|
-
'slash payload created',
|
|
285
|
-
120,
|
|
286
|
-
1,
|
|
287
|
-
);
|
|
288
|
-
expect(slashPayloadEvents.length).toBe(1);
|
|
289
|
-
// 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)
|
|
290
|
-
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
291
|
-
committee.length,
|
|
292
|
-
);
|
|
293
|
-
} else {
|
|
294
|
-
// Use the slash offset to ensure we are in the right epoch for tally
|
|
295
|
-
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
296
|
-
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
297
|
-
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
298
|
-
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
299
|
-
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
300
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
301
|
-
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
|
|
302
|
-
}
|
|
281
|
+
// Use the slash offset to ensure we are in the right epoch for tally
|
|
282
|
+
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
283
|
+
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
284
|
+
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
285
|
+
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
286
|
+
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
287
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
288
|
+
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
|
|
303
289
|
|
|
304
290
|
const attestersPre = await rollup.getAttesters();
|
|
305
291
|
expect(attestersPre.length).toBe(committee.length);
|
|
@@ -309,7 +295,10 @@ export async function awaitCommitteeKicked({
|
|
|
309
295
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
310
296
|
}
|
|
311
297
|
|
|
312
|
-
|
|
298
|
+
// Allow up to four round-lengths so that under proposer pipelining, where individual rounds
|
|
299
|
+
// sometimes fail to gather quorum because parts of the committee miss votes due to chain-state
|
|
300
|
+
// races, we still see a later round execute the slash.
|
|
301
|
+
const timeout = slashingRoundSize * 4 * aztecSlotDuration + 30;
|
|
313
302
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
314
303
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
315
304
|
|
|
@@ -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,88 @@
|
|
|
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
|
+
* - `inboxLag: 2` so the sequencer sources L1->L2 messages from checkpoint N-1 (already sealed),
|
|
31
|
+
* avoiding `L1ToL2MessagesNotReadyError` when building for slot N during slot N-1.
|
|
32
|
+
* - `minTxsPerBlock: 0` so empty checkpoints land even when a tx arrives late in the build window
|
|
33
|
+
* (otherwise the chain stalls on alternating slots).
|
|
34
|
+
* - `aztecSlotDuration: 12` / `ethereumSlotDuration: 4` so the pipelined cycle fits inside the
|
|
35
|
+
* default 300s Jest hook budget. Tests that depend on the env-default 72s/12s should override.
|
|
36
|
+
* - `walletMinFeePadding: PIPELINED_FEE_PADDING` (30x) to absorb the wider fee evolution window.
|
|
37
|
+
*/
|
|
38
|
+
export const PIPELINING_SETUP_OPTS = {
|
|
39
|
+
inboxLag: 2,
|
|
40
|
+
minTxsPerBlock: 0,
|
|
41
|
+
aztecSlotDuration: 12,
|
|
42
|
+
ethereumSlotDuration: 4,
|
|
43
|
+
walletMinFeePadding: PIPELINED_FEE_PADDING,
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Setup option preset that opts a test into the deterministic AutomineSequencer path.
|
|
48
|
+
* Use only for single-sequencer tests that don't exercise block-building or consensus
|
|
49
|
+
* (e.g. e2e_token, e2e_amm, e2e_authwit). Not compatible with `e2e_p2p/*`,
|
|
50
|
+
* `e2e_epochs/*`, `e2e_slashing/*`, `e2e_block_building`, or any multi-validator suite.
|
|
51
|
+
*
|
|
52
|
+
* await setup(N, { ...AUTOMINE_E2E_OPTS, ...otherOpts });
|
|
53
|
+
*
|
|
54
|
+
* The preset:
|
|
55
|
+
* - Swaps the production Sequencer for an AutomineSequencer that builds one block per
|
|
56
|
+
* submitted tx, publishes synchronously to L1, and owns all time control through a
|
|
57
|
+
* serial queue (see `sequencer-client/src/sequencer/automine/automine_sequencer.ts`).
|
|
58
|
+
* - Disables the validator client and AnvilTestWatcher (the AutomineSequencer needs
|
|
59
|
+
* neither).
|
|
60
|
+
* - Uses `inboxLag: 1` (synchronous) since the AutomineSequencer publishes one block per tx.
|
|
61
|
+
* - Switches anvil into automine mode at setup time (no interval mining); each L1 tx
|
|
62
|
+
* mines an L1 block immediately.
|
|
63
|
+
*
|
|
64
|
+
* Requires `aztecTargetCommitteeSize: 0`, which is the e2e default at `setup.ts:317`.
|
|
65
|
+
*/
|
|
66
|
+
export const AUTOMINE_E2E_OPTS = {
|
|
67
|
+
useAutomineSequencer: true,
|
|
68
|
+
disableAnvilTestWatcher: true,
|
|
69
|
+
inboxLag: 1,
|
|
70
|
+
minTxsPerBlock: 0,
|
|
71
|
+
aztecSlotDuration: 12,
|
|
72
|
+
ethereumSlotDuration: 4,
|
|
73
|
+
walletMinFeePadding: PIPELINED_FEE_PADDING,
|
|
74
|
+
} as const;
|
|
75
|
+
|
|
76
|
+
/** Returns worst-case predicted min fees with padding applied, mirroring the BaseWallet pattern. */
|
|
77
|
+
export async function getPaddedMaxFeesPerGas(node: AztecNode, padding = DEFAULT_MIN_FEE_PADDING): Promise<GasFees> {
|
|
78
|
+
const predicted = await node.getPredictedMinFees();
|
|
79
|
+
const worstCase =
|
|
80
|
+
predicted.length > 0
|
|
81
|
+
? predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst))
|
|
82
|
+
: await node.getCurrentMinFees();
|
|
83
|
+
return worstCase.mul(1 + padding);
|
|
84
|
+
}
|
|
85
|
+
|
|
3
86
|
export const shouldCollectMetrics = () => {
|
|
4
87
|
if (process.env.COLLECT_METRICS) {
|
|
5
88
|
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,
|