diff --git a/system-contracts/contracts/EvmEmulator.yul b/system-contracts/contracts/EvmEmulator.yul index f9a9c0d75..8462b70af 100644 --- a/system-contracts/contracts/EvmEmulator.yul +++ b/system-contracts/contracts/EvmEmulator.yul @@ -831,6 +831,7 @@ object "EvmEmulator" { let zkVmGasToPass := gas() // pass all remaining gas, precompiles should not call any contracts if lt(gasToPass, precompileCost) { zkVmGasToPass := 0 // in EVM precompile should revert consuming all gas in that case + precompileCost := gasToPass // just in case } switch isStatic @@ -3879,6 +3880,7 @@ object "EvmEmulator" { let zkVmGasToPass := gas() // pass all remaining gas, precompiles should not call any contracts if lt(gasToPass, precompileCost) { zkVmGasToPass := 0 // in EVM precompile should revert consuming all gas in that case + precompileCost := gasToPass // just in case } switch isStatic diff --git a/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul b/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul index 58736a58d..c09a4e76b 100644 --- a/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul +++ b/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul @@ -769,6 +769,7 @@ function callPrecompile(addr, precompileCost, gasToPass, value, argsOffset, args let zkVmGasToPass := gas() // pass all remaining gas, precompiles should not call any contracts if lt(gasToPass, precompileCost) { zkVmGasToPass := 0 // in EVM precompile should revert consuming all gas in that case + precompileCost := gasToPass // just in case } switch isStatic