Skip to content

Commit

Permalink
BFT-474: Remove the has_batch_qc check
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Jul 8, 2024
1 parent f706d35 commit 3abf978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
22 changes: 8 additions & 14 deletions node/actors/executor/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,15 @@ impl AttesterRunner {
break;
};

// The certificates might be collected out of order because of how gossip works,
// in which case we can skip signing it.
let has_batch_qc = self
.batch_store
.has_batch_qc(ctx, earliest_batch_number)
.await
.context("has_batch_qc")?;
// The certificates might be collected out of order because of how gossip works;
// we could query the DB to see if we already have a QC, or we can just go ahead
// and publish our vote, and let others ignore it.

if !has_batch_qc {
// We only have to publish a vote once; future peers can pull it from the register.
self.publisher
.publish(attesters, &self.attester.key, batch)
.await
.context("publish")?;
}
// We only have to publish a vote once; future peers can pull it from the register.
self.publisher
.publish(attesters, &self.attester.key, batch)
.await
.context("publish")?;

earliest_batch_number = earliest_batch_number.next();
}
Expand Down
12 changes: 0 additions & 12 deletions node/libs/storage/src/batch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,6 @@ impl BatchStore {
Ok(())
}

/// Check if a given batch number has a quorum certificate stored for it.
pub async fn has_batch_qc(
&self,
ctx: &ctx::Ctx,
number: attester::BatchNumber,
) -> ctx::Result<bool> {
self.persistent
.get_batch_qc(ctx, number)
.await
.map(|qc| qc.is_some())
}

/// Waits until the given batch is queued (in memory, or persisted).
/// Note that it doesn't mean that the batch is actually available, as old batches might get pruned.
pub async fn wait_until_queued(
Expand Down

0 comments on commit 3abf978

Please sign in to comment.