Frontier / EVM Pallet
Description
Currently, subtensor lacks Ethereum Virtual Machine (EVM) compatibility and some of our partners require said functionality to integrate their existing solutions or develop new ones on our platform.
To address this limitation and expand the chain's functionality, we propose adding the Frontier / EVM pallet to Subtensor. This addition will enable Ethereum-compatible smart contract execution, allowing us to support a wider range of applications and potentially attract more developers and users to our ecosystem.
Acceptance Criteria
- The Frontier / EVM pallet is successfully integrated into the Subtensor runtime.
- EVM-compatible smart contracts can be deployed and executed on the Subtensor blockchain.
- Ethereum-style accounts and addresses are supported alongside existing Substrate-native accounts.
- Basic Ethereum RPC methods are implemented and functional.
- Gas pricing and limits are properly configured and adjustable.
- The integration does not negatively impact the existing functionality of the Subtensor blockchain.
Tasks
- [x] Add the Frontier / EVM pallet as a dependency in the
Cargo.tomlfile. - [x] Configure the EVM pallet in the runtime's
lib.rsfile. - [x] Implement necessary runtime APIs for EVM support.
- [x] Add EVM-related types and configurations to the chain specification.
- [x] Implement Ethereum-compatible RPC methods.
- [x] Configure gas pricing and limits for EVM execution.
- [x] Update the genesis configuration to include EVM-related parameters.
- [x] Implement necessary storage migrations if required (not required).
- [x] Add unit tests and integration tests for EVM functionality (integration only, unit testing is on Parity).
- [x] Add balance transfer precompile
- [x] Add staking precompile (stake, unstake, stake_for, unstake_for)
- [ ] Update documentation to reflect the addition of EVM support.
- [ ] Perform thorough testing on a testnet environment before mainnet deployment.
- [x] Launch testnet
- [x] Launch block explorer
- [x] Upload TAO icon to IPFS with Pinata
- [x] Submit PR to ethereumlists.org and wait for merging
- [x] Submit PR to slip44 registry and wait for merging (already existed)
- [x] Test if Metamask picked up ethereumlists info
- [x] Create EVM integration kit and examples
- [ ] Test ws connection with Ethereum tools, setup on the testnet if possible
- [x] Fix baedeker and test with Finney state. Restart evm testnet and make it have Finney state
- [x] Update devnet-ready to polkadot 1.11.0
- [x] Test if transaction fees are removed from TI
- [x] Rebase to devnet-ready (fix Finney deployment CI job, there's a PR for that)
- [x] Expose staking state via staking precompile
- [x] Staking API usage example
- [x] Faucet
- [x] Metamask fix (9 vs 18 decimals)
- [x] Correct decimals in block explorer
- [x] (bonus *) Precompile to verify sr25519 signature
Additional Considerations
- How will the addition of the EVM pallet affect the overall performance and resource usage of the Subtensor blockchain?
- We need to consider and review gas price (esp. for precompiles) to avoid storing too much data onchain with no fee
- What security considerations need to be addressed when introducing EVM compatibility?
- Precompiles can access and modify runtime state. Ideally, each precompile needs to be audited
- How will we handle potential conflicts between Substrate-native and Ethereum-style accounts?
Related Links
- Frontier GitHub Repository: https://github.com/paritytech/frontier
- Ethereum Yellow Paper (for EVM specifications): https://ethereum.github.io/yellowpaper/paper.pdf
- EVM demo and integration kit: https://github.com/gztensor/evm-demo
Keith's update to 1.16 (pull in template node changes): https://github.com/polkadot-evm/frontier/pull/1504/files
This already exists in mainnet.