Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor - Moves bpf_loader registration into the runtime #31345

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -713,7 +713,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
38 changes: 0 additions & 38 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 @@ -14,7 +14,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: 0 additions & 13 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ pub use {

pub mod programs;

#[macro_use]
extern crate solana_bpf_loader_program;

/// Errors from the program test environment
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ProgramTestError {
Expand Down Expand Up @@ -787,16 +784,6 @@ impl ProgramTest {
}),
);

// Add loaders
macro_rules! add_builtin {
($b:expr) => {
bank.add_builtin(&$b.0, &$b.1, $b.2)
};
}
add_builtin!(solana_bpf_loader_deprecated_program!());
add_builtin!(solana_bpf_loader_program!());
add_builtin!(solana_bpf_loader_upgradeable_program!());

// Add commonly-used SPL programs as a convenience to the user
for (program_id, account) in programs::spl_programs(&Rent::default()).iter() {
bank.store_account(program_id, account);
Expand Down
4 changes: 2 additions & 2 deletions programs/bpf-loader-tests/tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![allow(dead_code)]

use {
solana_bpf_loader_program::{process_instruction, upgradeable::id},
solana_bpf_loader_program::process_instruction,
solana_program_test::*,
solana_sdk::{
account::AccountSharedData,
account_utils::StateMut,
bpf_loader_upgradeable::UpgradeableLoaderState,
bpf_loader_upgradeable::{id, UpgradeableLoaderState},
instruction::{Instruction, InstructionError},
pubkey::Pubkey,
signature::{Keypair, Signer},
Expand Down
6 changes: 0 additions & 6 deletions programs/bpf_loader/src/deprecated.rs

This file was deleted.

8 changes: 0 additions & 8 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#![deny(clippy::integer_arithmetic)]
#![deny(clippy::indexing_slicing)]

pub mod deprecated;
pub mod serialization;
pub mod syscalls;
pub mod upgradeable;

use {
solana_measure::measure::Measure,
Expand Down Expand Up @@ -61,12 +59,6 @@ use {
},
};

solana_sdk::declare_builtin!(
solana_sdk::bpf_loader::ID,
solana_bpf_loader_program,
solana_bpf_loader_program::process_instruction
);

#[allow(clippy::too_many_arguments)]
pub fn load_program_from_bytes(
feature_set: &FeatureSet,
Expand Down
6 changes: 0 additions & 6 deletions programs/bpf_loader/src/upgradeable.rs

This file was deleted.

6 changes: 1 addition & 5 deletions programs/sbf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use {solana_rbpf::memory_region::MemoryState, std::slice};

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

use {
byteorder::{ByteOrder, LittleEndian, WriteBytesExt},
Expand Down Expand Up @@ -193,9 +191,7 @@ fn bench_program_execute_noop(bencher: &mut Bencher) {
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_benches(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank = Bank::new_for_benches(&genesis_config);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);

Expand Down
Loading