foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.34k stars 1.77k forks source link

feat(forge): improve UX of `expectSafeMemory` & `expectSafeMemoryCall` cheatcodes #4699

Open 0xPhaze opened 1 year ago

0xPhaze commented 1 year ago

Component

Forge

Describe the feature you would like

The cheatcodes currently expect uint64 parameters. It would be nice to have these as uint256 types so as otherwise I imagine the user will have to often convert these.

// Only allows memory writes to offsets [0x00, 0x60) ∪ [_min, _max) in the current subcontext. If any other
// memory is written to, the test will fail.
function expectSafeMemory(uint256 _min, uint256 _max) external;

// Only allows memory writes to offsets [0x00, 0x60) ∪ [_min, _max) in the next created subcontext.
// If any other memory is written to, the test will fail.
function expectSafeMemoryCall(uint256 _min, uint256 _max) external;

PR https://github.com/foundry-rs/foundry/pull/4491 @clabby

Additional context

No response

mattsse commented 1 year ago

wdyt @mds1 ?

tynes commented 1 year ago

Seems like you could put a wrapper in forge-std, I don't think values that overflow are sane inputs