@@ -128,18 +128,23 @@ func NewMsgBlockTxsOffer(point pcommon.Point) *MsgBlockTxsOffer {
128128//
129129// - Votes holds vote IDs ([slot, voter_id], 2 elements) when the peer offers
130130// IDs to be fetched (dingo's offer-and-fetch design).
131- // - FullVotes holds complete votes ([slot, eb_hash, voter_id, signature], 4
132- // elements) when the peer pushes votes directly (the prototype dialect).
131+ // - FullVotes holds legacy complete votes
132+ // ([slot, eb_hash, voter_id, signature], 4 elements).
133+ // - PrototypeVotes holds current prototype votes
134+ // ([announcing_rb_hash, voter_id, signature], 3 elements).
133135//
134- // After decoding, exactly one of Votes / FullVotes is populated depending on
135- // the known per-vote CBOR array length. Encoding prefers FullVotes when
136- // present.
136+ // After decoding, exactly one of Votes, FullVotes, or PrototypeVotes is
137+ // populated depending on the known per-vote CBOR array length. Encoding
138+ // prefers PrototypeVotes, then FullVotes, when present.
137139type MsgVotesOffer struct {
138140 protocol.MessageBase
139- Votes []MsgVotesOfferVote
140- FullVotes []lcommon.LeiosVote
141+ Votes []MsgVotesOfferVote
142+ FullVotes []lcommon.LeiosVote
143+ PrototypeVotes []lcommon.LeiosPrototypeVote
141144}
142145
146+ type PrototypeVote = lcommon.LeiosPrototypeVote
147+
143148type MsgVotesOfferVote = lcommon.LeiosVoteId
144149
145150func NewMsgVotesOffer (votes []MsgVotesOfferVote ) * MsgVotesOffer {
@@ -164,10 +169,21 @@ func NewMsgVotesOfferFull(votes []lcommon.LeiosVote) *MsgVotesOffer {
164169 return m
165170}
166171
172+ // NewMsgVotesOfferPrototype builds a current-prototype pushed vote offer.
173+ func NewMsgVotesOfferPrototype (votes []PrototypeVote ) * MsgVotesOffer {
174+ return & MsgVotesOffer {
175+ MessageBase : protocol.MessageBase {MessageType : MessageTypeVotesOffer },
176+ PrototypeVotes : votes ,
177+ }
178+ }
179+
167180func (m * MsgVotesOffer ) MarshalCBOR () ([]byte , error ) {
168181 if raw := m .Cbor (); len (raw ) > 0 {
169182 return raw , nil
170183 }
184+ if len (m .PrototypeVotes ) > 0 {
185+ return cbor .Encode ([]any {m .MessageType , m .PrototypeVotes })
186+ }
171187 if len (m .FullVotes ) > 0 {
172188 return cbor .Encode ([]any {m .MessageType , m .FullVotes })
173189 }
@@ -189,6 +205,7 @@ func (m *MsgVotesOffer) UnmarshalCBOR(data []byte) error {
189205 m .MessageType = envelope .MessageType
190206 m .Votes = nil
191207 m .FullVotes = nil
208+ m .PrototypeVotes = nil
192209 for idx , voteRaw := range envelope .Votes {
193210 // Peek at the element count to distinguish a vote ID
194211 // ([slot, voter_id]) from a full vote
@@ -226,23 +243,19 @@ func (m *MsgVotesOffer) UnmarshalCBOR(data []byte) error {
226243 }
227244 m .FullVotes = append (m .FullVotes , vote )
228245 case 3 :
229- // prototype-2026w27 (the deployed musashi relay) diffuses a vote as
230- // a 3-element array [endorser_block_hash (hash32), voter_id (uint),
231- // signature (bytes .size 48)] — the 4-element full vote with the
232- // leading slot field dropped. Verified against live captures from
233- // leios-node.play.dev.cardano.org:3001 (network magic 164). Decode
234- // the three fields; SlotNo is left zero because the wire omits it.
235- var ebHash []byte
236- if _ , err := cbor .Decode (elems [0 ], & ebHash ); err != nil {
246+ // The current prototype signs and diffuses the announcing ranking
247+ // block hash, not the endorser-block point.
248+ var rbHash []byte
249+ if _ , err := cbor .Decode (elems [0 ], & rbHash ); err != nil {
237250 return fmt .Errorf (
238- "%s: votes offer: decode vote %d endorser block hash: %w" ,
251+ "%s: votes offer: decode vote %d announcing RB hash: %w" ,
239252 ProtocolName , idx , err ,
240253 )
241254 }
242- if len (ebHash ) != lcommon .Blake2b256Size {
255+ if len (rbHash ) != lcommon .Blake2b256Size {
243256 return fmt .Errorf (
244- "%s: votes offer: vote %d endorser block hash is %d bytes, expected %d" ,
245- ProtocolName , idx , len (ebHash ), lcommon .Blake2b256Size ,
257+ "%s: votes offer: vote %d announcing RB hash is %d bytes, expected %d" ,
258+ ProtocolName , idx , len (rbHash ), lcommon .Blake2b256Size ,
246259 )
247260 }
248261 var voterId uint64
@@ -265,10 +278,10 @@ func (m *MsgVotesOffer) UnmarshalCBOR(data []byte) error {
265278 ProtocolName , idx , len (sig ), lcommon .LeiosBlsSignatureSize ,
266279 )
267280 }
268- m .FullVotes = append (m .FullVotes , lcommon. LeiosVote {
269- EndorserBlockHash : lcommon .NewBlake2b256 (ebHash ),
270- VoterId : voterId ,
271- VoteSignature : sig ,
281+ m .PrototypeVotes = append (m .PrototypeVotes , PrototypeVote {
282+ AnnouncingRbHash : lcommon .NewBlake2b256 (rbHash ),
283+ VoterId : voterId ,
284+ VoteSignature : sig ,
272285 })
273286 default :
274287 return fmt .Errorf (
0 commit comments