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

Migrate 0.7.2 to cosmos-sdk goz-phase-3 #132

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 11 additions & 16 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,8 @@ import (
"os"
"path/filepath"

"github.com/spf13/viper"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -42,6 +33,12 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/cosmwasm/wasmd/x/wasm"
)
Expand Down Expand Up @@ -155,9 +152,7 @@ func NewWasmApp(
baseAppOptions ...func(*baseapp.BaseApp),
) *WasmApp {

// TODO: Remove cdc in favor of appCodec once all modules are migrated.
cdc := codecstd.MakeCodec(ModuleBasics)
appCodec := codecstd.NewAppCodec(cdc)
appCodec, cdc := MakeCodecs()

bApp := baseapp.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
Expand Down Expand Up @@ -262,12 +257,12 @@ func NewWasmApp(

// Create IBC Keeper
app.ibcKeeper = ibc.NewKeeper(
app.cdc, keys[ibc.StoreKey], app.stakingKeeper, scopedIBCKeeper,
app.cdc, appCodec, keys[ibc.StoreKey], app.stakingKeeper, scopedIBCKeeper,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting confused.

Why does this need both *std.Codec and *codec.Codec and what are these for?

(Not your issue, but if you can give me a 1 paragraph issue, I would be grateful)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not looked into details but migration to protobuf is not done for this module

)

// Create Transfer Keepers
app.transferKeeper = transfer.NewKeeper(
app.cdc, keys[transfer.StoreKey],
appCodec, keys[transfer.StoreKey],
app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper,
app.accountKeeper, app.bankKeeper,
scopedTransferKeeper,
Expand Down Expand Up @@ -295,7 +290,7 @@ func NewWasmApp(
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
auth.NewAppModule(appCodec, app.accountKeeper),
bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper),
capability.NewAppModule(*app.capabilityKeeper),
capability.NewAppModule(appCodec, *app.capabilityKeeper),
crisis.NewAppModule(&app.crisisKeeper),
gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper),
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper),
Expand All @@ -304,7 +299,7 @@ func NewWasmApp(
staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper),
upgrade.NewAppModule(app.upgradeKeeper),
wasm.NewAppModule(app.wasmKeeper),
evidence.NewAppModule(appCodec, app.evidenceKeeper),
evidence.NewAppModule(app.evidenceKeeper),
ibc.NewAppModule(app.ibcKeeper),
params.NewAppModule(app.paramsKeeper),
transferModule,
Expand Down
3 changes: 1 addition & 2 deletions app/benchmarks/txsize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/tendermint/tendermint/crypto/secp256k1"

codecstd "github.com/cosmos/cosmos-sdk/codec/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
Expand All @@ -17,7 +16,7 @@ import (
// This is due to secp256k1 signatures not being constant size.
// nolint: vet
func ExampleTxSendSize() {
cdc := codecstd.MakeCodec(app.ModuleBasics)
_, cdc := app.MakeCodecs()

var gas uint64 = 1

Expand Down
17 changes: 17 additions & 0 deletions app/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package app

import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func MakeCodecs() (*std.Codec, *codec.Codec) {
ethanfrey marked this conversation as resolved.
Show resolved Hide resolved
cdc := std.MakeCodec(ModuleBasics)
interfaceRegistry := codectypes.NewInterfaceRegistry()
sdk.RegisterInterfaces(interfaceRegistry)
ModuleBasics.RegisterInterfaceModules(interfaceRegistry)
appCodec := std.NewAppCodec(cdc, interfaceRegistry)
return appCodec, cdc
}
4 changes: 2 additions & 2 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package app
import (
"encoding/json"

codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/std"
)

// GenesisState defines a type alias for the Gaia genesis application state.
type GenesisState map[string]json.RawMessage

// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState() GenesisState {
cdc := codecstd.MakeCodec(ModuleBasics)
cdc := std.MakeCodec(ModuleBasics)
return ModuleBasics.DefaultGenesis(cdc)
}
Loading