Skip to content

Commit

Permalink
Removes the to_builtin!() macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Apr 25, 2023
1 parent 1b3f0be commit ae6ccf4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use {
genesis_config::GenesisConfig,
hash::Hash,
pubkey::Pubkey,
saturating_add_assign,
signature::{Keypair, Signature},
timing,
transaction::{
Expand Down
29 changes: 16 additions & 13 deletions ledger/src/builtins.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
use {
solana_program_runtime::builtin_program::BuiltinProgram,
solana_runtime::builtins::{BuiltinFeatureTransition, Builtins},
solana_sdk::{bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable},
};

macro_rules! to_builtin {
($b:expr) => {
BuiltinProgram {
name: $b.0.to_string(),
program_id: $b.1,
process_instruction: $b.2,
}
};
}

/// Builtin programs that are always available
fn genesis_builtins() -> Vec<BuiltinProgram> {
vec![
to_builtin!(solana_bpf_loader_deprecated_program!()),
to_builtin!(solana_bpf_loader_program!()),
to_builtin!(solana_bpf_loader_upgradeable_program!()),
BuiltinProgram {
name: "solana_bpf_loader_deprecated_program".to_string(),
program_id: bpf_loader_deprecated::id(),
process_instruction: solana_bpf_loader_program::process_instruction,
},
BuiltinProgram {
name: "solana_bpf_loader_program".to_string(),
program_id: bpf_loader::id(),
process_instruction: solana_bpf_loader_program::process_instruction,
},
BuiltinProgram {
name: "solana_bpf_loader_upgradeable_program".to_string(),
program_id: bpf_loader_upgradeable::id(),
process_instruction: solana_bpf_loader_program::process_instruction,
},
]
}

Expand Down
2 changes: 0 additions & 2 deletions ledger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
#![allow(clippy::integer_arithmetic)]
#[macro_use]
extern crate solana_bpf_loader_program;

pub mod bank_forks_utils;
pub mod bigtable_delete;
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/builtins.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
solana_program_runtime::builtin_program::BuiltinProgram,
solana_sdk::{feature_set, pubkey::Pubkey, stake},
solana_sdk::{feature_set, pubkey::Pubkey},
};

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -86,7 +86,7 @@ fn genesis_builtins() -> Vec<BuiltinProgram> {
},
BuiltinProgram {
name: "stake_program".to_string(),
program_id: stake::program::id(),
program_id: solana_stake_program::id(),
process_instruction: solana_stake_program::stake_instruction::process_instruction,
},
BuiltinProgram {
Expand Down

0 comments on commit ae6ccf4

Please sign in to comment.