@@ -15,8 +15,8 @@ use crate::{
1515} ;
1616use alto_types:: { Block , Finalized , Notarized } ;
1717use bytes:: Bytes ;
18- use commonware_codec:: { Decode , DecodeExt } ;
19- use commonware_consensus:: threshold_simplex:: types:: Finalization ;
18+ use commonware_codec:: { Decode , DecodeExt , Encode } ;
19+ use commonware_consensus:: threshold_simplex:: types:: { Finalization , Seedable , Viewable } ;
2020use commonware_cryptography:: { bls12381, ed25519:: PublicKey , sha256:: Digest , Digestible } ;
2121use commonware_macros:: select;
2222use commonware_p2p:: { utils:: requester, Receiver , Recipients , Sender } ;
@@ -341,9 +341,9 @@ impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R,
341341 . await
342342 . expect ( "Failed to get finalization" ) ;
343343 if let Some ( finalization) = finalization {
344- let finalization = Finalization :: deserialize ( None , & finalization)
344+ let finalization = Finalization :: decode ( finalization. as_ref ( ) )
345345 . expect ( "Failed to deserialize finalization" ) ;
346- * last_view_processed. lock ( ) . await = finalization. view ;
346+ * last_view_processed. lock ( ) . await = finalization. view ( ) ;
347347 }
348348 continue ;
349349 }
@@ -358,7 +358,7 @@ impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R,
358358 . await
359359 . expect ( "Failed to get finalized block" )
360360 . expect ( "Gapped block missing" ) ;
361- let gapped_block = Block :: deserialize ( & gapped_block)
361+ let gapped_block = Block :: decode ( gapped_block. as_ref ( ) )
362362 . expect ( "Failed to deserialize block" ) ;
363363
364364 // Attempt to repair one block from other sources
@@ -368,10 +368,10 @@ impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R,
368368 . await
369369 . expect ( "Failed to get verified block" ) ;
370370 if let Some ( verified) = verified {
371- let verified = Block :: deserialize ( & verified)
371+ let verified = Block :: decode ( verified. as_ref ( ) )
372372 . expect ( "Failed to deserialize block" ) ;
373373 blocks
374- . put ( verified. height , target_block, verified. serialize ( ) . into ( ) )
374+ . put ( verified. height , target_block, verified. encode ( ) . into ( ) )
375375 . await
376376 . expect ( "Failed to insert finalized block" ) ;
377377 debug ! ( height = verified. height, "repaired block from verified" ) ;
@@ -382,13 +382,13 @@ impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R,
382382 . await
383383 . expect ( "Failed to get notarized block" ) ;
384384 if let Some ( notarization) = notarization {
385- let notarization = Notarized :: deserialize ( None , & notarization)
385+ let notarization = Notarized :: decode ( notarization. as_ref ( ) )
386386 . expect ( "Failed to deserialize block" ) ;
387387 blocks
388388 . put (
389389 notarization. block . height ,
390390 target_block,
391- notarization. block . serialize ( ) . into ( ) ,
391+ notarization. block . encode ( ) . into ( ) ,
392392 )
393393 . await
394394 . expect ( "Failed to insert finalized block" ) ;
@@ -466,24 +466,23 @@ impl<R: Rng + Spawner + Metrics + Clock + GClock + Storage, I: Indexer> Actor<R,
466466 Message :: Broadcast { payload } => {
467467 broadcast_network
468468 . 0
469- . send( Recipients :: All , payload. serialize ( ) . into( ) , true )
469+ . send( Recipients :: All , payload. encode ( ) . into( ) , true )
470470 . await
471471 . expect( "Failed to broadcast" ) ;
472472 }
473473 Message :: Verified { view, payload } => {
474474 verified
475- . put( view, payload. digest( ) , payload. serialize ( ) . into( ) )
475+ . put( view, payload. digest( ) , payload. encode ( ) . into( ) )
476476 . await
477477 . expect( "Failed to insert verified block" ) ;
478478 }
479- Message :: Notarized { proof , seed } => {
479+ Message :: Notarization { notarization } => {
480480 // Upload seed to indexer (if available)
481481 if let Some ( indexer) = self . indexer. as_ref( ) {
482482 self . context. with_label( "indexer" ) . spawn( {
483483 let indexer = indexer. clone( ) ;
484- let view = proof . view ;
484+ let seed = notarization . seed ( ) ;
485485 move |_| async move {
486- let seed = seed. serialize( ) . into( ) ;
487486 let result = indexer. seed_upload( seed) . await ;
488487 if let Err ( e) = result {
489488 warn!( ?e, "failed to upload seed" ) ;
0 commit comments