Skip to content

Commit

Permalink
chore: remove globalfee module
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Aug 19, 2024
1 parent d49b863 commit c291fa0
Show file tree
Hide file tree
Showing 30 changed files with 10 additions and 4,415 deletions.
17 changes: 4 additions & 13 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

atomoneerrors "github.com/atomone-hub/atomone/types/errors"
atomonefeeante "github.com/atomone-hub/atomone/x/globalfee/ante"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions
Codec codec.BinaryCodec
IBCkeeper *ibckeeper.Keeper
GlobalFeeSubspace paramtypes.Subspace
StakingKeeper *stakingkeeper.Keeper
TxFeeChecker ante.TxFeeChecker
Codec codec.BinaryCodec
IBCkeeper *ibckeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
TxFeeChecker ante.TxFeeChecker
}

func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
Expand All @@ -41,10 +38,6 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(atomoneerrors.ErrLogic, "IBC keeper is required for AnteHandler")
}

if opts.GlobalFeeSubspace.Name() == "" {
return nil, errorsmod.Wrap(atomoneerrors.ErrNotFound, "globalfee param store is required for AnteHandler")
}

if opts.StakingKeeper == nil {
return nil, errorsmod.Wrap(atomoneerrors.ErrNotFound, "staking param store is required for AnteHandler")
}
Expand All @@ -53,7 +46,6 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker),
Expand All @@ -62,7 +54,6 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateMemoDecorator(opts.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
NewGovVoteDecorator(opts.Codec, opts.StakingKeeper),
atomonefeeante.NewFeeDecorator(opts.GlobalFeeSubspace, opts.StakingKeeper),
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.TxFeeChecker),
ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
Expand Down
11 changes: 4 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import (
"github.com/atomone-hub/atomone/app/keepers"
"github.com/atomone-hub/atomone/app/params"
"github.com/atomone-hub/atomone/app/upgrades"
"github.com/atomone-hub/atomone/x/globalfee"
)

var (
Expand Down Expand Up @@ -222,13 +221,11 @@ func NewAtomOneApp(
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
Codec: appCodec,
IBCkeeper: app.IBCKeeper,
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
StakingKeeper: app.StakingKeeper,
Codec: appCodec,
IBCkeeper: app.IBCKeeper,
StakingKeeper: app.StakingKeeper,
// If TxFeeChecker is nil the default ante TxFeeChecker is used
// so we use this no-op to keep the global fee module behaviour unchanged
TxFeeChecker: noOpTxFeeChecker,
TxFeeChecker: nil,
},
)
if err != nil {
Expand Down
4 changes: 1 addition & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
pfmrouterkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
pfmroutertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
Expand Down Expand Up @@ -67,8 +68,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/atomone-hub/atomone/x/globalfee"
)

type AppKeepers struct {
Expand Down Expand Up @@ -444,7 +443,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(pfmroutertypes.ModuleName).WithKeyTable(pfmroutertypes.ParamKeyTable())
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(providertypes.ModuleName)

return paramsKeeper
Expand Down
15 changes: 1 addition & 14 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package atomone
import (
pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
pfmroutertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
Expand Down Expand Up @@ -56,7 +57,6 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

atomoneappparams "github.com/atomone-hub/atomone/app/params"
"github.com/atomone-hub/atomone/x/globalfee"
"github.com/atomone-hub/atomone/x/metaprotocols"
metaprotocolstypes "github.com/atomone-hub/atomone/x/metaprotocols/types"
)
Expand Down Expand Up @@ -110,7 +110,6 @@ var ModuleBasics = module.NewBasicManager(
vesting.AppModuleBasic{},
pfmrouter.AppModuleBasic{},
ica.AppModuleBasic{},
globalfee.AppModule{},
icsprovider.AppModuleBasic{},
consensus.AppModuleBasic{},
metaprotocols.AppModuleBasic{},
Expand Down Expand Up @@ -146,7 +145,6 @@ func appModules(
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
ibc.NewAppModule(app.IBCKeeper),
sdkparams.NewAppModule(app.ParamsKeeper),
globalfee.NewAppModule(app.GetSubspace(globalfee.ModuleName)),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
app.TransferModule,
app.ICAModule,
Expand Down Expand Up @@ -220,7 +218,6 @@ func orderBeginBlockers() []string {
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
globalfee.ModuleName,
providertypes.ModuleName,
consensusparamtypes.ModuleName,
metaprotocolstypes.ModuleName,
Expand Down Expand Up @@ -257,7 +254,6 @@ func orderEndBlockers() []string {
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
globalfee.ModuleName,
providertypes.ModuleName,
consensusparamtypes.ModuleName,
metaprotocolstypes.ModuleName,
Expand Down Expand Up @@ -294,15 +290,6 @@ func orderInitBlockers() []string {
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
// The globalfee module should ideally be initialized before the genutil module in theory:
// The globalfee antehandler performs checks in DeliverTx, which is called by gentx.
// When the global fee > 0, gentx needs to pay the fee. However, this is not expected,
// (in our case, the global fee is initialized with an empty value, which might not be a problem
// if the globalfee in genesis is not changed.)
// To resolve this issue, we should initialize the globalfee module after genutil, ensuring that the global
// min fee is empty when gentx is called.
// For more details, please refer to the following link: https://github.com/cosmos/gaia/issues/2489
globalfee.ModuleName,
providertypes.ModuleName,
consensusparamtypes.ModuleName,
metaprotocolstypes.ModuleName,
Expand Down
123 changes: 0 additions & 123 deletions tests/e2e/e2e_globalfee_proposal_test.go

This file was deleted.

Loading

0 comments on commit c291fa0

Please sign in to comment.