Skip to content

Commit

Permalink
Storage Module Upgrade Part 1 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell authored Nov 16, 2022
2 parents 82c9f0b + b34d24f commit 2e71952
Show file tree
Hide file tree
Showing 176 changed files with 28,569 additions and 1,018 deletions.
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ SIMAPP = ./app

# for dockerized protobuf tools
DOCKER := $(shell which docker)
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
HTTPS_GIT := https://github.com/jackal-dao/canine.git
BUF_IMAGE=bufbuild/buf #@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
DOCKER_BUF := $(DOCKER) run --platform="linux/amd64" --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
HTTPS_GIT := https://github.com/jackalLabs/canine-chain.git

export GO111MODULE = on

Expand Down Expand Up @@ -59,7 +59,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=canine \
-X github.com/cosmos/cosmos-sdk/version.AppName=canined \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/jackal-dao/canine/app.Bech32Prefix=jkl \
-X github.com/jackalLabs/canine-chain/app.Bech32Prefix=jkl \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"

ifeq ($(WITH_CLEVELDB),yes)
Expand Down Expand Up @@ -161,7 +161,7 @@ lint: format-tools
format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/jackal-dao/canine
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/jackalLabs/canine-chain


###############################################################################
Expand All @@ -173,15 +173,14 @@ PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto
proto-all: proto-format proto-lint proto-gen format

proto-gen:

@echo "Generating Protobuf files"
$(DOCKER) run --platform="linux/amd64" --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh
./scripts/protocgen.sh

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
find ./ -name *.proto -exec clang-format -i {} \;

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To install `canined` on your Linux machine:
`go install ./...`

