Use bs58 strings to declare IDs rather then raw bytes (#7082)
This commit is contained in:
@@ -8,12 +8,7 @@ use crate::{
|
||||
sysvar::Sysvar,
|
||||
};
|
||||
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 24, 199, 116, 201, 40, 86, 99, 152, 105, 29, 94, 182, 139, 94, 184, 163, 155,
|
||||
75, 109, 92, 115, 85, 91, 33, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(ID, "SysvarC1ock11111111111111111111111111111111", Clock);
|
||||
crate::declare_sysvar_id!("SysvarC1ock11111111111111111111111111111111", Clock);
|
||||
|
||||
impl Sysvar for Clock {}
|
||||
|
||||
|
@@ -3,17 +3,7 @@
|
||||
pub use crate::epoch_schedule::EpochSchedule;
|
||||
use crate::{account::Account, sysvar::Sysvar};
|
||||
|
||||
/// epoch_schedule account pubkey
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 24, 220, 63, 238, 2, 211, 228, 127, 1, 0, 248, 176, 84, 247, 148, 46, 96, 89,
|
||||
30, 63, 80, 135, 25, 168, 5, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(
|
||||
ID,
|
||||
"SysvarEpochSchedu1e111111111111111111111111",
|
||||
EpochSchedule
|
||||
);
|
||||
crate::declare_sysvar_id!("SysvarEpochSchedu1e111111111111111111111111", EpochSchedule);
|
||||
|
||||
impl Sysvar for EpochSchedule {}
|
||||
|
||||
|
@@ -2,13 +2,7 @@
|
||||
//!
|
||||
use crate::{account::Account, fee_calculator::FeeCalculator, sysvar::Sysvar};
|
||||
|
||||
/// fees account pubkey
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 24, 226, 90, 141, 131, 80, 60, 37, 26, 122, 240, 113, 38, 253, 114, 0, 223,
|
||||
111, 196, 237, 82, 106, 156, 144, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(ID, "SysvarFees111111111111111111111111111111111", Fees);
|
||||
crate::declare_sysvar_id!("SysvarFees111111111111111111111111111111111", Fees);
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
|
@@ -28,9 +28,9 @@ pub fn is_sysvar_id(id: &Pubkey) -> bool {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! solana_sysvar_id(
|
||||
($id:ident, $name:expr, $type:ty) => (
|
||||
$crate::solana_name_id!($id, $name);
|
||||
macro_rules! declare_sysvar_id(
|
||||
($name:expr, $type:ty) => (
|
||||
$crate::declare_id!($name);
|
||||
|
||||
impl $crate::sysvar::SysvarId for $type {
|
||||
fn check_id(pubkey: &$crate::pubkey::Pubkey) -> bool {
|
||||
@@ -48,14 +48,8 @@ macro_rules! solana_sysvar_id(
|
||||
)
|
||||
);
|
||||
|
||||
/// "Sysvar1111111111111111111111111111111111111"
|
||||
/// owner pubkey for sysvar accounts
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 24, 117, 247, 41, 199, 61, 147, 64, 143, 33, 97, 32, 6, 126, 216, 140, 118,
|
||||
224, 140, 40, 127, 193, 148, 96, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_name_id!(ID, "Sysvar1111111111111111111111111111111111111");
|
||||
// owner pubkey for sysvar accounts
|
||||
crate::declare_id!("Sysvar1111111111111111111111111111111111111");
|
||||
|
||||
pub trait SysvarId {
|
||||
fn check_id(pubkey: &Pubkey) -> bool;
|
||||
|
@@ -4,13 +4,8 @@ use std::iter::FromIterator;
|
||||
use std::ops::Deref;
|
||||
|
||||
const MAX_ENTRIES: usize = 32;
|
||||
const ID: [u8; 32] = [
|
||||
0x06, 0xa7, 0xd5, 0x17, 0x19, 0x2c, 0x56, 0x8e, 0xe0, 0x8a, 0x84, 0x5f, 0x73, 0xd2, 0x97, 0x88,
|
||||
0xcf, 0x03, 0x5c, 0x31, 0x45, 0xb2, 0x1a, 0xb3, 0x44, 0xd8, 0x06, 0x2e, 0xa9, 0x40, 0x00, 0x00,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(
|
||||
ID,
|
||||
crate::declare_sysvar_id!(
|
||||
"SysvarRecentB1ockHashes11111111111111111111",
|
||||
RecentBlockhashes
|
||||
);
|
||||
|
@@ -8,13 +8,7 @@ use crate::{
|
||||
sysvar::Sysvar,
|
||||
};
|
||||
|
||||
/// rent account pubkey
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 25, 44, 92, 81, 33, 140, 201, 76, 61, 74, 241, 127, 88, 218, 238, 8, 155, 161,
|
||||
253, 68, 227, 219, 217, 138, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(ID, "SysvarRent111111111111111111111111111111111", Rent);
|
||||
crate::declare_sysvar_id!("SysvarRent111111111111111111111111111111111", Rent);
|
||||
|
||||
impl Sysvar for Rent {}
|
||||
|
||||
|
@@ -2,13 +2,7 @@
|
||||
//!
|
||||
use crate::{account::Account, sysvar::Sysvar};
|
||||
|
||||
/// account pubkey
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 25, 44, 97, 55, 206, 224, 146, 217, 182, 146, 62, 225, 204, 214, 25, 3, 250,
|
||||
130, 184, 161, 97, 145, 87, 141, 128, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(ID, "SysvarRewards111111111111111111111111111111", Rewards);
|
||||
crate::declare_sysvar_id!("SysvarRewards111111111111111111111111111111", Rewards);
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, PartialEq)]
|
||||
|
@@ -5,16 +5,7 @@
|
||||
pub use crate::slot_hashes::{SlotHash, SlotHashes};
|
||||
use crate::{account::Account, sysvar::Sysvar};
|
||||
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 25, 47, 10, 175, 198, 242, 101, 227, 251, 119, 204, 122, 218, 130, 197, 41,
|
||||
208, 190, 59, 19, 110, 45, 0, 85, 32, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(
|
||||
ID,
|
||||
"SysvarS1otHashes111111111111111111111111111",
|
||||
SlotHashes
|
||||
);
|
||||
crate::declare_sysvar_id!("SysvarS1otHashes111111111111111111111111111", SlotHashes);
|
||||
|
||||
pub const MAX_SLOT_HASHES: usize = 512; // 512 slots to get your vote in
|
||||
|
||||
|
@@ -7,16 +7,7 @@ pub use crate::clock::Epoch;
|
||||
use crate::{account::Account, sysvar::Sysvar};
|
||||
use std::ops::Deref;
|
||||
|
||||
const ID: [u8; 32] = [
|
||||
6, 167, 213, 23, 25, 53, 132, 208, 254, 237, 155, 179, 67, 29, 19, 32, 107, 229, 68, 40, 27,
|
||||
87, 184, 86, 108, 197, 55, 95, 244, 0, 0, 0,
|
||||
];
|
||||
|
||||
crate::solana_sysvar_id!(
|
||||
ID,
|
||||
"SysvarStakeHistory1111111111111111111111111",
|
||||
StakeHistory
|
||||
);
|
||||
crate::declare_sysvar_id!("SysvarStakeHistory1111111111111111111111111", StakeHistory);
|
||||
|
||||
pub const MAX_STAKE_HISTORY: usize = 512; // it should never take as many as 512 epochs to warm up or cool down
|
||||
|
||||
|
Reference in New Issue
Block a user