Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed May 24, 2024
1 parent 3c26795 commit b582c35
Show file tree
Hide file tree
Showing 68 changed files with 146 additions and 173 deletions.
2 changes: 1 addition & 1 deletion app/ante/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
"github.com/realiotech/realio-network/app/ante"
"github.com/realiotech/realio-network/v2/app/ante"
"github.com/stretchr/testify/require"
)

Expand Down
4 changes: 2 additions & 2 deletions app/ante/handler_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
ethante "github.com/evmos/evmos/v18/app/ante/evm"
"github.com/evmos/evmos/v18/encoding"
"github.com/evmos/evmos/v18/types"
"github.com/realiotech/realio-network/app"
"github.com/realiotech/realio-network/app/ante"
"github.com/realiotech/realio-network/v2/app"
"github.com/realiotech/realio-network/v2/app/ante"
)

func (suite *AnteTestSuite) TestValidateHandlerOptions() {
Expand Down
4 changes: 2 additions & 2 deletions app/ante/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
"github.com/evmos/evmos/v18/types"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
feemarkettypes "github.com/evmos/evmos/v18/x/feemarket/types"
"github.com/realiotech/realio-network/app"
realionetworktypes "github.com/realiotech/realio-network/types"
"github.com/realiotech/realio-network/v2/app"
realionetworktypes "github.com/realiotech/realio-network/v2/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
Expand Down
21 changes: 12 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import (
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"

// staking
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -107,20 +108,22 @@ import (
feemarkettypes "github.com/evmos/evmos/v18/x/feemarket/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"

// multi-staking
multistaking "github.com/realio-tech/multi-staking-module/x/multi-staking"
multistakingkeeper "github.com/realio-tech/multi-staking-module/x/multi-staking/keeper"
multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types"
"github.com/realiotech/realio-network/app/ante"
"github.com/realiotech/realio-network/v2/app/ante"

// unnamed import of statik for swagger UI support
_ "github.com/realiotech/realio-network/client/docs/statik"
realionetworktypes "github.com/realiotech/realio-network/types"
assetmodule "github.com/realiotech/realio-network/x/asset"
assetmodulekeeper "github.com/realiotech/realio-network/x/asset/keeper"
assetmoduletypes "github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/x/mint"
mintkeeper "github.com/realiotech/realio-network/x/mint/keeper"
minttypes "github.com/realiotech/realio-network/x/mint/types"
_ "github.com/realiotech/realio-network/v2/client/docs/statik"
realionetworktypes "github.com/realiotech/realio-network/v2/types"
assetmodule "github.com/realiotech/realio-network/v2/x/asset"
assetmodulekeeper "github.com/realiotech/realio-network/v2/x/asset/keeper"
assetmoduletypes "github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/realiotech/realio-network/v2/x/mint"
mintkeeper "github.com/realiotech/realio-network/v2/x/mint/keeper"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
"github.com/spf13/cast"
)

Expand Down
6 changes: 3 additions & 3 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/evmos/evmos/v18/encoding"
feemarkettypes "github.com/evmos/evmos/v18/x/feemarket/types"
multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types"
"github.com/realiotech/realio-network/cmd/config"
"github.com/realiotech/realio-network/types"
minttypes "github.com/realiotech/realio-network/x/mint/types"
"github.com/realiotech/realio-network/v2/cmd/config"
"github.com/realiotech/realio-network/v2/types"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
)

func init() {
Expand Down
10 changes: 5 additions & 5 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types"
multistaking "github.com/realiotech/realio-network/app/upgrades/multi-staking"
v3 "github.com/realiotech/realio-network/app/upgrades/v3"
multistaking "github.com/realiotech/realio-network/v2/app/upgrades/multi-staking"
v2 "github.com/realiotech/realio-network/v2/app/upgrades/v2"
)

func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
Expand All @@ -28,8 +28,8 @@ func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
)