### Pre-built Binary
[Releases](https://github.com/JACKAL-DAO/canine-chain/releases) and download the latest release. Move the executable to a folder in your `$PATH` and download [this](https://github.com/CosmWasm/wasmvm/raw/v1.1.1/internal/api/libwasmvm.x86_64.so) to `/lib/libwasmvm.x86_64.so`
[Releases](https://github.com/jackalLabs/canine-chain-chain/releases) and download the latest release. Move the executable to a folder in your `$PATH` and download [this](https://github.com/CosmWasm/wasmvm/raw/v1.1.1/internal/api/libwasmvm.x86_64.so) to `/lib/libwasmvm.x86_64.so`

```sh
sudo wget https://github.com/CosmWasm/wasmvm/raw/v1.1.1/internal/api/libwasmvm.x86_64.so -O /lib/libwasmvm.x86_64.so
Expand All @@ -33,6 +33,8 @@ You may also need to run `sudo chmod +x canined` inside the executables director

## Version Map

When Syncing, you **MUST** use the flag `--unsafe-skip-upgrades 118040` after `canined start` or else you will crash at height 118040.

|block height|canined version|
|------------|---------------|
|45381 |1.1.2 |
Expand Down
81 changes: 58 additions & 23 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ import (
rnsmodulekeeper "github.com/jackalLabs/canine-chain/x/rns/keeper"
rnsmoduletypes "github.com/jackalLabs/canine-chain/x/rns/types"

storagemodule "github.com/jackalLabs/canine-chain/x/storage"
storagemodulekeeper "github.com/jackalLabs/canine-chain/x/storage/keeper"
storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types"

/*
storagemodule "github.com/jackalLabs/canine-chain/x/storage"
storagemodulekeeper "github.com/jackalLabs/canine-chain/x/storage/keeper"
storagemoduletypes "github.com/jackalLabs/canine-chain/x/storage/types"
dsigmodule "github.com/jackalLabs/canine-chain/x/dsig"
dsigmodulekeeper "github.com/jackalLabs/canine-chain/x/dsig/keeper"
Expand Down Expand Up @@ -238,8 +239,9 @@ var (
ica.AppModuleBasic{},
intertx.AppModuleBasic{},
rnsmodule.AppModuleBasic{},
storagemodule.AppModuleBasic{},

/*
storagemodule.AppModuleBasic{},
dsigmodule.AppModuleBasic{},
filetreemodule.AppModuleBasic{},
notificationsmodule.AppModuleBasic{},
Expand All @@ -258,8 +260,9 @@ var (
icatypes.ModuleName: nil,
wasm.ModuleName: {authtypes.Burner},
rnsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
storagemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},

/*
storagemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
dsigmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
*/
}
Expand Down Expand Up @@ -313,10 +316,10 @@ type JackalApp struct {
scopedTransferKeeper capabilitykeeper.ScopedKeeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper

RnsKeeper rnsmodulekeeper.Keeper
RnsKeeper rnsmodulekeeper.Keeper
StorageKeeper storagemodulekeeper.Keeper

/*
StorageKeeper storagemodulekeeper.Keeper
DsigKeeper dsigmodulekeeper.Keeper
FileTreeKeeper filetreemodulekeeper.Keeper
Expand Down Expand Up @@ -362,9 +365,9 @@ func NewJackalApp(
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, intertxtypes.StoreKey,
rnsmoduletypes.StoreKey,
rnsmoduletypes.StoreKey, storagemoduletypes.StoreKey,
/*
storagemoduletypes.StoreKey, dsigmoduletypes.StoreKey, filetreemoduletypes.StoreKey,
, dsigmoduletypes.StoreKey, filetreemoduletypes.StoreKey,
notificationsmoduletypes.StoreKey,
*/
)
Expand Down Expand Up @@ -450,6 +453,7 @@ func NewJackalApp(
authtypes.FeeCollectorName,
// storagemoduletypes.ModuleName,
)
mintModule := mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, app.BankKeeper)

app.distrKeeper = distrkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -600,15 +604,18 @@ func NewJackalApp(
)
rnsModule := rnsmodule.NewAppModule(appCodec, app.RnsKeeper, app.AccountKeeper, app.BankKeeper)

app.StorageKeeper = *storagemodulekeeper.NewKeeper(
appCodec,
keys[storagemoduletypes.StoreKey],
keys[storagemoduletypes.MemStoreKey],
app.getSubspace(storagemoduletypes.ModuleName),
app.BankKeeper,
app.AccountKeeper,
)
storageModule := storagemodule.NewAppModule(appCodec, app.StorageKeeper, app.AccountKeeper, app.BankKeeper)

/*
app.StorageKeeper = *storagemodulekeeper.NewKeeper(
appCodec,
keys[storagemoduletypes.StoreKey],
keys[storagemoduletypes.MemStoreKey],
app.getSubspace(storagemoduletypes.ModuleName),
app.BankKeeper,
)
storageModule := storagemodule.NewAppModule(appCodec, app.StorageKeeper, app.AccountKeeper, app.BankKeeper)
app.DsigKeeper = *dsigmodulekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -684,7 +691,7 @@ func NewJackalApp(
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
capability.NewAppModule(appCodec, *app.capabilityKeeper),
gov.NewAppModule(appCodec, app.govKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, app.BankKeeper),
mintModule,
slashing.NewAppModule(appCodec, app.slashingKeeper, app.AccountKeeper, app.BankKeeper, app.stakingKeeper),
distr.NewAppModule(appCodec, app.distrKeeper, app.AccountKeeper, app.BankKeeper, app.stakingKeeper),
staking.NewAppModule(appCodec, app.stakingKeeper, app.AccountKeeper, app.BankKeeper),
Expand All @@ -700,8 +707,8 @@ func NewJackalApp(
interTxModule,
crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them
rnsModule,
storageModule,
/*
storageModule,
dsigModule,
filetreeModule,
notificationsModule,
Expand Down Expand Up @@ -736,8 +743,8 @@ func NewJackalApp(
intertxtypes.ModuleName,
wasm.ModuleName,
rnsmoduletypes.ModuleName,
storagemoduletypes.ModuleName,
/*
storagemoduletypes.ModuleName,
dsigmoduletypes.ModuleName,
filetreemoduletypes.ModuleName,
notificationsmoduletypes.ModuleName,
Expand Down Expand Up @@ -768,8 +775,8 @@ func NewJackalApp(
intertxtypes.ModuleName,
wasm.ModuleName,
rnsmoduletypes.ModuleName,
storagemoduletypes.ModuleName,
/*
storagemoduletypes.ModuleName,
dsigmoduletypes.ModuleName,
filetreemoduletypes.ModuleName,
notificationsmoduletypes.ModuleName,
Expand Down Expand Up @@ -808,14 +815,42 @@ func NewJackalApp(
// wasm after ibc transfer
wasm.ModuleName,
rnsmoduletypes.ModuleName,
storagemoduletypes.ModuleName,
/*
storagemoduletypes.ModuleName,
dsigmoduletypes.ModuleName,
filetreemoduletypes.ModuleName,
notificationsmoduletypes.ModuleName,
*/
)

app.mm.SetOrderExportGenesis(
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
govtypes.ModuleName,
minttypes.ModuleName,
crisistypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
// additional non simd modules
ibctransfertypes.ModuleName,
ibchost.ModuleName,
icatypes.ModuleName,
intertxtypes.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
rnsmoduletypes.ModuleName,
storagemoduletypes.ModuleName,
)

// Uncomment if you want to set a custom migration order here.
// app.mm.SetOrderMigrations(custom order)

Expand Down Expand Up @@ -846,7 +881,7 @@ func NewJackalApp(
ibc.NewAppModule(app.ibcKeeper),
transferModule,
rnsModule,
// storageModule,
storageModule,
)

app.sm.RegisterStoreDecoders()
Expand Down
36 changes: 19 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,36 @@ go 1.19

require (
github.com/CosmWasm/wasmd v0.29.2
github.com/cosmos/cosmos-sdk v0.45.10
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/gogo/protobuf v1.3.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.13.0
github.com/prometheus/client_golang v1.14.0
github.com/rakyll/statik v0.1.7
github.com/rs/cors v1.8.2 // indirect
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.5.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tendermint/tendermint v0.34.22
github.com/tendermint/tendermint v0.34.23
github.com/tendermint/tm-db v0.6.7
github.com/wealdtech/go-merkletree v1.0.0
github.com/zondax/ledger-go v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a
google.golang.org/grpc v1.50.1
gopkg.in/yaml.v2 v2.4.0

)

require (
github.com/CosmWasm/wasmvm v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
github.com/cosmos/gogoproto v1.4.2
github.com/cosmos/gogoproto v1.4.3
github.com/cosmos/iavl v0.19.4 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
Expand All @@ -41,19 +44,19 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/zondax/ledger-go v0.12.2 // indirect
golang.org/x/exp v0.0.0-20221019170559-20944726eadf // indirect
)

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

require (
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
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/Workiva/go-datastructures v1.0.53 // indirect
Expand Down Expand Up @@ -99,8 +102,7 @@ require (
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
Expand All @@ -116,7 +118,7 @@ require (
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
Expand All @@ -130,12 +132,12 @@ require (
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20221017152216-f25eb7ecb193 // indirect
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
Expand All @@ -144,7 +146,7 @@ require (

replace (
// use cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

// dragonberry ics23 patch
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
Expand Down
Loading

0 comments on commit 2e71952

Please sign in to comment.