fix: gossip config for devnet interop#139
Conversation
Updates the pinned leanSpec commit hash to pick up the latest spec changes.
leanSpec commit 0340cc1 changed XMSS Signature serialization from structured
JSON (path/rho/hashes sub-objects) to hex-encoded SSZ bytes ("0x..."). Replace
the old ProposerSignature struct and its SSZ reconstruction logic with a simple
hex deserializer (deser_xmss_hex), matching the existing deser_pubkey_hex pattern.
…lidation Port two validation rules from leanSpec 8b7636b: reject attestations where the head checkpoint is older than the target, and reject attestations where the head checkpoint slot doesn't match the actual block slot. Well-formed attestations already satisfy these, but without them we'd accept malformed ones.
At interval 3, the migration step (interval 4) hasn't run yet, so attestations that entered "known" directly (proposer's own attestation in block body, node's self-attestation) were invisible to the safe target calculation. Merge both pools to avoid undercounting support. No double-counting risk since extract_attestations_from_aggregated_payloads deduplicates by validator ID.
After aggregating committee signatures at interval 2, broadcast the resulting SignedAggregatedAttestation messages to the network. aggregate_committee_signatures and on_tick now return the new aggregates, and BlockChainServer::on_tick publishes them via P2PMessage::PublishAggregatedAttestation. The variant already existed but was never sent from the aggregation path.
🤖 Kimi Code ReviewReview SummaryThis PR introduces important fixes for attestation validation and aggregation logic, along with some configuration updates. Here are the key findings: Critical Issues
Security Considerations
Performance & Correctness
Code Quality
Minor Suggestions
The changes appear correct and address important consensus-layer validation issues. The PR is ready for merge. Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code ReviewReview summary: mostly solid changes, with a few correctness and security/perf concerns to address. Findings
Notable improvements
Tests/SSZ
If you want, I can dig into the attestation extraction path to confirm whether double-counting is currently possible (depends on how Automated review by OpenAI Codex · custom prompt |
Greptile SummaryThis PR fixes several gossip interop and attestation handling issues that were preventing justification and finalization in devnet-3.
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| crates/blockchain/src/store.rs | Core attestation pipeline fixes: merges known+new pools in update_safe_target, returns new aggregates from aggregate_committee_signatures for gossip broadcast, adds head >= target and head slot consistency validation checks. Logic is sound. |
| crates/blockchain/src/lib.rs | Wires up aggregated attestation broadcasting: on_tick return value is iterated and each aggregate is published to the P2P layer. Clean integration with existing P2PMessage enum. |
| crates/net/p2p/src/lib.rs | Removes validate_messages() (was silently dropping all gossip since no validation callback existed) and flood_publish(false), restoring default flood publishing. Network name changed from devnet3 to devnet0 for cross-client interop. |
| crates/blockchain/tests/signature_types.rs | Replaces ~130 lines of manual SSZ construction code with a simple hex deserializer for proposer signatures, matching the new leanSpec format. Clean simplification. |
| Makefile | Bumps leanSpec commit hash to 8b7636b for updated test fixtures. No logic changes. |
Sequence Diagram
sequenceDiagram
participant Timer as Tick Timer
participant BC as BlockChainServer
participant Store as Store (on_tick)
participant Agg as aggregate_committee_signatures
participant ST as update_safe_target
participant P2P as P2P Network
Timer->>BC: on_tick(timestamp_ms)
BC->>Store: on_tick(store, ts, has_proposal, is_aggregator)
Note over Store: Interval 0: accept attestations if proposer
Note over Store: Interval 1: vote propagation (no-op)
Store->>Agg: Interval 2: aggregate_committee_signatures(store)
Agg-->>Store: Vec<SignedAggregatedAttestation> (NEW)
Store->>ST: Interval 3: update_safe_target(store)
Note over ST: Merge known + new pools (NEW)
ST-->>Store: safe_target updated
Note over Store: Interval 4: accept new attestations
Store-->>BC: Vec<SignedAggregatedAttestation>
loop For each aggregate
BC->>P2P: PublishAggregatedAttestation(aggregate) (NEW)
end
Last reviewed commit: a10a4d4
Motivation
Devnet-3 runs with ethlambda and Zeam showed gossip messages not being delivered properly between clients, contributing to justification/finalization failures.
Description
validate_messages()from gossipsub config — was causing messages to be silently dropped.flood_publish(false)— was preventing reliable message propagation across clients.devnet3todevnet0— aligns with the network name used by other clients, ensuring gossipsub topic strings match (e.g.,/leanconsensus/devnet0/block/ssz_snappy).How to test
Full validation requires a multi-client devnet with Zeam nodes to verify gossip interop.