Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zjma committed Feb 28, 2024
1 parent ac14b75 commit 02cc8a8
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions consensus/src/rand/rand_gen/reliable_broadcast_state.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

use crate::{
logging::{LogEvent, LogSchema},
rand::rand_gen::{
network_messages::RandMessage,
rand_store::RandStore,
types::{
AugData, AugDataSignature, CertifiedAugData, CertifiedAugDataAck, RandConfig,
RandShare, RequestShare, TAugmentedData, TShare,
},
use crate::rand::rand_gen::{
network_messages::RandMessage,
rand_store::RandStore,
types::{
AugData, AugDataSignature, CertifiedAugData, CertifiedAugDataAck, RandConfig, RandShare,
RequestShare, TAugmentedData, TShare,
},
};
use anyhow::ensure;
use aptos_consensus_types::common::Author;
use aptos_infallible::Mutex;
use aptos_logger::{debug, info};
use aptos_reliable_broadcast::BroadcastStatus;
use aptos_types::{
aggregate_signature::PartialSignatures, epoch_state::EpochState, randomness::RandMetadata,
Expand Down Expand Up @@ -46,12 +42,7 @@ impl<S: TShare, D: TAugmentedData> BroadcastStatus<RandMessage<S, D>, RandMessag
type Response = AugDataSignature;

fn add(&self, peer: Author, ack: Self::Response) -> anyhow::Result<Option<Self::Aggregated>> {
debug!(
"[RandManager] AugDataCertBuilder::add: BEGIN: peer={}",
peer
);
ack.verify(peer, &self.epoch_state.verifier, &self.aug_data)?;
debug!("[RandManager] AugDataCertBuilder::add: ack verified");
let mut parital_signatures_guard = self.partial_signatures.lock();
parital_signatures_guard.add_signature(peer, ack.into_signature());
let qc_aug_data = self
Expand All @@ -67,10 +58,6 @@ impl<S: TShare, D: TAugmentedData> BroadcastStatus<RandMessage<S, D>, RandMessag
.expect("Signature aggregation should succeed");
CertifiedAugData::new(self.aug_data.clone(), aggregated_signature)
});
debug!(
"[RandManager] AugDataCertBuilder::add: END: qc_aug_data.is_some()={}",
qc_aug_data.is_some()
);
Ok(qc_aug_data)
}
}
Expand Down Expand Up @@ -146,11 +133,6 @@ impl<S: TShare, D: TAugmentedData> BroadcastStatus<RandMessage<S, D>, RandMessag
share.metadata()
);
share.verify(&self.rand_config)?;
info!(LogSchema::new(LogEvent::ReceiveReactiveRandShare)
.author(self.rand_config.author)
.epoch(share.epoch())
.round(share.metadata().round())
.remote_peer(*share.author()));
let mut store = self.rand_store.lock();
let aggregated = if store.add_share(share)? {
Some(())
Expand Down

0 comments on commit 02cc8a8

Please sign in to comment.