Split vote related code from runtime to its own crate (#32882)
* Move vote related code to its own crate * Update imports in code and tests * update programs/sbf/Cargo.lock * fix check errors * update abi_digest * rebase fixes * fixes after rebase
This commit is contained in:
parent
889d6c655e
commit
f50342a790
|
@ -5784,6 +5784,7 @@ dependencies = [
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-turbine",
|
"solana-turbine",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"strum",
|
"strum",
|
||||||
|
@ -6074,6 +6075,7 @@ dependencies = [
|
||||||
"solana-thin-client",
|
"solana-thin-client",
|
||||||
"solana-tpu-client",
|
"solana-tpu-client",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"test-case",
|
"test-case",
|
||||||
|
@ -6184,6 +6186,7 @@ dependencies = [
|
||||||
"solana-storage-bigtable",
|
"solana-storage-bigtable",
|
||||||
"solana-storage-proto",
|
"solana-storage-proto",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022",
|
||||||
|
@ -6291,6 +6294,7 @@ dependencies = [
|
||||||
"solana-thin-client",
|
"solana-thin-client",
|
||||||
"solana-tpu-client",
|
"solana-tpu-client",
|
||||||
"solana-turbine",
|
"solana-turbine",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
@ -6712,6 +6716,7 @@ dependencies = [
|
||||||
"solana-tpu-client",
|
"solana-tpu-client",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022",
|
||||||
|
@ -6883,6 +6888,7 @@ dependencies = [
|
||||||
"solana-stake-program",
|
"solana-stake-program",
|
||||||
"solana-system-program",
|
"solana-system-program",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"solana-zk-token-proof-program",
|
"solana-zk-token-proof-program",
|
||||||
"solana-zk-token-sdk",
|
"solana-zk-token-sdk",
|
||||||
|
@ -7405,6 +7411,84 @@ dependencies = [
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "solana-vote"
|
||||||
|
version = "1.17.0"
|
||||||
|
dependencies = [
|
||||||
|
"arrayref",
|
||||||
|
"assert_matches",
|
||||||
|
"bincode",
|
||||||
|
"blake3",
|
||||||
|
"bv",
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder",
|
||||||
|
"bzip2",
|
||||||
|
"crossbeam-channel",
|
||||||
|
"dashmap 4.0.2",
|
||||||
|
"dir-diff",
|
||||||
|
"ed25519-dalek",
|
||||||
|
"flate2",
|
||||||
|
"fnv",
|
||||||
|
"fs-err",
|
||||||
|
"im",
|
||||||
|
"index_list",
|
||||||
|
"itertools",
|
||||||
|
"lazy_static",
|
||||||
|
"libsecp256k1",
|
||||||
|
"log",
|
||||||
|
"lru",
|
||||||
|
"lz4",
|
||||||
|
"memmap2",
|
||||||
|
"memoffset 0.9.0",
|
||||||
|
"modular-bitfield",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"num_cpus",
|
||||||
|
"num_enum 0.6.1",
|
||||||
|
"ouroboros",
|
||||||
|
"percentage",
|
||||||
|
"qualifier_attr",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rand_chacha 0.3.1",
|
||||||
|
"rayon",
|
||||||
|
"regex",
|
||||||
|
"rustc_version 0.4.0",
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"siphasher",
|
||||||
|
"solana-address-lookup-table-program",
|
||||||
|
"solana-bpf-loader-program",
|
||||||
|
"solana-bucket-map",
|
||||||
|
"solana-compute-budget-program",
|
||||||
|
"solana-config-program",
|
||||||
|
"solana-cost-model",
|
||||||
|
"solana-frozen-abi",
|
||||||
|
"solana-frozen-abi-macro",
|
||||||
|
"solana-loader-v4-program",
|
||||||
|
"solana-logger",
|
||||||
|
"solana-measure",
|
||||||
|
"solana-metrics",
|
||||||
|
"solana-perf",
|
||||||
|
"solana-program-runtime",
|
||||||
|
"solana-rayon-threadlimit",
|
||||||
|
"solana-sdk",
|
||||||
|
"solana-stake-program",
|
||||||
|
"solana-system-program",
|
||||||
|
"solana-vote",
|
||||||
|
"solana-vote-program",
|
||||||
|
"solana-zk-token-proof-program",
|
||||||
|
"solana-zk-token-sdk",
|
||||||
|
"static_assertions",
|
||||||
|
"strum",
|
||||||
|
"strum_macros",
|
||||||
|
"symlink",
|
||||||
|
"tar",
|
||||||
|
"tempfile",
|
||||||
|
"test-case",
|
||||||
|
"thiserror",
|
||||||
|
"zstd",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-vote-program"
|
name = "solana-vote-program"
|
||||||
version = "1.17.0"
|
version = "1.17.0"
|
||||||
|
|
|
@ -109,6 +109,7 @@ members = [
|
||||||
"upload-perf",
|
"upload-perf",
|
||||||
"validator",
|
"validator",
|
||||||
"version",
|
"version",
|
||||||
|
"vote",
|
||||||
"watchtower",
|
"watchtower",
|
||||||
"zk-keygen",
|
"zk-keygen",
|
||||||
"zk-token-sdk",
|
"zk-token-sdk",
|
||||||
|
@ -367,6 +368,7 @@ solana-transaction-status = { path = "transaction-status", version = "=1.17.0" }
|
||||||
solana-turbine = { path = "turbine", version = "=1.17.0" }
|
solana-turbine = { path = "turbine", version = "=1.17.0" }
|
||||||
solana-udp-client = { path = "udp-client", version = "=1.17.0" }
|
solana-udp-client = { path = "udp-client", version = "=1.17.0" }
|
||||||
solana-version = { path = "version", version = "=1.17.0" }
|
solana-version = { path = "version", version = "=1.17.0" }
|
||||||
|
solana-vote = { path = "vote", version = "=1.17.0" }
|
||||||
solana-vote-program = { path = "programs/vote", version = "=1.17.0" }
|
solana-vote-program = { path = "programs/vote", version = "=1.17.0" }
|
||||||
solana-zk-keygen = { path = "zk-keygen", version = "=1.17.0" }
|
solana-zk-keygen = { path = "zk-keygen", version = "=1.17.0" }
|
||||||
solana-zk-token-proof-program = { path = "programs/zk-token-proof", version = "=1.17.0" }
|
solana-zk-token-proof-program = { path = "programs/zk-token-proof", version = "=1.17.0" }
|
||||||
|
|
|
@ -69,6 +69,7 @@ solana-tpu-client = { workspace = true }
|
||||||
solana-transaction-status = { workspace = true }
|
solana-transaction-status = { workspace = true }
|
||||||
solana-turbine = { workspace = true }
|
solana-turbine = { workspace = true }
|
||||||
solana-version = { workspace = true }
|
solana-version = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
strum = { workspace = true, features = ["derive"] }
|
strum = { workspace = true, features = ["derive"] }
|
||||||
strum_macros = { workspace = true }
|
strum_macros = { workspace = true }
|
||||||
|
|
|
@ -27,11 +27,9 @@ use {
|
||||||
solana_measure::{measure, measure_us},
|
solana_measure::{measure, measure_us},
|
||||||
solana_perf::{data_budget::DataBudget, packet::PACKETS_PER_BATCH},
|
solana_perf::{data_budget::DataBudget, packet::PACKETS_PER_BATCH},
|
||||||
solana_poh::poh_recorder::PohRecorder,
|
solana_poh::poh_recorder::PohRecorder,
|
||||||
solana_runtime::{
|
solana_runtime::{bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache},
|
||||||
bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache,
|
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
|
||||||
solana_sdk::timing::AtomicInterval,
|
solana_sdk::timing::AtomicInterval,
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteSender,
|
||||||
std::{
|
std::{
|
||||||
cmp, env,
|
cmp, env,
|
||||||
sync::{
|
sync::{
|
||||||
|
|
|
@ -14,12 +14,12 @@ use {
|
||||||
bank_utils,
|
bank_utils,
|
||||||
prioritization_fee_cache::PrioritizationFeeCache,
|
prioritization_fee_cache::PrioritizationFeeCache,
|
||||||
transaction_batch::TransactionBatch,
|
transaction_batch::TransactionBatch,
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{pubkey::Pubkey, saturating_add_assign},
|
solana_sdk::{pubkey::Pubkey, saturating_add_assign},
|
||||||
solana_transaction_status::{
|
solana_transaction_status::{
|
||||||
token_balances::TransactionTokenBalancesSet, TransactionTokenBalance,
|
token_balances::TransactionTokenBalancesSet, TransactionTokenBalance,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteSender,
|
||||||
std::{collections::HashMap, sync::Arc},
|
std::{collections::HashMap, sync::Arc},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -138,14 +138,12 @@ mod tests {
|
||||||
get_tmp_ledger_path_auto_delete, leader_schedule_cache::LeaderScheduleCache,
|
get_tmp_ledger_path_auto_delete, leader_schedule_cache::LeaderScheduleCache,
|
||||||
},
|
},
|
||||||
solana_poh::poh_recorder::{PohRecorder, WorkingBankEntry},
|
solana_poh::poh_recorder::{PohRecorder, WorkingBankEntry},
|
||||||
solana_runtime::{
|
solana_runtime::{bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache},
|
||||||
bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache,
|
|
||||||
vote_sender_types::ReplayVoteReceiver,
|
|
||||||
},
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
genesis_config::GenesisConfig, poh_config::PohConfig, pubkey::Pubkey,
|
genesis_config::GenesisConfig, poh_config::PohConfig, pubkey::Pubkey,
|
||||||
signature::Keypair, system_transaction,
|
signature::Keypair, system_transaction,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteReceiver,
|
||||||
std::{
|
std::{
|
||||||
sync::{atomic::AtomicBool, RwLock},
|
sync::{atomic::AtomicBool, RwLock},
|
||||||
thread::JoinHandle,
|
thread::JoinHandle,
|
||||||
|
|
|
@ -26,13 +26,8 @@ use {
|
||||||
rpc_subscriptions::RpcSubscriptions,
|
rpc_subscriptions::RpcSubscriptions,
|
||||||
},
|
},
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
bank::Bank,
|
bank::Bank, bank_forks::BankForks, commitment::VOTE_THRESHOLD_SIZE,
|
||||||
bank_forks::BankForks,
|
|
||||||
commitment::VOTE_THRESHOLD_SIZE,
|
|
||||||
epoch_stakes::EpochStakes,
|
epoch_stakes::EpochStakes,
|
||||||
vote_parser::{self, ParsedVote},
|
|
||||||
vote_sender_types::ReplayVoteReceiver,
|
|
||||||
vote_transaction::VoteTransaction,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
||||||
|
@ -43,6 +38,11 @@ use {
|
||||||
timing::AtomicInterval,
|
timing::AtomicInterval,
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
},
|
},
|
||||||
|
solana_vote::{
|
||||||
|
vote_parser::{self, ParsedVote},
|
||||||
|
vote_sender_types::ReplayVoteReceiver,
|
||||||
|
vote_transaction::VoteTransaction,
|
||||||
|
},
|
||||||
std::{
|
std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
iter::repeat,
|
iter::repeat,
|
||||||
|
@ -883,13 +883,13 @@ mod tests {
|
||||||
genesis_utils::{
|
genesis_utils::{
|
||||||
self, create_genesis_config, GenesisConfigInfo, ValidatorVoteKeypairs,
|
self, create_genesis_config, GenesisConfigInfo, ValidatorVoteKeypairs,
|
||||||
},
|
},
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
signature::{Keypair, Signature, Signer},
|
signature::{Keypair, Signature, Signer},
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteSender,
|
||||||
solana_vote_program::{vote_state::Vote, vote_transaction},
|
solana_vote_program::{vote_state::Vote, vote_transaction},
|
||||||
std::{
|
std::{
|
||||||
collections::BTreeSet,
|
collections::BTreeSet,
|
||||||
|
|
|
@ -19,10 +19,7 @@ use {
|
||||||
},
|
},
|
||||||
chrono::prelude::*,
|
chrono::prelude::*,
|
||||||
solana_ledger::{ancestor_iterator::AncestorIterator, blockstore::Blockstore, blockstore_db},
|
solana_ledger::{ancestor_iterator::AncestorIterator, blockstore::Blockstore, blockstore_db},
|
||||||
solana_runtime::{
|
solana_runtime::{bank::Bank, bank_forks::BankForks, commitment::VOTE_THRESHOLD_SIZE},
|
||||||
bank::Bank, bank_forks::BankForks, commitment::VOTE_THRESHOLD_SIZE,
|
|
||||||
vote_account::VoteAccountsHashMap,
|
|
||||||
},
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::{Slot, UnixTimestamp},
|
clock::{Slot, UnixTimestamp},
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
|
@ -31,6 +28,7 @@ use {
|
||||||
signature::Keypair,
|
signature::Keypair,
|
||||||
slot_history::{Check, SlotHistory},
|
slot_history::{Check, SlotHistory},
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_account::VoteAccountsHashMap,
|
||||||
solana_vote_program::{
|
solana_vote_program::{
|
||||||
vote_instruction,
|
vote_instruction,
|
||||||
vote_state::{
|
vote_state::{
|
||||||
|
@ -1521,7 +1519,7 @@ pub mod test {
|
||||||
},
|
},
|
||||||
itertools::Itertools,
|
itertools::Itertools,
|
||||||
solana_ledger::{blockstore::make_slot_entries, get_tmp_ledger_path},
|
solana_ledger::{blockstore::make_slot_entries, get_tmp_ledger_path},
|
||||||
solana_runtime::{bank::Bank, vote_account::VoteAccount},
|
solana_runtime::bank::Bank,
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
|
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
|
||||||
clock::Slot,
|
clock::Slot,
|
||||||
|
@ -1530,6 +1528,7 @@ pub mod test {
|
||||||
signature::Signer,
|
signature::Signer,
|
||||||
slot_history::SlotHistory,
|
slot_history::SlotHistory,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_account::VoteAccount,
|
||||||
solana_vote_program::vote_state::{Vote, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
solana_vote_program::vote_state::{Vote, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
||||||
std::{
|
std::{
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
|
|
|
@ -7,8 +7,9 @@ use {
|
||||||
},
|
},
|
||||||
solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
|
solana_ledger::blockstore_processor::{ConfirmationProgress, ConfirmationTiming},
|
||||||
solana_program_runtime::{report_execute_timings, timings::ExecuteTimingType},
|
solana_program_runtime::{report_execute_timings, timings::ExecuteTimingType},
|
||||||
solana_runtime::{bank::Bank, bank_forks::BankForks, vote_account::VoteAccountsHashMap},
|
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||||
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
|
solana_sdk::{clock::Slot, hash::Hash, pubkey::Pubkey},
|
||||||
|
solana_vote::vote_account::VoteAccountsHashMap,
|
||||||
std::{
|
std::{
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
ops::Index,
|
ops::Index,
|
||||||
|
@ -531,8 +532,8 @@ impl ProgressMap {
|
||||||
mod test {
|
mod test {
|
||||||
use {
|
use {
|
||||||
super::*,
|
super::*,
|
||||||
solana_runtime::vote_account::VoteAccount,
|
|
||||||
solana_sdk::account::{Account, AccountSharedData},
|
solana_sdk::account::{Account, AccountSharedData},
|
||||||
|
solana_vote::vote_account::VoteAccount,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn new_test_vote_account() -> VoteAccount {
|
fn new_test_vote_account() -> VoteAccount {
|
||||||
|
|
|
@ -63,7 +63,6 @@ use {
|
||||||
bank_forks::{BankForks, MAX_ROOT_DISTANCE_FOR_VOTE_ONLY},
|
bank_forks::{BankForks, MAX_ROOT_DISTANCE_FOR_VOTE_ONLY},
|
||||||
commitment::BlockCommitmentCache,
|
commitment::BlockCommitmentCache,
|
||||||
prioritization_fee_cache::PrioritizationFeeCache,
|
prioritization_fee_cache::PrioritizationFeeCache,
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::{BankId, Slot, MAX_PROCESSING_AGE, NUM_CONSECUTIVE_LEADER_SLOTS},
|
clock::{BankId, Slot, MAX_PROCESSING_AGE, NUM_CONSECUTIVE_LEADER_SLOTS},
|
||||||
|
@ -75,6 +74,7 @@ use {
|
||||||
timing::timestamp,
|
timing::timestamp,
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteSender,
|
||||||
solana_vote_program::vote_state::VoteTransaction,
|
solana_vote_program::vote_state::VoteTransaction,
|
||||||
std::{
|
std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
|
|
|
@ -30,11 +30,7 @@ use {
|
||||||
optimistically_confirmed_bank_tracker::BankNotificationSender,
|
optimistically_confirmed_bank_tracker::BankNotificationSender,
|
||||||
rpc_subscriptions::RpcSubscriptions,
|
rpc_subscriptions::RpcSubscriptions,
|
||||||
},
|
},
|
||||||
solana_runtime::{
|
solana_runtime::{bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache},
|
||||||
bank_forks::BankForks,
|
|
||||||
prioritization_fee_cache::PrioritizationFeeCache,
|
|
||||||
vote_sender_types::{ReplayVoteReceiver, ReplayVoteSender},
|
|
||||||
},
|
|
||||||
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Keypair},
|
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Keypair},
|
||||||
solana_streamer::{
|
solana_streamer::{
|
||||||
nonblocking::quic::DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
|
nonblocking::quic::DEFAULT_WAIT_FOR_CHUNK_TIMEOUT,
|
||||||
|
@ -42,6 +38,7 @@ use {
|
||||||
streamer::StakedNodes,
|
streamer::StakedNodes,
|
||||||
},
|
},
|
||||||
solana_turbine::broadcast_stage::{BroadcastStage, BroadcastStageType},
|
solana_turbine::broadcast_stage::{BroadcastStage, BroadcastStageType},
|
||||||
|
solana_vote::vote_sender_types::{ReplayVoteReceiver, ReplayVoteSender},
|
||||||
std::{
|
std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
net::{SocketAddr, UdpSocket},
|
net::{SocketAddr, UdpSocket},
|
||||||
|
|
|
@ -44,10 +44,10 @@ use {
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
accounts_background_service::AbsRequestSender, bank_forks::BankForks,
|
accounts_background_service::AbsRequestSender, bank_forks::BankForks,
|
||||||
commitment::BlockCommitmentCache, prioritization_fee_cache::PrioritizationFeeCache,
|
commitment::BlockCommitmentCache, prioritization_fee_cache::PrioritizationFeeCache,
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Keypair},
|
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Keypair},
|
||||||
solana_turbine::retransmit_stage::RetransmitStage,
|
solana_turbine::retransmit_stage::RetransmitStage,
|
||||||
|
solana_vote::vote_sender_types::ReplayVoteSender,
|
||||||
std::{
|
std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
net::{SocketAddr, UdpSocket},
|
net::{SocketAddr, UdpSocket},
|
||||||
|
|
|
@ -2,10 +2,7 @@ use {
|
||||||
crate::{cluster_info_vote_listener::VerifiedLabelVotePacketsReceiver, result::Result},
|
crate::{cluster_info_vote_listener::VerifiedLabelVotePacketsReceiver, result::Result},
|
||||||
itertools::Itertools,
|
itertools::Itertools,
|
||||||
solana_perf::packet::PacketBatch,
|
solana_perf::packet::PacketBatch,
|
||||||
solana_runtime::{
|
solana_runtime::bank::Bank,
|
||||||
bank::Bank,
|
|
||||||
vote_transaction::{VoteTransaction, VoteTransaction::VoteStateUpdate},
|
|
||||||
},
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::from_account,
|
account::from_account,
|
||||||
clock::{Slot, UnixTimestamp},
|
clock::{Slot, UnixTimestamp},
|
||||||
|
@ -15,6 +12,7 @@ use {
|
||||||
slot_hashes::SlotHashes,
|
slot_hashes::SlotHashes,
|
||||||
sysvar,
|
sysvar,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_transaction::{VoteTransaction, VoteTransaction::VoteStateUpdate},
|
||||||
std::{
|
std::{
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
|
|
@ -47,6 +47,7 @@ solana-streamer = { workspace = true }
|
||||||
solana-thin-client = { workspace = true }
|
solana-thin-client = { workspace = true }
|
||||||
solana-tpu-client = { workspace = true }
|
solana-tpu-client = { workspace = true }
|
||||||
solana-version = { workspace = true }
|
solana-version = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
static_assertions = { workspace = true }
|
static_assertions = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
|
@ -60,7 +60,7 @@ use {
|
||||||
packet::{Packet, PacketBatch, PacketBatchRecycler, PACKET_DATA_SIZE},
|
packet::{Packet, PacketBatch, PacketBatchRecycler, PACKET_DATA_SIZE},
|
||||||
},
|
},
|
||||||
solana_rayon_threadlimit::get_thread_count,
|
solana_rayon_threadlimit::get_thread_count,
|
||||||
solana_runtime::{bank_forks::BankForks, vote_parser},
|
solana_runtime::bank_forks::BankForks,
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_SLOTS_PER_EPOCH},
|
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_SLOTS_PER_EPOCH},
|
||||||
feature_set::FeatureSet,
|
feature_set::FeatureSet,
|
||||||
|
@ -77,6 +77,7 @@ use {
|
||||||
socket::SocketAddrSpace,
|
socket::SocketAddrSpace,
|
||||||
streamer::{PacketBatchReceiver, PacketBatchSender},
|
streamer::{PacketBatchReceiver, PacketBatchSender},
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_parser,
|
||||||
solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY,
|
solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY,
|
||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
|
|
|
@ -10,7 +10,6 @@ use {
|
||||||
bincode::{serialize, serialized_size},
|
bincode::{serialize, serialized_size},
|
||||||
rand::{CryptoRng, Rng},
|
rand::{CryptoRng, Rng},
|
||||||
serde::de::{Deserialize, Deserializer},
|
serde::de::{Deserialize, Deserializer},
|
||||||
solana_runtime::vote_parser,
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::Slot,
|
clock::Slot,
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
|
@ -20,6 +19,7 @@ use {
|
||||||
timing::timestamp,
|
timing::timestamp,
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_parser,
|
||||||
std::{
|
std::{
|
||||||
borrow::{Borrow, Cow},
|
borrow::{Borrow, Cow},
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
|
|
|
@ -54,6 +54,7 @@ solana-stake-program = { workspace = true }
|
||||||
solana-storage-bigtable = { workspace = true }
|
solana-storage-bigtable = { workspace = true }
|
||||||
solana-storage-proto = { workspace = true }
|
solana-storage-proto = { workspace = true }
|
||||||
solana-transaction-status = { workspace = true }
|
solana-transaction-status = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
spl-token = { workspace = true, features = ["no-entrypoint"] }
|
spl-token = { workspace = true, features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
|
spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
|
||||||
|
|
|
@ -43,8 +43,6 @@ use {
|
||||||
prioritization_fee_cache::PrioritizationFeeCache,
|
prioritization_fee_cache::PrioritizationFeeCache,
|
||||||
runtime_config::RuntimeConfig,
|
runtime_config::RuntimeConfig,
|
||||||
transaction_batch::TransactionBatch,
|
transaction_batch::TransactionBatch,
|
||||||
vote_account::VoteAccountsHashMap,
|
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
clock::{Slot, MAX_PROCESSING_AGE},
|
clock::{Slot, MAX_PROCESSING_AGE},
|
||||||
|
@ -61,6 +59,7 @@ use {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solana_transaction_status::token_balances::TransactionTokenBalancesSet,
|
solana_transaction_status::token_balances::TransactionTokenBalancesSet,
|
||||||
|
solana_vote::{vote_account::VoteAccountsHashMap, vote_sender_types::ReplayVoteSender},
|
||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
|
@ -1863,11 +1862,8 @@ pub mod tests {
|
||||||
rand::{thread_rng, Rng},
|
rand::{thread_rng, Rng},
|
||||||
solana_entry::entry::{create_ticks, next_entry, next_entry_mut},
|
solana_entry::entry::{create_ticks, next_entry, next_entry_mut},
|
||||||
solana_program_runtime::declare_process_instruction,
|
solana_program_runtime::declare_process_instruction,
|
||||||
solana_runtime::{
|
solana_runtime::genesis_utils::{
|
||||||
genesis_utils::{
|
self, create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs,
|
||||||
self, create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs,
|
|
||||||
},
|
|
||||||
vote_account::VoteAccount,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{AccountSharedData, WritableAccount},
|
account::{AccountSharedData, WritableAccount},
|
||||||
|
@ -1881,6 +1877,7 @@ pub mod tests {
|
||||||
system_transaction,
|
system_transaction,
|
||||||
transaction::{Transaction, TransactionError},
|
transaction::{Transaction, TransactionError},
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_account::VoteAccount,
|
||||||
solana_vote_program::{
|
solana_vote_program::{
|
||||||
self,
|
self,
|
||||||
vote_state::{VoteState, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
vote_state::{VoteState, VoteStateVersions, MAX_LOCKOUT_HISTORY},
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
pub(crate) mod tests {
|
pub(crate) mod tests {
|
||||||
use {
|
use {
|
||||||
rand::Rng,
|
rand::Rng,
|
||||||
solana_runtime::{
|
solana_runtime::bank::Bank,
|
||||||
bank::Bank,
|
|
||||||
vote_account::{VoteAccount, VoteAccounts},
|
|
||||||
},
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::AccountSharedData,
|
account::AccountSharedData,
|
||||||
clock::Clock,
|
clock::Clock,
|
||||||
|
@ -19,6 +16,7 @@ pub(crate) mod tests {
|
||||||
},
|
},
|
||||||
transaction::Transaction,
|
transaction::Transaction,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_account::{VoteAccount, VoteAccounts},
|
||||||
solana_vote_program::{
|
solana_vote_program::{
|
||||||
vote_instruction,
|
vote_instruction,
|
||||||
vote_state::{VoteInit, VoteState, VoteStateVersions},
|
vote_state::{VoteInit, VoteState, VoteStateVersions},
|
||||||
|
|
|
@ -33,6 +33,7 @@ solana-streamer = { workspace = true }
|
||||||
solana-thin-client = { workspace = true }
|
solana-thin-client = { workspace = true }
|
||||||
solana-tpu-client = { workspace = true }
|
solana-tpu-client = { workspace = true }
|
||||||
solana-turbine = { workspace = true }
|
solana-turbine = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
static_assertions = { workspace = true }
|
static_assertions = { workspace = true }
|
||||||
tempfile = { workspace = true }
|
tempfile = { workspace = true }
|
||||||
|
|
|
@ -21,7 +21,6 @@ use {
|
||||||
gossip_service::{self, discover_cluster, GossipService},
|
gossip_service::{self, discover_cluster, GossipService},
|
||||||
},
|
},
|
||||||
solana_ledger::blockstore::Blockstore,
|
solana_ledger::blockstore::Blockstore,
|
||||||
solana_runtime::vote_transaction::VoteTransaction,
|
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
client::SyncClient,
|
client::SyncClient,
|
||||||
clock::{self, Slot, NUM_CONSECUTIVE_LEADER_SLOTS},
|
clock::{self, Slot, NUM_CONSECUTIVE_LEADER_SLOTS},
|
||||||
|
@ -38,6 +37,7 @@ use {
|
||||||
transport::TransportError,
|
transport::TransportError,
|
||||||
},
|
},
|
||||||
solana_streamer::socket::SocketAddrSpace,
|
solana_streamer::socket::SocketAddrSpace,
|
||||||
|
solana_vote::vote_transaction::VoteTransaction,
|
||||||
solana_vote_program::vote_transaction,
|
solana_vote_program::vote_transaction,
|
||||||
std::{
|
std::{
|
||||||
borrow::Borrow,
|
borrow::Borrow,
|
||||||
|
|
|
@ -61,7 +61,6 @@ use {
|
||||||
snapshot_config::SnapshotConfig,
|
snapshot_config::SnapshotConfig,
|
||||||
snapshot_package::SnapshotKind,
|
snapshot_package::SnapshotKind,
|
||||||
snapshot_utils::{self},
|
snapshot_utils::{self},
|
||||||
vote_parser,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::AccountSharedData,
|
account::AccountSharedData,
|
||||||
|
@ -83,6 +82,7 @@ use {
|
||||||
broadcast_duplicates_run::{BroadcastDuplicatesConfig, ClusterPartition},
|
broadcast_duplicates_run::{BroadcastDuplicatesConfig, ClusterPartition},
|
||||||
BroadcastStageType,
|
BroadcastStageType,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_parser,
|
||||||
solana_vote_program::{vote_state::MAX_LOCKOUT_HISTORY, vote_transaction},
|
solana_vote_program::{vote_state::MAX_LOCKOUT_HISTORY, vote_transaction},
|
||||||
std::{
|
std::{
|
||||||
collections::{BTreeSet, HashMap, HashSet},
|
collections::{BTreeSet, HashMap, HashSet},
|
||||||
|
|
|
@ -4837,6 +4837,7 @@ dependencies = [
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-turbine",
|
"solana-turbine",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
|
@ -5050,6 +5051,7 @@ dependencies = [
|
||||||
"solana-thin-client",
|
"solana-thin-client",
|
||||||
"solana-tpu-client",
|
"solana-tpu-client",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -5105,6 +5107,7 @@ dependencies = [
|
||||||
"solana-storage-bigtable",
|
"solana-storage-bigtable",
|
||||||
"solana-storage-proto",
|
"solana-storage-proto",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022",
|
||||||
|
@ -5449,6 +5452,7 @@ dependencies = [
|
||||||
"solana-tpu-client",
|
"solana-tpu-client",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022",
|
||||||
|
@ -5574,6 +5578,7 @@ dependencies = [
|
||||||
"solana-stake-program",
|
"solana-stake-program",
|
||||||
"solana-system-program",
|
"solana-system-program",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
|
"solana-vote",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"solana-zk-token-proof-program",
|
"solana-zk-token-proof-program",
|
||||||
"solana-zk-token-sdk",
|
"solana-zk-token-sdk",
|
||||||
|
@ -6392,6 +6397,76 @@ dependencies = [
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "solana-vote"
|
||||||
|
version = "1.17.0"
|
||||||
|
dependencies = [
|
||||||
|
"arrayref",
|
||||||
|
"bincode",
|
||||||
|
"blake3",
|
||||||
|
"bv",
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder 1.4.3",
|
||||||
|
"bzip2",
|
||||||
|
"crossbeam-channel",
|
||||||
|
"dashmap",
|
||||||
|
"dir-diff",
|
||||||
|
"flate2",
|
||||||
|
"fnv",
|
||||||
|
"fs-err",
|
||||||
|
"im",
|
||||||
|
"index_list",
|
||||||
|
"itertools",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"lru",
|
||||||
|
"lz4",
|
||||||
|
"memmap2",
|
||||||
|
"modular-bitfield",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"num_cpus",
|
||||||
|
"num_enum 0.6.1",
|
||||||
|
"ouroboros",
|
||||||
|
"percentage",
|
||||||
|
"qualifier_attr",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rayon",
|
||||||
|
"regex",
|
||||||
|
"rustc_version",
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"siphasher",
|
||||||
|
"solana-address-lookup-table-program",
|
||||||
|
"solana-bpf-loader-program",
|
||||||
|
"solana-bucket-map",
|
||||||
|
"solana-compute-budget-program",
|
||||||
|
"solana-config-program",
|
||||||
|
"solana-cost-model",
|
||||||
|
"solana-frozen-abi",
|
||||||
|
"solana-frozen-abi-macro",
|
||||||
|
"solana-loader-v4-program",
|
||||||
|
"solana-measure",
|
||||||
|
"solana-metrics",
|
||||||
|
"solana-perf",
|
||||||
|
"solana-program-runtime",
|
||||||
|
"solana-rayon-threadlimit",
|
||||||
|
"solana-sdk",
|
||||||
|
"solana-stake-program",
|
||||||
|
"solana-system-program",
|
||||||
|
"solana-vote-program",
|
||||||
|
"solana-zk-token-proof-program",
|
||||||
|
"solana-zk-token-sdk",
|
||||||
|
"static_assertions",
|
||||||
|
"strum",
|
||||||
|
"strum_macros",
|
||||||
|
"symlink",
|
||||||
|
"tar",
|
||||||
|
"tempfile",
|
||||||
|
"thiserror",
|
||||||
|
"zstd",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-vote-program"
|
name = "solana-vote-program"
|
||||||
version = "1.17.0"
|
version = "1.17.0"
|
||||||
|
|
|
@ -51,6 +51,7 @@ solana-streamer = { workspace = true }
|
||||||
solana-tpu-client = { workspace = true }
|
solana-tpu-client = { workspace = true }
|
||||||
solana-transaction-status = { workspace = true }
|
solana-transaction-status = { workspace = true }
|
||||||
solana-version = { workspace = true }
|
solana-version = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
spl-token = { workspace = true, features = ["no-entrypoint"] }
|
spl-token = { workspace = true, features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
|
spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
|
||||||
|
|
|
@ -622,7 +622,6 @@ mod tests {
|
||||||
activate_all_features, create_genesis_config,
|
activate_all_features, create_genesis_config,
|
||||||
create_genesis_config_with_vote_accounts, GenesisConfigInfo, ValidatorVoteKeypairs,
|
create_genesis_config_with_vote_accounts, GenesisConfigInfo, ValidatorVoteKeypairs,
|
||||||
},
|
},
|
||||||
vote_transaction::VoteTransaction,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::ReadableAccount,
|
account::ReadableAccount,
|
||||||
|
@ -641,6 +640,7 @@ mod tests {
|
||||||
transaction::{self, Transaction},
|
transaction::{self, Transaction},
|
||||||
},
|
},
|
||||||
solana_stake_program::stake_state,
|
solana_stake_program::stake_state,
|
||||||
|
solana_vote::vote_transaction::VoteTransaction,
|
||||||
solana_vote_program::vote_state::Vote,
|
solana_vote_program::vote_state::Vote,
|
||||||
std::{
|
std::{
|
||||||
sync::{
|
sync::{
|
||||||
|
|
|
@ -29,7 +29,6 @@ use {
|
||||||
bank::{Bank, TransactionLogInfo},
|
bank::{Bank, TransactionLogInfo},
|
||||||
bank_forks::BankForks,
|
bank_forks::BankForks,
|
||||||
commitment::{BlockCommitmentCache, CommitmentSlots},
|
commitment::{BlockCommitmentCache, CommitmentSlots},
|
||||||
vote_transaction::VoteTransaction,
|
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{AccountSharedData, ReadableAccount},
|
account::{AccountSharedData, ReadableAccount},
|
||||||
|
@ -42,6 +41,7 @@ use {
|
||||||
solana_transaction_status::{
|
solana_transaction_status::{
|
||||||
BlockEncodingOptions, ConfirmedBlock, EncodeError, VersionedConfirmedBlock,
|
BlockEncodingOptions, ConfirmedBlock, EncodeError, VersionedConfirmedBlock,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_transaction::VoteTransaction,
|
||||||
std::{
|
std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
|
|
|
@ -66,6 +66,7 @@ solana-sdk = { workspace = true }
|
||||||
solana-stake-program = { workspace = true }
|
solana-stake-program = { workspace = true }
|
||||||
solana-system-program = { workspace = true }
|
solana-system-program = { workspace = true }
|
||||||
solana-version = { workspace = true }
|
solana-version = { workspace = true }
|
||||||
|
solana-vote = { workspace = true }
|
||||||
solana-vote-program = { workspace = true }
|
solana-vote-program = { workspace = true }
|
||||||
solana-zk-token-proof-program = { workspace = true }
|
solana-zk-token-proof-program = { workspace = true }
|
||||||
solana-zk-token-sdk = { workspace = true }
|
solana-zk-token-sdk = { workspace = true }
|
||||||
|
|
|
@ -54,7 +54,6 @@ use {
|
||||||
stakes::{InvalidCacheEntryReason, Stakes, StakesCache, StakesEnum},
|
stakes::{InvalidCacheEntryReason, Stakes, StakesCache, StakesEnum},
|
||||||
status_cache::{SlotDelta, StatusCache},
|
status_cache::{SlotDelta, StatusCache},
|
||||||
transaction_batch::TransactionBatch,
|
transaction_batch::TransactionBatch,
|
||||||
vote_account::{VoteAccount, VoteAccounts, VoteAccountsHashMap},
|
|
||||||
},
|
},
|
||||||
byteorder::{ByteOrder, LittleEndian},
|
byteorder::{ByteOrder, LittleEndian},
|
||||||
dashmap::{DashMap, DashSet},
|
dashmap::{DashMap, DashSet},
|
||||||
|
@ -178,6 +177,7 @@ use {
|
||||||
self, InflationPointCalculationEvent, PointValue, StakeStateV2,
|
self, InflationPointCalculationEvent, PointValue, StakeStateV2,
|
||||||
},
|
},
|
||||||
solana_system_program::{get_system_account_kind, SystemAccountKind},
|
solana_system_program::{get_system_account_kind, SystemAccountKind},
|
||||||
|
solana_vote::vote_account::{VoteAccount, VoteAccounts, VoteAccountsHashMap},
|
||||||
solana_vote_program::vote_state::VoteState,
|
solana_vote_program::vote_state::VoteState,
|
||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
|
|
|
@ -612,7 +612,7 @@ mod tests {
|
||||||
|
|
||||||
// This some what long test harness is required to freeze the ABI of
|
// This some what long test harness is required to freeze the ABI of
|
||||||
// Bank's serialization due to versioned nature
|
// Bank's serialization due to versioned nature
|
||||||
#[frozen_abi(digest = "5G71eC1ofQ6pqgeQLb8zaK4EQCncs5Rs51rfmMAvtF8U")]
|
#[frozen_abi(digest = "12WNiuA7qeLU8JFweQszX5sCnCj1fYnYV4i9DeACqhQD")]
|
||||||
#[derive(Serialize, AbiExample)]
|
#[derive(Serialize, AbiExample)]
|
||||||
pub struct BankAbiTestWrapperNewer {
|
pub struct BankAbiTestWrapperNewer {
|
||||||
#[serde(serialize_with = "wrapper_newer")]
|
#[serde(serialize_with = "wrapper_newer")]
|
||||||
|
|
|
@ -2,11 +2,10 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
bank::Bank,
|
bank::Bank,
|
||||||
genesis_utils::{self, GenesisConfigInfo, ValidatorVoteKeypairs},
|
genesis_utils::{self, GenesisConfigInfo, ValidatorVoteKeypairs},
|
||||||
vote_parser,
|
|
||||||
vote_sender_types::ReplayVoteSender,
|
|
||||||
},
|
},
|
||||||
solana_accounts_db::transaction_results::TransactionResults,
|
solana_accounts_db::transaction_results::TransactionResults,
|
||||||
solana_sdk::{pubkey::Pubkey, signature::Signer, transaction::SanitizedTransaction},
|
solana_sdk::{pubkey::Pubkey, signature::Signer, transaction::SanitizedTransaction},
|
||||||
|
solana_vote::{vote_parser, vote_sender_types::ReplayVoteSender},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn setup_bank_and_vote_pubkeys_for_tests(
|
pub fn setup_bank_and_vote_pubkeys_for_tests(
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use {
|
use {
|
||||||
crate::{stakes::StakesEnum, vote_account::VoteAccountsHashMap},
|
crate::stakes::StakesEnum,
|
||||||
serde::{Deserialize, Serialize},
|
serde::{Deserialize, Serialize},
|
||||||
solana_sdk::{clock::Epoch, pubkey::Pubkey},
|
solana_sdk::{clock::Epoch, pubkey::Pubkey},
|
||||||
|
solana_vote::vote_account::VoteAccountsHashMap,
|
||||||
std::{collections::HashMap, sync::Arc},
|
std::{collections::HashMap, sync::Arc},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ impl EpochStakes {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod tests {
|
pub(crate) mod tests {
|
||||||
use {
|
use {
|
||||||
super::*, crate::vote_account::VoteAccount, solana_sdk::account::AccountSharedData,
|
super::*, solana_sdk::account::AccountSharedData, solana_vote::vote_account::VoteAccount,
|
||||||
solana_vote_program::vote_state::create_account_with_authorized, std::iter,
|
solana_vote_program::vote_state::create_account_with_authorized, std::iter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,6 @@ pub mod static_ids;
|
||||||
pub mod status_cache;
|
pub mod status_cache;
|
||||||
pub mod transaction_batch;
|
pub mod transaction_batch;
|
||||||
pub mod transaction_priority_details;
|
pub mod transaction_priority_details;
|
||||||
pub mod vote_account;
|
|
||||||
pub mod vote_parser;
|
|
||||||
pub mod vote_sender_types;
|
|
||||||
pub mod vote_transaction;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate solana_metrics;
|
extern crate solana_metrics;
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
//! Stakes serve as a cache of stake and vote accounts to derive
|
//! Stakes serve as a cache of stake and vote accounts to derive
|
||||||
//! node stakes
|
//! node stakes
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{stake_account, stake_history::StakeHistory},
|
||||||
stake_account,
|
|
||||||
stake_history::StakeHistory,
|
|
||||||
vote_account::{VoteAccount, VoteAccounts},
|
|
||||||
},
|
|
||||||
dashmap::DashMap,
|
dashmap::DashMap,
|
||||||
im::HashMap as ImHashMap,
|
im::HashMap as ImHashMap,
|
||||||
log::error,
|
log::error,
|
||||||
|
@ -20,6 +16,7 @@ use {
|
||||||
stake::state::{Delegation, StakeActivationStatus},
|
stake::state::{Delegation, StakeActivationStatus},
|
||||||
vote::state::VoteStateVersions,
|
vote::state::VoteStateVersions,
|
||||||
},
|
},
|
||||||
|
solana_vote::vote_account::{VoteAccount, VoteAccounts},
|
||||||
std::{
|
std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
ops::{Add, Deref},
|
ops::{Add, Deref},
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
[package]
|
||||||
|
name = "solana-vote"
|
||||||
|
description = "Solana vote"
|
||||||
|
documentation = "https://docs.rs/solana-vote"
|
||||||
|
version = { workspace = true }
|
||||||
|
authors = { workspace = true }
|
||||||
|
repository = { workspace = true }
|
||||||
|
homepage = { workspace = true }
|
||||||
|
license = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arrayref = { workspace = true }
|
||||||
|
bincode = { workspace = true }
|
||||||
|
blake3 = { workspace = true }
|
||||||
|
bv = { workspace = true, features = ["serde"] }
|
||||||
|
bytemuck = { workspace = true }
|
||||||
|
byteorder = { workspace = true }
|
||||||
|
bzip2 = { workspace = true }
|
||||||
|
crossbeam-channel = { workspace = true }
|
||||||
|
dashmap = { workspace = true, features = ["rayon", "raw-api"] }
|
||||||
|
dir-diff = { workspace = true }
|
||||||
|
flate2 = { workspace = true }
|
||||||
|
fnv = { workspace = true }
|
||||||
|
fs-err = { workspace = true }
|
||||||
|
im = { workspace = true, features = ["rayon", "serde"] }
|
||||||
|
index_list = { workspace = true }
|
||||||
|
itertools = { workspace = true }
|
||||||
|
lazy_static = { workspace = true }
|
||||||
|
log = { workspace = true }
|
||||||
|
lru = { workspace = true }
|
||||||
|
lz4 = { workspace = true }
|
||||||
|
memmap2 = { workspace = true }
|
||||||
|
modular-bitfield = { workspace = true }
|
||||||
|
num-derive = { workspace = true }
|
||||||
|
num-traits = { workspace = true }
|
||||||
|
num_cpus = { workspace = true }
|
||||||
|
num_enum = { workspace = true }
|
||||||
|
ouroboros = { workspace = true }
|
||||||
|
percentage = { workspace = true }
|
||||||
|
qualifier_attr = { workspace = true }
|
||||||
|
rand = { workspace = true }
|
||||||
|
rayon = { workspace = true }
|
||||||
|
regex = { workspace = true }
|
||||||
|
serde = { workspace = true, features = ["rc"] }
|
||||||
|
serde_derive = { workspace = true }
|
||||||
|
siphasher = { workspace = true }
|
||||||
|
solana-address-lookup-table-program = { workspace = true }
|
||||||
|
solana-bpf-loader-program = { workspace = true }
|
||||||
|
solana-bucket-map = { workspace = true }
|
||||||
|
solana-compute-budget-program = { workspace = true }
|
||||||
|
solana-config-program = { workspace = true }
|
||||||
|
solana-cost-model = { workspace = true }
|
||||||
|
solana-frozen-abi = { workspace = true }
|
||||||
|
solana-frozen-abi-macro = { workspace = true }
|
||||||
|
solana-loader-v4-program = { workspace = true }
|
||||||
|
solana-measure = { workspace = true }
|
||||||
|
solana-metrics = { workspace = true }
|
||||||
|
solana-perf = { workspace = true }
|
||||||
|
solana-program-runtime = { workspace = true }
|
||||||
|
solana-rayon-threadlimit = { workspace = true }
|
||||||
|
solana-sdk = { workspace = true }
|
||||||
|
solana-stake-program = { workspace = true }
|
||||||
|
solana-system-program = { workspace = true }
|
||||||
|
solana-vote-program = { workspace = true }
|
||||||
|
solana-zk-token-proof-program = { workspace = true }
|
||||||
|
solana-zk-token-sdk = { workspace = true }
|
||||||
|
static_assertions = { workspace = true }
|
||||||
|
strum = { workspace = true, features = ["derive"] }
|
||||||
|
strum_macros = { workspace = true }
|
||||||
|
symlink = { workspace = true }
|
||||||
|
tar = { workspace = true }
|
||||||
|
tempfile = { workspace = true }
|
||||||
|
thiserror = { workspace = true }
|
||||||
|
zstd = { workspace = true }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["lib"]
|
||||||
|
name = "solana_vote"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
assert_matches = { workspace = true }
|
||||||
|
ed25519-dalek = { workspace = true }
|
||||||
|
libsecp256k1 = { workspace = true }
|
||||||
|
memoffset = { workspace = true }
|
||||||
|
rand_chacha = { workspace = true }
|
||||||
|
solana-logger = { workspace = true }
|
||||||
|
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
|
||||||
|
# See order-crates-for-publishing.py for using this unusual `path = "."`
|
||||||
|
solana-vote = { path = ".", features = ["dev-context-only-utils"] }
|
||||||
|
static_assertions = { workspace = true }
|
||||||
|
test-case = { workspace = true }
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
rustc_version = { workspace = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
dev-context-only-utils = []
|
|
@ -0,0 +1,27 @@
|
||||||
|
extern crate rustc_version;
|
||||||
|
use rustc_version::{version_meta, Channel};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Copied and adapted from
|
||||||
|
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
|
||||||
|
// Licensed under Apache-2.0 + MIT
|
||||||
|
match version_meta().unwrap().channel {
|
||||||
|
Channel::Stable => {
|
||||||
|
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
|
||||||
|
}
|
||||||
|
Channel::Beta => {
|
||||||
|
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
|
||||||
|
}
|
||||||
|
Channel::Nightly => {
|
||||||
|
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
|
||||||
|
}
|
||||||
|
Channel::Dev => {
|
||||||
|
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
|
||||||
|
// See https://github.com/solana-labs/solana/issues/11055
|
||||||
|
// We may be running the custom `rust-bpf-builder` toolchain,
|
||||||
|
// which currently needs `#![feature(proc_macro_hygiene)]` to
|
||||||
|
// be applied.
|
||||||
|
println!("cargo:rustc-cfg=RUSTC_NEEDS_PROC_MACRO_HYGIENE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
|
||||||
|
#![allow(clippy::integer_arithmetic)]
|
||||||
|
|
||||||
|
pub mod vote_account;
|
||||||
|
pub mod vote_parser;
|
||||||
|
pub mod vote_sender_types;
|
||||||
|
pub mod vote_transaction;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate serde_derive;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate solana_frozen_abi_macro;
|
|
@ -54,15 +54,15 @@ pub struct VoteAccounts {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VoteAccount {
|
impl VoteAccount {
|
||||||
pub(crate) fn account(&self) -> &AccountSharedData {
|
pub fn account(&self) -> &AccountSharedData {
|
||||||
&self.0.account
|
&self.0.account
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn lamports(&self) -> u64 {
|
pub fn lamports(&self) -> u64 {
|
||||||
self.0.account.lamports()
|
self.0.account.lamports()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn owner(&self) -> &Pubkey {
|
pub fn owner(&self) -> &Pubkey {
|
||||||
self.0.account.owner()
|
self.0.account.owner()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ impl VoteAccount {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_deserialized(&self) -> bool {
|
pub fn is_deserialized(&self) -> bool {
|
||||||
self.0.vote_state.get().is_some()
|
self.0.vote_state.get().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,10 +86,14 @@ impl VoteAccount {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VoteAccounts {
|
impl VoteAccounts {
|
||||||
pub(crate) fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.vote_accounts.len()
|
self.vote_accounts.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.vote_accounts.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn staked_nodes(&self) -> Arc<HashMap</*node_pubkey:*/ Pubkey, /*stake:*/ u64>> {
|
pub fn staked_nodes(&self) -> Arc<HashMap</*node_pubkey:*/ Pubkey, /*stake:*/ u64>> {
|
||||||
self.staked_nodes
|
self.staked_nodes
|
||||||
.get_or_init(|| {
|
.get_or_init(|| {
|
||||||
|
@ -109,7 +113,7 @@ impl VoteAccounts {
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get(&self, pubkey: &Pubkey) -> Option<&VoteAccount> {
|
pub fn get(&self, pubkey: &Pubkey) -> Option<&VoteAccount> {
|
||||||
let (_stake, vote_account) = self.vote_accounts.get(pubkey)?;
|
let (_stake, vote_account) = self.vote_accounts.get(pubkey)?;
|
||||||
Some(vote_account)
|
Some(vote_account)
|
||||||
}
|
}
|
||||||
|
@ -121,25 +125,25 @@ impl VoteAccounts {
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn iter(&self) -> impl Iterator<Item = (&Pubkey, &VoteAccount)> {
|
pub fn iter(&self) -> impl Iterator<Item = (&Pubkey, &VoteAccount)> {
|
||||||
self.vote_accounts
|
self.vote_accounts
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(vote_pubkey, (_stake, vote_account))| (vote_pubkey, vote_account))
|
.map(|(vote_pubkey, (_stake, vote_account))| (vote_pubkey, vote_account))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn delegated_stakes(&self) -> impl Iterator<Item = (&Pubkey, u64)> {
|
pub fn delegated_stakes(&self) -> impl Iterator<Item = (&Pubkey, u64)> {
|
||||||
self.vote_accounts
|
self.vote_accounts
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(vote_pubkey, (stake, _vote_account))| (vote_pubkey, *stake))
|
.map(|(vote_pubkey, (stake, _vote_account))| (vote_pubkey, *stake))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn find_max_by_delegated_stake(&self) -> Option<&VoteAccount> {
|
pub fn find_max_by_delegated_stake(&self) -> Option<&VoteAccount> {
|
||||||
let key = |(_pubkey, (stake, _vote_account)): &(_, &(u64, _))| *stake;
|
let key = |(_pubkey, (stake, _vote_account)): &(_, &(u64, _))| *stake;
|
||||||
let (_pubkey, (_stake, vote_account)) = self.vote_accounts.iter().max_by_key(key)?;
|
let (_pubkey, (_stake, vote_account)) = self.vote_accounts.iter().max_by_key(key)?;
|
||||||
Some(vote_account)
|
Some(vote_account)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn insert(&mut self, pubkey: Pubkey, (stake, vote_account): (u64, VoteAccount)) {
|
pub fn insert(&mut self, pubkey: Pubkey, (stake, vote_account): (u64, VoteAccount)) {
|
||||||
self.add_node_stake(stake, &vote_account);
|
self.add_node_stake(stake, &vote_account);
|
||||||
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
||||||
if let Some((stake, vote_account)) = vote_accounts.insert(pubkey, (stake, vote_account)) {
|
if let Some((stake, vote_account)) = vote_accounts.insert(pubkey, (stake, vote_account)) {
|
||||||
|
@ -147,7 +151,7 @@ impl VoteAccounts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn remove(&mut self, pubkey: &Pubkey) -> Option<(u64, VoteAccount)> {
|
pub fn remove(&mut self, pubkey: &Pubkey) -> Option<(u64, VoteAccount)> {
|
||||||
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
||||||
let entry = vote_accounts.remove(pubkey);
|
let entry = vote_accounts.remove(pubkey);
|
||||||
if let Some((stake, ref vote_account)) = entry {
|
if let Some((stake, ref vote_account)) = entry {
|
||||||
|
@ -156,7 +160,7 @@ impl VoteAccounts {
|
||||||
entry
|
entry
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_stake(&mut self, pubkey: &Pubkey, delta: u64) {
|
pub fn add_stake(&mut self, pubkey: &Pubkey, delta: u64) {
|
||||||
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
||||||
if let Some((stake, vote_account)) = vote_accounts.get_mut(pubkey) {
|
if let Some((stake, vote_account)) = vote_accounts.get_mut(pubkey) {
|
||||||
*stake += delta;
|
*stake += delta;
|
||||||
|
@ -165,7 +169,7 @@ impl VoteAccounts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn sub_stake(&mut self, pubkey: &Pubkey, delta: u64) {
|
pub fn sub_stake(&mut self, pubkey: &Pubkey, delta: u64) {
|
||||||
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
let vote_accounts = Arc::make_mut(&mut self.vote_accounts);
|
||||||
if let Some((stake, vote_account)) = vote_accounts.get_mut(pubkey) {
|
if let Some((stake, vote_account)) = vote_accounts.get_mut(pubkey) {
|
||||||
*stake = stake
|
*stake = stake
|
Loading…
Reference in New Issue