Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Follow the [migration document](docs/migrations/v0.5.x_to_v0.6.0.md) for upgrade

### BUG FIXES

- Bound the message `GasLimit` in `CallEVMWithData` to the caller-provided `gasCap` when set (`min(gasCap, DefaultGasCap)`) instead of always using `DefaultGasCap`, so callers (e.g. the CosmWasm ERC20 query bindings) can constrain internal EVM execution to their remaining gas budget.
- Fix EVM fee-abstraction gas refund to compute the refund against the full transaction gas (`gasUsed + leftoverGas`) instead of `gasUsed`, bounding the refund by the paid fee and preventing the fee collector from being drained by high gas limit transactions.
- [\#15](https://github.com/KiiChain/evm/pull/15) Fix distribution precompile 32-byte withdraw address inflating native supply by skipping non-20-byte accounts when mirroring balance changes to the StateDB.

Expand Down
9 changes: 8 additions & 1 deletion x/vm/keeper/call_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ func (k Keeper) CallEVMWithData(ctx sdk.Context, stateDB *statedb.StateDB, from
return nil, err
}

gasLimit := config.DefaultGasCap
if gasCap != nil && gasCap.IsUint64() {
if capped := gasCap.Uint64(); capped < gasLimit {
gasLimit = capped
}
}

msg := core.Message{
From: from,
To: contract,
Nonce: nonce,
Value: big.NewInt(0),
GasLimit: config.DefaultGasCap,
GasLimit: gasLimit,
GasPrice: big.NewInt(0),
GasTipCap: big.NewInt(0),
GasFeeCap: big.NewInt(0),
Expand Down
Loading