Feature disable fees sysvar (#18981)
* Feature disable fees sysvar * nudge
This commit is contained in:
@ -2,12 +2,11 @@
|
||||
|
||||
extern crate solana_program;
|
||||
#[allow(deprecated)]
|
||||
use solana_program::sysvar::{fees::Fees, recent_blockhashes::RecentBlockhashes};
|
||||
use solana_program::sysvar::recent_blockhashes::RecentBlockhashes;
|
||||
use solana_program::{
|
||||
account_info::AccountInfo,
|
||||
entrypoint,
|
||||
entrypoint::ProgramResult,
|
||||
fee_calculator::FeeCalculator,
|
||||
msg,
|
||||
program_error::ProgramError,
|
||||
pubkey::Pubkey,
|
||||
@ -44,22 +43,10 @@ pub fn process_instruction(
|
||||
assert_eq!(epoch_schedule, got_epoch_schedule);
|
||||
}
|
||||
|
||||
// Fees
|
||||
#[allow(deprecated)]
|
||||
{
|
||||
msg!("Fees identifier:");
|
||||
sysvar::fees::id().log();
|
||||
let fees = Fees::from_account_info(&accounts[4]).unwrap();
|
||||
let fee_calculator = fees.fee_calculator.clone();
|
||||
assert_ne!(fee_calculator, FeeCalculator::default());
|
||||
let got_fees = Fees::get()?;
|
||||
assert_eq!(fees, got_fees);
|
||||
}
|
||||
|
||||
// Instructions
|
||||
msg!("Instructions identifier:");
|
||||
sysvar::instructions::id().log();
|
||||
let index = instructions::load_current_index(&accounts[5].try_borrow_data()?);
|
||||
let index = instructions::load_current_index(&accounts[4].try_borrow_data()?);
|
||||
assert_eq!(0, index);
|
||||
|
||||
// Recent Blockhashes
|
||||
@ -67,7 +54,7 @@ pub fn process_instruction(
|
||||
{
|
||||
msg!("RecentBlockhashes identifier:");
|
||||
sysvar::recent_blockhashes::id().log();
|
||||
let recent_blockhashes = RecentBlockhashes::from_account_info(&accounts[6]).unwrap();
|
||||
let recent_blockhashes = RecentBlockhashes::from_account_info(&accounts[5]).unwrap();
|
||||
assert_ne!(recent_blockhashes, RecentBlockhashes::default());
|
||||
}
|
||||
|
||||
@ -75,7 +62,7 @@ pub fn process_instruction(
|
||||
{
|
||||
msg!("Rent identifier:");
|
||||
sysvar::rent::id().log();
|
||||
let rent = Rent::from_account_info(&accounts[7]).unwrap();
|
||||
let rent = Rent::from_account_info(&accounts[6]).unwrap();
|
||||
assert_eq!(rent, Rent::default());
|
||||
let got_rent = Rent::get()?;
|
||||
assert_eq!(rent, got_rent);
|
||||
@ -86,7 +73,7 @@ pub fn process_instruction(
|
||||
sysvar::slot_hashes::id().log();
|
||||
assert_eq!(
|
||||
Err(ProgramError::UnsupportedSysvar),
|
||||
SlotHashes::from_account_info(&accounts[8])
|
||||
SlotHashes::from_account_info(&accounts[7])
|
||||
);
|
||||
|
||||
// Slot History
|
||||
@ -94,13 +81,13 @@ pub fn process_instruction(
|
||||
sysvar::slot_history::id().log();
|
||||
assert_eq!(
|
||||
Err(ProgramError::UnsupportedSysvar),
|
||||
SlotHistory::from_account_info(&accounts[9])
|
||||
SlotHistory::from_account_info(&accounts[8])
|
||||
);
|
||||
|
||||
// Stake History
|
||||
msg!("StakeHistory identifier:");
|
||||
sysvar::stake_history::id().log();
|
||||
let _ = StakeHistory::from_account_info(&accounts[10]).unwrap();
|
||||
let _ = StakeHistory::from_account_info(&accounts[9]).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ 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),
|
||||
|
Reference in New Issue
Block a user