app.UpgradeKeeper.SetUpgradeHandler(
v3.UpgradeName,
v3.CreateUpgradeHandler(
v2.UpgradeName,
v2.CreateUpgradeHandler(
app.mm, app.configurator,
app.ConsensusParamsKeeper,
app.IBCKeeper.ClientKeeper,
Expand All @@ -55,7 +55,7 @@ func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{multistakingtypes.ModuleName},
}
} else if upgradeInfo.Name == v3.UpgradeName {
} else if upgradeInfo.Name == v2.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{crisistypes.ModuleName, consensusparamtypes.ModuleName},
}
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/multi-staking/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
multistaking "github.com/realio-tech/multi-staking-module/x/multi-staking"
multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types"
"github.com/realiotech/realio-network/app/upgrades/multi-staking/legacy"
minttypes "github.com/realiotech/realio-network/x/mint/types"
"github.com/realiotech/realio-network/v2/app/upgrades/multi-staking/legacy"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
"github.com/spf13/cast"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3
package v2

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
9 changes: 3 additions & 6 deletions app/upgrades/v2/constants.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package v2

const (
// UpgradeName is the shared upgrade plan name for mainnet and testnet
// UpgradeName = "v2.0.0"
// MainnetUpgradeHeight defines the Realio Network mainnet block height on which the upgrade will take place
// MainnetUpgradeHeight =
// UpgradeInfo defines the binaries that will be used for the upgrade
// UpgradeInfo = `'{"binaries":{"darwin/arm64":"https://github.com/realiotech/realio-network/releases/download/v0.1.0/realio-network_0.1.0_Darwin_arm64.tar.gz","darwin/x86_64":"https://github.com/realiotech/realio-network/releases/download/v0.1.0/realio-network_0.1.0_Darwin_x86_64.tar.gz","linux/arm64":"https://github.com/realiotech/realio-network/releases/download/v0.1.0/realio-network_0.1.0_Linux_arm64.tar.gz","linux/x86_64":"https://github.com/realiotech/realio-network/releases/download/v0.1.0/realio-network_0.1.0_Linux_x86_64.tar.gz","windows/x86_64":"https://github.com/realiotech/realio-network/releases/download/v0.1.0/realio-network_0.1.0_Windows_x86_64.zip"}}'`
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v2"
NewMinCommisionRate = "0.05"
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3
package v2

import (
"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -17,7 +17,7 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
feemarkettypes "github.com/evmos/evmos/v18/x/feemarket/types"
minttypes "github.com/realiotech/realio-network/x/mint/types"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
)

func migrateParamSubspace(ctx sdk.Context, ck consensuskeeper.Keeper, pk paramskeeper.Keeper) {
Expand Down
25 changes: 21 additions & 4 deletions app/upgrades/v2/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
package v2

import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations"
)

// CreateUpgradeHandler creates an SDK upgrade handler for v2
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
ck consensuskeeper.Keeper,
clientKeeper ibctmmigrations.ClientKeeper,
pk paramskeeper.Keeper,
sk *stakingkeeper.Keeper,
stakingLegacySubspace paramstypes.Subspace,
cdc codec.BinaryCodec,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// Refs:
// - https://docs.cosmos.network/master/building-modules/upgrade.html#registering-migrations
// - https://docs.cosmos.network/master/migrations/chain-upgrade-guide-044.html#chain-upgrade
ctx.Logger().Info("Starting upgrade for v3")

fixMinCommisionRate(ctx, sk, stakingLegacySubspace)
migrateParamSubspace(ctx, ck, pk)
// fixMinCommisionRate(ctx, sk)

if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper); err != nil {
return nil, err
}
return mm.RunMigrations(ctx, configurator, vm)
}
}
7 changes: 0 additions & 7 deletions app/upgrades/v3/constants.go

This file was deleted.

37 changes: 0 additions & 37 deletions app/upgrades/v3/upgrades.go

This file was deleted.

