-
Notifications
You must be signed in to change notification settings - Fork 774
feat!: Introduce feemarket module #3028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
67ed1ef
5a68fa1
cc65aae
0c4d33a
ffbe220
247596b
9b9ac32
22fdf42
0be4697
943a116
dff7000
080ffa1
d745944
c517b48
8cdce49
b9859d4
0b51473
b69c7b5
0fce83e
2e52f4f
686744f
37541f9
2ae514c
bd887ff
f57b72e
eedc862
9f3afd2
18fc6e4
9c52fe7
d387a7f
4d4662c
417c987
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| - Add feemarket module | ||
| - Remove globalfee module from the app and repository | ||
| - Remove auth module 'DeductFeeDecorator' | ||
| ([\#3028](https://github.com/cosmos/gaia/pull/3028)) | ||
|
MSalopek marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| - Add feemarket module | ||
| - Remove globalfee module from the app and repository | ||
| - Remove auth module 'DeductFeeDecorator' | ||
| ([\#3028](https://github.com/cosmos/gaia/pull/3028)) | ||
|
MSalopek marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| package ante | ||
|
|
||
| import ( | ||
| feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante" | ||
| feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" | ||
|
|
||
| ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" | ||
| ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" | ||
|
|
||
|
|
@@ -9,22 +12,23 @@ 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" | ||
|
|
||
| gaiaerrors "github.com/cosmos/gaia/v18/types/errors" | ||
| gaiafeeante "github.com/cosmos/gaia/v18/x/globalfee/ante" | ||
| ) | ||
|
|
||
| // UseFeeMarketDecorator to make the integration testing easier: we can switch off its ante and post decorators with this flag | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a workaround to make the integration tests based on IBC testing framework work without the need to override the |
||
| var UseFeeMarketDecorator = true | ||
|
|
||
| // 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 | ||
| FeeMarketKeeper *feemarketkeeper.Keeper | ||
| } | ||
|
|
||
| func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { | ||
|
|
@@ -40,9 +44,8 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { | |
| if opts.IBCkeeper == nil { | ||
| return nil, errorsmod.Wrap(gaiaerrors.ErrLogic, "IBC keeper is required for AnteHandler") | ||
| } | ||
|
|
||
| if opts.GlobalFeeSubspace.Name() == "" { | ||
| return nil, errorsmod.Wrap(gaiaerrors.ErrNotFound, "globalfee param store is required for AnteHandler") | ||
| if opts.FeeMarketKeeper == nil { | ||
| return nil, errorsmod.Wrap(gaiaerrors.ErrLogic, "FeeMarket keeper is required for AnteHandler") | ||
| } | ||
|
|
||
| if opts.StakingKeeper == nil { | ||
|
|
@@ -62,8 +65,6 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { | |
| ante.NewValidateMemoDecorator(opts.AccountKeeper), | ||
| ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper), | ||
| NewGovVoteDecorator(opts.Codec, opts.StakingKeeper), | ||
| gaiafeeante.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), | ||
| ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer), | ||
|
|
@@ -72,5 +73,9 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { | |
| ibcante.NewRedundantRelayDecorator(opts.IBCkeeper), | ||
| } | ||
|
|
||
| if UseFeeMarketDecorator { | ||
| anteDecorators = append(anteDecorators, feemarketante.NewFeeMarketCheckDecorator(opts.FeeMarketKeeper)) | ||
| } | ||
|
|
||
| return sdk.ChainAnteDecorators(anteDecorators...), nil | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package gaia | ||
|
|
||
| import ( | ||
| feemarketpost "github.com/skip-mev/feemarket/x/feemarket/post" | ||
|
|
||
| errorsmod "cosmossdk.io/errors" | ||
|
|
||
| sdk "github.com/cosmos/cosmos-sdk/types" | ||
| sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
|
||
| "github.com/cosmos/gaia/v18/ante" | ||
| ) | ||
|
|
||
| // PostHandlerOptions are the options required for constructing a FeeMarket PostHandler. | ||
| type PostHandlerOptions struct { | ||
| AccountKeeper feemarketpost.AccountKeeper | ||
| BankKeeper feemarketpost.BankKeeper | ||
| FeeMarketKeeper feemarketpost.FeeMarketKeeper | ||
| FeeGrantKeeper feemarketpost.FeeGrantKeeper | ||
| } | ||
|
|
||
| // NewPostHandler returns a PostHandler chain with the fee deduct decorator. | ||
| func NewPostHandler(options PostHandlerOptions) (sdk.PostHandler, error) { | ||
| if !ante.UseFeeMarketDecorator { | ||
| return nil, nil | ||
| } | ||
|
|
||
| if options.AccountKeeper == nil { | ||
| return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for post builder") | ||
| } | ||
|
|
||
| if options.BankKeeper == nil { | ||
| return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for post builder") | ||
| } | ||
|
|
||
| if options.FeeMarketKeeper == nil { | ||
| return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "feemarket keeper is required for post builder") | ||
| } | ||
|
|
||
| postDecorators := []sdk.PostDecorator{ | ||
| feemarketpost.NewFeeMarketDeductDecorator( | ||
| options.AccountKeeper, | ||
| options.BankKeeper, | ||
| options.FeeGrantKeeper, | ||
| options.FeeMarketKeeper, | ||
| ), | ||
| } | ||
|
|
||
| return sdk.ChainPostDecorators(postDecorators...), nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,28 @@ | ||
| package v18 | ||
|
|
||
| import ( | ||
| feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" | ||
|
|
||
| store "github.com/cosmos/cosmos-sdk/store/types" | ||
|
|
||
| "github.com/cosmos/gaia/v18/app/upgrades" | ||
| ) | ||
|
|
||
| const ( | ||
| // UpgradeName defines the on-chain upgrade name. | ||
| UpgradeName = "v18" | ||
| UpgradeName = "v18" | ||
| GlobalFeeModuleName = "globalfee" | ||
| ) | ||
|
|
||
| var Upgrade = upgrades.Upgrade{ | ||
| UpgradeName: UpgradeName, | ||
| CreateUpgradeHandler: CreateUpgradeHandler, | ||
| StoreUpgrades: store.StoreUpgrades{ | ||
| Added: []string{ | ||
| feemarkettypes.ModuleName, | ||
| }, | ||
| Deleted: []string{ | ||
| GlobalFeeModuleName, | ||
| }, | ||
| }, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one more changelog entry under api-breaking. Removing the globalfee module breaks the API, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.