Skip to content

Commit

Permalink
chore: fix max-block-number and auth e2e tests (#5694)
Browse files Browse the repository at this point in the history
This should fix the failures introduced by #5490. These were a bit of an
unforntunate coincidence,
#5500 changed the
underlying kernel data structures, and
#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 <karl.lye@gmail.com>
  • Loading branch information
nventuro and charlielye authored Apr 11, 2024
1 parent bf35464 commit f1bf314
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 4 additions & 0 deletions yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/src/e2e_auth_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ 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
// block. Because of the delay, the block of change would be lastBlockNumber + 1 + DELAY. Therefore the block
// 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);
});
Expand Down
24 changes: 12 additions & 12 deletions yarn-project/end-to-end/src/e2e_max_block_number.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit f1bf314

Please sign in to comment.