Skip to content

Commit

Permalink
Revert "Refactor: Merge MessageProcessor into InvokeContext (solana-l…
Browse files Browse the repository at this point in the history
…abs#20165)" (solana-labs#20301)

This reverts commit df6905c.
  • Loading branch information
jackcmay authored and dankelleher committed Nov 24, 2021
1 parent 87b0323 commit 207b5a9
Show file tree
Hide file tree
Showing 4 changed files with 407 additions and 334 deletions.
2 changes: 1 addition & 1 deletion program-runtime/src/instruction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ impl InstructionProcessor {
message,
instruction,
program_indices,
Some(account_indices),
account_indices,
)?;

let mut instruction_processor = InstructionProcessor::default();
Expand Down
21 changes: 10 additions & 11 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! `Bank::process_transactions`
//!
//! It does this by loading the accounts using the reference it holds on the account store,
//! and then passing those to an InvokeContext which handles loading the programs specified
//! and then passing those to the message_processor which handles loading the programs specified
//! by the Transaction and executing it.
//!
//! The bank then stores the results to the accounts store.
Expand Down Expand Up @@ -65,7 +65,7 @@ use log::*;
use rayon::ThreadPool;
use solana_measure::measure::Measure;
use solana_metrics::{datapoint_debug, inc_new_counter_debug, inc_new_counter_info};
use solana_program_runtime::{ExecuteDetailsTimings, Executors, InstructionProcessor};
use solana_program_runtime::{ExecuteDetailsTimings, Executors};
#[allow(deprecated)]
use solana_sdk::recent_blockhashes_account;
use solana_sdk::{
Expand Down Expand Up @@ -945,8 +945,8 @@ pub struct Bank {
/// stream for the slot == self.slot
is_delta: AtomicBool,

/// The InstructionProcessor
instruction_processor: InstructionProcessor,
/// The Message processor
message_processor: MessageProcessor,

compute_budget: Option<ComputeBudget>,

Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl Bank {
stakes: RwLock::<Stakes>::default(),
epoch_stakes: HashMap::<Epoch, EpochStakes>::default(),
is_delta: AtomicBool::default(),
instruction_processor: InstructionProcessor::default(),
message_processor: MessageProcessor::default(),
compute_budget: Option::<ComputeBudget>::default(),
feature_builtins: Arc::<Vec<(Builtin, Pubkey, ActivationType)>>::default(),
last_vote_sync: AtomicU64::default(),
Expand Down Expand Up @@ -1327,7 +1327,7 @@ impl Bank {
is_delta: AtomicBool::new(false),
tick_height: AtomicU64::new(parent.tick_height.load(Relaxed)),
signature_count: AtomicU64::new(0),
instruction_processor: parent.instruction_processor.clone(),
message_processor: parent.message_processor.clone(),
compute_budget: parent.compute_budget,
feature_builtins: parent.feature_builtins.clone(),
hard_forks: parent.hard_forks.clone(),
Expand Down Expand Up @@ -1482,7 +1482,7 @@ impl Bank {
stakes: RwLock::new(fields.stakes),
epoch_stakes: fields.epoch_stakes,
is_delta: AtomicBool::new(fields.is_delta),
instruction_processor: new(),
message_processor: new(),
compute_budget: None,
feature_builtins: new(),
last_vote_sync: new(),
Expand Down Expand Up @@ -3389,8 +3389,7 @@ impl Bank {
};

if let Some(legacy_message) = tx.message().legacy_message() {
process_result = MessageProcessor::process_message(
&self.instruction_processor,
process_result = self.message_processor.process_message(
legacy_message,
&loaded_transaction.program_indices,
&account_refcells,
Expand Down Expand Up @@ -5326,7 +5325,7 @@ impl Bank {
) {
debug!("Adding program {} under {:?}", name, program_id);
self.add_native_program(name, &program_id, false);
self.instruction_processor
self.message_processor
.add_program(program_id, process_instruction_with_context);
}

Expand All @@ -5339,7 +5338,7 @@ impl Bank {
) {
debug!("Replacing program {} under {:?}", name, program_id);
self.add_native_program(name, &program_id, true);
self.instruction_processor
self.message_processor
.add_program(program_id, process_instruction_with_context);
}

Expand Down
Loading

0 comments on commit 207b5a9

Please sign in to comment.