From d4b3917e16dc6f152dee2905be9ca967d3022f58 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 24 Jun 2024 22:40:09 -0600 Subject: [PATCH] Minor fixes to "separate cached from call cost" --- arbitrator/prover/src/binary.rs | 2 +- arbos/programs/programs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrator/prover/src/binary.rs b/arbitrator/prover/src/binary.rs index 821192ee38..aa5537476c 100644 --- a/arbitrator/prover/src/binary.rs +++ b/arbitrator/prover/src/binary.rs @@ -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); diff --git a/arbos/programs/programs.go b/arbos/programs/programs.go index 7ca33369c8..06943532b4 100644 --- a/arbos/programs/programs.go +++ b/arbos/programs/programs.go @@ -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 {