-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(forge): Fix cheatcodes not cooperating with vm.transact
#3970
fix(forge): Fix cheatcodes not cooperating with vm.transact
#3970
Conversation
thanks for looking into this
While this seems to be working, I'm hesitant to move forward with this because this will eventually cause all sorts of problems. it looks like we only need the Cheatcodes inspector though? and since the cheatcodes triggers the transact cheatcode call, it'd be perfectly fine to pass this as inspector instead? |
Yep, that makes sense! I thought that down the road other inspectors might be needed but didn't realise that it is only being called inside the Should this inspector inspect the |
hmm not entirely sure, but I think we can start by adding it to |
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.
lgtm, tysm
Motivation
Closes #3797
Solution
commit_transaction
RollFork3
/vm.rollFork(uint256 forkId, bytes32 transaction)
(which was not implemented until now for some particular reason?)transact
androllFork
cooperating with cheatcodesIt is evident that the
Cheatcodes
inspector doesn't inspect the transaction that is executed intransact
since not only doesvm.recordLogs
not work as expected but even other cheatcodes likevm.expectCall
doesn't work as expected.I added an optional inspector to inspect the new
EVM
instance that thetransact
is run on. However, since theCheatcodes
inspector needs theDatabase
to also implement theDatabaseExt
trait, I create a newBackend
database with the fork's database and pass it to theEVM
.Note that, this means that the
DatabaseExt
trait now depends onBackend
which implementsDatabaseExt
itself. It is a circular dependency. Would this design be prefered or shall I move the responsibility of passing aDatabaseExt
all the way up to the caller oftransact
?Also, I've noticed that
vm.transact
doesn't revert when the transaction is supposed to revert, shall I create a separate issue for this?