Ethereum Protocol Fellowship (EPF) Cohort 7 — Applications open until May 13
All EIPs
EIP-7939 Final

Count leading zeros (CLZ) opcode

Authors: , , , ,

Canonical data: /latest/eips/7939.json

Opcode to count the number of leading zero bits in a 256-bit word

Timeline

Included
EIP Created Apr 28, 2025

Key Benefits

  • Dramatically reduces gas costs for bit manipulation operations
  • Enables more efficient mathematical algorithms on-chain
  • Particularly beneficial for ZK-proving applications
  • Reduces bytecode size for mathematical operations
  • Enables efficient compression and decompression algorithms
  • Essential building block for advanced cryptographic schemes

Trade-offs & Considerations

No trade-offs documented yet.

Stakeholder Impact

End Users

Indirect benefits through lower gas costs for applications using mathematical operations, compression algorithms, and advanced cryptographic schemes.

Application Developers

Can implement much more efficient mathematical algorithms, compression schemes, and bitmap operations. Particularly beneficial for DeFi protocols requiring complex mathematical operations and ZK-proving applications.

Wallet Developers

Minimal direct impact, though benefits indirectly from more efficient mathematical operations in smart contracts.

Tooling / Infrastructure

Development tools and debuggers need to support the new CLZ opcode, but this is a straightforward addition.

Layer 2s

More efficient mathematical operations benefit ZK-proof generation and verification systems, reducing proving costs especially for RISC-V based proving systems.

Stakers & Node Operators

More efficient computation reduces overall network computational load for mathematical operations.

CL Client Developers

No direct impact on consensus layer operations as this affects execution layer computational capabilities.

EL Client Developers

Simple implementation - just need to add the CLZ opcode (0x1e) with proper gas accounting. Benchmarked to have similar computational cost to ADD.

North Star Goal Alignment

  • Scale L1: Significantly reduces gas costs for mathematical operations that require bit manipulation, improving computational efficiency and enabling more complex on-chain calculations.
  • Improve UX: Enables cheaper and more efficient mathematical operations, benefiting DeFi protocols, gaming applications, and any contracts requiring complex mathematical computations.