Skip to content

Commit

Permalink
Merge pull request #48 from xrplevm/upgrade/feat/v6
Browse files Browse the repository at this point in the history
feat(app): V6 UpgradeHandler
  • Loading branch information
AdriaCarrera authored Jan 21, 2025
2 parents d358e43 + 97ce614 commit 6688ca6
Show file tree
Hide file tree
Showing 36 changed files with 83 additions and 49 deletions.
2 changes: 1 addition & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/evmos/evmos/v20/app/ante"
ethante "github.com/evmos/evmos/v20/app/ante/evm"
etherminttypes "github.com/evmos/evmos/v20/types"
poaante "github.com/xrplevm/node/v5/x/poa/ante"
poaante "github.com/xrplevm/node/v6/x/poa/ante"
)

type AnteHandlerOptions ante.HandlerOptions
Expand Down
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/xrplevm/node/v5/x/poa"
"github.com/xrplevm/node/v6/x/poa"

"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
Expand Down Expand Up @@ -120,11 +120,11 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types"

"github.com/xrplevm/node/v5/docs"
poakeeper "github.com/xrplevm/node/v5/x/poa/keeper"
poatypes "github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/docs"
poakeeper "github.com/xrplevm/node/v6/x/poa/keeper"
poatypes "github.com/xrplevm/node/v6/x/poa/types"

// "github.com/xrplevm/node/v5/app/ante"
// "github.com/xrplevm/node/v6/app/ante"
"github.com/evmos/evmos/v20/app/ante"
srvflags "github.com/evmos/evmos/v20/server/flags"

Expand Down
2 changes: 1 addition & 1 deletion app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
"github.com/evmos/evmos/v20/app/ante"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/app"
"github.com/xrplevm/node/v6/app"
)

func init() {
Expand Down
14 changes: 11 additions & 3 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
v4 "github.com/xrplevm/node/v5/app/upgrades/v4"
v5 "github.com/xrplevm/node/v5/app/upgrades/v5"
v4 "github.com/xrplevm/node/v6/app/upgrades/v4"
v5 "github.com/xrplevm/node/v6/app/upgrades/v5"
v6 "github.com/xrplevm/node/v6/app/upgrades/v6"
)

func (app *App) setupUpgradeHandlers() {
Expand All @@ -36,6 +37,13 @@ func (app *App) setupUpgradeHandlers() {
app.configurator,
),
)
app.UpgradeKeeper.SetUpgradeHandler(
v6.UpgradeName,
v6.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)

// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
Expand All @@ -60,7 +68,7 @@ func (app *App) setupUpgradeHandlers() {
},
Deleted: []string{},
}
case v5.UpgradeName:
case v5.UpgradeName, v6.UpgradeName:
// No store upgrades for v5
storeUpgrades = &storetypes.StoreUpgrades{}
}
Expand Down
5 changes: 5 additions & 0 deletions app/upgrades/v6/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v6

const (
UpgradeName = "v6.0.0"
)
21 changes: 21 additions & 0 deletions app/upgrades/v6/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v6

import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(c)
logger := ctx.Logger().With("upgrade", UpgradeName)
logger.Info("Running v6 upgrade handler...")
return mm.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 1 addition & 1 deletion cmd/exrpd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
ethermintserver "github.com/evmos/evmos/v20/server"
ethermintservercfg "github.com/evmos/evmos/v20/server/config"
ethermintserverflags "github.com/evmos/evmos/v20/server/flags"
"github.com/xrplevm/node/v5/app"
"github.com/xrplevm/node/v6/app"
)

type emptyAppOptions struct{}
Expand Down
4 changes: 2 additions & 2 deletions cmd/exrpd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

"github.com/xrplevm/node/v5/app"
"github.com/xrplevm/node/v5/cmd/exrpd/cmd"
"github.com/xrplevm/node/v6/app"
"github.com/xrplevm/node/v6/cmd/exrpd/cmd"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/xrplevm/node/v5
module github.com/xrplevm/node/v6

go 1.22.7

Expand Down
2 changes: 1 addition & 1 deletion proto/poa/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package poa;
import "gogoproto/gogo.proto";
import "poa/params.proto";

option go_package = "github.com/xrplevm/node/v5/x/poa/types";
option go_package = "github.com/xrplevm/node/v6/x/poa/types";

