Add RPC notify and banking keys debug (#12396)
This commit is contained in:
parent
7cab638297
commit
68e5a2ef56
|
@ -17,6 +17,7 @@ use solana_client::{
|
||||||
RpcResponseContext, RpcSignatureResult, SlotInfo,
|
RpcResponseContext, RpcSignatureResult, SlotInfo,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use solana_measure::measure::Measure;
|
||||||
use solana_runtime::{
|
use solana_runtime::{
|
||||||
bank::Bank,
|
bank::Bank,
|
||||||
bank_forks::BankForks,
|
bank_forks::BankForks,
|
||||||
|
@ -445,7 +446,7 @@ impl RpcSubscriptions {
|
||||||
account_subscriptions: Arc<RpcAccountSubscriptions>,
|
account_subscriptions: Arc<RpcAccountSubscriptions>,
|
||||||
notifier: &RpcNotifier,
|
notifier: &RpcNotifier,
|
||||||
commitment_slots: &CommitmentSlots,
|
commitment_slots: &CommitmentSlots,
|
||||||
) {
|
) -> HashSet<SubscriptionId> {
|
||||||
let subscriptions = account_subscriptions.read().unwrap();
|
let subscriptions = account_subscriptions.read().unwrap();
|
||||||
check_commitment_and_notify(
|
check_commitment_and_notify(
|
||||||
&subscriptions,
|
&subscriptions,
|
||||||
|
@ -455,7 +456,7 @@ impl RpcSubscriptions {
|
||||||
Bank::get_account_modified_slot,
|
Bank::get_account_modified_slot,
|
||||||
filter_account_result,
|
filter_account_result,
|
||||||
notifier,
|
notifier,
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_program(
|
fn check_program(
|
||||||
|
@ -464,7 +465,7 @@ impl RpcSubscriptions {
|
||||||
program_subscriptions: Arc<RpcProgramSubscriptions>,
|
program_subscriptions: Arc<RpcProgramSubscriptions>,
|
||||||
notifier: &RpcNotifier,
|
notifier: &RpcNotifier,
|
||||||
commitment_slots: &CommitmentSlots,
|
commitment_slots: &CommitmentSlots,
|
||||||
) {
|
) -> HashSet<SubscriptionId> {
|
||||||
let subscriptions = program_subscriptions.read().unwrap();
|
let subscriptions = program_subscriptions.read().unwrap();
|
||||||
check_commitment_and_notify(
|
check_commitment_and_notify(
|
||||||
&subscriptions,
|
&subscriptions,
|
||||||
|
@ -474,7 +475,7 @@ impl RpcSubscriptions {
|
||||||
Bank::get_program_accounts_modified_since_parent,
|
Bank::get_program_accounts_modified_since_parent,
|
||||||
filter_program_results,
|
filter_program_results,
|
||||||
notifier,
|
notifier,
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_signature(
|
fn check_signature(
|
||||||
|
@ -483,7 +484,7 @@ impl RpcSubscriptions {
|
||||||
signature_subscriptions: Arc<RpcSignatureSubscriptions>,
|
signature_subscriptions: Arc<RpcSignatureSubscriptions>,
|
||||||
notifier: &RpcNotifier,
|
notifier: &RpcNotifier,
|
||||||
commitment_slots: &CommitmentSlots,
|
commitment_slots: &CommitmentSlots,
|
||||||
) {
|
) -> HashSet<SubscriptionId> {
|
||||||
let mut subscriptions = signature_subscriptions.write().unwrap();
|
let mut subscriptions = signature_subscriptions.write().unwrap();
|
||||||
let notified_ids = check_commitment_and_notify(
|
let notified_ids = check_commitment_and_notify(
|
||||||
&subscriptions,
|
&subscriptions,
|
||||||
|
@ -500,6 +501,7 @@ impl RpcSubscriptions {
|
||||||
subscriptions.remove(&signature);
|
subscriptions.remove(&signature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
notified_ids
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_account_subscription(
|
pub fn add_account_subscription(
|
||||||
|
@ -777,6 +779,7 @@ impl RpcSubscriptions {
|
||||||
match notification_receiver.recv_timeout(Duration::from_millis(RECEIVE_DELAY_MILLIS)) {
|
match notification_receiver.recv_timeout(Duration::from_millis(RECEIVE_DELAY_MILLIS)) {
|
||||||
Ok(notification_entry) => match notification_entry {
|
Ok(notification_entry) => match notification_entry {
|
||||||
NotificationEntry::Slot(slot_info) => {
|
NotificationEntry::Slot(slot_info) => {
|
||||||
|
debug!("slot notify: {:?}", slot_info);
|
||||||
let subscriptions = subscriptions.slot_subscriptions.read().unwrap();
|
let subscriptions = subscriptions.slot_subscriptions.read().unwrap();
|
||||||
for (_, sink) in subscriptions.iter() {
|
for (_, sink) in subscriptions.iter() {
|
||||||
notifier.notify(slot_info, sink);
|
notifier.notify(slot_info, sink);
|
||||||
|
@ -786,6 +789,7 @@ impl RpcSubscriptions {
|
||||||
// unlike `NotificationEntry::Gossip`, which also accounts for slots seen
|
// unlike `NotificationEntry::Gossip`, which also accounts for slots seen
|
||||||
// in VoteState's from bank states built in ReplayStage.
|
// in VoteState's from bank states built in ReplayStage.
|
||||||
NotificationEntry::Vote(ref vote_info) => {
|
NotificationEntry::Vote(ref vote_info) => {
|
||||||
|
debug!("vote notify: {:?}", vote_info);
|
||||||
let subscriptions = subscriptions.vote_subscriptions.read().unwrap();
|
let subscriptions = subscriptions.vote_subscriptions.read().unwrap();
|
||||||
for (_, sink) in subscriptions.iter() {
|
for (_, sink) in subscriptions.iter() {
|
||||||
notifier.notify(
|
notifier.notify(
|
||||||
|
@ -799,9 +803,12 @@ impl RpcSubscriptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NotificationEntry::Root(root) => {
|
NotificationEntry::Root(root) => {
|
||||||
let subscriptions = subscriptions.root_subscriptions.read().unwrap();
|
debug!("root notify: {:?}", root);
|
||||||
for (_, sink) in subscriptions.iter() {
|
{
|
||||||
notifier.notify(root, sink);
|
let subscriptions = subscriptions.root_subscriptions.read().unwrap();
|
||||||
|
for (_, sink) in subscriptions.iter() {
|
||||||
|
notifier.notify(root, sink);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prune old pending notifications
|
// Prune old pending notifications
|
||||||
|
@ -818,6 +825,7 @@ impl RpcSubscriptions {
|
||||||
&bank_forks,
|
&bank_forks,
|
||||||
&commitment_slots,
|
&commitment_slots,
|
||||||
¬ifier,
|
¬ifier,
|
||||||
|
"bank",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
NotificationEntry::Frozen(slot) => {
|
NotificationEntry::Frozen(slot) => {
|
||||||
|
@ -903,6 +911,7 @@ impl RpcSubscriptions {
|
||||||
bank_forks,
|
bank_forks,
|
||||||
&commitment_slots,
|
&commitment_slots,
|
||||||
¬ifier,
|
¬ifier,
|
||||||
|
"gossip",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,46 +922,76 @@ impl RpcSubscriptions {
|
||||||
bank_forks: &Arc<RwLock<BankForks>>,
|
bank_forks: &Arc<RwLock<BankForks>>,
|
||||||
commitment_slots: &CommitmentSlots,
|
commitment_slots: &CommitmentSlots,
|
||||||
notifier: &RpcNotifier,
|
notifier: &RpcNotifier,
|
||||||
|
source: &'static str,
|
||||||
) {
|
) {
|
||||||
|
let mut accounts_time = Measure::start("accounts");
|
||||||
let pubkeys: Vec<_> = {
|
let pubkeys: Vec<_> = {
|
||||||
let subs = account_subscriptions.read().unwrap();
|
let subs = account_subscriptions.read().unwrap();
|
||||||
subs.keys().cloned().collect()
|
subs.keys().cloned().collect()
|
||||||
};
|
};
|
||||||
|
let mut num_pubkeys_notified = 0;
|
||||||
for pubkey in &pubkeys {
|
for pubkey in &pubkeys {
|
||||||
Self::check_account(
|
num_pubkeys_notified += Self::check_account(
|
||||||
pubkey,
|
pubkey,
|
||||||
bank_forks,
|
bank_forks,
|
||||||
account_subscriptions.clone(),
|
account_subscriptions.clone(),
|
||||||
¬ifier,
|
¬ifier,
|
||||||
&commitment_slots,
|
&commitment_slots,
|
||||||
);
|
)
|
||||||
|
.len();
|
||||||
}
|
}
|
||||||
|
accounts_time.stop();
|
||||||
|
|
||||||
|
let mut programs_time = Measure::start("programs");
|
||||||
let programs: Vec<_> = {
|
let programs: Vec<_> = {
|
||||||
let subs = program_subscriptions.read().unwrap();
|
let subs = program_subscriptions.read().unwrap();
|
||||||
subs.keys().cloned().collect()
|
subs.keys().cloned().collect()
|
||||||
};
|
};
|
||||||
|
let mut num_programs_notified = 0;
|
||||||
for program_id in &programs {
|
for program_id in &programs {
|
||||||
Self::check_program(
|
num_programs_notified += Self::check_program(
|
||||||
program_id,
|
program_id,
|
||||||
bank_forks,
|
bank_forks,
|
||||||
program_subscriptions.clone(),
|
program_subscriptions.clone(),
|
||||||
¬ifier,
|
¬ifier,
|
||||||
&commitment_slots,
|
&commitment_slots,
|
||||||
);
|
)
|
||||||
|
.len();
|
||||||
}
|
}
|
||||||
|
programs_time.stop();
|
||||||
|
|
||||||
|
let mut signatures_time = Measure::start("signatures");
|
||||||
let signatures: Vec<_> = {
|
let signatures: Vec<_> = {
|
||||||
let subs = signature_subscriptions.read().unwrap();
|
let subs = signature_subscriptions.read().unwrap();
|
||||||
subs.keys().cloned().collect()
|
subs.keys().cloned().collect()
|
||||||
};
|
};
|
||||||
|
let mut num_signatures_notified = 0;
|
||||||
for signature in &signatures {
|
for signature in &signatures {
|
||||||
Self::check_signature(
|
num_signatures_notified += Self::check_signature(
|
||||||
signature,
|
signature,
|
||||||
bank_forks,
|
bank_forks,
|
||||||
signature_subscriptions.clone(),
|
signature_subscriptions.clone(),
|
||||||
¬ifier,
|
¬ifier,
|
||||||
&commitment_slots,
|
&commitment_slots,
|
||||||
|
)
|
||||||
|
.len();
|
||||||
|
}
|
||||||
|
signatures_time.stop();
|
||||||
|
let total_notified = num_pubkeys_notified + num_programs_notified + num_signatures_notified;
|
||||||
|
let total_ms = accounts_time.as_ms() + programs_time.as_ms() + signatures_time.as_ms();
|
||||||
|
if total_notified > 0 || total_ms > 10 {
|
||||||
|
debug!(
|
||||||
|
"notified({}): accounts: {} / {} ({}) programs: {} / {} ({}) signatures: {} / {} ({})",
|
||||||
|
source,
|
||||||
|
pubkeys.len(),
|
||||||
|
num_pubkeys_notified,
|
||||||
|
accounts_time,
|
||||||
|
programs.len(),
|
||||||
|
num_programs_notified,
|
||||||
|
programs_time,
|
||||||
|
signatures.len(),
|
||||||
|
num_signatures_notified,
|
||||||
|
signatures_time,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ pub struct ValidatorConfig {
|
||||||
pub poh_verify: bool, // Perform PoH verification during blockstore processing at boo
|
pub poh_verify: bool, // Perform PoH verification during blockstore processing at boo
|
||||||
pub cuda: bool,
|
pub cuda: bool,
|
||||||
pub require_tower: bool,
|
pub require_tower: bool,
|
||||||
|
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ValidatorConfig {
|
impl Default for ValidatorConfig {
|
||||||
|
@ -132,6 +133,7 @@ impl Default for ValidatorConfig {
|
||||||
poh_verify: true,
|
poh_verify: true,
|
||||||
cuda: false,
|
cuda: false,
|
||||||
require_tower: false,
|
require_tower: false,
|
||||||
|
debug_keys: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -788,6 +790,7 @@ fn new_banks_from_ledger(
|
||||||
dev_halt_at_slot: config.dev_halt_at_slot,
|
dev_halt_at_slot: config.dev_halt_at_slot,
|
||||||
new_hard_forks: config.new_hard_forks.clone(),
|
new_hard_forks: config.new_hard_forks.clone(),
|
||||||
frozen_accounts: config.frozen_accounts.clone(),
|
frozen_accounts: config.frozen_accounts.clone(),
|
||||||
|
debug_keys: config.debug_keys.clone(),
|
||||||
..blockstore_processor::ProcessOptions::default()
|
..blockstore_processor::ProcessOptions::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ mod tests {
|
||||||
&genesis_config_info.genesis_config,
|
&genesis_config_info.genesis_config,
|
||||||
vec![accounts_dir.path().to_path_buf()],
|
vec![accounts_dir.path().to_path_buf()],
|
||||||
&[],
|
&[],
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
bank0.freeze();
|
bank0.freeze();
|
||||||
let mut bank_forks = BankForks::new(bank0);
|
let mut bank_forks = BankForks::new(bank0);
|
||||||
|
@ -141,6 +142,7 @@ mod tests {
|
||||||
),
|
),
|
||||||
CompressionType::Bzip2,
|
CompressionType::Bzip2,
|
||||||
old_genesis_config,
|
old_genesis_config,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ pub fn load(
|
||||||
&archive_filename,
|
&archive_filename,
|
||||||
compression,
|
compression,
|
||||||
genesis_config,
|
genesis_config,
|
||||||
|
process_options.debug_keys.clone(),
|
||||||
)
|
)
|
||||||
.expect("Load from snapshot failed");
|
.expect("Load from snapshot failed");
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ use solana_sdk::{
|
||||||
use solana_vote_program::vote_state::VoteState;
|
use solana_vote_program::vote_state::VoteState;
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::HashMap,
|
collections::{HashMap, HashSet},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
result,
|
result,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
@ -311,6 +311,7 @@ pub struct ProcessOptions {
|
||||||
pub override_num_threads: Option<usize>,
|
pub override_num_threads: Option<usize>,
|
||||||
pub new_hard_forks: Option<Vec<Slot>>,
|
pub new_hard_forks: Option<Vec<Slot>>,
|
||||||
pub frozen_accounts: Vec<Pubkey>,
|
pub frozen_accounts: Vec<Pubkey>,
|
||||||
|
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initiate_callback(mut bank: &mut Arc<Bank>, genesis_config: &GenesisConfig) {
|
fn initiate_callback(mut bank: &mut Arc<Bank>, genesis_config: &GenesisConfig) {
|
||||||
|
@ -341,6 +342,7 @@ pub fn process_blockstore(
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
account_paths,
|
account_paths,
|
||||||
&opts.frozen_accounts,
|
&opts.frozen_accounts,
|
||||||
|
opts.debug_keys.clone(),
|
||||||
));
|
));
|
||||||
initiate_callback(&mut bank0, genesis_config);
|
initiate_callback(&mut bank0, genesis_config);
|
||||||
info!("processing ledger for slot 0...");
|
info!("processing ledger for slot 0...");
|
||||||
|
@ -2846,7 +2848,7 @@ pub mod tests {
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
account_paths: Vec<PathBuf>,
|
account_paths: Vec<PathBuf>,
|
||||||
) -> EpochSchedule {
|
) -> EpochSchedule {
|
||||||
let bank = Bank::new_with_paths(&genesis_config, account_paths, &[]);
|
let bank = Bank::new_with_paths(&genesis_config, account_paths, &[], None);
|
||||||
*bank.epoch_schedule()
|
*bank.epoch_schedule()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn bench_has_duplicates(bencher: &mut Bencher) {
|
||||||
#[bench]
|
#[bench]
|
||||||
fn test_accounts_create(bencher: &mut Bencher) {
|
fn test_accounts_create(bencher: &mut Bencher) {
|
||||||
let (genesis_config, _) = create_genesis_config(10_000);
|
let (genesis_config, _) = create_genesis_config(10_000);
|
||||||
let bank0 = Bank::new_with_paths(&genesis_config, vec![PathBuf::from("bench_a0")], &[]);
|
let bank0 = Bank::new_with_paths(&genesis_config, vec![PathBuf::from("bench_a0")], &[], None);
|
||||||
bencher.iter(|| {
|
bencher.iter(|| {
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
deposit_many(&bank0, &mut pubkeys, 1000);
|
deposit_many(&bank0, &mut pubkeys, 1000);
|
||||||
|
@ -50,6 +50,7 @@ fn test_accounts_squash(bencher: &mut Bencher) {
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
vec![PathBuf::from("bench_a1")],
|
vec![PathBuf::from("bench_a1")],
|
||||||
&[],
|
&[],
|
||||||
|
None,
|
||||||
));
|
));
|
||||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||||
deposit_many(&bank1, &mut pubkeys, 250_000);
|
deposit_many(&bank1, &mut pubkeys, 250_000);
|
||||||
|
|
|
@ -516,6 +516,8 @@ pub struct Bank {
|
||||||
|
|
||||||
/// Cached executors
|
/// Cached executors
|
||||||
cached_executors: Arc<RwLock<CachedExecutors>>,
|
cached_executors: Arc<RwLock<CachedExecutors>>,
|
||||||
|
|
||||||
|
transaction_debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BlockhashQueue {
|
impl Default for BlockhashQueue {
|
||||||
|
@ -526,15 +528,17 @@ impl Default for BlockhashQueue {
|
||||||
|
|
||||||
impl Bank {
|
impl Bank {
|
||||||
pub fn new(genesis_config: &GenesisConfig) -> Self {
|
pub fn new(genesis_config: &GenesisConfig) -> Self {
|
||||||
Self::new_with_paths(&genesis_config, Vec::new(), &[])
|
Self::new_with_paths(&genesis_config, Vec::new(), &[], None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_paths(
|
pub fn new_with_paths(
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut bank = Self::default();
|
let mut bank = Self::default();
|
||||||
|
bank.transaction_debug_keys = debug_keys;
|
||||||
bank.cluster_type = Some(genesis_config.cluster_type);
|
bank.cluster_type = Some(genesis_config.cluster_type);
|
||||||
bank.ancestors.insert(bank.slot(), 0);
|
bank.ancestors.insert(bank.slot(), 0);
|
||||||
|
|
||||||
|
@ -636,6 +640,7 @@ impl Bank {
|
||||||
lazy_rent_collection: AtomicBool::new(parent.lazy_rent_collection.load(Relaxed)),
|
lazy_rent_collection: AtomicBool::new(parent.lazy_rent_collection.load(Relaxed)),
|
||||||
rewards_pool_pubkeys: parent.rewards_pool_pubkeys.clone(),
|
rewards_pool_pubkeys: parent.rewards_pool_pubkeys.clone(),
|
||||||
cached_executors: parent.cached_executors.clone(),
|
cached_executors: parent.cached_executors.clone(),
|
||||||
|
transaction_debug_keys: parent.transaction_debug_keys.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
|
@ -688,6 +693,7 @@ impl Bank {
|
||||||
bank_rc: BankRc,
|
bank_rc: BankRc,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
fields: BankFieldsToDeserialize,
|
fields: BankFieldsToDeserialize,
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
fn new<T: Default>() -> T {
|
fn new<T: Default>() -> T {
|
||||||
T::default()
|
T::default()
|
||||||
|
@ -738,6 +744,7 @@ impl Bank {
|
||||||
lazy_rent_collection: new(),
|
lazy_rent_collection: new(),
|
||||||
rewards_pool_pubkeys: new(),
|
rewards_pool_pubkeys: new(),
|
||||||
cached_executors: Arc::new(RwLock::new(CachedExecutors::new(MAX_CACHED_EXECUTORS))),
|
cached_executors: Arc::new(RwLock::new(CachedExecutors::new(MAX_CACHED_EXECUTORS))),
|
||||||
|
transaction_debug_keys: debug_keys,
|
||||||
};
|
};
|
||||||
bank.finish_init(genesis_config);
|
bank.finish_init(genesis_config);
|
||||||
|
|
||||||
|
@ -2015,6 +2022,14 @@ impl Bank {
|
||||||
let mut tx_count: u64 = 0;
|
let mut tx_count: u64 = 0;
|
||||||
let err_count = &mut error_counters.total;
|
let err_count = &mut error_counters.total;
|
||||||
for ((r, _hash_age_kind), tx) in executed.iter().zip(txs.iter()) {
|
for ((r, _hash_age_kind), tx) in executed.iter().zip(txs.iter()) {
|
||||||
|
if let Some(debug_keys) = &self.transaction_debug_keys {
|
||||||
|
for key in &tx.message.account_keys {
|
||||||
|
if debug_keys.contains(key) {
|
||||||
|
info!("slot: {} result: {:?} tx: {:?}", self.slot, r, tx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if r.is_ok() {
|
if r.is_ok() {
|
||||||
tx_count += 1;
|
tx_count += 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use {
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
collections::HashMap,
|
collections::{HashMap, HashSet},
|
||||||
io::{BufReader, BufWriter, Read, Write},
|
io::{BufReader, BufWriter, Read, Write},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
result::Result,
|
result::Result,
|
||||||
|
@ -124,6 +124,7 @@ pub(crate) fn bank_from_stream<R, P>(
|
||||||
account_paths: &[PathBuf],
|
account_paths: &[PathBuf],
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> std::result::Result<Bank, Error>
|
) -> std::result::Result<Bank, Error>
|
||||||
where
|
where
|
||||||
R: Read,
|
R: Read,
|
||||||
|
@ -140,6 +141,7 @@ where
|
||||||
frozen_account_pubkeys,
|
frozen_account_pubkeys,
|
||||||
account_paths,
|
account_paths,
|
||||||
append_vecs_path,
|
append_vecs_path,
|
||||||
|
debug_keys,
|
||||||
)?;
|
)?;
|
||||||
Ok(bank)
|
Ok(bank)
|
||||||
}};
|
}};
|
||||||
|
@ -224,6 +226,7 @@ fn reconstruct_bank_from_fields<E, P>(
|
||||||
frozen_account_pubkeys: &[Pubkey],
|
frozen_account_pubkeys: &[Pubkey],
|
||||||
account_paths: &[PathBuf],
|
account_paths: &[PathBuf],
|
||||||
append_vecs_path: P,
|
append_vecs_path: P,
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> Result<Bank, Error>
|
) -> Result<Bank, Error>
|
||||||
where
|
where
|
||||||
E: Into<AccountStorageEntry>,
|
E: Into<AccountStorageEntry>,
|
||||||
|
@ -238,7 +241,7 @@ where
|
||||||
accounts_db.freeze_accounts(&bank_fields.ancestors, frozen_account_pubkeys);
|
accounts_db.freeze_accounts(&bank_fields.ancestors, frozen_account_pubkeys);
|
||||||
|
|
||||||
let bank_rc = BankRc::new(Accounts::new_empty(accounts_db), bank_fields.slot);
|
let bank_rc = BankRc::new(Accounts::new_empty(accounts_db), bank_fields.slot);
|
||||||
let bank = Bank::new_from_fields(bank_rc, genesis_config, bank_fields);
|
let bank = Bank::new_from_fields(bank_rc, genesis_config, bank_fields, debug_keys);
|
||||||
|
|
||||||
Ok(bank)
|
Ok(bank)
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,7 @@ fn test_bank_serialize_style(serde_style: SerdeStyle) {
|
||||||
&dbank_paths,
|
&dbank_paths,
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
&[],
|
&[],
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
dbank.src = ref_sc;
|
dbank.src = ref_sc;
|
||||||
|
|
|
@ -20,6 +20,8 @@ use solana_sdk::{
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
};
|
};
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use std::sync::Arc;
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
fmt,
|
fmt,
|
||||||
|
@ -571,6 +573,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||||
snapshot_tar: P,
|
snapshot_tar: P,
|
||||||
compression: CompressionType,
|
compression: CompressionType,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> Result<Bank> {
|
) -> Result<Bank> {
|
||||||
// Untar the snapshot into a temp directory under `snapshot_config.snapshot_path()`
|
// Untar the snapshot into a temp directory under `snapshot_config.snapshot_path()`
|
||||||
let unpack_dir = tempfile::tempdir_in(snapshot_path)?;
|
let unpack_dir = tempfile::tempdir_in(snapshot_path)?;
|
||||||
|
@ -591,6 +594,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
||||||
&unpacked_snapshots_dir,
|
&unpacked_snapshots_dir,
|
||||||
unpacked_accounts_dir,
|
unpacked_accounts_dir,
|
||||||
genesis_config,
|
genesis_config,
|
||||||
|
debug_keys,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if !bank.verify_snapshot_bank() {
|
if !bank.verify_snapshot_bank() {
|
||||||
|
@ -748,6 +752,7 @@ fn rebuild_bank_from_snapshots<P>(
|
||||||
unpacked_snapshots_dir: &PathBuf,
|
unpacked_snapshots_dir: &PathBuf,
|
||||||
append_vecs_path: P,
|
append_vecs_path: P,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
|
debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||||
) -> Result<Bank>
|
) -> Result<Bank>
|
||||||
where
|
where
|
||||||
P: AsRef<Path>,
|
P: AsRef<Path>,
|
||||||
|
@ -779,6 +784,7 @@ where
|
||||||
account_paths,
|
account_paths,
|
||||||
genesis_config,
|
genesis_config,
|
||||||
frozen_account_pubkeys,
|
frozen_account_pubkeys,
|
||||||
|
debug_keys,
|
||||||
),
|
),
|
||||||
}?)
|
}?)
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -1127,6 +1127,15 @@ pub fn main() {
|
||||||
.help("A snapshot hash must be published in gossip by this validator to be accepted. \
|
.help("A snapshot hash must be published in gossip by this validator to be accepted. \
|
||||||
May be specified multiple times. If unspecified any snapshot hash will be accepted"),
|
May be specified multiple times. If unspecified any snapshot hash will be accepted"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("debug_key")
|
||||||
|
.long("debug-key")
|
||||||
|
.validator(is_pubkey)
|
||||||
|
.value_name("PUBKEY")
|
||||||
|
.multiple(true)
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Log when transactions are processed which reference a given key."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("no_untrusted_rpc")
|
Arg::with_name("no_untrusted_rpc")
|
||||||
.long("no-untrusted-rpc")
|
.long("no-untrusted-rpc")
|
||||||
|
@ -1264,6 +1273,16 @@ pub fn main() {
|
||||||
exit(1);
|
exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let debug_keys: Option<Arc<HashSet<_>>> = if matches.is_present("debug_key") {
|
||||||
|
Some(Arc::new(
|
||||||
|
values_t_or_exit!(matches, "debug_key", Pubkey)
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let trusted_validators = validators_set(
|
let trusted_validators = validators_set(
|
||||||
&identity_keypair.pubkey(),
|
&identity_keypair.pubkey(),
|
||||||
&matches,
|
&matches,
|
||||||
|
@ -1339,6 +1358,7 @@ pub fn main() {
|
||||||
no_rocksdb_compaction,
|
no_rocksdb_compaction,
|
||||||
wal_recovery_mode,
|
wal_recovery_mode,
|
||||||
poh_verify: !matches.is_present("skip_poh_verify"),
|
poh_verify: !matches.is_present("skip_poh_verify"),
|
||||||
|
debug_keys,
|
||||||
..ValidatorConfig::default()
|
..ValidatorConfig::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue