Skip to content

Commit 60b067c

Browse files
Cifkosdbondi
andauthored
fix: qc was validated based on current epoch, not the qc's epoch (#896)
Description --- The qc validation was based on the epoch of the candidate block. So if the QC was from previous epoch the committee shard could be different. E.g. when you add a new VN into the committee, the qc was expected to have 2 signatures. But in the previous epoch there was only one VN so the QC never passed the validation. Motivation and Context --- How Has This Been Tested? --- Start dan-testing with 1 VN, add a new VN and mine it into the committee. Without this change you would never see a new block coming in. You still have to wait for some leader failure on the epoch change but eventually new blocks starts coming in. What process can a PR reviewer use to test or verify this change? --- As above. Breaking Changes --- - [x] None - [ ] Requires data directory to be deleted - [ ] Other - Please specify Co-authored-by: Stan Bondi <[email protected]>
1 parent 33283f8 commit 60b067c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dan_layer/consensus/src/block_validations.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ pub async fn check_quorum_certificate<TConsensusSpec: ConsensusSpec>(
109109
}
110110
}
111111
let committee_shard = epoch_manager
112-
.get_committee_shard_by_validator_public_key(candidate_block.epoch(), candidate_block.proposed_by())
112+
.get_committee_shard_by_validator_public_key(
113+
qc.epoch(),
114+
qc.signatures()
115+
.first()
116+
.ok_or::<HotStuffError>(ProposalValidationError::QuorumWasNotReached { qc: qc.clone() }.into())?
117+
.public_key(),
118+
)
113119
.await?;
114120

115121
if committee_shard.quorum_threshold() >

0 commit comments

Comments
 (0)