-
Notifications
You must be signed in to change notification settings - Fork 48
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
Cheatcodes as per new std-forge library #567
Open
msooseth
wants to merge
25
commits into
main
Choose a base branch
from
implement_new_cheatcodes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msooseth
force-pushed
the
implement_new_cheatcodes
branch
2 times, most recently
from
October 28, 2024 11:21
e78213a
to
c0cca47
Compare
msooseth
changed the title
[TODO] Cheatcodes TODOs
Cheatcodes as per new std-forge library
Oct 29, 2024
msooseth
changed the title
Cheatcodes as per new std-forge library
[DRAFT] Cheatcodes as per new std-forge library
Oct 29, 2024
msooseth
force-pushed
the
implement_new_cheatcodes
branch
7 times, most recently
from
October 29, 2024 17:46
fd7745f
to
527025f
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
October 29, 2024 17:51
527025f
to
a16d3c0
Compare
msooseth
commented
Oct 29, 2024
Comment on lines
-290
to
-297
checkSymFailures :: VMOps t => UnitTestOptions RealWorld -> Stepper t RealWorld (VM t RealWorld) | ||
checkSymFailures UnitTestOptions { .. } = do | ||
-- Ask whether any assertions failed | ||
Stepper.evm $ do | ||
popTrace | ||
abiCall testParams (Left ("failed()", emptyAbi)) | ||
Stepper.runFully | ||
|
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 is not used anywhere, so I'm removing it
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
October 31, 2024 11:54
6d87659
to
0905738
Compare
d-xo
reviewed
Oct 31, 2024
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 8, 2024 05:00
2cee6f1
to
48215cc
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 8, 2024 05:05
48215cc
to
b00abc9
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 25, 2024 17:44
865dee5
to
23328dc
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 25, 2024 17:45
23328dc
to
c8bd6b7
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 26, 2024 11:39
7051638
to
3797dc0
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
2 times, most recently
from
November 26, 2024 16:20
e138b11
to
0edfa94
Compare
msooseth
force-pushed
the
implement_new_cheatcodes
branch
from
November 26, 2024 16:23
0edfa94
to
a6124bb
Compare
msooseth
changed the title
[DRAFT] Cheatcodes as per new std-forge library
Cheatcodes as per new std-forge library
Nov 26, 2024
msooseth
commented
Nov 27, 2024
Comment on lines
-202
to
-204
Just cheatContract -> readStorage' (Lit 0x6661696c65640000000000000000000000000000000000000000000000000000) cheatContract.storage .== Lit 1 | ||
Nothing -> And (readStorage' (Lit 0) (testContract store).storage) (Lit 2) .== Lit 2 | ||
postcondition = curry $ case shouldFail of |
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.
We don't store failures here any more in forge-std, so no need to check.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
The way forge-std is doing things has changed. It no longer sets a value in ds-test, but instead
Revert
-s with a specific message. So we have to match:Instead of the current:
The most prominent part of this change is the disappearance of line 202 from
UnitTest.hs
, where we'd check for failure bit being set in the cheat contract (i.e.0x7109709EC...
)Implementation
EVM.hs
to have a separate frame, which allows this to be coded in a relatively compact way. I have now added a number of required (but not all) cheatcodes.std-forge/Test.hs
and{Test}
fromds-test/test.hs
and{DSTest}
assert...
methods, though some are still missing. The ones still missing would require dynamic ABI handling, such asassertTrue(uint,string)
, wherestring
is dynamic.prove_tuple_fail1(uint256[5] memory amounts)
actually worksFuture work
I haven't added:
assertEq(T[], T[])
type assertsassertNotEq(T[], T[])
type assertsassertXXDecimal
Mostly due to the above mentioned issue with dynamic ABI type issue.
TODO in a future PR
Checklist