reth icon indicating copy to clipboard operation
reth copied to clipboard

Compilation of `evm` crate to RISC-V in CI

Open puma314 opened this issue 1 year ago • 4 comments

This is an extremely messy WIP draft of the modifications needed to get the reth_evm crate to compile inside a zkVM. I put it up as a draft to get comments on the approach.

puma314 avatar May 14 '24 00:05 puma314

@mattsse do you have a suggestion for what to do for this import use reth_network_api::NetworkError? Any chance that we can move it to primitives and import it from there in interfaces, etc.?

puma314 avatar May 14 '24 21:05 puma314

looking into this

mattsse avatar May 14 '24 21:05 mattsse

Also do you have an recommendation of where to put the compilation to RISC-V test? I can put it in testing and add a git workflow for it. Can also add a dockerfile with all the relevant installs of the toolchains so that there is not need for an install script, etc.

puma314 avatar May 14 '24 21:05 puma314

@mattsse @gakonst this is ready for review, I cleaned it up significantly and found a sustainable solution for the NetworkError. I also added the testing of the zkVM compilation via Dockerfile environment.

puma314 avatar May 16 '24 05:05 puma314

By the way @mattsse these are the crates + methods from them that would be nice to have compiled to RISC-V:

  • reth-primitives = { path = "../../crates/primitives", default-features = false, features = ["alloy-compat"]}
  • reth-consensus.workspace = true
  • reth-interfaces = { path = "../../crates/interfaces", default-features = false }
  • reth-evm.workspace = true
  • revm.workspace = true
  • reth-revm.workspace = true
  • revm-primitives.workspace = true

In particular, we use the reth_evm::Executor (like this: use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor};) to actually run the execution.

You can see the crates + method we use in this WIP draft PR I made here that implements a zkEVM STF using the crates above if that's helpful context.

puma314 avatar May 23 '24 00:05 puma314