Skip to content

Commit

Permalink
rename (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
jparr721 authored Oct 16, 2024
1 parent 20910cb commit 06ae356
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions crates/task-impls/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ pub(crate) async fn parent_leaf_and_state<TYPES: NodeType, V: Versions>(
format!("Parent of high QC points to a view without a proposal; parent_view_number: {parent_view_number:?}, parent_view {parent_view:?}")
)?;

if leaf_commitment != consensus_reader.high_qc().date().leaf_commit {
if leaf_commitment != consensus_reader.high_qc().data().leaf_commit {
// NOTE: This happens on the genesis block
debug!(
"They don't equal: {:?} {:?}",
leaf_commitment,
consensus_reader.high_qc().date().leaf_commit
consensus_reader.high_qc().data().leaf_commit
);
}

Expand Down Expand Up @@ -620,7 +620,7 @@ pub async fn validate_proposal_view_and_certs<
match received_proposal_cert {
ViewChangeEvidence::Timeout(timeout_cert) => {
ensure!(
timeout_cert.date().view == view - 1,
timeout_cert.data().view == view - 1,
"Timeout certificate for view {} was not for the immediately preceding view",
*view
);
Expand Down
2 changes: 1 addition & 1 deletion crates/task-impls/src/quorum_proposal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
{
warn!(
"View Sync Finalize certificate {:?} was invalid",
certificate.date()
certificate.data()
);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions crates/task-impls/src/quorum_vote/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES> + 'static, V: Versions>
.read()
.await
.saved_leaves()
.get(&justify_qc.date().leaf_commit)
.get(&justify_qc.data().leaf_commit)
.cloned();
maybe_parent = match maybe_parent {
Some(p) => Some(p),
Expand All @@ -123,7 +123,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES> + 'static, V: Versions>
};
let parent = maybe_parent.context(format!(
"Proposal's parent missing from storage with commitment: {:?}, proposal view {:?}",
justify_qc.date().leaf_commit,
justify_qc.data().leaf_commit,
proposed_leaf.view_number(),
))?;
let consensus_reader = self.consensus.read().await;
Expand Down Expand Up @@ -295,7 +295,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES> + 'static, V: Versions> Handl
leaf = Some(proposed_leaf);
}
HotShotEvent::DaCertificateValidated(cert) => {
let cert_payload_comm = cert.date().payload_commit;
let cert_payload_comm = cert.data().payload_commit;
if let Some(comm) = payload_commitment {
if cert_payload_comm != comm {
error!("DAC has inconsistent payload commitment with quorum proposal or VID.");
Expand Down
22 changes: 11 additions & 11 deletions crates/task-impls/src/view_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
.is_valid_cert(self.membership.as_ref(), &self.upgrade_lock)
.await
{
error!("Not valid view sync cert! {:?}", certificate.date());
error!("Not valid view sync cert! {:?}", certificate.data());

return None;
}
Expand All @@ -516,13 +516,13 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
return Some(HotShotTaskCompleted);
}

if certificate.date().relay > self.relay {
self.relay = certificate.date().relay;
if certificate.data().relay > self.relay {
self.relay = certificate.data().relay;
}

let Ok(vote) = ViewSyncCommitVote::<TYPES>::create_signed_vote(
ViewSyncCommitData {
relay: certificate.date().relay,
relay: certificate.data().relay,
round: self.next_view,
},
self.next_view,
Expand Down Expand Up @@ -587,7 +587,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
.is_valid_cert(self.membership.as_ref(), &self.upgrade_lock)
.await
{
error!("Not valid view sync cert! {:?}", certificate.date());
error!("Not valid view sync cert! {:?}", certificate.data());

return None;
}
Expand All @@ -598,13 +598,13 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
return Some(HotShotTaskCompleted);
}

if certificate.date().relay > self.relay {
self.relay = certificate.date().relay;
if certificate.data().relay > self.relay {
self.relay = certificate.data().relay;
}

let Ok(vote) = ViewSyncFinalizeVote::<TYPES>::create_signed_vote(
ViewSyncFinalizeData {
relay: certificate.date().relay,
relay: certificate.data().relay,
round: self.next_view,
},
self.next_view,
Expand Down Expand Up @@ -679,7 +679,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
.is_valid_cert(self.membership.as_ref(), &self.upgrade_lock)
.await
{
error!("Not valid view sync cert! {:?}", certificate.date());
error!("Not valid view sync cert! {:?}", certificate.data());

return None;
}
Expand All @@ -690,8 +690,8 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
return Some(HotShotTaskCompleted);
}

if certificate.date().relay > self.relay {
self.relay = certificate.date().relay;
if certificate.data().relay > self.relay {
self.relay = certificate.data().relay;
}

if let Some(timeout_task) = self.timeout_task.take() {
Expand Down
4 changes: 2 additions & 2 deletions crates/types/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<TYPES: NodeType> ViewChangeEvidence<TYPES> {
/// Check that the given ViewChangeEvidence is relevant to the current view.
pub fn is_valid_for_view(&self, view: &TYPES::Time) -> bool {
match self {
ViewChangeEvidence::Timeout(timeout_cert) => timeout_cert.date().view == *view - 1,
ViewChangeEvidence::Timeout(timeout_cert) => timeout_cert.data().view == *view - 1,
ViewChangeEvidence::ViewSync(view_sync_cert) => view_sync_cert.view_number == *view,
}
}
Expand Down Expand Up @@ -769,7 +769,7 @@ impl<TYPES: NodeType> Leaf<TYPES> {
Leaf {
view_number: *view_number,
justify_qc: justify_qc.clone(),
parent_commitment: justify_qc.date().leaf_commit,
parent_commitment: justify_qc.data().leaf_commit,
block_header: block_header.clone(),
upgrade_certificate: upgrade_certificate.clone(),
block_payload: None,
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/simple_certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<TYPES: NodeType, VOTEABLE: Voteable + 'static, THRESHOLD: Threshold<TYPES>>
membership.stake_table(),
U256::from(Self::threshold(membership)),
);
let Ok(commit) = self.date_commitment(upgrade_lock).await else {
let Ok(commit) = self.data_commitment(upgrade_lock).await else {
return false;
};
<TYPES::SignatureKey as SignatureKey>::check(
Expand All @@ -169,10 +169,10 @@ impl<TYPES: NodeType, VOTEABLE: Voteable + 'static, THRESHOLD: Threshold<TYPES>>
fn threshold<MEMBERSHIP: Membership<TYPES>>(membership: &MEMBERSHIP) -> u64 {
THRESHOLD::threshold(membership)
}
fn date(&self) -> &Self::Voteable {
fn data(&self) -> &Self::Voteable {
&self.data
}
async fn date_commitment<V: Versions>(
async fn data_commitment<V: Versions>(
&self,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> Result<Commitment<VersionedVoteData<TYPES, VOTEABLE, V>>> {
Expand Down
2 changes: 1 addition & 1 deletion crates/types/src/simple_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<TYPES: NodeType, DATA: Voteable + 'static> Vote<TYPES> for SimpleVote<TYPES
&self.data
}

fn date_commitment(&self) -> Commitment<DATA> {
fn data_commitment(&self) -> Commitment<DATA> {
self.data.commit()
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub trait Vote<TYPES: NodeType>: HasViewNumber<TYPES> {
/// Gets the data which was voted on by this vote
fn date(&self) -> &Self::Commitment;
/// Gets the Data commitment of the vote
fn date_commitment(&self) -> Commitment<Self::Commitment>;
fn data_commitment(&self) -> Commitment<Self::Commitment>;

/// Gets the public signature key of the votes creator/sender
fn signing_key(&self) -> TYPES::SignatureKey;
Expand Down Expand Up @@ -81,9 +81,9 @@ pub trait Certificate<TYPES: NodeType>: HasViewNumber<TYPES> {
// TODO: Make this a static ratio of the total stake of `Membership`
fn threshold<MEMBERSHIP: Membership<TYPES>>(membership: &MEMBERSHIP) -> u64;
/// Get the commitment which was voted on
fn date(&self) -> &Self::Voteable;
fn data(&self) -> &Self::Voteable;
/// Get the vote commitment which the votes commit to
fn date_commitment<V: Versions>(
fn data_commitment<V: Versions>(
&self,
upgrade_lock: &UpgradeLock<TYPES, V>,
) -> impl std::future::Future<Output = Result<Commitment<VersionedVoteData<TYPES, Self::Voteable, V>>>>;
Expand Down

0 comments on commit 06ae356

Please sign in to comment.