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 max-block-number and auth e2e tests #5694

Merged
merged 6 commits into from
Apr 11, 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
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
Loading