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 Substrate EVM Adapter application #2292

Merged
merged 2 commits into from
May 8, 2024
Merged

Conversation

dastanbeksamatov
Copy link
Contributor

@dastanbeksamatov dastanbeksamatov commented Apr 24, 2024

Project Abstract

Substrate EVM adapter aims to present an alternative approach to EVM compatibility for Substrate chains. The main goals are to improve developer experience and introduce an approach that requires the least amount of changes to the runtime and client. It does so by leveraging the best parts of multiple existing compatibility solutions and other awesome ecosystem tools.

Grant level

  • Level 1: Up to $10,000, 2 approvals
  • Level 2: Up to $30,000, 3 approvals
  • Level 3: Unlimited, 5 approvals (for >$100k: Web3 Foundation Council approval)

Application Checklist

  • The application template has been copied and aptly renamed (project_name.md).
  • I have read the application guidelines.
  • Payment details have been provided (Polkadot AssetHub (DOT, USDC & USDT) address in the application and bank details via email, if applicable).
  • I understand that 30% of each milestone will be paid in vested DOT, to the Polkadot address listed in the application.
  • I am aware that, in order to receive a grant, I (and the entity I represent) have to successfully complete a KYC/KYB check.
  • The software delivered for this grant will be released under an open-source license specified in the application.
  • The initial PR contains only one commit (squash and force-push if needed).
  • The grant will only be announced once the first milestone has been accepted (see the announcement guidelines).
  • I prefer the discussion of this application to take place in a private Element/Matrix channel. My username is: @_______:matrix.org (change the homeserver if you use a different one)

@github-actions github-actions bot added the admin-review This application requires a review from an admin. label Apr 24, 2024
Copy link
Contributor

github-actions bot commented Apr 24, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@dastanbeksamatov
Copy link
Contributor Author

I have read and hereby sign the Contributor License Agreement.

Copy link
Member

@PieWol PieWol left a comment

Choose a reason for hiding this comment

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

To my understanding this application tries to do what the Metamask snaps developed by Chainsafe try to do. I'm personally not fond of supporting another project with the same goal, especially as you are planning to completely discard a core piece of this grant application in the long run (adapter pallet). Other than that I left a few comments that should be addressed. Let's see what my colleagues will say.

applications/substrate-evm-adapter.md Outdated Show resolved Hide resolved
applications/substrate-evm-adapter.md Outdated Show resolved Hide resolved

## Future Plans

In the future, we plan to explore if we can completely remove the adapter pallet and have the account mapping and transaction converting logic completely in the RPC adapter. This will allow us to have even more lightweight and generic solution, however could present more challenges. A minimal metamask snap that can share the keyring with the adapter could be one of the solutions, but needs more research.
Copy link
Member

Choose a reason for hiding this comment

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

I think the metamask snaps especially by Chainsafe are exactly what you are looking for.

Copy link
Contributor Author

@dastanbeksamatov dastanbeksamatov May 1, 2024

Choose a reason for hiding this comment

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

changed it to more generic text about possibility of having evm compatibility without the pallet.
also, see my comment below for more context.

| **0d.** | Docker | We will provide a Dockerfile(s) that can be used to test all the functionality delivered with this milestone. |
| **0e.** | Article | I will publish an article that explains the complete lifecycle and future plans of the project |
| 1. | EVM Adapter Pallet | We will create a pallet that will be responsible for bridging the gap between the ETH RPC adapter and the Substrate chain. It will have the ability to dispatch FRAME calls, opt-in possibility to execute EVM bytecode, and handle account mapping. Another main responsibility of the pallet will be handling signature verification. Some parts of this pallet can be inspired from `frontier`'s pallet `pallet-ethereum` but needs refinement and some modification. |
| 2. | Substrate Node | We will create a Substrate node that has two runtimes: with and without the `pallet-evm`. Both will contain `evm-adapter` pallet, but only the one with `pallet-evm` will be able to execute EVM bytecode. This will demonstrate two main use-cases of this pallet. |
Copy link
Member

Choose a reason for hiding this comment

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

How is this Node different from existing EVM chains like Moonbeam?

Copy link
Contributor Author

@dastanbeksamatov dastanbeksamatov May 1, 2024

Choose a reason for hiding this comment

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

moonbeam and many other EVM compatible chains built with Frontier have the ETH RPC baked in in the client. They also add a lot pallets, runtime APIs and other changes to the runtime to ensure full EVM compatibility. Integrated ETH RPC complicates the code, really slows down the node, tps takes a hit and makes it hard to benchmark etc.

This deliverable in comparison, will have the most minimal setup: normal Substrate client and runtime with stripped down, lightweight version of the pallet-evm and pallet-evm-adapter. rpc-adapter is a standalone light client and does not have the problems of integrated rpc

