Skip to content

Enhance precompile revert mechanism: apply journal-based approach #204

@cloudgray

Description

@cloudgray

Problem

In the current precompile implementation, journals are recorded after logic execution rather than before, unlike in go-ethereum, which causes revert failures during errors—a fundamental issue that was patched by forcing immediate reverts, though it deviates from Geth VM’s intended behavior.

Closing criteria

  • pass all test cases without using RunAtomic() method.
  • pass all test cases without immediate revert for OutOfGas error in HandleGasError method.

Problem details

  • In the original go-ethereum code, when a contract call fails, it processes a revert by traversing the journals that were recorded during the execution. [ref1][ref2] Therefore, journals are written before the logic is executed. [ref3]

  • However, in the current precompile implementation, journals are recorded after the logic is executed.[ref4] As a result, if an error occurs during execution, there are no journals to revert, which is the root cause of the previously reported vulnerability.

  • For now, the vulnerability has been patched by triggering a revert immediately upon precompile logic failure.[ref5] However, this approach is not natural from the perspective of how the Geth VM is designed to function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions