Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prepare v11.15.0-rc0 #352

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ import (

"github.com/persistenceOne/persistenceCore/v11/app/keepers"
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
v11_14_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.14.0"
v11_15_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.15.0-rc0"
"github.com/persistenceOne/persistenceCore/v11/client/docs"
)

var (
DefaultNodeHome string
Upgrades = []upgrades.Upgrade{v11_14_0.Upgrade}
Upgrades = []upgrades.Upgrade{v11_15_0_rc0.Upgrade}
ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...)
)

Expand Down
38 changes: 20 additions & 18 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
Expand Down Expand Up @@ -340,10 +340,21 @@ func NewAppKeeper(
appKeepers.ScopedIBCKeeper,
)

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(appKeepers.keys[ibchookstypes.StoreKey])
appKeepers.IBCHooksKeeper = &hooksKeeper
wasmHooks := ibchooks.NewWasmHooks(&hooksKeeper, appKeepers.WasmKeeper, bech32Prefix)
appKeepers.ICS20WasmHooks = &wasmHooks
hooksICS4Wrapper := ibchooks.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.ICS20WasmHooks,
)
appKeepers.HooksICS4Wrapper = &hooksICS4Wrapper

ibcFeeKeeper := ibcfeekeeper.NewKeeper(
appCodec,
appKeepers.keys[ibcfeetypes.StoreKey],
appKeepers.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
appKeepers.HooksICS4Wrapper, // may be replaced with IBC middleware
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
Expand All @@ -358,7 +369,7 @@ func NewAppKeeper(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.DistributionKeeper,
appKeepers.BankKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCFeeKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

Expand Down Expand Up @@ -528,19 +539,8 @@ func NewAppKeeper(
wasmOpts...,
)
appKeepers.WasmKeeper = &wasmKeeper

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(appKeepers.keys[ibchookstypes.StoreKey])
appKeepers.IBCHooksKeeper = &hooksKeeper

wasmHooks := ibchooks.NewWasmHooks(&hooksKeeper, appKeepers.WasmKeeper, bech32Prefix)
appKeepers.ICS20WasmHooks = &wasmHooks

hooksICS4Wrapper := ibchooks.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.ICS20WasmHooks,
)
appKeepers.HooksICS4Wrapper = &hooksICS4Wrapper
// Set ics20 wasm hooks the initialised wasmkeeper
appKeepers.ICS20WasmHooks.ContractKeeper = appKeepers.WasmKeeper

builderKeeper := builderkeeper.NewKeeper(
appCodec,
Expand All @@ -557,16 +557,18 @@ func NewAppKeeper(
icaHostStack = icahost.NewIBCModule(*appKeepers.ICAHostKeeper)
icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, *appKeepers.IBCFeeKeeper)

//SendPacket --> Transfer -> PFM -> Fee -> ibcHooks -> IBC-Core (ICS4Wrappers)
//RecvPacket --> IBC-Core -> ibcHooks -> Fee -> PFM -> ibcHooker(persistence-sdk) -> Transfer (AddRoute)
var transferStack ibctypes.IBCModule = appKeepers.IBCTransferHooksMiddleware
transferStack = ibcfee.NewIBCMiddleware(transferStack, *appKeepers.IBCFeeKeeper)
transferStack = ibchooks.NewIBCMiddleware(transferStack, appKeepers.HooksICS4Wrapper)
transferStack = packetforward.NewIBCMiddleware(
transferStack,
appKeepers.PacketForwardKeeper,
0, // no retries on timeout
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
transferStack = ibcfee.NewIBCMiddleware(transferStack, *appKeepers.IBCFeeKeeper)
transferStack = ibchooks.NewIBCMiddleware(transferStack, appKeepers.HooksICS4Wrapper)

// Information will flow: ibc-port -> icaController -> lscosmos.
var icaControllerStack ibctypes.IBCModule = liquidStakeIBCModule
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/testnet/v11.14.0-rc0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This upgrade on testnet was skipped as nothing could be tested
18 changes: 18 additions & 0 deletions app/upgrades/testnet/v11.15.0-rc0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v11_15_0_rc0

import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v11.15.0-rc0"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}
51 changes: 51 additions & 0 deletions app/upgrades/testnet/v11.15.0-rc0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package v11_15_0_rc0

import (
"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
)

func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("running module migrations...")
err := MigrateVestingAccounts(ctx, args)
if err != nil {
return vm, err
}
return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm)
}
}

func MigrateVestingAccounts(ctx sdk.Context, args upgrades.UpgradeHandlerArgs) error {
accounts := args.Keepers.AccountKeeper.GetAllAccounts(ctx)
for _, account := range accounts {
switch account.(type) {
case *vestingtypes.PeriodicVestingAccount:
a, ok := account.(*vestingtypes.PeriodicVestingAccount)
if !ok {
return errors.Wrapf(sdkerrors.ErrInvalidType, "invalid account type: %T", account)
}
args.Keepers.AccountKeeper.SetAccount(ctx, a.BaseAccount)
case *vestingtypes.ContinuousVestingAccount:
a, ok := account.(*vestingtypes.ContinuousVestingAccount)
if !ok {
return errors.Wrapf(sdkerrors.ErrInvalidType, "invalid account type: %T", account)
}
args.Keepers.AccountKeeper.SetAccount(ctx, a.BaseAccount)
case *vestingtypes.DelayedVestingAccount:
a, ok := account.(*vestingtypes.DelayedVestingAccount)
if !ok {
return errors.Wrapf(sdkerrors.ErrInvalidType, "invalid account type: %T", account)
}
args.Keepers.AccountKeeper.SetAccount(ctx, a.BaseAccount)
default:
}
}
return nil
}
4 changes: 2 additions & 2 deletions interchaintest/chain_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const (
func TestPersistenceUpgradeBasic(t *testing.T) {
var (
chainName = "persistence"
initialVersion = "v11.13.0"
upgradeName = "v11.14.0"
initialVersion = "v11.13.0-rc0"
upgradeName = "v11.15.0-rc0"
upgradeRepo = PersistenceCoreImage.Repository
upgradeBranchVersion = PersistenceCoreImage.Version
)
Expand Down
Loading
Loading