Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
chore(feemarket): Delete deprecated migration logic (#1508)
Browse files Browse the repository at this point in the history
* (refactor): Remove old migration code

* (fix): Lint and add CHANGELOG entry
  • Loading branch information
Vvaradinov authored Nov 29, 2022
1 parent 5fbe109 commit 831588c
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 2,151 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (feemarket) [#1508](https://github.com/evmos/ethermint/pull/1508) Remove old x/params migration logic
* (evm) [#1499](https://github.com/evmos/ethermint/pull/1499) Add Shanghai and Cancun block
* (ante) [#1455](https://github.com/evmos/ethermint/pull/1455) Refactor `AnteHandler` logic
* (evm) [#1444](https://github.com/evmos/ethermint/pull/1444) Improve performance of `eth_estimateGas`
Expand Down
6 changes: 4 additions & 2 deletions x/feemarket/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import (
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"

v010 "github.com/evmos/ethermint/x/feemarket/migrations/v010"
"github.com/evmos/ethermint/x/feemarket/types"
)

// KeyPrefixBaseFeeV1 TODO: Temporary will be removed with params refactor PR
var KeyPrefixBaseFeeV1 = []byte{2}

// Keeper grants access to the Fee Market module state.
type Keeper struct {
// Protobuf codec
Expand Down Expand Up @@ -98,7 +100,7 @@ func (k Keeper) AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64
// return nil if base fee is not enabled
func (k Keeper) GetBaseFeeV1(ctx sdk.Context) *big.Int {
store := ctx.KVStore(k.storeKey)
bz := store.Get(v010.KeyPrefixBaseFeeV1)
bz := store.Get(KeyPrefixBaseFeeV1)
if len(bz) == 0 {
return nil
}
Expand Down
17 changes: 0 additions & 17 deletions x/feemarket/keeper/migrations.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"

v010 "github.com/evmos/ethermint/x/feemarket/migrations/v010"
v011 "github.com/evmos/ethermint/x/feemarket/migrations/v011"
)

// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
Expand All @@ -18,13 +11,3 @@ func NewMigrator(keeper Keeper) Migrator {
keeper: keeper,
}
}

// Migrate1to2 migrates the store from consensus version v1 to v2
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v010.MigrateStore(ctx, &m.keeper.paramSpace, m.keeper.storeKey)
}

// Migrate2to3 migrates the store from consensus version v2 to v3
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return v011.MigrateStore(ctx, &m.keeper.paramSpace)
}
19 changes: 0 additions & 19 deletions x/feemarket/keeper/migrations_test.go
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
package keeper_test

import (
"math/big"

"github.com/evmos/ethermint/x/feemarket/keeper"
v010 "github.com/evmos/ethermint/x/feemarket/migrations/v010"
)

func (suite *KeeperTestSuite) TestMigration1To2() {
suite.SetupTest()
storeKey := suite.app.GetKey("feemarket")
store := suite.ctx.KVStore(storeKey)
baseFee := big.NewInt(1000)
store.Set(v010.KeyPrefixBaseFeeV1, baseFee.Bytes())
m := keeper.NewMigrator(suite.app.FeeMarketKeeper)
err := m.Migrate1to2(suite.ctx)
suite.Require().NoError(err)
suite.Require().Equal(baseFee, suite.app.FeeMarketKeeper.GetBaseFee(suite.ctx))
}
3 changes: 2 additions & 1 deletion x/feemarket/keeper/params_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package keeper_test

import (
"github.com/evmos/ethermint/x/feemarket/types"
"reflect"

"github.com/evmos/ethermint/x/feemarket/types"
)

func (suite *KeeperTestSuite) TestSetGetParams() {
Expand Down
76 changes: 0 additions & 76 deletions x/feemarket/migrations/v010/migrate.go

This file was deleted.

69 changes: 0 additions & 69 deletions x/feemarket/migrations/v010/migrate_test.go

This file was deleted.

Loading

0 comments on commit 831588c

Please sign in to comment.