6 changes: 3 additions & 3 deletions app/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
v3 "github.com/realiotech/realio-network/app/upgrades/v3"
v2 "github.com/realiotech/realio-network/v2/app/upgrades/v2"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func TestV3Upgrade(t *testing.T) {
app.StakingKeeper.SetValidator(ctx, validators[3])

upgradePlan := upgradetypes.Plan{
Name: v3.UpgradeName,
Name: v2.UpgradeName,
Height: ctx.BlockHeight(),
}
err := app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan)
Expand All @@ -60,7 +60,7 @@ func TestV3Upgrade(t *testing.T) {

validatorsAfter := app.StakingKeeper.GetAllValidators(ctx)

upgradeMinCommRate := sdk.MustNewDecFromStr(v3.NewMinCommisionRate)
upgradeMinCommRate := sdk.MustNewDecFromStr(v2.NewMinCommisionRate)
require.Equal(t, validatorsAfter[0].Commission.CommissionRates.Rate, upgradeMinCommRate)
require.Equal(t, validatorsAfter[1].Commission.CommissionRates.Rate, upgradeMinCommRate)
require.Equal(t, validatorsAfter[0].Commission.CommissionRates.MaxRate, upgradeMinCommRate)
Expand Down
4 changes: 2 additions & 2 deletions cmd/realio-networkd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/realiotech/realio-network/app"
cmdcfg "github.com/realiotech/realio-network/cmd/config"
"github.com/realiotech/realio-network/v2/app"
cmdcfg "github.com/realiotech/realio-network/v2/cmd/config"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/realio-networkd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"github.com/evmos/evmos/v18/crypto/hd"
ethermintserver "github.com/evmos/evmos/v18/server"
servercfg "github.com/evmos/evmos/v18/server/config"
"github.com/realiotech/realio-network/app"
cmdcfg "github.com/realiotech/realio-network/cmd/config"
"github.com/realiotech/realio-network/v2/app"
cmdcfg "github.com/realiotech/realio-network/v2/cmd/config"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down
6 changes: 3 additions & 3 deletions cmd/realio-networkd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import (
srvflags "github.com/evmos/evmos/v18/server/flags"
ethermint "github.com/evmos/evmos/v18/types"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
cmdcfg "github.com/realiotech/realio-network/cmd/config"
"github.com/realiotech/realio-network/testutil/network"
minttypes "github.com/realiotech/realio-network/x/mint/types"
cmdcfg "github.com/realiotech/realio-network/v2/cmd/config"
"github.com/realiotech/realio-network/v2/testutil/network"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
"github.com/spf13/cobra"
)

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/realiotech/realio-network
module github.com/realiotech/realio-network/v2

go 1.22.2

Expand Down
4 changes: 2 additions & 2 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ import (
"github.com/evmos/evmos/v18/server/config"
ethermint "github.com/evmos/evmos/v18/types"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
"github.com/realiotech/realio-network/app"
"github.com/realiotech/realio-network/types"
"github.com/realiotech/realio-network/v2/app"
"github.com/realiotech/realio-network/v2/types"
"github.com/spf13/cobra"
"google.golang.org/grpc"
)
Expand Down
4 changes: 2 additions & 2 deletions testutil/network/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
"github.com/evmos/evmos/v18/server"
evmtypes "github.com/evmos/evmos/v18/x/evm/types"
assettypes "github.com/realiotech/realio-network/x/asset/types"
minttypes "github.com/realiotech/realio-network/x/mint/types"
assettypes "github.com/realiotech/realio-network/v2/x/asset/types"
minttypes "github.com/realiotech/realio-network/v2/x/mint/types"
)

func startInProcess(cfg Config, val *Validator) error {
Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/cosmos/cosmos-sdk/client"
"github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/query_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/tx.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/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/tx_authorize_address.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/cosmos/cosmos-sdk/client/tx"
"github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/asset/client/cli/tx_create_token.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/cosmos/cosmos-sdk/client/tx"
"github.com/realiotech/realio-network/x/asset/types"
"github.com/realiotech/realio-network/v2/x/asset/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
Expand Down
Loading

0 comments on commit b582c35

Please sign in to comment.