Skip to content

Commit 1f7898c

Browse files
committed
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.
1 parent a8cfa93 commit 1f7898c

4 files changed

Lines changed: 31 additions & 21 deletions

File tree

yarn-project/end-to-end/src/single-node/bot/bot.test.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { EmbeddedWallet } from '@aztec/wallets/embedded';
2222
import { jest } from '@jest/globals';
2323

2424
import { PIPELINED_FEE_PADDING, PIPELINING_SETUP_OPTS } from '../../fixtures/fixtures.js';
25+
import { testSpan } from '../../fixtures/timing.js';
2526
import { getPrivateKeyFromIndex, setup } from '../../fixtures/utils.js';
2627
import { NO_REORG_SUBMISSION_EPOCHS } from '../setup.js';
2728

@@ -54,8 +55,10 @@ describe('single-node/bot/bot', () => {
5455
cheatCodes,
5556
config: { l1RpcUrls },
5657
} = setupResult);
57-
wallet = await EmbeddedWallet.create(aztecNode, { ephemeral: true });
58-
await wallet.createSchnorrInitializerlessAccount(botAccount.secret, botAccount.salt, botAccount.signingKey);
58+
wallet = await testSpan('setup:wallet', () => EmbeddedWallet.create(aztecNode, { ephemeral: true }));
59+
await testSpan('wallet:create', () =>
60+
wallet.createSchnorrInitializerlessAccount(botAccount.secret, botAccount.salt, botAccount.signingKey),
61+
);
5962
});
6063

6164
afterAll(() => teardown());
@@ -73,7 +76,9 @@ describe('single-node/bot/bot', () => {
7376
botMode: 'transfer',
7477
minFeePadding: PIPELINED_FEE_PADDING,
7578
};
76-
bot = await Bot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot')));
79+
bot = await testSpan('setup:bot', async () =>
80+
Bot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))),
81+
);
7782
});
7883

7984
// Runs bot.run() once and asserts recipient private and public balances each increase by 1.
@@ -131,7 +136,7 @@ describe('single-node/bot/bot', () => {
131136
let store: BotStore;
132137

133138
beforeAll(async () => {
134-
store = new BotStore(await openTmpStore('bot'));
139+
store = await testSpan('setup:bot', async () => new BotStore(await openTmpStore('bot')));
135140
});
136141

137142
afterAll(async () => {
@@ -238,7 +243,9 @@ describe('single-node/bot/bot', () => {
238243
followChain: 'CHECKPOINTED',
239244
botMode: 'amm',
240245
};
241-
bot = await AmmBot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot')));
246+
bot = await testSpan('setup:bot', async () =>
247+
AmmBot.create(config, wallet, aztecNode, undefined, new BotStore(await openTmpStore('bot'))),
248+
);
242249
});
243250

244251
// 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', () => {
302309
flushSetupTransactions: true,
303310
l1ToL2SeedCount: 2,
304311
};
305-
bot = await CrossChainBot.create(
306-
config,
307-
wallet,
308-
aztecNode,
309-
aztecNodeAdmin,
310-
new BotStore(await openTmpStore('bot')),
312+
bot = await testSpan('setup:bot', async () =>
313+
CrossChainBot.create(config, wallet, aztecNode, aztecNodeAdmin, new BotStore(await openTmpStore('bot'))),
311314
);
312315
}, 600_000);
313316

yarn-project/end-to-end/src/single-node/fees/failures.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('single-node/fees/failures', () => {
5757
aztecNode = t.aztecNode;
5858

5959
// Prove up until the current state by advancing the epoch and waiting for the prover node.
60-
await t.cheatCodes.rollup.advanceToNextEpoch();
60+
await t.advanceToNextEpoch();
6161
await t.catchUpProvenChain();
6262
});
6363

@@ -123,7 +123,7 @@ describe('single-node/fees/failures', () => {
123123

124124
// @note There is a potential race condition here if other tests send transactions that get into the same
125125
// epoch and thereby pays out fees at the same time (when proven).
126-
await t.cheatCodes.rollup.advanceToNextEpoch();
126+
await t.advanceToNextEpoch();
127127
const provenTimeout =
128128
(t.context.config.aztecProofSubmissionEpochs + 1) *
129129
t.context.config.aztecEpochDuration *
@@ -362,7 +362,7 @@ describe('single-node/fees/failures', () => {
362362
);
363363

364364
// Prove the block containing the teardown-reverted tx (revert_code = 2).
365-
await t.cheatCodes.rollup.advanceToNextEpoch();
365+
await t.advanceToNextEpoch();
366366
const provenTimeout =
367367
(t.context.config.aztecProofSubmissionEpochs + 1) *
368368
t.context.config.aztecEpochDuration *
@@ -389,7 +389,7 @@ describe('single-node/fees/failures', () => {
389389
expect(receipt.executionResult).toBe(TxExecutionResult.REVERTED);
390390
expect(receipt.transactionFee).toBeGreaterThan(0n);
391391

392-
await t.cheatCodes.rollup.advanceToNextEpoch();
392+
await t.advanceToNextEpoch();
393393
const provenTimeout =
394394
(t.context.config.aztecProofSubmissionEpochs + 1) *
395395
t.context.config.aztecEpochDuration *

yarn-project/end-to-end/src/single-node/fees/fees_test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,22 @@ export class FeesTest extends SingleNodeTestContext {
131131
}
132132

133133
async catchUpProvenChain() {
134-
const bn = await this.aztecNode.getBlockNumber();
135-
while ((await this.aztecNode.getBlockNumber('proven')) < bn) {
136-
await sleep(1000);
137-
}
134+
await testSpan('wait:proven-checkpoint', async () => {
135+
const bn = await this.aztecNode.getBlockNumber();
136+
while ((await this.aztecNode.getBlockNumber('proven')) < bn) {
137+
await sleep(1000);
138+
}
139+
});
140+
}
141+
142+
/** Warps L1 to the next epoch boundary so the current epoch closes and can be proven. */
143+
async advanceToNextEpoch() {
144+
await testSpan('warp:proven-checkpoint-epoch', () => this.cheatCodes.rollup.advanceToNextEpoch());
138145
}
139146

140147
/** Advances to the next epoch and waits for the proven chain to catch up, so all prior fees are paid out. */
141148
async waitForEpochProven() {
142-
await this.cheatCodes.rollup.advanceToNextEpoch();
149+
await this.advanceToNextEpoch();
143150
await this.catchUpProvenChain();
144151
}
145152

yarn-project/end-to-end/src/single-node/fees/private_payments.parallel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('single-node/fees/private_payments', () => {
140140
const provenCheckpointBefore = await t.rollupContract.getProvenCheckpointNumber();
141141

142142
const receipt = await localTx.send({ timeout: 300, interval: 10 });
143-
await t.cheatCodes.rollup.advanceToNextEpoch();
143+
await t.advanceToNextEpoch();
144144

145145
await waitForProven(aztecNode, receipt, { provenTimeout: 300 });
146146

0 commit comments

Comments
 (0)