Supporting EIP-5656 (MCOPY opcode) in the Filecoin EVM runtime #1025
Replies: 4 comments 9 replies
-
Pinging @trruckerfling as you're likely to encounter this in the wild. |
Beta Was this translation helpful? Give feedback.
-
Builtin actors issue: filecoin-project/builtin-actors#1457 |
Beta Was this translation helpful? Give feedback.
-
There is a larger convo on whether filecoin should keep up with EVM in general - but this particular one seems well scoped and straight forward; and seems like IPC has a use case for it so I’m 👍🏻 @raulk I’m making a bold assumption that IPC team will drive an FIP and an implementation for this unless there’s major objections from other core devs/community members? (Next upgrade window is proposed here fyi filecoin-project/core-devs#150 (comment) |
Beta Was this translation helpful? Give feedback.
-
For visibility, this work is underway: |
Beta Was this translation helpful? Give feedback.
-
Problem
This EIP was deployed to the Ethereum mainnet in the Dencun upgrade. (NB: It may have been added to the upgrade after we assessed compatibility with the Filecoin EVM, as otherwise we would've identified the divergence just like with #855).
Solidity v0.8.24 added support for MCOPY in Yul and inline assembly (requiring the dev to explicitly use it), and v0.8.25 added support in the code generator. The compiler now utilizes the MCOPY opcode to optimize operations like ABI encode and decode, unlike it happens with TSTORE/TLOAD, which requires explicit inline assembly. More here: https://soliditylang.org/blog/2024/03/14/solidity-0.8.25-release-announcement/
Impact
It is common for smart contract devs to use loose pragma ranges like
pragma solidity ^0.8.0;
. Often their tooling will install/use the latest stable v0.8 Solidity version published at the time. With time, more and more devs will end up using v0.8.25 — especially since v0.8.26 is GA too.The IPC Core team recently debugged one such example here: https://filecoinproject.slack.com/archives/C04U4GPK3QR/p1719310936862459.
Workaround
The workaround is to downgrade to Solidity v0.8.24, but forcing devs to rely on outdated compilers is hardly a good solution.
Solution
We should add support for
MCOPY
to the Filecoin EVM. It should be pretty straightforward.Beta Was this translation helpful? Give feedback.
All reactions