diff --git a/app/app.go b/app/app.go index a2c8d83124..a6ddfb39df 100644 --- a/app/app.go +++ b/app/app.go @@ -455,7 +455,7 @@ func NewEthermintApp( feeMarketSs := app.GetSubspace(feemarkettypes.ModuleName) app.FeeMarketKeeper = feemarketkeeper.NewKeeper( appCodec, authtypes.NewModuleAddress(govtypes.ModuleName), - keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], feeMarketSs, app.ConsensusParamsKeeper, + keys[feemarkettypes.StoreKey], tkeys[feemarkettypes.TransientKey], feeMarketSs, ) // Set authority to x/gov module account to only expect the module account to update params @@ -463,7 +463,7 @@ func NewEthermintApp( app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], authtypes.NewModuleAddress(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper, - nil, geth.NewEVM, tracer, evmSs, app.ConsensusParamsKeeper, + nil, geth.NewEVM, tracer, evmSs, ) // Create IBC Keeper diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index ea2d930db0..642300f41b 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -300,10 +300,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type hi = uint64(*args.Gas) } else { // Query block gas limit - params, err := k.ck.Get(ctx) - if err != nil { - return nil, err - } + params := ctx.ConsensusParams() if params != nil && params.Block != nil && params.Block.MaxGas > 0 { hi = uint64(params.Block.MaxGas) } else { diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 4cd0d2bd8a..58621e310a 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -31,7 +31,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" ethermint "github.com/evmos/ethermint/types" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" @@ -79,7 +78,6 @@ type Keeper struct { evmConstructor evm.Constructor // Legacy subspace ss paramstypes.Subspace - ck consensusparamkeeper.Keeper } // NewKeeper generates new evm module keeper @@ -95,7 +93,6 @@ func NewKeeper( evmConstructor evm.Constructor, tracer string, ss paramstypes.Subspace, - ck consensusparamkeeper.Keeper, ) *Keeper { // ensure evm module account is set if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { @@ -121,7 +118,6 @@ func NewKeeper( evmConstructor: evmConstructor, tracer: tracer, ss: ss, - ck: ck, } } diff --git a/x/feemarket/keeper/eip1559.go b/x/feemarket/keeper/eip1559.go index a3c6751cff..d477caa84e 100644 --- a/x/feemarket/keeper/eip1559.go +++ b/x/feemarket/keeper/eip1559.go @@ -35,10 +35,8 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int { if !params.IsBaseFeeEnabled(ctx.BlockHeight()) { return nil } - consParams, err := k.ck.Get(ctx) - if err != nil { - return nil - } + + consParams := ctx.ConsensusParams() // If the current block is the first EIP-1559 block, return the base fee // defined in the parameters (DefaultBaseFee if it hasn't been changed by diff --git a/x/feemarket/keeper/eip1559_test.go b/x/feemarket/keeper/eip1559_test.go index 4b02cac478..267e3cc9fe 100644 --- a/x/feemarket/keeper/eip1559_test.go +++ b/x/feemarket/keeper/eip1559_test.go @@ -103,7 +103,8 @@ func (suite *KeeperTestSuite) TestCalculateBaseFee() { MaxBytes: 10, } consParams := tmproto.ConsensusParams{Block: &blockParams} - suite.app.ConsensusParamsKeeper.Set(suite.ctx, &consParams) + suite.ctx = suite.ctx.WithConsensusParams(&consParams) + fee := suite.app.FeeMarketKeeper.CalculateBaseFee(suite.ctx) if tc.NoBaseFee { suite.Require().Nil(fee, tc.name) diff --git a/x/feemarket/keeper/keeper.go b/x/feemarket/keeper/keeper.go index 2a23bd5926..5720f0ed51 100644 --- a/x/feemarket/keeper/keeper.go +++ b/x/feemarket/keeper/keeper.go @@ -24,7 +24,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" "github.com/evmos/ethermint/x/feemarket/types" ) @@ -42,12 +41,11 @@ type Keeper struct { authority sdk.AccAddress // Legacy subspace ss paramstypes.Subspace - ck consensusparamkeeper.Keeper } // NewKeeper generates new fee market module keeper func NewKeeper( - cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey, ss paramstypes.Subspace, ck consensusparamkeeper.Keeper, + cdc codec.BinaryCodec, authority sdk.AccAddress, storeKey, transientKey storetypes.StoreKey, ss paramstypes.Subspace, ) Keeper { // ensure authority account is correctly formatted if err := sdk.VerifyAddressFormat(authority); err != nil { @@ -60,7 +58,6 @@ func NewKeeper( authority: authority, transientKey: transientKey, ss: ss, - ck: ck, } }