Skip to content

Conversation

@GheisMohammadi
Copy link
Collaborator

@GheisMohammadi GheisMohammadi commented Nov 7, 2025

EIP-3855 introduces a new Ethereum Virtual Machine (EVM) instruction called PUSH0 that pushes the value zero onto the stack. Before this improvement, pushing zero required using PUSH1 0, which takes 2 bytes of bytecode and costs 3 gas at runtime. The new PUSH0 opcode (represented by 0x5f) accomplishes the same task using only 1 byte and costs just 2 gas, making smart contracts more efficient and cheaper to deploy and execute.

The motivation for this change comes from how frequently zero values are used in smart contracts. Many EVM operations need zero as an input parameter—for example, when making contract calls where you want to specify zero offsets or when using return data functions. Previously, every time a contract needed to push zero onto the stack, it had to use the more expensive PUSH1 0 instruction. With PUSH0, developers can write more gas-efficient code, and the smaller bytecode size also reduces deployment costs.

This PR implements EIP-3855 and can be activated at a specific epoch through the EIP3855Epoch configuration parameter. When enabled, the EVM interpreter includes the PUSH0 opcode in its jump table, allowing smart contracts to use this more efficient instruction. This is part of Harmony's ongoing effort to align with Ethereum improvements while maintaining its own epoch-based upgrade mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants