Skip to content

feat: stateful precompiles have too many boilerplates #578

@yihuang

Description

@yihuang

When developing the new erc20 precompile, I find the current precompiles code structure is not ideal, there are a few issues:

  1. Each precompile has to duplicate the "out of gas" panic recovering, gas metering, BalanceHandler, and those are critical logics for stateful precompiles to function correctly, fail to include one of them could cause disastrous issue.
  2. It has to recover panic twice in the same precompile, in the RunSetup and precompile Run itself.
  3. ABI handling is intertwined with the native state handling, make it hard to implement stateful precompiles that don't use the go-ethereum/accounts/abi library for the API.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions