From 2486a5ccaa9f965a25fe6b198e9cf051d63ca9e4 Mon Sep 17 00:00:00 2001 From: Jarred Parr Date: Tue, 15 Oct 2024 18:41:48 -0600 Subject: [PATCH] rename --- crates/task-impls/src/helpers.rs | 6 +++--- crates/task-impls/src/quorum_proposal/mod.rs | 2 +- crates/task-impls/src/quorum_vote/mod.rs | 6 +++--- crates/task-impls/src/view_sync.rs | 22 ++++++++++---------- crates/types/src/data.rs | 4 ++-- crates/types/src/simple_certificate.rs | 6 +++--- crates/types/src/simple_vote.rs | 2 +- crates/types/src/vote.rs | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/crates/task-impls/src/helpers.rs b/crates/task-impls/src/helpers.rs index e582c93e97..5df8200f16 100644 --- a/crates/task-impls/src/helpers.rs +++ b/crates/task-impls/src/helpers.rs @@ -399,12 +399,12 @@ pub(crate) async fn parent_leaf_and_state( 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 ); } @@ -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 ); diff --git a/crates/task-impls/src/quorum_proposal/mod.rs b/crates/task-impls/src/quorum_proposal/mod.rs index 0d845f2070..2c12b83b28 100644 --- a/crates/task-impls/src/quorum_proposal/mod.rs +++ b/crates/task-impls/src/quorum_proposal/mod.rs @@ -426,7 +426,7 @@ impl, V: Versions> { warn!( "View Sync Finalize certificate {:?} was invalid", - certificate.date() + certificate.data() ); return; } diff --git a/crates/task-impls/src/quorum_vote/mod.rs b/crates/task-impls/src/quorum_vote/mod.rs index e7dd9c1699..ed0d61d4e9 100644 --- a/crates/task-impls/src/quorum_vote/mod.rs +++ b/crates/task-impls/src/quorum_vote/mod.rs @@ -104,7 +104,7 @@ impl + '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), @@ -123,7 +123,7 @@ impl + '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; @@ -295,7 +295,7 @@ impl + '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."); diff --git a/crates/task-impls/src/view_sync.rs b/crates/task-impls/src/view_sync.rs index 630907c0ac..cc06ed170d 100644 --- a/crates/task-impls/src/view_sync.rs +++ b/crates/task-impls/src/view_sync.rs @@ -505,7 +505,7 @@ impl, 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; } @@ -516,13 +516,13 @@ impl, 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::::create_signed_vote( ViewSyncCommitData { - relay: certificate.date().relay, + relay: certificate.data().relay, round: self.next_view, }, self.next_view, @@ -587,7 +587,7 @@ impl, 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; } @@ -598,13 +598,13 @@ impl, 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::::create_signed_vote( ViewSyncFinalizeData { - relay: certificate.date().relay, + relay: certificate.data().relay, round: self.next_view, }, self.next_view, @@ -679,7 +679,7 @@ impl, 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; } @@ -690,8 +690,8 @@ impl, 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() { diff --git a/crates/types/src/data.rs b/crates/types/src/data.rs index d05760bf7a..e70af8c294 100644 --- a/crates/types/src/data.rs +++ b/crates/types/src/data.rs @@ -241,7 +241,7 @@ impl ViewChangeEvidence { /// 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, } } @@ -769,7 +769,7 @@ impl Leaf { 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, diff --git a/crates/types/src/simple_certificate.rs b/crates/types/src/simple_certificate.rs index f948e3a20b..6e9e7bbbfb 100644 --- a/crates/types/src/simple_certificate.rs +++ b/crates/types/src/simple_certificate.rs @@ -157,7 +157,7 @@ impl> 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; }; ::check( @@ -169,10 +169,10 @@ impl> fn threshold>(membership: &MEMBERSHIP) -> u64 { THRESHOLD::threshold(membership) } - fn date(&self) -> &Self::Voteable { + fn data(&self) -> &Self::Voteable { &self.data } - async fn date_commitment( + async fn data_commitment( &self, upgrade_lock: &UpgradeLock, ) -> Result>> { diff --git a/crates/types/src/simple_vote.rs b/crates/types/src/simple_vote.rs index a86452b9a9..45e131f756 100644 --- a/crates/types/src/simple_vote.rs +++ b/crates/types/src/simple_vote.rs @@ -147,7 +147,7 @@ impl Vote for SimpleVote Commitment { + fn data_commitment(&self) -> Commitment { self.data.commit() } } diff --git a/crates/types/src/vote.rs b/crates/types/src/vote.rs index 0123ba0085..1376aa0d03 100644 --- a/crates/types/src/vote.rs +++ b/crates/types/src/vote.rs @@ -39,7 +39,7 @@ pub trait Vote: HasViewNumber { /// 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; + fn data_commitment(&self) -> Commitment; /// Gets the public signature key of the votes creator/sender fn signing_key(&self) -> TYPES::SignatureKey; @@ -81,9 +81,9 @@ pub trait Certificate: HasViewNumber { // TODO: Make this a static ratio of the total stake of `Membership` fn threshold>(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( + fn data_commitment( &self, upgrade_lock: &UpgradeLock, ) -> impl std::future::Future>>>;