-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
88 additions
and
1 deletion.
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,45 @@ | ||
package v21 | ||
|
||
import ( | ||
"fmt" | ||
|
||
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/CosmosContracts/juno/v21/app/keepers" | ||
"github.com/CosmosContracts/juno/v21/app/upgrades" | ||
) | ||
|
||
// UpgradeName defines the on-chain upgrade name for the upgrade. | ||
const UpgradeName = "v2100alpha1" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: v2100Alpha1UpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{}, | ||
} | ||
|
||
func v2100Alpha1UpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
k *keepers.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
logger := ctx.Logger().With("upgrade", UpgradeName) | ||
|
||
nativeDenom := upgrades.GetChainsDenomToken(ctx.ChainID()) | ||
logger.Info(fmt.Sprintf("With native denom %s", nativeDenom)) | ||
|
||
// Run migrations | ||
logger.Info(fmt.Sprintf("pre migrate version map: %v", vm)) | ||
versionMap, err := mm.RunMigrations(ctx, cfg, vm) | ||
if err != nil { | ||
return nil, err | ||
} | ||
logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) | ||
|
||
return versionMap, err | ||
} | ||
} |
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,40 @@ | ||
package v21_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/CosmosContracts/juno/v21/app/apptesting" | ||
v19alpha3 "github.com/CosmosContracts/juno/v21/app/upgrades/testnet/v19.0.0-alpha.3" | ||
) | ||
|
||
type UpgradeTestSuite struct { | ||
apptesting.KeeperTestHelper | ||
} | ||
|
||
func (s *UpgradeTestSuite) SetupTest() { | ||
s.Setup() | ||
} | ||
|
||
func TestKeeperTestSuite(t *testing.T) { | ||
suite.Run(t, new(UpgradeTestSuite)) | ||
} | ||
|
||
// Ensures the test does not error out. | ||
func (s *UpgradeTestSuite) TestUpgrade() { | ||
s.Setup() | ||
|
||
preUpgradeChecks(s) | ||
|
||
upgradeHeight := int64(5) | ||
s.ConfirmUpgradeSucceeded(v19alpha3.UpgradeName, upgradeHeight) | ||
|
||
postUpgradeChecks(s) | ||
} | ||
|
||
func preUpgradeChecks(_ *UpgradeTestSuite) { | ||
} | ||
|
||
func postUpgradeChecks(_ *UpgradeTestSuite) { | ||
} |