diff --git a/system-contracts/contracts/EvmEmulator.yul b/system-contracts/contracts/EvmEmulator.yul index ad827c5bb..e3803ce7f 100644 --- a/system-contracts/contracts/EvmEmulator.yul +++ b/system-contracts/contracts/EvmEmulator.yul @@ -839,6 +839,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 @@ -3890,6 +3891,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 d8131e1a8..b8b4a8448 100644 --- a/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul +++ b/system-contracts/evm-emulator/EvmEmulatorFunctions.template.yul @@ -777,6 +777,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