Skip to content

Commit

Permalink
Spins up AccountsHashVerifier in ledger-tool (#31358)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Apr 26, 2023
1 parent 2d91c52 commit c73b654
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ledger-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ solana-cli-output = { workspace = true }
solana-core = { workspace = true }
solana-entry = { workspace = true }
solana-geyser-plugin-manager = { workspace = true }
solana-gossip = { workspace = true }
solana-ledger = { workspace = true }
solana-logger = { workspace = true }
solana-measure = { workspace = true }
Expand All @@ -38,6 +39,7 @@ solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-stake-program = { workspace = true }
solana-storage-bigtable = { workspace = true }
solana-streamer = { workspace = true }
solana-transaction-status = { workspace = true }
solana-version = { workspace = true }
solana-vote-program = { workspace = true }
Expand Down
28 changes: 26 additions & 2 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ use {
},
solana_cli_output::{CliAccount, CliAccountNewConfig, OutputFormat},
solana_core::{
accounts_hash_verifier::AccountsHashVerifier,
system_monitor_service::{SystemMonitorService, SystemMonitorStatsReportConfig},
validator::BlockVerificationMethod,
},
solana_entry::entry::Entry,
solana_geyser_plugin_manager::geyser_plugin_service::GeyserPluginService,
solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo},
solana_ledger::{
ancestor_iterator::AncestorIterator,
bank_forks_utils,
Expand Down Expand Up @@ -92,13 +94,17 @@ use {
pubkey::Pubkey,
rent::Rent,
shred_version::compute_shred_version,
signature::Signer,
signer::keypair::Keypair,
stake::{self, state::StakeState},
system_program,
timing::timestamp,
transaction::{
MessageHash, SanitizedTransaction, SimpleAddressLoader, VersionedTransaction,
},
},
solana_stake_program::stake_state::{self, PointValue},
solana_streamer::socket::SocketAddrSpace,
solana_vote_program::{
self,
vote_state::{self, VoteState},
Expand Down Expand Up @@ -1261,8 +1267,26 @@ fn load_bank_forks(
block_verification_method,
);

let exit = Arc::new(AtomicBool::new(false));
let node_id = Arc::new(Keypair::new());
let cluster_info = Arc::new(ClusterInfo::new(
ContactInfo::new_localhost(&node_id.pubkey(), timestamp()),
Arc::clone(&node_id),
SocketAddrSpace::Unspecified,
));
let (accounts_package_sender, accounts_package_receiver) = crossbeam_channel::unbounded();
let accounts_hash_verifier = AccountsHashVerifier::new(
accounts_package_sender.clone(),
accounts_package_receiver,
None,
exit.clone(),
cluster_info,
None,
false,
None,
SnapshotConfig::new_load_only(),
);
let (snapshot_request_sender, snapshot_request_receiver) = crossbeam_channel::unbounded();
let (accounts_package_sender, _accounts_package_receiver) = crossbeam_channel::unbounded();
let accounts_background_request_sender = AbsRequestSender::new(snapshot_request_sender.clone());
let snapshot_request_handler = SnapshotRequestHandler {
snapshot_config: SnapshotConfig::new_load_only(),
Expand All @@ -1279,7 +1303,6 @@ fn load_bank_forks(
snapshot_request_handler,
pruned_banks_request_handler,
};
let exit = Arc::new(AtomicBool::new(false));
let accounts_background_service = AccountsBackgroundService::new(
bank_forks.clone(),
exit.clone(),
Expand Down Expand Up @@ -1323,6 +1346,7 @@ fn load_bank_forks(

exit.store(true, Ordering::Relaxed);
accounts_background_service.join().unwrap();
accounts_hash_verifier.join().unwrap();
if let Some(service) = transaction_status_service {
service.join().unwrap();
}
Expand Down

0 comments on commit c73b654

Please sign in to comment.