From e41e44a3b46c46f37d3f7320c70e40bd57cf39ea Mon Sep 17 00:00:00 2001
From: Shinsaku Ashizawa <39494661+NoCtrlZ@users.noreply.github.com>
Date: Mon, 9 Nov 2020 02:18:34 +0900
Subject: [PATCH] Write pallet_evm README (#7487)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* describe pallet evm

* add license

* write readme into lib.rs

* change some sentence

Co-authored-by: Wei Tang <accounts@that.world>

* update implementation status

Co-authored-by: Wei Tang <accounts@that.world>

* update readme according to review

* Update frame/evm/src/lib.rs

* fix line length

Co-authored-by: Wei Tang <accounts@that.world>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
---
 substrate/frame/evm/README.md  | 28 ++++++++++++++++++++++++++-
 substrate/frame/evm/src/lib.rs | 35 +++++++++++++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/substrate/frame/evm/README.md b/substrate/frame/evm/README.md
index f8feadbf58e..499a0761cfa 100644
--- a/substrate/frame/evm/README.md
+++ b/substrate/frame/evm/README.md
@@ -1,3 +1,29 @@
-EVM execution module for Substrate
+# EVM Module
+
+The EVM module allows unmodified EVM code to be executed in a Substrate-based blockchain.
+- [`evm::Trait`](https://docs.rs/pallet-evm/2.0.0/pallet_evm/trait.Trait.html)
+
+## EVM Engine
+
+The EVM module uses [`SputnikVM`](https://github.com/rust-blockchain/evm) as the underlying EVM engine. The engine is overhauled so that it's [`modular`](https://github.com/corepaper/evm).
+
+## Execution Lifecycle
+
+There are a separate set of accounts managed by the EVM module. Substrate based accounts can call the EVM Module to deposit or withdraw balance from the Substrate base-currency into a different balance managed and used by the EVM module. Once a user has populated their balance, they can create and call smart contracts using this module.
+
+There's one-to-one mapping from Substrate accounts and EVM external accounts that is defined by a conversion function.
+
+## EVM Module vs Ethereum Network
+
+The EVM module should be able to produce nearly identical results compared to the Ethereum mainnet, including gas cost and balance changes.
+
+Observable differences include:
+
+- The available length of block hashes may not be 256 depending on the configuration of the System module in the Substrate runtime.
+- Difficulty and coinbase, which do not make sense in this module and is currently hard coded to zero.
+
+We currently do not aim to make unobservable behaviors, such as state root, to be the same. We also don't aim to follow the exact same transaction / receipt format. However, given one Ethereum transaction and one Substrate account's private key, one should be able to convert any Ethereum transaction into a transaction compatible with this module.
+
+The gas configurations are configurable. Right now, a pre-defined Istanbul hard fork configuration option is provided.
 
 License: Apache-2.0
\ No newline at end of file
diff --git a/substrate/frame/evm/src/lib.rs b/substrate/frame/evm/src/lib.rs
index dddb71fc02a..e7812a55482 100644
--- a/substrate/frame/evm/src/lib.rs
+++ b/substrate/frame/evm/src/lib.rs
@@ -15,7 +15,40 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-//! EVM execution module for Substrate
+//! # EVM Module
+//!
+//! The EVM module allows unmodified EVM code to be executed in a Substrate-based blockchain.
+//! - [`evm::Trait`]
+//!
+//! ## EVM Engine
+//!
+//! The EVM module uses [`SputnikVM`](https://github.com/rust-blockchain/evm) as the underlying EVM engine.
+//! The engine is overhauled so that it's [`modular`](https://github.com/corepaper/evm).
+//!
+//! ## Execution Lifecycle
+//!
+//! There are a separate set of accounts managed by the EVM module. Substrate based accounts can call the EVM Module
+//! to deposit or withdraw balance from the Substrate base-currency into a different balance managed and used by
+//! the EVM module. Once a user has populated their balance, they can create and call smart contracts using this module.
+//!
+//! There's one-to-one mapping from Substrate accounts and EVM external accounts that is defined by a conversion function.
+//!
+//! ## EVM Module vs Ethereum Network
+//!
+//! The EVM module should be able to produce nearly identical results compared to the Ethereum mainnet,
+//! including gas cost and balance changes.
+//!
+//! Observable differences include:
+//!
+//! - The available length of block hashes may not be 256 depending on the configuration of the System module
+//! in the Substrate runtime.
+//! - Difficulty and coinbase, which do not make sense in this module and is currently hard coded to zero.
+//!
+//! We currently do not aim to make unobservable behaviors, such as state root, to be the same. We also don't aim to follow
+//! the exact same transaction / receipt format. However, given one Ethereum transaction and one Substrate account's
+//! private key, one should be able to convert any Ethereum transaction into a transaction compatible with this module.
+//!
+//! The gas configurations are configurable. Right now, a pre-defined Istanbul hard fork configuration option is provided.
 
 // Ensure we're `no_std` when compiling for Wasm.
 #![cfg_attr(not(feature = "std"), no_std)]
-- 
GitLab