Skip to content

Add support for EIP-7939 (CLZ opcode)#400

Merged
sorpaas merged 5 commits into
rust-ethereum:v0.xfrom
moonbeam-foundation:manuel/add-support-for-eip7939
Jan 12, 2026
Merged

Add support for EIP-7939 (CLZ opcode)#400
sorpaas merged 5 commits into
rust-ethereum:v0.xfrom
moonbeam-foundation:manuel/add-support-for-eip7939

Conversation

@manuelmauro
Copy link
Copy Markdown
Contributor

@manuelmauro manuelmauro commented Jan 9, 2026

Description

Implements the Count Leading Zeros (CLZ) opcode as specified in https://eips.ethereum.org/EIPS/eip-7939.

Changes

  • Add CLZ opcode (0x1e) to evm-core
  • Add clz() function returning leading zero count (256 for zero input)
  • Add has_eip_7939 config flag, enabled starting from Osaka fork
  • Gas cost is set to 5 (G_LOW), matching MUL and consistent with both the EIP-7939 specification and go-ethereum's implementation.
  • Add Config::osaka() fork configuration

Copy link
Copy Markdown
Member

@sorpaas sorpaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks straightforward. Let me know if it's ready.

@manuelmauro
Copy link
Copy Markdown
Contributor Author

Thank you @sorpaas ! I consider it ready 👍

@manuelmauro manuelmauro marked this pull request as ready for review January 12, 2026 08:28
Copy link
Copy Markdown

@librelois librelois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@sorpaas can you merge it?

@sorpaas sorpaas merged commit a656db9 into rust-ethereum:v0.x Jan 12, 2026
2 checks passed
manuelmauro added a commit to moonbeam-foundation/evm that referenced this pull request Jan 13, 2026
* feat: ✨ add support for count leading zeros (CLZ) opcode

* style: 🎨 fmt

* refactor: ♻️ remove redundant check

* refactor: 🚨 clippy

* refactor: 🚨 more clippy
manuelmauro added a commit to moonbeam-foundation/moonbeam that referenced this pull request May 8, 2026
Created `moonbeam-polkadot-stable2603` on `moonbeam-foundation/evm`.
Upstream `rust-ethereum/evm` has moved to v1.0; the moonbeam fork
stays on the 0.43.x line and there is no new upstream commit to
pull. The new branch shares the same tip SHA as stable2512
(`bb9cdde4`) so both moonbeam-only commits — `a656db90` (the
EIP-7939 CLZ-opcode cherry-pick of rust-ethereum/evm#400, which was
merged upstream only on v1.0) and `bb9cdde4` (the MBF ethereum fork
dep pin discovered in Phase 0.5) — are inherited as-is.

Tick Phase 1.2 boxes in UPGRADE-stable2603.md and replace the `TBD`
placeholder in the EIP-7939 row of `polkadot-sdk-stable2603.md` with
the actual commit link.
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.

3 participants