Skip to content

Commit

Permalink
fix: duplicate import
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Oct 31, 2024
1 parent c37446a commit f602811
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions x/evm/precompile/precompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import (

"github.com/NibiruChain/collections"
store "github.com/cosmos/cosmos-sdk/store/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
gethabi "github.com/ethereum/go-ethereum/accounts/abi"
gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
gethparams "github.com/ethereum/go-ethereum/params"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/NibiruChain/nibiru/v2/app/keepers"
"github.com/NibiruChain/nibiru/v2/x/evm/statedb"
)
Expand Down Expand Up @@ -209,9 +207,9 @@ func OnRunStart(
// Temporarily switching to a local gas meter to enforce gas limit check for a precompile
// returning parent gas meter after execution or failure
parentGasMeter := cacheCtx.GasMeter()
cacheCtx = cacheCtx.WithGasMeter(storetypes.NewGasMeter(gasLimit)).
WithKVGasConfig(storetypes.GasConfig{}).
WithTransientKVGasConfig(storetypes.GasConfig{})
cacheCtx = cacheCtx.WithGasMeter(sdk.NewGasMeter(gasLimit)).
WithKVGasConfig(sdk.GasConfig{}).
WithTransientKVGasConfig(sdk.GasConfig{})

return OnRunStartResult{
Args: args,
Expand Down Expand Up @@ -241,7 +239,7 @@ func ReturnToParentGasMeter(ctx sdk.Context, contract *vm.Contract, parentGasMet
return func() {
if r := recover(); r != nil {
switch r.(type) {
case storetypes.ErrorOutOfGas:
case sdk.ErrorOutOfGas:
_ = contract.UseGas(ctx.GasMeter().GasConsumed())

*err = vm.ErrOutOfGas
Expand All @@ -251,7 +249,7 @@ func ReturnToParentGasMeter(ctx sdk.Context, contract *vm.Contract, parentGasMet
}
// Back to parent ctx gas meter (before entering precompile)
ctx = ctx.WithGasMeter(parentGasMeter).
WithKVGasConfig(storetypes.GasConfig{}).
WithTransientKVGasConfig(storetypes.GasConfig{})
WithKVGasConfig(sdk.GasConfig{}).
WithTransientKVGasConfig(sdk.GasConfig{})
}
}

0 comments on commit f602811

Please sign in to comment.