Skip to content

Commit

Permalink
chore: pfm bump (#980)
Browse files Browse the repository at this point in the history
* chore: pgf bump

* add testnet upgrade handler
  • Loading branch information
dimiandre authored Mar 9, 2024
1 parent 8e07fb4 commit e98863b
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 8 deletions.
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import (
testnetV18alpha3 "github.com/CosmosContracts/juno/v21/app/upgrades/testnet/v18.0.0-alpha.3"
testnetV18alpha4 "github.com/CosmosContracts/juno/v21/app/upgrades/testnet/v18.0.0-alpha.4"
testnetV19alpha3 "github.com/CosmosContracts/juno/v21/app/upgrades/testnet/v19.0.0-alpha.3"
testnetV21alpha1 "github.com/CosmosContracts/juno/v21/app/upgrades/testnet/v21.0.0-alpha.1"
v10 "github.com/CosmosContracts/juno/v21/app/upgrades/v10"
v11 "github.com/CosmosContracts/juno/v21/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v21/app/upgrades/v12"
Expand Down Expand Up @@ -109,7 +110,8 @@ var (
testnetV18alpha3.Upgrade,
testnetV18alpha4.Upgrade,
testnetV19alpha3.Upgrade,

testnetV21alpha1.Upgrade,

Check failure on line 114 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)

Check failure on line 114 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)
v10.Upgrade,
v11.Upgrade,
v12.Upgrade,
Expand Down
5 changes: 3 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,15 @@ func NewAppKeepers(
// Initialize packet forward middleware router
appKeepers.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
appCodec, appKeepers.keys[packetforwardtypes.StoreKey],
appKeepers.GetSubspace(packetforwardtypes.ModuleName),
appKeepers.TransferKeeper, // Will be zero-value here. Reference is set later on with SetTransferKeeper.
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.DistrKeeper,
appKeepers.BankKeeper,
appKeepers.HooksICS4Wrapper,
govModAddress,
)


Check failure on line 412 in app/keepers/keepers.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)

Check failure on line 412 in app/keepers/keepers.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)
// Create Transfer Keepers
appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -748,7 +749,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icqtypes.ModuleName)
paramsKeeper.Subspace(packetforwardtypes.ModuleName)
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(feesharetypes.ModuleName)
Expand Down
2 changes: 1 addition & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func appModules(
// IBC modules
ibc_hooks.NewAppModule(app.AppKeepers.AccountKeeper),
icq.NewAppModule(app.AppKeepers.ICQKeeper),
packetforward.NewAppModule(app.AppKeepers.PacketForwardKeeper),
packetforward.NewAppModule(app.AppKeepers.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
wasmlc.NewAppModule(app.AppKeepers.WasmClientKeeper),
}
}
Expand Down
45 changes: 45 additions & 0 deletions app/upgrades/testnet/v21.0.0-alpha.1/constants.go
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,

Check warning on line 27 in app/upgrades/testnet/v21.0.0-alpha.1/constants.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'k' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 27 in app/upgrades/testnet/v21.0.0-alpha.1/constants.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'k' seems to be unused, consider removing or renaming it as _ (revive)
) 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
}
}
40 changes: 40 additions & 0 deletions app/upgrades/testnet/v21.0.0-alpha.1/upgrade_test.go
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) {
}
4 changes: 1 addition & 3 deletions app/upgrades/v21/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ const UpgradeName = "v21"
var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateV21UpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
},
StoreUpgrades: store.StoreUpgrades{},

Check failure on line 15 in app/upgrades/v21/constants.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)

Check failure on line 15 in app/upgrades/v21/constants.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s blank -s dot -s prefix(github.com/cometbft/cometbft) -s prefix(github.com/cosmos) -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) -s prefix(github.com/CosmosContracts/juno) --custom-order (gci)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-sdk v0.47.6
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79
// https://github.com/cosmos/ibc-go/releases/tag/modules%2Flight-clients%2F08-wasm%2Fv0.1.0%2Bibc-go-v7.3-wasmvm-v1.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1 h1:8mK4Ha/56P6jkRcLhIYhg/ipWhEuXBtj5O4I6fAi6vg=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.1/go.mod h1:GGUJN4LnB3J1Luu4kxTklQLbW69So3QXUndSalB003s=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b h1:VwhHRRIPdMshBMb2TP7xrkY4Ee8CJWsHZvucYeJ56no=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240228213828-cce7f56d000b/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s=
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 h1:mMHedP3Q+mz5gpOWNz0P+X8hxPdamylrBKc/P2cFakA=
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0/go.mod h1:/P6l2bWo2AR3rrsfs0DHuFZO3Imzb93sxFD3ihrIgw4=
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79 h1:pCxyhIxgWTabAQC5UerkITraHG3SwajdLKKMCFDWCv4=
Expand Down

0 comments on commit e98863b

Please sign in to comment.