Stage 1 Complete: DeepSEA Compiler for Conflux Network

Originally published
January 20, 2021


  • Addition of 5 opcodes not found in Ethereum Yellow Paper:
  • Extension of DeepSEA’s backend bytecode generation to support production of new opcodes; 0x46 and 0x47
  • Entirely redesigned DeepSEA’s testing framework to be fully compatible with Conflux Chain

A closer look

Our improvements to the DeepSEA compiler accommodate bytecode features unique to Conflux VM. There are five opcodes in the Conflux Protocol Specification that are not found in the Ethereum Yellow Paper: CHAINID, SELFBALANCE, BEGINSUB, JUMPSUB, and RETURNSUB. These are part of the latest Ethereum version but were not yet implemented in DeepSEA (see EIP-2315, EIP-1344, EIP-1884, the latest opcodes in go-ethereum, and Appendix B in the Conflux Protocol Specification).

We have added CHAINID and SELFBALANCE. This involved the addition of the two keywords to both the DeepSEA and MiniC compiler frontends. In addition, we extended the DeepSEA backend's bytecode generation so that new opcodes 0x46 and 0x47 can be produced. The subroutine-specific opcodes could also be implemented, but they are only for efficiency and don't expose any new functionality to the contracts, so they are not needed to write full-featured Conflux contracts.

Next, in order to treat the Conflux platform on the same level as Ethereum, we entirely redesigned our testing framework so that we can test DeepSEA contracts on a Conflux chain.

Our unit tests used to be Ethereum-specific, relying on the ethers.js API to deploy contracts and call methods. Rather than create a copy of our existing tests and reimplement them using js-conflux-sdk, we instead created a chain-independent testing interface that can be implemented for any chain. This then calls js-conflux-sdk behind the scenes.

As such, Conflux is a first-class citizen in our testing alongside Ethereum, and any new tests that we add will automatically be tested on both chains. (As a bonus, the work of adding another chain to test on is streamlined and minimized.)

Every DeepSEA test has run as expected on Conflux when testing on a single node dev chain. For stage 2, we’ll be sharing more details about new features towards creating an example end-to-end verified Conflux DeFi contract.

Our team will be releasing more technical specifications regarding our implementation of Conflux with DeepSEA in the upcoming days. For those that are more technically inclined, stay tuned for an upcoming report. Feel free to reach out to us if you have any questions.

Follow us on Telegram:
✅ Follow us on Twitter: