Deprecate SysvarRecentBlockhashes (#18875)
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
#[allow(deprecated)]
|
||||
use crate::sysvar::recent_blockhashes;
|
||||
use crate::{
|
||||
decode_error::DecodeError,
|
||||
instruction::{AccountMeta, Instruction},
|
||||
nonce,
|
||||
pubkey::Pubkey,
|
||||
system_program,
|
||||
sysvar::{recent_blockhashes, rent},
|
||||
sysvar::rent,
|
||||
};
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use thiserror::Error;
|
||||
@ -400,6 +402,7 @@ pub fn create_nonce_account_with_seed(
|
||||
&SystemInstruction::InitializeNonceAccount(*authority),
|
||||
vec![
|
||||
AccountMeta::new(*nonce_pubkey, false),
|
||||
#[allow(deprecated)]
|
||||
AccountMeta::new_readonly(recent_blockhashes::id(), false),
|
||||
AccountMeta::new_readonly(rent::id(), false),
|
||||
],
|
||||
@ -426,6 +429,7 @@ pub fn create_nonce_account(
|
||||
&SystemInstruction::InitializeNonceAccount(*authority),
|
||||
vec![
|
||||
AccountMeta::new(*nonce_pubkey, false),
|
||||
#[allow(deprecated)]
|
||||
AccountMeta::new_readonly(recent_blockhashes::id(), false),
|
||||
AccountMeta::new_readonly(rent::id(), false),
|
||||
],
|
||||
@ -436,6 +440,7 @@ pub fn create_nonce_account(
|
||||
pub fn advance_nonce_account(nonce_pubkey: &Pubkey, authorized_pubkey: &Pubkey) -> Instruction {
|
||||
let account_metas = vec![
|
||||
AccountMeta::new(*nonce_pubkey, false),
|
||||
#[allow(deprecated)]
|
||||
AccountMeta::new_readonly(recent_blockhashes::id(), false),
|
||||
AccountMeta::new_readonly(*authorized_pubkey, true),
|
||||
];
|
||||
@ -455,6 +460,7 @@ pub fn withdraw_nonce_account(
|
||||
let account_metas = vec![
|
||||
AccountMeta::new(*nonce_pubkey, false),
|
||||
AccountMeta::new(*to_pubkey, false),
|
||||
#[allow(deprecated)]
|
||||
AccountMeta::new_readonly(recent_blockhashes::id(), false),
|
||||
AccountMeta::new_readonly(rent::id(), false),
|
||||
AccountMeta::new_readonly(*authorized_pubkey, true),
|
||||
|
@ -13,6 +13,7 @@ pub mod slot_hashes;
|
||||
pub mod slot_history;
|
||||
pub mod stake_history;
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub fn is_sysvar_id(id: &Pubkey) -> bool {
|
||||
clock::check_id(id)
|
||||
|| epoch_schedule::check_id(id)
|
||||
|
@ -1,26 +1,38 @@
|
||||
#![allow(deprecated)]
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
use crate::{
|
||||
declare_sysvar_id,
|
||||
declare_deprecated_sysvar_id,
|
||||
fee_calculator::FeeCalculator,
|
||||
hash::{hash, Hash},
|
||||
sysvar::Sysvar,
|
||||
};
|
||||
use std::{cmp::Ordering, collections::BinaryHeap, iter::FromIterator, ops::Deref};
|
||||
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
pub const MAX_ENTRIES: usize = 150;
|
||||
|
||||
declare_sysvar_id!(
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
declare_deprecated_sysvar_id!(
|
||||
"SysvarRecentB1ockHashes11111111111111111111",
|
||||
RecentBlockhashes
|
||||
);
|
||||
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
pub struct Entry {
|
||||
pub blockhash: Hash,
|
||||
pub fee_calculator: FeeCalculator,
|
||||
}
|
||||
|
||||
impl Entry {
|
||||
pub fn new(blockhash: &Hash, fee_calculator: &FeeCalculator) -> Self {
|
||||
Self {
|
||||
@ -30,6 +42,10 @@ impl Entry {
|
||||
}
|
||||
}
|
||||
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct IterItem<'a>(pub u64, pub &'a Hash, pub &'a FeeCalculator);
|
||||
|
||||
@ -57,6 +73,10 @@ impl<'a> PartialOrd for IterItem<'a> {
|
||||
///
|
||||
/// The entries are ordered by descending block height, so the first entry holds
|
||||
/// the most recent block hash, and the last entry holds an old block hash.
|
||||
#[deprecated(
|
||||
since = "1.8.0",
|
||||
note = "Please do not use, will no longer be available in the future"
|
||||
)]
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub struct RecentBlockhashes(Vec<Entry>);
|
||||
|
Reference in New Issue
Block a user