-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #897 from comdex-official/feature/dev
Comdex ICS changes
- Loading branch information
Showing
17 changed files
with
1,375 additions
and
157 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 @@ | ||
package app | ||
|
||
import ( | ||
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" | ||
) | ||
|
||
// This is used for non-legacy gov transactions | ||
// Returning true cause all txs are whitelisted | ||
func IsModuleWhiteList(typeUrl string) bool { | ||
return true | ||
} | ||
|
||
// This is used for legacy gov transactions | ||
// Returning true cause all txs are whitelisted | ||
func IsProposalWhitelisted(content govv1beta1.Content) bool { | ||
return true | ||
} |
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,15 @@ | ||
package v15 | ||
|
||
const ( | ||
UpgradeName = "v15.0.0" | ||
UpgradeHeight = "" | ||
UpgradeInfo = `'{ | ||
"binaries": { | ||
"darwin/arm64":"", | ||
"darwin/x86_64":"", | ||
"linux/arm64":"", | ||
"linux/x86_64":"", | ||
"windows/x86_64":"" | ||
} | ||
}'` | ||
) |
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,58 @@ | ||
package v15 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
servertypes "github.com/cosmos/cosmos-sdk/server/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" | ||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
ibcconnectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" | ||
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" | ||
ccvconsumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper" | ||
consumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types" | ||
"github.com/spf13/cast" | ||
) | ||
|
||
// CreateUpgradeHandler creates an SDK upgrade handler for v15 | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
cdc codec.Codec, | ||
appOpts servertypes.AppOptions, | ||
ibcKeeper ibckeeper.Keeper, | ||
consumerKeeper *ccvconsumerkeeper.Keeper, | ||
stakingKeeper stakingkeeper.Keeper, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
ctx.Logger().Info("Starting upgrade testnet v15...") | ||
ibcKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) | ||
|
||
fromVM := make(map[string]uint64) | ||
|
||
nodeHome := cast.ToString(appOpts.Get(flags.FlagHome)) | ||
consumerUpgradeGenFile := nodeHome + "/config/ccv.json" | ||
appState, _, err := genutiltypes.GenesisStateFromGenFile(consumerUpgradeGenFile) | ||
if err != nil { | ||
return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err) | ||
} | ||
|
||
var consumerGenesis = consumertypes.GenesisState{} | ||
cdc.MustUnmarshalJSON(appState[consumertypes.ModuleName], &consumerGenesis) | ||
|
||
consumerGenesis.PreCCV = true | ||
consumerGenesis.Params.SoftOptOutThreshold = "0.05" | ||
consumerGenesis.Params.RewardDenoms = []string{"ucmdx"} | ||
consumerGenesis.Params.Enabled = true | ||
consumerGenesis.Params.ProviderFeePoolAddrStr = "" // replace with provider address | ||
consumerGenesis.Params.ConsumerRedistributionFraction = "0.70" | ||
consumerKeeper.InitGenesis(ctx, &consumerGenesis) | ||
consumerKeeper.SetDistributionTransmissionChannel(ctx, "channel-2") // replace with correct channel | ||
|
||
return fromVM, nil | ||
} | ||
} |
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
Oops, something went wrong.