diff --git a/validator_client/src/attestation_producer/grpc.rs b/validator_client/src/attestation_producer/grpc.rs index 900a92f32..6249db3e1 100644 --- a/validator_client/src/attestation_producer/grpc.rs +++ b/validator_client/src/attestation_producer/grpc.rs @@ -1,7 +1,7 @@ use super::beacon_node_attestation::BeaconNodeAttestation; use crate::block_producer::{BeaconNodeError, PublishOutcome}; use protos::services_grpc::AttestationServiceClient; -use ssz::{ssz_encode, Decodable}; +use ssz::{Decodable, Encodable}; use protos::services::{ Attestation as GrpcAttestation, ProduceAttestationDataRequest, PublishAttestationRequest, @@ -22,8 +22,8 @@ impl BeaconNodeAttestation for AttestationServiceClient { .produce_attestation_data(&req) .map_err(|err| BeaconNodeError::RemoteFailure(format!("{:?}", err)))?; - let (attestation_data, _index) = - AttestationData::ssz_decode(reply.get_attestation_data().get_ssz(), 0) + let attestation_data = + AttestationData::from_ssz_bytes(reply.get_attestation_data().get_ssz()) .map_err(|_| BeaconNodeError::DecodeFailure)?; Ok(attestation_data) } @@ -34,7 +34,7 @@ impl BeaconNodeAttestation for AttestationServiceClient { ) -> Result { let mut req = PublishAttestationRequest::new(); - let ssz = ssz_encode(&attestation); + let ssz = attestation.as_ssz_bytes(); let mut grpc_attestation = GrpcAttestation::new(); grpc_attestation.set_ssz(ssz); diff --git a/validator_client/src/block_producer/grpc.rs b/validator_client/src/block_producer/grpc.rs index 1c4977bac..6ce7ae09d 100644 --- a/validator_client/src/block_producer/grpc.rs +++ b/validator_client/src/block_producer/grpc.rs @@ -3,7 +3,7 @@ use protos::services::{ BeaconBlock as GrpcBeaconBlock, ProduceBeaconBlockRequest, PublishBeaconBlockRequest, }; use protos::services_grpc::BeaconBlockServiceClient; -use ssz::{decode, ssz_encode}; +use ssz::{Decodable, Encodable}; use std::sync::Arc; use types::{BeaconBlock, Signature, Slot}; @@ -33,7 +33,7 @@ impl BeaconNodeBlock for BeaconBlockGrpcClient { // request a beacon block from the node let mut req = ProduceBeaconBlockRequest::new(); req.set_slot(slot.as_u64()); - req.set_randao_reveal(ssz_encode(randao_reveal)); + req.set_randao_reveal(randao_reveal.as_ssz_bytes()); //TODO: Determine if we want an explicit timeout let reply = self @@ -46,7 +46,8 @@ impl BeaconNodeBlock for BeaconBlockGrpcClient { let block = reply.get_block(); let ssz = block.get_ssz(); - let block = decode::(&ssz).map_err(|_| BeaconNodeError::DecodeFailure)?; + let block = + BeaconBlock::from_ssz_bytes(&ssz).map_err(|_| BeaconNodeError::DecodeFailure)?; Ok(Some(block)) } else { @@ -61,7 +62,7 @@ impl BeaconNodeBlock for BeaconBlockGrpcClient { fn publish_beacon_block(&self, block: BeaconBlock) -> Result { let mut req = PublishBeaconBlockRequest::new(); - let ssz = ssz_encode(&block); + let ssz = block.as_ssz_bytes(); let mut grpc_block = GrpcBeaconBlock::new(); grpc_block.set_ssz(ssz);