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
2 changes: 1 addition & 1 deletion 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
22 changes: 22 additions & 0 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions bin/ethlambda/src/cli.rs
Original file line number Diff line number Diff line change
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.4`). 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.4 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