Skip to content

Commit

Permalink
fix proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Dec 4, 2024
1 parent 41e0f30 commit 25e24e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
14 changes: 8 additions & 6 deletions crates/task-impls/src/quorum_proposal/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use committable::Committable;
use hotshot_task::dependency_task::HandleDepOutput;
use hotshot_types::{
consensus::{CommitmentAndMetadata, OuterConsensus},
data::{Leaf2, QuorumProposal, VidDisperse, ViewChangeEvidence},
data::{Leaf2, QuorumProposal2, VidDisperse, ViewChangeEvidence},
drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT},
message::Proposal,
simple_certificate::{QuorumCertificate2, UpgradeCertificate},
traits::{
Expand Down Expand Up @@ -296,14 +297,15 @@ impl<TYPES: NodeType, V: Versions> ProposalDependencyHandle<TYPES, V> {
.context(warn!("Failed to construct marketplace block header"))?
};

let proposal = QuorumProposal {
let proposal = QuorumProposal2 {
block_header,
view_number: self.view_number,
justify_qc: parent_qc.to_qc(),
justify_qc: parent_qc,
upgrade_certificate,
proposal_certificate,
}
.into();
view_change_evidence: proposal_certificate,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
};

let proposed_leaf = Leaf2::from_quorum_proposal(&proposal);
ensure!(
Expand Down
4 changes: 2 additions & 2 deletions crates/task-impls/src/quorum_proposal_recv/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ pub(crate) async fn handle_quorum_proposal_recv<
.is_valid_cert(
validation_info
.quorum_membership
.stake_table(validation_info.cur_epoch),
.stake_table(justify_qc.data.epoch),
validation_info
.quorum_membership
.success_threshold(validation_info.cur_epoch),
.success_threshold(justify_qc.data.epoch),
&validation_info.upgrade_lock,
)
.await
Expand Down
7 changes: 6 additions & 1 deletion crates/task-impls/src/quorum_vote/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,17 @@ pub(crate) async fn submit_vote<TYPES: NodeType, I: NodeImplementation<TYPES>, V
private_key: <TYPES::SignatureKey as SignatureKey>::PrivateKey,
upgrade_lock: UpgradeLock<TYPES, V>,
view_number: TYPES::View,
epoch_number: TYPES::Epoch,
epoch_height: u64,
storage: Arc<RwLock<I::Storage>>,
leaf: Leaf2<TYPES>,
vid_share: Proposal<TYPES, VidDisperseShare<TYPES>>,
extended_vote: bool,
) -> Result<()> {
let epoch_number = TYPES::Epoch::new(epoch_from_block_number(
leaf.block_header().block_number(),
epoch_height,
));

ensure!(
quorum_membership.has_stake(&public_key, epoch_number),
info!(
Expand Down
4 changes: 2 additions & 2 deletions crates/task-impls/src/quorum_vote/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES> + 'static, V: Versions> Handl
self.private_key.clone(),
self.upgrade_lock.clone(),
self.view_number,
current_epoch,
self.epoch_height,
Arc::clone(&self.storage),
leaf,
vid_share,
Expand Down Expand Up @@ -709,7 +709,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> QuorumVoteTaskS
self.private_key.clone(),
self.upgrade_lock.clone(),
proposal.data.view_number(),
current_epoch,
self.epoch_height,
Arc::clone(&self.storage),
proposed_leaf,
updated_vid,
Expand Down
7 changes: 4 additions & 3 deletions crates/types/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ use vbs::{

use crate::{
data::{
DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, UpgradeProposal, VidDisperseShare,
DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, UpgradeProposal,
VidDisperseShare,
},
request_response::ProposalRequestPayload,
simple_certificate::{
DaCertificate, DaCertificate2, QuorumCertificate2, UpgradeCertificate, ViewSyncCommitCertificate,
ViewSyncFinalizeCertificate, ViewSyncPreCommitCertificate,
DaCertificate, DaCertificate2, QuorumCertificate2, UpgradeCertificate,
ViewSyncCommitCertificate, ViewSyncFinalizeCertificate, ViewSyncPreCommitCertificate,
},
simple_vote::{
DaVote, DaVote2, QuorumVote, QuorumVote2, TimeoutVote, UpgradeVote, ViewSyncCommitVote,
Expand Down

0 comments on commit 25e24e9

Please sign in to comment.