Skip to content

Commit

Permalink
CNS-53 spec support simultaneously both res ts get post (#165)
Browse files Browse the repository at this point in the history
* removed proposal json and using the generated one

* removed spec modify

* changed specs to the new version

* deterministic is moved into the interface

* renaming some parameters in spec

* added migrator

* add upgrade plan

* PR changes, moved category to interface

* update get interface

* add method to newmsg in rest

* fix tendermint new msg

* update specs

Co-authored-by: Yarom Swisa <[email protected] git config --global user.name Yarom>
Co-authored-by: omer mishael <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2022
1 parent cf54b2a commit ada6320
Show file tree
Hide file tree
Showing 54 changed files with 75,829 additions and 75,861 deletions.
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
specmoduleclient.SpecAddProposalHandler,
specmoduleclient.SpecModifyProposalHandler,
// this line is used by starport scaffolding # stargate/app/govProposalHandler
)

Expand Down
14 changes: 14 additions & 0 deletions app/upgrades/v0_X_0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package v0_X_0

import (
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/lavanet/lava/app/upgrades"
)

const UpgradeName = "v0.X.0"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName, // upgrade name defined few lines above
CreateUpgradeHandler: CreateUpgradeHandler, // create CreateUpgradeHandler in upgrades.go below
StoreUpgrades: store.StoreUpgrades{}, // StoreUpgrades has 3 fields: Added/Renamed/Deleted any module that fits these description should be added in the way below
}
32 changes: 32 additions & 0 deletions app/upgrades/v0_X_0/upgrade_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//go:build ignore

package v0_x_0_test

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ignite-hq/cli/ignite/pkg/cosmoscmd"
keepertest "github.com/lavanet/lava/testutil/keeper"
"github.com/stretchr/testify/suite"
)

type UpgradeTestSuite struct {
suite.Suite

ctx sdk.Context
app cosmoscmd.App
}

func (suite *UpgradeTestSuite) SetupTestApp() {
suite.app, suite.ctx = app.TestSetup()
}

func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(UpgradeTestSuite))
}

func (suite *UpgradeTestSuite) TestBody() {
suite.SetupTestApp() // setup test app
suite.T().Log("test")
}
32 changes: 32 additions & 0 deletions app/upgrades/v0_X_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package v0_X_0

import (
"log"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/lavanet/lava/app/keepers"
"github.com/lavanet/lava/app/upgrades"
"github.com/lavanet/lava/x/spec/migrations"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bpm upgrades.BaseAppParamManager,
keepers *keepers.LavaKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
log.Println("########################")
log.Println("# STARTING UPGRADE #")
log.Println("########################")

// delete all existing conflicts

migrator := migrations.NewMigrator(keepers.SpecKeeper)
migrator.MigrateToV0X0(ctx)

return mm.RunMigrations(ctx, configurator, vm)
}
}
Loading

0 comments on commit ada6320

Please sign in to comment.