anvil-zksync
anvil-zksync copied to clipboard
Incorrect diagnostics information when a transaction fails during gas estimation stage
🐛 Bug Report for anvil-zksync
📝 Description
When transaction fails during gas estimation, the report is not useful.
- gas limit is shown as 0 (because it's gas estimation -- there is no limit yet)
- likely causes/possible fixes are incorrect. The real problem in this case is that transaction reverts during gas estimation, so it cannot be estimated.
🤔 Expected Behavior
Shows something like:
Likely causes
- The provided transaction always reverts, so it cannot be estimated.
- The transaction requires too much gas for execution (for example, it has an infinite loop), so it cannot be estimated.
Possible fixes
- Find the reason transaction reverts/consumes too much gas.
- If transaction is intended to fail (e.g. for testing purposes), provide gas limit manually and avoid gas estimation.
😯 Current Behavior
Proposal: on estimation we run transaction with max possible gas once and if it fails we print summary, traces etc and exit early. Otherwise continue with the current flow.