From c089f9ffc93c571d18bf4b73e96526ac96038d89 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Fri, 11 Aug 2023 15:54:39 -0500 Subject: [PATCH 01/12] Initial upgrade handler --- module/app/app.go | 10 ++++++++++ module/app/upgrades/v3/README.md | 17 +++++++++++++++++ module/app/upgrades/v3/constants.go | 4 ++++ module/app/upgrades/v3/upgrades.go | 20 ++++++++++++++++++++ module/app/upgrades/v3/upgrades_test.go | 1 + module/x/gravity/module.go | 5 +++++ 6 files changed, 57 insertions(+) create mode 100644 module/app/upgrades/v3/README.md create mode 100644 module/app/upgrades/v3/constants.go create mode 100644 module/app/upgrades/v3/upgrades.go create mode 100644 module/app/upgrades/v3/upgrades_test.go diff --git a/module/app/app.go b/module/app/app.go index 2c5a6f3b7..fa339d7fd 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -82,6 +82,7 @@ import ( "github.com/gorilla/mux" gravityparams "github.com/peggyjv/gravity-bridge/module/v3/app/params" v2 "github.com/peggyjv/gravity-bridge/module/v3/app/upgrades/v2" + v3 "github.com/peggyjv/gravity-bridge/module/v3/app/upgrades/v3" "github.com/peggyjv/gravity-bridge/module/v3/x/gravity" gravityclient "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/client" "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/keeper" @@ -840,4 +841,13 @@ func (app *Gravity) setupUpgradeHandlers() { app.bankKeeper, ), ) + + app.upgradeKeeper.SetUpgradeHandler( + v3.UpgradeName, + v3.CreateUpgradeHandler( + app.mm, + app.configurator, + app.bankKeeper, + ), + ) } diff --git a/module/app/upgrades/v3/README.md b/module/app/upgrades/v3/README.md new file mode 100644 index 000000000..181931c2b --- /dev/null +++ b/module/app/upgrades/v3/README.md @@ -0,0 +1,17 @@ +# v3 upgrade + +This upgrade moves the gravity module from consensus version 2 to 3. + +## Summary of changes + +* Add CompletedOutgoingTx store for marking transactions as executed +* Refactor slashing logic and include CompletedOutgoingTx in unslashed tx getter +* Add tx confirmation pruning +* Add event vote record pruning +* Fix bug that iterated the entire key store when SetDelegateKeys was called +* Refactor address lookups used in SetDelegateKeys to not require scanning entire list of validators +* Remove MsgRequestBatchTx and handlers +* Add missing Amino registrations +* Fix minor CLI bugs +* Improve and correct terminology in function names and comments + diff --git a/module/app/upgrades/v3/constants.go b/module/app/upgrades/v3/constants.go new file mode 100644 index 000000000..6a5ba25a2 --- /dev/null +++ b/module/app/upgrades/v3/constants.go @@ -0,0 +1,4 @@ +package v3 + +// UpgradeName defines the on-chain upgrade name for the Gravity v2 upgrade +const UpgradeName = "v3" diff --git a/module/app/upgrades/v3/upgrades.go b/module/app/upgrades/v3/upgrades.go new file mode 100644 index 000000000..5169cff75 --- /dev/null +++ b/module/app/upgrades/v3/upgrades.go @@ -0,0 +1,20 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + bankKeeper bankkeeper.Keeper, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("v3 upgrade: entering handler") + + return mm.RunMigrations(ctx, configurator, fromVM) + } +} diff --git a/module/app/upgrades/v3/upgrades_test.go b/module/app/upgrades/v3/upgrades_test.go new file mode 100644 index 000000000..eac3ae96a --- /dev/null +++ b/module/app/upgrades/v3/upgrades_test.go @@ -0,0 +1 @@ +package v3 diff --git a/module/x/gravity/module.go b/module/x/gravity/module.go index 9c5736e07..6084e277f 100644 --- a/module/x/gravity/module.go +++ b/module/x/gravity/module.go @@ -137,6 +137,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { panic(fmt.Sprintf("failed to migrate x/gravity from version 1 to 2: %v", err)) } + + // The 2-to-3 migration is a no-op because there are no required store migration steps + cfg.RegisterMigration(types.ModuleName, 2, func (ctx sdk.Context) error { + return nil + }) } // InitGenesis initializes the genesis state for this module and implements app module. From f1c775c6e84075d6e0067449d6cd49f2b10089fb Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Fri, 11 Aug 2023 15:57:44 -0500 Subject: [PATCH 02/12] Consensus version -> 3 --- module/x/gravity/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/x/gravity/module.go b/module/x/gravity/module.go index 6084e277f..49bea2a9c 100644 --- a/module/x/gravity/module.go +++ b/module/x/gravity/module.go @@ -104,7 +104,7 @@ func (AppModule) Name() string { // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { - return 2 + return 3 } // RegisterInvariants implements app module From 525f6cae3b92d9d4010b23bc632e7f99c0a33aa4 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Mon, 14 Aug 2023 13:41:18 -0500 Subject: [PATCH 03/12] Param store migration and test --- module/x/gravity/keeper/migrations.go | 6 ++++ module/x/gravity/migrations/v2/keys.go | 6 ++++ module/x/gravity/migrations/v2/store.go | 20 ++++++++++++ module/x/gravity/migrations/v2/store_test.go | 33 ++++++++++++++++++++ module/x/gravity/module.go | 10 +++--- 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 module/x/gravity/migrations/v2/keys.go create mode 100644 module/x/gravity/migrations/v2/store.go create mode 100644 module/x/gravity/migrations/v2/store_test.go diff --git a/module/x/gravity/keeper/migrations.go b/module/x/gravity/keeper/migrations.go index 38d50b0ca..c5a52cc70 100644 --- a/module/x/gravity/keeper/migrations.go +++ b/module/x/gravity/keeper/migrations.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" v1 "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/migrations/v1" + v2 "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/migrations/v2" ) // Migrator is a struct for handling in-place store migrations. @@ -19,3 +20,8 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v1.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) } + +// Migrate2to3 migrates from consensus version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v2.MigrateParamStore(ctx, m.keeper.paramSpace) +} diff --git a/module/x/gravity/migrations/v2/keys.go b/module/x/gravity/migrations/v2/keys.go new file mode 100644 index 000000000..4454afd45 --- /dev/null +++ b/module/x/gravity/migrations/v2/keys.go @@ -0,0 +1,6 @@ +package v2 + +const ( + // ModuleName is the name of the module + ModuleName = "gravity" +) diff --git a/module/x/gravity/migrations/v2/store.go b/module/x/gravity/migrations/v2/store.go new file mode 100644 index 000000000..fc297eac5 --- /dev/null +++ b/module/x/gravity/migrations/v2/store.go @@ -0,0 +1,20 @@ +package v2 + +import ( + sdktypes "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/types" +) + +func MigrateParamStore(ctx sdktypes.Context, subspace paramstypes.Subspace) error { + if subspace.HasKeyTable() { + subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) + subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) + } else { + subspace.WithKeyTable(types.ParamKeyTable()) + subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) + subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) + } + + return nil +} diff --git a/module/x/gravity/migrations/v2/store_test.go b/module/x/gravity/migrations/v2/store_test.go new file mode 100644 index 000000000..31315044a --- /dev/null +++ b/module/x/gravity/migrations/v2/store_test.go @@ -0,0 +1,33 @@ +package v2_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/testutil" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + v2 "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/migrations/v2" + "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/types" + "github.com/stretchr/testify/require" +) + +func TestStoreMigration(t *testing.T) { + gravityKey := storetypes.NewKVStoreKey(v2.ModuleName) + tGravityKey := storetypes.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(gravityKey, tGravityKey) + aminoCodec := codec.NewLegacyAmino() + paramstore := paramtypes.NewSubspace(nil, aminoCodec, gravityKey, tGravityKey, v2.ModuleName) + + // Check no params + require.False(t, paramstore.Has(ctx, types.ParamStoreConfirmedOutgoingTxWindow)) + require.False(t, paramstore.Has(ctx, types.ParamStoreEventVoteWindow)) + + // Run migrations. + err := v2.MigrateParamStore(ctx, paramstore) + require.NoError(t, err) + + // Make sure the new params are set. + require.True(t, paramstore.Has(ctx, types.ParamStoreConfirmedOutgoingTxWindow)) + require.True(t, paramstore.Has(ctx, types.ParamStoreEventVoteWindow)) +} diff --git a/module/x/gravity/module.go b/module/x/gravity/module.go index 49bea2a9c..9712e08b8 100644 --- a/module/x/gravity/module.go +++ b/module/x/gravity/module.go @@ -137,11 +137,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { panic(fmt.Sprintf("failed to migrate x/gravity from version 1 to 2: %v", err)) } - - // The 2-to-3 migration is a no-op because there are no required store migration steps - cfg.RegisterMigration(types.ModuleName, 2, func (ctx sdk.Context) error { - return nil - }) + + // The 2-to-3 migration is a no-op because there are no required store migration steps + if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { + panic(fmt.Sprintf("failed to migrate x/gravity from version 2 to 3: %v", err)) + } } // InitGenesis initializes the genesis state for this module and implements app module. From e5253febc417404e91a6a6511a1958b2372b40c9 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 15 Aug 2023 14:38:22 -0500 Subject: [PATCH 04/12] Remove bankKeeper argument from upgrade handler --- module/app/app.go | 1 - module/app/upgrades/v3/upgrades.go | 1 - 2 files changed, 2 deletions(-) diff --git a/module/app/app.go b/module/app/app.go index fa339d7fd..bbca29d31 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -847,7 +847,6 @@ func (app *Gravity) setupUpgradeHandlers() { v3.CreateUpgradeHandler( app.mm, app.configurator, - app.bankKeeper, ), ) } diff --git a/module/app/upgrades/v3/upgrades.go b/module/app/upgrades/v3/upgrades.go index 5169cff75..fdf70d8e1 100644 --- a/module/app/upgrades/v3/upgrades.go +++ b/module/app/upgrades/v3/upgrades.go @@ -10,7 +10,6 @@ import ( func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, - bankKeeper bankkeeper.Keeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("v3 upgrade: entering handler") From 75a43ad95ae30d3ca0a82711bcfcae327db72125 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 15 Aug 2023 14:38:43 -0500 Subject: [PATCH 05/12] Update changelog in README --- module/app/upgrades/v3/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/app/upgrades/v3/README.md b/module/app/upgrades/v3/README.md index 181931c2b..f8075cb59 100644 --- a/module/app/upgrades/v3/README.md +++ b/module/app/upgrades/v3/README.md @@ -4,6 +4,9 @@ This upgrade moves the gravity module from consensus version 2 to 3. ## Summary of changes +* Bumps cosmos-sdk to v0.45.10 and ibc-go to v3.4.0 +* Bumps minor dependency versions +* Fix signer set signature sorting inconsistency between orchestrator and chain when powers are equal * Add CompletedOutgoingTx store for marking transactions as executed * Refactor slashing logic and include CompletedOutgoingTx in unslashed tx getter * Add tx confirmation pruning @@ -14,4 +17,5 @@ This upgrade moves the gravity module from consensus version 2 to 3. * Add missing Amino registrations * Fix minor CLI bugs * Improve and correct terminology in function names and comments +* Update queries From a3b0d4d5701617c589f7dc560f9dad382be988d4 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 15 Aug 2023 14:38:57 -0500 Subject: [PATCH 06/12] Fix comment --- module/app/upgrades/v3/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/app/upgrades/v3/constants.go b/module/app/upgrades/v3/constants.go index 6a5ba25a2..8cffd9af2 100644 --- a/module/app/upgrades/v3/constants.go +++ b/module/app/upgrades/v3/constants.go @@ -1,4 +1,4 @@ package v3 -// UpgradeName defines the on-chain upgrade name for the Gravity v2 upgrade +// UpgradeName defines the on-chain upgrade name for the Gravity v3 upgrade const UpgradeName = "v3" From 22b247b91b3545ce24f0c1ccf5c330ebba2ec3fd Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 15 Aug 2023 14:39:11 -0500 Subject: [PATCH 07/12] Move ModuleName const to test file --- module/x/gravity/migrations/v2/keys.go | 6 ------ module/x/gravity/migrations/v2/store_test.go | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 module/x/gravity/migrations/v2/keys.go diff --git a/module/x/gravity/migrations/v2/keys.go b/module/x/gravity/migrations/v2/keys.go deleted file mode 100644 index 4454afd45..000000000 --- a/module/x/gravity/migrations/v2/keys.go +++ /dev/null @@ -1,6 +0,0 @@ -package v2 - -const ( - // ModuleName is the name of the module - ModuleName = "gravity" -) diff --git a/module/x/gravity/migrations/v2/store_test.go b/module/x/gravity/migrations/v2/store_test.go index 31315044a..76053c07b 100644 --- a/module/x/gravity/migrations/v2/store_test.go +++ b/module/x/gravity/migrations/v2/store_test.go @@ -12,12 +12,16 @@ import ( "github.com/stretchr/testify/require" ) +const ( + ModuleName = "gravity" +) + func TestStoreMigration(t *testing.T) { - gravityKey := storetypes.NewKVStoreKey(v2.ModuleName) + gravityKey := storetypes.NewKVStoreKey(ModuleName) tGravityKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(gravityKey, tGravityKey) aminoCodec := codec.NewLegacyAmino() - paramstore := paramtypes.NewSubspace(nil, aminoCodec, gravityKey, tGravityKey, v2.ModuleName) + paramstore := paramtypes.NewSubspace(nil, aminoCodec, gravityKey, tGravityKey, ModuleName) // Check no params require.False(t, paramstore.Has(ctx, types.ParamStoreConfirmedOutgoingTxWindow)) From 0cf501bbc1ac30417f9070b6370b64dc0d5f7912 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Thu, 17 Aug 2023 14:46:46 -0500 Subject: [PATCH 08/12] Pass paramstore by reference to migrator --- module/x/gravity/keeper/migrations.go | 2 +- module/x/gravity/migrations/v2/store.go | 2 +- module/x/gravity/migrations/v2/store_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/x/gravity/keeper/migrations.go b/module/x/gravity/keeper/migrations.go index c5a52cc70..6ac6df6d8 100644 --- a/module/x/gravity/keeper/migrations.go +++ b/module/x/gravity/keeper/migrations.go @@ -23,5 +23,5 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error { // Migrate2to3 migrates from consensus version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v2.MigrateParamStore(ctx, m.keeper.paramSpace) + return v2.MigrateParamStore(ctx, &m.keeper.paramSpace) } diff --git a/module/x/gravity/migrations/v2/store.go b/module/x/gravity/migrations/v2/store.go index fc297eac5..3bebcdba4 100644 --- a/module/x/gravity/migrations/v2/store.go +++ b/module/x/gravity/migrations/v2/store.go @@ -6,7 +6,7 @@ import ( "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/types" ) -func MigrateParamStore(ctx sdktypes.Context, subspace paramstypes.Subspace) error { +func MigrateParamStore(ctx sdktypes.Context, subspace *paramstypes.Subspace) error { if subspace.HasKeyTable() { subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) diff --git a/module/x/gravity/migrations/v2/store_test.go b/module/x/gravity/migrations/v2/store_test.go index 76053c07b..4f71c2e67 100644 --- a/module/x/gravity/migrations/v2/store_test.go +++ b/module/x/gravity/migrations/v2/store_test.go @@ -28,7 +28,7 @@ func TestStoreMigration(t *testing.T) { require.False(t, paramstore.Has(ctx, types.ParamStoreEventVoteWindow)) // Run migrations. - err := v2.MigrateParamStore(ctx, paramstore) + err := v2.MigrateParamStore(ctx, ¶mstore) require.NoError(t, err) // Make sure the new params are set. From d26821cd5b782d6f47c1c82d738d57fe94bd83f0 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Thu, 17 Aug 2023 14:46:51 -0500 Subject: [PATCH 09/12] Remove unused import --- module/app/upgrades/v3/upgrades.go | 1 - 1 file changed, 1 deletion(-) diff --git a/module/app/upgrades/v3/upgrades.go b/module/app/upgrades/v3/upgrades.go index fdf70d8e1..1f3d508b1 100644 --- a/module/app/upgrades/v3/upgrades.go +++ b/module/app/upgrades/v3/upgrades.go @@ -3,7 +3,6 @@ package v3 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) From bacb5a62b09f915ec14c1044a797003e1b444ab8 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Thu, 17 Aug 2023 15:59:35 -0500 Subject: [PATCH 10/12] Remove unnecessary use of pointer in migration --- module/x/gravity/keeper/migrations.go | 2 +- module/x/gravity/migrations/v2/store.go | 11 +++++------ module/x/gravity/migrations/v2/store_test.go | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/module/x/gravity/keeper/migrations.go b/module/x/gravity/keeper/migrations.go index 6ac6df6d8..c5a52cc70 100644 --- a/module/x/gravity/keeper/migrations.go +++ b/module/x/gravity/keeper/migrations.go @@ -23,5 +23,5 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error { // Migrate2to3 migrates from consensus version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v2.MigrateParamStore(ctx, &m.keeper.paramSpace) + return v2.MigrateParamStore(ctx, m.keeper.paramSpace) } diff --git a/module/x/gravity/migrations/v2/store.go b/module/x/gravity/migrations/v2/store.go index 3bebcdba4..bbd1b522c 100644 --- a/module/x/gravity/migrations/v2/store.go +++ b/module/x/gravity/migrations/v2/store.go @@ -6,13 +6,12 @@ import ( "github.com/peggyjv/gravity-bridge/module/v3/x/gravity/types" ) -func MigrateParamStore(ctx sdktypes.Context, subspace *paramstypes.Subspace) error { - if subspace.HasKeyTable() { - subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) - subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) - } else { - subspace.WithKeyTable(types.ParamKeyTable()) +func MigrateParamStore(ctx sdktypes.Context, subspace paramstypes.Subspace) error { + // Don't want to overwrite values if they were set in an upgrade handler + if !subspace.Has(ctx, types.ParamStoreConfirmedOutgoingTxWindow) { subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) + } + if !subspace.Has(ctx, types.ParamStoreEventVoteWindow) { subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) } diff --git a/module/x/gravity/migrations/v2/store_test.go b/module/x/gravity/migrations/v2/store_test.go index 4f71c2e67..76053c07b 100644 --- a/module/x/gravity/migrations/v2/store_test.go +++ b/module/x/gravity/migrations/v2/store_test.go @@ -28,7 +28,7 @@ func TestStoreMigration(t *testing.T) { require.False(t, paramstore.Has(ctx, types.ParamStoreEventVoteWindow)) // Run migrations. - err := v2.MigrateParamStore(ctx, ¶mstore) + err := v2.MigrateParamStore(ctx, paramstore) require.NoError(t, err) // Make sure the new params are set. From 5db518d61d0df3dfccdd5fb139ab734342fc3793 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Fri, 18 Aug 2023 09:11:38 -0500 Subject: [PATCH 11/12] Remove old comment --- module/x/gravity/module.go | 1 - 1 file changed, 1 deletion(-) diff --git a/module/x/gravity/module.go b/module/x/gravity/module.go index 9712e08b8..96f549f06 100644 --- a/module/x/gravity/module.go +++ b/module/x/gravity/module.go @@ -138,7 +138,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { panic(fmt.Sprintf("failed to migrate x/gravity from version 1 to 2: %v", err)) } - // The 2-to-3 migration is a no-op because there are no required store migration steps if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { panic(fmt.Sprintf("failed to migrate x/gravity from version 2 to 3: %v", err)) } From 9b28b3e87f588c6a0a4506748c27beaeb55480e6 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Fri, 18 Aug 2023 09:13:41 -0500 Subject: [PATCH 12/12] Correct naming of param key name and value --- module/x/gravity/migrations/v2/store.go | 4 ++-- module/x/gravity/types/genesis.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/x/gravity/migrations/v2/store.go b/module/x/gravity/migrations/v2/store.go index bbd1b522c..7097c9824 100644 --- a/module/x/gravity/migrations/v2/store.go +++ b/module/x/gravity/migrations/v2/store.go @@ -11,8 +11,8 @@ func MigrateParamStore(ctx sdktypes.Context, subspace paramstypes.Subspace) erro if !subspace.Has(ctx, types.ParamStoreConfirmedOutgoingTxWindow) { subspace.Set(ctx, types.ParamStoreConfirmedOutgoingTxWindow, types.DefaultParams().ConfirmedOutgoingTxWindow) } - if !subspace.Has(ctx, types.ParamStoreEventVoteWindow) { - subspace.Set(ctx, types.ParamStoreEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) + if !subspace.Has(ctx, types.ParamStoreEthereumEventVoteWindow) { + subspace.Set(ctx, types.ParamStoreEthereumEventVoteWindow, types.DefaultParams().EthereumEventVoteWindow) } return nil diff --git a/module/x/gravity/types/genesis.go b/module/x/gravity/types/genesis.go index 162ae2310..f8de6d063 100644 --- a/module/x/gravity/types/genesis.go +++ b/module/x/gravity/types/genesis.go @@ -65,8 +65,8 @@ var ( // ParamStoreUnbondSlashingSignerSetTxsWindow stores unbond slashing valset window ParamStoreUnbondSlashingSignerSetTxsWindow = []byte("UnbondSlashingSignerSetTxsWindow") - // ParamStoreEventVoteWindow stores the event vote window - ParamStoreEventVoteWindow = []byte("EventVoteWindow") + // ParamStoreEthereumEventVoteWindow stores the event vote window + ParamStoreEthereumEventVoteWindow = []byte("EthereumEventVoteWindow") // ParamStoreUnbondSlashingSignerSetTxsWindow stores unbond slashing valset window ParamStoreConfirmedOutgoingTxWindow = []byte("ConfirmedOutgoingTxWindow") @@ -228,7 +228,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(ParamsStoreSlashFractionEthereumSignature, &p.SlashFractionEthereumSignature, validateSlashFractionEthereumSignature), paramtypes.NewParamSetPair(ParamsStoreSlashFractionConflictingEthereumSignature, &p.SlashFractionConflictingEthereumSignature, validateSlashFractionConflictingEthereumSignature), paramtypes.NewParamSetPair(ParamStoreUnbondSlashingSignerSetTxsWindow, &p.UnbondSlashingSignerSetTxsWindow, validateUnbondSlashingSignerSetTxsWindow), - paramtypes.NewParamSetPair(ParamStoreEventVoteWindow, &p.EthereumEventVoteWindow, validateEthereumEventVoteWindow), + paramtypes.NewParamSetPair(ParamStoreEthereumEventVoteWindow, &p.EthereumEventVoteWindow, validateEthereumEventVoteWindow), paramtypes.NewParamSetPair(ParamStoreConfirmedOutgoingTxWindow, &p.ConfirmedOutgoingTxWindow, validateConfirmedOutgoingTxWindow), } }