Skip to content

Commit

Permalink
1.2.0 Upgrade Handlers & Info (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell authored Mar 11, 2023
2 parents 660a003 + f5239b1 commit be7f28a
Show file tree
Hide file tree
Showing 19 changed files with 246 additions and 82 deletions.
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/alpha13"
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/async"
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/beta6"
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/beta7"
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/fixstrays"
"github.com/jackalLabs/canine-chain/app/upgrades/testnet/killdeals"
paramUpgrade "github.com/jackalLabs/canine-chain/app/upgrades/testnet/params"
Expand Down Expand Up @@ -397,6 +398,7 @@ func NewJackalApp(
oraclemoduletypes.MemStoreKey,
storagemoduletypes.MemStoreKey,
rnsmoduletypes.MemStoreKey,
notificationsmoduletypes.MemStoreKey,
// filetreemoduletypes.MemStoreKey, minttypes.MemStoreKey
)

Expand Down Expand Up @@ -1141,6 +1143,7 @@ func (app *JackalApp) registerTestnetUpgradeHandlers() {
app.registerUpgrade(async.NewUpgrade(app.mm, app.configurator, app.StorageKeeper))
app.registerUpgrade(paramUpgrade.NewUpgrade(app.mm, app.configurator, app.StorageKeeper))
app.registerUpgrade(beta6.NewUpgrade(app.mm, app.configurator, app.StorageKeeper))
app.registerUpgrade(beta7.NewUpgrade(app.mm, app.configurator, app.NotificationsKeeper))
}

func (app *JackalApp) registerMainnetUpgradeHandlers() {
Expand Down Expand Up @@ -1207,6 +1210,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(oraclemoduletypes.ModuleName)
paramsKeeper.Subspace(storagemoduletypes.ModuleName)
paramsKeeper.Subspace(filetreemoduletypes.ModuleName)
paramsKeeper.Subspace(notificationsmoduletypes.ModuleName)

return paramsKeeper
}
Expand Down
3 changes: 3 additions & 0 deletions app/upgrades/bouncybulldog/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/jackalLabs/canine-chain/app/upgrades"
"github.com/jackalLabs/canine-chain/types"
filetreemoduletypes "github.com/jackalLabs/canine-chain/x/filetree/types"
notificationsmoduletypes "github.com/jackalLabs/canine-chain/x/notifications/types"
oraclekeeper "github.com/jackalLabs/canine-chain/x/oracle/keeper"
oraclemoduletypes "github.com/jackalLabs/canine-chain/x/oracle/types"
storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types"
Expand Down Expand Up @@ -48,6 +49,7 @@ func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
fromVM[storagemoduletypes.ModuleName] = 1
fromVM[filetreemoduletypes.ModuleName] = 1
fromVM[oraclemoduletypes.ModuleName] = 1
fromVM[notificationsmoduletypes.ModuleName] = 1

newVM, err := u.mm.RunMigrations(ctx, u.configurator, fromVM)
if err != nil {
Expand All @@ -65,6 +67,7 @@ func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades {
storagemoduletypes.StoreKey,
filetreemoduletypes.StoreKey,
oraclemoduletypes.StoreKey,
notificationsmoduletypes.StoreKey,
},
}
}
64 changes: 64 additions & 0 deletions app/upgrades/testnet/beta7/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package beta7

import (
storetypes "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/jackalLabs/canine-chain/app/upgrades"
"github.com/jackalLabs/canine-chain/types"
notificationkeeper "github.com/jackalLabs/canine-chain/x/notifications/keeper"
notificationtypes "github.com/jackalLabs/canine-chain/x/notifications/types"
rnstypes "github.com/jackalLabs/canine-chain/x/rns/types"
)

var _ upgrades.Upgrade = &Upgrade{}

// Upgrade represents the v4 upgrade
type Upgrade struct {
mm *module.Manager
configurator module.Configurator
notificationKeeper notificationkeeper.Keeper
}

// NewUpgrade returns a new Upgrade instance
func NewUpgrade(mm *module.Manager, configurator module.Configurator, notificationKeeper notificationkeeper.Keeper) *Upgrade {
return &Upgrade{
mm: mm,
configurator: configurator,
notificationKeeper: notificationKeeper,
}
}

// Name implements upgrades.Upgrade
func (u *Upgrade) Name() string {
return "beta7"
}

// Handler implements upgrades.Upgrade
func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
if types.IsTestnet(ctx.ChainID()) || ctx.ChainID() == "test" {

fromVM[notificationtypes.ModuleName] = 1
fromVM[rnstypes.ModuleName] = 2

newVM, err := u.mm.RunMigrations(ctx, u.configurator, fromVM)
if err != nil {
return newVM, err
}

return newVM, err
}
return fromVM, nil
}
}

// StoreUpgrades implements upgrades.Upgrade
func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades {
return &storetypes.StoreUpgrades{
Added: []string{
notificationtypes.StoreKey,
},
}
}
30 changes: 10 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ go 1.20

require (
github.com/CosmWasm/wasmd v0.29.2
github.com/cosmos/cosmos-sdk v0.45.14
github.com/cosmos/cosmos-sdk v0.45.11
github.com/cosmos/ibc-go/v3 v3.4.0
github.com/cosmos/interchain-accounts v0.1.0
github.com/ecies/go/v2 v2.0.5
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/prometheus/client_golang v1.14.0
Expand All @@ -20,20 +20,20 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tendermint/tendermint v0.34.26
github.com/tendermint/tendermint v0.34.24
github.com/tendermint/tm-db v0.6.7
github.com/wealdtech/go-merkletree v1.0.0
github.com/zondax/hid v0.9.1 // indirect
google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f
google.golang.org/grpc v1.53.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/CosmWasm/wasmvm v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
github.com/cosmos/gogoproto v1.4.6
github.com/cosmos/iavl v0.19.5 // indirect
github.com/cosmos/iavl v0.19.4 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
Expand All @@ -47,8 +47,8 @@ require (
)

require (
cosmossdk.io/api v0.2.6
cosmossdk.io/core v0.5.1
cosmossdk.io/api v0.2.4
cosmossdk.io/core v0.3.2
github.com/golang/mock v1.6.0
)

Expand All @@ -58,22 +58,16 @@ require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/btcsuite/btcd v0.22.2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
Expand All @@ -87,7 +81,6 @@ require (
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
github.com/ethereum/go-ethereum v1.11.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
Expand All @@ -112,11 +105,8 @@ require (
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.7.10 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand All @@ -132,14 +122,14 @@ require (
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rs/zerolog v1.27.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.5.0 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.6.0 // indirect
Expand Down
Loading

0 comments on commit be7f28a

Please sign in to comment.