Skip to content

Commit

Permalink
Merge branch 'master' into backport-hashdb-locking
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz authored Feb 20, 2024
2 parents 94db071 + d3bcf56 commit 775cdc2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,14 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
if err != nil {
return nil, err
}
// The scheduling transaction will "use" all of the gas available to it,
// but it's really just passing it on to the scheduled tx, so we subtract it out here.
if result.UsedGas >= msg.GasLimit {
result.UsedGas -= msg.GasLimit
} else {
log.Warn("Scheduling tx used less gas than scheduled tx has available", "usedGas", result.UsedGas, "scheduledGas", msg.GasLimit)
result.UsedGas = 0
}
msg.TxRunMode = runMode
// make a new EVM for the scheduled Tx (an EVM must never be reused)
evm, vmError := b.GetEVM(ctx, msg, state, header, &vm.Config{NoBaseFee: true}, &blockCtx)
Expand All @@ -1159,6 +1167,8 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
if scheduledTxResult.Failed() {
return scheduledTxResult, nil
}
// Add back in any gas used by the scheduled transaction.
result.UsedGas += scheduledTxResult.UsedGas
scheduled = append(scheduled[1:], scheduledTxResult.ScheduledTxes...)
}

Expand Down

0 comments on commit 775cdc2

Please sign in to comment.