-
Notifications
You must be signed in to change notification settings - Fork 666
/
migration.go
38 lines (32 loc) · 1.34 KB
/
migration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package v2
import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/gaia/v15/x/globalfee/types"
)
// MigrateStore performs in-place params migrations of
// BypassMinFeeMsgTypes and MaxTotalBypassMinFeeMsgGasUsage
// from app.toml to globalfee params.
// The migration includes:
// Add bypass-min-fee-msg-types params that are set
// ["/ibc.core.channel.v1.MsgRecvPacket",
// "/ibc.core.channel.v1.MsgAcknowledgement",
// "/ibc.core.client.v1.MsgUpdateClient",
// "/ibc.core.channel.v1.MsgTimeout",
// "/ibc.core.channel.v1.MsgTimeoutOnClose"] as default and
// add MaxTotalBypassMinFeeMsgGasUsage that is set 1_000_000 as default.
func MigrateStore(ctx sdk.Context, globalfeeSubspace paramtypes.Subspace) error {
var oldGlobalMinGasPrices sdk.DecCoins
globalfeeSubspace.Get(ctx, types.ParamStoreKeyMinGasPrices, &oldGlobalMinGasPrices)
defaultParams := types.DefaultParams()
params := types.Params{
MinimumGasPrices: oldGlobalMinGasPrices,
BypassMinFeeMsgTypes: defaultParams.BypassMinFeeMsgTypes,
MaxTotalBypassMinFeeMsgGasUsage: defaultParams.MaxTotalBypassMinFeeMsgGasUsage,
}
if !globalfeeSubspace.HasKeyTable() {
globalfeeSubspace = globalfeeSubspace.WithKeyTable(types.ParamKeyTable())
}
globalfeeSubspace.SetParamSet(ctx, ¶ms)
return nil
}