< 返回版块

Mike Tang 发表于 2019-11-05 19:15

Tags:rust,substrate

PR 3927 已经于 10 天前合并进 Master 分支了。

这个 PR 提供了一个 SRML 的模块,这个模块实现了 EVM 执行器,允许已有的 EVM 合约代码不需要任何修改就能在基于 Substrate 的区块链上执行。

Execution Lifecycle

Accounts that the EVM can touch are stored in srml_evm::Accounts. Users can use call Module::deposit_balance and Module::withdraw_balance to transfer balance from normal balances module into the EVM module. There's one-to-one correspondence of balances account and EVM external accounts, defined via Trait::ConvertAccountId.

Once balance is in, users can then use Module::call and Module::create to execute normal EVM transactions, which corresponds to Ethereum message call transactions and contract creation transactions.

Compatibility

The module should be able to produce nearly identical result as running on Ethereum mainnet, including gas cost and balance changes. Observable behaviors by the contract that might be different include:

  • Block hashes. We use the system module to fetch block hashes. The available length may not be 256, but depends on the configuration of the system module.
  • Difficulty and coinbase. This value does not quite make sense in this module, and is currently hard coded to zero.

Detailed content in https://github.com/paritytech/substrate/pull/3927

评论区

写评论

还没有评论

1 共 0 条评论, 1 页