// GenesisState defines the poa module's genesis state.
message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; }
2 changes: 1 addition & 1 deletion proto/poa/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package poa;

import "gogoproto/gogo.proto";

option go_package = "github.com/xrplevm/node/v5/x/poa/types";
option go_package = "github.com/xrplevm/node/v6/x/poa/types";

// Params defines the parameters for the module.
message Params { option (gogoproto.goproto_stringer) = false; }
2 changes: 1 addition & 1 deletion proto/poa/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "poa/params.proto";

option go_package = "github.com/xrplevm/node/v5/x/poa/types";
option go_package = "github.com/xrplevm/node/v6/x/poa/types";

// Query defines the gRPC querier service.
service Query {
Expand Down
2 changes: 1 addition & 1 deletion proto/poa/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "cosmos/staking/v1beta1/staking.proto";
import "google/protobuf/any.proto";
import "amino/amino.proto";

option go_package = "github.com/xrplevm/node/v5/x/poa/types";
option go_package = "github.com/xrplevm/node/v6/x/poa/types";

// Msg defines the Msg service.
service Msg {
Expand Down
4 changes: 2 additions & 2 deletions x/poa/ante/poa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/types"
)

func setupPoaDecorator(t *testing.T) (
Expand Down
2 changes: 1 addition & 1 deletion x/poa/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// "github.com/cosmos/cosmos-sdk/client/flags"
// sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

// GetQueryCmd returns the cli query commands for this module
Expand Down
2 changes: 1 addition & 1 deletion x/poa/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

func CmdQueryParams() *cobra.Command {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/client/cli"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"

"github.com/spf13/cobra"

Expand Down
4 changes: 2 additions & 2 deletions x/poa/keeper/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/golang/mock/gomock"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/types"

stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

// InitGenesis initializes the module's state from a provided genesis state.
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/testutil"
)

func TestPoA_Hooks(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

// RegisterInvariants registers all module invariants
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/invariants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/testutil"
)

func TestStakingPowerInvariant_Valid(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions x/poa/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/types"
)

func poaKeeperTestSetup(t *testing.T) (*Keeper, sdk.Context) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/msg_server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keeper

import (
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

type msgServer struct {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/msg_server_add_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

func (k msgServer) AddValidator(goCtx context.Context, msg *types.MsgAddValidator) (*types.MsgAddValidatorResponse, error) {
Expand Down
4 changes: 2 additions & 2 deletions x/poa/keeper/msg_server_add_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/testutil"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/testutil"
"github.com/xrplevm/node/v6/x/poa/types"
)

func TestMsgServer_AddValidator(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/msg_server_remove_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
gov "github.com/cosmos/cosmos-sdk/x/gov/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

func (k msgServer) RemoveValidator(goCtx context.Context, msg *types.MsgRemoveValidator) (*types.MsgRemoveValidatorResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/msg_server_remove_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

func TestMsgServer_RemoveValidator(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

// GetParams get all parameters as types.Params
Expand Down
2 changes: 1 addition & 1 deletion x/poa/keeper/query.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keeper

import (
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

var _ types.QueryServer = Keeper{}
2 changes: 1 addition & 1 deletion x/poa/keeper/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
6 changes: 3 additions & 3 deletions x/poa/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/xrplevm/node/v5/x/poa/client/cli"
"github.com/xrplevm/node/v5/x/poa/keeper"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/client/cli"
"github.com/xrplevm/node/v6/x/poa/keeper"
"github.com/xrplevm/node/v6/x/poa/types"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions x/poa/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/cosmos/cosmos-sdk/x/simulation"

"github.com/xrplevm/node/v5/testutil/sample"
poasimulation "github.com/xrplevm/node/v5/x/poa/simulation"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/testutil/sample"
poasimulation "github.com/xrplevm/node/v6/x/poa/simulation"
"github.com/xrplevm/node/v6/x/poa/types"
)

// avoid unused import issue
Expand Down
2 changes: 1 addition & 1 deletion x/poa/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion x/poa/simulation/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/address"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/stretchr/testify/require"
"github.com/xrplevm/node/v5/x/poa/types"
"github.com/xrplevm/node/v6/x/poa/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down

0 comments on commit 6688ca6

Please sign in to comment.