From f30b78e59c017840791938d15c4a2ca4b2261d83 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Wed, 17 May 2023 12:10:56 +0200 Subject: [PATCH 1/3] docs: update comments on globalfee, genutil module init order --- app/modules.go | 8 ++++++++ x/globalfee/ante/fee.go | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/modules.go b/app/modules.go index 38d84bc3fca..4ac1d1d33dd 100644 --- a/app/modules.go +++ b/app/modules.go @@ -284,6 +284,14 @@ 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, } diff --git a/x/globalfee/ante/fee.go b/x/globalfee/ante/fee.go index bdb54b582de..9ff63b204fd 100644 --- a/x/globalfee/ante/fee.go +++ b/x/globalfee/ante/fee.go @@ -28,8 +28,8 @@ import ( var _ sdk.AnteDecorator = FeeDecorator{} type FeeDecorator struct { - GlobalMinFee globalfee.ParamSource - StakingSubspace paramtypes.Subspace + GlobalMinFeeSubspace globalfee.ParamSource + StakingSubspace paramtypes.Subspace } func NewFeeDecorator(globalfeeSubspace, stakingSubspace paramtypes.Subspace) FeeDecorator { @@ -42,8 +42,8 @@ func NewFeeDecorator(globalfeeSubspace, stakingSubspace paramtypes.Subspace) Fee } return FeeDecorator{ - GlobalMinFee: globalfeeSubspace, - StakingSubspace: stakingSubspace, + GlobalMinFeeSubspace: globalfeeSubspace, + StakingSubspace: stakingSubspace, } } @@ -186,8 +186,8 @@ func (mfd FeeDecorator) GetGlobalFee(ctx sdk.Context, feeTx sdk.FeeTx) (sdk.Coin err error ) - if mfd.GlobalMinFee.Has(ctx, types.ParamStoreKeyMinGasPrices) { - mfd.GlobalMinFee.Get(ctx, types.ParamStoreKeyMinGasPrices, &globalMinGasPrices) + if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyMinGasPrices) { + mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyMinGasPrices, &globalMinGasPrices) } // global fee is empty set, set global fee to 0uatom if len(globalMinGasPrices) == 0 { @@ -239,16 +239,16 @@ func (mfd FeeDecorator) ContainsOnlyBypassMinFeeMsgs(ctx sdk.Context, msgs []sdk } func (mfd FeeDecorator) GetBypassMsgTypes(ctx sdk.Context) (res []string) { - if mfd.GlobalMinFee.Has(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes) { - mfd.GlobalMinFee.Get(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes, &res) + if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes) { + mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes, &res) } return } func (mfd FeeDecorator) GetMaxTotalBypassMinFeeMsgGasUsage(ctx sdk.Context) (res uint64) { - if mfd.GlobalMinFee.Has(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage) { - mfd.GlobalMinFee.Get(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage, &res) + if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage) { + mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage, &res) } return From dd17571b5438ff2a6377c84924b537a1b6af17fa Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Thu, 1 Jun 2023 14:59:08 +0200 Subject: [PATCH 2/3] rename GlobalMinFee GlobalMinFeeParamSource in FeeDecorator --- x/globalfee/ante/fee.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/x/globalfee/ante/fee.go b/x/globalfee/ante/fee.go index 9ff63b204fd..15de3fb27ed 100644 --- a/x/globalfee/ante/fee.go +++ b/x/globalfee/ante/fee.go @@ -28,8 +28,8 @@ import ( var _ sdk.AnteDecorator = FeeDecorator{} type FeeDecorator struct { - GlobalMinFeeSubspace globalfee.ParamSource - StakingSubspace paramtypes.Subspace + GlobalMinFeeParamSource globalfee.ParamSource + StakingSubspace paramtypes.Subspace } func NewFeeDecorator(globalfeeSubspace, stakingSubspace paramtypes.Subspace) FeeDecorator { @@ -42,8 +42,8 @@ func NewFeeDecorator(globalfeeSubspace, stakingSubspace paramtypes.Subspace) Fee } return FeeDecorator{ - GlobalMinFeeSubspace: globalfeeSubspace, - StakingSubspace: stakingSubspace, + GlobalMinFeeParamSource: globalfeeSubspace, + StakingSubspace: stakingSubspace, } } @@ -186,8 +186,8 @@ func (mfd FeeDecorator) GetGlobalFee(ctx sdk.Context, feeTx sdk.FeeTx) (sdk.Coin err error ) - if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyMinGasPrices) { - mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyMinGasPrices, &globalMinGasPrices) + if mfd.GlobalMinFeeParamSource.Has(ctx, types.ParamStoreKeyMinGasPrices) { + mfd.GlobalMinFeeParamSource.Get(ctx, types.ParamStoreKeyMinGasPrices, &globalMinGasPrices) } // global fee is empty set, set global fee to 0uatom if len(globalMinGasPrices) == 0 { @@ -239,16 +239,16 @@ func (mfd FeeDecorator) ContainsOnlyBypassMinFeeMsgs(ctx sdk.Context, msgs []sdk } func (mfd FeeDecorator) GetBypassMsgTypes(ctx sdk.Context) (res []string) { - if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes) { - mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes, &res) + if mfd.GlobalMinFeeParamSource.Has(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes) { + mfd.GlobalMinFeeParamSource.Get(ctx, types.ParamStoreKeyBypassMinFeeMsgTypes, &res) } return } func (mfd FeeDecorator) GetMaxTotalBypassMinFeeMsgGasUsage(ctx sdk.Context) (res uint64) { - if mfd.GlobalMinFeeSubspace.Has(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage) { - mfd.GlobalMinFeeSubspace.Get(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage, &res) + if mfd.GlobalMinFeeParamSource.Has(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage) { + mfd.GlobalMinFeeParamSource.Get(ctx, types.ParamStoreKeyMaxTotalBypassMinFeeMsgGasUsage, &res) } return From e39d765005c4f1d9397cbfd8a363e2ba0abb0f56 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Fri, 2 Jun 2023 17:03:55 +0200 Subject: [PATCH 3/3] fix: deadlink --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 19d503ab37f..420d6daaa1e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,7 +25,7 @@ Welcome to the documentation of the **Cosmos Hub application: `gaia`**. ## Setup Your Own `gaia` Testnet -- [Setup your own `gaia` testnet](https://github.com/cosmos/testnets/tree/master/local/previous-local-testnets/theta) +- [Setup your own `gaia` testnet](https://github.com/cosmos/testnets/tree/master/local/previous-local-testnets/v7-theta) ## Additional Resources