Skip to content

Commit

Permalink
checked result of consume_checked() if featureis activated
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones committed Mar 13, 2023
1 parent 2f78ea0 commit 70be670
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,17 @@ pub fn create_ebpf_vm<'a, 'b>(
orig_account_lengths: Vec<usize>,
invoke_context: &'a mut InvokeContext<'b>,
) -> Result<EbpfVm<'a, RequisiteVerifier, InvokeContext<'b>>, EbpfError> {
let _ = invoke_context.consume_checked(calculate_heap_cost(
let round_up_heap_size = invoke_context
.feature_set
.is_active(&round_up_heap_size::id());
let heap_cost_result = invoke_context.consume_checked(calculate_heap_cost(
heap.len() as u64,
invoke_context.get_compute_budget().heap_cost,
invoke_context
.feature_set
.is_active(&round_up_heap_size::id()),
round_up_heap_size,
));
if round_up_heap_size {
heap_cost_result?;
}
let check_aligned = bpf_loader_deprecated::id()
!= invoke_context
.transaction_context
Expand Down

0 comments on commit 70be670

Please sign in to comment.