Deprecate commitment variants (#14797)
* Deprecate commitment variants * Add new CommitmentConfig builders * Add helpers to avoid allowing deprecated variants * Remove deprecated transaction-status code * Include new commitment variants in runtime commitment; allow deprecated as long as old variants persist * Remove deprecated banks code * Remove deprecated variants in core; allow deprecated in rpc/rpc-subscriptions for now * Heavier hand with rpc/rpc-subscription commitment * Remove deprecated variants from local-cluster * Remove deprecated variants from various tools * Remove deprecated variants from validator * Update docs * Remove deprecated client code * Add new variants to cli; remove deprecated variants as possible * Don't send new commitment variants to old clusters * Retain deprecated method in test_validator_saves_tower * Fix clippy matches! suggestion for BPF solana-sdk legacy compile test * Refactor node version check to handle commitment variants and transaction encoding * Hide deprecated variants from cli help * Add cli App comments
This commit is contained in:
@@ -168,7 +168,7 @@ fn test_local_cluster_signature_subscribe() {
|
||||
VALIDATOR_PORT_RANGE,
|
||||
);
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = tx_client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
|
||||
let mut transaction = system_transaction::transfer(
|
||||
@@ -182,7 +182,7 @@ fn test_local_cluster_signature_subscribe() {
|
||||
&format!("ws://{}", &non_bootstrap_info.rpc_pubsub.to_string()),
|
||||
&transaction.signatures[0],
|
||||
Some(RpcSignatureSubscribeConfig {
|
||||
commitment: Some(CommitmentConfig::recent()),
|
||||
commitment: Some(CommitmentConfig::processed()),
|
||||
enable_received_notification: Some(true),
|
||||
}),
|
||||
)
|
||||
@@ -791,7 +791,7 @@ fn test_mainnet_beta_cluster_type() {
|
||||
(
|
||||
program_id,
|
||||
client
|
||||
.get_account_with_commitment(program_id, CommitmentConfig::recent())
|
||||
.get_account_with_commitment(program_id, CommitmentConfig::processed())
|
||||
.unwrap()
|
||||
),
|
||||
(_program_id, Some(_))
|
||||
@@ -809,7 +809,7 @@ fn test_mainnet_beta_cluster_type() {
|
||||
(
|
||||
program_id,
|
||||
client
|
||||
.get_account_with_commitment(program_id, CommitmentConfig::recent())
|
||||
.get_account_with_commitment(program_id, CommitmentConfig::processed())
|
||||
.unwrap()
|
||||
),
|
||||
(program_id, None)
|
||||
@@ -826,7 +826,7 @@ fn generate_frozen_account_panic(mut cluster: LocalCluster, frozen_account: Arc<
|
||||
trace!(
|
||||
"validator slot: {}",
|
||||
client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.expect("get slot")
|
||||
);
|
||||
|
||||
@@ -838,7 +838,7 @@ fn generate_frozen_account_panic(mut cluster: LocalCluster, frozen_account: Arc<
|
||||
while !solana_runtime::accounts_db::FROZEN_ACCOUNT_PANIC.load(Ordering::Relaxed) {
|
||||
// Transfer from frozen account
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
client
|
||||
.async_transfer(
|
||||
@@ -1222,7 +1222,7 @@ fn test_snapshots_blockstore_floor() {
|
||||
let target_slot = slot_floor + 40;
|
||||
while current_slot <= target_slot {
|
||||
trace!("current_slot: {}", current_slot);
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::recent()) {
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::processed()) {
|
||||
current_slot = slot;
|
||||
} else {
|
||||
continue;
|
||||
@@ -1402,7 +1402,7 @@ fn test_no_voting() {
|
||||
.unwrap();
|
||||
loop {
|
||||
let last_slot = client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.expect("Couldn't get slot");
|
||||
if last_slot > 4 * VOTE_THRESHOLD_DEPTH as u64 {
|
||||
break;
|
||||
@@ -1460,7 +1460,7 @@ fn test_optimistic_confirmation_violation_detection() {
|
||||
let mut prev_voted_slot = 0;
|
||||
loop {
|
||||
let last_voted_slot = client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
if last_voted_slot > 50 {
|
||||
if prev_voted_slot == 0 {
|
||||
@@ -1498,7 +1498,7 @@ fn test_optimistic_confirmation_violation_detection() {
|
||||
let client = cluster.get_validator_client(&entry_point_id).unwrap();
|
||||
loop {
|
||||
let last_root = client
|
||||
.get_slot_with_commitment(CommitmentConfig::max())
|
||||
.get_slot_with_commitment(CommitmentConfig::finalized())
|
||||
.unwrap();
|
||||
if last_root > prev_voted_slot {
|
||||
break;
|
||||
@@ -1561,7 +1561,7 @@ fn test_validator_saves_tower() {
|
||||
// Wait for some votes to be generated
|
||||
let mut last_replayed_root;
|
||||
loop {
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::recent()) {
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::processed()) {
|
||||
trace!("current slot: {}", slot);
|
||||
if slot > 2 {
|
||||
// this will be the root next time a validator starts
|
||||
@@ -1584,6 +1584,9 @@ fn test_validator_saves_tower() {
|
||||
|
||||
// Wait for the first root
|
||||
loop {
|
||||
#[allow(deprecated)]
|
||||
// This test depends on knowing the immediate root, without any delay from the commitment
|
||||
// service, so the deprecated CommitmentConfig::root() is retained
|
||||
if let Ok(root) = validator_client.get_slot_with_commitment(CommitmentConfig::root()) {
|
||||
trace!("current root: {}", root);
|
||||
if root > last_replayed_root + 1 {
|
||||
@@ -1596,7 +1599,7 @@ fn test_validator_saves_tower() {
|
||||
|
||||
// Stop validator, and check saved tower
|
||||
let recent_slot = validator_client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
let validator_info = cluster.exit_node(&validator_id);
|
||||
let tower2 = Tower::restore(&ledger_path, &validator_id).unwrap();
|
||||
@@ -1613,6 +1616,9 @@ fn test_validator_saves_tower() {
|
||||
|
||||
// Wait for a new root, demonstrating the validator was able to make progress from the older `tower1`
|
||||
loop {
|
||||
#[allow(deprecated)]
|
||||
// This test depends on knowing the immediate root, without any delay from the commitment
|
||||
// service, so the deprecated CommitmentConfig::root() is retained
|
||||
if let Ok(root) = validator_client.get_slot_with_commitment(CommitmentConfig::root()) {
|
||||
trace!(
|
||||
"current root: {}, last_replayed_root: {}",
|
||||
@@ -1642,10 +1648,10 @@ fn test_validator_saves_tower() {
|
||||
|
||||
// Wait for a couple more slots to pass so another vote occurs
|
||||
let current_slot = validator_client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
loop {
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::recent()) {
|
||||
if let Ok(slot) = validator_client.get_slot_with_commitment(CommitmentConfig::processed()) {
|
||||
trace!("current_slot: {}, slot: {}", current_slot, slot);
|
||||
if slot > current_slot + 1 {
|
||||
break;
|
||||
@@ -2157,13 +2163,13 @@ fn test_optimistic_confirmation_violation_without_tower() {
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_run_test_load_program_accounts_root() {
|
||||
run_test_load_program_accounts(CommitmentConfig::root());
|
||||
run_test_load_program_accounts(CommitmentConfig::finalized());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn test_run_test_load_program_accounts_partition_root() {
|
||||
run_test_load_program_accounts_partition(CommitmentConfig::root());
|
||||
run_test_load_program_accounts_partition(CommitmentConfig::finalized());
|
||||
}
|
||||
|
||||
fn run_test_load_program_accounts_partition(scan_commitment: CommitmentConfig) {
|
||||
@@ -2245,7 +2251,7 @@ fn setup_transfer_scan_threads(
|
||||
return;
|
||||
}
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
for i in 0..starting_keypairs_.len() {
|
||||
client
|
||||
@@ -2388,7 +2394,7 @@ fn wait_for_next_snapshot(
|
||||
.get_validator_client(&cluster.entry_point_info.id)
|
||||
.unwrap();
|
||||
let last_slot = client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.expect("Couldn't get slot");
|
||||
|
||||
// Wait for a snapshot for a bank >= last_slot to be made so we know that the snapshot
|
||||
|
Reference in New Issue
Block a user