From 46074c24a49f4945111d1aa744be391557a89b30 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Mon, 6 Jul 2026 10:32:15 -0300 Subject: [PATCH] test(e2e): instrument bot suite setup and fees proven-chain residuals Adds timing spans so the untagged residual of the bot suite's file-level beforeAll (~178s on CI, 97% invisible) can be decomposed and the ~32s/shard proven-chain residual in the private_payments/failures fees suites becomes visible. Bot suite (single-node/bot/bot.test.ts): - setup:wallet around EmbeddedWallet.create (stands up the ephemeral PXE) - wallet:create around createSchnorrInitializerlessAccount (same concept as createFundedInitializerlessAccounts, already tagged wallet:create) - setup:bot around the nested describes' Bot.create/AmmBot.create/ CrossChainBot.create/BotStore creation, which the suite-line accounting folds into the same suite beforeHooksMs as the file hook Fees harness (single-node/fees): - wait:proven-checkpoint around catchUpProvenChain's poll loop - warp:proven-checkpoint-epoch around advanceToNextEpoch, via a new instrumented FeesTest.advanceToNextEpoch() wrapper that waitForEpochProven and the direct call sites in failures/private_payments now route through Reuses existing tags where the concept matches rather than inventing near-duplicates. Spans are passthrough when TEST_TIMING_FILE is unset, so this is zero behavior change. --- .../src/single-node/bot/bot.test.ts | 25 +++++++++++-------- .../src/single-node/fees/failures.test.ts | 8 +++--- .../src/single-node/fees/fees_test.ts | 17 +++++++++---- .../fees/private_payments.parallel.test.ts | 2 +- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/yarn-project/end-to-end/src/single-node/bot/bot.test.ts b/yarn-project/end-to-end/src/single-node/bot/bot.test.ts index 3a73306a5c8a..75a54e5b92f2 100644 --- a/yarn-project/end-to-end/src/single-node/bot/bot.test.ts +++ b/yarn-project/end-to-end/src/single-node/bot/bot.test.ts @@ -22,6 +22,7 @@ import { EmbeddedWallet } from '@aztec/wallets/embedded'; import { jest } from '@jest/globals'; import { PIPELINED_FEE_PADDING, PIPELINING_SETUP_OPTS } from '../../fixtures/fixtures.js'; +import { testSpan } from '../../fixtures/timing.js'; import { getPrivateKeyFromIndex, setup } from '../../fixtures/utils.js'; import { NO_REORG_SUBMISSION_EPOCHS } from '../setup.js'; @@ -54,8 +55,10 @@ describe('single-node/bot/bot', () => { cheatCodes, config: { l1RpcUrls }, } = setupResult); - wallet = await EmbeddedWallet.create(aztecNode, { ephemeral: true }); - await wallet.createSchnorrInitializerlessAccount(botAccount.secret, botAccount.salt, botAccount.signingKey); + wallet = await testSpan('setup:wallet', () => EmbeddedWallet.create(aztecNode, { ephemeral: true })); + await testSpan('wallet:create', () => + wallet.createSchnorrInitializerlessAccount(botAccount.secret, botAccount.salt, botAccount.signingKey), + ); }); afterAll(() => teardown()); @@ -73,7 +76,9 @@ describe('single-node/bot/bot', () => { botMode: 'transfer', minFeePadding: PIPELINED_FEE_PADDING, }; - bot = await Bot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))); + bot = await testSpan('setup:bot', async () => + Bot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))), + ); }); // Runs bot.run() once and asserts recipient private and public balances each increase by 1. @@ -131,7 +136,7 @@ describe('single-node/bot/bot', () => { let store: BotStore; beforeAll(async () => { - store = new BotStore(await openTmpStore('bot')); + store = await testSpan('setup:bot', async () => new BotStore(await openTmpStore('bot'))); }); afterAll(async () => { @@ -238,7 +243,9 @@ describe('single-node/bot/bot', () => { followChain: 'CHECKPOINTED', botMode: 'amm', }; - bot = await AmmBot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))); + bot = await testSpan('setup:bot', async () => + AmmBot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))), + ); }); // Runs the AMM bot once and asserts one of the two private token balances decreased and @@ -302,12 +309,8 @@ describe('single-node/bot/bot', () => { flushSetupTransactions: true, l1ToL2SeedCount: 2, }; - bot = await CrossChainBot.create( - config, - wallet, - aztecNode, - aztecNodeAdmin, - new BotStore(await openTmpStore('bot')), + bot = await testSpan('setup:bot', async () => + CrossChainBot.create(config, wallet, aztecNode, aztecNodeAdmin, new BotStore(await openTmpStore('bot'))), ); }, 600_000); diff --git a/yarn-project/end-to-end/src/single-node/fees/failures.test.ts b/yarn-project/end-to-end/src/single-node/fees/failures.test.ts index 234b84c54f44..44a5124cb0f5 100644 --- a/yarn-project/end-to-end/src/single-node/fees/failures.test.ts +++ b/yarn-project/end-to-end/src/single-node/fees/failures.test.ts @@ -57,7 +57,7 @@ describe('single-node/fees/failures', () => { aztecNode = t.aztecNode; // Prove up until the current state by advancing the epoch and waiting for the prover node. - await t.cheatCodes.rollup.advanceToNextEpoch(); + await t.advanceToNextEpoch(); await t.catchUpProvenChain(); }); @@ -123,7 +123,7 @@ describe('single-node/fees/failures', () => { // @note There is a potential race condition here if other tests send transactions that get into the same // epoch and thereby pays out fees at the same time (when proven). - await t.cheatCodes.rollup.advanceToNextEpoch(); + await t.advanceToNextEpoch(); const provenTimeout = (t.context.config.aztecProofSubmissionEpochs + 1) * t.context.config.aztecEpochDuration * @@ -362,7 +362,7 @@ describe('single-node/fees/failures', () => { ); // Prove the block containing the teardown-reverted tx (revert_code = 2). - await t.cheatCodes.rollup.advanceToNextEpoch(); + await t.advanceToNextEpoch(); const provenTimeout = (t.context.config.aztecProofSubmissionEpochs + 1) * t.context.config.aztecEpochDuration * @@ -389,7 +389,7 @@ describe('single-node/fees/failures', () => { expect(receipt.executionResult).toBe(TxExecutionResult.REVERTED); expect(receipt.transactionFee).toBeGreaterThan(0n); - await t.cheatCodes.rollup.advanceToNextEpoch(); + await t.advanceToNextEpoch(); const provenTimeout = (t.context.config.aztecProofSubmissionEpochs + 1) * t.context.config.aztecEpochDuration * diff --git a/yarn-project/end-to-end/src/single-node/fees/fees_test.ts b/yarn-project/end-to-end/src/single-node/fees/fees_test.ts index 0cc1d3a38a88..cfb353025bcd 100644 --- a/yarn-project/end-to-end/src/single-node/fees/fees_test.ts +++ b/yarn-project/end-to-end/src/single-node/fees/fees_test.ts @@ -131,15 +131,22 @@ export class FeesTest extends SingleNodeTestContext { } async catchUpProvenChain() { - const bn = await this.aztecNode.getBlockNumber(); - while ((await this.aztecNode.getBlockNumber('proven')) < bn) { - await sleep(1000); - } + await testSpan('wait:proven-checkpoint', async () => { + const bn = await this.aztecNode.getBlockNumber(); + while ((await this.aztecNode.getBlockNumber('proven')) < bn) { + await sleep(1000); + } + }); + } + + /** Warps L1 to the next epoch boundary so the current epoch closes and can be proven. */ + async advanceToNextEpoch() { + await testSpan('warp:proven-checkpoint-epoch', () => this.cheatCodes.rollup.advanceToNextEpoch()); } /** Advances to the next epoch and waits for the proven chain to catch up, so all prior fees are paid out. */ async waitForEpochProven() { - await this.cheatCodes.rollup.advanceToNextEpoch(); + await this.advanceToNextEpoch(); await this.catchUpProvenChain(); } diff --git a/yarn-project/end-to-end/src/single-node/fees/private_payments.parallel.test.ts b/yarn-project/end-to-end/src/single-node/fees/private_payments.parallel.test.ts index ad155ec4a467..77b51cfbb7ee 100644 --- a/yarn-project/end-to-end/src/single-node/fees/private_payments.parallel.test.ts +++ b/yarn-project/end-to-end/src/single-node/fees/private_payments.parallel.test.ts @@ -140,7 +140,7 @@ describe('single-node/fees/private_payments', () => { const provenCheckpointBefore = await t.rollupContract.getProvenCheckpointNumber(); const receipt = await localTx.send({ timeout: 300, interval: 10 }); - await t.cheatCodes.rollup.advanceToNextEpoch(); + await t.advanceToNextEpoch(); await waitForProven(aztecNode, receipt, { provenTimeout: 300 });