Use bs58 strings to declare IDs rather then raw bytes (#7082)
This commit is contained in:
@ -7,7 +7,7 @@ use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
|
||||
use log::*;
|
||||
use solana_rbpf::{memory_region::MemoryRegion, EbpfVm};
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::bpf_loader::PROGRAM_ID;
|
||||
use solana_sdk::bpf_loader;
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::instruction_processor_utils::{limited_deserialize, next_keyed_account};
|
||||
use solana_sdk::loader_instruction::LoaderInstruction;
|
||||
@ -19,8 +19,7 @@ use std::io::Error;
|
||||
use std::mem;
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
PROGRAM_ID,
|
||||
"BPFLoader1111111111111111111111111111111111",
|
||||
bpf_loader::BS58_STRING,
|
||||
solana_bpf_loader_program,
|
||||
process_instruction
|
||||
);
|
||||
|
@ -11,13 +11,7 @@ pub mod utils;
|
||||
|
||||
use crate::spv_processor::process_instruction;
|
||||
|
||||
pub const BTC_SPV_PROGRAM_ID: [u8; 32] = [
|
||||
2, 202, 42, 59, 228, 51, 182, 147, 162, 245, 234, 78, 205, 37, 131, 154, 110, 252, 154, 254,
|
||||
190, 13, 90, 231, 198, 144, 239, 96, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
BTC_SPV_PROGRAM_ID,
|
||||
"BtcSpv1111111111111111111111111111111111111",
|
||||
solana_btc_spv_program,
|
||||
process_instruction
|
||||
|
@ -5,13 +5,7 @@ pub mod budget_state;
|
||||
|
||||
use crate::budget_processor::process_instruction;
|
||||
|
||||
const BUDGET_PROGRAM_ID: [u8; 32] = [
|
||||
2, 203, 81, 223, 225, 24, 34, 35, 203, 214, 138, 130, 144, 208, 35, 77, 63, 16, 87, 51, 47,
|
||||
198, 115, 123, 98, 188, 19, 160, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
BUDGET_PROGRAM_ID,
|
||||
"Budget1111111111111111111111111111111111111",
|
||||
solana_budget_program,
|
||||
process_instruction
|
||||
|
@ -6,13 +6,7 @@ use bincode::{deserialize, serialize, serialized_size};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::{account::Account, pubkey::Pubkey, short_vec};
|
||||
|
||||
const CONFIG_PROGRAM_ID: [u8; 32] = [
|
||||
3, 6, 74, 163, 0, 47, 116, 220, 200, 110, 67, 49, 15, 12, 5, 42, 248, 197, 218, 39, 246, 16,
|
||||
64, 25, 163, 35, 239, 160, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
CONFIG_PROGRAM_ID,
|
||||
"Config1111111111111111111111111111111111111",
|
||||
solana_config_program,
|
||||
process_instruction
|
||||
|
@ -7,26 +7,12 @@ extern crate solana_metrics;
|
||||
|
||||
use crate::exchange_processor::process_instruction;
|
||||
|
||||
pub const EXCHANGE_PROGRAM_ID: [u8; 32] = [
|
||||
3, 147, 111, 103, 210, 47, 14, 213, 108, 116, 49, 115, 232, 171, 14, 111, 167, 140, 221, 234,
|
||||
33, 70, 185, 192, 42, 31, 141, 152, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
EXCHANGE_PROGRAM_ID,
|
||||
"Exchange11111111111111111111111111111111111",
|
||||
solana_exchange_program,
|
||||
process_instruction
|
||||
);
|
||||
|
||||
pub mod faucet {
|
||||
pub const EXCHANGE_FAUCET_ID: [u8; 32] = [
|
||||
3, 147, 111, 103, 210, 47, 23, 11, 176, 29, 147, 89, 237, 155, 21, 62, 107, 105, 157, 1,
|
||||
98, 204, 206, 211, 54, 212, 79, 15, 160, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(
|
||||
EXCHANGE_FAUCET_ID,
|
||||
"ExchangeFaucet11111111111111111111111111111"
|
||||
);
|
||||
solana_sdk::declare_id!("ExchangeFaucet11111111111111111111111111111");
|
||||
}
|
||||
|
@ -2,13 +2,7 @@ use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
pub const FAILURE_PROGRAM_ID: [u8; 32] = [
|
||||
3, 188, 64, 34, 171, 255, 206, 240, 89, 4, 11, 161, 30, 250, 18, 135, 195, 82, 6, 72, 220, 142,
|
||||
53, 26, 45, 144, 70, 112, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
FAILURE_PROGRAM_ID,
|
||||
"FaiLure111111111111111111111111111111111111",
|
||||
solana_failure_program,
|
||||
process_instruction
|
||||
|
@ -1,10 +1,4 @@
|
||||
const LIBRAPAY_PROGRAM_ID: [u8; 32] = [
|
||||
5, 13, 18, 222, 165, 11, 80, 225, 56, 103, 125, 38, 15, 252, 181, 16, 125, 99, 110, 106, 186,
|
||||
28, 136, 119, 235, 245, 20, 80, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(
|
||||
LIBRAPAY_PROGRAM_ID,
|
||||
solana_sdk::declare_id!(
|
||||
"LibraPay11111111111111111111111111111111111"
|
||||
);
|
||||
|
||||
|
3
programs/move_loader/Cargo.lock
generated
3
programs/move_loader/Cargo.lock
generated
@ -2079,7 +2079,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-move-loader-api"
|
||||
name = "solana-move-loader-program"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2119,6 +2119,7 @@ dependencies = [
|
||||
"generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -4,11 +4,10 @@ pub mod error_mappers;
|
||||
pub mod processor;
|
||||
|
||||
use crate::processor::process_instruction;
|
||||
use solana_sdk::move_loader::PROGRAM_ID;
|
||||
use solana_sdk::move_loader;
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
PROGRAM_ID,
|
||||
"MoveLdr111111111111111111111111111111111111",
|
||||
move_loader::BS58_STRING,
|
||||
solana_move_loader_program,
|
||||
process_instruction
|
||||
);
|
||||
|
@ -3,13 +3,7 @@ use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
pub const NOOP_PROGRAM_ID: [u8; 32] = [
|
||||
5, 150, 31, 54, 19, 205, 142, 201, 161, 38, 97, 31, 144, 212, 37, 82, 93, 58, 178, 5, 131, 178,
|
||||
31, 101, 138, 251, 91, 128, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
NOOP_PROGRAM_ID,
|
||||
"Noop111111111111111111111111111111111111111",
|
||||
solana_noop_program,
|
||||
process_instruction
|
||||
|
@ -1,12 +1,4 @@
|
||||
pub mod ownable_instruction;
|
||||
pub mod ownable_processor;
|
||||
|
||||
const OWNABLE_PROGRAM_ID: [u8; 32] = [
|
||||
12, 6, 169, 236, 232, 53, 216, 159, 221, 186, 8, 8, 33, 45, 166, 249, 243, 55, 177, 184, 195,
|
||||
132, 141, 34, 63, 108, 219, 80, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(
|
||||
OWNABLE_PROGRAM_ID,
|
||||
"ownab1e111111111111111111111111111111111111"
|
||||
);
|
||||
solana_sdk::declare_id!("ownab1e111111111111111111111111111111111111");
|
||||
|
@ -10,12 +10,7 @@ use solana_sdk::{
|
||||
};
|
||||
|
||||
// stake config ID
|
||||
const ID: [u8; 32] = [
|
||||
6, 161, 216, 23, 165, 2, 5, 11, 104, 7, 145, 230, 206, 109, 184, 142, 30, 91, 113, 80, 246, 31,
|
||||
198, 121, 10, 78, 180, 209, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(ID, "StakeConfig11111111111111111111111111111111");
|
||||
solana_sdk::declare_id!("StakeConfig11111111111111111111111111111111");
|
||||
|
||||
// means that no more than RATE of current effective stake may be added or subtracted per
|
||||
// epoch
|
||||
|
@ -5,13 +5,7 @@ pub mod rewards_pools;
|
||||
pub mod stake_instruction;
|
||||
pub mod stake_state;
|
||||
|
||||
const STAKE_PROGRAM_ID: [u8; 32] = [
|
||||
6, 161, 216, 23, 145, 55, 84, 42, 152, 52, 55, 189, 254, 42, 122, 178, 85, 127, 83, 92, 138,
|
||||
120, 114, 43, 104, 164, 157, 192, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
STAKE_PROGRAM_ID,
|
||||
"Stake11111111111111111111111111111111111111",
|
||||
solana_stake_program,
|
||||
stake_instruction::process_instruction
|
||||
|
@ -11,18 +11,13 @@ use solana_sdk::{
|
||||
};
|
||||
|
||||
// base rewards pool ID
|
||||
const ID: [u8; 32] = [
|
||||
6, 161, 216, 23, 186, 139, 91, 88, 83, 34, 32, 112, 237, 188, 184, 153, 69, 67, 238, 112, 93,
|
||||
54, 133, 142, 145, 182, 214, 15, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(ID, "StakeRewards1111111111111111111111111111111");
|
||||
solana_sdk::declare_id!("StakeRewards1111111111111111111111111111111");
|
||||
|
||||
// to cut down on collisions for redemptions, we make multiple accounts
|
||||
pub const NUM_REWARDS_POOLS: usize = 256;
|
||||
|
||||
pub fn random_id() -> Pubkey {
|
||||
let mut id = Hash::new(&ID);
|
||||
let mut id = Hash::new(id().as_ref());
|
||||
|
||||
for _i in 0..thread_rng().gen_range(0, NUM_REWARDS_POOLS) {
|
||||
id = hash(id.as_ref());
|
||||
|
@ -5,13 +5,7 @@ pub mod storage_processor;
|
||||
|
||||
use crate::storage_processor::process_instruction;
|
||||
|
||||
const STORAGE_PROGRAM_ID: [u8; 32] = [
|
||||
6, 162, 25, 123, 127, 68, 233, 59, 131, 151, 21, 152, 162, 120, 90, 37, 154, 88, 86, 5, 156,
|
||||
221, 182, 201, 142, 103, 151, 112, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
STORAGE_PROGRAM_ID,
|
||||
"Storage111111111111111111111111111111111111",
|
||||
solana_storage_program,
|
||||
process_instruction
|
||||
|
@ -10,12 +10,7 @@ use solana_sdk::hash::{hash, Hash};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
// base rewards pool ID
|
||||
const ID: [u8; 32] = [
|
||||
6, 162, 25, 123, 127, 71, 141, 232, 129, 171, 58, 183, 79, 88, 181, 17, 163, 11, 51, 111, 22,
|
||||
123, 67, 115, 5, 131, 109, 161, 16, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::solana_name_id!(ID, "StorageMiningPoo111111111111111111111111111");
|
||||
solana_sdk::declare_id!("StorageMiningPoo111111111111111111111111111");
|
||||
|
||||
// to cut down on collisions for redemptions, we make multiple accounts
|
||||
pub const NUM_REWARDS_POOLS: usize = 32;
|
||||
@ -31,7 +26,7 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig) -> u64 {
|
||||
}
|
||||
|
||||
pub fn random_id() -> Pubkey {
|
||||
let mut id = Hash::new(&ID);
|
||||
let mut id = Hash::new(id().as_ref());
|
||||
|
||||
for _i in 0..thread_rng().gen_range(0, NUM_REWARDS_POOLS) {
|
||||
id = hash(id.as_ref());
|
||||
|
@ -6,13 +6,7 @@ pub mod vest_state;
|
||||
|
||||
use crate::vest_processor::process_instruction;
|
||||
|
||||
const VEST_PROGRAM_ID: [u8; 32] = [
|
||||
7, 87, 23, 47, 219, 236, 238, 33, 137, 188, 215, 141, 32, 229, 155, 195, 133, 124, 23, 232,
|
||||
113, 153, 252, 252, 111, 5, 187, 128, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
VEST_PROGRAM_ID,
|
||||
"Vest111111111111111111111111111111111111111",
|
||||
solana_vest_program,
|
||||
process_instruction
|
||||
|
@ -3,13 +3,7 @@ pub mod vote_state;
|
||||
|
||||
use crate::vote_instruction::process_instruction;
|
||||
|
||||
const VOTE_PROGRAM_ID: [u8; 32] = [
|
||||
7, 97, 72, 29, 53, 116, 116, 187, 124, 77, 118, 36, 235, 211, 189, 179, 216, 53, 94, 115, 209,
|
||||
16, 67, 252, 13, 163, 83, 128, 0, 0, 0, 0,
|
||||
];
|
||||
|
||||
solana_sdk::declare_program!(
|
||||
VOTE_PROGRAM_ID,
|
||||
"Vote111111111111111111111111111111111111111",
|
||||
solana_vote_program,
|
||||
process_instruction
|
||||
|
Reference in New Issue
Block a user