applications/substrate-evm-adapter.md Outdated Show resolved Hide resolved
@dastanbeksamatov
Copy link
Contributor Author

dastanbeksamatov commented May 1, 2024

thanks for the review! @PieWol

In general, I described pros and cons for similar in the Ecosystem Fit section and I believe there is a need for this kind of solution, as evidenced by forum and StackExchange posts.

what the Metamask snaps developed by Chainsafe try to do.

I took a look at their snap as well, and it comes down to the same thing I mentioned for polkamask - the need to install a third party plugin, and the fact that it is closely tied to Metamask itself. It does not work in a script with web3.js or ethers.js, for example

I'm personally not fond of supporting another project with the same goal, especially as you are planning to completely discard a core piece of this grant application in the long run (adapter pallet)

I think, I understand where the confusion comes from. With enabling near to full evm compatibility without the pallet, I meant having such possibility, pallet would remain there as an option for teams to consider when they want to have EVM compatible chain. But it would be possible to "write" to the chain without using the adapter pallet. And snap is a very low hanging fruit that can be defaulted to if I don't find any better solution. And that future plans section is very raw right now, and I expect it will change during the course of this grant's development.

@semuelle semuelle self-assigned this May 2, 2024
Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

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

Welcome back and thanks for the application, @dastanbeksamatov.

You write that "In the future, we plan to explore if we can make the adapter pallet optional". Are you planning to use this architecture in a project of your own, or are you just building it in the hopes that it will generate enough community interest to maintain itself?

@dastanbeksamatov
Copy link
Contributor Author

dastanbeksamatov commented May 2, 2024

Welcome back and thanks for the application, @dastanbeksamatov.

thanks @semuelle!

In the future, we plan to explore if we can make the adapter pallet optional

IMO, one of the main disadvantages of current solutions is the fact that they require a lot of changes to the core protocol (runtime and client). And by having the adapter pallet, we are not completely fixing that. This is why I think it is important to explore options that could enable frictionless EVM compatibility that does not require changes to the protocol. Obviously without sacrificing security of the chain.

Are you planning to use this architecture in a project of your own, or are you just building it in the hopes that it will generate enough community interest to maintain itself?

RPC adapter itself will be a community tool that can run a light client of any Substrate chain and expose ETH RPC from it. As I mentioned above, there is enough community interest for this. And the evm adapter pallet, it will also be a public module that chains can use to provide "almost" full EVM compatibility. I can maintain it for the foreseeable future. If it generates enough interest (especially from the polkadot evm community), I would be interested in integrating it to upstream frontier monorepo as a stripped down version of pallet-evm.

Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification, @dastanbeksamatov. Sounds good to me. I will share your application with the rest of the committee.

@semuelle semuelle added the ready for review The project is ready to be reviewed by the committee members. label May 6, 2024
Copy link
Collaborator

@Noc2 Noc2 left a comment

Choose a reason for hiding this comment

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

Looks good to me

Copy link
Contributor

@keeganquigley keeganquigley left a comment

Choose a reason for hiding this comment

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

Hi @dastanbeksamatov thanks for the explanations and also for the presentation you gave me during our call. Based on your previous work, also happy to approve it.

I know you've worked with us a lot but I don't believe you've gone through a KYC phase with us yet, which we now require for all grantees. Could you take a moment to submit verification? Thanks! Once that is done we can merge the grant.

@dastanbeksamatov
Copy link
Contributor Author

Hi @dastanbeksamatov thanks for the explanations and also for the presentation you gave me during our call. Based on your previous work, also happy to approve it.

I know you've worked with us a lot but I don't believe you've gone through a KYC phase with us yet, which we now require for all grantees. Could you take a moment to submit verification? Thanks! Once that is done we can merge the grant.

just completed it! thanks!

@semuelle semuelle removed the admin-review This application requires a review from an admin. label May 8, 2024
@semuelle semuelle merged commit d405a58 into w3f:master May 8, 2024
10 of 12 checks passed
Copy link
Contributor

github-actions bot commented May 8, 2024

Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section of our README for more ways to find answers to your questions.

Before you start, take a moment to read through our announcement guidelines for all communications related to the grant or make them known to the right person in your organisation. In particular, please don't announce the grant publicly before at least the first milestone of your project has been approved. At that point or shortly before, you can get in touch with us at [email protected] and we'll be happy to collaborate on an announcement about the work you’re doing.

Lastly, please remember to let us know in case you run into any delays or deviate from the deliverables in your application. You can either leave a comment here or directly request to amend your application via PR. We wish you luck with your project! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The project is ready to be reviewed by the committee members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants