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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

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.

Related PR: paritytech/revive-ethereum-rpc#5

Changes Included:

  • 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

@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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code used to generate rpc_types_gen.rs and rpc_methods_gen.rs will be added in a separate PR to keep the diff manageable here

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.

1 participant