Skip to content

Commit

Permalink
Merge pull request #922 from comdex-official/ics-mainnet
Browse files Browse the repository at this point in the history
Ics mainnet
  • Loading branch information
dheerajkd30 authored Nov 8, 2024
2 parents 77064d0 + d0b5274 commit 0371a61
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 130 deletions.
14 changes: 7 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ import (
ccvgov "github.com/cosmos/interchain-security/v4/x/ccv/democracy/governance"
ccvstaking "github.com/cosmos/interchain-security/v4/x/ccv/democracy/staking"

tv15 "github.com/comdex-official/comdex/app/upgrades/testnet/v15"
mv15 "github.com/comdex-official/comdex/app/upgrades/mainnet/v15"
)

const (
Expand Down Expand Up @@ -695,6 +695,7 @@ func New(
scopedICAHostKeeper,
app.MsgServiceRouter(),
)
app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter())

app.AssetKeeper = assetkeeper.NewKeeper(
app.cdc,
Expand Down Expand Up @@ -939,13 +940,12 @@ func New(
icqKeeper := icqkeeper.NewKeeper(
appCodec,
app.keys[icqtypes.StoreKey],
app.GetSubspace(icqtypes.ModuleName),
app.IbcKeeper.ChannelKeeper, // may be replaced with middleware
app.IbcKeeper.ChannelKeeper,
&app.IbcKeeper.PortKeeper,
scopedICQKeeper,
app.GRPCQueryRouter(),
// NewQuerierWrapper(baseApp), // in-case of strangelove-ventures icq
govModAddress,
)
app.ICQKeeper = &icqKeeper

Expand Down Expand Up @@ -1106,7 +1106,7 @@ func New(
liquidationsV2.NewAppModule(app.cdc, app.NewliqKeeper, app.AccountKeeper, app.BankKeeper),
auctionsV2.NewAppModule(app.cdc, app.NewaucKeeper, app.BankKeeper),
ibchooks.NewAppModule(app.AccountKeeper),
icq.NewAppModule(*app.ICQKeeper),
icq.NewAppModule(*app.ICQKeeper, app.GetSubspace(icqtypes.ModuleName)),
packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
auctionmoduleskip.NewAppModule(app.cdc, app.AuctionKeeperSkip),
consumerModule,
Expand Down Expand Up @@ -1606,8 +1606,8 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {

func (a *App) registerUpgradeHandlers(appOptions servertypes.AppOptions) {
a.UpgradeKeeper.SetUpgradeHandler(
tv15.UpgradeName,
tv15.CreateUpgradeHandler(a.mm,
mv15.UpgradeName,
mv15.CreateUpgradeHandler(a.mm,
a.configurator,
a.cdc, appOptions,
*a.IbcKeeper,
Expand Down Expand Up @@ -1635,7 +1635,7 @@ func (a *App) registerUpgradeHandlers(appOptions servertypes.AppOptions) {
func upgradeHandlers(upgradeInfo upgradetypes.Plan, a *App, storeUpgrades *storetypes.StoreUpgrades) *storetypes.StoreUpgrades {
switch {

case upgradeInfo.Name == tv15.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
case upgradeInfo.Name == mv15.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{
ccvconsumertypes.StoreKey,
Expand Down
15 changes: 15 additions & 0 deletions app/upgrades/mainnet/v15/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v15

const (
UpgradeName = "v15.2.0"
UpgradeHeight = ""
UpgradeInfo = `'{
"binaries": {
"darwin/arm64":"",
"darwin/x86_64":"",
"linux/arm64":"",
"linux/x86_64":"",
"windows/x86_64":""
}
}'`
)
58 changes: 58 additions & 0 deletions app/upgrades/mainnet/v15/upgrades.go
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 main-net 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 = "cosmos1ap0mh6xzfn8943urr84q6ae7zfnar48am2erhd"
consumerGenesis.Params.ConsumerRedistributionFraction = "0.70"
consumerKeeper.InitGenesis(ctx, &consumerGenesis)
consumerKeeper.SetDistributionTransmissionChannel(ctx, "channel-37")

return fromVM, nil
}
}
77 changes: 38 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ require (
cosmossdk.io/api v0.3.1
cosmossdk.io/errors v1.0.1
cosmossdk.io/math v1.3.0
github.com/CosmWasm/wasmd v0.45.0
github.com/CosmWasm/wasmvm v1.5.2
github.com/CosmWasm/wasmd v0.46.0
github.com/CosmWasm/wasmvm v1.5.5
github.com/bandprotocol/bandchain-packet v0.0.3
github.com/cometbft/cometbft v0.37.6
github.com/cometbft/cometbft v0.37.8
github.com/cometbft/cometbft-db v0.11.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.47.11
github.com/cosmos/cosmos-sdk v0.47.13
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20231017170841-8fd49ec0f017
github.com/cosmos/interchain-security/v4 v4.2.0
github.com/cosmos/interchain-security/v4 v4.5.0
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.16.0
github.com/skip-mev/block-sdk v1.4.3
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)

require (
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3
github.com/cosmos/ibc-go/v7 v7.4.0
github.com/cosmos/ibc-go/v7 v7.8.0
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/golangci/golangci-lint v1.56.2
github.com/rakyll/statik v0.1.7
Expand All @@ -45,11 +45,10 @@ require (
require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
4d63.com/gochecknoglobals v0.2.1 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
cloud.google.com/go/storage v1.38.0 // indirect
cosmossdk.io/core v0.6.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/log v1.3.1 // indirect
Expand Down Expand Up @@ -92,7 +91,7 @@ require (
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
Expand Down Expand Up @@ -155,7 +154,7 @@ require (
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/glog v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
Expand All @@ -175,7 +174,7 @@ require (
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/gordonklaus/ineffassign v0.1.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
Expand All @@ -188,11 +187,12 @@ require (
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.4 // indirect
github.com/hashicorp/go-getter v1.7.5 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
Expand All @@ -210,7 +210,7 @@ require (
github.com/kisielk/errcheck v1.7.0 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kulti/thelper v0.6.3 // indirect
Expand Down Expand Up @@ -248,7 +248,7 @@ require (
github.com/nunnatsa/ginkgolinter v0.15.2 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/polyfloyd/go-errorlint v1.4.8 // indirect
Expand Down Expand Up @@ -282,7 +282,7 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
Expand Down Expand Up @@ -312,30 +312,29 @@ require (
go-simpler.org/sloglint v0.4.0 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/api v0.162.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/api v0.171.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.4.6 // indirect
Expand Down
Loading

0 comments on commit 0371a61

Please sign in to comment.