[pallet-revive] Eth RPC integration (#5866)
This PR introduces the necessary changes to pallet-revive for integrating with our Ethereum JSON-RPC. The RPC proxy itself will be added in a follow up. ## Changes - A new pallet::call `Call::eth_transact`. This is used as a wrapper to accept unsigned Ethereum transaction, valid call will be routed to `Call::call` or `Call::instantiate_with_code` - A custom UncheckedExtrinsic struct, that wraps the generic one usually and add the ability to check eth_transact calls sent from an Ethereum JSON-RPC proxy. - Generated types and traits to support implementing a JSON-RPC Ethereum proxy. ## Flow Overview: - A user submits a transaction via MetaMask or another Ethereum-compatible wallet. - The proxy dry run the transaction and add metadata to the call (gas limit in Weight, storage deposit limit, and length of bytecode and constructor input for contract instantiation) - The raw transaction, along with the additional metadata, is submitted to the node as an unsigned extrinsic. - On the runtime, our custom UncheckedExtrinsic define a custom Checkable implementation that converts the unsigned extrinsics into checked one - It recovers the signer - validates the payload, and injects signed extensions, allowing the system to increment the nonce and charge the appropriate fees. - re-route the call to pallet-revive::Call::call or pallet-revive::Call::instantiateWithCode ## Dependencies - https://github.com/koute/polkavm/pull/188 ## Follow up PRs - #5926 - #6147 (previously #5953) - #5502 --------- Co-authored-by:Alexander Theißen <alex.theissen@me.com> Co-authored-by:
Cyrill Leutwiler <cyrill@parity.io>
parent
356386b5
Showing
- Cargo.lock 141 additions, 30 deletionsCargo.lock
- prdoc/pr_5866.prdoc 23 additions, 0 deletionsprdoc/pr_5866.prdoc
- substrate/bin/node/cli/Cargo.toml 1 addition, 2 deletionssubstrate/bin/node/cli/Cargo.toml
- substrate/bin/node/cli/benches/block_production.rs 6 additions, 4 deletionssubstrate/bin/node/cli/benches/block_production.rs
- substrate/bin/node/cli/src/chain_spec.rs 31 additions, 2 deletionssubstrate/bin/node/cli/src/chain_spec.rs
- substrate/bin/node/cli/src/service.rs 14 additions, 5 deletionssubstrate/bin/node/cli/src/service.rs
- substrate/bin/node/cli/tests/basic.rs 4 additions, 4 deletionssubstrate/bin/node/cli/tests/basic.rs
- substrate/bin/node/cli/tests/fees.rs 1 addition, 1 deletionsubstrate/bin/node/cli/tests/fees.rs
- substrate/bin/node/cli/tests/submit_transaction.rs 5 additions, 4 deletionssubstrate/bin/node/cli/tests/submit_transaction.rs
- substrate/bin/node/runtime/Cargo.toml 2 additions, 0 deletionssubstrate/bin/node/runtime/Cargo.toml
- substrate/bin/node/runtime/src/lib.rs 73 additions, 6 deletionssubstrate/bin/node/runtime/src/lib.rs
- substrate/bin/node/testing/Cargo.toml 1 addition, 0 deletionssubstrate/bin/node/testing/Cargo.toml
- substrate/bin/node/testing/src/bench.rs 9 additions, 6 deletionssubstrate/bin/node/testing/src/bench.rs
- substrate/bin/node/testing/src/keyring.rs 9 additions, 6 deletionssubstrate/bin/node/testing/src/keyring.rs
- substrate/frame/revive/Cargo.toml 32 additions, 9 deletionssubstrate/frame/revive/Cargo.toml
- substrate/frame/revive/fixtures/Cargo.toml 2 additions, 9 deletionssubstrate/frame/revive/fixtures/Cargo.toml
- substrate/frame/revive/fixtures/build.rs 7 additions, 2 deletionssubstrate/frame/revive/fixtures/build.rs
- substrate/frame/revive/fixtures/build/Cargo.toml 1 addition, 1 deletionsubstrate/frame/revive/fixtures/build/Cargo.toml
- substrate/frame/revive/fixtures/src/lib.rs 11 additions, 12 deletionssubstrate/frame/revive/fixtures/src/lib.rs
- substrate/frame/revive/mock-network/Cargo.toml 14 additions, 0 deletionssubstrate/frame/revive/mock-network/Cargo.toml
Please register or sign in to comment