deprecate fees sysvar (#18960)
This commit is contained in:
@ -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();
|
||||
|
@ -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),
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -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),
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -9,6 +9,8 @@ use solana_rbpf::{
|
||||
vm::{EbpfVm, SyscallObject, SyscallRegistry},
|
||||
};
|
||||
use solana_runtime::message_processor::MessageProcessor;
|
||||
#[allow(deprecated)]
|
||||
use solana_sdk::sysvar::fees::Fees;
|
||||
use solana_sdk::{
|
||||
account::{Account, AccountSharedData, ReadableAccount},
|
||||
account_info::AccountInfo,
|
||||
@ -35,7 +37,7 @@ use solana_sdk::{
|
||||
secp256k1_recover::{
|
||||
Secp256k1RecoverError, SECP256K1_PUBLIC_KEY_LENGTH, SECP256K1_SIGNATURE_LENGTH,
|
||||
},
|
||||
sysvar::{self, fees::Fees, Sysvar, SysvarId},
|
||||
sysvar::{self, Sysvar, SysvarId},
|
||||
};
|
||||
use std::{
|
||||
alloc::Layout,
|
||||
@ -1114,6 +1116,7 @@ struct SyscallGetFeesSysvar<'a> {
|
||||
invoke_context: Rc<RefCell<&'a mut dyn InvokeContext>>,
|
||||
loader_id: &'a Pubkey,
|
||||
}
|
||||
#[allow(deprecated)]
|
||||
impl<'a> SyscallObject<BpfError> for SyscallGetFeesSysvar<'a> {
|
||||
fn call(
|
||||
&mut self,
|
||||
@ -3365,6 +3368,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test fees sysvar
|
||||
#[allow(deprecated)]
|
||||
{
|
||||
let got_fees = Fees::default();
|
||||
let got_fees_va = 2048;
|
||||
|
Reference in New Issue
Block a user