MyCut

AI First Flight #8
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: low
Likelihood: medium
Invalid

PUSH0 opcode incompatibility on L2 / non-Shanghai EVM chains

Root + Impact

Description

  • pragma solidity ^0.8.20 defaults the EVM target to Shanghai, introducing the PUSH0 opcode (0x5F).

  • Several EVM-equivalent chains, notably zkSync Era, Polygon zkEVM, and older Arbitrum nodes, do not yet support PUSH0 causing deployment to fail silently or with an opcode-invalid error.

  • The project states compatibility with "EVM Equivalent Chains Only", making this a concrete deployment risk.

// ContestManager.sol line 2, Pot.sol line 2
pragma solidity ^0.8.20; // defaults EVM target to Shanghai → emits PUSH0 opcodes

Risk

Likelihood:

  • The protocol explicitly targets "EVM Equivalent Chains", which includes L2s. zkSync Era uses a custom EVM dialect that rejects PUSH0 outright; Polygon zkEVM and older Arbitrum sequencer versions have the same restriction.

  • Any deployment attempt on these chains would fail at the point of contract creation before any protocol logic runs, silently wasting deployment gas. As L2 adoption grows, the surface area for this failure increases.

Proof of Concept

This is a deployment-time issue with no runtime PoC. The following shell commands confirm PUSH0 presence in the compiled artifact and show how to verify it:

# Build with the default Shanghai EVM target (0.8.20 default)
forge build
# Search for PUSH0 (opcode 0x5f) in the Pot bytecode object
cat out/Pot.sol/Pot.json | python3 -c \
"import sys,json; b=json.load(sys.stdin)['bytecode']['object']; \
print('PUSH0 count:', b.count('5f'))"
# Output: PUSH0 count: <non-zero>
# Rebuild targeting Paris (no PUSH0) and verify count drops to zero
forge build --evm-version paris
cat out/Pot.sol/Pot.json | python3 -c \
"import sys,json; b=json.load(sys.stdin)['bytecode']['object']; \
print('PUSH0 count (paris):', b.count('5f'))"
# Output: PUSH0 count (paris): 0

Recommended Mitigation

Pin the EVM target to paris in foundry.toml this produces PUSH0-free bytecode while retaining all Solidity 0.8.20 language features:

[profile.default]
evm_version = "paris"

Or downgrade the compiler to 0.8.19 (which pre-dates the Shanghai EVM target):

pragma solidity 0.8.19;
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 4 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!