Rename "trusted" to "known" in validators/
(#21197)
* Replaced trusted with known validator * Format Convention
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Service to verify accounts hashes with other trusted validator nodes.
|
||||
// Service to verify accounts hashes with other known validator nodes.
|
||||
//
|
||||
// Each interval, publish the snapshat hash which is the full accounts state
|
||||
// hash on gossip. Monitor gossip for messages from validators in the `--known-validator`s
|
||||
@ -40,8 +40,8 @@ impl AccountsHashVerifier {
|
||||
pending_snapshot_package: Option<PendingSnapshotPackage>,
|
||||
exit: &Arc<AtomicBool>,
|
||||
cluster_info: &Arc<ClusterInfo>,
|
||||
trusted_validators: Option<HashSet<Pubkey>>,
|
||||
halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
||||
known_validators: Option<HashSet<Pubkey>>,
|
||||
halt_on_known_validators_accounts_hash_mismatch: bool,
|
||||
fault_injection_rate_slots: u64,
|
||||
snapshot_config: Option<SnapshotConfig>,
|
||||
ledger_path: PathBuf,
|
||||
@ -68,8 +68,8 @@ impl AccountsHashVerifier {
|
||||
Self::process_accounts_package(
|
||||
accounts_package,
|
||||
&cluster_info,
|
||||
trusted_validators.as_ref(),
|
||||
halt_on_trusted_validators_accounts_hash_mismatch,
|
||||
known_validators.as_ref(),
|
||||
halt_on_known_validators_accounts_hash_mismatch,
|
||||
pending_snapshot_package.as_ref(),
|
||||
&mut hashes,
|
||||
&exit,
|
||||
@ -94,8 +94,8 @@ impl AccountsHashVerifier {
|
||||
fn process_accounts_package(
|
||||
accounts_package: AccountsPackage,
|
||||
cluster_info: &ClusterInfo,
|
||||
trusted_validators: Option<&HashSet<Pubkey>>,
|
||||
halt_on_trusted_validator_accounts_hash_mismatch: bool,
|
||||
known_validators: Option<&HashSet<Pubkey>>,
|
||||
halt_on_known_validator_accounts_hash_mismatch: bool,
|
||||
pending_snapshot_package: Option<&PendingSnapshotPackage>,
|
||||
hashes: &mut Vec<(Slot, Hash)>,
|
||||
exit: &Arc<AtomicBool>,
|
||||
@ -109,8 +109,8 @@ impl AccountsHashVerifier {
|
||||
Self::push_accounts_hashes_to_cluster(
|
||||
&accounts_package,
|
||||
cluster_info,
|
||||
trusted_validators,
|
||||
halt_on_trusted_validator_accounts_hash_mismatch,
|
||||
known_validators,
|
||||
halt_on_known_validator_accounts_hash_mismatch,
|
||||
hashes,
|
||||
exit,
|
||||
fault_injection_rate_slots,
|
||||
@ -152,8 +152,8 @@ impl AccountsHashVerifier {
|
||||
fn push_accounts_hashes_to_cluster(
|
||||
accounts_package: &AccountsPackage,
|
||||
cluster_info: &ClusterInfo,
|
||||
trusted_validators: Option<&HashSet<Pubkey>>,
|
||||
halt_on_trusted_validator_accounts_hash_mismatch: bool,
|
||||
known_validators: Option<&HashSet<Pubkey>>,
|
||||
halt_on_known_validator_accounts_hash_mismatch: bool,
|
||||
hashes: &mut Vec<(Slot, Hash)>,
|
||||
exit: &Arc<AtomicBool>,
|
||||
fault_injection_rate_slots: u64,
|
||||
@ -177,12 +177,12 @@ impl AccountsHashVerifier {
|
||||
hashes.remove(0);
|
||||
}
|
||||
|
||||
if halt_on_trusted_validator_accounts_hash_mismatch {
|
||||
if halt_on_known_validator_accounts_hash_mismatch {
|
||||
let mut slot_to_hash = HashMap::new();
|
||||
for (slot, hash) in hashes.iter() {
|
||||
slot_to_hash.insert(*slot, *hash);
|
||||
}
|
||||
if Self::should_halt(cluster_info, trusted_validators, &mut slot_to_hash) {
|
||||
if Self::should_halt(cluster_info, known_validators, &mut slot_to_hash) {
|
||||
exit.store(true, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
@ -226,20 +226,20 @@ impl AccountsHashVerifier {
|
||||
|
||||
fn should_halt(
|
||||
cluster_info: &ClusterInfo,
|
||||
trusted_validators: Option<&HashSet<Pubkey>>,
|
||||
known_validators: Option<&HashSet<Pubkey>>,
|
||||
slot_to_hash: &mut HashMap<Slot, Hash>,
|
||||
) -> bool {
|
||||
let mut verified_count = 0;
|
||||
let mut highest_slot = 0;
|
||||
if let Some(trusted_validators) = trusted_validators {
|
||||
for trusted_validator in trusted_validators {
|
||||
let is_conflicting = cluster_info.get_accounts_hash_for_node(trusted_validator, |accounts_hashes|
|
||||
if let Some(known_validators) = known_validators {
|
||||
for known_validator in known_validators {
|
||||
let is_conflicting = cluster_info.get_accounts_hash_for_node(known_validator, |accounts_hashes|
|
||||
{
|
||||
accounts_hashes.iter().any(|(slot, hash)| {
|
||||
if let Some(reference_hash) = slot_to_hash.get(slot) {
|
||||
if *hash != *reference_hash {
|
||||
error!("Trusted validator {} produced conflicting hashes for slot: {} ({} != {})",
|
||||
trusted_validator,
|
||||
error!("Known validator {} produced conflicting hashes for slot: {} ({} != {})",
|
||||
known_validator,
|
||||
slot,
|
||||
hash,
|
||||
reference_hash,
|
||||
@ -303,11 +303,11 @@ mod tests {
|
||||
let cluster_info = new_test_cluster_info(contact_info);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
|
||||
let mut trusted_validators = HashSet::new();
|
||||
let mut known_validators = HashSet::new();
|
||||
let mut slot_to_hash = HashMap::new();
|
||||
assert!(!AccountsHashVerifier::should_halt(
|
||||
&cluster_info,
|
||||
Some(&trusted_validators),
|
||||
Some(&known_validators),
|
||||
&mut slot_to_hash,
|
||||
));
|
||||
|
||||
@ -320,10 +320,10 @@ mod tests {
|
||||
cluster_info.flush_push_queue();
|
||||
}
|
||||
slot_to_hash.insert(0, hash2);
|
||||
trusted_validators.insert(validator1.pubkey());
|
||||
known_validators.insert(validator1.pubkey());
|
||||
assert!(AccountsHashVerifier::should_halt(
|
||||
&cluster_info,
|
||||
Some(&trusted_validators),
|
||||
Some(&known_validators),
|
||||
&mut slot_to_hash,
|
||||
));
|
||||
}
|
||||
@ -339,7 +339,7 @@ mod tests {
|
||||
let cluster_info = new_test_cluster_info(contact_info);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
|
||||
let trusted_validators = HashSet::new();
|
||||
let known_validators = HashSet::new();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let mut hashes = vec![];
|
||||
let full_snapshot_archive_interval_slots = 100;
|
||||
@ -370,7 +370,7 @@ mod tests {
|
||||
AccountsHashVerifier::process_accounts_package(
|
||||
accounts_package,
|
||||
&cluster_info,
|
||||
Some(&trusted_validators),
|
||||
Some(&known_validators),
|
||||
false,
|
||||
None,
|
||||
&mut hashes,
|
||||
|
@ -1246,23 +1246,23 @@ mod tests {
|
||||
// 2) repair validator set only includes our own id
|
||||
// then no repairs should be generated
|
||||
for pubkey in &[solana_sdk::pubkey::new_rand(), me.id] {
|
||||
let trusted_validators = Some(vec![*pubkey].into_iter().collect());
|
||||
assert!(serve_repair.repair_peers(&trusted_validators, 1).is_empty());
|
||||
let known_validators = Some(vec![*pubkey].into_iter().collect());
|
||||
assert!(serve_repair.repair_peers(&known_validators, 1).is_empty());
|
||||
assert!(serve_repair
|
||||
.repair_request(
|
||||
&cluster_slots,
|
||||
ShredRepairType::Shred(0, 0),
|
||||
&mut LruCache::new(100),
|
||||
&mut RepairStats::default(),
|
||||
&trusted_validators,
|
||||
&known_validators,
|
||||
&mut OutstandingShredRepairs::default(),
|
||||
)
|
||||
.is_err());
|
||||
}
|
||||
|
||||
// If trusted validator exists in gossip, should return repair successfully
|
||||
let trusted_validators = Some(vec![contact_info2.id].into_iter().collect());
|
||||
let repair_peers = serve_repair.repair_peers(&trusted_validators, 1);
|
||||
// If known validator exists in gossip, should return repair successfully
|
||||
let known_validators = Some(vec![contact_info2.id].into_iter().collect());
|
||||
let repair_peers = serve_repair.repair_peers(&known_validators, 1);
|
||||
assert_eq!(repair_peers.len(), 1);
|
||||
assert_eq!(repair_peers[0].id, contact_info2.id);
|
||||
assert!(serve_repair
|
||||
@ -1271,12 +1271,12 @@ mod tests {
|
||||
ShredRepairType::Shred(0, 0),
|
||||
&mut LruCache::new(100),
|
||||
&mut RepairStats::default(),
|
||||
&trusted_validators,
|
||||
&known_validators,
|
||||
&mut OutstandingShredRepairs::default(),
|
||||
)
|
||||
.is_ok());
|
||||
|
||||
// Using no trusted validators should default to all
|
||||
// Using no known validators should default to all
|
||||
// validator's available in gossip, excluding myself
|
||||
let repair_peers: HashSet<Pubkey> = serve_repair
|
||||
.repair_peers(&None, 1)
|
||||
|
@ -82,8 +82,8 @@ pub struct Sockets {
|
||||
pub struct TvuConfig {
|
||||
pub max_ledger_shreds: Option<u64>,
|
||||
pub shred_version: u16,
|
||||
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
||||
pub trusted_validators: Option<HashSet<Pubkey>>,
|
||||
pub halt_on_known_validators_accounts_hash_mismatch: bool,
|
||||
pub known_validators: Option<HashSet<Pubkey>>,
|
||||
pub repair_validators: Option<HashSet<Pubkey>>,
|
||||
pub accounts_hash_fault_injection_slots: u64,
|
||||
pub accounts_db_caching_enabled: bool,
|
||||
@ -220,8 +220,8 @@ impl Tvu {
|
||||
pending_snapshot_package,
|
||||
exit,
|
||||
cluster_info,
|
||||
tvu_config.trusted_validators.clone(),
|
||||
tvu_config.halt_on_trusted_validators_accounts_hash_mismatch,
|
||||
tvu_config.known_validators.clone(),
|
||||
tvu_config.halt_on_known_validators_accounts_hash_mismatch,
|
||||
tvu_config.accounts_hash_fault_injection_slots,
|
||||
snapshot_config.clone(),
|
||||
blockstore.ledger_path().to_path_buf(),
|
||||
|
@ -130,10 +130,10 @@ pub struct ValidatorConfig {
|
||||
pub fixed_leader_schedule: Option<FixedSchedule>,
|
||||
pub wait_for_supermajority: Option<Slot>,
|
||||
pub new_hard_forks: Option<Vec<Slot>>,
|
||||
pub trusted_validators: Option<HashSet<Pubkey>>, // None = trust all
|
||||
pub repair_validators: Option<HashSet<Pubkey>>, // None = repair from all
|
||||
pub gossip_validators: Option<HashSet<Pubkey>>, // None = gossip with all
|
||||
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
||||
pub known_validators: Option<HashSet<Pubkey>>, // None = trust all
|
||||
pub repair_validators: Option<HashSet<Pubkey>>, // None = repair from all
|
||||
pub gossip_validators: Option<HashSet<Pubkey>>, // None = gossip with all
|
||||
pub halt_on_known_validators_accounts_hash_mismatch: bool,
|
||||
pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection
|
||||
pub frozen_accounts: Vec<Pubkey>,
|
||||
pub no_rocksdb_compaction: bool,
|
||||
@ -190,10 +190,10 @@ impl Default for ValidatorConfig {
|
||||
fixed_leader_schedule: None,
|
||||
wait_for_supermajority: None,
|
||||
new_hard_forks: None,
|
||||
trusted_validators: None,
|
||||
known_validators: None,
|
||||
repair_validators: None,
|
||||
gossip_validators: None,
|
||||
halt_on_trusted_validators_accounts_hash_mismatch: false,
|
||||
halt_on_known_validators_accounts_hash_mismatch: false,
|
||||
accounts_hash_fault_injection_slots: 0,
|
||||
frozen_accounts: vec![],
|
||||
no_rocksdb_compaction: false,
|
||||
@ -612,7 +612,7 @@ impl Validator {
|
||||
genesis_config.hash(),
|
||||
ledger_path,
|
||||
config.validator_exit.clone(),
|
||||
config.trusted_validators.clone(),
|
||||
config.known_validators.clone(),
|
||||
rpc_override_health_check.clone(),
|
||||
optimistically_confirmed_bank.clone(),
|
||||
config.send_transaction_service_config.clone(),
|
||||
@ -827,10 +827,10 @@ impl Validator {
|
||||
cluster_confirmed_slot_receiver,
|
||||
TvuConfig {
|
||||
max_ledger_shreds: config.max_ledger_shreds,
|
||||
halt_on_trusted_validators_accounts_hash_mismatch: config
|
||||
.halt_on_trusted_validators_accounts_hash_mismatch,
|
||||
halt_on_known_validators_accounts_hash_mismatch: config
|
||||
.halt_on_known_validators_accounts_hash_mismatch,
|
||||
shred_version: node.info.shred_version,
|
||||
trusted_validators: config.trusted_validators.clone(),
|
||||
known_validators: config.known_validators.clone(),
|
||||
repair_validators: config.repair_validators.clone(),
|
||||
accounts_hash_fault_injection_slots: config.accounts_hash_fault_injection_slots,
|
||||
accounts_db_caching_enabled: config.accounts_db_caching_enabled,
|
||||
|
Reference in New Issue
Block a user