From f1bf31431df68655fa5364c0504c2323ad660c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Thu, 11 Apr 2024 14:12:37 -0300 Subject: [PATCH] chore: fix max-block-number and auth e2e tests (#5694) This should fix the failures introduced by #5490. These were a bit of an unforntunate coincidence, https://github.com/AztecProtocol/aztec-packages/pull/5500 changed the underlying kernel data structures, and https://github.com/AztecProtocol/aztec-packages/pull/5432 changed what `simulate` does: both would've caused issues, but because `simulate`'s return type is `any` this went unnoticed until execution. I also added the new job to the earthly setup, still looking into why the old PR was merged despite failing. --------- Co-authored-by: Charlie Lye --- yarn-project/end-to-end/Earthfile | 4 ++++ .../end-to-end/src/e2e_auth_contract.test.ts | 6 ++--- .../src/e2e_max_block_number.test.ts | 24 +++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/yarn-project/end-to-end/Earthfile b/yarn-project/end-to-end/Earthfile index 85d6ffb644a..ec082d5c874 100644 --- a/yarn-project/end-to-end/Earthfile +++ b/yarn-project/end-to-end/Earthfile @@ -86,6 +86,10 @@ e2e-2-pxes: ARG e2e_mode=local DO +E2E_TEST --test=e2e_2_pxes.test.ts --e2e_mode=$e2e_mode +e2e-auth-contract: + ARG e2e_mode=local + DO +E2E_TEST --test=e2e_auth_contract.test.ts --e2e_mode=$e2e_mode + e2e-note-getter: ARG e2e_mode=local DO +E2E_TEST --test=e2e_note_getter.test.ts --e2e_mode=$e2e_mode diff --git a/yarn-project/end-to-end/src/e2e_auth_contract.test.ts b/yarn-project/end-to-end/src/e2e_auth_contract.test.ts index a5a3da14d14..b2568365140 100644 --- a/yarn-project/end-to-end/src/e2e_auth_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_auth_contract.test.ts @@ -83,7 +83,7 @@ describe('e2e_auth_contract', () => { const interaction = contract.withWallet(authorized).methods.do_private_authorized_thing(VALUE); - const tx = await interaction.simulate(); + const tx = await interaction.prove(); const lastBlockNumber = await pxe.getBlockNumber(); // In the last block there was no scheduled value change, so the earliest one could be scheduled is in the next @@ -91,8 +91,8 @@ describe('e2e_auth_contract', () => { // horizon should be the block preceding that one. const expectedMaxBlockNumber = lastBlockNumber + DELAY; - expect(tx.data.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); - expect(tx.data.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(expectedMaxBlockNumber)); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(expectedMaxBlockNumber)); await assertLoggedNumber(interaction, VALUE); }); diff --git a/yarn-project/end-to-end/src/e2e_max_block_number.test.ts b/yarn-project/end-to-end/src/e2e_max_block_number.test.ts index ed022b3acff..7000bcd5df7 100644 --- a/yarn-project/end-to-end/src/e2e_max_block_number.test.ts +++ b/yarn-project/end-to-end/src/e2e_max_block_number.test.ts @@ -28,9 +28,9 @@ describe('e2e_max_block_number', () => { const enqueuePublicCall = false; it('sets the max block number', async () => { - const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).simulate(); - expect(tx.data.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); - expect(tx.data.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); + const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).prove(); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); }); it('does not invalidate the transaction', async () => { @@ -42,9 +42,9 @@ describe('e2e_max_block_number', () => { const enqueuePublicCall = true; it('sets the max block number', async () => { - const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).simulate(); - expect(tx.data.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); - expect(tx.data.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); + const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).prove(); + expect(tx.data.forPublic!.validationRequests.forRollup.maxBlockNumber.isSome).toEqual(true); + expect(tx.data.forPublic!.validationRequests.forRollup.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); }); it('does not invalidate the transaction', async () => { @@ -64,9 +64,9 @@ describe('e2e_max_block_number', () => { const enqueuePublicCall = false; it('sets the max block number', async () => { - const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).simulate(); - expect(tx.data.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); - expect(tx.data.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); + const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).prove(); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); + expect(tx.data.forRollup!.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); }); it('invalidates the transaction', async () => { @@ -80,9 +80,9 @@ describe('e2e_max_block_number', () => { const enqueuePublicCall = true; it('sets the max block number', async () => { - const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).simulate(); - expect(tx.data.rollupValidationRequests.maxBlockNumber.isSome).toEqual(true); - expect(tx.data.rollupValidationRequests.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); + const tx = await contract.methods.set_tx_max_block_number(maxBlockNumber, enqueuePublicCall).prove(); + expect(tx.data.forPublic!.validationRequests.forRollup.maxBlockNumber.isSome).toEqual(true); + expect(tx.data.forPublic!.validationRequests.forRollup.maxBlockNumber.value).toEqual(new Fr(maxBlockNumber)); }); it('invalidates the transaction', async () => {