-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
extcodesize
check bypass for mockCall
#1987
Comments
Check out all the discussion in foundry-rs/forge-std#46 around how foundry should handle mocking, including questions about what should be upstreamed to foundry and what should be part of forge-std. The discussion has stalled, but would love your input there, as this is one of things covered. |
I'm not entirely sure how we can solve this specific issue in Forge, I'd love some input. Here are some different approaches and the issues I see with them:
It seems like your scenario is using mockCall on an empty address which is why you're having this issue, but a lot of people also use mockCall on an address that has a bytecode, where they only mock one or two functions that should still work as intended. For your use case specifically, can I suggest doing the |
Thanks @mds1, must have missed it the first time around, but I'll take a look at the discussion there! And @onbjerg thanks for response. My suggestions would either be:
Yeah this is a good call, we will do this for now. |
How is the state of this issue? Encountered the same problem when trying to mock a function that does not return. |
Hasn't been a priority because there is so much else to look at. I think the solution is pretty simple, so I'll take a look at it now since it was bumped |
PR is up, should be good for the nightly tonight :) |
Component
Forge
Describe the feature you would like
Adding an
extcodesize
check bypass when mocking functions. Functions that have no return data are still subject to anextcodesize
check (see ethereum/solidity#12204). This makes it challenging when working with external integrations in a non forked environment (mocked calls still revert because extcodesize == 0).Currently, my local solution is to fill junk bytes at a target address before mocking:
It would be nice to have this feature integrated into foundry that way
mockCall
covers all possible scenarios. Just not sure if my solution is ideal because it leaves junk bytecode at addresses.Additional context
No response
The text was updated successfully, but these errors were encountered: