From 2396d62be0926f8ace82d0ae982be867d45370fe Mon Sep 17 00:00:00 2001 From: brooks Date: Wed, 26 Apr 2023 10:39:52 -0400 Subject: [PATCH] Spins up AccountsHashVerifier in ledger-tool --- Cargo.lock | 2 ++ ledger-tool/Cargo.toml | 2 ++ ledger-tool/src/main.rs | 28 ++++++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06287d68630863..67572f7d89ff7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6013,6 +6013,7 @@ dependencies = [ "solana-core", "solana-entry", "solana-geyser-plugin-manager", + "solana-gossip", "solana-ledger", "solana-logger 1.16.0", "solana-measure", @@ -6021,6 +6022,7 @@ dependencies = [ "solana-sdk 1.16.0", "solana-stake-program", "solana-storage-bigtable", + "solana-streamer", "solana-transaction-status", "solana-version", "solana-vote-program", diff --git a/ledger-tool/Cargo.toml b/ledger-tool/Cargo.toml index 09a7c622327710..aaaf336d502f24 100644 --- a/ledger-tool/Cargo.toml +++ b/ledger-tool/Cargo.toml @@ -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 } @@ -37,6 +38,7 @@ solana-rpc = { workspace = true } solana-runtime = { workspace = true } solana-sdk = { workspace = true } solana-stake-program = { workspace = true } +solana-streamer = { workspace = true } solana-storage-bigtable = { workspace = true } solana-transaction-status = { workspace = true } solana-version = { workspace = true } diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index a268f87c16ae37..79a61d7e28522d 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -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, @@ -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}, @@ -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(), @@ -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(), @@ -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(); }