From c73bebe9847ecd5a1cbffa96bf03e03a7683232f Mon Sep 17 00:00:00 2001
From: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com>
Date: Thu, 19 Oct 2023 11:10:42 -0500
Subject: [PATCH] Split compute budget instructions process from struct itself
(#33513)
* Split compute budget instruction processing from ComputeBudget struct itself, allow compute_budget_instructions be processed elsewhere without having to instantiate ComputeBudget
* updated tests
---
accounts-db/src/accounts.rs | 52 +-
cost-model/src/cost_model.rs | 69 +-
program-runtime/src/compute_budget.rs | 648 +-----------------
.../src/compute_budget_processor.rs | 619 +++++++++++++++++
program-runtime/src/invoke_context.rs | 11 +-
program-runtime/src/lib.rs | 1 +
programs/sbf/tests/programs.rs | 17 +-
runtime/src/bank.rs | 67 +-
runtime/src/bank/tests.rs | 34 +-
runtime/src/transaction_priority_details.rs | 40 +-
10 files changed, 796 insertions(+), 762 deletions(-)
create mode 100644 program-runtime/src/compute_budget_processor.rs
diff --git a/accounts-db/src/accounts.rs b/accounts-db/src/accounts.rs
index 47b372d981..4ff891fc8b 100644
--- a/accounts-db/src/accounts.rs
+++ b/accounts-db/src/accounts.rs
@@ -25,7 +25,7 @@ use {
itertools::Itertools,
log::*,
solana_program_runtime::{
- compute_budget::{self, ComputeBudget},
+ compute_budget_processor::process_compute_budget_instructions,
loaded_programs::LoadedProgramsForTxBatch,
},
solana_sdk::{
@@ -35,9 +35,8 @@ use {
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
clock::{BankId, Slot},
feature_set::{
- self, add_set_tx_loaded_accounts_data_size_instruction,
- include_loaded_accounts_data_size_in_fee_calculation,
- remove_congestion_multiplier_from_fee_calculation, remove_deprecated_request_unit_ix,
+ self, include_loaded_accounts_data_size_in_fee_calculation,
+ remove_congestion_multiplier_from_fee_calculation,
simplify_writable_program_account_check, FeatureSet,
},
fee::FeeStructure,
@@ -247,15 +246,16 @@ impl Accounts {
feature_set: &FeatureSet,
) -> Result