add deterministic default cost

This commit is contained in:
Tao Zhu
2022-03-14 15:27:29 -05:00
committed by Tao Zhu
parent ce2e82cfb6
commit a4cacf3389
4 changed files with 96 additions and 76 deletions

View File

@ -73,13 +73,8 @@ impl Default for ComputeBudget {
impl ComputeBudget {
pub fn new(use_max_units_default: bool) -> Self {
let max_units = if use_max_units_default {
MAX_UNITS
} else {
200_000
} as u64;
ComputeBudget {
max_units,
max_units: ComputeBudget::get_max_units(use_max_units_default),
log_64_units: 100,
create_program_address_units: 1500,
invoke_units: 1000,
@ -102,6 +97,14 @@ impl ComputeBudget {
}
}
pub fn get_max_units(use_max_units_default: bool) -> u64 {
if use_max_units_default {
MAX_UNITS as u64
} else {
200_000
}
}
pub fn process_message(
&mut self,
message: &SanitizedMessage,