changelog: v0.12.2 (#1022)

* changelog: v0.12.2

* fix
This commit is contained in:
Federico Kunze Küllmer
2022-03-30 19:16:37 +02:00
committed by GitHub
parent d19e38833c
commit 4ddc8afd18
11 changed files with 1019 additions and 22 deletions
+4 -13
View File
@@ -1,13 +1,10 @@
package keeper
import (
"math/big"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// KeyPrefixBaseFeeV1 is the base fee key prefix used in version 1
var KeyPrefixBaseFeeV1 = []byte{2}
v010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
@@ -21,13 +18,7 @@ func NewMigrator(keeper Keeper) Migrator {
}
}
// Migrate1to2 migrates the store from consensus version v1 to v2
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
store := ctx.KVStore(m.keeper.storeKey)
bz := store.Get(KeyPrefixBaseFeeV1)
if len(bz) > 0 {
baseFee := new(big.Int).SetBytes(bz)
m.keeper.SetBaseFee(ctx, baseFee)
}
store.Delete(KeyPrefixBaseFeeV1)
return nil
return v010.MigrateStore(ctx, &m.keeper.paramSpace, m.keeper.storeKey)
}
+4 -2
View File
@@ -4,6 +4,7 @@ import (
"math/big"
"github.com/tharsis/ethermint/x/feemarket/keeper"
v010 "github.com/tharsis/ethermint/x/feemarket/migrations/v010"
)
func (suite *KeeperTestSuite) TestMigration1To2() {
@@ -11,8 +12,9 @@ func (suite *KeeperTestSuite) TestMigration1To2() {
storeKey := suite.app.GetKey("feemarket")
store := suite.ctx.KVStore(storeKey)
baseFee := big.NewInt(1000)
store.Set(keeper.KeyPrefixBaseFeeV1, baseFee.Bytes())
store.Set(v010.KeyPrefixBaseFeeV1, baseFee.Bytes())
m := keeper.NewMigrator(suite.app.FeeMarketKeeper)
suite.Require().NoError(m.Migrate1to2(suite.ctx))
err := m.Migrate1to2(suite.ctx)
suite.Require().NoError(err)
suite.Require().Equal(baseFee, suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx))
}