Skip to content

Commit

Permalink
Fix gas calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz committed Mar 1, 2022
1 parent ca18305 commit ee8eb0c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions sui_programmability/adapter/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,16 @@ pub fn publish<E: Debug, S: ResourceResolver<Error = E> + ModuleResolver<Error =
Err(err) => exec_failure!(gas::MIN_MOVE, err),
};

let gas_used_for_init =
match store_package_and_init_modules(state_view, &vm, modules, ctx, gas_budget) {
Ok(ok) => ok,
Err(err) => exec_failure!(gas::MIN_MOVE, err),
};
let gas_used_for_init = match store_package_and_init_modules(
state_view,
&vm,
modules,
ctx,
gas_budget - gas_used_for_publish,
) {
Ok(ok) => ok,
Err(err) => exec_failure!(gas::MIN_MOVE, err),
};

let total_gas_used = gas_used_for_publish + gas_used_for_init;
// successful execution of both publishing operation and or all
Expand Down

0 comments on commit ee8eb0c

Please sign in to comment.