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

Add pallet-contracts support as a pallet-evm Runner #1283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sorpaas
Copy link
Member

@sorpaas sorpaas commented Jan 21, 2024

This adds basic pallet-contracts support by implementing it as a pallet-evm Runner.

We implement Runner::call and Runner::create, but not Runner::create2, because the latter is never directly called in an Ethereum transaction.

The implementation of Runner::call is straightforward. For Runner::create, we "abused" the init field to hold a SCALE encoded tuple (code: Vec<u8>, init_data: Vec<u8>, salt: Vec<u8>), and implemented it that way.

Comment on lines +196 to +200
let (code, init_data, salt): (Vec<u8>, Vec<u8>, Vec<u8>) =
scale_codec::Decode::decode(&mut &init[..]).map_err(|_| RunnerError {
error: Error::<T>::Undefined, // TODO: pallet contracts specific error.
weight,
})?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will work but only when we provide some custom tooling, right? Otherwise when using web3.js init will contain init_args ++ code, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

This will need custom tooling no matter what simply because it's not EVM..
But it does fulfill the requirement that we can now use Ethereum RPCs to interact with pallet-contracts.

@boundless-forest
Copy link
Collaborator

Question: Does this mean that the frontier can support ink contact with the Ethereum RPC layer?

@sorpaas
Copy link
Member Author

sorpaas commented Jan 25, 2024

Does this mean that the frontier can support ink contact with the Ethereum RPC layer?

If this works, yes. :)

@gregogalante
Copy link

Any updates here?

@athei
Copy link
Contributor

athei commented Jul 4, 2024

This was only an experiment. We decided to go down a different route. Instead of adding support to frontier we are creating a solution more similar what Acala is doing: Having a stand alone proxy translation server that translates Eth RPC to Substrate unchecked extrinsics. This will allow it to work without adding support to each client.

Please note that even with that it will not work with ink! out of the box. Ink needs support for Ethereum ABI to make this any useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants