cli stake tests: Increase stake amounts to handle raising minimum delegation (#24835)
This commit is contained in:
parent
45314a89b0
commit
cb501807ca
|
@ -49,7 +49,12 @@ fn test_stake_delegation_force() {
|
||||||
config.json_rpc_url = test_validator.rpc_url();
|
config.json_rpc_url = test_validator.rpc_url();
|
||||||
config.signers = vec![&default_signer];
|
config.signers = vec![&default_signer];
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 100_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
100_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Create vote account
|
// Create vote account
|
||||||
|
@ -82,7 +87,7 @@ fn test_stake_delegation_force() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -150,10 +155,14 @@ fn test_seed_stake_delegation_and_deactivation() {
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config_validator,
|
&config_validator,
|
||||||
&config_validator.signers[0].pubkey(),
|
&config_validator.signers[0].pubkey(),
|
||||||
100_000,
|
100_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(100_000, &rpc_client, &config_validator.signers[0].pubkey());
|
check_balance!(
|
||||||
|
100_000_000_000,
|
||||||
|
&rpc_client,
|
||||||
|
&config_validator.signers[0].pubkey()
|
||||||
|
);
|
||||||
|
|
||||||
let stake_address = Pubkey::create_with_seed(
|
let stake_address = Pubkey::create_with_seed(
|
||||||
&config_validator.signers[0].pubkey(),
|
&config_validator.signers[0].pubkey(),
|
||||||
|
@ -171,7 +180,7 @@ fn test_seed_stake_delegation_and_deactivation() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -240,10 +249,14 @@ fn test_stake_delegation_and_deactivation() {
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config_validator,
|
&config_validator,
|
||||||
&config_validator.signers[0].pubkey(),
|
&config_validator.signers[0].pubkey(),
|
||||||
100_000,
|
100_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(100_000, &rpc_client, &config_validator.signers[0].pubkey());
|
check_balance!(
|
||||||
|
100_000_000_000,
|
||||||
|
&rpc_client,
|
||||||
|
&config_validator.signers[0].pubkey()
|
||||||
|
);
|
||||||
|
|
||||||
// Create stake account
|
// Create stake account
|
||||||
config_validator.signers.push(&stake_keypair);
|
config_validator.signers.push(&stake_keypair);
|
||||||
|
@ -254,7 +267,7 @@ fn test_stake_delegation_and_deactivation() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -335,19 +348,27 @@ fn test_offline_stake_delegation_and_deactivation() {
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config_validator,
|
&config_validator,
|
||||||
&config_validator.signers[0].pubkey(),
|
&config_validator.signers[0].pubkey(),
|
||||||
100_000,
|
100_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(100_000, &rpc_client, &config_validator.signers[0].pubkey());
|
check_balance!(
|
||||||
|
100_000_000_000,
|
||||||
|
&rpc_client,
|
||||||
|
&config_validator.signers[0].pubkey()
|
||||||
|
);
|
||||||
|
|
||||||
request_and_confirm_airdrop(
|
request_and_confirm_airdrop(
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config_offline,
|
&config_offline,
|
||||||
&config_offline.signers[0].pubkey(),
|
&config_offline.signers[0].pubkey(),
|
||||||
100_000,
|
100_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(100_000, &rpc_client, &config_offline.signers[0].pubkey());
|
check_balance!(
|
||||||
|
100_000_000_000,
|
||||||
|
&rpc_client,
|
||||||
|
&config_offline.signers[0].pubkey()
|
||||||
|
);
|
||||||
|
|
||||||
// Create stake account
|
// Create stake account
|
||||||
config_validator.signers.push(&stake_keypair);
|
config_validator.signers.push(&stake_keypair);
|
||||||
|
@ -358,7 +379,7 @@ fn test_offline_stake_delegation_and_deactivation() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -468,7 +489,12 @@ fn test_nonced_stake_delegation_and_deactivation() {
|
||||||
.get_minimum_balance_for_rent_exemption(NonceState::size())
|
.get_minimum_balance_for_rent_exemption(NonceState::size())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 100_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
100_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Create stake account
|
// Create stake account
|
||||||
|
@ -481,7 +507,7 @@ fn test_nonced_stake_delegation_and_deactivation() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -583,7 +609,12 @@ fn test_stake_authorize() {
|
||||||
config.json_rpc_url = test_validator.rpc_url();
|
config.json_rpc_url = test_validator.rpc_url();
|
||||||
config.signers = vec![&default_signer];
|
config.signers = vec![&default_signer];
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 100_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
100_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let offline_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
let offline_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
||||||
|
@ -599,7 +630,7 @@ fn test_stake_authorize() {
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config_offline,
|
&config_offline,
|
||||||
&config_offline.signers[0].pubkey(),
|
&config_offline.signers[0].pubkey(),
|
||||||
100_000,
|
100_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -614,7 +645,7 @@ fn test_stake_authorize() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -919,14 +950,21 @@ fn test_stake_authorize_with_fee_payer() {
|
||||||
config_offline.command = CliCommand::ClusterVersion;
|
config_offline.command = CliCommand::ClusterVersion;
|
||||||
process_command(&config_offline).unwrap_err();
|
process_command(&config_offline).unwrap_err();
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &default_pubkey, 5_000_000).unwrap();
|
request_and_confirm_airdrop(&rpc_client, &config, &default_pubkey, 5_000_000_000_000).unwrap();
|
||||||
check_balance!(5_000_000, &rpc_client, &config.signers[0].pubkey());
|
check_balance!(5_000_000_000_000, &rpc_client, &config.signers[0].pubkey());
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config_payer, &payer_pubkey, 5_000_000).unwrap();
|
request_and_confirm_airdrop(&rpc_client, &config_payer, &payer_pubkey, 5_000_000_000_000)
|
||||||
check_balance!(5_000_000, &rpc_client, &payer_pubkey);
|
.unwrap();
|
||||||
|
check_balance!(5_000_000_000_000, &rpc_client, &payer_pubkey);
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config_offline, &offline_pubkey, 5_000_000).unwrap();
|
request_and_confirm_airdrop(
|
||||||
check_balance!(5_000_000, &rpc_client, &offline_pubkey);
|
&rpc_client,
|
||||||
|
&config_offline,
|
||||||
|
&offline_pubkey,
|
||||||
|
5_000_000_000_000,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
check_balance!(5_000_000_000_000, &rpc_client, &offline_pubkey);
|
||||||
|
|
||||||
check_ready(&rpc_client);
|
check_ready(&rpc_client);
|
||||||
|
|
||||||
|
@ -941,7 +979,7 @@ fn test_stake_authorize_with_fee_payer() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(1_000_000),
|
amount: SpendAmount::Some(1_000_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -952,7 +990,11 @@ fn test_stake_authorize_with_fee_payer() {
|
||||||
from: 0,
|
from: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(4_000_000 - fee_two_sig, &rpc_client, &default_pubkey);
|
check_balance!(
|
||||||
|
4_000_000_000_000 - fee_two_sig,
|
||||||
|
&rpc_client,
|
||||||
|
&default_pubkey
|
||||||
|
);
|
||||||
|
|
||||||
// Assign authority with separate fee payer
|
// Assign authority with separate fee payer
|
||||||
config.signers = vec![&default_signer, &payer_keypair];
|
config.signers = vec![&default_signer, &payer_keypair];
|
||||||
|
@ -976,10 +1018,14 @@ fn test_stake_authorize_with_fee_payer() {
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
// `config` balance has not changed, despite submitting the TX
|
// `config` balance has not changed, despite submitting the TX
|
||||||
check_balance!(4_000_000 - fee_two_sig, &rpc_client, &default_pubkey);
|
check_balance!(
|
||||||
|
4_000_000_000_000 - fee_two_sig,
|
||||||
|
&rpc_client,
|
||||||
|
&default_pubkey
|
||||||
|
);
|
||||||
// `config_payer` however has paid `config`'s authority sig
|
// `config_payer` however has paid `config`'s authority sig
|
||||||
// and `config_payer`'s fee sig
|
// and `config_payer`'s fee sig
|
||||||
check_balance!(5_000_000 - fee_two_sig, &rpc_client, &payer_pubkey);
|
check_balance!(5_000_000_000_000 - fee_two_sig, &rpc_client, &payer_pubkey);
|
||||||
|
|
||||||
// Assign authority with offline fee payer
|
// Assign authority with offline fee payer
|
||||||
let blockhash = rpc_client.get_latest_blockhash().unwrap();
|
let blockhash = rpc_client.get_latest_blockhash().unwrap();
|
||||||
|
@ -1027,10 +1073,18 @@ fn test_stake_authorize_with_fee_payer() {
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
// `config`'s balance again has not changed
|
// `config`'s balance again has not changed
|
||||||
check_balance!(4_000_000 - fee_two_sig, &rpc_client, &default_pubkey);
|
check_balance!(
|
||||||
|
4_000_000_000_000 - fee_two_sig,
|
||||||
|
&rpc_client,
|
||||||
|
&default_pubkey
|
||||||
|
);
|
||||||
// `config_offline` however has paid 1 sig due to being both authority
|
// `config_offline` however has paid 1 sig due to being both authority
|
||||||
// and fee payer
|
// and fee payer
|
||||||
check_balance!(5_000_000 - fee_one_sig, &rpc_client, &offline_pubkey);
|
check_balance!(
|
||||||
|
5_000_000_000_000 - fee_one_sig,
|
||||||
|
&rpc_client,
|
||||||
|
&offline_pubkey
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1068,18 +1122,25 @@ fn test_stake_split() {
|
||||||
&rpc_client,
|
&rpc_client,
|
||||||
&config,
|
&config,
|
||||||
&config.signers[0].pubkey(),
|
&config.signers[0].pubkey(),
|
||||||
50_000_000,
|
50_000_000_000_000,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(50_000_000, &rpc_client, &config.signers[0].pubkey());
|
check_balance!(50_000_000_000_000, &rpc_client, &config.signers[0].pubkey());
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config_offline, &offline_pubkey, 1_000_000).unwrap();
|
request_and_confirm_airdrop(
|
||||||
check_balance!(1_000_000, &rpc_client, &offline_pubkey);
|
&rpc_client,
|
||||||
|
&config_offline,
|
||||||
|
&offline_pubkey,
|
||||||
|
1_000_000_000_000,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
check_balance!(1_000_000_000_000, &rpc_client, &offline_pubkey);
|
||||||
|
|
||||||
// Create stake account, identity is authority
|
// Create stake account, identity is authority
|
||||||
let minimum_stake_balance = rpc_client
|
let stake_balance = rpc_client
|
||||||
.get_minimum_balance_for_rent_exemption(StakeState::size_of())
|
.get_minimum_balance_for_rent_exemption(StakeState::size_of())
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
+ 10_000_000_000;
|
||||||
let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
||||||
let stake_account_pubkey = stake_keypair.pubkey();
|
let stake_account_pubkey = stake_keypair.pubkey();
|
||||||
config.signers.push(&stake_keypair);
|
config.signers.push(&stake_keypair);
|
||||||
|
@ -1090,7 +1151,7 @@ fn test_stake_split() {
|
||||||
withdrawer: Some(offline_pubkey),
|
withdrawer: Some(offline_pubkey),
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(10 * minimum_stake_balance),
|
amount: SpendAmount::Some(10 * stake_balance),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -1101,11 +1162,7 @@ fn test_stake_split() {
|
||||||
from: 0,
|
from: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(
|
check_balance!(10 * stake_balance, &rpc_client, &stake_account_pubkey,);
|
||||||
10 * minimum_stake_balance,
|
|
||||||
&rpc_client,
|
|
||||||
&stake_account_pubkey,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create nonce account
|
// Create nonce account
|
||||||
let minimum_nonce_balance = rpc_client
|
let minimum_nonce_balance = rpc_client
|
||||||
|
@ -1148,7 +1205,7 @@ fn test_stake_split() {
|
||||||
memo: None,
|
memo: None,
|
||||||
split_stake_account: 1,
|
split_stake_account: 1,
|
||||||
seed: None,
|
seed: None,
|
||||||
lamports: 2 * minimum_stake_balance,
|
lamports: 2 * stake_balance,
|
||||||
fee_payer: 0,
|
fee_payer: 0,
|
||||||
};
|
};
|
||||||
config_offline.output_format = OutputFormat::JsonCompact;
|
config_offline.output_format = OutputFormat::JsonCompact;
|
||||||
|
@ -1171,20 +1228,12 @@ fn test_stake_split() {
|
||||||
memo: None,
|
memo: None,
|
||||||
split_stake_account: 1,
|
split_stake_account: 1,
|
||||||
seed: None,
|
seed: None,
|
||||||
lamports: 2 * minimum_stake_balance,
|
lamports: 2 * stake_balance,
|
||||||
fee_payer: 0,
|
fee_payer: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(
|
check_balance!(8 * stake_balance, &rpc_client, &stake_account_pubkey,);
|
||||||
8 * minimum_stake_balance,
|
check_balance!(2 * stake_balance, &rpc_client, &split_account.pubkey(),);
|
||||||
&rpc_client,
|
|
||||||
&stake_account_pubkey,
|
|
||||||
);
|
|
||||||
check_balance!(
|
|
||||||
2 * minimum_stake_balance,
|
|
||||||
&rpc_client,
|
|
||||||
&split_account.pubkey(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1218,17 +1267,29 @@ fn test_stake_set_lockup() {
|
||||||
config_offline.command = CliCommand::ClusterVersion;
|
config_offline.command = CliCommand::ClusterVersion;
|
||||||
process_command(&config_offline).unwrap_err();
|
process_command(&config_offline).unwrap_err();
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 5_000_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
5_000_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(5_000_000, &rpc_client, &config.signers[0].pubkey());
|
check_balance!(5_000_000_000_000, &rpc_client, &config.signers[0].pubkey());
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config_offline, &offline_pubkey, 1_000_000).unwrap();
|
request_and_confirm_airdrop(
|
||||||
check_balance!(1_000_000, &rpc_client, &offline_pubkey);
|
&rpc_client,
|
||||||
|
&config_offline,
|
||||||
|
&offline_pubkey,
|
||||||
|
1_000_000_000_000,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
check_balance!(1_000_000_000_000, &rpc_client, &offline_pubkey);
|
||||||
|
|
||||||
// Create stake account, identity is authority
|
// Create stake account, identity is authority
|
||||||
let minimum_stake_balance = rpc_client
|
let stake_balance = rpc_client
|
||||||
.get_minimum_balance_for_rent_exemption(StakeState::size_of())
|
.get_minimum_balance_for_rent_exemption(StakeState::size_of())
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
+ 10_000_000_000;
|
||||||
|
|
||||||
let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
||||||
let stake_account_pubkey = stake_keypair.pubkey();
|
let stake_account_pubkey = stake_keypair.pubkey();
|
||||||
|
@ -1246,7 +1307,7 @@ fn test_stake_set_lockup() {
|
||||||
withdrawer: Some(config.signers[0].pubkey()),
|
withdrawer: Some(config.signers[0].pubkey()),
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup,
|
lockup,
|
||||||
amount: SpendAmount::Some(10 * minimum_stake_balance),
|
amount: SpendAmount::Some(10 * stake_balance),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -1257,16 +1318,8 @@ fn test_stake_set_lockup() {
|
||||||
from: 0,
|
from: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(
|
check_balance!(10 * stake_balance, &rpc_client, &stake_account_pubkey,);
|
||||||
10 * minimum_stake_balance,
|
check_balance!(10 * stake_balance, &rpc_client, &stake_account_pubkey,);
|
||||||
&rpc_client,
|
|
||||||
&stake_account_pubkey,
|
|
||||||
);
|
|
||||||
check_balance!(
|
|
||||||
10 * minimum_stake_balance,
|
|
||||||
&rpc_client,
|
|
||||||
&stake_account_pubkey,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Online set lockup
|
// Online set lockup
|
||||||
let lockup = LockupArgs {
|
let lockup = LockupArgs {
|
||||||
|
@ -1489,12 +1542,23 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
// Verify that we cannot reach the cluster
|
// Verify that we cannot reach the cluster
|
||||||
process_command(&config_offline).unwrap_err();
|
process_command(&config_offline).unwrap_err();
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 200_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
200_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
check_balance!(200_000, &rpc_client, &config.signers[0].pubkey());
|
check_balance!(200_000_000_000, &rpc_client, &config.signers[0].pubkey());
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config_offline, &offline_pubkey, 100_000).unwrap();
|
request_and_confirm_airdrop(
|
||||||
check_balance!(100_000, &rpc_client, &offline_pubkey);
|
&rpc_client,
|
||||||
|
&config_offline,
|
||||||
|
&offline_pubkey,
|
||||||
|
100_000_000_000,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
check_balance!(100_000_000_000, &rpc_client, &offline_pubkey);
|
||||||
|
|
||||||
// Create nonce account
|
// Create nonce account
|
||||||
let minimum_nonce_balance = rpc_client
|
let minimum_nonce_balance = rpc_client
|
||||||
|
@ -1533,7 +1597,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::None(nonce_hash),
|
blockhash_query: BlockhashQuery::None(nonce_hash),
|
||||||
|
@ -1557,7 +1621,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
|
@ -1571,7 +1635,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
from: 0,
|
from: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(50_000, &rpc_client, &stake_pubkey);
|
check_balance!(50_000_000_000, &rpc_client, &stake_pubkey);
|
||||||
|
|
||||||
// Fetch nonce hash
|
// Fetch nonce hash
|
||||||
let nonce_hash = nonce_utils::get_account_with_commitment(
|
let nonce_hash = nonce_utils::get_account_with_commitment(
|
||||||
|
@ -1590,7 +1654,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
config_offline.command = CliCommand::WithdrawStake {
|
config_offline.command = CliCommand::WithdrawStake {
|
||||||
stake_account_pubkey: stake_pubkey,
|
stake_account_pubkey: stake_pubkey,
|
||||||
destination_account_pubkey: recipient_pubkey,
|
destination_account_pubkey: recipient_pubkey,
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
withdraw_authority: 0,
|
withdraw_authority: 0,
|
||||||
custodian: None,
|
custodian: None,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
@ -1609,7 +1673,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
config.command = CliCommand::WithdrawStake {
|
config.command = CliCommand::WithdrawStake {
|
||||||
stake_account_pubkey: stake_pubkey,
|
stake_account_pubkey: stake_pubkey,
|
||||||
destination_account_pubkey: recipient_pubkey,
|
destination_account_pubkey: recipient_pubkey,
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
withdraw_authority: 0,
|
withdraw_authority: 0,
|
||||||
custodian: None,
|
custodian: None,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
@ -1625,7 +1689,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
fee_payer: 0,
|
fee_payer: 0,
|
||||||
};
|
};
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
check_balance!(50_000, &rpc_client, &recipient_pubkey);
|
check_balance!(50_000_000_000, &rpc_client, &recipient_pubkey);
|
||||||
|
|
||||||
// Fetch nonce hash
|
// Fetch nonce hash
|
||||||
let nonce_hash = nonce_utils::get_account_with_commitment(
|
let nonce_hash = nonce_utils::get_account_with_commitment(
|
||||||
|
@ -1647,7 +1711,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
withdrawer: None,
|
withdrawer: None,
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::None(nonce_hash),
|
blockhash_query: BlockhashQuery::None(nonce_hash),
|
||||||
|
@ -1669,7 +1733,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
withdrawer: Some(offline_pubkey),
|
withdrawer: Some(offline_pubkey),
|
||||||
withdrawer_signer: None,
|
withdrawer_signer: None,
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
|
@ -1685,7 +1749,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() {
|
||||||
process_command(&config).unwrap();
|
process_command(&config).unwrap();
|
||||||
let seed_address =
|
let seed_address =
|
||||||
Pubkey::create_with_seed(&stake_pubkey, seed, &stake::program::id()).unwrap();
|
Pubkey::create_with_seed(&stake_pubkey, seed, &stake::program::id()).unwrap();
|
||||||
check_balance!(50_000, &rpc_client, &seed_address);
|
check_balance!(50_000_000_000, &rpc_client, &seed_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1706,7 +1770,12 @@ fn test_stake_checked_instructions() {
|
||||||
config.json_rpc_url = test_validator.rpc_url();
|
config.json_rpc_url = test_validator.rpc_url();
|
||||||
config.signers = vec![&default_signer];
|
config.signers = vec![&default_signer];
|
||||||
|
|
||||||
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 100_000)
|
request_and_confirm_airdrop(
|
||||||
|
&rpc_client,
|
||||||
|
&config,
|
||||||
|
&config.signers[0].pubkey(),
|
||||||
|
100_000_000_000,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Create stake account with withdrawer
|
// Create stake account with withdrawer
|
||||||
|
@ -1722,7 +1791,7 @@ fn test_stake_checked_instructions() {
|
||||||
withdrawer: Some(withdrawer_pubkey),
|
withdrawer: Some(withdrawer_pubkey),
|
||||||
withdrawer_signer: Some(1),
|
withdrawer_signer: Some(1),
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
@ -1742,7 +1811,7 @@ fn test_stake_checked_instructions() {
|
||||||
withdrawer: Some(withdrawer_pubkey),
|
withdrawer: Some(withdrawer_pubkey),
|
||||||
withdrawer_signer: Some(1),
|
withdrawer_signer: Some(1),
|
||||||
lockup: Lockup::default(),
|
lockup: Lockup::default(),
|
||||||
amount: SpendAmount::Some(50_000),
|
amount: SpendAmount::Some(50_000_000_000),
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
dump_transaction_message: false,
|
dump_transaction_message: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
|
Loading…
Reference in New Issue