use protos::services_grpc::AttestationServiceClient; use std::sync::Arc; use attester::{BeaconNode, BeaconNodeError, PublishOutcome}; use protos::services::ProduceAttestationDataRequest; use types::{AttestationData, FreeAttestation, Slot}; pub struct AttestationGrpcClient { client: Arc, } impl AttestationGrpcClient { pub fn new(client: Arc) -> Self { Self { client } } } impl BeaconNode for AttestationGrpcClient { fn produce_attestation_data( &self, slot: Slot, shard: u64, ) -> Result, BeaconNodeError> { let mut req = ProduceAttestationDataRequest::new(); req.set_slot(slot.as_u64()); req.set_shard(shard); let reply = self .client .produce_attestation_data(&req) .map_err(|err| BeaconNodeError::RemoteFailure(format!("{:?}", err)))?; // TODO: return correct AttestationData Err(BeaconNodeError::DecodeFailure) } fn publish_attestation_data( &self, free_attestation: FreeAttestation, ) -> Result { // TODO: return correct PublishOutcome Err(BeaconNodeError::DecodeFailure) } }