Skip to content

Commit

Permalink
Refactor - Merges BuiltinPrograms into LoadedPrograms (#31654)
Browse files Browse the repository at this point in the history
* Merges BuiltinPrograms into LoadedPrograms.

* Prevents built-ins from being pruned.
  • Loading branch information
Lichtso authored May 18, 2023
1 parent a57fe0c commit 520c647
Show file tree
Hide file tree
Showing 16 changed files with 369 additions and 551 deletions.
7 changes: 1 addition & 6 deletions ledger-tool/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,7 @@ pub fn program(ledger_path: &Path, matches: &ArgMatches<'_>) {
AccountSharedData::new(0, 0, &loader_id),
));
let interpreted = matches.value_of("mode").unwrap() != "jit";
with_mock_invoke_context!(
invoke_context,
transaction_context,
transaction_accounts,
bank.get_builtin_programs()
);
with_mock_invoke_context!(invoke_context, transaction_context, transaction_accounts);

// Adding `DELAY_VISIBILITY_SLOT_OFFSET` to slots to accommodate for delay visibility of the program
let mut loaded_programs =
Expand Down
12 changes: 3 additions & 9 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ pub mod tests {
matches::assert_matches,
rand::{thread_rng, Rng},
solana_entry::entry::{create_ticks, next_entry, next_entry_mut},
solana_program_runtime::{builtin_program::create_builtin, declare_process_instruction},
solana_program_runtime::declare_process_instruction,
solana_runtime::{
genesis_utils::{
self, create_genesis_config_with_vote_accounts, ValidatorVoteKeypairs,
Expand Down Expand Up @@ -3002,10 +3002,7 @@ pub mod tests {
let mock_program_id = solana_sdk::pubkey::new_rand();

let mut bank = Bank::new_for_tests(&genesis_config);
bank.add_builtin(
mock_program_id,
create_builtin("mockup".to_string(), mock_processor_ok),
);
bank.add_mockup_builtin(mock_program_id, mock_processor_ok);

let tx = Transaction::new_signed_with_payer(
&[Instruction::new_with_bincode(
Expand Down Expand Up @@ -3046,10 +3043,7 @@ pub mod tests {

(0..get_instruction_errors().len()).for_each(|err| {
let mut bank = Bank::new_for_tests(&genesis_config);
bank.add_builtin(
mock_program_id,
create_builtin("mockup".to_string(), mock_processor_err),
);
bank.add_mockup_builtin(mock_program_id, mock_processor_err);

let tx = Transaction::new_signed_with_payer(
&[Instruction::new_with_bincode(
Expand Down
47 changes: 0 additions & 47 deletions program-runtime/src/builtin_program.rs

This file was deleted.

Loading

0 comments on commit 520c647

Please sign in to comment.