Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
solana_measure::measure::Measure,
solana_runtime::{
bank::Bank, bank_forks::BankForks, commitment::VOTE_THRESHOLD_SIZE,
vote_account::ArcVoteAccount,
vote_account::VoteAccount,
},
solana_sdk::{
clock::{Slot, UnixTimestamp},
Expand Down Expand Up @@ -232,7 +232,7 @@ impl Tower {
latest_validator_votes_for_frozen_banks: &mut LatestValidatorVotesForFrozenBanks,
) -> ComputedBankState
where
F: IntoIterator<Item = (Pubkey, (u64, ArcVoteAccount))>,
F: IntoIterator<Item = (Pubkey, (u64, VoteAccount))>,
{
let mut vote_slots = HashSet::new();
let mut voted_stakes = HashMap::new();
Expand Down Expand Up @@ -578,7 +578,7 @@ impl Tower {
descendants: &HashMap<Slot, HashSet<u64>>,
progress: &ProgressMap,
total_stake: u64,
epoch_vote_accounts: &HashMap<Pubkey, (u64, ArcVoteAccount)>,
epoch_vote_accounts: &HashMap<Pubkey, (u64, VoteAccount)>,
latest_validator_votes_for_frozen_banks: &LatestValidatorVotesForFrozenBanks,
heaviest_subtree_fork_choice: &HeaviestSubtreeForkChoice,
) -> SwitchForkDecision {
Expand Down Expand Up @@ -828,7 +828,7 @@ impl Tower {
descendants: &HashMap<Slot, HashSet<u64>>,
progress: &ProgressMap,
total_stake: u64,
epoch_vote_accounts: &HashMap<Pubkey, (u64, ArcVoteAccount)>,
epoch_vote_accounts: &HashMap<Pubkey, (u64, VoteAccount)>,
latest_validator_votes_for_frozen_banks: &LatestValidatorVotesForFrozenBanks,
heaviest_subtree_fork_choice: &HeaviestSubtreeForkChoice,
) -> SwitchForkDecision {
Expand Down Expand Up @@ -1722,7 +1722,7 @@ pub mod test {
(bank_forks, progress, heaviest_subtree_fork_choice)
}

fn gen_stakes(stake_votes: &[(u64, &[u64])]) -> Vec<(Pubkey, (u64, ArcVoteAccount))> {
fn gen_stakes(stake_votes: &[(u64, &[u64])]) -> Vec<(Pubkey, (u64, VoteAccount))> {
let mut stakes = vec![];
for (lamports, votes) in stake_votes {
let mut account = AccountSharedData::from(Account {
Expand All @@ -1741,7 +1741,7 @@ pub mod test {
.expect("serialize state");
stakes.push((
solana_sdk::pubkey::new_rand(),
(*lamports, ArcVoteAccount::from(account)),
(*lamports, VoteAccount::from(account)),
));
}
stakes
Expand Down
8 changes: 4 additions & 4 deletions core/src/progress_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use {
replay_stage::SUPERMINORITY_THRESHOLD,
},
solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
solana_runtime::{bank::Bank, bank_forks::BankForks, vote_account::ArcVoteAccount},
solana_runtime::{bank::Bank, bank_forks::BankForks, vote_account::VoteAccount},
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
std::{
collections::{BTreeMap, HashMap, HashSet},
Expand Down Expand Up @@ -343,7 +343,7 @@ impl PropagatedStats {
&mut self,
node_pubkey: &Pubkey,
vote_account_pubkeys: &[Pubkey],
epoch_vote_accounts: &HashMap<Pubkey, (u64, ArcVoteAccount)>,
epoch_vote_accounts: &HashMap<Pubkey, (u64, VoteAccount)>,
) {
self.propagated_node_ids.insert(*node_pubkey);
for vote_account_pubkey in vote_account_pubkeys.iter() {
Expand Down Expand Up @@ -539,7 +539,7 @@ mod test {
let epoch_vote_accounts: HashMap<_, _> = vote_account_pubkeys
.iter()
.skip(num_vote_accounts - staked_vote_accounts)
.map(|pubkey| (*pubkey, (1, ArcVoteAccount::default())))
.map(|pubkey| (*pubkey, (1, VoteAccount::default())))
.collect();

let mut stats = PropagatedStats::default();
Expand Down Expand Up @@ -581,7 +581,7 @@ mod test {
let epoch_vote_accounts: HashMap<_, _> = vote_account_pubkeys
.iter()
.skip(num_vote_accounts - staked_vote_accounts)
.map(|pubkey| (*pubkey, (1, ArcVoteAccount::default())))
.map(|pubkey| (*pubkey, (1, VoteAccount::default())))
.collect();
stats.add_node_pubkey_internal(&node_pubkey, &vote_account_pubkeys, &epoch_vote_accounts);
assert!(stats.propagated_node_ids.contains(&node_pubkey));
Expand Down
8 changes: 4 additions & 4 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use {
commitment::VOTE_THRESHOLD_SIZE,
snapshot_utils::BankFromArchiveTimings,
transaction_batch::TransactionBatch,
vote_account::ArcVoteAccount,
vote_account::VoteAccount,
vote_sender_types::ReplayVoteSender,
},
solana_sdk::{
Expand Down Expand Up @@ -1206,7 +1206,7 @@ fn supermajority_root_from_vote_accounts<I>(
vote_accounts: I,
) -> Option<Slot>
where
I: IntoIterator<Item = (Pubkey, (u64, ArcVoteAccount))>,
I: IntoIterator<Item = (Pubkey, (u64, VoteAccount))>,
{
let mut roots_stakes: Vec<(Slot, u64)> = vote_accounts
.into_iter()
Expand Down Expand Up @@ -3591,7 +3591,7 @@ pub mod tests {
#[allow(clippy::field_reassign_with_default)]
fn test_supermajority_root_from_vote_accounts() {
let convert_to_vote_accounts =
|roots_stakes: Vec<(Slot, u64)>| -> Vec<(Pubkey, (u64, ArcVoteAccount))> {
|roots_stakes: Vec<(Slot, u64)>| -> Vec<(Pubkey, (u64, VoteAccount))> {
roots_stakes
.into_iter()
.map(|(root, stake)| {
Expand All @@ -3606,7 +3606,7 @@ pub mod tests {
VoteState::serialize(&versioned, vote_account.data_as_mut_slice()).unwrap();
(
solana_sdk::pubkey::new_rand(),
(stake, ArcVoteAccount::from(vote_account)),
(stake, VoteAccount::from(vote_account)),
)
})
.collect_vec()
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/staking_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(crate) mod tests {
bootstrap_validator_stake_lamports, create_genesis_config, GenesisConfigInfo,
},
rand::Rng,
solana_runtime::vote_account::{ArcVoteAccount, VoteAccounts},
solana_runtime::vote_account::{VoteAccount, VoteAccounts},
solana_sdk::{
account::{from_account, AccountSharedData},
clock::Clock,
Expand Down Expand Up @@ -312,7 +312,7 @@ pub(crate) mod tests {
)
.unwrap();
let vote_pubkey = Pubkey::new_unique();
(vote_pubkey, (stake, ArcVoteAccount::from(account)))
(vote_pubkey, (stake, VoteAccount::from(account)))
});
let result = vote_accounts.collect::<VoteAccounts>().staked_nodes();
assert_eq!(result.len(), 2);
Expand Down
13 changes: 5 additions & 8 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ use {
status_cache::{SlotDelta, StatusCache},
system_instruction_processor::{get_system_account_kind, SystemAccountKind},
transaction_batch::TransactionBatch,
vote_account::ArcVoteAccount,
vote_account::VoteAccount,
},
byteorder::{ByteOrder, LittleEndian},
dashmap::DashMap,
Expand Down Expand Up @@ -3809,7 +3809,7 @@ impl Bank {
#[allow(clippy::needless_collect)]
fn distribute_rent_to_validators<I>(&self, vote_accounts: I, rent_to_be_distributed: u64)
where
I: IntoIterator<Item = (Pubkey, (u64, ArcVoteAccount))>,
I: IntoIterator<Item = (Pubkey, (u64, VoteAccount))>,
{
let mut total_staked = 0;

Expand Down Expand Up @@ -5196,7 +5196,7 @@ impl Bank {
/// attributed to each account
/// Note: This clones the entire vote-accounts hashmap. For a single
/// account lookup use get_vote_account instead.
pub fn vote_accounts(&self) -> Vec<(Pubkey, (u64 /*stake*/, ArcVoteAccount))> {
pub fn vote_accounts(&self) -> Vec<(Pubkey, (/*stake:*/ u64, VoteAccount))> {
self.stakes_cache
.stakes()
.vote_accounts()
Expand All @@ -5206,10 +5206,7 @@ impl Bank {
}

/// Vote account for the given vote account pubkey along with the stake.
pub fn get_vote_account(
&self,
vote_account: &Pubkey,
) -> Option<(u64 /*stake*/, ArcVoteAccount)> {
pub fn get_vote_account(&self, vote_account: &Pubkey) -> Option<(/*stake:*/ u64, VoteAccount)> {
self.stakes_cache
.stakes()
.vote_accounts()
Expand All @@ -5235,7 +5232,7 @@ impl Bank {
pub fn epoch_vote_accounts(
&self,
epoch: Epoch,
) -> Option<&HashMap<Pubkey, (u64, ArcVoteAccount)>> {
) -> Option<&HashMap<Pubkey, (u64, VoteAccount)>> {
self.epoch_stakes
.get(&epoch)
.map(|epoch_stakes| Stakes::vote_accounts(epoch_stakes.stakes()))
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/epoch_stakes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {
crate::{stakes::Stakes, vote_account::ArcVoteAccount},
crate::{stakes::Stakes, vote_account::VoteAccount},
serde::{Deserialize, Serialize},
solana_sdk::{clock::Epoch, pubkey::Pubkey},
std::{collections::HashMap, sync::Arc},
Expand Down Expand Up @@ -59,7 +59,7 @@ impl EpochStakes {
}

fn parse_epoch_vote_accounts(
epoch_vote_accounts: &HashMap<Pubkey, (u64, ArcVoteAccount)>,
epoch_vote_accounts: &HashMap<Pubkey, (u64, VoteAccount)>,
leader_schedule_epoch: Epoch,
) -> (u64, NodeIdToVoteAccounts, EpochAuthorizedVoters) {
let mut node_id_to_vote_accounts: NodeIdToVoteAccounts = HashMap::new();
Expand Down Expand Up @@ -190,7 +190,7 @@ pub(crate) mod tests {
vote_accounts.iter().map(|v| {
(
v.vote_account,
(stake_per_account, ArcVoteAccount::from(v.account.clone())),
(stake_per_account, VoteAccount::from(v.account.clone())),
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/serde_snapshot/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ mod test_bank_serialize {

// This some what long test harness is required to freeze the ABI of
// Bank's serialization due to versioned nature
#[frozen_abi(digest = "9NFbb7BMUbSjUr8xwRGhW5kT5jCTQj2U2vZtMxvovsTn")]
#[frozen_abi(digest = "9jiGyuG8pK3nBNbCEtLZBghXRNg3PHhkf1jS1GgTTdGz")]
#[derive(Serialize, AbiExample)]
pub struct BankAbiTestWrapperFuture {
#[serde(serialize_with = "wrapper_future")]
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/stake_weighted_timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub(crate) struct MaxAllowableDrift {

pub(crate) fn calculate_stake_weighted_timestamp<I, K, V, T>(
unique_timestamps: I,
stakes: &HashMap<Pubkey, (u64, T /*Account|ArcVoteAccount*/)>,
stakes: &HashMap<Pubkey, (u64, T /*Account|VoteAccount*/)>,
slot: Slot,
slot_duration: Duration,
epoch_start_timestamp: Option<(Slot, UnixTimestamp)>,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/stakes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Stakes serve as a cache of stake and vote accounts to derive
//! node stakes
use {
crate::vote_account::{ArcVoteAccount, VoteAccounts, VoteAccountsHashMap},
crate::vote_account::{VoteAccount, VoteAccounts, VoteAccountsHashMap},
dashmap::DashMap,
num_derive::ToPrimitive,
num_traits::ToPrimitive,
Expand Down Expand Up @@ -268,7 +268,7 @@ impl Stakes {
);

self.vote_accounts
.insert(*pubkey, (stake, ArcVoteAccount::from(account.clone())));
.insert(*pubkey, (stake, VoteAccount::from(account.clone())));
}
} else if stake::program::check_id(account.owner()) {
// old_stake is stake lamports and voter_pubkey from the pre-store() version
Expand Down
Loading