From ba9dfa0d229ef9bea36712cf1941fef729eab460 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sun, 28 Nov 2021 21:55:35 -0800 Subject: [PATCH] Remove frozen account support --- core/src/validator.rs | 3 - core/tests/snapshots.rs | 4 - ledger/src/bank_forks_utils.rs | 1 - ledger/src/blockstore_processor.rs | 3 - local-cluster/src/validator_configs.rs | 1 - local-cluster/tests/local_cluster.rs | 116 ------------- replica-node/src/replica_node.rs | 1 - runtime/benches/accounts.rs | 2 - runtime/src/accounts_db.rs | 220 +------------------------ runtime/src/bank.rs | 14 -- runtime/src/serde_snapshot.rs | 10 +- runtime/src/serde_snapshot/tests.rs | 1 - runtime/src/snapshot_utils.rs | 13 -- validator/src/main.rs | 12 -- 14 files changed, 2 insertions(+), 399 deletions(-) diff --git a/core/src/validator.rs b/core/src/validator.rs index f081ea7328..61e403ca9d 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -136,7 +136,6 @@ pub struct ValidatorConfig { pub gossip_validators: Option>, // 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, pub no_rocksdb_compaction: bool, pub rocksdb_compaction_interval: Option, pub rocksdb_max_compaction_jitter: Option, @@ -197,7 +196,6 @@ impl Default for ValidatorConfig { gossip_validators: None, halt_on_known_validators_accounts_hash_mismatch: false, accounts_hash_fault_injection_slots: 0, - frozen_accounts: vec![], no_rocksdb_compaction: false, rocksdb_compaction_interval: None, rocksdb_max_compaction_jitter: None, @@ -1276,7 +1274,6 @@ fn new_banks_from_ledger( poh_verify, dev_halt_at_slot: config.dev_halt_at_slot, new_hard_forks: config.new_hard_forks.clone(), - frozen_accounts: config.frozen_accounts.clone(), debug_keys: config.debug_keys.clone(), account_indexes: config.account_indexes.clone(), accounts_db_caching_enabled: config.accounts_db_caching_enabled, diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index 97412cea8e..1961ce0fb7 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -126,7 +126,6 @@ mod tests { let bank0 = Bank::new_with_paths_for_tests( &genesis_config_info.genesis_config, vec![accounts_dir.path().to_path_buf()], - &[], None, None, AccountSecondaryIndexes::default(), @@ -184,7 +183,6 @@ mod tests { let (deserialized_bank, _timing) = snapshot_utils::bank_from_snapshot_archives( account_paths, - &[], &old_bank_forks .snapshot_config .as_ref() @@ -828,7 +826,6 @@ mod tests { &snapshot_config.bank_snapshots_dir, &snapshot_config.snapshot_archives_dir, &[accounts_dir], - &[], genesis_config, None, None, @@ -1008,7 +1005,6 @@ mod tests { &snapshot_test_config.snapshot_config.bank_snapshots_dir, &snapshot_test_config.snapshot_config.snapshot_archives_dir, &[snapshot_test_config.accounts_dir.as_ref().to_path_buf()], - &[], &snapshot_test_config.genesis_config_info.genesis_config, None, None, diff --git a/ledger/src/bank_forks_utils.rs b/ledger/src/bank_forks_utils.rs index 9323dd8dff..e1e9a322cb 100644 --- a/ledger/src/bank_forks_utils.rs +++ b/ledger/src/bank_forks_utils.rs @@ -169,7 +169,6 @@ fn load_from_snapshot( &snapshot_config.bank_snapshots_dir, &snapshot_config.snapshot_archives_dir, &account_paths, - &process_options.frozen_accounts, genesis_config, process_options.debug_keys.clone(), Some(&crate::builtins::get(process_options.bpf_jit)), diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index 6f7ccdaf41..3393f0985f 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -464,7 +464,6 @@ pub struct ProcessOptions { pub entry_callback: Option, pub override_num_threads: Option, pub new_hard_forks: Option>, - pub frozen_accounts: Vec, pub debug_keys: Option>>, pub account_indexes: AccountSecondaryIndexes, pub accounts_db_caching_enabled: bool, @@ -500,7 +499,6 @@ pub fn process_blockstore( let bank0 = Bank::new_with_paths( genesis_config, account_paths, - &opts.frozen_accounts, opts.debug_keys.clone(), Some(&crate::builtins::get(opts.bpf_jit)), opts.account_indexes.clone(), @@ -3376,7 +3374,6 @@ pub mod tests { let bank = Bank::new_with_paths_for_tests( genesis_config, account_paths, - &[], None, None, AccountSecondaryIndexes::default(), diff --git a/local-cluster/src/validator_configs.rs b/local-cluster/src/validator_configs.rs index 13f769bd78..3e77611662 100644 --- a/local-cluster/src/validator_configs.rs +++ b/local-cluster/src/validator_configs.rs @@ -30,7 +30,6 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig { halt_on_known_validators_accounts_hash_mismatch: config .halt_on_known_validators_accounts_hash_mismatch, accounts_hash_fault_injection_slots: config.accounts_hash_fault_injection_slots, - frozen_accounts: config.frozen_accounts.clone(), no_rocksdb_compaction: config.no_rocksdb_compaction, rocksdb_compaction_interval: config.rocksdb_compaction_interval, rocksdb_max_compaction_jitter: config.rocksdb_max_compaction_jitter, diff --git a/local-cluster/tests/local_cluster.rs b/local-cluster/tests/local_cluster.rs index accd56c912..40a4eff32c 100644 --- a/local-cluster/tests/local_cluster.rs +++ b/local-cluster/tests/local_cluster.rs @@ -1440,122 +1440,6 @@ fn test_mainnet_beta_cluster_type() { } } -fn generate_frozen_account_panic(mut cluster: LocalCluster, frozen_account: Arc) { - let client = cluster - .get_validator_client(&frozen_account.pubkey()) - .unwrap(); - - // Check the validator is alive by poking it over RPC - trace!( - "validator slot: {}", - client - .get_slot_with_commitment(CommitmentConfig::processed()) - .expect("get slot") - ); - - // Reset the frozen account panic signal - solana_runtime::accounts_db::FROZEN_ACCOUNT_PANIC.store(false, Ordering::Relaxed); - - // Wait for the frozen account panic signal - let mut i = 0; - while !solana_runtime::accounts_db::FROZEN_ACCOUNT_PANIC.load(Ordering::Relaxed) { - // Transfer from frozen account - let (blockhash, _) = client - .get_latest_blockhash_with_commitment(CommitmentConfig::processed()) - .unwrap(); - client - .async_transfer( - 1, - &frozen_account, - &solana_sdk::pubkey::new_rand(), - blockhash, - ) - .unwrap(); - - sleep(Duration::from_secs(1)); - i += 1; - assert!(i <= 10, "FROZEN_ACCOUNT_PANIC still false"); - } - - // The validator is now broken and won't shutdown properly. Avoid LocalCluster panic in Drop - // with some manual cleanup: - cluster.exit(); - cluster.validators = HashMap::default(); -} - -#[test] -#[serial] -fn test_frozen_account_from_genesis() { - solana_logger::setup_with_default(RUST_LOG_FILTER); - let validator_identity = - Arc::new(solana_sdk::signature::keypair_from_seed(&[0u8; 32]).unwrap()); - - let mut config = ClusterConfig { - validator_keys: Some(vec![(validator_identity.clone(), true)]), - node_stakes: vec![100; 1], - cluster_lamports: 1_000, - validator_configs: vec![ValidatorConfig { - // Freeze the validator identity account - frozen_accounts: vec![validator_identity.pubkey()], - ..ValidatorConfig::default() - }], - ..ClusterConfig::default() - }; - generate_frozen_account_panic( - LocalCluster::new(&mut config, SocketAddrSpace::Unspecified), - validator_identity, - ); -} - -#[test] -#[serial] -fn test_frozen_account_from_snapshot() { - solana_logger::setup_with_default(RUST_LOG_FILTER); - let validator_identity = - Arc::new(solana_sdk::signature::keypair_from_seed(&[0u8; 32]).unwrap()); - - let mut snapshot_test_config = setup_snapshot_validator_config(5, 1); - // Freeze the validator identity account - snapshot_test_config.validator_config.frozen_accounts = vec![validator_identity.pubkey()]; - - let mut config = ClusterConfig { - validator_keys: Some(vec![(validator_identity.clone(), true)]), - node_stakes: vec![100; 1], - cluster_lamports: 1_000, - validator_configs: make_identical_validator_configs( - &snapshot_test_config.validator_config, - 1, - ), - ..ClusterConfig::default() - }; - let mut cluster = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified); - - let snapshot_archives_dir = &snapshot_test_config - .validator_config - .snapshot_config - .as_ref() - .unwrap() - .snapshot_archives_dir; - - trace!("Waiting for snapshot at {:?}", snapshot_archives_dir); - let full_snapshot_archive_info = cluster.wait_for_next_full_snapshot(snapshot_archives_dir); - - trace!( - "Found snapshot: {}", - full_snapshot_archive_info.path().display() - ); - - // Restart the validator from a snapshot - let validator_info = cluster.exit_node(&validator_identity.pubkey()); - cluster.restart_node( - &validator_identity.pubkey(), - validator_info, - SocketAddrSpace::Unspecified, - ); - - generate_frozen_account_panic(cluster, validator_identity); -} - #[test] #[serial] fn test_consistency_halt() { diff --git a/replica-node/src/replica_node.rs b/replica-node/src/replica_node.rs index 9797a58312..351cdfdaba 100644 --- a/replica-node/src/replica_node.rs +++ b/replica-node/src/replica_node.rs @@ -119,7 +119,6 @@ fn initialize_from_snapshot( ); let (bank0, _) = snapshot_utils::bank_from_snapshot_archives( &replica_config.account_paths, - &[], &snapshot_config.bank_snapshots_dir, &archive_info, None, diff --git a/runtime/benches/accounts.rs b/runtime/benches/accounts.rs index 37e0189be7..8f8385887a 100644 --- a/runtime/benches/accounts.rs +++ b/runtime/benches/accounts.rs @@ -47,7 +47,6 @@ fn test_accounts_create(bencher: &mut Bencher) { let bank0 = Bank::new_with_paths_for_benches( &genesis_config, vec![PathBuf::from("bench_a0")], - &[], None, None, AccountSecondaryIndexes::default(), @@ -68,7 +67,6 @@ fn test_accounts_squash(bencher: &mut Bencher) { let mut prev_bank = Arc::new(Bank::new_with_paths_for_benches( &genesis_config, vec![PathBuf::from("bench_a1")], - &[], None, None, AccountSecondaryIndexes::default(), diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 1ef3fd38c8..693cd83473 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -44,7 +44,6 @@ use dashmap::{ mapref::entry::Entry::{Occupied, Vacant}, DashMap, DashSet, }; -use lazy_static::lazy_static; use log::*; use rand::{prelude::SliceRandom, thread_rng, Rng}; use rayon::{prelude::*, ThreadPool}; @@ -57,7 +56,7 @@ use solana_sdk::{ clock::{BankId, Epoch, Slot, SlotCount}, epoch_schedule::EpochSchedule, genesis_config::ClusterType, - hash::{Hash, Hasher}, + hash::Hash, pubkey::Pubkey, timing::AtomicInterval, }; @@ -165,12 +164,6 @@ const ABSURD_CONSECUTIVE_FAILED_ITERATIONS: usize = 100; type DashMapVersionHash = DashMap; -lazy_static! { - // FROZEN_ACCOUNT_PANIC is used to signal local_cluster that an AccountsDb panic has occurred, - // as |cargo test| cannot observe panics in other threads - pub static ref FROZEN_ACCOUNT_PANIC: Arc = Arc::new(AtomicBool::new(false)); -} - #[derive(Debug, Clone, Copy)] pub enum AccountShrinkThreshold { /// Measure the total space sparseness across all candididates @@ -868,12 +861,6 @@ pub struct BankHashInfo { pub stats: BankHashStats, } -#[derive(Debug)] -struct FrozenAccountInfo { - pub hash: Hash, // Hash generated by hash_frozen_account_data() - pub lamports: u64, // Account balance cannot be lower than this amount -} - #[derive(Default)] pub struct StoreAccountsTiming { store_accounts_elapsed: u64, @@ -1008,9 +995,6 @@ pub struct AccountsDb { /// Starting file size of appendvecs file_size: u64, - /// Accounts that will cause a panic! if data modified or lamports decrease - frozen_accounts: HashMap, - /// Thread pool used for par_iter pub thread_pool: ThreadPool, @@ -1585,7 +1569,6 @@ impl AccountsDb { thread_pool_clean: make_min_priority_thread_pool(), min_num_stores: num_threads, bank_hashes: RwLock::new(bank_hashes), - frozen_accounts: HashMap::new(), external_purge_slots_stats: PurgeStats::default(), clean_accounts_stats: CleanAccountsStats::default(), shrink_stats: ShrinkStats::default(), @@ -4351,21 +4334,6 @@ impl AccountsDb { ) } - fn hash_frozen_account_data(account: &AccountSharedData) -> Hash { - let mut hasher = Hasher::default(); - - hasher.hash(account.data()); - hasher.hash(account.owner().as_ref()); - - if account.executable() { - hasher.hash(&[1u8; 1]); - } else { - hasher.hash(&[0u8; 1]); - } - - hasher.result() - } - fn hash_account_data( slot: Slot, lamports: u64, @@ -6204,58 +6172,6 @@ impl AccountsDb { .fetch_add(measure.as_us(), Ordering::Relaxed); } - pub(crate) fn freeze_accounts(&mut self, ancestors: &Ancestors, account_pubkeys: &[Pubkey]) { - for account_pubkey in account_pubkeys { - if let Some((account, _slot)) = self.load_without_fixed_root(ancestors, account_pubkey) - { - let frozen_account_info = FrozenAccountInfo { - hash: Self::hash_frozen_account_data(&account), - lamports: account.lamports(), - }; - warn!( - "Account {} is now frozen at lamports={}, hash={}", - account_pubkey, frozen_account_info.lamports, frozen_account_info.hash - ); - self.frozen_accounts - .insert(*account_pubkey, frozen_account_info); - } else { - panic!( - "Unable to freeze an account that does not exist: {}", - account_pubkey - ); - } - } - } - - /// Cause a panic if frozen accounts would be affected by data in `accounts` - fn assert_frozen_accounts(&self, accounts: &[(&Pubkey, &AccountSharedData)]) { - if self.frozen_accounts.is_empty() { - return; - } - for (account_pubkey, account) in accounts.iter() { - if let Some(frozen_account_info) = self.frozen_accounts.get(*account_pubkey) { - if account.lamports() < frozen_account_info.lamports { - FROZEN_ACCOUNT_PANIC.store(true, Ordering::Relaxed); - panic!( - "Frozen account {} modified. Lamports decreased from {} to {}", - account_pubkey, - frozen_account_info.lamports, - account.lamports(), - ) - } - - let hash = Self::hash_frozen_account_data(account); - if hash != frozen_account_info.hash { - FROZEN_ACCOUNT_PANIC.store(true, Ordering::Relaxed); - panic!( - "Frozen account {} modified. Hash changed from {} to {}", - account_pubkey, frozen_account_info.hash, hash, - ) - } - } - } - } - pub fn store_cached(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) { self.store(slot, accounts, self.caching_enabled); } @@ -6272,7 +6188,6 @@ impl AccountsDb { if accounts.is_empty() { return; } - self.assert_frozen_accounts(accounts); let mut stats = BankHashStats::default(); let mut total_data = 0; @@ -9674,139 +9589,6 @@ pub mod tests { assert_eq!(ret.0.data().len(), data_len); } - #[test] - fn test_hash_frozen_account_data() { - let account = AccountSharedData::new(1, 42, &Pubkey::default()); - - let hash = AccountsDb::hash_frozen_account_data(&account); - assert_ne!(hash, Hash::default()); // Better not be the default Hash - - // Lamports changes to not affect the hash - let mut account_modified = account.clone(); - account_modified.checked_sub_lamports(1).unwrap(); - assert_eq!( - hash, - AccountsDb::hash_frozen_account_data(&account_modified) - ); - - // Rent epoch may changes to not affect the hash - let mut account_modified = account.clone(); - account_modified.set_rent_epoch(account_modified.rent_epoch() + 1); - assert_eq!( - hash, - AccountsDb::hash_frozen_account_data(&account_modified) - ); - - // Account data may not be modified - let mut account_modified = account.clone(); - account_modified.data_as_mut_slice()[0] = 42; - assert_ne!( - hash, - AccountsDb::hash_frozen_account_data(&account_modified) - ); - - // Owner may not be modified - let mut account_modified = account.clone(); - account_modified - .set_owner(Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap()); - assert_ne!( - hash, - AccountsDb::hash_frozen_account_data(&account_modified) - ); - - // Executable may not be modified - let mut account_modified = account; - account_modified.set_executable(true); - assert_ne!( - hash, - AccountsDb::hash_frozen_account_data(&account_modified) - ); - } - - #[test] - fn test_frozen_account_lamport_increase() { - let frozen_pubkey = - Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap(); - let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development); - - let mut account = AccountSharedData::new(1, 42, &frozen_pubkey); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - let ancestors = vec![(0, 0)].into_iter().collect(); - db.freeze_accounts(&ancestors, &[frozen_pubkey]); - - // Store with no account changes is ok - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - // Store with an increase in lamports is ok - account.set_lamports(2); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - // Store with an decrease that does not go below the frozen amount of lamports is tolerated - account.set_lamports(1); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - // A store of any value over the frozen value of '1' across different slots is also ok - account.set_lamports(3); - db.store_uncached(1, &[(&frozen_pubkey, &account)]); - account.set_lamports(2); - db.store_uncached(2, &[(&frozen_pubkey, &account)]); - account.set_lamports(1); - db.store_uncached(3, &[(&frozen_pubkey, &account)]); - } - - #[test] - #[should_panic( - expected = "Frozen account My11111111111111111111111111111111111111111 modified. Lamports decreased from 1 to 0" - )] - fn test_frozen_account_lamport_decrease() { - let frozen_pubkey = - Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap(); - let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development); - - let mut account = AccountSharedData::new(1, 42, &frozen_pubkey); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - let ancestors = vec![(0, 0)].into_iter().collect(); - db.freeze_accounts(&ancestors, &[frozen_pubkey]); - - // Store with a decrease below the frozen amount of lamports is not ok - account.checked_sub_lamports(1).unwrap(); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - } - - #[test] - #[should_panic( - expected = "Unable to freeze an account that does not exist: My11111111111111111111111111111111111111111" - )] - fn test_frozen_account_nonexistent() { - let frozen_pubkey = - Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap(); - let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development); - - let ancestors = vec![(0, 0)].into_iter().collect(); - db.freeze_accounts(&ancestors, &[frozen_pubkey]); - } - - #[test] - #[should_panic( - expected = "Frozen account My11111111111111111111111111111111111111111 modified. Hash changed from 8wHcxDkjiwdrkPAsDnmNrF1UDGJFAtZzPQBSVweY3yRA to JdscGYB1uczVssmYuJusDD1Bfe6wpNeeho8XjcH8inN" - )] - fn test_frozen_account_data_modified() { - let frozen_pubkey = - Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap(); - let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development); - - let mut account = AccountSharedData::new(1, 42, &frozen_pubkey); - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - - let ancestors = vec![(0, 0)].into_iter().collect(); - db.freeze_accounts(&ancestors, &[frozen_pubkey]); - - account.data_as_mut_slice()[0] = 42; - db.store_uncached(0, &[(&frozen_pubkey, &account)]); - } - #[test] fn test_stored_readable_account() { let lamports = 1; diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index d9bbc68c2d..31610ad5cf 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1065,7 +1065,6 @@ impl Bank { Self::new_with_paths_for_tests( genesis_config, Vec::new(), - &[], None, None, AccountSecondaryIndexes::default(), @@ -1079,7 +1078,6 @@ impl Bank { let mut bank = Self::new_with_paths_for_tests( genesis_config, Vec::new(), - &[], None, None, AccountSecondaryIndexes::default(), @@ -1102,7 +1100,6 @@ impl Bank { Self::new_with_paths_for_tests( genesis_config, Vec::new(), - &[], None, None, account_indexes, @@ -1175,7 +1172,6 @@ impl Bank { pub fn new_with_paths_for_tests( genesis_config: &GenesisConfig, paths: Vec, - frozen_account_pubkeys: &[Pubkey], debug_keys: Option>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, @@ -1186,7 +1182,6 @@ impl Bank { Self::new_with_paths( genesis_config, paths, - frozen_account_pubkeys, debug_keys, additional_builtins, account_indexes, @@ -1201,7 +1196,6 @@ impl Bank { pub fn new_with_paths_for_benches( genesis_config: &GenesisConfig, paths: Vec, - frozen_account_pubkeys: &[Pubkey], debug_keys: Option>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, @@ -1212,7 +1206,6 @@ impl Bank { Self::new_with_paths( genesis_config, paths, - frozen_account_pubkeys, debug_keys, additional_builtins, account_indexes, @@ -1228,7 +1221,6 @@ impl Bank { pub fn new_with_paths( genesis_config: &GenesisConfig, paths: Vec, - frozen_account_pubkeys: &[Pubkey], debug_keys: Option>>, additional_builtins: Option<&Builtins>, account_indexes: AccountSecondaryIndexes, @@ -1259,11 +1251,6 @@ impl Bank { debug_do_not_add_builtins, ); - // Freeze accounts after process_genesis_config creates the initial append vecs - Arc::get_mut(&mut Arc::get_mut(&mut bank.rc.accounts).unwrap().accounts_db) - .unwrap() - .freeze_accounts(&bank.ancestors, frozen_account_pubkeys); - // genesis needs stakes for all epochs up to the epoch implied by // slot = 0 and genesis configuration { @@ -13386,7 +13373,6 @@ pub(crate) mod tests { let bank0 = Arc::new(Bank::new_with_paths_for_tests( &genesis_config, Vec::new(), - &[], None, Some(&builtins), AccountSecondaryIndexes::default(), diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index 40c92b2851..c343aca10b 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -7,7 +7,6 @@ use { }, accounts_index::AccountSecondaryIndexes, accounts_update_notifier_interface::AccountsUpdateNotifier, - ancestors::Ancestors, append_vec::{AppendVec, StoredMetaWriteVersion}, bank::{Bank, BankFieldsToDeserialize, BankRc}, blockhash_queue::BlockhashQueue, @@ -196,7 +195,6 @@ pub(crate) fn bank_from_streams( account_paths: &[PathBuf], unpacked_append_vec_map: UnpackedAppendVecMap, genesis_config: &GenesisConfig, - frozen_account_pubkeys: &[Pubkey], debug_keys: Option>>, additional_builtins: Option<&Builtins>, account_secondary_indexes: AccountSecondaryIndexes, @@ -233,7 +231,6 @@ where incremental_snapshot_bank_fields.unwrap_or(full_snapshot_bank_fields), snapshot_accounts_db_fields, genesis_config, - frozen_account_pubkeys, account_paths, unpacked_append_vec_map, debug_keys, @@ -327,7 +324,6 @@ fn reconstruct_bank_from_fields( bank_fields: BankFieldsToDeserialize, snapshot_accounts_db_fields: SnapshotAccountsDbFields, genesis_config: &GenesisConfig, - frozen_account_pubkeys: &[Pubkey], account_paths: &[PathBuf], unpacked_append_vec_map: UnpackedAppendVecMap, debug_keys: Option>>, @@ -343,7 +339,7 @@ fn reconstruct_bank_from_fields( where E: SerializableStorage + std::marker::Sync, { - let mut accounts_db = reconstruct_accountsdb_from_fields( + let accounts_db = reconstruct_accountsdb_from_fields( snapshot_accounts_db_fields, account_paths, unpacked_append_vec_map, @@ -356,10 +352,6 @@ where accounts_db_config, accounts_update_notifier, )?; - accounts_db.freeze_accounts( - &Ancestors::from(&bank_fields.ancestors), - frozen_account_pubkeys, - ); let bank_rc = BankRc::new(Accounts::new_empty(accounts_db), bank_fields.slot); diff --git a/runtime/src/serde_snapshot/tests.rs b/runtime/src/serde_snapshot/tests.rs index 4b9c85649f..c992583486 100644 --- a/runtime/src/serde_snapshot/tests.rs +++ b/runtime/src/serde_snapshot/tests.rs @@ -241,7 +241,6 @@ fn test_bank_serialize_style(serde_style: SerdeStyle) { &dbank_paths, unpacked_append_vec_map, &genesis_config, - &[], None, None, AccountSecondaryIndexes::default(), diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 248263f0fb..3d68c3671b 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -721,7 +721,6 @@ const PARALLEL_UNTAR_READERS_DEFAULT: usize = 4; #[allow(clippy::too_many_arguments)] pub fn bank_from_snapshot_archives( account_paths: &[PathBuf], - frozen_account_pubkeys: &[Pubkey], bank_snapshots_dir: impl AsRef, full_snapshot_archive_info: &FullSnapshotArchiveInfo, incremental_snapshot_archive_info: Option<&IncrementalSnapshotArchiveInfo>, @@ -789,7 +788,6 @@ pub fn bank_from_snapshot_archives( .map(|unarchive_preparation_result| { &unarchive_preparation_result.unpacked_snapshots_dir_and_version }), - frozen_account_pubkeys, account_paths, unpacked_append_vec_map, genesis_config, @@ -836,7 +834,6 @@ pub fn bank_from_latest_snapshot_archives( bank_snapshots_dir: impl AsRef, snapshot_archives_dir: impl AsRef, account_paths: &[PathBuf], - frozen_account_pubkeys: &[Pubkey], genesis_config: &GenesisConfig, debug_keys: Option>>, additional_builtins: Option<&Builtins>, @@ -877,7 +874,6 @@ pub fn bank_from_latest_snapshot_archives( let (bank, timings) = bank_from_snapshot_archives( account_paths, - frozen_account_pubkeys, bank_snapshots_dir.as_ref(), &full_snapshot_archive_info, incremental_snapshot_archive_info.as_ref(), @@ -1418,7 +1414,6 @@ fn rebuild_bank_from_snapshots( incremental_snapshot_unpacked_snapshots_dir_and_version: Option< &UnpackedSnapshotsDirAndVersion, >, - frozen_account_pubkeys: &[Pubkey], account_paths: &[PathBuf], unpacked_append_vec_map: UnpackedAppendVecMap, genesis_config: &GenesisConfig, @@ -1470,7 +1465,6 @@ fn rebuild_bank_from_snapshots( account_paths, unpacked_append_vec_map, genesis_config, - frozen_account_pubkeys, debug_keys, additional_builtins, account_secondary_indexes, @@ -2638,7 +2632,6 @@ mod tests { let (roundtrip_bank, _) = bank_from_snapshot_archives( &[PathBuf::from(accounts_dir.path())], - &[], bank_snapshots_dir.path(), &snapshot_archive_info, None, @@ -2730,7 +2723,6 @@ mod tests { let (roundtrip_bank, _) = bank_from_snapshot_archives( &[PathBuf::from(accounts_dir.path())], - &[], bank_snapshots_dir.path(), &full_snapshot_archive_info, None, @@ -2841,7 +2833,6 @@ mod tests { let (roundtrip_bank, _) = bank_from_snapshot_archives( &[PathBuf::from(accounts_dir.path())], - &[], bank_snapshots_dir.path(), &full_snapshot_archive_info, Some(&incremental_snapshot_archive_info), @@ -2944,7 +2935,6 @@ mod tests { &bank_snapshots_dir, &snapshot_archives_dir, &[accounts_dir.as_ref().to_path_buf()], - &[], &genesis_config, None, None, @@ -3004,7 +2994,6 @@ mod tests { let bank0 = Arc::new(Bank::new_with_paths_for_tests( &genesis_config, vec![accounts_dir.path().to_path_buf()], - &[], None, None, AccountSecondaryIndexes::default(), @@ -3081,7 +3070,6 @@ mod tests { .unwrap(); let (deserialized_bank, _) = bank_from_snapshot_archives( &[accounts_dir.path().to_path_buf()], - &[], bank_snapshots_dir.path(), &full_snapshot_archive_info, Some(&incremental_snapshot_archive_info), @@ -3144,7 +3132,6 @@ mod tests { let (deserialized_bank, _) = bank_from_snapshot_archives( &[accounts_dir.path().to_path_buf()], - &[], bank_snapshots_dir.path(), &full_snapshot_archive_info, Some(&incremental_snapshot_archive_info), diff --git a/validator/src/main.rs b/validator/src/main.rs index b1c6996548..c5264f19cf 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -1386,17 +1386,6 @@ pub fn main() { .takes_value(false) .help("Abort the validator if a bank hash mismatch is detected within known validator set"), ) - .arg( - Arg::with_name("frozen_accounts") - .long("frozen-account") - .validator(is_pubkey) - .value_name("PUBKEY") - .multiple(true) - .takes_value(true) - .help("Freeze the specified account. This will cause the validator to \ - intentionally crash should any transaction modify the frozen account in any way \ - other than increasing the account balance"), - ) .arg( Arg::with_name("snapshot_archive_format") .long("snapshot-archive-format") @@ -2252,7 +2241,6 @@ pub fn main() { known_validators, repair_validators, gossip_validators, - frozen_accounts: values_t!(matches, "frozen_accounts", Pubkey).unwrap_or_default(), no_rocksdb_compaction, rocksdb_compaction_interval, rocksdb_max_compaction_jitter,