Skip to content

feat: in-process ethrex integration — engine core (phases 0-1)#530

Draft
pablodeymo wants to merge 2 commits into
mainfrom
feat/ethrex-inprocess-poc
Draft

feat: in-process ethrex integration — engine core (phases 0-1)#530
pablodeymo wants to merge 2 commits into
mainfrom
feat/ethrex-inprocess-poc

Conversation

@pablodeymo

@pablodeymo pablodeymo commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Description / Motivation

Integrates ethrex in-process as a library crate (counterpart to #367, which integrates ethrex out-of-process over the Engine API). No separate ethrex binary, no JWT/JSON-RPC hop — the execution layer is driven directly via ethrex library calls.

Opened as draft; first of a multi-phase series. Later phases stack on #367.

What Changed

Phase 0 — dependency de-risk

  • New crate crates/net/ethrex-engine (ethlambda-ethrex-engine).
  • Added ethrex-common, ethrex-storage, ethrex-blockchain as pinned git deps (rev = de9b249b).
  • ethrex ships its own EVM (levm) and devp2p stack, so there is no revm/libp2p/ethereum_ssz clash. Lockfile resolves to 823 packages under Rust 1.92.0 with zero unification conflicts. The heavyweight ethrex-rpc crate (axum/p2p server) is deliberately not a dependency.

Phase 1 — engine core

EthrexEngine — the #367-independent core, over ethrex-native types (Block, H256):

  • from_genesis — in-memory ethrex Store + Blockchain from a parsed EL Genesis.
  • build_blockcreate_payload + build_payload on top of the canonical head (mirrors forkchoiceUpdated(build) + getPayload, synchronously).
  • import_blockadd_block (execute + persist).
  • set_forkchoiceapply_fork_choice to advance the canonical head.
  • head_hash / head_number accessors; EngineError wraps ethrex Store/Chain/ForkChoice errors.

Deferred to the #367 re-stack: the ethlambda ExecutionPayloadV3 ⇄ ethrex Block conversion, the ExecutionEngine trait impl, the get_payload-by-id cache path, and live slot-loop wiring.

How to Test

cargo test -p ethlambda-ethrex-engine

roundtrip::builds_executes_and_advances_head proves the full in-process path: genesis → build block → execute/import → fork choice → canonical head advances to block 1.

cargo fmt --all -- --check
cargo clippy -p ethlambda-ethrex-engine --all-targets -- -D warnings

First step toward integrating ethrex in-process as a library crate (counterpart
to #367, which integrates ethrex out-of-process over the Engine API). This is a
de-risk spike proving ethrex embeds as an unmodified pinned git dependency and
compiles cleanly inside the workspace before any functional code is written.

- New crate crates/net/ethrex-engine (ethlambda-ethrex-engine) linking the three
  core ethrex library crates (ethrex-common, ethrex-storage, ethrex-blockchain),
  pinned to rev de9b249b. No functionality yet; ExecutionEngine impl follows.
- ethrex ships its own EVM (levm) and devp2p, so there is no revm/libp2p/
  ethereum_ssz clash; lockfile resolves with zero unification conflicts. The
  heavyweight ethrex-rpc crate is intentionally not a dependency.
- docs/plans/ethrex-inprocess-poc.md documents the design and phased plan.
Implement EthrexEngine, the #367-independent core of the in-process ethrex
integration. It bootstraps an in-memory ethrex store from an EL genesis and
drives the execution layer directly via ethrex library calls — no Engine API
or JSON-RPC hop.

- from_genesis: in-memory Store + Blockchain from a parsed Genesis
- build_block: create_payload + build_payload on top of the canonical head
  (mirrors forkchoiceUpdated(build)+getPayload synchronously)
- import_block: add_block (execute + persist)
- set_forkchoice: apply_fork_choice to advance the canonical head
- head_hash / head_number accessors
- EngineError wraps the underlying ethrex Store/Chain/ForkChoice errors

Speaks ethrex-native types (Block, H256); the ethlambda ExecutionPayloadV3 ⇄
Block conversion and the ExecutionEngine trait impl are layered on when this
crate stacks on the Engine-API branch (#367). Proven by the roundtrip test:
genesis → build → execute → fork-choice → head advances to block 1.
@pablodeymo pablodeymo changed the title feat: scaffold in-process ethrex execution-engine crate (phase 0) feat: in-process ethrex integration — engine core (phases 0-1) Jul 20, 2026
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.

1 participant