Skip to content

Commit

Permalink
chore(gas) consider refund for gasUsed (evmos#1452)
Browse files Browse the repository at this point in the history
* chore(gas) consider refund for gasUsed

* chore(gas) add changelog entry
  • Loading branch information
GAtom22 authored Mar 10, 2023
1 parent bef87b3 commit ee693d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#1433](https://github.com/evmos/evmos/pull/1433) Add max priority fee check on `FeeChecker`.
- (ci) [#1383](https://github.com/evmos/evmos/pull/1383) Fix go-releaser error when building macOS binaries
- (ante) [#1435](https://github.com/evmos/evmos/pull/1435) Add block gas limit check for cosmos transactions
- (evm) [#1452](https://github.com/evmos/evmos/pull/1452) Consider refund amount on `gasUsed` calculation

## [v11.0.2] - 2023-02-10

Expand Down
6 changes: 5 additions & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
}
// refund gas
temporaryGasUsed := msg.Gas() - leftoverGas
leftoverGas += GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)
refund := GasToRefund(stateDB.GetRefund(), temporaryGasUsed, refundQuotient)

// update leftoverGas and temporaryGasUsed with refund amount
leftoverGas += refund
temporaryGasUsed -= refund

// EVM execution error needs to be available for the JSON-RPC client
var vmError string
Expand Down

0 comments on commit ee693d4

Please sign in to comment.