Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix flakey e2e fees failures test #8807

Merged
merged 3 commits into from
Sep 26, 2024
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
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ e2e-fees-dapp-subscription:
LOCALLY
RUN ./scripts/e2e_test.sh ./src/e2e_fees/dapp_subscription.test.ts

# e2e-fees-failures:
# LOCALLY
# RUN ./scripts/e2e_test.sh ./src/e2e_fees/failures.test.ts
e2e-fees-failures:
LOCALLY
RUN ./scripts/e2e_test.sh ./src/e2e_fees/failures.test.ts

e2e-fees-fee-juice-payments:
LOCALLY
Expand Down
14 changes: 14 additions & 0 deletions yarn-project/end-to-end/scripts/deflaker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

testname=$1
script_dir=$(dirname "$0")

for i in {1..100}
do
echo "Run #$i"
if ! yarn test $1 > $script_dir/deflaker.log 2>&1; then
echo "failed"
exit 1
fi
done
echo "success"
10 changes: 5 additions & 5 deletions yarn-project/end-to-end/src/e2e_fees/failures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
PublicFeePaymentMethod,
TxStatus,
computeSecretHash,
sleep,
} from '@aztec/aztec.js';
import { Gas, GasSettings } from '@aztec/circuits.js';
import { FunctionType } from '@aztec/foundation/abi';
Expand Down Expand Up @@ -82,7 +81,11 @@ describe('e2e_fees failures', () => {

// if we skip simulation, it includes the failed TX
const rebateSecret = Fr.random();

// We wait until the proven chain is caught up so all previous fees are paid out.
await t.catchUpProvenChain();
const currentSequencerL1Gas = await t.getCoinbaseBalance();

const txReceipt = await bananaCoin.methods
.transfer_public(aliceAddress, sequencerAddress, OutrageousPublicAmountAliceDoesNotHave, 0)
.send({
Expand All @@ -97,10 +100,7 @@ describe('e2e_fees failures', () => {
expect(txReceipt.status).toBe(TxStatus.APP_LOGIC_REVERTED);

// We wait until the block is proven since that is when the payout happens.
const bn = await t.aztecNode.getBlockNumber();
while ((await t.aztecNode.getProvenBlockNumber()) < bn) {
await sleep(1000);
}
await t.catchUpProvenChain();

const feeAmount = txReceipt.transactionFee!;
const newSequencerL1FeeAssetBalance = await t.getCoinbaseBalance();
Expand Down
8 changes: 8 additions & 0 deletions yarn-project/end-to-end/src/e2e_fees/fees_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
type TxHash,
computeSecretHash,
createDebugLogger,
sleep,
} from '@aztec/aztec.js';
import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint';
import { EthAddress, GasSettings, computePartialAddress } from '@aztec/circuits.js';
Expand Down Expand Up @@ -101,6 +102,13 @@ export class FeesTest {
await this.snapshotManager.teardown();
}

async catchUpProvenChain() {
const bn = await this.aztecNode.getBlockNumber();
while ((await this.aztecNode.getProvenBlockNumber()) < bn) {
await sleep(1000);
}
}

/** Alice mints Token */
async mintToken(amount: bigint) {
const balanceBefore = await this.token.methods.balance_of_private(this.aliceAddress).simulate();
Expand Down
Loading