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:
@ -49,11 +49,14 @@ pub fn spend_and_verify_all_nodes<S: ::std::hash::BuildHasher>(
|
||||
let random_keypair = Keypair::new();
|
||||
let client = create_client(ingress_node.client_facing_addr(), VALIDATOR_PORT_RANGE);
|
||||
let bal = client
|
||||
.poll_get_balance_with_commitment(&funding_keypair.pubkey(), CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(
|
||||
&funding_keypair.pubkey(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("balance in source");
|
||||
assert!(bal > 0);
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
let mut transaction =
|
||||
system_transaction::transfer(&funding_keypair, &random_keypair.pubkey(), 1, blockhash);
|
||||
@ -78,7 +81,7 @@ pub fn verify_balances<S: ::std::hash::BuildHasher>(
|
||||
let client = create_client(node.client_facing_addr(), VALIDATOR_PORT_RANGE);
|
||||
for (pk, b) in expected_balances {
|
||||
let bal = client
|
||||
.poll_get_balance_with_commitment(&pk, CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(&pk, CommitmentConfig::processed())
|
||||
.expect("balance in source");
|
||||
assert_eq!(bal, b);
|
||||
}
|
||||
@ -95,11 +98,14 @@ pub fn send_many_transactions(
|
||||
for _ in 0..num_txs {
|
||||
let random_keypair = Keypair::new();
|
||||
let bal = client
|
||||
.poll_get_balance_with_commitment(&funding_keypair.pubkey(), CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(
|
||||
&funding_keypair.pubkey(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("balance in source");
|
||||
assert!(bal > 0);
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
let transfer_amount = thread_rng().gen_range(1, max_tokens_per_transfer);
|
||||
|
||||
@ -195,7 +201,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
|
||||
for ingress_node in &cluster_nodes {
|
||||
client
|
||||
.poll_get_balance_with_commitment(&ingress_node.id, CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(&ingress_node.id, CommitmentConfig::processed())
|
||||
.unwrap_or_else(|err| panic!("Node {} has no balance: {}", ingress_node.id, err));
|
||||
}
|
||||
|
||||
@ -219,7 +225,10 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
|
||||
let client = create_client(ingress_node.client_facing_addr(), VALIDATOR_PORT_RANGE);
|
||||
let balance = client
|
||||
.poll_get_balance_with_commitment(&funding_keypair.pubkey(), CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(
|
||||
&funding_keypair.pubkey(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("balance in source");
|
||||
assert_ne!(balance, 0);
|
||||
|
||||
@ -233,7 +242,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
|
||||
let random_keypair = Keypair::new();
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
let mut transaction = system_transaction::transfer(
|
||||
&funding_keypair,
|
||||
@ -311,7 +320,7 @@ pub fn check_no_new_roots(
|
||||
.unwrap_or_else(|_| panic!("get_slot for {} failed", ingress_node.id));
|
||||
roots[i] = initial_root;
|
||||
client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap_or_else(|_| panic!("get_slot for {} failed", ingress_node.id))
|
||||
})
|
||||
.max()
|
||||
@ -325,7 +334,7 @@ pub fn check_no_new_roots(
|
||||
for contact_info in contact_infos {
|
||||
let client = create_client(contact_info.client_facing_addr(), VALIDATOR_PORT_RANGE);
|
||||
current_slot = client
|
||||
.get_slot_with_commitment(CommitmentConfig::recent())
|
||||
.get_slot_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap_or_else(|_| panic!("get_slot for {} failed", contact_infos[0].id));
|
||||
if current_slot > end_slot {
|
||||
reached_end_slot = true;
|
||||
|
@ -435,7 +435,7 @@ impl LocalCluster {
|
||||
) -> u64 {
|
||||
trace!("getting leader blockhash");
|
||||
let (blockhash, _fee_calculator, _last_valid_slot) = client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap();
|
||||
let mut tx =
|
||||
system_transaction::transfer(&source_keypair, dest_pubkey, lamports, blockhash);
|
||||
@ -452,7 +452,7 @@ impl LocalCluster {
|
||||
.wait_for_balance_with_commitment(
|
||||
dest_pubkey,
|
||||
Some(lamports),
|
||||
CommitmentConfig::recent(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("get balance")
|
||||
}
|
||||
@ -474,7 +474,7 @@ impl LocalCluster {
|
||||
|
||||
// Create the vote account if necessary
|
||||
if client
|
||||
.poll_get_balance_with_commitment(&vote_account_pubkey, CommitmentConfig::recent())
|
||||
.poll_get_balance_with_commitment(&vote_account_pubkey, CommitmentConfig::processed())
|
||||
.unwrap_or(0)
|
||||
== 0
|
||||
{
|
||||
@ -496,7 +496,7 @@ impl LocalCluster {
|
||||
&[from_account.as_ref(), vote_account],
|
||||
message,
|
||||
client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap()
|
||||
.0,
|
||||
);
|
||||
@ -507,7 +507,7 @@ impl LocalCluster {
|
||||
.wait_for_balance_with_commitment(
|
||||
&vote_account_pubkey,
|
||||
Some(amount),
|
||||
CommitmentConfig::recent(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("get balance");
|
||||
|
||||
@ -524,7 +524,7 @@ impl LocalCluster {
|
||||
&[from_account.as_ref(), &stake_account_keypair],
|
||||
message,
|
||||
client
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
|
||||
.unwrap()
|
||||
.0,
|
||||
);
|
||||
@ -541,7 +541,7 @@ impl LocalCluster {
|
||||
.wait_for_balance_with_commitment(
|
||||
&stake_account_pubkey,
|
||||
Some(amount),
|
||||
CommitmentConfig::recent(),
|
||||
CommitmentConfig::processed(),
|
||||
)
|
||||
.expect("get balance");
|
||||
} else {
|
||||
@ -552,8 +552,9 @@ impl LocalCluster {
|
||||
}
|
||||
info!("Checking for vote account registration of {}", node_pubkey);
|
||||
match (
|
||||
client.get_account_with_commitment(&stake_account_pubkey, CommitmentConfig::recent()),
|
||||
client.get_account_with_commitment(&vote_account_pubkey, CommitmentConfig::recent()),
|
||||
client
|
||||
.get_account_with_commitment(&stake_account_pubkey, CommitmentConfig::processed()),
|
||||
client.get_account_with_commitment(&vote_account_pubkey, CommitmentConfig::processed()),
|
||||
) {
|
||||
(Ok(Some(stake_account)), Ok(Some(vote_account))) => {
|
||||
match (
|
||||
|
Reference in New Issue
Block a user