Merge pull request #6085: Move codec/std to std

This commit is contained in:
Aaron Craelius
2020-04-27 15:40:50 -04:00
committed by GitHub
parent 9b51908597
commit cc90f2e002
39 changed files with 233 additions and 234 deletions
+2 -3
View File
@@ -11,7 +11,6 @@ import (
"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/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
@@ -141,8 +140,8 @@ func NewSimApp(
) *SimApp {
// TODO: Remove cdc in favor of appCodec once all modules are migrated.
cdc := codecstd.MakeCodec(ModuleBasics)
appCodec := codecstd.NewAppCodec(cdc)
cdc := std.MakeCodec(ModuleBasics)
appCodec := std.NewAppCodec(cdc)
bApp := baseapp.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
+4 -3
View File
@@ -5,6 +5,8 @@ import (
"os"
"path"
"github.com/cosmos/cosmos-sdk/std"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/go-amino"
@@ -15,7 +17,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/client/rpc"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
@@ -25,8 +26,8 @@ import (
)
var (
cdc = codecstd.MakeCodec(simapp.ModuleBasics)
appCodec = codecstd.NewAppCodec(cdc)
cdc = std.MakeCodec(simapp.ModuleBasics)
appCodec = std.NewAppCodec(cdc)
)
func init() {
+3 -2
View File
@@ -5,6 +5,8 @@ import (
"errors"
"fmt"
"github.com/cosmos/cosmos-sdk/std"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@@ -12,7 +14,6 @@ import (
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/client/flags"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -32,7 +33,7 @@ const (
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
func AddGenesisAccountCmd(
ctx *server.Context, depCdc *amino.Codec, cdc *codecstd.Codec, defaultNodeHome, defaultClientHome string,
ctx *server.Context, depCdc *amino.Codec, cdc *std.Codec, defaultNodeHome, defaultClientHome string,
) *cobra.Command {
cmd := &cobra.Command{
+4 -3
View File
@@ -4,6 +4,8 @@ import (
"encoding/json"
"io"
"github.com/cosmos/cosmos-sdk/std"
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
@@ -15,7 +17,6 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
@@ -30,8 +31,8 @@ const flagInvCheckPeriod = "inv-check-period"
var invCheckPeriod uint
func main() {
cdc := codecstd.MakeCodec(simapp.ModuleBasics)
appCodec := codecstd.NewAppCodec(cdc)
cdc := std.MakeCodec(simapp.ModuleBasics)
appCodec := std.NewAppCodec(cdc)
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
+2 -2
View File
@@ -3,7 +3,7 @@ package simapp
import (
"encoding/json"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/std"
)
// The genesis state of the blockchain is represented here as a map of raw json
@@ -17,6 +17,6 @@ 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)
}
+3 -2
View File
@@ -4,16 +4,17 @@ import (
"fmt"
"testing"
"github.com/cosmos/cosmos-sdk/std"
"github.com/stretchr/testify/require"
tmkv "github.com/tendermint/tendermint/libs/kv"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
)
func TestGetSimulationLog(t *testing.T) {
cdc := codecstd.MakeCodec(ModuleBasics)
cdc := std.MakeCodec(ModuleBasics)
decoders := make(sdk.StoreDecoderRegistry)
decoders[auth.StoreKey] = func(kvAs, kvBs tmkv.Pair) string { return "10" }