Remove frozen account support
This commit is contained in:
@ -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]
|
||||
#[serial]
|
||||
fn test_consistency_halt() {
|
||||
|
Reference in New Issue
Block a user