Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spins up AccountsHashVerifier in ledger-tool #31358

Merged
merged 1 commit into from
Apr 26, 2023
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
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,
));
Comment on lines +1271 to +1276
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AccountsHashVerifier needs a ClusterInfo to push the accounts hashes to gossip. But since we don't actually care about gossip in ledger-tool, just use default/dummy values.

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(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, we could use the snapshot_config that was created above, but we don't want to create and snapshot archives with AHV here; it's only used to service EAH requests.

);
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