Skip to content

Commit

Permalink
Changing names
Browse files Browse the repository at this point in the history
  • Loading branch information
vusirikala committed Sep 18, 2024
1 parent a2ebb6c commit 065d760
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions consensus/consensus-types/src/block_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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(),
);
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions consensus/consensus-types/src/timeout_2chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -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(),
);
Expand Down
4 changes: 2 additions & 2 deletions consensus/safety-rules/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
);
Expand Down
4 changes: 2 additions & 2 deletions consensus/src/liveness/round_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>,
}

Expand Down
6 changes: 3 additions & 3 deletions consensus/src/pending_order_votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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
Expand Down Expand Up @@ -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(),
)),
Expand Down
10 changes: 5 additions & 5 deletions consensus/src/pending_votes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(),
),
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions consensus/src/pipeline/buffer_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -106,15 +106,15 @@ 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,
}

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)>,
Expand Down
14 changes: 7 additions & 7 deletions types/src/ledger_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -393,21 +393,21 @@ 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.
unverified_signatures: PartialSignatures,
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,
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 065d760

Please sign in to comment.