Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions yarn-project/end-to-end/src/single-node/bot/bot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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());
Expand All @@ -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.
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions yarn-project/end-to-end/src/single-node/fees/failures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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 *
Expand All @@ -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 *
Expand Down
17 changes: 12 additions & 5 deletions yarn-project/end-to-end/src/single-node/fees/fees_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
Loading