Skip to content

[pallet-revive] EXTCODECOPY faults instead of zero filling for an out of range code_offset #12643

Description

@Nathy-bajo

EXTCODECOPY at host.rs converts code_offset with as_usize_or_halt, which halts with OutOfGas when the value does not fit in usize (>= 2^64). Per the EVM spec and revm, an out of range code offset must zero fill, not fault. The sibling opcodes CODECOPY, CALLDATACOPY, and RETURNDATACOPY correctly use as_usize_saturated (system.rs), so this is an isolated inconsistency.

Repro: EXTCODECOPY(addr, 0, 2**64, 32) returns 32 zero bytes on Ethereum but traps here, yielding a different state root.

Fix: switch host.rs to as_usize_saturated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions