deprecate fees sysvar (#18960)

This commit is contained in:
Jack May
2021-07-29 10:48:14 -07:00
committed by GitHub
parent da480bdb5f
commit dfbb0c559b
11 changed files with 98 additions and 88 deletions

View File

@@ -2,7 +2,7 @@
extern crate solana_program;
#[allow(deprecated)]
use solana_program::sysvar::recent_blockhashes::RecentBlockhashes;
use solana_program::sysvar::{fees::Fees, recent_blockhashes::RecentBlockhashes};
use solana_program::{
account_info::AccountInfo,
entrypoint,
@@ -12,7 +12,7 @@ use solana_program::{
program_error::ProgramError,
pubkey::Pubkey,
sysvar::{
self, clock::Clock, epoch_schedule::EpochSchedule, fees::Fees, instructions, rent::Rent,
self, clock::Clock, epoch_schedule::EpochSchedule, instructions, rent::Rent,
slot_hashes::SlotHashes, slot_history::SlotHistory, stake_history::StakeHistory, Sysvar,
},
};
@@ -45,6 +45,7 @@ pub fn process_instruction(
}
// Fees
#[allow(deprecated)]
{
msg!("Fees identifier:");
sysvar::fees::id().log();

View File

@@ -1,13 +1,11 @@
use solana_bpf_rust_sysvar::process_instruction;
use solana_program_test::*;
use solana_sdk::sysvar::{fees, recent_blockhashes};
use solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
signature::Signer,
sysvar::{
clock, epoch_schedule, fees, instructions, recent_blockhashes, rent, slot_hashes,
slot_history, stake_history,
},
sysvar::{clock, epoch_schedule, instructions, rent, slot_hashes, slot_history, stake_history},
transaction::Transaction,
};
@@ -30,8 +28,10 @@ async fn test_sysvars() {
AccountMeta::new(Pubkey::new_unique(), false),
AccountMeta::new_readonly(clock::id(), false),
AccountMeta::new_readonly(epoch_schedule::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(fees::id(), false),
AccountMeta::new_readonly(instructions::id(), false),
#[allow(deprecated)]
AccountMeta::new_readonly(recent_blockhashes::id(), false),
AccountMeta::new_readonly(rent::id(), false),
AccountMeta::new_readonly(slot_hashes::id(), false),

View File

@@ -2,12 +2,8 @@
extern crate solana_program;
use solana_program::{
account_info::AccountInfo,
entrypoint,
entrypoint::ProgramResult,
msg,
pubkey::Pubkey,
sysvar::{clock, fees},
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
sysvar::clock,
};
entrypoint!(process_instruction);
@@ -17,9 +13,8 @@ fn process_instruction(
_instruction_data: &[u8],
) -> ProgramResult {
msg!("Upgradeable program");
assert_eq!(accounts.len(), 3);
assert_eq!(accounts.len(), 2);
assert_eq!(accounts[0].key, program_id);
assert_eq!(*accounts[1].key, clock::id());
assert_eq!(*accounts[2].key, fees::id());
Err(42.into())
}

View File

@@ -2,12 +2,8 @@
extern crate solana_program;
use solana_program::{
account_info::AccountInfo,
entrypoint,
entrypoint::ProgramResult,
msg,
pubkey::Pubkey,
sysvar::{clock, fees},
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
sysvar::clock,
};
entrypoint!(process_instruction);
@@ -17,9 +13,8 @@ fn process_instruction(
_instruction_data: &[u8],
) -> ProgramResult {
msg!("Upgraded program");
assert_eq!(accounts.len(), 3);
assert_eq!(accounts.len(), 2);
assert_eq!(accounts[0].key, program_id);
assert_eq!(*accounts[1].key, clock::id());
assert_eq!(*accounts[2].key, fees::id());
Err(43.into())
}

View File

@@ -42,7 +42,7 @@ use solana_sdk::{
pubkey::Pubkey,
signature::{keypair_from_seed, Keypair, Signer},
system_instruction,
sysvar::{clock, fees, rent},
sysvar::{clock, rent},
transaction::{Transaction, TransactionError},
};
use solana_transaction_status::{
@@ -1258,11 +1258,8 @@ fn test_program_bpf_call_depth() {
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_ok());
let instruction = Instruction::new_with_bincode(
program_id,
&ComputeBudget::default().max_call_depth,
vec![],
);
let instruction =
Instruction::new_with_bincode(program_id, &ComputeBudget::default().max_call_depth, vec![]);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_err());
}
@@ -1701,7 +1698,6 @@ fn test_program_bpf_upgrade() {
vec![
AccountMeta::new(program_id.clone(), false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);
@@ -1797,7 +1793,6 @@ fn test_program_bpf_upgrade_and_invoke_in_same_tx() {
vec![
AccountMeta::new(program_id.clone(), false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);
@@ -1886,7 +1881,6 @@ fn test_program_bpf_invoke_upgradeable_via_cpi() {
AccountMeta::new(program_id, false),
AccountMeta::new(program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);
@@ -2077,7 +2071,6 @@ fn test_program_bpf_upgrade_via_cpi() {
AccountMeta::new(program_id, false),
AccountMeta::new(program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);
@@ -2182,7 +2175,6 @@ fn test_program_bpf_upgrade_self_via_cpi() {
AccountMeta::new(noop_program_id, false),
AccountMeta::new(noop_program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);