-
Notifications
You must be signed in to change notification settings - Fork 615
fix: include validation reason in PXE simulate error #20768
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,14 @@ describe('e2e_expiration_timestamp', () => { | |
| .send({ from: defaultAccountAddress }), | ||
| ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); | ||
| }); | ||
|
|
||
| it('simulation includes validation reason in error', async () => { | ||
| await expect( | ||
| contract.methods | ||
| .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) | ||
| .simulate({ from: defaultAccountAddress }), | ||
| ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); | ||
| }); | ||
| }); | ||
|
|
||
| describe('with an enqueued public call', () => { | ||
|
|
@@ -135,6 +143,14 @@ describe('e2e_expiration_timestamp', () => { | |
| .send({ from: defaultAccountAddress }), | ||
| ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); | ||
| }); | ||
|
|
||
| it('simulation includes validation reason in error', async () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above BTW did you check if it really makes sense to have this be checked by 2 tests? Shouldn't the timestamp expiration be enforced by one code path irrespective of enqueued public calls?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was just to mimic send's behavior, which is tested in both places. But we can keep only one, since it isn't affected by presence/lack of enqueued calls |
||
| await expect( | ||
| contract.methods | ||
| .set_expiration_timestamp(expirationTimestamp, enqueuePublicCall) | ||
| .simulate({ from: defaultAccountAddress }), | ||
| ).rejects.toThrow(TX_ERROR_INVALID_EXPIRATION_TIMESTAMP); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like the best test suite for it as it's not testing the expiration timestamp but pxe.
AI recommended this:
Not sure if e2e_avm is the correct place though as it might be a big pile of ancient mess and this is testing pxe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially added the tests here because the original issue reported a problem with discarded error messages on timestamps failures. I would personally leave one of the tests here, so we test the timestamps failures both send and simulate workflows
I did look for other e2e tests to test this better, but I failed to find one that simply tests PXE's handling of errors, or something similar. Would you like me to create one?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just create e2e_pxe test for it and document there what we are testing and add there a todo to ideally eventually make it a non-e2e test.
The problem with this is that it makes the test suite hard to read because nobody would expect that you test pxe here.