Rename in-tree program_ids to be base-58 human readable (#4001)

This commit is contained in:
Michael Vines 2019-04-25 17:58:49 -07:00 committed by GitHub
parent fd60ef8a8d
commit e71ab55288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 55 additions and 54 deletions

1
Cargo.lock generated
View File

@ -2478,6 +2478,7 @@ dependencies = [
"solana-config-api 0.14.0",
"solana-exchange-api 0.14.0",
"solana-sdk 0.14.0",
"solana-stake-api 0.14.0",
"solana-storage-api 0.14.0",
"solana-token-api 0.14.0",
"solana-vote-api 0.14.0",

View File

@ -229,7 +229,7 @@ mod tests {
subscriptions.check_account(&alice.pubkey(), &account);
let string = transport_receiver.poll();
if let Async::Ready(Some(response)) = string.unwrap() {
let expected = format!(r#"{{"jsonrpc":"2.0","method":"accountNotification","params":{{"result":{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"subscription":0}}}}"#);
let expected = format!(r#"{{"jsonrpc":"2.0","method":"accountNotification","params":{{"result":{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[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]}},"subscription":0}}}}"#);
assert_eq!(expected, response);
}
@ -275,7 +275,7 @@ mod tests {
subscriptions.check_program(&solana_budget_api::id(), &alice.pubkey(), &account);
let string = transport_receiver.poll();
if let Async::Ready(Some(response)) = string.unwrap() {
let expected = format!(r#"{{"jsonrpc":"2.0","method":"programNotification","params":{{"result":["{:?}",{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}}],"subscription":0}}}}"#, alice.pubkey());
let expected = format!(r#"{{"jsonrpc":"2.0","method":"programNotification","params":{{"result":["{:?}",{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[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]}}],"subscription":0}}}}"#, alice.pubkey());
assert_eq!(expected, response);
}

View File

@ -14,6 +14,7 @@ serde_json = "1.0.39"
solana = { path = "../core", version = "0.14.0" }
solana-sdk = { path = "../sdk", version = "0.14.0" }
solana-budget-api = { path = "../programs/budget_api", version = "0.14.0" }
solana-stake-api = { path = "../programs/stake_api", version = "0.14.0" }
solana-storage-api = { path = "../programs/storage_api", version = "0.14.0" }
solana-token-api = { path = "../programs/token_api", version = "0.14.0" }
solana-config-api = { path = "../programs/config_api", version = "0.14.0" }

View File

@ -123,43 +123,39 @@ mod tests {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
]);
let native = Pubkey::new(&[
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
]);
let bpf = Pubkey::new(&[
128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let budget = Pubkey::new(&[
129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let storage = Pubkey::new(&[
130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let token = Pubkey::new(&[
131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let vote = Pubkey::new(&[
132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let config = Pubkey::new(&[
133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let exchange = Pubkey::new(&[
134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
]);
let native_loader = "NativeLoader1111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let bpf_loader = "BPFLoader1111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let budget = "Budget1111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let stake = "Stake11111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let storage = "Storage111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let token = "Token11111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let vote = "Vote111111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let config = "Config1111111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
let exchange = "Exchange11111111111111111111111111111111111"
.parse::<Pubkey>()
.unwrap();
assert_eq!(solana_sdk::system_program::id(), system);
assert_eq!(solana_sdk::native_loader::id(), native);
assert_eq!(solana_sdk::bpf_loader::id(), bpf);
assert_eq!(solana_sdk::native_loader::id(), native_loader);
assert_eq!(solana_sdk::bpf_loader::id(), bpf_loader);
assert_eq!(solana_budget_api::id(), budget);
assert_eq!(solana_stake_api::id(), stake);
assert_eq!(solana_storage_api::id(), storage);
assert_eq!(solana_token_api::id(), token);
assert_eq!(solana_vote_api::id(), vote);

View File

@ -6,8 +6,8 @@ pub mod budget_state;
use solana_sdk::pubkey::Pubkey;
const BUDGET_PROGRAM_ID: [u8; 32] = [
129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn id() -> Pubkey {

View File

@ -5,8 +5,8 @@ pub mod config_instruction;
pub mod config_processor;
const CONFIG_PROGRAM_ID: [u8; 32] = [
133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {

View File

@ -8,8 +8,8 @@ extern crate solana_metrics;
use solana_sdk::pubkey::Pubkey;
pub const EXCHANGE_PROGRAM_ID: [u8; 32] = [
134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {

View File

@ -4,8 +4,8 @@ pub mod stake_state;
use solana_sdk::pubkey::Pubkey;
const STAKE_PROGRAM_ID: [u8; 32] = [
135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {

View File

@ -11,8 +11,8 @@ pub fn get_segment_from_entry(entry_height: u64) -> usize {
}
const STORAGE_PROGRAM_ID: [u8; 32] = [
130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {

View File

@ -4,8 +4,8 @@ mod token_state;
use solana_sdk::pubkey::Pubkey;
const TOKEN_PROGRAM_ID: [u8; 32] = [
131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
6, 221, 246, 225, 142, 57, 236, 63, 240, 189, 82, 112, 85, 219, 2, 165, 51, 122, 113, 201, 115,
12, 217, 253, 72, 146, 220, 192, 0, 0, 0, 0,
];
pub fn id() -> Pubkey {

View File

@ -4,8 +4,8 @@ pub mod vote_state;
use solana_sdk::pubkey::Pubkey;
const VOTE_PROGRAM_ID: [u8; 32] = [
132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {

View File

@ -1,8 +1,8 @@
use crate::pubkey::Pubkey;
const BPF_LOADER_PROGRAM_ID: [u8; 32] = [
128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
2, 168, 246, 145, 78, 136, 161, 107, 189, 35, 149, 133, 95, 100, 4, 217, 180, 244, 86, 183,
130, 27, 176, 20, 87, 73, 66, 140, 0, 0, 0, 0,
];
pub fn id() -> Pubkey {

View File

@ -2,7 +2,8 @@ use crate::account::Account;
use crate::pubkey::Pubkey;
const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 135, 132, 191, 20, 139, 164, 40, 47, 176, 18, 87, 72, 136, 169, 241, 83, 160, 125, 173, 247,
101, 192, 69, 92, 154, 151, 3, 128, 0, 0, 0,
];
pub fn id() -> Pubkey {

View File

@ -1,6 +1,8 @@
use crate::pubkey::Pubkey;
const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32];
const SYSTEM_PROGRAM_ID: [u8; 32] = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
];
pub fn id() -> Pubkey {
Pubkey::new(&SYSTEM_PROGRAM_ID)