From 065d7602cf402188c8395ec105265c640d8e7c50 Mon Sep 17 00:00:00 2001 From: Satya Vusirikala <satyasatya123456@gmail.com> Date: Wed, 18 Sep 2024 16:42:30 -0700 Subject: [PATCH] Changing names --- consensus/consensus-types/src/block_test.rs | 6 +++--- consensus/consensus-types/src/timeout_2chain.rs | 4 ++-- consensus/safety-rules/src/test_utils.rs | 4 ++-- consensus/src/liveness/round_state.rs | 4 ++-- consensus/src/pending_order_votes.rs | 6 +++--- consensus/src/pending_votes.rs | 10 +++++----- consensus/src/pipeline/buffer_item.rs | 8 ++++---- types/src/ledger_info.rs | 14 +++++++------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/consensus/consensus-types/src/block_test.rs b/consensus/consensus-types/src/block_test.rs index bc33ddec8bc5a..54ece0539e2c8 100644 --- a/consensus/consensus-types/src/block_test.rs +++ b/consensus/consensus-types/src/block_test.rs @@ -17,7 +17,7 @@ use aptos_types::{ account_address::AccountAddress, aggregate_signature::PartialSignatures, block_info::{BlockInfo, Round}, - ledger_info::{LedgerInfo, LedgerInfoWithPartialSignatures}, + ledger_info::{LedgerInfo, LedgerInfoWithVerifiedSignatures}, on_chain_config::ValidatorSet, validator_signer::ValidatorSigner, validator_verifier::{random_validator_verifier, ValidatorVerifier}, @@ -131,7 +131,7 @@ fn test_same_qc_different_authors() { .unwrap(); let signature = signer.sign(genesis_qc.ledger_info().ledger_info()).unwrap(); - let mut ledger_info_altered = LedgerInfoWithPartialSignatures::new( + let mut ledger_info_altered = LedgerInfoWithVerifiedSignatures::new( genesis_qc.ledger_info().ledger_info().clone(), PartialSignatures::empty(), ); @@ -201,7 +201,7 @@ fn test_block_metadata_bitvec() { ); let mut ledger_info_1 = - LedgerInfoWithPartialSignatures::new(ledger_info.clone(), PartialSignatures::empty()); + LedgerInfoWithVerifiedSignatures::new(ledger_info.clone(), PartialSignatures::empty()); let votes_1 = vec![true, false, true, true]; votes_1 .iter() diff --git a/consensus/consensus-types/src/timeout_2chain.rs b/consensus/consensus-types/src/timeout_2chain.rs index c0d62edc6ffb3..87d35bc99bd92 100644 --- a/consensus/consensus-types/src/timeout_2chain.rs +++ b/consensus/consensus-types/src/timeout_2chain.rs @@ -406,7 +406,7 @@ mod tests { use aptos_types::{ aggregate_signature::PartialSignatures, block_info::BlockInfo, - ledger_info::{LedgerInfo, LedgerInfoWithPartialSignatures}, + ledger_info::{LedgerInfo, LedgerInfoWithVerifiedSignatures}, validator_verifier::random_validator_verifier, }; @@ -415,7 +415,7 @@ mod tests { let quorum_size = validators.quorum_voting_power() as usize; let generate_quorum = |round, num_of_signature| { let vote_data = VoteData::new(BlockInfo::random(round), BlockInfo::random(0)); - let mut ledger_info = LedgerInfoWithPartialSignatures::new( + let mut ledger_info = LedgerInfoWithVerifiedSignatures::new( LedgerInfo::new(BlockInfo::empty(), vote_data.hash()), PartialSignatures::empty(), ); diff --git a/consensus/safety-rules/src/test_utils.rs b/consensus/safety-rules/src/test_utils.rs index 07b9159c66a45..ce161c0a5fb14 100644 --- a/consensus/safety-rules/src/test_utils.rs +++ b/consensus/safety-rules/src/test_utils.rs @@ -24,7 +24,7 @@ use aptos_types::{ block_info::BlockInfo, epoch_change::EpochChangeProof, epoch_state::EpochState, - ledger_info::{LedgerInfo, LedgerInfoWithPartialSignatures, LedgerInfoWithSignatures}, + ledger_info::{LedgerInfo, LedgerInfoWithSignatures, LedgerInfoWithVerifiedSignatures}, on_chain_config::ValidatorSet, proof::AccumulatorExtensionProof, validator_info::ValidatorInfo, @@ -168,7 +168,7 @@ pub fn make_proposal_with_parent_and_overrides( ) .unwrap(); - let mut ledger_info_with_signatures = LedgerInfoWithPartialSignatures::new( + let mut ledger_info_with_signatures = LedgerInfoWithVerifiedSignatures::new( vote.ledger_info().clone(), PartialSignatures::empty(), ); diff --git a/consensus/src/liveness/round_state.rs b/consensus/src/liveness/round_state.rs index 0dc03ab88d105..74e78e9c9f024 100644 --- a/consensus/src/liveness/round_state.rs +++ b/consensus/src/liveness/round_state.rs @@ -14,7 +14,7 @@ use aptos_consensus_types::{ use aptos_crypto::HashValue; use aptos_logger::{prelude::*, Schema}; use aptos_types::{ - ledger_info::LedgerInfoWithPartialSignatures, validator_verifier::ValidatorVerifier, + ledger_info::LedgerInfoWithVerifiedSignatures, validator_verifier::ValidatorVerifier, }; use futures::future::AbortHandle; use serde::Serialize; @@ -45,7 +45,7 @@ pub struct NewRoundEvent { pub round: Round, pub reason: NewRoundReason, pub timeout: Duration, - pub prev_round_votes: Vec<(HashValue, LedgerInfoWithPartialSignatures)>, + pub prev_round_votes: Vec<(HashValue, LedgerInfoWithVerifiedSignatures)>, pub prev_round_timeout_votes: Option<TwoChainTimeoutWithPartialSignatures>, } diff --git a/consensus/src/pending_order_votes.rs b/consensus/src/pending_order_votes.rs index 94b1ba6d15451..46cf23cfe2b90 100644 --- a/consensus/src/pending_order_votes.rs +++ b/consensus/src/pending_order_votes.rs @@ -7,7 +7,7 @@ use aptos_crypto::{hash::CryptoHash, HashValue}; use aptos_logger::prelude::*; use aptos_types::{ aggregate_signature::PartialSignatures, - ledger_info::{LedgerInfo, LedgerInfoWithPartialSignatures, LedgerInfoWithSignatures}, + ledger_info::{LedgerInfo, LedgerInfoWithSignatures, LedgerInfoWithVerifiedSignatures}, validator_verifier::{ValidatorVerifier, VerifyError}, }; use std::{collections::HashMap, sync::Arc}; @@ -33,7 +33,7 @@ pub enum OrderVoteReceptionResult { #[derive(Debug, PartialEq, Eq)] enum OrderVoteStatus { EnoughVotes(LedgerInfoWithSignatures), - NotEnoughVotes(LedgerInfoWithPartialSignatures), + NotEnoughVotes(LedgerInfoWithVerifiedSignatures), } /// A PendingVotes structure keep track of order votes for the last few rounds @@ -75,7 +75,7 @@ impl PendingOrderVotes { verified_quorum_cert.expect( "Quorum Cert is expected when creating a new entry in pending order votes", ), - OrderVoteStatus::NotEnoughVotes(LedgerInfoWithPartialSignatures::new( + OrderVoteStatus::NotEnoughVotes(LedgerInfoWithVerifiedSignatures::new( order_vote.ledger_info().clone(), PartialSignatures::empty(), )), diff --git a/consensus/src/pending_votes.rs b/consensus/src/pending_votes.rs index 05abc30dc63a2..b2177d2c5889a 100644 --- a/consensus/src/pending_votes.rs +++ b/consensus/src/pending_votes.rs @@ -20,7 +20,7 @@ use aptos_crypto::{hash::CryptoHash, HashValue}; use aptos_logger::prelude::*; use aptos_types::{ aggregate_signature::PartialSignatures, - ledger_info::LedgerInfoWithPartialSignatures, + ledger_info::LedgerInfoWithVerifiedSignatures, validator_verifier::{ValidatorVerifier, VerifyError}, }; use std::{ @@ -62,7 +62,7 @@ pub struct PendingVotes { /// This might keep multiple LedgerInfos for the current round: either due to different proposals (byzantine behavior) /// or due to different NIL proposals (clients can have a different view of what block to extend). li_digest_to_votes: - HashMap<HashValue /* LedgerInfo digest */, (usize, LedgerInfoWithPartialSignatures)>, + HashMap<HashValue /* LedgerInfo digest */, (usize, LedgerInfoWithVerifiedSignatures)>, /// Tracks all the signatures of the 2-chain timeout for the given round. maybe_partial_2chain_tc: Option<TwoChainTimeoutWithPartialSignatures>, /// Map of Author to (vote, li_digest). This is useful to discard multiple votes. @@ -138,7 +138,7 @@ impl PendingVotes { // if the ledger info with signatures doesn't exist yet, create it ( len, - LedgerInfoWithPartialSignatures::new( + LedgerInfoWithVerifiedSignatures::new( vote.ledger_info().clone(), PartialSignatures::empty(), ), @@ -264,7 +264,7 @@ impl PendingVotes { pub fn aggregate_qc_now( validator_verifier: &ValidatorVerifier, - li_with_sig: &LedgerInfoWithPartialSignatures, + li_with_sig: &LedgerInfoWithVerifiedSignatures, vote_data: &VoteData, ) -> VoteReceptionResult { match li_with_sig.aggregate_signatures(validator_verifier) { @@ -317,7 +317,7 @@ impl PendingVotes { pub fn drain_votes( &mut self, ) -> ( - Vec<(HashValue, LedgerInfoWithPartialSignatures)>, + Vec<(HashValue, LedgerInfoWithVerifiedSignatures)>, Option<TwoChainTimeoutWithPartialSignatures>, ) { for (hash_index, _) in self.li_digest_to_votes.values() { diff --git a/consensus/src/pipeline/buffer_item.rs b/consensus/src/pipeline/buffer_item.rs index 46e92047d3d18..3d06658cd4323 100644 --- a/consensus/src/pipeline/buffer_item.rs +++ b/consensus/src/pipeline/buffer_item.rs @@ -16,7 +16,7 @@ use aptos_reliable_broadcast::DropGuard; use aptos_types::{ aggregate_signature::PartialSignatures, block_info::BlockInfo, - ledger_info::{LedgerInfo, LedgerInfoWithPartialSignatures, LedgerInfoWithSignatures}, + ledger_info::{LedgerInfo, LedgerInfoWithSignatures, LedgerInfoWithVerifiedSignatures}, validator_verifier::ValidatorVerifier, }; use futures::future::BoxFuture; @@ -68,7 +68,7 @@ fn generate_executed_item_from_ordered( order_vote_enabled: bool, ) -> BufferItem { debug!("{} advance to executed from ordered", commit_info); - let partial_commit_proof = LedgerInfoWithPartialSignatures::new( + let partial_commit_proof = LedgerInfoWithVerifiedSignatures::new( generate_commit_ledger_info(&commit_info, &ordered_proof, order_vote_enabled), verified_signatures, ); @@ -106,7 +106,7 @@ pub struct OrderedItem { pub struct ExecutedItem { pub executed_blocks: Vec<PipelinedBlock>, - pub partial_commit_proof: LedgerInfoWithPartialSignatures, + pub partial_commit_proof: LedgerInfoWithVerifiedSignatures, pub callback: StateComputerCommitCallBackType, pub commit_info: BlockInfo, pub ordered_proof: LedgerInfoWithSignatures, @@ -114,7 +114,7 @@ pub struct ExecutedItem { pub struct SignedItem { pub executed_blocks: Vec<PipelinedBlock>, - pub partial_commit_proof: LedgerInfoWithPartialSignatures, + pub partial_commit_proof: LedgerInfoWithVerifiedSignatures, pub callback: StateComputerCommitCallBackType, pub commit_vote: CommitVote, pub rb_handle: Option<(Instant, DropGuard)>, diff --git a/types/src/ledger_info.rs b/types/src/ledger_info.rs index 18aff380a54f9..7e0da229864e0 100644 --- a/types/src/ledger_info.rs +++ b/types/src/ledger_info.rs @@ -326,18 +326,18 @@ pub enum VerificationStatus { /// Contains the ledger info and partially aggregated signature from a set of validators, this data /// is only used during the aggregating the votes from different validators and is not persisted in DB. #[derive(Clone, Debug, Eq, PartialEq)] -pub struct LedgerInfoWithPartialSignatures { +pub struct LedgerInfoWithVerifiedSignatures { ledger_info: LedgerInfo, partial_sigs: PartialSignatures, } -impl Display for LedgerInfoWithPartialSignatures { +impl Display for LedgerInfoWithVerifiedSignatures { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { write!(f, "{}", self.ledger_info) } } -impl LedgerInfoWithPartialSignatures { +impl LedgerInfoWithVerifiedSignatures { pub fn new(ledger_info: LedgerInfo, signatures: PartialSignatures) -> Self { Self { ledger_info, @@ -393,7 +393,7 @@ pub enum SignatureWithStatus { /// verify the aggregated signature at once. If the aggregated signature is invalid, then we verify each individual /// unverified signature and remove the invalid signatures. #[derive(Clone, Debug, Eq, PartialEq)] -pub struct LedgerInfoWithMixedSignatures { +pub struct LedgerInfoWithUnverifiedSignatures { ledger_info: LedgerInfo, // These signatures are not yet verified. For efficiency, once enough unverified signatures are collected, // they will be aggregated and verified. @@ -401,13 +401,13 @@ pub struct LedgerInfoWithMixedSignatures { verified_signatures: PartialSignatures, } -impl Display for LedgerInfoWithMixedSignatures { +impl Display for LedgerInfoWithUnverifiedSignatures { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { write!(f, "{}", self.ledger_info) } } -impl LedgerInfoWithMixedSignatures { +impl LedgerInfoWithUnverifiedSignatures { pub fn new(ledger_info: LedgerInfo) -> Self { Self { ledger_info, @@ -691,7 +691,7 @@ mod tests { let epoch_state = Arc::new(EpochState::new(10, validator_verifier.clone())); let mut ledger_info_with_mixed_signatures = - LedgerInfoWithMixedSignatures::new(ledger_info.clone()); + LedgerInfoWithUnverifiedSignatures::new(ledger_info.clone()); let mut partial_sig = PartialSignatures::empty();