Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e745f4b
feat: integrate with ethrex over Engine API
pablodeymo May 13, 2026
a17c2d9
Merge branch 'main' into engine-api-integration
pablodeymo May 14, 2026
d2dc7cf
fix(ethrex-client): address review feedback on wire types and scaffol…
pablodeymo May 14, 2026
33e9c9a
Merge remote-tracking branch 'origin/main' into engine-api-integration
pablodeymo May 18, 2026
0dc37b3
refactor(types): promote execution-payload schema into common/types
pablodeymo May 18, 2026
c9e57c1
refactor(types): make ExecutionPayloadV3 and Withdrawal SSZ-derivable
pablodeymo May 18, 2026
c0d2938
feat(types): add ExecutionPayloadHeader plus payload→header projection
pablodeymo May 18, 2026
8f29f73
feat(types): embed execution payload in BlockBody and State (schema b…
pablodeymo May 18, 2026
47ee3bc
feat(state-transition): wire process_execution_payload into STF
pablodeymo May 18, 2026
99a8e9d
feat(blockchain): validate received-block payloads via engine_newPayl…
pablodeymo May 18, 2026
2b09417
feat(blockchain): fetch real execution payloads from the EL on proposal
pablodeymo May 18, 2026
adcfba3
test(blockchain): cover Phase 4 payload threading + leanSpec proposal…
pablodeymo May 18, 2026
5c54490
feat(blockchain): forward real EL block hashes in engine_forkchoiceUp…
pablodeymo May 19, 2026
dc25b97
fix(ethlambda): parse the dual-pubkey annotated_validators.yaml schema
pablodeymo May 19, 2026
db76a86
Revert "fix(ethlambda): parse the dual-pubkey annotated_validators.ya…
pablodeymo May 19, 2026
69c92e5
feat(ethlambda): seed genesis EL block_hash via --execution-genesis-b…
pablodeymo May 19, 2026
b6ca292
feat(blockchain): inform EL of own-built blocks via engine_newPayloadV3
pablodeymo May 19, 2026
b669410
feat: bootstrap real EL payload flow end-to-end (V4 + genesis body seed)
pablodeymo May 19, 2026
d0c5b72
feat: complete the ethlambda↔ethrex EL pairing loop end-to-end
pablodeymo May 19, 2026
a141a4a
Switch the two remaining V4 call sites in the actor to engine_newPayl…
pablodeymo May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 56 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"crates/common/test-fixtures",
"crates/common/types",
"crates/net/api",
"crates/net/ethrex-client",
"crates/net/p2p",
"crates/net/rpc",
"crates/storage",
Expand All @@ -35,6 +36,7 @@ ethlambda-metrics = { path = "crates/common/metrics" }
ethlambda-test-fixtures = { path = "crates/common/test-fixtures" }
ethlambda-types = { path = "crates/common/types" }
ethlambda-network-api = { path = "crates/net/api" }
ethlambda-ethrex-client = { path = "crates/net/ethrex-client" }
ethlambda-p2p = { path = "crates/net/p2p" }
ethlambda-rpc = { path = "crates/net/rpc" }
ethlambda-storage = { path = "crates/storage" }
Expand Down
1 change: 1 addition & 0 deletions bin/ethlambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license.workspace = true

[dependencies]
ethlambda-blockchain.workspace = true
ethlambda-ethrex-client.workspace = true
ethlambda-network-api.workspace = true
ethlambda-p2p.workspace = true
ethlambda-types.workspace = true
Expand Down
76 changes: 75 additions & 1 deletion bin/ethlambda/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use tracing::{error, info, warn};
use tracing_subscriber::{EnvFilter, Layer, Registry, layer::SubscriberExt};

use ethlambda_blockchain::BlockChain;
use ethlambda_ethrex_client::{ETHLAMBDA_ENGINE_CAPABILITIES, EngineClient, JwtSecret};
use ethlambda_rpc::RpcConfig;
use ethlambda_storage::{StorageBackend, Store, backend::RocksDBBackend};

Expand Down Expand Up @@ -105,6 +106,17 @@ struct CliOptions {
/// Directory for RocksDB storage
#[arg(long, default_value = "./data")]
data_dir: PathBuf,
/// URL of the ethrex (or other EL) Engine API auth endpoint, e.g. `http://127.0.0.1:8551`.
///
/// When unset, Engine API integration is disabled and ethlambda runs as
/// a consensus-only node. When set, `--execution-jwt-secret` is required.
#[arg(long, requires = "execution_jwt_secret")]
execution_endpoint: Option<String>,
/// Path to a file containing the 32-byte JWT secret shared with the EL,
/// as a single line of hex (optionally `0x`-prefixed). Same format used
/// by Lighthouse/Teku/Prysm/ethrex.
#[arg(long, requires = "execution_endpoint")]
execution_jwt_secret: Option<PathBuf>,
}

#[tokio::main]
Expand Down Expand Up @@ -217,7 +229,18 @@ async fn main() -> eyre::Result<()> {
// and the API server (which exposes GET/POST admin endpoints).
let aggregator = AggregatorController::new(options.is_aggregator);

let blockchain = BlockChain::spawn(store.clone(), validator_keys, aggregator.clone());
let execution_client = build_execution_client(
options.execution_endpoint.as_deref(),
options.execution_jwt_secret.as_deref(),
)
.await;

let blockchain = BlockChain::spawn(
store.clone(),
validator_keys,
aggregator.clone(),
execution_client,
);

// Note: SwarmConfig.is_aggregator is intentionally a plain bool, not the
// AggregatorController β€” subnet subscriptions are decided once here and
Expand Down Expand Up @@ -538,6 +561,57 @@ fn read_validator_keys(
Ok(validator_keys)
}

/// Build the optional Engine API client and run the capability handshake.
///
/// Returns `None` when integration is disabled (neither flag provided).
/// Returns `None` and logs an error when construction or the handshake
/// fails β€” consensus must keep running regardless of EL state.
async fn build_execution_client(
endpoint: Option<&str>,
jwt_path: Option<&Path>,
) -> Option<EngineClient> {
// CLI requires both-or-neither; defensive recheck for clarity.
let (endpoint, jwt_path) = match (endpoint, jwt_path) {
(Some(e), Some(p)) => (e, p),
(None, None) => return None,
_ => {
error!("Both --execution-endpoint and --execution-jwt-secret are required together");
return None;
}
};

let secret = match JwtSecret::from_file(jwt_path) {
Ok(s) => s,
Err(err) => {
error!(path = %jwt_path.display(), %err, "Failed to load JWT secret");
return None;
}
};

let client = match EngineClient::new(endpoint, secret) {
Ok(c) => c,
Err(err) => {
error!(%err, "Failed to construct EngineClient");
return None;
}
};

info!(endpoint, "Engine API integration enabled");

match client
.exchange_capabilities(ETHLAMBDA_ENGINE_CAPABILITIES)
.await
{
Ok(caps) => info!(count = caps.len(), "EL capability handshake succeeded"),
Err(err) => warn!(
%err,
"EL capability handshake failed (will keep retrying on each tick)"
),
}

Some(client)
}

fn read_hex_file_bytes(path: impl AsRef<Path>) -> Vec<u8> {
let path = path.as_ref();
let Ok(file_content) = std::fs::read_to_string(path)
Expand Down
1 change: 1 addition & 0 deletions crates/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ version.workspace = true
autotests = false

[dependencies]
ethlambda-ethrex-client.workspace = true
ethlambda-network-api.workspace = true
ethlambda-storage.workspace = true
ethlambda-state-transition.workspace = true
Expand Down
Loading
Loading