You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the easiest way to test code that calls blockhash is to wrap the blockhash call in a virtual, internal method and then create a test class that overrides that method to mock blockhash calls.
I'd rather just have the mocking performed at the level of the vm.
If this is considered sufficiently useful, I would be happy to try my hand at adding this cheat code. Just don't want to learn rust, etc. to add this only to have a PR rejected if the feature isn't seen as useful.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Unsure if this makes sense to add if https://eips.ethereum.org/EIPS/eip-2935 is included in Prague, as this could be emulated with just setting the appropriate slot on the contract
Unsure if this makes sense to add if https://eips.ethereum.org/EIPS/eip-2935 is included in Prague, as this could be emulated with just setting the appropriate slot on the contract
In that case, wouldn't vm.setBlockhash still be a useful shorthand to set that slot?
Component
cheatcodes
Describe the feature you would like
A
vm.setBlockhash
cheat code would be very convenient for testing code that uses the Solidityblockhash
function.This is how it would be used:
Currently, the easiest way to test code that calls
blockhash
is to wrap theblockhash
call in a virtual, internal method and then create a test class that overrides that method to mockblockhash
calls.I'd rather just have the mocking performed at the level of the
vm
.If this is considered sufficiently useful, I would be happy to try my hand at adding this cheat code. Just don't want to learn rust, etc. to add this only to have a PR rejected if the feature isn't seen as useful.
Additional context
No response
The text was updated successfully, but these errors were encountered: