Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aptos-core/consensus/consensus-types/src/proof_of_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ pub enum SignedBatchInfoError {
NotFound,
AlreadyCommitted,
NoTimeStamps,
UnableToAggregate,
}

#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
Expand Down
18 changes: 13 additions & 5 deletions aptos-core/consensus/src/quorum_store/proof_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,25 @@ impl IncrementalProofState {
}
}

fn take(&mut self, validator_verifier: &ValidatorVerifier) -> ProofOfStore {
fn take(
&mut self,
validator_verifier: &ValidatorVerifier,
) -> Result<ProofOfStore, SignedBatchInfoError> {
if self.completed {
panic!("Cannot call take twice, unexpected issue occurred");
}
self.completed = true;

match validator_verifier.aggregate_signatures(
PartialSignatures::new(self.aggregated_signature.clone()).signatures_iter(),
) {
Ok(sig) => ProofOfStore::new(self.info.clone(), sig),
Err(e) => unreachable!("Cannot aggregate signatures on digest err = {:?}", e),
Ok(sig) => {
self.completed = true;
Ok(ProofOfStore::new(self.info.clone(), sig))
}
Err(e) => {
error!("Cannot aggregate signatures on digest err = {:?}", e);
Err(SignedBatchInfoError::UnableToAggregate)
}
}
}

Expand Down Expand Up @@ -216,7 +224,7 @@ impl ProofCoordinator {
if let Some(value) = self.batch_info_to_proof.get_mut(signed_batch_info.batch_info()) {
value.add_signature(&signed_batch_info, validator_verifier)?;
if !value.completed && value.ready(validator_verifier) {
let proof = value.take(validator_verifier);
let proof = value.take(validator_verifier)?;
txn_metrics::TxnLifeTime::get_txn_life_time().record_proof(proof.info().batch_id());
// proof validated locally, so adding to cache
self.proof_cache.insert(proof.info().clone(), proof.multi_signature().clone());
Expand Down
Loading