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.21k stars 1.71k forks source link

feat(cheatcodes): add `returndata` to `expectCall` and `AccountAccess` #7884

Open d1ll0n opened 5 months ago

d1ll0n commented 5 months ago

Component

Forge

Describe the feature you would like

It'd be nice if it was possible to specify returndata in expectCall and/or if it was provided in the AccountAccess struct from recorded state diffs, as these would allow more granular testing of the interactions between contracts.

Additional context

Think these are the primary related bits:

https://github.com/foundry-rs/foundry/blob/874ea8cd3f8bf3545d210efd7b9f4c41ff36218a/crates/cheatcodes/src/inspector.rs#L1218

https://github.com/foundry-rs/foundry/blob/874ea8cd3f8bf3545d210efd7b9f4c41ff36218a/crates/cheatcodes/src/inspector.rs#L1109

grandizzy commented 1 week ago

@d1ll0n could you please explain how this would be different than just asserting returned data? thank you!