Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit b5a156d

Browse files
committed
divide Certificate into Certificate and CertificateMessage
1 parent 24cc588 commit b5a156d

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

program/src/bls_message.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
use serde::{Deserialize, Serialize};
44

55
use {
6-
crate::{
7-
certificate::{CertificateMessage, CertificateType},
8-
vote::Vote,
9-
},
6+
crate::{certificate::Certificate, vote::Vote},
107
bitvec::prelude::*,
118
solana_bls::Signature as BLSSignature,
12-
solana_hash::Hash,
13-
solana_program::clock::Slot,
149
};
1510

1611
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
@@ -25,6 +20,18 @@ pub struct VoteMessage {
2520
pub rank: u16,
2621
}
2722

23+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
24+
#[derive(Clone, Debug, PartialEq)]
25+
/// BLS vote message, we need rank to look up pubkey
26+
pub struct CertificateMessage {
27+
/// The certificate
28+
pub certificate: Certificate,
29+
/// The signature
30+
pub signature: BLSSignature,
31+
/// The bitmap for validators, little endian byte order
32+
pub bitmap: BitVec<u8, Lsb0>,
33+
}
34+
2835
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
2936
#[derive(Clone, Debug, PartialEq)]
3037
#[allow(clippy::large_enum_variant)]
@@ -48,18 +55,12 @@ impl BLSMessage {
4855

4956
/// Create a new certificate message
5057
pub fn new_certificate(
51-
certificate_type: CertificateType,
52-
slot: Slot,
53-
block_id: Option<Hash>,
54-
replayed_bank_hash: Option<Hash>,
58+
certificate: Certificate,
5559
bitmap: BitVec<u8, Lsb0>,
5660
signature: BLSSignature,
5761
) -> Self {
5862
Self::Certificate(CertificateMessage {
59-
certificate_type,
60-
slot,
61-
block_id,
62-
replayed_bank_hash,
63+
certificate,
6364
signature,
6465
bitmap,
6566
})

program/src/certificate.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
#[cfg(feature = "serde")]
33
use serde::{Deserialize, Serialize};
44

5-
use {
6-
bitvec::prelude::*, solana_bls::Signature as BLSSignature, solana_hash::Hash,
7-
solana_program::clock::Slot,
8-
};
5+
use {solana_hash::Hash, solana_program::clock::Slot};
96

107
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
118
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -26,7 +23,7 @@ pub enum CertificateType {
2623
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
2724
#[derive(Clone, Debug, PartialEq)]
2825
/// Certificate Type in Alpenglow
29-
pub struct CertificateMessage {
26+
pub struct Certificate {
3027
/// Certificate type
3128
pub certificate_type: CertificateType,
3229
/// The slot of the block
@@ -35,8 +32,4 @@ pub struct CertificateMessage {
3532
pub block_id: Option<Hash>,
3633
/// The bank hash of the block
3734
pub replayed_bank_hash: Option<Hash>,
38-
/// The BLS signature
39-
pub signature: BLSSignature,
40-
/// The bitmap for validators, little endian byte order
41-
pub bitmap: BitVec<u8, Lsb0>,
4235
}

0 commit comments

Comments
 (0)