|
| 1 | +# Backwards Compatibility |
| 2 | +The current approach to achieving backwards compatibility with EVM1 is to |
| 3 | +support both of the instruction sets with the option to transcompiling EVM1 to |
| 4 | +eWASM. This approach gives clients optionality when dealing with EVM1 code. |
| 5 | +A client can either implement only an eWASM VM and transcompile all of the EVM1 |
| 6 | +code. Or a client can implement a eWASM VM and EVM1 VM and leave the old code as |
| 7 | +is. |
| 8 | + |
| 9 | +## Gas Prices |
| 10 | +In eWASM we will introduce sub-gas units so that each EVM1 opcode's |
| 11 | +transcompiled equivalent eWASM's gas cost is less then the original EM1 opcode's |
| 12 | +cost. The fee schedule for eWASM is yet to be specified. |
| 13 | + |
| 14 | +## Identification of code |
| 15 | +We assume there is some sort of code handler function that all clients have |
| 16 | +implemented. The code handler identifies the instruction set type by whether it |
| 17 | +starts with WASM's magic number or not. |
| 18 | + |
| 19 | +The WASM magic number is the following byte sequence: `0x00, 0x61, 0x73, 0x6d`. |
| 20 | + |
| 21 | +## Solidity |
| 22 | +Support of compiling to eWASM can be accompilshed by adding a new backend to |
| 23 | +the solidity compile. eWASM support for Solidity is part of the MVP. |
| 24 | + |
| 25 | +## Transcompiler |
| 26 | +A post-MVP goal is to have the transcompiler it self become a contract by |
| 27 | +compiling it to eWASM. Once this is accomplished, EVM1 contracts created by |
| 28 | +the CREATE op will be transcompiled to eWASM. This will also allow us to assume |
| 29 | +that all EVM1 code is now transcompiled eWASM code, which should be reflected |
| 30 | +in the state root since the has of the code is stored in the Merkle trie. Note: |
| 31 | +this should still allow clients to fallback to EVM1 VMs if running EVM1 code. |
0 commit comments