test-validator: Always use overridden compute budget in bank (#25128)
This commit is contained in:
parent
766e361111
commit
542a14d9b7
|
@ -4372,34 +4372,37 @@ impl Bank {
|
|||
feature_set_clone_time.as_us()
|
||||
);
|
||||
|
||||
let tx_wide_compute_cap = feature_set.is_active(&tx_wide_compute_cap::id());
|
||||
let compute_budget_max_units = if tx_wide_compute_cap {
|
||||
compute_budget::MAX_UNITS
|
||||
let compute_budget = if let Some(compute_budget) = self.compute_budget {
|
||||
compute_budget
|
||||
} else {
|
||||
compute_budget::DEFAULT_UNITS
|
||||
};
|
||||
let mut compute_budget = self
|
||||
.compute_budget
|
||||
.unwrap_or_else(|| ComputeBudget::new(compute_budget_max_units));
|
||||
if tx_wide_compute_cap {
|
||||
let mut compute_budget_process_transaction_time =
|
||||
Measure::start("compute_budget_process_transaction_time");
|
||||
let process_transaction_result = compute_budget.process_message(
|
||||
tx.message(),
|
||||
feature_set.is_active(&requestable_heap_size::id()),
|
||||
feature_set.is_active(&default_units_per_instruction::id()),
|
||||
);
|
||||
compute_budget_process_transaction_time.stop();
|
||||
saturating_add_assign!(
|
||||
timings
|
||||
.execute_accessories
|
||||
.compute_budget_process_transaction_us,
|
||||
compute_budget_process_transaction_time.as_us()
|
||||
);
|
||||
if let Err(err) = process_transaction_result {
|
||||
return TransactionExecutionResult::NotExecuted(err);
|
||||
let tx_wide_compute_cap = feature_set.is_active(&tx_wide_compute_cap::id());
|
||||
let compute_budget_max_units = if tx_wide_compute_cap {
|
||||
compute_budget::MAX_UNITS
|
||||
} else {
|
||||
compute_budget::DEFAULT_UNITS
|
||||
};
|
||||
let mut compute_budget = ComputeBudget::new(compute_budget_max_units);
|
||||
if tx_wide_compute_cap {
|
||||
let mut compute_budget_process_transaction_time =
|
||||
Measure::start("compute_budget_process_transaction_time");
|
||||
let process_transaction_result = compute_budget.process_message(
|
||||
tx.message(),
|
||||
feature_set.is_active(&requestable_heap_size::id()),
|
||||
feature_set.is_active(&default_units_per_instruction::id()),
|
||||
);
|
||||
compute_budget_process_transaction_time.stop();
|
||||
saturating_add_assign!(
|
||||
timings
|
||||
.execute_accessories
|
||||
.compute_budget_process_transaction_us,
|
||||
compute_budget_process_transaction_time.as_us()
|
||||
);
|
||||
if let Err(err) = process_transaction_result {
|
||||
return TransactionExecutionResult::NotExecuted(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
compute_budget
|
||||
};
|
||||
|
||||
self.execute_loaded_transaction(
|
||||
tx,
|
||||
|
|
Loading…
Reference in New Issue