Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ crates/
├─ crypto/ # XMSS sign/verify + aggregation (leanVM wrapper)
├─ ssz-tree/ # Persistent Merkle tree (List/Vector) behind the beacon registry and balances
├─ metrics/ # Prometheus re-exports, TimingGuard, gather utilities
├─ telemetry/ # ClickHouse block_events rows (opt-in)
├─ telemetry/ # ClickHouse block_events rows + OTLP pq.* telemetry events (opt-in)
└─ test-fixtures/ # Spec-fixture loading (prod dep of rpc's Hive test driver)
net/
├─ api/ # Actor protocol traits wiring BlockChain ↔ P2P, plus the shared sync-gate thresholds (`sync.rs`)
Expand Down Expand Up @@ -303,8 +303,8 @@ actual_slot = finalized_slot + 1 + relative_index
consensus-specs' and leanVM's known answers), and proves many signatures at
once through `ethlambda_crypto::stark`: the specification's reference (the
signatures concatenated), or real leanVM proofs made in process
(`stark::leanvm`, leanVM `351f7ae4`, bindings v0.19.0, the one release
pq-devnet-1 runs for signer, prover and verifier; `lean_vm` with its
(`stark::leanvm`, leanVM `17cb5cc6`, bindings v0.19.2, the release
pq-devnet-2 runs for signer, prover and verifier; `lean_vm` with its
experimental prover). `run_node` installs leanVM as soon
as `--network` resolves to a network that schedules PQ, on
`--pq-prover-threads` threads (0: one per core, never more than the
Expand All @@ -321,8 +321,9 @@ actual_slot = finalized_slot + 1 + relative_index
seat's 2.4 s proving window. v0.17.0 removed pq-devnet-0's
`leanvm-sidecar`, so the image builds none, and `ethlambda-pq`
(`bin/ethlambda/pq/`) is now a shim that execs `ethlambda`, kept for
launchers that still call it. A proof from another leanVM revision does not
verify, and nothing on the wire says why; the root `leanvm-revision` file
launchers that still call it. A proof from a leanVM revision with another
`PROTOCOL_VERSION` does not verify (v0.19.0 through v0.19.2 share theirs),
and nothing on the wire says why; the root `leanvm-revision` file
names the pin (a test holds it equal to the manifest's `rev`s, and the
Dockerfile reads it). The two encodings do not verify each other's proofs.
Never pass one scheme's key to the other
Expand Down
158 changes: 90 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ keccak = "0.1.6"
# attestation proofs as the PQ devnet makes them, real leanVM STARKs over
# leanXMSS signatures rather than the specification's concatenation
# (`ethlambda_crypto::stark`); and leanVM's leanXMSS, which signs and verifies.
# Pinned to bindings v0.19.0 (351f7ae4), the one release pq-devnet-1 runs for
# its signer, prover and verifier; the devnet takes no other revision.
# Pinned to bindings v0.19.2 (17cb5cc6), the release pq-devnet-2 runs for its
# signer, prover and verifier. It proves the same guest as v0.19.0, which
# pq-devnet-1 ran (`PROTOCOL_VERSION` 1 in both), so the two verify each
# other's proofs and signatures.
# `experimental_prover` is the prover the pq-devnet-0 sidecar ran; it makes
# the same proofs as the stable one, faster. leanVM's `cpu_tiers` is behind
# `ethlambda-crypto`'s `leanvm-cpu-tiers` feature, off by default: it only
# does anything under leanVM's `scripts/tier-rustc` as `RUSTC_WRAPPER`, which
# the Dockerfile sets.
# Not the `leanvm` revision below, which lean consensus proves with.
leanvm_prover = { package = "lean_vm", git = "https://github.com/leanEthereum/leanVM.git", rev = "351f7ae421529ce164ed747eee1f78bdeaec3e80", features = ["experimental_prover"] }
leanvm_claims = { package = "claims", git = "https://github.com/leanEthereum/leanVM.git", rev = "351f7ae421529ce164ed747eee1f78bdeaec3e80" }
leanvm_lean_xmss = { package = "lean_xmss", git = "https://github.com/leanEthereum/leanVM.git", rev = "351f7ae421529ce164ed747eee1f78bdeaec3e80" }
leanvm_prover = { package = "lean_vm", git = "https://github.com/leanEthereum/leanVM.git", rev = "17cb5cc6bb9af2321cfff3a50ccbeaf612e0113b", features = ["experimental_prover"] }
leanvm_claims = { package = "claims", git = "https://github.com/leanEthereum/leanVM.git", rev = "17cb5cc6bb9af2321cfff3a50ccbeaf612e0113b" }
leanvm_lean_xmss = { package = "lean_xmss", git = "https://github.com/leanEthereum/leanVM.git", rev = "17cb5cc6bb9af2321cfff3a50ccbeaf612e0113b" }

# XMSS signatures + recursive aggregation, through leanVM's own facade crate:
# it re-exports the aggregation API, the `xmss` module (keys, signing, and the
Expand Down
9 changes: 8 additions & 1 deletion bin/ethlambda/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub(crate) struct MainnetOptions {
/// How many threads leanVM's in-process prover runs on, 0 for one per
/// core. Read only on a network that schedules the PQ fork, whose
/// attestation proofs this node makes and checks with leanVM (bindings
/// v0.19.0) in process.
/// v0.19.2) in process.
#[arg(long, default_value_t = 0)]
pub(crate) pq_prover_threads: usize,

Expand Down Expand Up @@ -470,6 +470,13 @@ pub(crate) struct MainnetOptions {
/// finalized checkpoint.
#[arg(long, default_value_t = ethlambda_rpc::FallbackThresholds::DEFAULT.epochs_since_finalization, requires = "builder")]
pub(crate) builder_fallback_epochs_since_finalization: u64,

/// Comma-separated telemetry event families to export over OTLP Logs
/// (`pq` in `eth.telemetry/0.5`). Configured via standard `OTEL_*`
/// environment variables (`OTEL_EXPORTER_OTLP_LOGS_*`,
/// `OTEL_RESOURCE_ATTRIBUTES` with `eth.node.id`, `OTEL_SERVICE_NAME`).
#[arg(long, value_parser = ethlambda_telemetry::pq_events::event_families)]
pub(crate) telemetry_events: Option<String>,
}

/// `--builder`'s value, refused while the flags are parsed unless it is an
Expand Down
44 changes: 44 additions & 0 deletions bin/ethlambda/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,45 @@ async fn run_node(options: Options) -> eyre::Result<()> {
}
};

if let Some(ref families) = mainnet.telemetry_events {
ethlambda_telemetry::pq_events::event_families(families)
.map_err(|e| eyre::eyre!(e))?;
ethlambda_telemetry::pq_events::ExportSettings::from_env("ethlambda-bn")
.map_err(|e| eyre::eyre!(e))?;
let cfg = store.config();
if cfg.pq_fork_epoch != ethlambda_types::beacon::constants::FAR_FUTURE_EPOCH {
use ethlambda_crypto::stark::{
self,
leanvm::{LEANVM_REV, LeanVmConfig},
};
let cores = std::thread::available_parallelism().map_or(1, usize::from);
let effective_threads = if mainnet.pq_prover_threads == 0 {
cores
} else {
mainnet.pq_prover_threads.min(cores)
};
ethlambda_telemetry::pq_events::start(
ethlambda_telemetry::pq_events::StartParams {
role: "bn",
network: cfg.config_name.as_str(),
genesis_root: format!(
"0x{}",
hex::encode(params.wire.genesis_validators_root.0)
),
genesis_time: params.wire.genesis_time,
slot_duration: std::time::Duration::from_millis(cfg.slot_duration_ms),
client_commit: version::GIT_COMMIT,
prover_revision: Some(LEANVM_REV),
prover_backend: Some(stark::backend_name()),
log_inverse_rate: Some(u64::from(LeanVmConfig::default().log_inv_rate)),
effective_prover_threads: Some(effective_threads),
},
)
.map_err(|e| eyre::eyre!(e))?;
info!("Exporting eth.telemetry/0.5 PQ measurement events over OTLP Logs");
}
}

ChainSetup {
wire: WireConfig::Beacon(Box::new(params.wire)),
discovery: DiscoveryWireEntries {
Expand Down Expand Up @@ -1244,6 +1283,7 @@ async fn wait_for_shutdown(node: RunningNode) {
let _ = node.http.await;
// After the actors, which are the only emitters, have stopped.
ethlambda_telemetry::shutdown(TELEMETRY_FLUSH_TIMEOUT).await;
ethlambda_telemetry::pq_events::shutdown(TELEMETRY_FLUSH_TIMEOUT).await;

info!("Shutdown complete");
}
Expand Down Expand Up @@ -2211,6 +2251,9 @@ fn first_config_difference(
// row, `persisted` already holds the file's
// (`Store::fill_missing_config_keys`).
gas_limit_schedule: _,
// Compared below: PR-5879 requires never reusing a database under a
// different `X_COMMITTEE_COUNTS` rotation configuration.
x_committee_counts: _,
} = persisted;

compare!(preset_base);
Expand Down Expand Up @@ -2286,6 +2329,7 @@ fn first_config_difference(
churn_limit_quotient_gloas,
max_per_epoch_activation_churn_limit_gloas,
x_max_committee_count_per_slot,
x_committee_counts,
consolidation_churn_limit_quotient,
max_blobs_per_block_deneb,
max_blobs_per_block_electra,
Expand Down
12 changes: 10 additions & 2 deletions bin/ethlambda/src/network/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub(crate) enum NetworkDirError {
CommitteeCap {
path: PathBuf,
#[source]
source: ethlambda_types::beacon::config::CommitteeCapTooLarge,
source: ethlambda_types::beacon::config::PqCommitteeConfigError,
},
// `{fork:?}` rather than `{fork}`: `ForkName` exposes `as_str` and does not
// implement `Display`.
Expand Down Expand Up @@ -120,11 +120,19 @@ impl NetworkDir {
let fork = parsed.config.fork_at_epoch(0);
let genesis_state = BeaconState::from_ssz(fork, &genesis_bytes).map_err(|err| {
NetworkDirError::Genesis {
path: genesis_path,
path: genesis_path.clone(),
fork,
reason: format!("{err:?}"),
}
})?;
ethlambda_state_transition::beacon::helpers::pq::validate_pq_rotation_genesis(
&parsed.config,
&genesis_state,
)
.map_err(|source| NetworkDirError::CommitteeCap {
path: config_path.clone(),
source,
})?;

let bootnodes = read_bootnodes(base)?;

Expand Down
16 changes: 10 additions & 6 deletions bin/ethlambda/src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ pub(crate) mod dir;

use std::path::PathBuf;

use ethlambda_types::beacon::config::{
CommitteeCapTooLarge, Config, select_x_max_committee_count_per_slot,
};
use ethlambda_types::beacon::config::{Config, PqCommitteeConfigError, select_pq_committee_config};

use self::config_file::ConfigFile;
use ethlambda_types::beacon::preset::{Preset, PresetAlreadyActive};
Expand Down Expand Up @@ -125,12 +123,12 @@ pub(crate) fn select_preset(declared: &str) -> Result<Preset, PresetSelectError>
/// - A value above the preset's is refused, as the specification forbids it:
/// a client that ran it would name committees an attestation cannot, and
/// one that silently lowered it would shuffle another chain than its peers.
pub(crate) fn select_committee_cap(parsed: &mut ConfigFile) -> Result<(), CommitteeCapTooLarge> {
pub(crate) fn select_committee_cap(parsed: &mut ConfigFile) -> Result<(), PqCommitteeConfigError> {
if !parsed.committee_cap_declared {
parsed.config.x_max_committee_count_per_slot =
ethlambda_types::beacon::preset::max_committees_per_slot_pq() as u64;
}
select_x_max_committee_count_per_slot(&parsed.config)?;
select_pq_committee_config(&parsed.config)?;
Ok(())
}

Expand Down Expand Up @@ -500,7 +498,13 @@ mod tests {
let mut parsed = ConfigFile::parse(&yaml).unwrap();
assert!(parsed.committee_cap_declared);
let err = select_committee_cap(&mut parsed).unwrap_err();
assert_eq!((err.declared, err.max), (above, above - 1));
assert_eq!(
err,
PqCommitteeConfigError::CapTooLarge {
declared: above,
max: above - 1,
}
);
}

#[test]
Expand Down
Loading
Loading