Skip to content

Commit

Permalink
update review nits
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones committed Oct 19, 2023
1 parent 2962903 commit 297353f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion program-runtime/src/compute_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl ComputeBudget {
}
}

pub fn try_new_from<'a>(
pub fn try_from_instructions<'a>(
instructions: impl Iterator<Item = (&'a Pubkey, &'a CompiledInstruction)>,
feature_set: &FeatureSet,
) -> Result<Self> {
Expand Down
5 changes: 2 additions & 3 deletions program-runtime/src/compute_budget_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub fn process_compute_budget_instructions<'a>(
})
.min(MAX_COMPUTE_UNIT_LIMIT);

let compute_unit_price = updated_compute_unit_price.unwrap_or(0).min(u64::MAX);
let compute_unit_price = updated_compute_unit_price.unwrap_or(0);

let loaded_accounts_bytes = updated_loaded_accounts_data_size_limit
.unwrap_or(MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES)
Expand All @@ -179,10 +179,9 @@ fn sanitize_requested_heap_size(bytes: u32) -> bool {
// Supports request_units_derpecated ix, returns cu_price if available.
fn support_deprecated_requested_units(additional_fee: u32, compute_unit_limit: u32) -> Option<u64> {
// TODO: remove support of 'Deprecated' after feature remove_deprecated_request_unit_ix::id() is activated
type MicroLamports = u128;
const MICRO_LAMPORTS_PER_LAMPORT: u64 = 1_000_000;

let micro_lamport_fee: MicroLamports =
let micro_lamport_fee =
(additional_fee as u128).saturating_mul(MICRO_LAMPORTS_PER_LAMPORT as u128);
micro_lamport_fee
.checked_div(compute_unit_limit as u128)
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5198,7 +5198,7 @@ impl Bank {
} else {
let mut compute_budget_process_transaction_time =
Measure::start("compute_budget_process_transaction_time");
let maybe_compute_budget = ComputeBudget::try_new_from(
let maybe_compute_budget = ComputeBudget::try_from_instructions(
tx.message().program_instructions_iter(),
&self.feature_set,
);
Expand Down
1 change: 0 additions & 1 deletion runtime/src/transaction_priority_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub trait GetTransactionPriorityDetails {
instructions: impl Iterator<Item = (&'a Pubkey, &'a CompiledInstruction)>,
_round_compute_unit_price_enabled: bool,
) -> Option<TransactionPriorityDetails> {
// NOTE: replace hardcode individual feature gates with feature_set
let mut feature_set = FeatureSet::default();
feature_set.activate(
&solana_sdk::feature_set::add_set_tx_loaded_accounts_data_size_instruction::id(),
Expand Down

0 comments on commit 297353f

Please sign in to comment.