From 61141400d61835283f7cede3bbf3d98c85c08347 Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 25 Sep 2024 19:46:33 -0400 Subject: [PATCH 1/3] set max block size in fees test. --- yarn-project/end-to-end/Earthfile | 6 +++--- yarn-project/end-to-end/src/e2e_fees/failures.test.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yarn-project/end-to-end/Earthfile b/yarn-project/end-to-end/Earthfile index 2cf744c225d..83f95c3712f 100644 --- a/yarn-project/end-to-end/Earthfile +++ b/yarn-project/end-to-end/Earthfile @@ -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 diff --git a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts index 253cada5a31..af6f4c2e517 100644 --- a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts @@ -31,6 +31,7 @@ describe('e2e_fees failures', () => { await t.applyBaseSnapshots(); await t.applyFPCSetupSnapshot(); ({ aliceWallet, aliceAddress, sequencerAddress, bananaCoin, bananaFPC, gasSettings } = await t.setup()); + await t.aztecNode.setConfig({ minTxsPerBlock: 1, maxTxsPerBlock: 1 }); }); afterAll(async () => { From 8b6a163b8ae40a356c30cba5b0c959b4ecb2bec8 Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 25 Sep 2024 20:36:03 -0400 Subject: [PATCH 2/3] actually fix the test --- yarn-project/end-to-end/scripts/deflaker.sh | 14 ++++++++++++++ .../end-to-end/src/e2e_fees/failures.test.ts | 11 +++++------ yarn-project/end-to-end/src/e2e_fees/fees_test.ts | 8 ++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 yarn-project/end-to-end/scripts/deflaker.sh diff --git a/yarn-project/end-to-end/scripts/deflaker.sh b/yarn-project/end-to-end/scripts/deflaker.sh new file mode 100755 index 00000000000..072a5f2952a --- /dev/null +++ b/yarn-project/end-to-end/scripts/deflaker.sh @@ -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" diff --git a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts index af6f4c2e517..5b7fad4ed1f 100644 --- a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts @@ -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'; @@ -31,7 +30,6 @@ describe('e2e_fees failures', () => { await t.applyBaseSnapshots(); await t.applyFPCSetupSnapshot(); ({ aliceWallet, aliceAddress, sequencerAddress, bananaCoin, bananaFPC, gasSettings } = await t.setup()); - await t.aztecNode.setConfig({ minTxsPerBlock: 1, maxTxsPerBlock: 1 }); }); afterAll(async () => { @@ -84,6 +82,10 @@ describe('e2e_fees failures', () => { // if we skip simulation, it includes the failed TX const rebateSecret = Fr.random(); const currentSequencerL1Gas = await t.getCoinbaseBalance(); + + // We wait until the proven chain is caught up so all previous fees are paid out. + await t.catchUpProvenChain(); + const txReceipt = await bananaCoin.methods .transfer_public(aliceAddress, sequencerAddress, OutrageousPublicAmountAliceDoesNotHave, 0) .send({ @@ -98,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(); diff --git a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts index 4beb1b07dee..aa5761aa80f 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts @@ -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'; @@ -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(); From e07daa148480a9d1702820342d544c0c5739520c Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 25 Sep 2024 20:54:55 -0400 Subject: [PATCH 3/3] put the catchup in the right spot --- yarn-project/end-to-end/src/e2e_fees/failures.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts index 5b7fad4ed1f..60a418bdee6 100644 --- a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts @@ -81,10 +81,10 @@ describe('e2e_fees failures', () => { // if we skip simulation, it includes the failed TX const rebateSecret = Fr.random(); - const currentSequencerL1Gas = await t.getCoinbaseBalance(); // 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)