From d0b30f5c3747bf5b8e1abaf532b57bfb9966eb4f Mon Sep 17 00:00:00 2001 From: wanderer Date: Wed, 3 Aug 2016 16:41:40 -0400 Subject: [PATCH 1/4] added backwards compatibility section --- backwardsCompatibility.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 backwardsCompatibility.md diff --git a/backwardsCompatibility.md b/backwardsCompatibility.md new file mode 100644 index 00000000..56fcd943 --- /dev/null +++ b/backwardsCompatibility.md @@ -0,0 +1,29 @@ +# Backwards Compatibility +The current approach to achieving backwards compatibility with EVM1 is to +support both of the instruction sets with the option to transcompiling EVM1 to +EVM2. This approach gives clients optionality when dealing with EVM1 code. +A client can either implement only a WASM VM and transcompile all of the EVM1 +code. Or a client can implement a wasm VM and EVM1 VM and leave the old code as +is. + +## Gas Prices +In eWASM we will introduce sub-gas units so that each EVM1 opcode's +transcompiled equivalent ewasm's gas cost is less then the original EM1 opcode's +cost. The fee schedule for eWASM is yet to be specified. + +## Identification of code +We assume there is some sort of code handler function that all clients have +implemented. The code handler identifies the instruction Set type by whether it +starts with WASM's magic number (0x6d736100) or not. + +## Solidity +Support of compiling to eWASM can be accompilshed by adding a new backend to +the solidity compile. eWASM support for Solidity is part of the MVP. + +## Transcompiler +A post-MVP goal is to have the transcompiler it self become a contract by +compiling it to wasm. Once this is accomplished, EVM1 contracts created by +the CREATE op will be transcompiled to eWASM. This will also allow us to assume +that all EVM1 code is now transcompiled eWASM code, which should be reflected +in the state root since the has of the code is stored in the Merkle trie. Note: +this should still allow clients to fallback to EVM1 VMs if running EVM1 code. From 603454593ce4783c2fc71406f2ac4ae90f65fb45 Mon Sep 17 00:00:00 2001 From: wanderer Date: Wed, 3 Aug 2016 21:32:18 -0400 Subject: [PATCH 2/4] uniform ewasm capitilization --- backwardsCompatibility.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backwardsCompatibility.md b/backwardsCompatibility.md index 56fcd943..abadb02b 100644 --- a/backwardsCompatibility.md +++ b/backwardsCompatibility.md @@ -1,19 +1,19 @@ # Backwards Compatibility The current approach to achieving backwards compatibility with EVM1 is to support both of the instruction sets with the option to transcompiling EVM1 to -EVM2. This approach gives clients optionality when dealing with EVM1 code. -A client can either implement only a WASM VM and transcompile all of the EVM1 -code. Or a client can implement a wasm VM and EVM1 VM and leave the old code as +eWASM. This approach gives clients optionality when dealing with EVM1 code. +A client can either implement only an eWASM VM and transcompile all of the EVM1 +code. Or a client can implement a eWASM VM and EVM1 VM and leave the old code as is. ## Gas Prices In eWASM we will introduce sub-gas units so that each EVM1 opcode's -transcompiled equivalent ewasm's gas cost is less then the original EM1 opcode's +transcompiled equivalent eWASM's gas cost is less then the original EM1 opcode's cost. The fee schedule for eWASM is yet to be specified. ## Identification of code We assume there is some sort of code handler function that all clients have -implemented. The code handler identifies the instruction Set type by whether it +implemented. The code handler identifies the instruction set type by whether it starts with WASM's magic number (0x6d736100) or not. ## Solidity @@ -22,7 +22,7 @@ the solidity compile. eWASM support for Solidity is part of the MVP. ## Transcompiler A post-MVP goal is to have the transcompiler it self become a contract by -compiling it to wasm. Once this is accomplished, EVM1 contracts created by +compiling it to eWASM. Once this is accomplished, EVM1 contracts created by the CREATE op will be transcompiled to eWASM. This will also allow us to assume that all EVM1 code is now transcompiled eWASM code, which should be reflected in the state root since the has of the code is stored in the Merkle trie. Note: From e4dead6680a104c80c8e03113ab9e46134348c16 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 14 Aug 2016 13:34:38 +0100 Subject: [PATCH 3/4] Compat: use the on-wire ASM magic number layout --- backwardsCompatibility.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backwardsCompatibility.md b/backwardsCompatibility.md index abadb02b..285b4edb 100644 --- a/backwardsCompatibility.md +++ b/backwardsCompatibility.md @@ -14,7 +14,9 @@ cost. The fee schedule for eWASM is yet to be specified. ## Identification of code We assume there is some sort of code handler function that all clients have implemented. The code handler identifies the instruction set type by whether it -starts with WASM's magic number (0x6d736100) or not. +starts with WASM's magic number or not. + +The WASM magic number is the following byte sequence: `0x00, 0x61, 0x73, 0x6d`. ## Solidity Support of compiling to eWASM can be accompilshed by adding a new backend to From f50d5dede3968fd6f15886ebaf4584d7ca69b815 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 14 Aug 2016 13:50:32 +0100 Subject: [PATCH 4/4] Include backwards compatibility link in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aeeee191..8da22268 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ eWASM: * specifies an [Ethereum environment interface](./eth_interface.md) to facilitate interaction with the Ethereum environment from an *eWASM contract* * specifies [metering](./metering.md) for instructions * and aims to restrict [non-deterministic behavior](https://github.com/WebAssembly/design/blob/master/Nondeterminism.md) +* specifies a backwards compatible upgrade path to EVM1 ### Goals of the eWASM project @@ -50,6 +51,7 @@ eWASM: * [Rationale](./rationale.md) * [Ethereum environment interface](./eth_interface.md) * [eWASM Contract Interface](./contract_interface.md) +* [Backwards compatibility instructions](./backwardsCompatibility.md) * [Original Proposal](https://github.com/ethereum/EIPs/issues/48) (EIP#48) * [WebAssembly design documents](https://github.com/WebAssembly/design)