-
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
Add basic forking cheatcodes #259
Conversation
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.
CI is only failing because of some unrelated windows build error...
persistentState = 0; | ||
} | ||
|
||
function test_ForkedState() external { |
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.
according to the foundry docs, the state of msg.sender
should also be persisted betweeen forks. Could we also test that behaviour here (I guess by sending some eth to msg.sender and checking that it is persisted between forks?).
-- we don't support this at the moment | ||
pure () | ||
Nothing -> | ||
pure () -- no-op: fork not found |
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.
do we wanna noop or error here? what does foundry do?
(ConcreteStore store, ConcreteStore savedStore) -> do | ||
let | ||
-- the current contract is persited across forks | ||
self = vm.state.contract |
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 don't know exactly how foundry behaves here, but according to the docs only the state of the the test contract itself is persisted between forks, and I think we're going to persist the wrong contract if we call this from a subcontract that's deployed from the top level test contract?
_ -> | ||
-- no-op: current storage and/or saved storage is symbolic | ||
-- we don't support this at the moment | ||
pure () |
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.
What exactly is the difficultty in supporting symbolic storage here? I think if we can't do it easily it's probably better to error out?
@arcz @d-xo I did a bit of work on this PR, result is here. Changes:
Right now the test fails, because |
Thanks for the work on this pr @samalws-tob, looks super nice.
I'm not sure I fully understand the question. |
Using (Edit: this ended up working, implemented in #433 ) |
Add basic forking cheatcodes (continuation of #259)
Description
Basic implementation of forking: https://book.getfoundry.sh/forge/fork-testing
Checklist