Skip to content

Commit 479cb05

Browse files
committed
Merge branch 'main' into releases/v2.0.0
2 parents ae2d85e + b61c103 commit 479cb05

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ feat(evm-funtoken-precompile): Implement methods: balance, bankBalance, whoAmI
111111
- [#2108](https://github.com/NibiruChain/nibiru/pull/2108) - fix(evm): removed deprecated root key from eth_getTransactionReceipt
112112
- [#2110](https://github.com/NibiruChain/nibiru/pull/2110) - fix(evm): Restore StateDB to its state prior to ApplyEvmMsg call to ensure deterministic gas usage. This fixes an issue where the StateDB pointer field in NibiruBankKeeper was being updated during readonly query endpoints like eth_estimateGas, leading to non-deterministic gas usage in subsequent transactions.
113113
- [#2111](https://github.com/NibiruChain/nibiru/pull/2111) - fix: e2e-evm-cron.yml
114+
- [#2114](https://github.com/NibiruChain/nibiru/pull/2114) - fix(evm): make gas cost zero in conditional bank keeper flow
114115

115116
#### Nibiru EVM | Before Audit 1 - 2024-10-18
116117

x/evm/keeper/bank_extension.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package keeper
22

33
import (
4+
storetypes "github.com/cosmos/cosmos-sdk/store/types"
45
sdk "github.com/cosmos/cosmos-sdk/types"
56
auth "github.com/cosmos/cosmos-sdk/x/auth/types"
67
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
@@ -84,6 +85,14 @@ func (bk *NibiruBankKeeper) SyncStateDBWithAccount(
8485
if bk.StateDB == nil {
8586
return
8687
}
88+
89+
cachedGasConfig := ctx.KVGasConfig()
90+
defer func() {
91+
ctx = ctx.WithKVGasConfig(cachedGasConfig)
92+
}()
93+
94+
// set gas cost to zero for this conditional operation
95+
ctx = ctx.WithKVGasConfig(storetypes.GasConfig{})
8796
balanceWei := evm.NativeToWei(
8897
bk.GetBalance(ctx, acc, evm.EVMBankDenom).Amount.BigInt(),
8998
)

0 commit comments

Comments
 (0)