From d18232649f99431d771d1d49b5e7b44a97067cef Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Thu, 5 Mar 2026 17:25:58 -0300 Subject: [PATCH] Rename SignedAttestation.message to .data to align with leanSpec 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). --- crates/blockchain/src/lib.rs | 2 +- crates/blockchain/src/store.rs | 2 +- crates/common/types/src/attestation.rs | 4 ++-- crates/net/p2p/src/gossipsub/handler.rs | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/blockchain/src/lib.rs b/crates/blockchain/src/lib.rs index 16ec92d2..50dd6f4e 100644 --- a/crates/blockchain/src/lib.rs +++ b/crates/blockchain/src/lib.rs @@ -223,7 +223,7 @@ impl BlockChainServer { // Create signed attestation let signed_attestation = SignedAttestation { validator_id, - message: attestation_data.clone(), + data: attestation_data.clone(), signature, }; diff --git a/crates/blockchain/src/store.rs b/crates/blockchain/src/store.rs index 63d62ef3..b52ad505 100644 --- a/crates/blockchain/src/store.rs +++ b/crates/blockchain/src/store.rs @@ -353,7 +353,7 @@ pub fn on_gossip_attestation( let validator_id = signed_attestation.validator_id; let attestation = Attestation { validator_id, - data: signed_attestation.message, + data: signed_attestation.data, }; validate_attestation_data(store, &attestation.data) .inspect_err(|_| metrics::inc_attestations_invalid("gossip"))?; diff --git a/crates/common/types/src/attestation.rs b/crates/common/types/src/attestation.rs index bd668266..e33db5cc 100644 --- a/crates/common/types/src/attestation.rs +++ b/crates/common/types/src/attestation.rs @@ -37,8 +37,8 @@ pub struct AttestationData { pub struct SignedAttestation { /// The index of the validator making the attestation. pub validator_id: u64, - /// The attestation message signed by the validator. - pub message: AttestationData, + /// The attestation data signed by the validator. + pub data: AttestationData, /// Signature aggregation produced by the leanVM (SNARKs in the future). pub signature: XmssSignature, } diff --git a/crates/net/p2p/src/gossipsub/handler.rs b/crates/net/p2p/src/gossipsub/handler.rs index a52b65f2..eab0c6ed 100644 --- a/crates/net/p2p/src/gossipsub/handler.rs +++ b/crates/net/p2p/src/gossipsub/handler.rs @@ -89,16 +89,16 @@ pub async fn handle_gossipsub_message(server: &mut P2PServer, event: Event) { else { return; }; - let slot = signed_attestation.message.slot; + let slot = signed_attestation.data.slot; let validator = signed_attestation.validator_id; info!( %slot, validator, - head_root = %ShortRoot(&signed_attestation.message.head.root.0), - target_slot = signed_attestation.message.target.slot, - target_root = %ShortRoot(&signed_attestation.message.target.root.0), - source_slot = signed_attestation.message.source.slot, - source_root = %ShortRoot(&signed_attestation.message.source.root.0), + head_root = %ShortRoot(&signed_attestation.data.head.root.0), + target_slot = signed_attestation.data.target.slot, + target_root = %ShortRoot(&signed_attestation.data.target.root.0), + source_slot = signed_attestation.data.source.slot, + source_root = %ShortRoot(&signed_attestation.data.source.root.0), "Received attestation from gossip" ); server @@ -113,7 +113,7 @@ pub async fn handle_gossipsub_message(server: &mut P2PServer, event: Event) { } pub async fn publish_attestation(server: &mut P2PServer, attestation: SignedAttestation) { - let slot = attestation.message.slot; + let slot = attestation.data.slot; let validator = attestation.validator_id; // Encode to SSZ @@ -131,10 +131,10 @@ pub async fn publish_attestation(server: &mut P2PServer, attestation: SignedAtte .inspect(|_| info!( %slot, validator, - target_slot = attestation.message.target.slot, - target_root = %ShortRoot(&attestation.message.target.root.0), - source_slot = attestation.message.source.slot, - source_root = %ShortRoot(&attestation.message.source.root.0), + target_slot = attestation.data.target.slot, + target_root = %ShortRoot(&attestation.data.target.root.0), + source_slot = attestation.data.source.slot, + source_root = %ShortRoot(&attestation.data.source.root.0), "Published attestation to gossipsub" )) .inspect_err(|err| {