-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from lavanet/CNS-45-add-query-to-support-prot…
…ocol CNS-45 add query to support protocol
- Loading branch information
Showing
20 changed files
with
795 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package vx | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/lavanet/lava/app/upgrades" | ||
) | ||
|
||
const UpgradeName = "vx" | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//go:build ignore | ||
|
||
package vx_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" | ||
v020 "github.com/lavanet/lava/x/spec/migrations/v0.2.0" | ||
"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") | ||
} | ||
|
||
func (suite *UpgradeTestSuite) TestAddingBlockLastUpdated() { | ||
_, keepers, ctx := keepertest.InitAllKeepers(suite.T()) | ||
sdkctx := sdk.UnwrapSDKContext(ctx) | ||
suite.T().Log("TestAddingBlockLastUpdated") | ||
|
||
migrator := v020.NewMigrator(keepers.Spec) | ||
migrator.MigrateToV020(sdkctx) | ||
|
||
allSpec := keepers.Spec.GetAllSpec(sdk.UnwrapSDKContext(ctx)) | ||
for _, spec := range allSpec { | ||
suite.Require().Equal(0, spec.BlockLastUpdated) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package vx | ||
|
||
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" | ||
v020 "github.com/lavanet/lava/x/spec/migrations/v0.2.0" | ||
) | ||
|
||
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 := v020.NewMigrator(keepers.SpecKeeper) | ||
migrator.MigrateToV020(ctx) | ||
|
||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.