Skip to content

Commit 32dc528

Browse files
committed
Merge engine-api-integration (#367) into the in-process ethrex PoC
Absorbs the out-of-process Engine-API integration (#367) so the full EL pipeline — ExecutionEngine trait, ExecutionPayloadV3 embedded in BlockBody, process_execution_payload STF, per-slot forkchoiceUpdated, newPayload on import and on own-built blocks — lands on this branch alongside the in-process ethrex-engine crate. Reconciled against 55 commits of main evolution since #367 branched: - Block-production timing (Option A): main builds+publishes the next slot's block one interval early (interval 4). The EL payload is now built inline and synchronously at interval 4 via build_execution_payload (build-mode forkchoiceUpdated + getPayload), replacing #367's request-at-4 / fetch-at-0 stash. Dropped pending_payload_id, request_payload_id_for_next_slot, take_prepared_payload. - BlockChainConfig gained execution_client + suggested_fee_recipient (main had folded actor params into the config struct); CliOptions moved to cli.rs and gained the --execution-* flags there. - Signature type rename TypeOneMultiSignature -> SingleMessageAggregate applied to the merged block-builder / store paths; build_block and produce_block_with_signatures now thread both proposer_config and the optional execution_payload. - StateDiff carries latest_execution_payload_header so reconstructed states keep the EL block-hash chain (added the field + Eq/PartialEq on ExecutionPayloadHeader). Test-only State literals updated for the new field. Workspace builds, clippy -D warnings is clean, fmt clean; blockchain (58), state-transition (108), storage (67) unit tests and the ethrex-engine roundtrip pass. The in-process ExecutionEngine impl + --execution-mode selector are the next step.
2 parents 51d420c + 344c67b commit 32dc528

42 files changed

Lines changed: 3393 additions & 27 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 52 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ members = [
1111
"crates/common/test-fixtures",
1212
"crates/common/types",
1313
"crates/net/api",
14+
"crates/net/ethrex-client",
1415
"crates/net/ethrex-engine",
1516
"crates/net/p2p",
1617
"crates/net/rpc",
@@ -36,6 +37,7 @@ ethlambda-metrics = { path = "crates/common/metrics" }
3637
ethlambda-test-fixtures = { path = "crates/common/test-fixtures" }
3738
ethlambda-types = { path = "crates/common/types" }
3839
ethlambda-network-api = { path = "crates/net/api" }
40+
ethlambda-ethrex-client = { path = "crates/net/ethrex-client" }
3941
ethlambda-p2p = { path = "crates/net/p2p" }
4042
ethlambda-rpc = { path = "crates/net/rpc" }
4143
ethlambda-storage = { path = "crates/storage" }
@@ -56,6 +58,7 @@ spawned-concurrency = "0.5.0"
5658
spawned-rt = "0.5.0"
5759
tokio = "1.0"
5860
tokio-util = "0.7"
61+
async-trait = "0.1.83"
5962

6063
prometheus = "0.14"
6164

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help fmt lint docker-build shadow-build shadow-docker-build run-devnet test docs docs-deps docs-serve
1+
.PHONY: help fmt lint docker-build shadow-build shadow-docker-build run-devnet run-el-demo test docs docs-deps docs-serve
22

33
help: ## 📚 Show help for each of the Makefile recipes
44
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@@ -74,6 +74,9 @@ run-devnet: docker-build lean-quickstart ## 🚀 Run a local devnet using lean-q
7474
@cd lean-quickstart \
7575
&& NETWORK_DIR=local-devnet ./spin-node.sh --node all --generateGenesis --metrics > ../devnet.log 2>&1
7676

77+
run-el-demo: ## 🔗 Run the ethlambda <-> ethrex Engine API demo (see scripts/engine-api-demo/README.md)
78+
@./scripts/engine-api-demo/run.sh
79+
7780
docs-deps: ## 📦 Install dependencies for generating the documentation
7881
cargo install --version 0.5.2 --locked mdbook
7982
cargo install --version 0.12.0 --locked mdbook-linkcheck2

bin/ethlambda/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ shadow-integration = ["ethlambda-crypto/shadow-integration"]
2121
[dependencies]
2222
ethlambda-blockchain.workspace = true
2323
ethlambda-crypto.workspace = true
24+
ethlambda-ethrex-client.workspace = true
2425
ethlambda-network-api.workspace = true
2526
ethlambda-p2p.workspace = true
2627
ethlambda-types.workspace = true

bin/ethlambda/src/checkpoint_sync.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ mod tests {
380380
justified_slots: JustifiedSlots::new(),
381381
justifications_roots: Default::default(),
382382
justifications_validators: JustificationValidators::new(),
383+
latest_execution_payload_header: Default::default(),
383384
}
384385
}
385386

bin/ethlambda/src/cli.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ pub(crate) struct CliOptions {
7575
/// Directory for RocksDB storage
7676
#[arg(long, default_value = "./data")]
7777
pub(crate) data_dir: PathBuf,
78+
/// URL of the ethrex (or other EL) Engine API auth endpoint, e.g.
79+
/// `http://127.0.0.1:8551`. When unset, Engine API integration is disabled
80+
/// and ethlambda runs as a consensus-only node. When set,
81+
/// `--execution-jwt-secret` is required.
82+
#[arg(long, requires = "execution_jwt_secret")]
83+
pub(crate) execution_endpoint: Option<String>,
84+
/// Path to a file containing the 32-byte JWT secret shared with the EL, as
85+
/// a single line of hex (optionally `0x`-prefixed). Same format used by
86+
/// Lighthouse/Teku/Prysm/ethrex.
87+
#[arg(long, requires = "execution_endpoint")]
88+
pub(crate) execution_jwt_secret: Option<PathBuf>,
89+
/// 32-byte hex hash of the EL's genesis block. Seeds
90+
/// `state.latest_execution_payload_header.block_hash` so the first
91+
/// `forkchoiceUpdated` carries a head the EL recognizes. Only meaningful
92+
/// alongside `--execution-endpoint`.
93+
#[arg(long, requires = "execution_endpoint")]
94+
pub(crate) execution_genesis_block_hash: Option<String>,
7895
/// Disable the sync-gate's suppression of validator duties.
7996
///
8097
/// By default a node that judges itself to be syncing (local head lagging

0 commit comments

Comments
 (0)