@aztec/end-to-end 0.0.1-commit.7b86788 → 0.0.1-commit.7cbc774
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 +33 -36
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +8 -3
- 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 +28 -19
- 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 +44 -11
- 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 +6 -7
- 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 +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +65 -43
- 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 +25 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +73 -50
- 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 +15 -13
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- 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 +13 -17
- 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 +44 -12
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +138 -29
- 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 +22 -18
- 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 +19 -10
- package/dest/shared/jest_setup.js +32 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- 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 +60 -39
- 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 +26 -14
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- 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 +72 -39
- 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 +74 -21
- 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 +49 -46
- package/src/bench/client_flows/benchmark.ts +19 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +60 -41
- package/src/bench/utils.ts +9 -3
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +42 -24
- 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 +49 -9
- package/src/e2e_nested_contract/nested_contract_test.ts +9 -5
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -3
- package/src/e2e_p2p/p2p_network.ts +82 -60
- package/src/e2e_p2p/reqresp/utils.ts +51 -12
- package/src/e2e_p2p/shared.ts +92 -64
- package/src/e2e_token_contract/token_contract_test.ts +28 -10
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +22 -19
- 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 +176 -34
- package/src/fixtures/setup_p2p_test.ts +13 -9
- package/src/fixtures/token_utils.ts +1 -2
- 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 +27 -13
- package/src/shared/gas_portal_test_harness.ts +21 -11
- package/src/shared/jest_setup.ts +36 -1
- package/src/shared/submit-transactions.ts +1 -4
- package/src/shared/uniswap_l1_l2.ts +77 -50
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +32 -14
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +91 -37
- package/src/spartan/tx_metrics.ts +82 -24
- 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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
1
2
|
import type { Archiver } from '@aztec/archiver';
|
|
2
3
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
+
import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
3
5
|
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
4
6
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
@@ -28,11 +30,16 @@ import { type SequencerClient, type SequencerEvents, SequencerState } from '@azt
|
|
|
28
30
|
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
29
31
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
30
32
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
33
|
+
import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
|
|
31
34
|
|
|
32
35
|
import { join } from 'path';
|
|
33
36
|
import type { Hex } from 'viem';
|
|
34
37
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
35
38
|
|
|
39
|
+
import {
|
|
40
|
+
SCHNORR_HARDCODED_PRIVATE_KEY,
|
|
41
|
+
SchnorrHardcodedKeyAccountContract,
|
|
42
|
+
} from '../fixtures/schnorr_hardcoded_account_contract.js';
|
|
36
43
|
import {
|
|
37
44
|
type EndToEndContext,
|
|
38
45
|
type SetupOptions,
|
|
@@ -40,6 +47,7 @@ import {
|
|
|
40
47
|
getPrivateKeyFromIndex,
|
|
41
48
|
setup,
|
|
42
49
|
} from '../fixtures/utils.js';
|
|
50
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
43
51
|
|
|
44
52
|
export const WORLD_STATE_CHECKPOINT_HISTORY = 2;
|
|
45
53
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
@@ -50,6 +58,13 @@ export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
|
50
58
|
numberOfAccounts?: number;
|
|
51
59
|
pxeOpts?: Partial<PXEConfig>;
|
|
52
60
|
aztecSlotDurationInL1Slots?: number;
|
|
61
|
+
/** Skip creating/registering the hardcoded account during setup (for tests that handle accounts themselves). */
|
|
62
|
+
skipHardcodedAccount?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Force the hardcoded-account fast-path even when an initial sequencer is running. Useful for
|
|
65
|
+
* tests with tight per-block gas budgets that can't fit a full account-deploy tx.
|
|
66
|
+
*/
|
|
67
|
+
useHardcodedAccount?: boolean;
|
|
53
68
|
};
|
|
54
69
|
|
|
55
70
|
export type TrackedSequencerEvent = {
|
|
@@ -120,10 +135,20 @@ export class EpochsTestContext {
|
|
|
120
135
|
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
121
136
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
122
137
|
|
|
138
|
+
// Auto-create a hardcoded account funded via genesis when:
|
|
139
|
+
// - skipInitialSequencer is set (no sequencer to deploy on-chain), or
|
|
140
|
+
// - useHardcodedAccount is explicitly requested (e.g. tight per-block gas budgets that
|
|
141
|
+
// can't fit a full account-deploy tx).
|
|
142
|
+
const useHardcodedAccount = (opts.skipInitialSequencer || opts.useHardcodedAccount) && !opts.skipHardcodedAccount;
|
|
143
|
+
let hardcodedAccountData: InitialAccountData | undefined;
|
|
144
|
+
if (useHardcodedAccount) {
|
|
145
|
+
hardcodedAccountData = await EpochsTestContext.getHardcodedAccountData(Fr.random(), Fr.random());
|
|
146
|
+
}
|
|
147
|
+
|
|
123
148
|
// Set up system without any account nor protocol contracts
|
|
124
149
|
// and with faster block times and shorter epochs.
|
|
125
150
|
const context = await setup(
|
|
126
|
-
opts.numberOfAccounts ?? 0,
|
|
151
|
+
useHardcodedAccount ? 0 : (opts.numberOfAccounts ?? 0),
|
|
127
152
|
{
|
|
128
153
|
automineL1Setup: true,
|
|
129
154
|
checkIntervalMs: 50,
|
|
@@ -138,15 +163,13 @@ export class EpochsTestContext {
|
|
|
138
163
|
realProofs: false,
|
|
139
164
|
startProverNode: true,
|
|
140
165
|
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
141
|
-
// We use numeric incremental prover ids for simplicity, but we can switch to
|
|
142
|
-
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
143
|
-
// Use numeric EthAddress for deterministic prover id
|
|
144
166
|
proverId: EthAddress.fromNumber(1),
|
|
145
167
|
worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
|
|
146
168
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
147
|
-
|
|
169
|
+
slasherEnabled: false,
|
|
148
170
|
l1PublishingTime,
|
|
149
171
|
...opts,
|
|
172
|
+
...(hardcodedAccountData ? { initialFundedAccounts: [hardcodedAccountData], numberOfAccounts: 0 } : {}),
|
|
150
173
|
},
|
|
151
174
|
// Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
152
175
|
// Can be overridden via opts.pxeOpts.
|
|
@@ -154,6 +177,11 @@ export class EpochsTestContext {
|
|
|
154
177
|
);
|
|
155
178
|
|
|
156
179
|
this.context = context;
|
|
180
|
+
|
|
181
|
+
// Register the hardcoded account in PXE (local only, no on-chain deployment needed).
|
|
182
|
+
if (hardcodedAccountData) {
|
|
183
|
+
await this.registerHardcodedAccount(hardcodedAccountData);
|
|
184
|
+
}
|
|
157
185
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
158
186
|
this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
|
|
159
187
|
this.logger = context.logger;
|
|
@@ -181,6 +209,7 @@ export class EpochsTestContext {
|
|
|
181
209
|
ethereumSlotDuration,
|
|
182
210
|
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
|
|
183
211
|
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
|
|
212
|
+
rollupManaLimit: Number(await this.rollup.getManaLimit()),
|
|
184
213
|
};
|
|
185
214
|
|
|
186
215
|
this.logger.info(
|
|
@@ -195,6 +224,35 @@ export class EpochsTestContext {
|
|
|
195
224
|
await this.context.teardown();
|
|
196
225
|
}
|
|
197
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Computes InitialAccountData for a SchnorrHardcodedKeyAccountContract.
|
|
229
|
+
* This contract has a hardcoded signing key and no initializer, so it can be used without
|
|
230
|
+
* on-chain deployment. Pass the returned data in `initialFundedAccounts` so the address
|
|
231
|
+
* gets funded with fee juice in genesis.
|
|
232
|
+
*/
|
|
233
|
+
public static async getHardcodedAccountData(secret: Fr, salt: Fr): Promise<InitialAccountData> {
|
|
234
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
235
|
+
const address = await getAccountContractAddress(contract, secret, salt);
|
|
236
|
+
const signingKey = SCHNORR_HARDCODED_PRIVATE_KEY;
|
|
237
|
+
return { secret, salt, signingKey, address };
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Registers a SchnorrHardcodedKeyAccountContract in PXE. The account must have been funded
|
|
242
|
+
* at genesis (via getHardcodedAccountData). No on-chain deployment or block mining needed.
|
|
243
|
+
*/
|
|
244
|
+
public async registerHardcodedAccount(accountData: InitialAccountData) {
|
|
245
|
+
const contract = new SchnorrHardcodedKeyAccountContract();
|
|
246
|
+
const wallet = this.context.wallet;
|
|
247
|
+
const accountManager = await (wallet as TestWallet).createAccount({
|
|
248
|
+
secret: accountData.secret,
|
|
249
|
+
salt: accountData.salt,
|
|
250
|
+
contract,
|
|
251
|
+
});
|
|
252
|
+
this.context.accounts = [accountManager.address];
|
|
253
|
+
return accountManager.address;
|
|
254
|
+
}
|
|
255
|
+
|
|
198
256
|
public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
|
|
199
257
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
200
258
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
@@ -221,7 +279,7 @@ export class EpochsTestContext {
|
|
|
221
279
|
},
|
|
222
280
|
},
|
|
223
281
|
{
|
|
224
|
-
|
|
282
|
+
genesis: this.context.genesis,
|
|
225
283
|
dontStart: opts.dontStart,
|
|
226
284
|
},
|
|
227
285
|
),
|
|
@@ -237,13 +295,21 @@ export class EpochsTestContext {
|
|
|
237
295
|
|
|
238
296
|
public createValidatorNode(
|
|
239
297
|
privateKeys: `0x${string}`[],
|
|
240
|
-
opts: Partial<AztecNodeConfig> & {
|
|
298
|
+
opts: Partial<AztecNodeConfig> & {
|
|
299
|
+
dontStartSequencer?: boolean;
|
|
300
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
301
|
+
} = {},
|
|
241
302
|
) {
|
|
242
303
|
this.logger.warn('Creating and syncing a validator node...');
|
|
243
304
|
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
|
|
244
305
|
}
|
|
245
306
|
|
|
246
|
-
private async createNode(
|
|
307
|
+
private async createNode(
|
|
308
|
+
opts: Partial<AztecNodeConfig> & {
|
|
309
|
+
dontStartSequencer?: boolean;
|
|
310
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
311
|
+
} = {},
|
|
312
|
+
) {
|
|
247
313
|
const nodeIndex = this.nodes.length + 1;
|
|
248
314
|
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
249
315
|
const { mockGossipSubNetwork } = this.context;
|
|
@@ -256,6 +322,7 @@ export class EpochsTestContext {
|
|
|
256
322
|
...resolvedConfig,
|
|
257
323
|
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
258
324
|
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
325
|
+
nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
|
|
259
326
|
p2pEnabled,
|
|
260
327
|
p2pIp,
|
|
261
328
|
},
|
|
@@ -264,9 +331,10 @@ export class EpochsTestContext {
|
|
|
264
331
|
p2pClientDeps: {
|
|
265
332
|
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
266
333
|
},
|
|
334
|
+
slashingProtectionDb: opts.slashingProtectionDb,
|
|
267
335
|
},
|
|
268
336
|
{
|
|
269
|
-
|
|
337
|
+
genesis: this.context.genesis,
|
|
270
338
|
...opts,
|
|
271
339
|
},
|
|
272
340
|
),
|
|
@@ -337,7 +405,7 @@ export class EpochsTestContext {
|
|
|
337
405
|
await sleep(waitTime);
|
|
338
406
|
const [syncState, tips] = await Promise.all([
|
|
339
407
|
this.context.aztecNode.getWorldStateSyncStatus(),
|
|
340
|
-
await this.context.aztecNode.
|
|
408
|
+
await this.context.aztecNode.getChainTips(),
|
|
341
409
|
]);
|
|
342
410
|
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, { blockNumber, type, syncState, tips });
|
|
343
411
|
if (type === 'proven') {
|
|
@@ -404,7 +472,7 @@ export class EpochsTestContext {
|
|
|
404
472
|
/** Verifies at least one checkpoint has the target number of blocks (for MBPS validation). */
|
|
405
473
|
public async assertMultipleBlocksPerSlot(targetBlockCount: number) {
|
|
406
474
|
const archiver = (this.context.aztecNode as AztecNodeService).getBlockSource() as Archiver;
|
|
407
|
-
const checkpoints = await archiver.getCheckpoints(CheckpointNumber(1), 50);
|
|
475
|
+
const checkpoints = await archiver.getCheckpoints({ from: CheckpointNumber(1), limit: 50 });
|
|
408
476
|
|
|
409
477
|
this.logger.warn(`Retrieved ${checkpoints.length} checkpoints from archiver`, {
|
|
410
478
|
checkpoints: checkpoints.map(pc => pc.checkpoint.getStats()),
|
|
@@ -436,6 +504,7 @@ export class EpochsTestContext {
|
|
|
436
504
|
public watchSequencerEvents(
|
|
437
505
|
sequencers: SequencerClient[],
|
|
438
506
|
getMetadata: (i: number) => Record<string, any> = () => ({}),
|
|
507
|
+
additionalFailEventKeys: (keyof SequencerEvents)[] = [],
|
|
439
508
|
) {
|
|
440
509
|
const stateChanges: TrackedSequencerEvent[] = [];
|
|
441
510
|
const failEvents: TrackedSequencerEvent[] = [];
|
|
@@ -446,6 +515,11 @@ export class EpochsTestContext {
|
|
|
446
515
|
'block-build-failed',
|
|
447
516
|
'checkpoint-publish-failed',
|
|
448
517
|
'proposer-rollup-check-failed',
|
|
518
|
+
'checkpoint-error',
|
|
519
|
+
'checkpoint-publish-failed',
|
|
520
|
+
'header-validation-failed',
|
|
521
|
+
'pipelined-checkpoint-discarded',
|
|
522
|
+
...additionalFailEventKeys,
|
|
449
523
|
];
|
|
450
524
|
|
|
451
525
|
const makeEvent = (
|
|
@@ -475,6 +549,13 @@ export class EpochsTestContext {
|
|
|
475
549
|
});
|
|
476
550
|
failEventsKeys.forEach(eventName => {
|
|
477
551
|
sequencer.getSequencer().on(eventName, (args: Parameters<SequencerEvents[typeof eventName]>[0]) => {
|
|
552
|
+
// Skip benign block-build-failed events where the builder rejected the block because it
|
|
553
|
+
// could not collect enough valid txs. This is the same "not enough txs" case as
|
|
554
|
+
// block-tx-count-check-failed (which is already excluded above), just detected after we
|
|
555
|
+
// started processing txs rather than before.
|
|
556
|
+
if (eventName === 'block-build-failed' && (args as { reason?: string }).reason === 'Insufficient valid txs') {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
478
559
|
const evt = makeEvent(i, eventName, args);
|
|
479
560
|
failEvents.push(evt);
|
|
480
561
|
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
|
|
@@ -484,4 +565,11 @@ export class EpochsTestContext {
|
|
|
484
565
|
|
|
485
566
|
return { failEvents, stateChanges };
|
|
486
567
|
}
|
|
568
|
+
|
|
569
|
+
public assertNoFailuresFromSequencers(failEvents: TrackedSequencerEvent[]) {
|
|
570
|
+
if (failEvents.length > 0) {
|
|
571
|
+
this.logger.error(`Failed events from sequencers`, failEvents);
|
|
572
|
+
}
|
|
573
|
+
expect(failEvents).toEqual([]);
|
|
574
|
+
}
|
|
487
575
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
|
+
import { CheatCodes, getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
5
5
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
7
|
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
@@ -23,11 +23,12 @@ import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
|
23
23
|
|
|
24
24
|
import { getContract } from 'viem';
|
|
25
25
|
|
|
26
|
-
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
26
|
+
import { MNEMONIC, getPaddedMaxFeesPerGas } from '../fixtures/fixtures.js';
|
|
27
27
|
import {
|
|
28
28
|
type EndToEndContext,
|
|
29
29
|
type SetupOptions,
|
|
30
30
|
deployAccounts,
|
|
31
|
+
ensureAuthRegistryPublished,
|
|
31
32
|
publicDeployAccounts,
|
|
32
33
|
setup,
|
|
33
34
|
teardown,
|
|
@@ -84,6 +85,8 @@ export class FeesTest {
|
|
|
84
85
|
public getBananaPublicBalanceFn!: BalancesFn;
|
|
85
86
|
public getBananaPrivateBalanceFn!: BalancesFn;
|
|
86
87
|
public getProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
88
|
+
public getCommittedProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
89
|
+
public getCommittedBurn!: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
87
90
|
|
|
88
91
|
public readonly ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
89
92
|
public readonly SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
@@ -102,14 +105,18 @@ export class FeesTest {
|
|
|
102
105
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
async setup() {
|
|
108
|
+
async setup(opts: Partial<SetupOptions> = {}) {
|
|
106
109
|
this.logger.verbose('Setting up fresh context...');
|
|
110
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
111
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
107
112
|
this.context = await setup(0, {
|
|
108
113
|
startProverNode: true,
|
|
109
114
|
...this.setupOptions,
|
|
115
|
+
...opts,
|
|
110
116
|
fundSponsoredFPC: true,
|
|
111
117
|
skipAccountDeployment: true,
|
|
112
118
|
l1ContractsArgs: { ...this.setupOptions },
|
|
119
|
+
txPublicSetupAllowListExtend: [...(this.setupOptions.txPublicSetupAllowListExtend ?? []), ...tokenAllowList],
|
|
113
120
|
});
|
|
114
121
|
|
|
115
122
|
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
@@ -131,7 +138,7 @@ export class FeesTest {
|
|
|
131
138
|
|
|
132
139
|
async catchUpProvenChain() {
|
|
133
140
|
const bn = await this.aztecNode.getBlockNumber();
|
|
134
|
-
while ((await this.aztecNode.
|
|
141
|
+
while ((await this.aztecNode.getBlockNumber('proven')) < bn) {
|
|
135
142
|
await sleep(1000);
|
|
136
143
|
}
|
|
137
144
|
}
|
|
@@ -157,21 +164,31 @@ export class FeesTest {
|
|
|
157
164
|
|
|
158
165
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
159
166
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
160
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
167
|
+
const { result: balanceBefore } = await this.bananaCoin.methods
|
|
168
|
+
.balance_of_private(address)
|
|
169
|
+
.simulate({ from: address });
|
|
161
170
|
|
|
162
171
|
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
163
172
|
|
|
164
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
173
|
+
const { result: balanceAfter } = await this.bananaCoin.methods
|
|
174
|
+
.balance_of_private(address)
|
|
175
|
+
.simulate({ from: address });
|
|
165
176
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
166
177
|
}
|
|
167
178
|
|
|
168
179
|
public async applyBaseSetup() {
|
|
169
180
|
await this.applyInitialAccounts();
|
|
181
|
+
await this.applyEnsureAuthRegistryPublished();
|
|
170
182
|
await this.applyPublicDeployAccounts();
|
|
171
183
|
await this.applySetupFeeJuice();
|
|
172
184
|
await this.applyDeployBananaToken();
|
|
173
185
|
}
|
|
174
186
|
|
|
187
|
+
async applyEnsureAuthRegistryPublished() {
|
|
188
|
+
this.logger.info('Ensuring AuthRegistry published');
|
|
189
|
+
await ensureAuthRegistryPublished(this.wallet, this.aliceAddress);
|
|
190
|
+
}
|
|
191
|
+
|
|
175
192
|
async applyInitialAccounts() {
|
|
176
193
|
this.logger.info('Applying initial accounts setup');
|
|
177
194
|
|
|
@@ -186,7 +203,9 @@ export class FeesTest {
|
|
|
186
203
|
this.wallet = this.context.wallet;
|
|
187
204
|
this.aztecNode = this.context.aztecNodeService;
|
|
188
205
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
189
|
-
this.gasSettings = GasSettings.
|
|
206
|
+
this.gasSettings = GasSettings.fallback({
|
|
207
|
+
maxFeesPerGas: await getPaddedMaxFeesPerGas(this.aztecNode),
|
|
208
|
+
});
|
|
190
209
|
this.cheatCodes = this.context.cheatCodes;
|
|
191
210
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
192
211
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
@@ -223,7 +242,7 @@ export class FeesTest {
|
|
|
223
242
|
async applyDeployBananaToken() {
|
|
224
243
|
this.logger.info('Applying deploy banana token setup');
|
|
225
244
|
|
|
226
|
-
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
245
|
+
const { contract: bananaCoin } = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
227
246
|
from: this.aliceAddress,
|
|
228
247
|
});
|
|
229
248
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
@@ -244,7 +263,7 @@ export class FeesTest {
|
|
|
244
263
|
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
245
264
|
|
|
246
265
|
const bananaCoin = this.bananaCoin;
|
|
247
|
-
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
266
|
+
const { contract: bananaFPC } = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
248
267
|
from: this.aliceAddress,
|
|
249
268
|
});
|
|
250
269
|
|
|
@@ -293,6 +312,27 @@ export class FeesTest {
|
|
|
293
312
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
294
313
|
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
295
314
|
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Reads the prover fee that the rollup actually committed for the block's checkpoint, which is what
|
|
318
|
+
* RewardLib uses to pay prover rewards. Unlike `getProverFee`, this does not re-derive the value
|
|
319
|
+
* from current L1 fees or current eth-per-fee-asset price, so it is robust to pipelined fee-asset-price
|
|
320
|
+
* drift between propose-time and reward-payout-time.
|
|
321
|
+
*/
|
|
322
|
+
this.getCommittedProverFee = async (blockNumber: BlockNumber) => {
|
|
323
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
324
|
+
const feeHeader = await this.rollupContract.getFeeHeader(BigInt(block!.checkpointNumber));
|
|
325
|
+
return feeHeader.manaUsed * feeHeader.proverCost;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// RewardLib computes sequencerFee = checkpointFee - burn - proverFee where burn = manaUsed * congestionCost.
|
|
329
|
+
// The fixture's typical case keeps congestionCost at zero, but reading it explicitly avoids latent bugs
|
|
330
|
+
// when test load changes excess mana.
|
|
331
|
+
this.getCommittedBurn = async (blockNumber: BlockNumber) => {
|
|
332
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
333
|
+
const feeHeader = await this.rollupContract.getFeeHeader(BigInt(block!.checkpointNumber));
|
|
334
|
+
return feeHeader.manaUsed * feeHeader.congestionCost;
|
|
335
|
+
};
|
|
296
336
|
}
|
|
297
337
|
|
|
298
338
|
public async applySponsoredFPCSetup() {
|
|
@@ -7,6 +7,7 @@ import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
type EndToEndContext,
|
|
10
|
+
type SetupOptions,
|
|
10
11
|
deployAccounts,
|
|
11
12
|
publicDeployAccounts,
|
|
12
13
|
setup,
|
|
@@ -50,9 +51,10 @@ export class NestedContractTest {
|
|
|
50
51
|
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
async setup() {
|
|
54
|
+
async setup(opts: Partial<SetupOptions> = {}) {
|
|
54
55
|
this.logger.info('Setting up fresh subsystems');
|
|
55
56
|
this.context = await setup(0, {
|
|
57
|
+
...opts,
|
|
56
58
|
fundSponsoredFPC: true,
|
|
57
59
|
skipAccountDeployment: true,
|
|
58
60
|
});
|
|
@@ -65,9 +67,11 @@ export class NestedContractTest {
|
|
|
65
67
|
|
|
66
68
|
async applyManual() {
|
|
67
69
|
this.logger.info('Deploying parent and child contracts');
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.childContract =
|
|
70
|
+
({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({
|
|
71
|
+
from: this.defaultAccountAddress,
|
|
72
|
+
}));
|
|
73
|
+
({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({
|
|
74
|
+
from: this.defaultAccountAddress,
|
|
75
|
+
}));
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -58,6 +58,9 @@ export class P2PInactivityTest {
|
|
|
58
58
|
basePort: BOOT_NODE_UDP_PORT,
|
|
59
59
|
startProverNode: true,
|
|
60
60
|
initialConfig: {
|
|
61
|
+
enableProposerPipelining: true,
|
|
62
|
+
inboxLag: 2,
|
|
63
|
+
anvilSlotsInAnEpoch: 4,
|
|
61
64
|
proverNodeConfig: { proverNodeEpochProvingDelayMs: AZTEC_SLOT_DURATION * 1000 },
|
|
62
65
|
aztecTargetCommitteeSize: COMMITTEE_SIZE,
|
|
63
66
|
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
@@ -66,7 +69,6 @@ export class P2PInactivityTest {
|
|
|
66
69
|
listenAddress: '127.0.0.1',
|
|
67
70
|
minTxsPerBlock: 0,
|
|
68
71
|
aztecEpochDuration: EPOCH_DURATION,
|
|
69
|
-
validatorReexecute: false,
|
|
70
72
|
sentinelEnabled: true,
|
|
71
73
|
slashingQuorum: SLASHING_QUORUM,
|
|
72
74
|
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE_IN_EPOCHS,
|
|
@@ -108,7 +110,7 @@ export class P2PInactivityTest {
|
|
|
108
110
|
this.test.bootstrapNodeEnr,
|
|
109
111
|
NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode),
|
|
110
112
|
BOOT_NODE_UDP_PORT,
|
|
111
|
-
this.test.
|
|
113
|
+
this.test.genesis,
|
|
112
114
|
this.dataDir,
|
|
113
115
|
undefined,
|
|
114
116
|
Number(this.keepInitialNode),
|
|
@@ -122,7 +124,7 @@ export class P2PInactivityTest {
|
|
|
122
124
|
this.test.bootstrapNodeEnr,
|
|
123
125
|
this.inactiveNodeCount,
|
|
124
126
|
BOOT_NODE_UDP_PORT,
|
|
125
|
-
this.test.
|
|
127
|
+
this.test.genesis,
|
|
126
128
|
this.dataDir,
|
|
127
129
|
undefined,
|
|
128
130
|
NUM_NODES - this.inactiveNodeCount,
|