-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new upgrde plan * write upgrade test * fix proto breaking
- Loading branch information
Showing
11 changed files
with
130 additions
and
18 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
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,29 @@ | ||
package v4patch1 | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
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/CoreumFoundation/coreum/v4/app/upgrade" | ||
) | ||
|
||
// Name defines the upgrade name. | ||
const ( | ||
Name = "v4patch1" | ||
) | ||
|
||
// New makes an upgrade handler for v4patch1 upgrade. | ||
func New(name string, mm *module.Manager, configurator module.Configurator, | ||
) upgrade.Upgrade { | ||
return upgrade.Upgrade{ | ||
Name: name, | ||
StoreUpgrades: store.StoreUpgrades{ | ||
Added: []string{}, | ||
}, | ||
Upgrade: func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//go:build integrationtests | ||
|
||
package upgrade | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice" | ||
"github.com/stretchr/testify/require" | ||
|
||
integrationtests "github.com/CoreumFoundation/coreum/v4/integration-tests" | ||
) | ||
|
||
type wasmdUpgradeTest struct { | ||
} | ||
|
||
func (wut *wasmdUpgradeTest) Before(t *testing.T) { | ||
assertDependencyVersion( | ||
t, | ||
"github.com/CosmWasm/wasmd", | ||
"v0.45.", | ||
) | ||
assertDependencyVersion( | ||
t, | ||
"github.com/CosmWasm/wasmvm", | ||
"v1.5.2", | ||
) | ||
} | ||
|
||
func (wut *wasmdUpgradeTest) After(t *testing.T) { | ||
assertDependencyVersion( | ||
t, | ||
"github.com/CosmWasm/wasmd", | ||
"v0.46.0", | ||
) | ||
assertDependencyVersion( | ||
t, | ||
"github.com/CosmWasm/wasmvm", | ||
"v1.5.4", | ||
) | ||
} | ||
|
||
func assertDependencyVersion( | ||
t *testing.T, | ||
depName string, | ||
versionPrefix string, | ||
) { | ||
ctx, chain := integrationtests.NewCoreumTestingContext(t) | ||
requireT := require.New(t) | ||
cmtClient := tmservice.NewServiceClient(chain.ClientContext) | ||
nodeInfo, err := cmtClient.GetNodeInfo(ctx, &tmservice.GetNodeInfoRequest{}) | ||
requireT.NoError(err) | ||
for _, dep := range nodeInfo.ApplicationVersion.BuildDeps { | ||
if dep.Path == depName { | ||
t.Logf("dep %s. version:%s. expected version:%s", dep.Path, dep.Version, versionPrefix) | ||
requireT.True(strings.HasPrefix(dep.Version, versionPrefix)) | ||
return | ||
} | ||
} | ||
requireT.Failf("dependency %s not found", depName) | ||
} |