Skip to content

Commit

Permalink
Minor fixes to "separate cached from call cost"
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jun 25, 2024
1 parent 28d2ebe commit d4b3917
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arbitrator/prover/src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ impl<'a> WasmBinary<'a> {

let mut init: u64 = 0;
if compile.version == 1 {
init = cached_init; // in version 1 cached cost is part of call cost
init = cached_init; // in version 1 cached cost is part of init cost
}
init = init.saturating_add(funcs.saturating_mul(8252) / 1000);
init = init.saturating_add(type_len.saturating_mul(1059) / 1000);
Expand Down
2 changes: 1 addition & 1 deletion arbos/programs/programs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (p Programs) CallProgram(

// pay for program init
cached := program.cached || statedb.GetRecentWasms().Insert(codeHash, params.BlockCacheSize)
if cached || params.Version > 1 { // in version 1 cached cost is part of called cost
if cached || program.version > 1 { // in version 1 cached cost is part of init cost
callCost = am.SaturatingUAdd(callCost, program.cachedGas(params))
}
if !cached {
Expand Down

0 comments on commit d4b3917

Please sign in to comment.