MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

`PUSH0` is not supported by all chains in the `ContestManager.sol`

Description: The PUSH0 opcode is a new Ethereum Virtual Machine (EVM) instruction introduced in the Shanghai upgrade. It pushes the constant value 0 onto the stack. However, not all Ethereum-compatible blockchains (e.g., some Layer 2 solutions or forks) have adopted this opcode, leading to compatibility issues.

Impact:

  • Compatibility Issues: Contracts using PUSH0 may not deploy or execute correctly on chains that haven't implemented this opcode.

  • Deployment Failures: Attempting to deploy contracts on incompatible chains could result in errors or failed transactions.

  • Reduced Portability: Contracts are less portable across different EVM-compatible chains, limiting their usability and reach.

Proof of Concept: While PUSH0 is a low-level EVM instruction, its use can be indirectly observed in Solidity code compiled with newer compiler versions that target the Shanghai upgrade. Directly writing EVM bytecode is not typical in high-level Solidity contracts, but here's how you might encounter it:

pragma solidity ^0.8.20;
contract Example {
function zero() public pure returns (uint256) {
return 0; // This might compile to use PUSH0 in newer compilers
}
}

Recommended Mitigation:

  • Target Compatible Chains: Ensure deployment targets are chains that support the Shanghai upgrade and PUSH0.

  • Use Compatible Compiler Versions: Compile contracts with versions that do not introduce PUSH0

Updates

Lead Judging Commences

equious Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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