@@ -260,6 +260,18 @@ impl VotingService {
260260 staked_validators_cache,
261261 ) ;
262262 }
263+ BLSOp :: PushCertificate { certificate } => {
264+ let vote_slot = certificate. certificate . slot ;
265+ let bls_message = BLSMessage :: Certificate ( ( * certificate) . clone ( ) ) ;
266+ Self :: broadcast_alpenglow_message (
267+ vote_slot,
268+ cluster_info,
269+ & bls_message,
270+ connection_cache,
271+ additional_listeners,
272+ staked_validators_cache,
273+ ) ;
274+ }
263275 }
264276 }
265277
@@ -308,9 +320,11 @@ mod tests {
308320 super :: * ,
309321 crate :: consensus:: tower_storage:: NullTowerStorage ,
310322 alpenglow_vote:: {
311- bls_message:: { BLSMessage , VoteMessage } ,
323+ bls_message:: { BLSMessage , CertificateMessage , VoteMessage } ,
324+ certificate:: { Certificate , CertificateType } ,
312325 vote:: Vote ,
313326 } ,
327+ bitvec:: prelude:: * ,
314328 solana_bls_signatures:: Signature as BLSSignature ,
315329 solana_gossip:: { cluster_info:: ClusterInfo , contact_info:: ContactInfo } ,
316330 solana_ledger:: {
@@ -326,10 +340,7 @@ mod tests {
326340 ValidatorVoteKeypairs ,
327341 } ,
328342 } ,
329- solana_sdk:: {
330- hash:: Hash ,
331- signer:: { keypair:: Keypair , Signer } ,
332- } ,
343+ solana_sdk:: signer:: { keypair:: Keypair , Signer } ,
333344 solana_streamer:: {
334345 packet:: { Packet , PacketBatch } ,
335346 recvmmsg:: recv_mmsg,
@@ -342,6 +353,7 @@ mod tests {
342353 net:: SocketAddr ,
343354 sync:: { atomic:: AtomicBool , Arc , RwLock } ,
344355 } ,
356+ test_case:: test_case,
345357 } ;
346358
347359 fn create_voting_service (
@@ -397,9 +409,41 @@ mod tests {
397409 )
398410 }
399411
400- #[ allow( clippy:: disallowed_methods) ]
401- #[ test]
402- fn test_send_bls_message ( ) {
412+ #[ test_case( BLSOp :: PushVote {
413+ bls_message: Arc :: new( BLSMessage :: Vote ( VoteMessage {
414+ vote: Vote :: new_skip_vote( 5 ) ,
415+ signature: BLSSignature :: default ( ) ,
416+ rank: 1 ,
417+ } ) ) ,
418+ slot: 5 ,
419+ saved_vote_history: SavedVoteHistoryVersions :: Current ( SavedVoteHistory :: default ( ) ) ,
420+ } , BLSMessage :: Vote ( VoteMessage {
421+ vote: Vote :: new_skip_vote( 5 ) ,
422+ signature: BLSSignature :: default ( ) ,
423+ rank: 1 ,
424+ } ) ) ]
425+ #[ test_case( BLSOp :: PushCertificate {
426+ certificate: Arc :: new( CertificateMessage {
427+ certificate: Certificate {
428+ certificate_type: CertificateType :: Skip ,
429+ slot: 5 ,
430+ block_id: None ,
431+ replayed_bank_hash: None ,
432+ } ,
433+ signature: BLSSignature :: default ( ) ,
434+ bitmap: BitVec :: new( ) ,
435+ } ) ,
436+ } , BLSMessage :: Certificate ( CertificateMessage {
437+ certificate: Certificate {
438+ certificate_type: CertificateType :: Skip ,
439+ slot: 5 ,
440+ block_id: None ,
441+ replayed_bank_hash: None ,
442+ } ,
443+ signature: BLSSignature :: default ( ) ,
444+ bitmap: BitVec :: new( ) ,
445+ } ) ) ]
446+ fn test_send_bls_message ( bls_op : BLSOp , expected_bls_message : BLSMessage ) {
403447 solana_logger:: setup ( ) ;
404448 let ( _vote_sender, vote_receiver) = crossbeam_channel:: unbounded ( ) ;
405449 let ( bls_sender, bls_receiver) = crossbeam_channel:: unbounded ( ) ;
@@ -413,19 +457,7 @@ mod tests {
413457 let _ = create_voting_service ( vote_receiver, bls_receiver, listener_addr) ;
414458
415459 // Send a BLS message via the VotingService
416- let bls_message = BLSMessage :: Vote ( VoteMessage {
417- vote : Vote :: new_notarization_vote ( 5 , Hash :: new_unique ( ) , Hash :: new_unique ( ) ) ,
418- signature : BLSSignature :: default ( ) ,
419- rank : 1 ,
420- } ) ;
421- let saved_vote_history = SavedVoteHistoryVersions :: Current ( SavedVoteHistory :: default ( ) ) ;
422- assert ! ( bls_sender
423- . send( BLSOp :: PushVote {
424- bls_message: bls_message. clone( ) ,
425- slot: 5 ,
426- saved_vote_history,
427- } )
428- . is_ok( ) ) ;
460+ assert ! ( bls_sender. send( bls_op) . is_ok( ) ) ;
429461
430462 // Wait for the listener to receive the message
431463 let mut packet_batch = PacketBatch :: new ( vec ! [ Packet :: default ( ) ] ) ;
@@ -443,6 +475,6 @@ mod tests {
443475 err
444476 )
445477 } ) ;
446- assert_eq ! ( received_bls_message, bls_message ) ;
478+ assert_eq ! ( received_bls_message, expected_bls_message ) ;
447479 }
448480}
0 commit comments