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

Commit

Permalink
feat: store migration setup (#794)
Browse files Browse the repository at this point in the history
* feat: store migration setup

* comment

* changelog

(cherry picked from commit 841c93c)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
fedekunze authored and mergify-bot committed Nov 29, 2021
1 parent 70480d2 commit c851500
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,21 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

<<<<<<< HEAD
## [v0.8.1] - 2021-11-23
=======
## Unreleased

## Improvements

* (app) [tharsis#794](https://github.com/tharsis/ethermint/pull/794) Setup in-place store migrators.
* (ci) [tharsis#784](https://github.com/tharsis/ethermint/pull/784) Enable automatic backport of PRs.
* (rpc) [tharsis#786](https://github.com/tharsis/ethermint/pull/786) Improve error message of `SendTransaction`/`SendRawTransaction` JSON-RPC APIs.
>>>>>>> 841c93c (feat: store migration setup (#794))
### Bug Fixes

* (evm) [tharsis#794](https://github.com/tharsis/ethermint/pull/794) Register EVM gRPC `Msg` server.
* (feemarket) [tharsis#770](https://github.com/tharsis/ethermint/pull/770) Enable fee market (EIP1559) by default.
* (rpc) [tharsis#769](https://github.com/tharsis/ethermint/pull/769) Fix default Ethereum signer for JSON-RPC.

Expand Down
2 changes: 1 addition & 1 deletion cmd/ethermintd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.MigrateGenesisCmd(),
genutilcli.MigrateGenesisCmd(), // TODO: shouldn't this include the local app version instead of the SDK?
genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(app.DefaultNodeHome),
Expand Down
13 changes: 13 additions & 0 deletions x/evm/keeper/migrations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keeper

// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
}

// NewMigrator returns a new Migrator.
func NewMigrator(keeper Keeper) Migrator {
return Migrator{
keeper: keeper,
}
}
6 changes: 3 additions & 3 deletions x/evm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ func (AppModule) Name() string {
// RegisterInvariants interface for registering invariants. Performs a no-op
// as the evm module doesn't expose invariants.
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
// Invariats lead to performance degradation
//
// keeper.RegisterInvariants(ir, *am.keeper)
}

// RegisterQueryService registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)

_ = keeper.NewMigrator(*am.keeper)
}

// Route returns the message routing key for the evm module.
Expand Down
13 changes: 13 additions & 0 deletions x/feemarket/keeper/migrations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keeper

// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
}

// NewMigrator returns a new Migrator.
func NewMigrator(keeper Keeper) Migrator {
return Migrator{
keeper: keeper,
}
}
2 changes: 2 additions & 0 deletions x/feemarket/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)

_ = keeper.NewMigrator(am.keeper)
}

// Route returns the message routing key for the fee market module.
Expand Down

0 comments on commit c851500

Please sign in to comment.