New cheatcodes (draft) #643
Draft
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.
This PR is a WIP to add new cheatcode to medusa. The PR is not ready yet, but I am sharing it in case anyone has time to provide some feedback.
It's built on top of #618, so the code outside of chain/cheat_code_tracer.go / chain/standard_cheat_code_contract.go is not relevant to the PR.
Once I have stabilized everything, I will open individual PR to make the review easier + add the relevant documentation.
Open questions:
getDeployedCode
would benefit from some logging to let the user knows if the targeted contract was not deployed, but I am not sure how to log this properlyexpectRevert
is the right approach. The cheatcode is a bit tricky given it's logic, so I had to modify theOnOpcode
hook (cheat_code_tracer.go). It works by havingexpectRevert
adding a placeholder variable, that basically means "once you execute the first opcode after returning from the targeted call, invert the value on the stack". If you have a cleaner idea on how to handle this one, let me knowThe new cheatcodes: