foundry
foundry copied to clipboard
feat(`anvil`) add "strict" mode that warns on common user errors
Component
Anvil
Describe the feature you would like
Make common mistakes easy to spot:
eth_calling 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.
Hi @krzkaczor thanks for your suggestion
I noticed anvil currently does not support verbosity flags like the other binaries do, perhaps that would be a natural place to add these kind of user errors (say, at a high verbosity level >4)?
Perhaps this is better captured as a design goal for reth-anvil post-1.0
Any learning materials about reth-anvil so i can dive deeper? is the plan to rewrite anvil to reuse parts of reth under the hood?
Any learning materials about
reth-anvilso i can dive deeper? is the plan to rewrite anvil to reuse parts of reth under the hood?
Best to follow along in https://github.com/paradigmxyz/reth/issues?q=is%3Aopen+is%3Aissue+label%3AA-sdk where the goal is to create an SDK. anvil-reth will build on top of this SDK.
we're going to add more logging with https://github.com/foundry-rs/foundry/issues/9796 and then reevaluate if this ticket still needed.