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

support for expectRevert(bytes4) #519

Merged
merged 17 commits into from
Apr 25, 2024
Merged

Conversation

ovatman
Copy link
Contributor

@ovatman ovatman commented Apr 17, 2024

Resolves #466

This PR contains

  • matching expectRevert(bytes4) selector in cheatcode support
  • After revert happens, when checking to clear the revert previous version was checking the whole output with the expected reason except the initial 4 bytes. This version just checks the last 32 bytes which contain the whole selector information (regardless of the type of parameter)

@ovatman ovatman added the enhancement New feature or request label Apr 17, 2024
@ovatman ovatman self-assigned this Apr 17, 2024
@ovatman ovatman requested a review from anvacaru April 17, 2024 21:21
@anvacaru
Copy link
Contributor

There are at least two tests that are skipped because we didn't have support for this cheatcode. Can you remove them from the *-skip and *-skip-legacy lists?

  • testFail_expectRevert_bytes4
  • test_expectRevert_bytes4

@ovatman
Copy link
Contributor Author

ovatman commented Apr 18, 2024

There are at least two tests that are skipped because we didn't have support for this cheatcode. Can you remove them from the *-skip and *-skip-legacy lists?

* `testFail_expectRevert_bytes4`

* `test_expectRevert_bytes4`

They have been added now.

@ovatman ovatman marked this pull request as draft April 24, 2024 07:19
@ovatman
Copy link
Contributor Author

ovatman commented Apr 24, 2024

When bytes4 type parameter is used some of the information is not directly included in the EXPECTED data since they become constant values, such as the size of the expected output. Here we set them manually to constant values.

@ovatman ovatman marked this pull request as ready for review April 24, 2024 15:53
@ovatman ovatman requested a review from anvacaru April 24, 2024 15:53
Copy link
Contributor

@anvacaru anvacaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with some formatting comments.

src/kontrol/kdist/cheatcodes.md Outdated Show resolved Hide resolved
src/kontrol/kdist/cheatcodes.md Outdated Show resolved Hide resolved
ovatman and others added 2 commits April 25, 2024 15:09
Co-authored-by: Andrei Văcaru <[email protected]>
Co-authored-by: Andrei Văcaru <[email protected]>
@rv-jenkins rv-jenkins merged commit b7065f7 into master Apr 25, 2024
12 checks passed
@rv-jenkins rv-jenkins deleted the tolga/expectrevert-bytes4-support branch April 25, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support expectRevert(bytes4) cheatcode
5 participants