@@ -33,12 +33,13 @@ use ssv_types::{
3333 Cluster , CommitteeId , ValidatorIndex , ValidatorMetadata ,
3434 consensus:: {
3535 BEACON_ROLE_AGGREGATOR , BEACON_ROLE_PROPOSER , BEACON_ROLE_SYNC_COMMITTEE_CONTRIBUTION ,
36- BeaconVote , Contribution , QbftData , ValidatorConsensusData , ValidatorDuty ,
36+ BeaconVote , Contribution , ContributionWrapper , Contributions , QbftData ,
37+ ValidatorConsensusData , ValidatorDuty ,
3738 } ,
3839 msgid:: Role ,
3940 partial_sig:: PartialSignatureKind ,
4041} ;
41- use ssz:: { Decode , Encode } ;
42+ use ssz:: { Decode , DecodeError , Encode } ;
4243use task_executor:: TaskExecutor ;
4344use tokio:: {
4445 select,
@@ -51,7 +52,7 @@ use types::{
5152 AggregateAndProofElectra , BeaconBlockRef , BlindedBeaconBlock , BlindedPayload , ChainSpec ,
5253 ContributionAndProof , Domain , EthSpec , ForkName , FullPayload , Hash256 , PublicKeyBytes ,
5354 SecretKey , Signature , SignedBeaconBlock , SignedBlindedBeaconBlock , SignedRoot ,
54- SignedVoluntaryExit , SyncAggregatorSelectionData , VariableList , VoluntaryExit ,
55+ SignedVoluntaryExit , SyncAggregatorSelectionData , VoluntaryExit ,
5556 attestation:: Attestation ,
5657 beacon_block:: BeaconBlock ,
5758 graffiti:: Graffiti ,
@@ -64,7 +65,6 @@ use types::{
6465 sync_committee_message:: SyncCommitteeMessage ,
6566 sync_selection_proof:: SyncSelectionProof ,
6667 sync_subnet_id:: SyncSubnetId ,
67- typenum:: U13 ,
6868 validator_registration_data:: { SignedValidatorRegistrationData , ValidatorRegistrationData } ,
6969} ;
7070use validator_metrics:: IntCounterVec ;
@@ -471,14 +471,7 @@ impl<T: SlotClock, E: EthSpec> AnchorValidatorStore<T, E> {
471471 FullBlockContents :: from_ssz_bytes_for_fork ( & completed_data. data_ssz , fork)
472472 . map ( UnsignedBlock :: Full )
473473 } )
474- . map_err ( |err| {
475- error ! (
476- %fork,
477- ?err,
478- "Failed to deserialize decided block"
479- ) ;
480- Error :: SpecificError ( SpecificError :: InvalidQbftData )
481- } )
474+ . map_err ( |err| Error :: SpecificError ( SpecificError :: InvalidQbftData ( err) ) )
482475 }
483476
484477 async fn sign_abstract_block (
@@ -737,7 +730,7 @@ pub enum SpecificError {
737730 ArithError ( ArithError ) ,
738731 QbftError ( QbftError ) ,
739732 Timeout ,
740- InvalidQbftData ,
733+ InvalidQbftData ( DecodeError ) ,
741734 TooManySyncSubnetsToSign ,
742735 NoDataAgreed ,
743736 Metadata ,
@@ -1131,12 +1124,12 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
11311124 let message = if ForkName :: from ( data. version ) < ForkName :: Electra {
11321125 AggregateAndProof :: Base (
11331126 AggregateAndProofBase :: from_ssz_bytes ( & data. data_ssz )
1134- . map_err ( |_ | Error :: SpecificError ( SpecificError :: InvalidQbftData ) ) ?,
1127+ . map_err ( |e | Error :: SpecificError ( SpecificError :: InvalidQbftData ( e ) ) ) ?,
11351128 )
11361129 } else {
11371130 AggregateAndProof :: Electra (
11381131 AggregateAndProofElectra :: from_ssz_bytes ( & data. data_ssz )
1139- . map_err ( |_ | Error :: SpecificError ( SpecificError :: InvalidQbftData ) ) ?,
1132+ . map_err ( |e | Error :: SpecificError ( SpecificError :: InvalidQbftData ( e ) ) ) ?,
11401133 )
11411134 } ;
11421135
@@ -1362,18 +1355,19 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
13621355 }
13631356 } ;
13641357
1365- let data: VariableList < _ , U13 > = match VariableList :: new (
1358+ let data = Contributions :: new (
13661359 signing_data
13671360 . iter ( )
1368- . map ( |signing_data| Contribution {
1369- selection_proof_sig : signing_data. selection_proof . clone ( ) . into ( ) ,
1370- contribution : signing_data. contribution . clone ( ) ,
1361+ . map ( |signing_data| {
1362+ // Wrap contribution to match Go-SSV's encoding
1363+ ContributionWrapper :: from ( Contribution {
1364+ selection_proof_sig : signing_data. selection_proof . clone ( ) . into ( ) ,
1365+ contribution : signing_data. contribution . clone ( ) ,
1366+ } )
13711367 } )
13721368 . collect ( ) ,
1373- ) {
1374- Ok ( data) => data,
1375- Err ( _) => return Err ( SpecificError :: TooManySyncSubnetsToSign . into ( ) ) ,
1376- } ;
1369+ )
1370+ . map_err ( |_| SpecificError :: TooManySyncSubnetsToSign ) ?;
13771371
13781372 let timer = metrics:: start_timer_vec (
13791373 & metrics:: CONSENSUS_TIMES ,
@@ -1406,7 +1400,7 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
14061400 validator_committee_index : aggregator_index,
14071401 validator_sync_committee_indices : Default :: default ( ) ,
14081402 } ,
1409- version : ForkName :: Base . into ( ) ,
1403+ version : ForkName :: Altair . into ( ) ,
14101404 data_ssz : data. as_ssz_bytes ( ) ,
14111405 } ,
14121406 start_time,
@@ -1421,11 +1415,12 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
14211415 Err ( err) => return Err ( SpecificError :: QbftError ( err) . into ( ) ) ,
14221416 } ;
14231417
1424- let data = VariableList :: < Contribution < E > , U13 > :: from_ssz_bytes ( & data. data_ssz )
1425- . map_err ( |_ | Error :: from ( SpecificError :: InvalidQbftData ) ) ?;
1418+ let data = Contributions :: < E > :: from_ssz_bytes ( & data. data_ssz )
1419+ . map_err ( |e | Error :: from ( SpecificError :: InvalidQbftData ( e ) ) ) ?;
14261420
14271421 let data = data
14281422 . into_iter ( )
1423+ . map ( Contribution :: from)
14291424 . find ( |data| data. contribution . subcommittee_index == subcommittee_index)
14301425 . ok_or ( SpecificError :: NoDataAgreed ) ?;
14311426
@@ -1446,7 +1441,7 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
14461441 let signing_root = message. signing_root ( domain_hash) ;
14471442 self . collect_signature (
14481443 PartialSignatureKind :: PostConsensus ,
1449- Role :: Aggregator ,
1444+ Role :: SyncCommittee ,
14501445 None ,
14511446 validator,
14521447 signing_root,
0 commit comments