Skip to content

Add CLZ opcode (EIP-7939) #122

Description

@mw2000

Summary

Add the Count Leading Zeros opcode (CLZ, 0x1E). Activates with Fusaka.

Spec

Scope

  • Add Fusaka hardfork + EIP-7939 flag to EEVM.HardforkConfig.
  • Implement the CLZ opcode in the interpreter (single 256-bit input → leading-zero count, 0..256).
  • Charge G_low (5 gas).
  • Gate the opcode on the flag — earlier hardforks must reject it as invalid.

Definition of Done

  • CLZ(0) returns 256, CLZ(1) returns 255, CLZ(2^255) returns 0.
  • Fusaka CLZ StateTest fixtures pass.

Parent

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreCore EVM functionalityeipEIP specification implementationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions