Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pallet-revive] Eth RPC integration #5866

Merged
merged 163 commits into from
Oct 22, 2024
Merged

[pallet-revive] Eth RPC integration #5866

merged 163 commits into from
Oct 22, 2024

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Sep 30, 2024

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

Follow up PRs

@pgherveou pgherveou force-pushed the pg/revive-rpc-fixes-v2 branch 4 times, most recently from 16c7f99 to c58e6a5 Compare September 30, 2024 14:49
@pgherveou pgherveou marked this pull request as ready for review September 30, 2024 15:53
@pgherveou pgherveou added R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts. labels Sep 30, 2024
substrate/bin/node/runtime/Cargo.toml Outdated Show resolved Hide resolved
Co-authored-by: Cyrill Leutwiler <[email protected]>
@pgherveou pgherveou added this pull request to the merge queue Oct 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 22, 2024
@pgherveou pgherveou added this pull request to the merge queue Oct 22, 2024
Merged via the queue into master with commit 21930ed Oct 22, 2024
189 of 196 checks passed
@pgherveou pgherveou deleted the pg/revive-rpc-fixes-v2 branch October 22, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants