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

Create an example using Revm #1339

Open
12 tasks
roninjin10 opened this issue Jul 25, 2024 · 0 comments
Open
12 tasks

Create an example using Revm #1339

roninjin10 opened this issue Jul 25, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@roninjin10
Copy link
Collaborator

roninjin10 commented Jul 25, 2024

Description

It would be useful to offer revm as a plugin for the devnet to be swapped in for the EVM. To do this we just need to create an adapter that uses revm under the hood to implement some subset of the ethereumjs EVM interface

This task has 4 steps

1. Add @tevm/revm-example

  • Create a simple example node.js or bun example using tevm in the examples folder

Note: it is expected the example won't work yet we implement it in following steps

import { createMemoryClient } from 'tevm'
import { createRevm } from 'tevm/revm'

const client = createMemoryClient({
  createEvm: (opts) => {
    return createRevm(opts)
  }
})

2. Create the Revm adapter

This step is to wrap revm in the ethereumjs evm api. This task has substeps

The only real important method we need to implement for evm is runCall. But feel free to implement other methods too

When implement take the following shortcuts to make it much simpler

  • Don't support reading from the tevm state manager. This means it won't support forking etc. to start.
  • Don't support precompiles
  • Feel free to skip supporting any EVM params as long as it supports a basic call

See following links

3. Add createEvm as experimental option to @tevm/base-client

  • Add createEvm s a typescript interface to BaseClient file
  • Implement it by having it default to the current createEvm function iin createBaseClient
  • Export it from a revm folder in tevm package `export * from '@tevm/revm'
  • Additionally you should add it typedoc.json tsup.config.js and package.json. Reach out for help if you get stuck

4. Put it all together

  • Now we should be able to test it out in your example app
@roninjin10 roninjin10 added the help wanted Extra attention is needed label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant