foundry-rs / foundry-rs/foundry
feat(`anvil`) add "strict" mode that warns on common user errors
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 511
Description
### Component
Anvil
### Describe the feature you would like
Make common mistakes easy to spot:
* `eth_call`ing empty contract
* sending tx (with calldata) to empty contract
* delegate calling empty contract
* probably more
All of these, even though well within consensus rules, are most likely mistakes.
These actions could result in something as unintrusive as printing a warning in console or, alternatively bail the whole request.
I am curious what do you think? This could be ofc turned off/on with a command line flag.
### Additional context
Already, `cast call` on empty contract results in an error but this is implemented in `cast` and works only when return type is provided and could not be decoded (because `eth_call` returned empty data). Implementing this in node directly could be much more solid. Also, more complex scenarios as delegatecalling empty contract would be possible to cover.
Delegate calling empty contact is something that I've recently spent couple of hours debugging and actually it prompted me to create this issue. Turns out that I missed `broadcast` in a foundry script when deploying governance spell so in a later (broadcasted) tx I was calling governance relay that was trying to delegatecall to not-deployed governance spell. It simply succeeded without doing anything of value. Again, I know this is correct according to consensus rules but I can't imagine scenario when delegatingcalling to empty contract makes sense in dev node.
Contributor guide
Assessment
This issue has not been assessed yet.