Remove frozen account support

This commit is contained in:
Michael Vines
2021-11-28 21:55:35 -08:00
parent 09799590ac
commit ba9dfa0d22
14 changed files with 2 additions and 399 deletions

View File

@ -136,7 +136,6 @@ pub struct ValidatorConfig {
pub gossip_validators: Option<HashSet<Pubkey>>, // None = gossip with all pub gossip_validators: Option<HashSet<Pubkey>>, // None = gossip with all
pub halt_on_known_validators_accounts_hash_mismatch: bool, pub halt_on_known_validators_accounts_hash_mismatch: bool,
pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection
pub frozen_accounts: Vec<Pubkey>,
pub no_rocksdb_compaction: bool, pub no_rocksdb_compaction: bool,
pub rocksdb_compaction_interval: Option<u64>, pub rocksdb_compaction_interval: Option<u64>,
pub rocksdb_max_compaction_jitter: Option<u64>, pub rocksdb_max_compaction_jitter: Option<u64>,
@ -197,7 +196,6 @@ impl Default for ValidatorConfig {
gossip_validators: None, gossip_validators: None,
halt_on_known_validators_accounts_hash_mismatch: false, halt_on_known_validators_accounts_hash_mismatch: false,
accounts_hash_fault_injection_slots: 0, accounts_hash_fault_injection_slots: 0,
frozen_accounts: vec![],
no_rocksdb_compaction: false, no_rocksdb_compaction: false,
rocksdb_compaction_interval: None, rocksdb_compaction_interval: None,
rocksdb_max_compaction_jitter: None, rocksdb_max_compaction_jitter: None,
@ -1276,7 +1274,6 @@ fn new_banks_from_ledger(
poh_verify, poh_verify,
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(),
debug_keys: config.debug_keys.clone(), debug_keys: config.debug_keys.clone(),
account_indexes: config.account_indexes.clone(), account_indexes: config.account_indexes.clone(),
accounts_db_caching_enabled: config.accounts_db_caching_enabled, accounts_db_caching_enabled: config.accounts_db_caching_enabled,

View File

@ -126,7 +126,6 @@ mod tests {
let bank0 = Bank::new_with_paths_for_tests( let bank0 = Bank::new_with_paths_for_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, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),
@ -184,7 +183,6 @@ mod tests {
let (deserialized_bank, _timing) = snapshot_utils::bank_from_snapshot_archives( let (deserialized_bank, _timing) = snapshot_utils::bank_from_snapshot_archives(
account_paths, account_paths,
&[],
&old_bank_forks &old_bank_forks
.snapshot_config .snapshot_config
.as_ref() .as_ref()
@ -828,7 +826,6 @@ mod tests {
&snapshot_config.bank_snapshots_dir, &snapshot_config.bank_snapshots_dir,
&snapshot_config.snapshot_archives_dir, &snapshot_config.snapshot_archives_dir,
&[accounts_dir], &[accounts_dir],
&[],
genesis_config, genesis_config,
None, None,
None, None,
@ -1008,7 +1005,6 @@ mod tests {
&snapshot_test_config.snapshot_config.bank_snapshots_dir, &snapshot_test_config.snapshot_config.bank_snapshots_dir,
&snapshot_test_config.snapshot_config.snapshot_archives_dir, &snapshot_test_config.snapshot_config.snapshot_archives_dir,
&[snapshot_test_config.accounts_dir.as_ref().to_path_buf()], &[snapshot_test_config.accounts_dir.as_ref().to_path_buf()],
&[],
&snapshot_test_config.genesis_config_info.genesis_config, &snapshot_test_config.genesis_config_info.genesis_config,
None, None,
None, None,

View File

@ -169,7 +169,6 @@ fn load_from_snapshot(
&snapshot_config.bank_snapshots_dir, &snapshot_config.bank_snapshots_dir,
&snapshot_config.snapshot_archives_dir, &snapshot_config.snapshot_archives_dir,
&account_paths, &account_paths,
&process_options.frozen_accounts,
genesis_config, genesis_config,
process_options.debug_keys.clone(), process_options.debug_keys.clone(),
Some(&crate::builtins::get(process_options.bpf_jit)), Some(&crate::builtins::get(process_options.bpf_jit)),

View File

@ -464,7 +464,6 @@ pub struct ProcessOptions {
pub entry_callback: Option<ProcessCallback>, pub entry_callback: Option<ProcessCallback>,
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 debug_keys: Option<Arc<HashSet<Pubkey>>>, pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
pub account_indexes: AccountSecondaryIndexes, pub account_indexes: AccountSecondaryIndexes,
pub accounts_db_caching_enabled: bool, pub accounts_db_caching_enabled: bool,
@ -500,7 +499,6 @@ pub fn process_blockstore(
let bank0 = Bank::new_with_paths( let bank0 = Bank::new_with_paths(
genesis_config, genesis_config,
account_paths, account_paths,
&opts.frozen_accounts,
opts.debug_keys.clone(), opts.debug_keys.clone(),
Some(&crate::builtins::get(opts.bpf_jit)), Some(&crate::builtins::get(opts.bpf_jit)),
opts.account_indexes.clone(), opts.account_indexes.clone(),
@ -3376,7 +3374,6 @@ pub mod tests {
let bank = Bank::new_with_paths_for_tests( let bank = Bank::new_with_paths_for_tests(
genesis_config, genesis_config,
account_paths, account_paths,
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),

View File

@ -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: config
.halt_on_known_validators_accounts_hash_mismatch, .halt_on_known_validators_accounts_hash_mismatch,
accounts_hash_fault_injection_slots: config.accounts_hash_fault_injection_slots, accounts_hash_fault_injection_slots: config.accounts_hash_fault_injection_slots,
frozen_accounts: config.frozen_accounts.clone(),
no_rocksdb_compaction: config.no_rocksdb_compaction, no_rocksdb_compaction: config.no_rocksdb_compaction,
rocksdb_compaction_interval: config.rocksdb_compaction_interval, rocksdb_compaction_interval: config.rocksdb_compaction_interval,
rocksdb_max_compaction_jitter: config.rocksdb_max_compaction_jitter, rocksdb_max_compaction_jitter: config.rocksdb_max_compaction_jitter,

View File

@ -1440,122 +1440,6 @@ fn test_mainnet_beta_cluster_type() {
} }
} }
fn generate_frozen_account_panic(mut cluster: LocalCluster, frozen_account: Arc<Keypair>) {
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] #[test]
#[serial] #[serial]
fn test_consistency_halt() { fn test_consistency_halt() {

View File

@ -119,7 +119,6 @@ fn initialize_from_snapshot(
); );
let (bank0, _) = snapshot_utils::bank_from_snapshot_archives( let (bank0, _) = snapshot_utils::bank_from_snapshot_archives(
&replica_config.account_paths, &replica_config.account_paths,
&[],
&snapshot_config.bank_snapshots_dir, &snapshot_config.bank_snapshots_dir,
&archive_info, &archive_info,
None, None,

View File

@ -47,7 +47,6 @@ fn test_accounts_create(bencher: &mut Bencher) {
let bank0 = Bank::new_with_paths_for_benches( let bank0 = Bank::new_with_paths_for_benches(
&genesis_config, &genesis_config,
vec![PathBuf::from("bench_a0")], vec![PathBuf::from("bench_a0")],
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), 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( let mut prev_bank = Arc::new(Bank::new_with_paths_for_benches(
&genesis_config, &genesis_config,
vec![PathBuf::from("bench_a1")], vec![PathBuf::from("bench_a1")],
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),

View File

@ -44,7 +44,6 @@ use dashmap::{
mapref::entry::Entry::{Occupied, Vacant}, mapref::entry::Entry::{Occupied, Vacant},
DashMap, DashSet, DashMap, DashSet,
}; };
use lazy_static::lazy_static;
use log::*; use log::*;
use rand::{prelude::SliceRandom, thread_rng, Rng}; use rand::{prelude::SliceRandom, thread_rng, Rng};
use rayon::{prelude::*, ThreadPool}; use rayon::{prelude::*, ThreadPool};
@ -57,7 +56,7 @@ use solana_sdk::{
clock::{BankId, Epoch, Slot, SlotCount}, clock::{BankId, Epoch, Slot, SlotCount},
epoch_schedule::EpochSchedule, epoch_schedule::EpochSchedule,
genesis_config::ClusterType, genesis_config::ClusterType,
hash::{Hash, Hasher}, hash::Hash,
pubkey::Pubkey, pubkey::Pubkey,
timing::AtomicInterval, timing::AtomicInterval,
}; };
@ -165,12 +164,6 @@ const ABSURD_CONSECUTIVE_FAILED_ITERATIONS: usize = 100;
type DashMapVersionHash = DashMap<Pubkey, (u64, Hash)>; type DashMapVersionHash = DashMap<Pubkey, (u64, Hash)>;
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<AtomicBool> = Arc::new(AtomicBool::new(false));
}
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum AccountShrinkThreshold { pub enum AccountShrinkThreshold {
/// Measure the total space sparseness across all candididates /// Measure the total space sparseness across all candididates
@ -868,12 +861,6 @@ pub struct BankHashInfo {
pub stats: BankHashStats, 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)] #[derive(Default)]
pub struct StoreAccountsTiming { pub struct StoreAccountsTiming {
store_accounts_elapsed: u64, store_accounts_elapsed: u64,
@ -1008,9 +995,6 @@ pub struct AccountsDb {
/// Starting file size of appendvecs /// Starting file size of appendvecs
file_size: u64, file_size: u64,
/// Accounts that will cause a panic! if data modified or lamports decrease
frozen_accounts: HashMap<Pubkey, FrozenAccountInfo>,
/// Thread pool used for par_iter /// Thread pool used for par_iter
pub thread_pool: ThreadPool, pub thread_pool: ThreadPool,
@ -1585,7 +1569,6 @@ impl AccountsDb {
thread_pool_clean: make_min_priority_thread_pool(), thread_pool_clean: make_min_priority_thread_pool(),
min_num_stores: num_threads, min_num_stores: num_threads,
bank_hashes: RwLock::new(bank_hashes), bank_hashes: RwLock::new(bank_hashes),
frozen_accounts: HashMap::new(),
external_purge_slots_stats: PurgeStats::default(), external_purge_slots_stats: PurgeStats::default(),
clean_accounts_stats: CleanAccountsStats::default(), clean_accounts_stats: CleanAccountsStats::default(),
shrink_stats: ShrinkStats::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( fn hash_account_data(
slot: Slot, slot: Slot,
lamports: u64, lamports: u64,
@ -6204,58 +6172,6 @@ impl AccountsDb {
.fetch_add(measure.as_us(), Ordering::Relaxed); .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)]) { pub fn store_cached(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
self.store(slot, accounts, self.caching_enabled); self.store(slot, accounts, self.caching_enabled);
} }
@ -6272,7 +6188,6 @@ impl AccountsDb {
if accounts.is_empty() { if accounts.is_empty() {
return; return;
} }
self.assert_frozen_accounts(accounts);
let mut stats = BankHashStats::default(); let mut stats = BankHashStats::default();
let mut total_data = 0; let mut total_data = 0;
@ -9674,139 +9589,6 @@ pub mod tests {
assert_eq!(ret.0.data().len(), data_len); 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] #[test]
fn test_stored_readable_account() { fn test_stored_readable_account() {
let lamports = 1; let lamports = 1;

View File

@ -1065,7 +1065,6 @@ impl Bank {
Self::new_with_paths_for_tests( Self::new_with_paths_for_tests(
genesis_config, genesis_config,
Vec::new(), Vec::new(),
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),
@ -1079,7 +1078,6 @@ impl Bank {
let mut bank = Self::new_with_paths_for_tests( let mut bank = Self::new_with_paths_for_tests(
genesis_config, genesis_config,
Vec::new(), Vec::new(),
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),
@ -1102,7 +1100,6 @@ impl Bank {
Self::new_with_paths_for_tests( Self::new_with_paths_for_tests(
genesis_config, genesis_config,
Vec::new(), Vec::new(),
&[],
None, None,
None, None,
account_indexes, account_indexes,
@ -1175,7 +1172,6 @@ impl Bank {
pub fn new_with_paths_for_tests( pub fn new_with_paths_for_tests(
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
paths: Vec<PathBuf>, paths: Vec<PathBuf>,
frozen_account_pubkeys: &[Pubkey],
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&Builtins>, additional_builtins: Option<&Builtins>,
account_indexes: AccountSecondaryIndexes, account_indexes: AccountSecondaryIndexes,
@ -1186,7 +1182,6 @@ impl Bank {
Self::new_with_paths( Self::new_with_paths(
genesis_config, genesis_config,
paths, paths,
frozen_account_pubkeys,
debug_keys, debug_keys,
additional_builtins, additional_builtins,
account_indexes, account_indexes,
@ -1201,7 +1196,6 @@ impl Bank {
pub fn new_with_paths_for_benches( pub fn new_with_paths_for_benches(
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
paths: Vec<PathBuf>, paths: Vec<PathBuf>,
frozen_account_pubkeys: &[Pubkey],
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&Builtins>, additional_builtins: Option<&Builtins>,
account_indexes: AccountSecondaryIndexes, account_indexes: AccountSecondaryIndexes,
@ -1212,7 +1206,6 @@ impl Bank {
Self::new_with_paths( Self::new_with_paths(
genesis_config, genesis_config,
paths, paths,
frozen_account_pubkeys,
debug_keys, debug_keys,
additional_builtins, additional_builtins,
account_indexes, account_indexes,
@ -1228,7 +1221,6 @@ impl Bank {
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],
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&Builtins>, additional_builtins: Option<&Builtins>,
account_indexes: AccountSecondaryIndexes, account_indexes: AccountSecondaryIndexes,
@ -1259,11 +1251,6 @@ impl Bank {
debug_do_not_add_builtins, 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 // genesis needs stakes for all epochs up to the epoch implied by
// slot = 0 and genesis configuration // slot = 0 and genesis configuration
{ {
@ -13386,7 +13373,6 @@ pub(crate) mod tests {
let bank0 = Arc::new(Bank::new_with_paths_for_tests( let bank0 = Arc::new(Bank::new_with_paths_for_tests(
&genesis_config, &genesis_config,
Vec::new(), Vec::new(),
&[],
None, None,
Some(&builtins), Some(&builtins),
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),

View File

@ -7,7 +7,6 @@ use {
}, },
accounts_index::AccountSecondaryIndexes, accounts_index::AccountSecondaryIndexes,
accounts_update_notifier_interface::AccountsUpdateNotifier, accounts_update_notifier_interface::AccountsUpdateNotifier,
ancestors::Ancestors,
append_vec::{AppendVec, StoredMetaWriteVersion}, append_vec::{AppendVec, StoredMetaWriteVersion},
bank::{Bank, BankFieldsToDeserialize, BankRc}, bank::{Bank, BankFieldsToDeserialize, BankRc},
blockhash_queue::BlockhashQueue, blockhash_queue::BlockhashQueue,
@ -196,7 +195,6 @@ pub(crate) fn bank_from_streams<R>(
account_paths: &[PathBuf], account_paths: &[PathBuf],
unpacked_append_vec_map: UnpackedAppendVecMap, unpacked_append_vec_map: UnpackedAppendVecMap,
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
frozen_account_pubkeys: &[Pubkey],
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&Builtins>, additional_builtins: Option<&Builtins>,
account_secondary_indexes: AccountSecondaryIndexes, account_secondary_indexes: AccountSecondaryIndexes,
@ -233,7 +231,6 @@ where
incremental_snapshot_bank_fields.unwrap_or(full_snapshot_bank_fields), incremental_snapshot_bank_fields.unwrap_or(full_snapshot_bank_fields),
snapshot_accounts_db_fields, snapshot_accounts_db_fields,
genesis_config, genesis_config,
frozen_account_pubkeys,
account_paths, account_paths,
unpacked_append_vec_map, unpacked_append_vec_map,
debug_keys, debug_keys,
@ -327,7 +324,6 @@ fn reconstruct_bank_from_fields<E>(
bank_fields: BankFieldsToDeserialize, bank_fields: BankFieldsToDeserialize,
snapshot_accounts_db_fields: SnapshotAccountsDbFields<E>, snapshot_accounts_db_fields: SnapshotAccountsDbFields<E>,
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
frozen_account_pubkeys: &[Pubkey],
account_paths: &[PathBuf], account_paths: &[PathBuf],
unpacked_append_vec_map: UnpackedAppendVecMap, unpacked_append_vec_map: UnpackedAppendVecMap,
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
@ -343,7 +339,7 @@ fn reconstruct_bank_from_fields<E>(
where where
E: SerializableStorage + std::marker::Sync, E: SerializableStorage + std::marker::Sync,
{ {
let mut accounts_db = reconstruct_accountsdb_from_fields( let accounts_db = reconstruct_accountsdb_from_fields(
snapshot_accounts_db_fields, snapshot_accounts_db_fields,
account_paths, account_paths,
unpacked_append_vec_map, unpacked_append_vec_map,
@ -356,10 +352,6 @@ where
accounts_db_config, accounts_db_config,
accounts_update_notifier, 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); let bank_rc = BankRc::new(Accounts::new_empty(accounts_db), bank_fields.slot);

View File

@ -241,7 +241,6 @@ fn test_bank_serialize_style(serde_style: SerdeStyle) {
&dbank_paths, &dbank_paths,
unpacked_append_vec_map, unpacked_append_vec_map,
&genesis_config, &genesis_config,
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),

View File

@ -721,7 +721,6 @@ const PARALLEL_UNTAR_READERS_DEFAULT: usize = 4;
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn bank_from_snapshot_archives( pub fn bank_from_snapshot_archives(
account_paths: &[PathBuf], account_paths: &[PathBuf],
frozen_account_pubkeys: &[Pubkey],
bank_snapshots_dir: impl AsRef<Path>, bank_snapshots_dir: impl AsRef<Path>,
full_snapshot_archive_info: &FullSnapshotArchiveInfo, full_snapshot_archive_info: &FullSnapshotArchiveInfo,
incremental_snapshot_archive_info: Option<&IncrementalSnapshotArchiveInfo>, incremental_snapshot_archive_info: Option<&IncrementalSnapshotArchiveInfo>,
@ -789,7 +788,6 @@ pub fn bank_from_snapshot_archives(
.map(|unarchive_preparation_result| { .map(|unarchive_preparation_result| {
&unarchive_preparation_result.unpacked_snapshots_dir_and_version &unarchive_preparation_result.unpacked_snapshots_dir_and_version
}), }),
frozen_account_pubkeys,
account_paths, account_paths,
unpacked_append_vec_map, unpacked_append_vec_map,
genesis_config, genesis_config,
@ -836,7 +834,6 @@ pub fn bank_from_latest_snapshot_archives(
bank_snapshots_dir: impl AsRef<Path>, bank_snapshots_dir: impl AsRef<Path>,
snapshot_archives_dir: impl AsRef<Path>, snapshot_archives_dir: impl AsRef<Path>,
account_paths: &[PathBuf], account_paths: &[PathBuf],
frozen_account_pubkeys: &[Pubkey],
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
debug_keys: Option<Arc<HashSet<Pubkey>>>, debug_keys: Option<Arc<HashSet<Pubkey>>>,
additional_builtins: Option<&Builtins>, additional_builtins: Option<&Builtins>,
@ -877,7 +874,6 @@ pub fn bank_from_latest_snapshot_archives(
let (bank, timings) = bank_from_snapshot_archives( let (bank, timings) = bank_from_snapshot_archives(
account_paths, account_paths,
frozen_account_pubkeys,
bank_snapshots_dir.as_ref(), bank_snapshots_dir.as_ref(),
&full_snapshot_archive_info, &full_snapshot_archive_info,
incremental_snapshot_archive_info.as_ref(), incremental_snapshot_archive_info.as_ref(),
@ -1418,7 +1414,6 @@ fn rebuild_bank_from_snapshots(
incremental_snapshot_unpacked_snapshots_dir_and_version: Option< incremental_snapshot_unpacked_snapshots_dir_and_version: Option<
&UnpackedSnapshotsDirAndVersion, &UnpackedSnapshotsDirAndVersion,
>, >,
frozen_account_pubkeys: &[Pubkey],
account_paths: &[PathBuf], account_paths: &[PathBuf],
unpacked_append_vec_map: UnpackedAppendVecMap, unpacked_append_vec_map: UnpackedAppendVecMap,
genesis_config: &GenesisConfig, genesis_config: &GenesisConfig,
@ -1470,7 +1465,6 @@ fn rebuild_bank_from_snapshots(
account_paths, account_paths,
unpacked_append_vec_map, unpacked_append_vec_map,
genesis_config, genesis_config,
frozen_account_pubkeys,
debug_keys, debug_keys,
additional_builtins, additional_builtins,
account_secondary_indexes, account_secondary_indexes,
@ -2638,7 +2632,6 @@ mod tests {
let (roundtrip_bank, _) = bank_from_snapshot_archives( let (roundtrip_bank, _) = bank_from_snapshot_archives(
&[PathBuf::from(accounts_dir.path())], &[PathBuf::from(accounts_dir.path())],
&[],
bank_snapshots_dir.path(), bank_snapshots_dir.path(),
&snapshot_archive_info, &snapshot_archive_info,
None, None,
@ -2730,7 +2723,6 @@ mod tests {
let (roundtrip_bank, _) = bank_from_snapshot_archives( let (roundtrip_bank, _) = bank_from_snapshot_archives(
&[PathBuf::from(accounts_dir.path())], &[PathBuf::from(accounts_dir.path())],
&[],
bank_snapshots_dir.path(), bank_snapshots_dir.path(),
&full_snapshot_archive_info, &full_snapshot_archive_info,
None, None,
@ -2841,7 +2833,6 @@ mod tests {
let (roundtrip_bank, _) = bank_from_snapshot_archives( let (roundtrip_bank, _) = bank_from_snapshot_archives(
&[PathBuf::from(accounts_dir.path())], &[PathBuf::from(accounts_dir.path())],
&[],
bank_snapshots_dir.path(), bank_snapshots_dir.path(),
&full_snapshot_archive_info, &full_snapshot_archive_info,
Some(&incremental_snapshot_archive_info), Some(&incremental_snapshot_archive_info),
@ -2944,7 +2935,6 @@ mod tests {
&bank_snapshots_dir, &bank_snapshots_dir,
&snapshot_archives_dir, &snapshot_archives_dir,
&[accounts_dir.as_ref().to_path_buf()], &[accounts_dir.as_ref().to_path_buf()],
&[],
&genesis_config, &genesis_config,
None, None,
None, None,
@ -3004,7 +2994,6 @@ mod tests {
let bank0 = Arc::new(Bank::new_with_paths_for_tests( let bank0 = Arc::new(Bank::new_with_paths_for_tests(
&genesis_config, &genesis_config,
vec![accounts_dir.path().to_path_buf()], vec![accounts_dir.path().to_path_buf()],
&[],
None, None,
None, None,
AccountSecondaryIndexes::default(), AccountSecondaryIndexes::default(),
@ -3081,7 +3070,6 @@ mod tests {
.unwrap(); .unwrap();
let (deserialized_bank, _) = bank_from_snapshot_archives( let (deserialized_bank, _) = bank_from_snapshot_archives(
&[accounts_dir.path().to_path_buf()], &[accounts_dir.path().to_path_buf()],
&[],
bank_snapshots_dir.path(), bank_snapshots_dir.path(),
&full_snapshot_archive_info, &full_snapshot_archive_info,
Some(&incremental_snapshot_archive_info), Some(&incremental_snapshot_archive_info),
@ -3144,7 +3132,6 @@ mod tests {
let (deserialized_bank, _) = bank_from_snapshot_archives( let (deserialized_bank, _) = bank_from_snapshot_archives(
&[accounts_dir.path().to_path_buf()], &[accounts_dir.path().to_path_buf()],
&[],
bank_snapshots_dir.path(), bank_snapshots_dir.path(),
&full_snapshot_archive_info, &full_snapshot_archive_info,
Some(&incremental_snapshot_archive_info), Some(&incremental_snapshot_archive_info),

View File

@ -1386,17 +1386,6 @@ pub fn main() {
.takes_value(false) .takes_value(false)
.help("Abort the validator if a bank hash mismatch is detected within known validator set"), .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(
Arg::with_name("snapshot_archive_format") Arg::with_name("snapshot_archive_format")
.long("snapshot-archive-format") .long("snapshot-archive-format")
@ -2252,7 +2241,6 @@ pub fn main() {
known_validators, known_validators,
repair_validators, repair_validators,
gossip_validators, gossip_validators,
frozen_accounts: values_t!(matches, "frozen_accounts", Pubkey).unwrap_or_default(),
no_rocksdb_compaction, no_rocksdb_compaction,
rocksdb_compaction_interval, rocksdb_compaction_interval,
rocksdb_max_compaction_jitter, rocksdb_max_compaction_jitter,