EIP-3855: Add PUSH0 OpCode#4975
Merged
GheisMohammadi merged 1 commit intodevfrom Apr 26, 2026
Merged
Conversation
56478d0 to
335f245
Compare
Collaborator
|
Rebase please @GheisMohammadi |
335f245 to
5273eb7
Compare
Collaborator
Author
rebased |
Collaborator
|
Hey @GheisMohammadi, please fix the tests |
5273eb7 to
92bcab9
Compare
Collaborator
Author
fixed and rebased |
mur-me
approved these changes
Apr 9, 2026
Frozen
approved these changes
Apr 13, 2026
Collaborator
|
rebase please |
92bcab9 to
c540a7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EIP-3855 introduces a new Ethereum Virtual Machine (EVM) instruction called
PUSH0that pushes the value zero onto the stack. Before this improvement, pushing zero required usingPUSH1 0, which takes 2 bytes of bytecode and costs 3 gas at runtime. The newPUSH0opcode (represented by0x5f) 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 0instruction. WithPUSH0, 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
EIP3855Epochconfiguration parameter. When enabled, the EVM interpreter includes thePUSH0opcode 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.