Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[SPIKE] EVM bytecode compatibility across SF networks #1533

Closed
d10r opened this issue Jul 20, 2023 · 3 comments · Fixed by #1562
Closed

[SPIKE] EVM bytecode compatibility across SF networks #1533

d10r opened this issue Jul 20, 2023 · 3 comments · Fixed by #1562
Assignees
Labels
Team: Protocol Protocol Core, Sentinel, Peripherals, Protocol Infrastructure Tools & DevOps

Comments

@d10r
Copy link
Collaborator

d10r commented Jul 20, 2023

The solidity compiler has a configurable EVM version target, see
https://docs.soliditylang.org/en/v0.8.21/using-the-compiler.html#input-description

This defaults to what's deployed on Ethereum.
We don't currently have a process in place for ensuring that the bytecode we create is compatible with all EVM networks it's deployed to.

Task:
Investigate if there's any risks here / what they are / how to mitigate

@d10r d10r added the Team: Protocol Protocol Core, Sentinel, Peripherals, Protocol Infrastructure Tools & DevOps label Jul 20, 2023
@d10r d10r self-assigned this Jul 20, 2023
@d10r
Copy link
Collaborator Author

d10r commented Jul 24, 2023

example for an added opcode: https://eips.ethereum.org/EIPS/eip-3855

@d10r
Copy link
Collaborator Author

d10r commented Aug 7, 2023

We indeed need to be extra careful with the switch to Solidity v0.8.20+, see OpenZeppelin/openzeppelin-contracts#4489 (comment)

Recommendation: explicitly set evm target to "paris" (prevent switch to the new default target "shanghai" which enables the new PUSH0 opcode not universally supported).

@hellwolf
Copy link
Contributor

hellwolf commented Aug 7, 2023

As of solidity v0.8.19, the default evm_version is paris, see https://docs.soliditylang.org/en/v0.8.19/using-the-compiler.html.

After solidity v0.8.19, the default evm_version is at least shanghai, see https://docs.soliditylang.org/en/v0.8.21/using-the-compiler.html

The shanghai evm version include a breaking evm upgrade that is "push0" op code. The concern is that not all EVM chains would keep up with this change at the same rate, and superfluid protocol has a implicit assumption that all networks are compatible to the extent what superfluid protocol is built against.

This assumption is now in jeopardy because of the inclusion of push0 op code, and the options we have are:

  1. multi evm-target releases, where pre-shanghai and post-shanghai are two release targets.
  2. configure solc to use paris evm target explicitly, in foundry see this
    • a related scenario is that, we still uses hardhat/truffle to test the contracts, we should also set them to paris target explicitly.

P.S.:

A oneliner for detecting PUSH0:

find out/default -name '*.json' | grep -v build-info | while read i;do echo $i;cast disassemble $(cat "$i" | jq -r .deployedBytecode.object) | grep PUSH0;done

So far we haven't managed to produce a single contract that contans the PUSH0 yet.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Team: Protocol Protocol Core, Sentinel, Peripherals, Protocol Infrastructure Tools & DevOps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants