foundry-rs / foundry-rs/foundry

feat(inspectors): enhance revert diagnostic inspector

Open
#10,591 0 comments 0 reactions 0 assignees View on GitHub
C-forge T-feature
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
16h 38m
Merged PRs (30d)
511

Description

### Component

Forge

### Describe the feature you would like

## current state

the revert diagnostic inspector currently identifies:
- non-void calls to non-contract addresses (i.e. `function number() external returns (uint256);`)
- void calls to non-contract addresses (i.e. `function increment() external;`)

additionally, the traces decoder is able to identify non-supported function calls to contracts that don't have a fallback fn. However, it is limited to local contracts for which the ABI is known.

## to-do

enhance the revert diagnostics inspector to identify bytecode patterns that indicate reverts due to:
- [ ] non-supported fn calls to contracts that don't have a fallback (so that the traces decoder is not needed and we are not limited to known ABIs)
- [ ] call fails due to mismatch between the actual bytecode and the expected ABI (i.e. common case of ERC20 transfer not returning `bool` and returndata validation failing)

### Additional context

- relevant discussion: https://github.com/foundry-rs/foundry/pull/10446#discussion_r2099121392
- potential inspiration: [hardhat revert diagnostics](https://github.com/NomicFoundation/hardhat/blob/67f1e95e1f3904f7b2e8a5560115c1551e899f64/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidity-errors.ts#L218-L341)

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing revert diagnostic inspector in Forge and read the linked discussion around pull request #10446. Compare the requested bytecode-pattern diagnostics with Hardhat's solidity-errors.ts implementation. Done means identifying unsupported calls without fallback functions and ABI/bytecode mismatches without relying on known local ABIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, solidity
Domain
blockchain, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.