Add fees to tx-wide caps (#22081)

This commit is contained in:
Jack May
2022-02-11 16:23:16 -08:00
committed by GitHub
parent 12dffc105a
commit 3d9874b95a
15 changed files with 1149 additions and 186 deletions

View File

@ -1585,13 +1585,10 @@ mod tests {
#[test]
fn test_check_payer_balances_distribute_tokens_single_payer() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(
alice.pubkey(),
fees,
10_000,
None,
SocketAddrSpace::Unspecified,
);
@ -1601,6 +1598,11 @@ mod tests {
let sender_keypair_file = tmp_file_path("keypair_file", &alice.pubkey());
write_keypair_file(&alice, &sender_keypair_file).unwrap();
let fees = client
.get_fee_for_message(&one_signer_message(&client))
.unwrap();
let fees_in_sol = lamports_to_sol(fees);
let allocation_amount = 1000.0;
// Fully funded payer
@ -1678,12 +1680,10 @@ mod tests {
#[test]
fn test_check_payer_balances_distribute_tokens_separate_payers() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(
alice.pubkey(),
fees,
10_000,
None,
SocketAddrSpace::Unspecified,
);
@ -1691,6 +1691,11 @@ mod tests {
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
let fees = client
.get_fee_for_message(&one_signer_message(&client))
.unwrap();
let fees_in_sol = lamports_to_sol(fees);
let sender_keypair_file = tmp_file_path("keypair_file", &alice.pubkey());
write_keypair_file(&alice, &sender_keypair_file).unwrap();
@ -1802,18 +1807,21 @@ mod tests {
#[test]
fn test_check_payer_balances_distribute_stakes_single_payer() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(
alice.pubkey(),
fees,
10_000,
None,
SocketAddrSpace::Unspecified,
);
let url = test_validator.rpc_url();
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
let fees = client
.get_fee_for_message(&one_signer_message(&client))
.unwrap();
let fees_in_sol = lamports_to_sol(fees);
let sender_keypair_file = tmp_file_path("keypair_file", &alice.pubkey());
write_keypair_file(&alice, &sender_keypair_file).unwrap();
@ -1925,12 +1933,10 @@ mod tests {
#[test]
fn test_check_payer_balances_distribute_stakes_separate_payers() {
let fees = 10_000;
let fees_in_sol = lamports_to_sol(fees);
let alice = Keypair::new();
let test_validator = TestValidator::with_custom_fees(
alice.pubkey(),
fees,
10_000,
None,
SocketAddrSpace::Unspecified,
);
@ -1938,6 +1944,11 @@ mod tests {
let client = RpcClient::new_with_commitment(url, CommitmentConfig::processed());
let fees = client
.get_fee_for_message(&one_signer_message(&client))
.unwrap();
let fees_in_sol = lamports_to_sol(fees);
let sender_keypair_file = tmp_file_path("keypair_file", &alice.pubkey());
write_keypair_file(&alice, &sender_keypair_file).unwrap();