Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(EVM): Zero out frame gas left for underpaid precompiles #1101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions system-contracts/contracts/EvmEmulator.yul
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading