Skip to content

Commit

Permalink
Removes AccountsDataMeter from InvokeContext (solana-labs#34698)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jan 10, 2024
1 parent 61e42cb commit dc5af2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use {
crate::{
accounts_data_meter::AccountsDataMeter,
compute_budget::ComputeBudget,
ic_msg,
loaded_programs::{LoadedProgram, LoadedProgramType, LoadedProgramsForTxBatch},
Expand Down Expand Up @@ -164,7 +163,6 @@ pub struct InvokeContext<'a> {
compute_budget: ComputeBudget,
current_compute_budget: ComputeBudget,
compute_meter: RefCell<u64>,
accounts_data_meter: AccountsDataMeter,
pub programs_loaded_for_tx_batch: &'a LoadedProgramsForTxBatch,
pub programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch,
pub feature_set: Arc<FeatureSet>,
Expand All @@ -187,7 +185,7 @@ impl<'a> InvokeContext<'a> {
feature_set: Arc<FeatureSet>,
blockhash: Hash,
lamports_per_signature: u64,
prev_accounts_data_len: u64,
_prev_accounts_data_len: u64,
) -> Self {
Self {
transaction_context,
Expand All @@ -196,7 +194,6 @@ impl<'a> InvokeContext<'a> {
current_compute_budget: compute_budget,
compute_budget,
compute_meter: RefCell::new(compute_budget.compute_unit_limit),
accounts_data_meter: AccountsDataMeter::new(prev_accounts_data_len),
programs_loaded_for_tx_batch,
programs_modified_by_tx,
feature_set,
Expand Down Expand Up @@ -570,11 +567,6 @@ impl<'a> InvokeContext<'a> {
*self.compute_meter.borrow_mut() = remaining;
}

/// Get this invocation's AccountsDataMeter
pub fn get_accounts_data_meter(&self) -> &AccountsDataMeter {
&self.accounts_data_meter
}

/// Get this invocation's compute budget
pub fn get_compute_budget(&self) -> &ComputeBudget {
&self.current_compute_budget
Expand Down
2 changes: 1 addition & 1 deletion program-runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl MessageProcessor {
.map_err(|err| TransactionError::InstructionError(instruction_index as u8, err))?;
}
Ok(ProcessedMessageInfo {
accounts_data_len_delta: invoke_context.get_accounts_data_meter().delta(),
accounts_data_len_delta: 0, // unused
})
}
}
Expand Down

0 comments on commit dc5af2c

Please sign in to comment.