feat: in-process ethrex integration — engine core (phases 0-1)#530
Draft
pablodeymo wants to merge 2 commits into
Draft
feat: in-process ethrex integration — engine core (phases 0-1)#530pablodeymo wants to merge 2 commits into
pablodeymo wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
crates/net/ethrex-engine(ethlambda-ethrex-engine).ethrex-common,ethrex-storage,ethrex-blockchainas pinned git deps (rev = de9b249b).levm) and devp2p stack, so there is norevm/libp2p/ethereum_sszclash. Lockfile resolves to 823 packages under Rust 1.92.0 with zero unification conflicts. The heavyweightethrex-rpccrate (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 ethrexStore+Blockchainfrom a parsed ELGenesis.build_block—create_payload+build_payloadon top of the canonical head (mirrorsforkchoiceUpdated(build)+getPayload, synchronously).import_block—add_block(execute + persist).set_forkchoice—apply_fork_choiceto advance the canonical head.head_hash/head_numberaccessors;EngineErrorwraps ethrex Store/Chain/ForkChoice errors.Deferred to the #367 re-stack: the ethlambda
ExecutionPayloadV3⇄ ethrexBlockconversion, theExecutionEnginetrait impl, theget_payload-by-id cache path, and live slot-loop wiring.How to Test
roundtrip::builds_executes_and_advances_headproves the full in-process path: genesis → build block → execute/import → fork choice → canonical head advances to block 1.