From 41972b810c98024f4a9886d7262b5d5eef77f6aa Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Thu, 28 May 2026 18:20:00 -0300 Subject: [PATCH] test: migrate benchmarks to pipelining setup --- .../client_flows/client_flows_benchmark.ts | 4 ++-- .../src/bench/node_rpc_perf.test.ts | 2 ++ .../src/bench/tx_stats_bench.test.ts | 8 +++---- yarn-project/end-to-end/src/bench/utils.ts | 3 ++- .../src/shared/gas_portal_test_harness.ts | 24 +++++++++++++------ 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/yarn-project/end-to-end/src/bench/client_flows/client_flows_benchmark.ts b/yarn-project/end-to-end/src/bench/client_flows/client_flows_benchmark.ts index 0858e18e26b3..74ba3a4439d7 100644 --- a/yarn-project/end-to-end/src/bench/client_flows/client_flows_benchmark.ts +++ b/yarn-project/end-to-end/src/bench/client_flows/client_flows_benchmark.ts @@ -28,7 +28,7 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract'; import { GasSettings } from '@aztec/stdlib/gas'; import { deriveSigningKey } from '@aztec/stdlib/keys'; -import { MNEMONIC, getPaddedMaxFeesPerGas } from '../../fixtures/fixtures.js'; +import { AUTOMINE_E2E_OPTS, MNEMONIC, getPaddedMaxFeesPerGas } from '../../fixtures/fixtures.js'; import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js'; import { mintTokensToPrivate } from '../../fixtures/token_utils.js'; import { setupSponsoredFPC } from '../../fixtures/utils.js'; @@ -125,7 +125,7 @@ export class ClientFlowsBenchmark { constructor(testName?: string, setupOptions: Partial = {}) { this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`); - this.setupOptions = { startProverNode: true, ...setupOptions }; + this.setupOptions = { ...AUTOMINE_E2E_OPTS, startProverNode: true, ...setupOptions }; this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG; ProxyLogger.create(); this.proxyLogger = ProxyLogger.getInstance(); diff --git a/yarn-project/end-to-end/src/bench/node_rpc_perf.test.ts b/yarn-project/end-to-end/src/bench/node_rpc_perf.test.ts index f2db3a0ba546..a0db5a60f32c 100644 --- a/yarn-project/end-to-end/src/bench/node_rpc_perf.test.ts +++ b/yarn-project/end-to-end/src/bench/node_rpc_perf.test.ts @@ -24,6 +24,7 @@ import { mkdir, writeFile } from 'fs/promises'; import 'jest-extended'; import * as path from 'path'; +import { PIPELINING_SETUP_OPTS } from '../fixtures/fixtures.js'; import { setup } from '../fixtures/utils.js'; import type { TestWallet } from '../test-wallet/test_wallet.js'; import { proveInteraction } from '../test-wallet/utils.js'; @@ -148,6 +149,7 @@ describe('e2e_node_rpc_perf', () => { sequencerPollingIntervalMS: 200, worldStateBlockCheckIntervalMS: 200, blockCheckIntervalMS: 200, + ...PIPELINING_SETUP_OPTS, minTxsPerBlock: 1, })); diff --git a/yarn-project/end-to-end/src/bench/tx_stats_bench.test.ts b/yarn-project/end-to-end/src/bench/tx_stats_bench.test.ts index 1d58f3a3e40e..4b0fda236914 100644 --- a/yarn-project/end-to-end/src/bench/tx_stats_bench.test.ts +++ b/yarn-project/end-to-end/src/bench/tx_stats_bench.test.ts @@ -20,14 +20,14 @@ import { } from 'zlib'; import { FullProverTest } from '../fixtures/e2e_prover_test.js'; +import { PIPELINING_SETUP_OPTS } from '../fixtures/fixtures.js'; import type { TestWallet } from '../test-wallet/test_wallet.js'; import { proveInteraction } from '../test-wallet/utils.js'; -// Set a 3 minute timeout. -const TIMEOUT = 300_000; +const REAL_PROOFS = !parseBooleanEnv(process.env.FAKE_PROOFS); +const TIMEOUT = REAL_PROOFS ? 45 * 60 * 1000 : 15 * 60 * 1000; describe('transaction benchmarks', () => { - const REAL_PROOFS = !parseBooleanEnv(process.env.FAKE_PROOFS); const COINBASE_ADDRESS = EthAddress.random(); const t = new FullProverTest('full_prover', 1, COINBASE_ADDRESS, REAL_PROOFS); @@ -55,7 +55,7 @@ describe('transaction benchmarks', () => { beforeAll(async () => { t.logger.warn(`Running suite with ${REAL_PROOFS ? 'real' : 'fake'} proofs`); - await t.setup(); + await t.setup({ ...PIPELINING_SETUP_OPTS }); ({ provenWallet, diff --git a/yarn-project/end-to-end/src/bench/utils.ts b/yarn-project/end-to-end/src/bench/utils.ts index 7daa924782df..78834612d929 100644 --- a/yarn-project/end-to-end/src/bench/utils.ts +++ b/yarn-project/end-to-end/src/bench/utils.ts @@ -11,6 +11,7 @@ import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient import { mkdirSync, writeFileSync } from 'fs'; import path from 'path'; +import { PIPELINING_SETUP_OPTS } from '../fixtures/fixtures.js'; import { type EndToEndContext, type SetupOptions, setup } from '../fixtures/utils.js'; /** @@ -23,7 +24,7 @@ export async function benchmarkSetup( benchOutput?: string; }, ) { - const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } }); + const context = await setup(1, { ...PIPELINING_SETUP_OPTS, ...opts, telemetryConfig: { benchmark: true } }); const defaultAccountAddress = context.accounts[0]; const { contract } = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }); context.logger.info(`Deployed benchmarking contract at ${contract.address}`); diff --git a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts index e894e77862a7..0d3285247727 100644 --- a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts @@ -8,10 +8,13 @@ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types'; import { retryUntil } from '@aztec/foundation/retry'; import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; -import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client'; +import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { waitForL1ToL2MessageSeen } from './wait_for_l1_to_l2_message.js'; +/** Aztec node that may expose the debug mining API in local e2e setups. */ +type MiningAztecNode = AztecNode & Partial; + export interface IGasBridgingTestHarness { getL1FeeJuiceBalance(address: EthAddress): Promise; prepareTokensOnL1(owner: AztecAddress): Promise; @@ -21,7 +24,7 @@ export interface IGasBridgingTestHarness { } export interface FeeJuicePortalTestingHarnessFactoryConfig { - aztecNode: AztecNode; + aztecNode: MiningAztecNode; aztecNodeAdmin?: AztecNodeAdmin; l1Client: ExtendedViemWalletClient; wallet: Wallet; @@ -77,7 +80,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { constructor( /** Aztec node */ - public aztecNode: AztecNode, + public aztecNode: MiningAztecNode, /** Aztec node admin interface */ public aztecNodeAdmin: AztecNodeAdmin | undefined, /** Wallet. */ @@ -164,6 +167,11 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { } private async advanceL2Block() { + if (this.aztecNode.mineBlock) { + await this.aztecNode.mineBlock(); + return; + } + const initialBlockNumber = await this.aztecNode.getBlockNumber(); let minTxsPerBlock = undefined; @@ -172,10 +180,12 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { await this.aztecNodeAdmin.setConfig({ minTxsPerBlock: 0 }); // Set to 0 to ensure we can advance the block } - await retryUntil(async () => (await this.aztecNode.getBlockNumber()) >= initialBlockNumber + 1); - - if (this.aztecNodeAdmin && minTxsPerBlock !== undefined) { - await this.aztecNodeAdmin.setConfig({ minTxsPerBlock }); + try { + await retryUntil(async () => (await this.aztecNode.getBlockNumber()) >= initialBlockNumber + 1); + } finally { + if (this.aztecNodeAdmin && minTxsPerBlock !== undefined) { + await this.aztecNodeAdmin.setConfig({ minTxsPerBlock }); + } } } }