Skip to content

refactor: align precompile reverts with Solidity errors#1099

Open
nowooj wants to merge 7 commits intocosmos:mainfrom
nowooj:refactor/sol-error
Open

refactor: align precompile reverts with Solidity errors#1099
nowooj wants to merge 7 commits intocosmos:mainfrom
nowooj:refactor/sol-error

Conversation

@nowooj
Copy link
Copy Markdown

@nowooj nowooj commented Apr 3, 2026

Description

Precompile failures no longer rely primarily on string reasons. Failures are now returned as Solidity custom errors encoded from each module’s abi.json, via NewRevertWithSolidityError and ReturnRevertError in precompiles/common, including interpreter return data where applicable.

The ERC-20 precompile drops the split IERC20 / IERC20Metadata setup in favor of ERC20I, combining OpenZeppelin IERC20Metadata, IERC6093 IERC20Errors, and the shared IPrecompile interface. Other precompiles (bank, distribution, gov, ics02, ics20, slashing, staking, etc.) were updated for interfaces, errors.go, and regenerated abi.json.

Tooling: Solidity 0.8.26, Hardhat evmVersion: cancun, and OpenZeppelin v5, with contracts recompiled and artifacts aligned to Hardhat 3 (hh3-artifact-1).

Tests: Go integration tests and Solidity suites (revert_cases, ERC20) assert custom error selectors / revert data where relevant.

Review focus: precompiles/common/revert.go, use of NewRevertWithSolidityError in each module’s errors.go / tx.go / query.go, and consistency between ERC20I.sol and generated abi.json.

Breaking change: Call sites that assumed only Error(string) reverts may need to decode standard custom errors instead.

Closes: #954


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes (no change)
  • targeted the main branch

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 3, 2026

PR author is not in the allowed authors list.

@nowooj
Copy link
Copy Markdown
Author

nowooj commented Apr 3, 2026

Rebase on main

@nowooj nowooj force-pushed the refactor/sol-error branch from 0c7c32b to 2e1567f Compare April 3, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Support Solidity Custom Errors in Precompiles

1 participant