Rename SignedAttestation.message to .data to align with leanSpec#183
Rename SignedAttestation.message to .data to align with leanSpec#183MegaRedHand merged 1 commit intomainfrom
Conversation
The leanSpec changed SignedAttestation to inherit from Attestation, which uses instead of for the AttestationData field. SSZ wire format is unchanged (same types in same field order).
🤖 Kimi Code ReviewReview SummaryThis PR renames the Issues Found
Security Considerations
Performance Impact
Code Quality
Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code Review
No correctness, security, fork-choice, attestation-validation, state-transition, XMSS, or SSZ-layout issues were evident in this diff itself. The SSZ field order appears unchanged, so wire encoding should remain stable. Residual risk/testing gap:
Automated review by OpenAI Codex · custom prompt |
🤖 Claude Code ReviewThe diff is clean and complete. Here's my review: Code Review: PR #183 — Rename
|
Greptile SummaryThis PR is a pure, mechanical field rename —
No logic, behaviour, or wire-format changes are introduced. The rename is complete and consistent across the workspace. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| crates/common/types/src/attestation.rs | Field renamed from message: AttestationData to data: AttestationData in SignedAttestation; doc-comment updated to match. No behavioral change. |
| crates/blockchain/src/lib.rs | Single struct construction site updated from message: to data: when building a SignedAttestation. Trivially correct. |
| crates/blockchain/src/store.rs | One field access updated from signed_attestation.message to signed_attestation.data; the existing variable data on the Attestation struct is retained, so logic is unchanged. |
| crates/net/p2p/src/gossipsub/handler.rs | Ten .message. → .data. access sites updated across handle_gossipsub_message and publish_attestation; all are logging/tracing expressions with no side effects on logic. |
Sequence Diagram
sequenceDiagram
participant V as Validator (lib.rs)
participant G as Gossipsub Handler (handler.rs)
participant S as Store (store.rs)
V->>V: Build SignedAttestation { validator_id, data, signature }
V->>G: P2PMessage::PublishAttestation(signed_attestation)
G->>G: Read attestation.data.slot / .target / .source (logging)
G->>G: Encode to SSZ & publish to attestation subnet topic
Note over G,S: Peer receives gossip
G->>G: Decode SignedAttestation from SSZ
G->>G: Read signed_attestation.data.slot / .head / .target / .source (logging)
G->>S: notify_new_attestation(signed_attestation)
S->>S: signed_attestation.data → Attestation { validator_id, data }
S->>S: validate_attestation_data(&attestation.data)
Last reviewed commit: d182326
## Motivation The [leanSpec](https://github.com/leanEthereum/leanSpec) reference implementation renamed the XMSS signing/verification parameter from `epoch` to `slot` ([commit `3b9d054`](leanEthereum/leanSpec@3b9d054), part of [PR #412](leanEthereum/leanSpec#412)). In ethlambda, the actual value passed to this parameter is always a **slot number** (e.g., `attestation.data.slot as u32`), so the `epoch` naming was misleading — in Ethereum consensus, an "epoch" typically means 32 slots, but leanConsensus has no epoch concept at all. The XMSS scheme uses this parameter as a one-time signature index to prevent key reuse, and leanConsensus uses the slot number for this purpose. This is part of the post-devnet-3 alignment work tracked in #155 (pq-devnet-4 preparation). ## Description Pure parameter rename: `epoch` → `slot` across production code, documentation, and tests. **No behavioral or wire-format change** — the `leansig` crate uses positional arguments, so the external dependency is unaffected. ### Changes by file | File | Scope | Changes | |------|-------|---------| | `crates/common/types/src/signature.rs` | `is_valid()`, `sign()` | Parameter + doc rename | | `crates/common/crypto/src/lib.rs` | `aggregate_signatures()`, `verify_aggregated_signature()` | Parameter + doc rename | | `crates/common/crypto/src/lib.rs` | Unit tests + cross-client ream tests | Variable, constant (`REAM_EPOCH` → `REAM_SLOT`), test name, comment, and assert message renames | | `crates/blockchain/src/key_manager.rs` | `sign_attestation()`, `sign_message()` | Parameter + doc + local variable rename | | `crates/blockchain/src/store.rs` | `verify_signature()`, `verify_aggregated_attestation()`, block verification | Local variable rename at 4 call sites | ### What was NOT renamed - **`activation_epoch`** variables in test helpers — these are parameters to `generate_keypair_and_sign()` for leansig keypair setup, not part of our signing/verification API. - **`leansig` internals** — the external crate's parameter names are unchanged; we only pass our renamed variable positionally. ## How to test ```bash cargo check --workspace # Compiles clean cargo clippy --workspace -- -D warnings # No warnings cargo test --workspace --release # All 92 tests pass (5 pre-existing ignores) ``` ## Related issues - Part of #155 (pq-devnet-4 preparation, section 1.2) - Companion PR: #183 (rename `SignedAttestation.message` → `.data`) - leanSpec reference: [commit `3b9d054`](leanEthereum/leanSpec@3b9d054) --------- Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
Motivation
The leanSpec reference implementation changed
SignedAttestationto inherit fromAttestation, which usesdatainstead ofmessagefor theAttestationDatafield (commit3b9d054). This is part of the post-devnet-3 alignment work tracked in #155.Description
Pure field rename:
SignedAttestation.message→SignedAttestation.dataacross 4 files, 13 call sites.No behavioral or wire-format change. SSZ encodes by field position, not field name, so the serialization is identical before and after this PR.
Changes by file
crates/common/types/src/attestation.rsmessage→datacrates/blockchain/src/lib.rsmessage:→data:crates/blockchain/src/store.rssigned_attestation.message→.datacrates/net/p2p/src/gossipsub/handler.rs.message.accesses →.data.(10 occurrences)Why
datainstead ofmessage?In the leanSpec,
SignedAttestationnow inherits fromAttestation:Rust doesn't have inheritance, so we keep the flat struct but align the field name.
How to test
Related issues
pq-devnet-4#155 (pq-devnet-4 preparation)