-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package v23 | ||
|
||
import ( | ||
"fmt" | ||
|
||
Check failure on line 5 in app/upgrades/testnet/v23.0.0-alpha.1/constants.go GitHub Actions / lint
|
||
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" | ||
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" | ||
Check failure on line 10 in app/upgrades/testnet/v23.0.0-alpha.1/constants.go GitHub Actions / lint
|
||
|
||
"github.com/CosmosContracts/juno/v23/app/keepers" | ||
"github.com/CosmosContracts/juno/v23/app/upgrades" | ||
) | ||
|
||
// UpgradeName defines the on-chain upgrade name for the upgrade. | ||
const UpgradeName = "v2300alpha1" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: v2300Alpha1UpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{ | ||
Check failure on line 22 in app/upgrades/testnet/v23.0.0-alpha.1/constants.go GitHub Actions / lint
|
||
Added: []string{ | ||
// updated modules | ||
icqtypes.ModuleName, | ||
}, | ||
}, | ||
} | ||
|
||
func v2300Alpha1UpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
_ *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 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package v23_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/CosmosContracts/juno/v23/app/apptesting" | ||
v23alpha1 "github.com/CosmosContracts/juno/v23/app/upgrades/testnet/v22.0.0-alpha.1" | ||
) | ||
|
||
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(v23alpha1.UpgradeName, upgradeHeight) | ||
|
||
postUpgradeChecks(s) | ||
} | ||
|
||
func preUpgradeChecks(_ *UpgradeTestSuite) { | ||
} | ||
|
||
func postUpgradeChecks(_ *UpgradeTestSuite) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package v23 | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
Check failure on line 4 in app/upgrades/v23/constants.go GitHub Actions / lint
|
||
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" | ||
|
||
Check failure on line 6 in app/upgrades/v23/constants.go GitHub Actions / lint
|
||
"github.com/CosmosContracts/juno/v23/app/upgrades" | ||
) | ||
|
||
// UpgradeName defines the on-chain upgrade name for the upgrade. | ||
const UpgradeName = "v23" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateV23UpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{ | ||
Check failure on line 16 in app/upgrades/v23/constants.go GitHub Actions / lint
|
||
Added: []string{ | ||
// updated modules | ||
icqtypes.ModuleName, | ||
}, | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package v23_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/CosmosContracts/juno/v23/app/apptesting" | ||
v23 "github.com/CosmosContracts/juno/v23/app/upgrades/v23" | ||
) | ||
|
||
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(v23.UpgradeName, upgradeHeight) | ||
|
||
postUpgradeChecks(s) | ||
} | ||
|
||
func preUpgradeChecks(_ *UpgradeTestSuite) { | ||
} | ||
|
||
func postUpgradeChecks(_ *UpgradeTestSuite) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package v23 | ||
|
||
import ( | ||
"fmt" | ||
|
||
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/v23/app/keepers" | ||
"github.com/CosmosContracts/juno/v23/app/upgrades" | ||
) | ||
|
||
func CreateV23UpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
_ *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 | ||
} | ||
} |