Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Moves the bpf_loader registration from the ledger into the runtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Apr 25, 2023
1 parent 1b3f0be commit bb28ccb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ledger/src/bank_forks_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fn bank_forks_from_snapshot(
genesis_config,
&process_options.runtime_config,
process_options.debug_keys.clone(),
Some(&crate::builtins::get()),
None,
process_options.account_indexes.clone(),
process_options.limit_load_slot_count_from_snapshot,
process_options.shrink_ratio,
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ pub(crate) fn process_blockstore_for_bank_0(
Arc::new(opts.runtime_config.clone()),
account_paths,
opts.debug_keys.clone(),
Some(&crate::builtins::get()),
None,
opts.account_indexes.clone(),
opts.shrink_ratio,
false,
Expand Down
35 changes: 0 additions & 35 deletions ledger/src/builtins.rs

This file was deleted.

1 change: 0 additions & 1 deletion ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub mod blockstore_meta;
pub mod blockstore_metrics;
pub mod blockstore_options;
pub mod blockstore_processor;
pub mod builtins;
pub mod genesis_utils;
pub mod leader_schedule;
pub mod leader_schedule_cache;
Expand Down
13 changes: 13 additions & 0 deletions runtime/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ impl BuiltinFeatureTransition {
}
}

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

/// Built-in programs that are always available
fn genesis_builtins() -> Vec<BuiltinProgram> {
vec![
Expand All @@ -94,6 +104,9 @@ fn genesis_builtins() -> Vec<BuiltinProgram> {
program_id: solana_config_program::id(),
process_instruction: solana_config_program::config_processor::process_instruction,
},
to_builtin!(solana_bpf_loader_deprecated_program!()),
to_builtin!(solana_bpf_loader_program!()),
to_builtin!(solana_bpf_loader_upgradeable_program!()),
]
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate solana_bpf_loader_program;

pub mod account_info;
pub mod account_overrides;
Expand Down

0 comments on commit bb28ccb

Please sign in to comment.