Merge PR #6595: Single Binary & Command Refactor

This commit is contained in:
Alexander Bezobchuk 2020-07-07 11:40:46 -04:00 committed by GitHub
parent ebf1583462
commit 8670a10564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 673 additions and 652 deletions

View File

@ -205,9 +205,9 @@ jobs:
.go .go
.mod .mod
.sum .sum
- name: build-sim - name: build-simd
run: | run: |
make build-sim make build-simd
if: "env.GIT_DIFF != ''" if: "env.GIT_DIFF != ''"
- name: cli-test - name: cli-test
run: | run: |

View File

@ -7,8 +7,8 @@
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd start # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd start
# #
# Client: (Note the simapp binary always looks at ~/.simapp we can bind to different local storage) # Client: (Note the simapp binary always looks at ~/.simapp we can bind to different local storage)
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simcli keys add foo # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys add foo
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simcli keys list # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys list
# TODO: demo connecting rest-server (or is this in server now?) # TODO: demo connecting rest-server (or is this in server now?)
FROM golang:alpine AS build-env FROM golang:alpine AS build-env
@ -24,7 +24,7 @@ COPY . .
# build Cosmos SDK, remove packages # build Cosmos SDK, remove packages
RUN make tools && \ RUN make tools && \
make build-sim && \ make build-simd && \
cp ./build/sim* /go/bin cp ./build/sim* /go/bin
# make build-sim-linux ?? # make build-sim-linux ??
@ -38,7 +38,6 @@ WORKDIR /root
# Copy over binaries from the build-env # Copy over binaries from the build-env
COPY --from=build-env /go/bin/simd /usr/bin/simd COPY --from=build-env /go/bin/simd /usr/bin/simd
COPY --from=build-env /go/bin/simcli /usr/bin/simcli
EXPOSE 26656 26657 1317 EXPOSE 26656 26657 1317

View File

@ -26,15 +26,14 @@ include contrib/devtools/Makefile
build: go.sum build: go.sum
go build -mod=readonly ./... go build -mod=readonly ./...
build-sim: go.sum build-simd: go.sum
mkdir -p $(BUILDDIR) mkdir -p $(BUILDDIR)
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./simapp/cmd/simd go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./simapp/simd
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./simapp/cmd/simcli
build-sim-linux: go.sum build-simd-linux: go.sum
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build-sim LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build-simd
.PHONY: build build-sim build-sim-linux .PHONY: build build-simd build-simd-linux
mocks: $(MOCKS_DIR) mocks: $(MOCKS_DIR)
mockgen -source=client/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go mockgen -source=client/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
@ -129,7 +128,7 @@ test-unit:
test-race: test-race:
@VERSION=$(VERSION) go test -mod=readonly -race $(PACKAGES_NOSIMULATION) @VERSION=$(VERSION) go test -mod=readonly -race $(PACKAGES_NOSIMULATION)
test-integration: build-sim test-integration: build-simd
BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...` BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...`
.PHONY: test test-all test-ledger-mock test-ledger test-unit test-race .PHONY: test test-all test-ledger-mock test-ledger test-unit test-race
@ -321,7 +320,7 @@ build-docker-local-simapp:
@$(MAKE) -C networks/local @$(MAKE) -C networks/local
# Run a 4-node testnet locally # Run a 4-node testnet locally
localnet-start: build-sim-linux localnet-stop localnet-start: build-simd-linux localnet-stop
@if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/simd:Z cosmos-sdk/simappnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi @if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/simd:Z cosmos-sdk/simappnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi
docker-compose up -d docker-compose up -d

View File

@ -9,13 +9,12 @@ import (
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
) )
type contextKey string
// ClientContextKey defines the context key used to retrieve a client.Context from // ClientContextKey defines the context key used to retrieve a client.Context from
// a command's Context. // a command's Context.
const ClientContextKey = contextKey("client.context") const ClientContextKey = sdk.ContextKey("client.context")
// SetCmdClientContextHandler is to be used in a command pre-hook execution to // SetCmdClientContextHandler is to be used in a command pre-hook execution to
// read flags that populate a Context and sets that to the command's Context. // read flags that populate a Context and sets that to the command's Context.

View File

@ -8,24 +8,22 @@ import (
"strings" "strings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/ed25519"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
) )
func Cmd(cdc *codec.Codec) *cobra.Command { func Cmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "debug", Use: "debug",
Short: "Tool for helping with debugging your application", Short: "Tool for helping with debugging your application",
RunE: client.ValidateCmd, RunE: client.ValidateCmd,
} }
cmd.AddCommand(PubkeyCmd(cdc)) cmd.AddCommand(PubkeyCmd())
cmd.AddCommand(AddrCmd()) cmd.AddCommand(AddrCmd())
cmd.AddCommand(RawBytesCmd()) cmd.AddCommand(RawBytesCmd())
@ -68,7 +66,7 @@ func getPubKeyFromString(pkstr string) (crypto.PubKey, error) {
return nil, fmt.Errorf("pubkey '%s' invalid; expected hex, base64, or bech32", pubKey) return nil, fmt.Errorf("pubkey '%s' invalid; expected hex, base64, or bech32", pubKey)
} }
func PubkeyCmd(cdc *codec.Codec) *cobra.Command { func PubkeyCmd() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "pubkey [pubkey]", Use: "pubkey [pubkey]",
Short: "Decode a ED25519 pubkey from hex, base64, or bech32", Short: "Decode a ED25519 pubkey from hex, base64, or bech32",
@ -77,9 +75,11 @@ func PubkeyCmd(cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s debug pubkey TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz $ %s debug pubkey TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
$ %s debug pubkey cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg $ %s debug pubkey cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg
`, version.ClientName, version.ClientName), `, version.AppName, version.AppName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
pk, err := getPubKeyFromString(args[0]) pk, err := getPubKeyFromString(args[0])
if err != nil { if err != nil {
return err return err
@ -90,7 +90,7 @@ $ %s debug pubkey cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg
return fmt.Errorf("invalid pubkey type; expected ED25519") return fmt.Errorf("invalid pubkey type; expected ED25519")
} }
pubKeyJSONBytes, err := cdc.MarshalJSON(edPK) pubKeyJSONBytes, err := clientCtx.JSONMarshaler.MarshalJSON(edPK)
if err != nil { if err != nil {
return err return err
} }
@ -127,7 +127,7 @@ func AddrCmd() *cobra.Command {
Example: Example:
$ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg $ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg
`, version.ClientName), `, version.AppName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -171,7 +171,7 @@ func RawBytesCmd() *cobra.Command {
Example: Example:
$ %s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 110 100] $ %s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 110 100]
`, version.ClientName), `, version.AppName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
stringBytes := args[0] stringBytes := args[0]

View File

@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -22,12 +23,16 @@ const (
) )
// ExportCmd dumps app state to JSON. // ExportCmd dumps app state to JSON.
func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) *cobra.Command { func ExportCmd(appExporter AppExporter) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "export", Use: "export",
Short: "Export state to JSON", Short: "Export state to JSON",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
config := ctx.Config clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
serverCtx := GetServerContextFromCmd(cmd)
config := serverCtx.Config
homeDir, _ := cmd.Flags().GetString(flags.FlagHome) homeDir, _ := cmd.Flags().GetString(flags.FlagHome)
config.SetRoot(homeDir) config.SetRoot(homeDir)
@ -61,12 +66,12 @@ func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) *
forZeroHeight, _ := cmd.Flags().GetBool(flagForZeroHeight) forZeroHeight, _ := cmd.Flags().GetBool(flagForZeroHeight)
jailWhiteList, _ := cmd.Flags().GetStringSlice(flagJailWhitelist) jailWhiteList, _ := cmd.Flags().GetStringSlice(flagJailWhitelist)
appState, validators, cp, err := appExporter(ctx.Logger, db, traceWriter, height, forZeroHeight, jailWhiteList) appState, validators, cp, err := appExporter(serverCtx.Logger, db, traceWriter, height, forZeroHeight, jailWhiteList)
if err != nil { if err != nil {
return fmt.Errorf("error exporting state: %v", err) return fmt.Errorf("error exporting state: %v", err)
} }
doc, err := tmtypes.GenesisDocFromFile(ctx.Config.GenesisFile()) doc, err := tmtypes.GenesisDocFromFile(serverCtx.Config.GenesisFile())
if err != nil { if err != nil {
return err return err
} }

View File

@ -2,6 +2,7 @@ package server
import ( import (
"bytes" "bytes"
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@ -16,6 +17,7 @@ import (
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db" dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp"
@ -36,11 +38,13 @@ func TestExportCmd_ConsensusParams(t *testing.T) {
db := dbm.NewMemDB() db := dbm.NewMemDB()
app := simapp.NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, tempDir, 0) app := simapp.NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, tempDir, 0)
ctx := NewDefaultContext() serverCtx := NewDefaultContext()
ctx.Config.RootDir = tempDir serverCtx.Config.RootDir = tempDir
clientCtx := client.Context{}.WithJSONMarshaler(app.Codec())
genDoc := newDefaultGenesisDoc(app.Codec()) genDoc := newDefaultGenesisDoc(app.Codec())
err = saveGenesisFile(genDoc, ctx.Config.GenesisFile()) err = saveGenesisFile(genDoc, serverCtx.Config.GenesisFile())
app.InitChain( app.InitChain(
abci.RequestInitChain{ abci.RequestInitChain{
@ -53,16 +57,18 @@ func TestExportCmd_ConsensusParams(t *testing.T) {
app.Commit() app.Commit()
cmd := ExportCmd( cmd := ExportCmd(
ctx,
app.Codec(),
func(logger log.Logger, db dbm.DB, writer io.Writer, i int64, b bool, strings []string) (json.RawMessage, []tmtypes.GenesisValidator, *abci.ConsensusParams, error) { func(logger log.Logger, db dbm.DB, writer io.Writer, i int64, b bool, strings []string) (json.RawMessage, []tmtypes.GenesisValidator, *abci.ConsensusParams, error) {
return app.ExportAppStateAndValidators(true, []string{}) return app.ExportAppStateAndValidators(true, []string{})
}) })
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
ctx = context.WithValue(ctx, ServerContextKey, serverCtx)
output := &bytes.Buffer{} output := &bytes.Buffer{}
cmd.SetOut(output) cmd.SetOut(output)
cmd.SetArgs([]string{fmt.Sprintf("--%s=%s", flags.FlagHome, tempDir)}) cmd.SetArgs([]string{fmt.Sprintf("--%s=%s", flags.FlagHome, tempDir)})
require.NoError(t, cmd.Execute()) require.NoError(t, cmd.ExecuteContext(ctx))
var exportedGenDoc tmtypes.GenesisDoc var exportedGenDoc tmtypes.GenesisDoc
err = app.Codec().UnmarshalJSON(output.Bytes(), &exportedGenDoc) err = app.Codec().UnmarshalJSON(output.Bytes(), &exportedGenDoc)

View File

@ -48,7 +48,7 @@ const (
// StartCmd runs the service passed in, either stand-alone or in-process with // StartCmd runs the service passed in, either stand-alone or in-process with
// Tendermint. // Tendermint.
func StartCmd(ctx *Context, cdc codec.JSONMarshaler, appCreator AppCreator) *cobra.Command { func StartCmd(appCreator AppCreator) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "start", Use: "start",
Short: "Run the full node", Short: "Run the full node",
@ -74,20 +74,29 @@ will not be able to commit subsequent blocks.
For profiling and benchmarking purposes, CPU profiling can be enabled via the '--cpu-profile' flag For profiling and benchmarking purposes, CPU profiling can be enabled via the '--cpu-profile' flag
which accepts a path for the resulting pprof file. which accepts a path for the resulting pprof file.
`, `,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, _ []string) error {
_, err := GetPruningOptionsFromFlags(ctx.Viper) serverCtx := GetServerContextFromCmd(cmd)
// Bind flags to the Context's Viper so the app construction can set
// options accordingly.
serverCtx.Viper.BindPFlags(cmd.Flags())
_, err := GetPruningOptionsFromFlags(serverCtx.Viper)
return err return err
}, },
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
serverCtx := GetServerContextFromCmd(cmd)
clientCtx := client.GetClientContextFromCmd(cmd)
withTM, _ := cmd.Flags().GetBool(flagWithTendermint) withTM, _ := cmd.Flags().GetBool(flagWithTendermint)
if !withTM { if !withTM {
ctx.Logger.Info("starting ABCI without Tendermint") serverCtx.Logger.Info("starting ABCI without Tendermint")
return startStandAlone(ctx, appCreator) return startStandAlone(serverCtx, appCreator)
} }
ctx.Logger.Info("starting ABCI with Tendermint") serverCtx.Logger.Info("starting ABCI with Tendermint")
err := startInProcess(ctx, cdc, appCreator) err := startInProcess(serverCtx, clientCtx.JSONMarshaler, appCreator)
return err return err
}, },
} }
@ -109,10 +118,6 @@ which accepts a path for the resulting pprof file.
cmd.Flags().Uint64(FlagPruningInterval, 0, "Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom')") cmd.Flags().Uint64(FlagPruningInterval, 0, "Height interval at which pruned heights are removed from disk (ignored if pruning is not 'custom')")
cmd.Flags().Uint(FlagInvCheckPeriod, 0, "Assert registered invariants every N blocks") cmd.Flags().Uint(FlagInvCheckPeriod, 0, "Assert registered invariants every N blocks")
// Bind flags to the Context's Viper so the app construction can set options
// accordingly.
ctx.Viper.BindPFlags(cmd.Flags())
// add support for all Tendermint-specific command line options // add support for all Tendermint-specific command line options
tcmd.AddNodeFlags(cmd) tcmd.AddNodeFlags(cmd)
return cmd return cmd
@ -147,9 +152,8 @@ func startStandAlone(ctx *Context, appCreator AppCreator) error {
tmos.Exit(err.Error()) tmos.Exit(err.Error())
} }
tmos.TrapSignal(ctx.Logger, func() { TrapSignal(func() {
err = svr.Stop() if err = svr.Stop(); err != nil {
if err != nil {
tmos.Exit(err.Error()) tmos.Exit(err.Error())
} }
}) })

View File

@ -7,13 +7,12 @@ import (
"strings" "strings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
"github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/p2p"
pvm "github.com/tendermint/tendermint/privval" pvm "github.com/tendermint/tendermint/privval"
tversion "github.com/tendermint/tendermint/version" tversion "github.com/tendermint/tendermint/version"
yaml "gopkg.in/yaml.v2"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
@ -21,16 +20,19 @@ import (
) )
// ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout // ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout
func ShowNodeIDCmd(ctx *Context) *cobra.Command { func ShowNodeIDCmd() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "show-node-id", Use: "show-node-id",
Short: "Show this node's ID", Short: "Show this node's ID",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config serverCtx := GetServerContextFromCmd(cmd)
cfg := serverCtx.Config
nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile()) nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile())
if err != nil { if err != nil {
return err return err
} }
fmt.Println(nodeKey.ID()) fmt.Println(nodeKey.ID())
return nil return nil
}, },
@ -38,12 +40,13 @@ func ShowNodeIDCmd(ctx *Context) *cobra.Command {
} }
// ShowValidator - ported from Tendermint, show this node's validator info // ShowValidator - ported from Tendermint, show this node's validator info
func ShowValidatorCmd(ctx *Context) *cobra.Command { func ShowValidatorCmd() *cobra.Command {
cmd := cobra.Command{ cmd := cobra.Command{
Use: "show-validator", Use: "show-validator",
Short: "Show this node's tendermint validator info", Short: "Show this node's tendermint validator info",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config serverCtx := GetServerContextFromCmd(cmd)
cfg := serverCtx.Config
privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()) privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
valPubKey, err := privValidator.GetPubKey() valPubKey, err := privValidator.GetPubKey()
@ -71,12 +74,14 @@ func ShowValidatorCmd(ctx *Context) *cobra.Command {
} }
// ShowAddressCmd - show this node's validator address // ShowAddressCmd - show this node's validator address
func ShowAddressCmd(ctx *Context) *cobra.Command { func ShowAddressCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "show-address", Use: "show-address",
Short: "Shows this node's tendermint validator consensus address", Short: "Shows this node's tendermint validator consensus address",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config serverCtx := GetServerContextFromCmd(cmd)
cfg := serverCtx.Config
privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()) privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
valConsAddr := (sdk.ConsAddress)(privValidator.GetAddress()) valConsAddr := (sdk.ConsAddress)(privValidator.GetAddress())
@ -95,15 +100,14 @@ func ShowAddressCmd(ctx *Context) *cobra.Command {
} }
// VersionCmd prints tendermint and ABCI version numbers. // VersionCmd prints tendermint and ABCI version numbers.
func VersionCmd(ctx *Context) *cobra.Command { func VersionCmd() *cobra.Command {
cmd := &cobra.Command{ return &cobra.Command{
Use: "version", Use: "version",
Short: "Print tendermint libraries' version", Short: "Print tendermint libraries' version",
Long: `Print protocols' and libraries' version numbers Long: `Print protocols' and libraries' version numbers
against which this app has been compiled. against which this app has been compiled.
`, `,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
bs, err := yaml.Marshal(&struct { bs, err := yaml.Marshal(&struct {
Tendermint string Tendermint string
ABCI string ABCI string
@ -123,28 +127,31 @@ against which this app has been compiled.
return nil return nil
}, },
} }
return cmd
} }
func printlnJSON(v interface{}) error { func printlnJSON(v interface{}) error {
cdc := codec.New() cdc := codec.New()
cryptocodec.RegisterCrypto(cdc) cryptocodec.RegisterCrypto(cdc)
marshalled, err := cdc.MarshalJSON(v) marshalled, err := cdc.MarshalJSON(v)
if err != nil { if err != nil {
return err return err
} }
fmt.Println(string(marshalled)) fmt.Println(string(marshalled))
return nil return nil
} }
// UnsafeResetAllCmd - extension of the tendermint command, resets initialization // UnsafeResetAllCmd - extension of the tendermint command, resets initialization
func UnsafeResetAllCmd(ctx *Context) *cobra.Command { func UnsafeResetAllCmd() *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "unsafe-reset-all", Use: "unsafe-reset-all",
Short: "Resets the blockchain database, removes address book files, and resets priv_validator.json to the genesis state", Short: "Resets the blockchain database, removes address book files, and resets priv_validator.json to the genesis state",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config serverCtx := GetServerContextFromCmd(cmd)
tcmd.ResetAll(cfg.DBDir(), cfg.P2P.AddrBookFile(), cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile(), ctx.Logger) cfg := serverCtx.Config
tcmd.ResetAll(cfg.DBDir(), cfg.P2P.AddrBookFile(), cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile(), serverCtx.Logger)
return nil return nil
}, },
} }

View File

@ -21,11 +21,16 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server/config" "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
) )
// DONTCOVER // DONTCOVER
// ServerContextKey defines the context key used to retrieve a server.Context from
// a command's Context.
const ServerContextKey = sdk.ContextKey("server.context")
// server context // server context
type Context struct { type Context struct {
Viper *viper.Viper Viper *viper.Viper
@ -41,43 +46,62 @@ func NewContext(v *viper.Viper, config *tmcfg.Config, logger log.Logger) *Contex
return &Context{v, config, logger} return &Context{v, config, logger}
} }
// PersistentPreRunEFn returns a PersistentPreRunE function for the root daemon // InterceptConfigsPreRunHandler performs a pre-run function for the root daemon
// application command. The provided context is typically the default context, // application command. It will create a Viper literal and a default server
// where the logger and config are set based on the execution of parsing or // Context. The server Tendermint configuration will either be read and parsed
// creating a new Tendermint configuration file (config.toml). The provided // or created and saved to disk, where the server Context is updated to reflect
// viper object must be created at the root level and have all necessary flags, // the Tendermint configuration. The Viper literal is used to read and parse
// defined by Tendermint, bound to it. // the application configuration. Command handlers can fetch the server Context
func PersistentPreRunEFn(ctx *Context) func(*cobra.Command, []string) error { // to get the Tendermint configuration or to get access to Viper.
return func(cmd *cobra.Command, args []string) error { func InterceptConfigsPreRunHandler(cmd *cobra.Command) error {
rootViper := viper.New() rootViper := viper.New()
rootViper.BindPFlags(cmd.Flags()) rootViper.BindPFlags(cmd.Flags())
rootViper.BindPFlags(cmd.PersistentFlags()) rootViper.BindPFlags(cmd.PersistentFlags())
if cmd.Name() == version.Cmd.Name() { serverCtx := NewDefaultContext()
return nil config, err := interceptConfigs(serverCtx, rootViper)
} if err != nil {
return err
config, err := interceptConfigs(ctx, rootViper)
if err != nil {
return err
}
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, tmcfg.DefaultLogLevel())
if err != nil {
return err
}
if rootViper.GetBool(tmcli.TraceFlag) {
logger = log.NewTracingLogger(logger)
}
logger = logger.With("module", "main")
ctx.Config = config
ctx.Logger = logger
return nil
} }
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, tmcfg.DefaultLogLevel())
if err != nil {
return err
}
if rootViper.GetBool(tmcli.TraceFlag) {
logger = log.NewTracingLogger(logger)
}
serverCtx.Config = config
serverCtx.Logger = logger.With("module", "main")
return SetCmdServerContext(cmd, serverCtx)
}
// GetServerContextFromCmd returns a Context from a command or an empty Context
// if it has not been set.
func GetServerContextFromCmd(cmd *cobra.Command) *Context {
if v := cmd.Context().Value(ServerContextKey); v != nil {
serverCtxPtr := v.(*Context)
return serverCtxPtr
}
return NewDefaultContext()
}
// SetCmdServerContext sets a command's Context value to the provided argument.
func SetCmdServerContext(cmd *cobra.Command, serverCtx *Context) error {
v := cmd.Context().Value(ServerContextKey)
if v == nil {
return errors.New("server context not set")
}
serverCtxPtr := v.(*Context)
*serverCtxPtr = *serverCtx
return nil
} }
// interceptConfigs parses and updates a Tendermint configuration file or // interceptConfigs parses and updates a Tendermint configuration file or
@ -139,27 +163,25 @@ func interceptConfigs(ctx *Context, rootViper *viper.Viper) (*tmcfg.Config, erro
} }
// add server commands // add server commands
func AddCommands(ctx *Context, cdc codec.JSONMarshaler, rootCmd *cobra.Command, appCreator AppCreator, appExport AppExporter) { func AddCommands(rootCmd *cobra.Command, appCreator AppCreator, appExport AppExporter) {
rootCmd.PersistentFlags().String("log_level", ctx.Config.LogLevel, "Log level")
tendermintCmd := &cobra.Command{ tendermintCmd := &cobra.Command{
Use: "tendermint", Use: "tendermint",
Short: "Tendermint subcommands", Short: "Tendermint subcommands",
} }
tendermintCmd.AddCommand( tendermintCmd.AddCommand(
ShowNodeIDCmd(ctx), ShowNodeIDCmd(),
ShowValidatorCmd(ctx), ShowValidatorCmd(),
ShowAddressCmd(ctx), ShowAddressCmd(),
VersionCmd(ctx), VersionCmd(),
) )
rootCmd.AddCommand( rootCmd.AddCommand(
StartCmd(ctx, cdc, appCreator), StartCmd(appCreator),
UnsafeResetAllCmd(ctx), UnsafeResetAllCmd(),
flags.LineBreak, flags.LineBreak,
tendermintCmd, tendermintCmd,
ExportCmd(ctx, cdc, appExport), ExportCmd(appExport),
flags.LineBreak, flags.LineBreak,
version.Cmd, version.Cmd,
) )

View File

@ -78,9 +78,6 @@ import (
const appName = "SimApp" const appName = "SimApp"
var ( var (
// DefaultCLIHome default home directories for the application CLI
DefaultCLIHome = os.ExpandEnv("$HOME/.simapp")
// DefaultNodeHome default home directories for the application daemon // DefaultNodeHome default home directories for the application daemon
DefaultNodeHome = os.ExpandEnv("$HOME/.simapp") DefaultNodeHome = os.ExpandEnv("$HOME/.simapp")

View File

@ -1,136 +0,0 @@
package main
import (
"context"
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/types"
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
)
var (
encodingConfig = simapp.MakeEncodingConfig()
initClientCtx = client.Context{}.
WithJSONMarshaler(encodingConfig.Marshaler).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxGenerator(encodingConfig.TxGenerator).
WithCodec(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.NewAccountRetriever(encodingConfig.Marshaler)).
WithBroadcastMode(flags.BroadcastBlock)
)
func init() {
authclient.Codec = encodingConfig.Marshaler
}
// TODO: setup keybase, viper object, etc. to be passed into
// the below functions and eliminate global vars, like we do
// with the cdc
func main() {
cobra.EnableCommandSorting = false
// Read in the configuration file for the sdk
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
config.Seal()
rootCmd := &cobra.Command{
Use: "simcli",
Short: "Command line interface for interacting with simapp",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
return client.SetCmdClientContextHandler(initClientCtx, cmd)
},
}
rootCmd.PersistentFlags().String(flags.FlagChainID, "", "network chain ID")
rootCmd.AddCommand(
rpc.StatusCommand(),
queryCmd(),
txCmd(),
flags.LineBreak,
flags.LineBreak,
keys.Commands(),
flags.LineBreak,
flags.NewCompletionCmd(rootCmd, true),
)
// Add flags and prefix all env exposed with GA
executor := cli.PrepareMainCmd(rootCmd, "GA", simapp.DefaultCLIHome)
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{})
if err := executor.ExecuteContext(ctx); err != nil {
fmt.Printf("failed execution: %s, exiting...\n", err)
os.Exit(1)
}
}
func queryCmd() *cobra.Command {
queryCmd := &cobra.Command{
Use: "query",
Aliases: []string{"q"},
Short: "Querying subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
queryCmd.AddCommand(
authcmd.GetAccountCmd(encodingConfig.Amino),
flags.LineBreak,
rpc.ValidatorCommand(encodingConfig.Amino),
rpc.BlockCommand(),
authcmd.QueryTxsByEventsCmd(encodingConfig.Amino),
authcmd.QueryTxCmd(encodingConfig.Amino),
flags.LineBreak,
)
simapp.ModuleBasics.AddQueryCommands(queryCmd, initClientCtx)
return queryCmd
}
func txCmd() *cobra.Command {
txCmd := &cobra.Command{
Use: "tx",
Short: "Transactions subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
txCmd.AddCommand(
bankcmd.NewSendTxCmd(),
flags.LineBreak,
authcmd.GetSignCommand(initClientCtx),
authcmd.GetSignBatchCommand(encodingConfig.Amino),
authcmd.GetMultiSignCommand(initClientCtx),
authcmd.GetValidateSignaturesCommand(initClientCtx),
flags.LineBreak,
authcmd.GetBroadcastCommand(initClientCtx),
authcmd.GetEncodeCommand(initClientCtx),
authcmd.GetDecodeCommand(initClientCtx),
flags.LineBreak,
)
simapp.ModuleBasics.AddTxCommands(txCmd, initClientCtx)
return txCmd
}

View File

@ -1,118 +0,0 @@
package main
import (
"encoding/json"
"io"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
)
var viperCfg = viper.New()
func main() {
appCodec, cdc := simapp.MakeCodecs()
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
config.Seal()
ctx := server.NewDefaultContext()
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
Use: "simd",
Short: "Simulation Daemon (server)",
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
}
rootCmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
viperCfg.BindPFlags(rootCmd.Flags())
rootCmd.AddCommand(
genutilcli.InitCmd(ctx, cdc, simapp.ModuleBasics, simapp.DefaultNodeHome),
genutilcli.CollectGenTxsCmd(ctx, cdc, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.MigrateGenesisCmd(ctx, cdc),
genutilcli.GenTxCmd(
ctx, cdc, simapp.ModuleBasics,
banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome, simapp.DefaultCLIHome,
),
genutilcli.ValidateGenesisCmd(ctx, cdc, simapp.ModuleBasics),
AddGenesisAccountCmd(ctx, cdc, appCodec, simapp.DefaultCLIHome),
flags.NewCompletionCmd(rootCmd, true),
testnetCmd(ctx, cdc, simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(cdc),
)
server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
executor := cli.PrepareBaseCmd(rootCmd, "", simapp.DefaultNodeHome)
if err := executor.Execute(); err != nil {
panic(err)
}
}
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts server.AppOptions) server.Application {
var cache sdk.MultiStorePersistentCache
if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
cache = store.NewCommitKVStoreCacheManager()
}
skipUpgradeHeights := make(map[int64]bool)
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
skipUpgradeHeights[int64(h)] = true
}
pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
if err != nil {
panic(err)
}
return simapp.NewSimApp(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
)
}
func exportAppStateAndTMValidators(
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string,
) (json.RawMessage, []tmtypes.GenesisValidator, *abci.ConsensusParams, error) {
var simApp *simapp.SimApp
if height != -1 {
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1))
if err := simApp.LoadHeight(height); err != nil {
return nil, nil, nil, err
}
} else {
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1))
}
return simApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
}

View File

@ -1,4 +1,4 @@
package main package cmd
import ( import (
"bufio" "bufio"
@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keyring"
@ -28,7 +29,7 @@ const (
) )
// AddGenesisAccountCmd returns add-genesis-account cobra Command. // AddGenesisAccountCmd returns add-genesis-account cobra Command.
func AddGenesisAccountCmd(ctx *server.Context, depCdc codec.JSONMarshaler, cdc codec.Marshaler, defaultClientHome string) *cobra.Command { func AddGenesisAccountCmd(defaultClientHome string) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
Short: "Add a genesis account to genesis.json", Short: "Add a genesis account to genesis.json",
@ -39,7 +40,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
`, `,
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
config := ctx.Config clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.Codec
cdc := clientCtx.JSONMarshaler.(codec.Marshaler)
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
homeDir, _ := cmd.Flags().GetString(cli.HomeFlag) homeDir, _ := cmd.Flags().GetString(cli.HomeFlag)
config.SetRoot(homeDir) config.SetRoot(homeDir)
@ -160,5 +167,5 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
return cmd return flags.GetCommands(cmd)[0]
} }

195
simapp/simd/cmd/root.go Normal file
View File

@ -0,0 +1,195 @@
package cmd
import (
"context"
"encoding/json"
"io"
"os"
"github.com/spf13/cast"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
)
var (
rootCmd = &cobra.Command{
Use: "simd",
Short: "simulation app",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
return server.InterceptConfigsPreRunHandler(cmd)
},
}
encodingConfig = simapp.MakeEncodingConfig()
initClientCtx = client.Context{}.
WithJSONMarshaler(encodingConfig.Marshaler).
WithTxGenerator(encodingConfig.TxGenerator).
WithCodec(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(types.NewAccountRetriever(encodingConfig.Marshaler)).
WithBroadcastMode(flags.BroadcastBlock)
)
// Execute executes the root command.
func Execute() error {
// Create and set a client.Context on the command's Context. During the pre-run
// of the root command, a default initialized client.Context is provided to
// seed child command execution with values such as AccountRetriver, Keyring,
// and a Tendermint RPC. This requires the use of a pointer reference when
// getting and setting the client.Context. Ideally, we utilize
// https://github.com/spf13/cobra/pull/1118.
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &client.Context{})
ctx = context.WithValue(ctx, server.ServerContextKey, server.NewDefaultContext())
executor := cli.PrepareBaseCmd(rootCmd, "", simapp.DefaultNodeHome)
return executor.ExecuteContext(ctx)
}
func init() {
authclient.Codec = encodingConfig.Marshaler
rootCmd.AddCommand(
genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.MigrateGenesisCmd(),
genutilcli.GenTxCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.ValidateGenesisCmd(simapp.ModuleBasics),
AddGenesisAccountCmd(simapp.DefaultNodeHome),
flags.NewCompletionCmd(rootCmd, true),
testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
)
server.AddCommands(rootCmd, newApp, exportAppStateAndTMValidators)
// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
rpc.StatusCommand(),
queryCommand(),
txCommand(),
keys.Commands(),
)
}
func queryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Aliases: []string{"q"},
Short: "Querying subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
authcmd.GetAccountCmd(encodingConfig.Amino),
rpc.ValidatorCommand(encodingConfig.Amino),
rpc.BlockCommand(),
authcmd.QueryTxsByEventsCmd(encodingConfig.Amino),
authcmd.QueryTxCmd(encodingConfig.Amino),
)
simapp.ModuleBasics.AddQueryCommands(cmd, initClientCtx)
cmd.PersistentFlags().String(flags.FlagChainID, "", "network chain ID")
return cmd
}
func txCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tx",
Short: "Transactions subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
authcmd.GetSignCommand(initClientCtx),
authcmd.GetSignBatchCommand(encodingConfig.Amino),
authcmd.GetMultiSignCommand(initClientCtx),
authcmd.GetValidateSignaturesCommand(initClientCtx),
flags.LineBreak,
authcmd.GetBroadcastCommand(initClientCtx),
authcmd.GetEncodeCommand(initClientCtx),
authcmd.GetDecodeCommand(initClientCtx),
flags.LineBreak,
)
simapp.ModuleBasics.AddTxCommands(cmd, initClientCtx)
cmd.PersistentFlags().String(flags.FlagChainID, "", "network chain ID")
return cmd
}
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts server.AppOptions) server.Application {
var cache sdk.MultiStorePersistentCache
if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
cache = store.NewCommitKVStoreCacheManager()
}
skipUpgradeHeights := make(map[int64]bool)
for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
skipUpgradeHeights[int64(h)] = true
}
pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
if err != nil {
panic(err)
}
return simapp.NewSimApp(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
)
}
func exportAppStateAndTMValidators(
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailWhiteList []string,
) (json.RawMessage, []tmtypes.GenesisValidator, *abci.ConsensusParams, error) {
var simApp *simapp.SimApp
if height != -1 {
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1))
if err := simApp.LoadHeight(height); err != nil {
return nil, nil, nil, err
}
} else {
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1))
}
return simApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
}

View File

@ -1,4 +1,4 @@
package main package cmd
// DONTCOVER // DONTCOVER
@ -18,6 +18,7 @@ import (
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time" tmtime "github.com/tendermint/tendermint/types/time"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
clientkeys "github.com/cosmos/cosmos-sdk/client/keys" clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
@ -43,10 +44,7 @@ var (
) )
// get cmd to initialize all files for tendermint testnet and application // get cmd to initialize all files for tendermint testnet and application
func testnetCmd(ctx *server.Context, cdc codec.JSONMarshaler, func testnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command {
mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator,
) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "testnet", Use: "testnet",
Short: "Initialize files for a simapp testnet", Short: "Initialize files for a simapp testnet",
@ -59,7 +57,11 @@ Example:
simd testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2 simd testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2
`, `,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
config := ctx.Config clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
outputDir, _ := cmd.Flags().GetString(flagOutputDir) outputDir, _ := cmd.Flags().GetString(flagOutputDir)
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend) keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)

13
simapp/simd/main.go Normal file
View File

@ -0,0 +1,13 @@
package main
import (
"os"
"github.com/cosmos/cosmos-sdk/simapp/simd/cmd"
)
func main() {
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}

View File

@ -21,7 +21,6 @@ type Fixtures struct {
BuildDir string BuildDir string
RootDir string RootDir string
SimdBinary string SimdBinary string
SimcliBinary string
ChainID string ChainID string
RPCAddr string RPCAddr string
Port string Port string
@ -56,7 +55,6 @@ func NewFixtures(t *testing.T) *Fixtures {
BuildDir: buildDir, BuildDir: buildDir,
RootDir: tmpDir, RootDir: tmpDir,
SimdBinary: filepath.Join(buildDir, "simd"), SimdBinary: filepath.Join(buildDir, "simd"),
SimcliBinary: filepath.Join(buildDir, "simcli"),
SimdHome: filepath.Join(tmpDir, ".simd"), SimdHome: filepath.Join(tmpDir, ".simd"),
SimcliHome: filepath.Join(tmpDir, ".simcli"), SimcliHome: filepath.Join(tmpDir, ".simcli"),
RPCAddr: servAddr, RPCAddr: servAddr,

View File

@ -51,7 +51,7 @@ func (f *Fixtures) UnsafeResetAll(flags ...string) {
// SDInit is simd init // SDInit is simd init
// NOTE: SDInit sets the ChainID for the Fixtures instance // NOTE: SDInit sets the ChainID for the Fixtures instance
func (f *Fixtures) SDInit(moniker string, flags ...string) { func (f *Fixtures) SDInit(moniker string, flags ...string) {
cmd := fmt.Sprintf("%s init -o --home=%s %s", f.SimdBinary, f.SimdHome, moniker) cmd := fmt.Sprintf("%s init --overwrite --home=%s %s", f.SimdBinary, f.SimdHome, moniker)
_, stderr := tests.ExecuteT(f.T, AddFlags(cmd, flags), clientkeys.DefaultKeyPass) _, stderr := tests.ExecuteT(f.T, AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
var chainID string var chainID string
@ -113,14 +113,14 @@ func (f *Fixtures) ValidateGenesis() {
// KeysDelete is simcli keys delete // KeysDelete is simcli keys delete
func (f *Fixtures) KeysDelete(name string, flags ...string) { func (f *Fixtures) KeysDelete(name string, flags ...string) {
cmd := fmt.Sprintf("%s keys delete --keyring-backend=test --home=%s %s", f.SimcliBinary, cmd := fmt.Sprintf("%s keys delete --keyring-backend=test --home=%s %s", f.SimdBinary,
f.SimcliHome, name) f.SimcliHome, name)
ExecuteWrite(f.T, AddFlags(cmd, append(append(flags, "-y"), "-f"))) ExecuteWrite(f.T, AddFlags(cmd, append(append(flags, "-y"), "-f")))
} }
// KeysAdd is simcli keys add // KeysAdd is simcli keys add
func (f *Fixtures) KeysAdd(name string, flags ...string) { func (f *Fixtures) KeysAdd(name string, flags ...string) {
cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s %s", f.SimcliBinary, cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s %s", f.SimdBinary,
f.SimcliHome, name) f.SimcliHome, name)
ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags)) ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags))
} }
@ -128,20 +128,20 @@ func (f *Fixtures) KeysAdd(name string, flags ...string) {
// KeysAddRecover prepares simcli keys add --recover // KeysAddRecover prepares simcli keys add --recover
func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) { func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) {
cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s --recover %s", cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s --recover %s",
f.SimcliBinary, f.SimcliHome, name) f.SimdBinary, f.SimcliHome, name)
return ExecuteWriteRetStdStreams(f.T, AddFlags(cmd, flags), mnemonic) return ExecuteWriteRetStdStreams(f.T, AddFlags(cmd, flags), mnemonic)
} }
// KeysAddRecoverHDPath prepares simcli keys add --recover --account --index // KeysAddRecoverHDPath prepares simcli keys add --recover --account --index
func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) {
cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s --recover %s --account %d"+ cmd := fmt.Sprintf("%s keys add --keyring-backend=test --home=%s --recover %s --account %d"+
" --index %d", f.SimcliBinary, f.SimcliHome, name, account, index) " --index %d", f.SimdBinary, f.SimcliHome, name, account, index)
ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags), mnemonic) ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags), mnemonic)
} }
// KeysShow is simcli keys show // KeysShow is simcli keys show
func (f *Fixtures) KeysShow(name string, flags ...string) keyring.KeyOutput { func (f *Fixtures) KeysShow(name string, flags ...string) keyring.KeyOutput {
cmd := fmt.Sprintf("%s keys show --keyring-backend=test --home=%s %s --output=json", f.SimcliBinary, f.SimcliHome, name) cmd := fmt.Sprintf("%s keys show --keyring-backend=test --home=%s %s --output=json", f.SimdBinary, f.SimcliHome, name)
out, _ := tests.ExecuteT(f.T, AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, AddFlags(cmd, flags), "")
var ko keyring.KeyOutput var ko keyring.KeyOutput
err := clientkeys.UnmarshalJSON([]byte(out), &ko) err := clientkeys.UnmarshalJSON([]byte(out), &ko)
@ -163,7 +163,7 @@ func (f *Fixtures) KeyAddress(name string) sdk.AccAddress {
// QueryTxs is simcli query txs // QueryTxs is simcli query txs
func (f *Fixtures) QueryTxs(page, limit int, events ...string) *sdk.SearchTxsResult { func (f *Fixtures) QueryTxs(page, limit int, events ...string) *sdk.SearchTxsResult {
cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --events='%s' %v", cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --events='%s' %v",
f.SimcliBinary, page, limit, buildEventsQueryString(events), f.Flags()) f.SimdBinary, page, limit, buildEventsQueryString(events), f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var result sdk.SearchTxsResult var result sdk.SearchTxsResult

View File

@ -226,9 +226,10 @@ func (c Context) CacheContext() (cc Context, writeCache func()) {
return cc, cms.Write return cc, cms.Write
} }
type sdkContextKeyType string // ContextKey defines a type alias for a stdlib Context key.
type ContextKey string
const sdkContextKey sdkContextKeyType = "sdk-context" const sdkContextKey ContextKey = "sdk-context"
// WrapSDKContext returns a stdlib context.Context with the provided sdk.Context's internal // WrapSDKContext returns a stdlib context.Context with the provided sdk.Context's internal
// context as a value. It is useful for passing an sdk.Context through methods that take a // context as a value. It is useful for passing an sdk.Context through methods that take a

View File

@ -10,8 +10,7 @@
// can be passed as build flags as shown in the following example: // can be passed as build flags as shown in the following example:
// //
// go build -X github.com/cosmos/cosmos-sdk/version.Name=gaia \ // go build -X github.com/cosmos/cosmos-sdk/version.Name=gaia \
// -X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \ // -X github.com/cosmos/cosmos-sdk/version.AppName=gaiad \
// -X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \
// -X github.com/cosmos/cosmos-sdk/version.Version=1.0 \ // -X github.com/cosmos/cosmos-sdk/version.Version=1.0 \
// -X github.com/cosmos/cosmos-sdk/version.Commit=f0f7b7dab7e36c20b757cebce0e8f4fc5b95de60 \ // -X github.com/cosmos/cosmos-sdk/version.Commit=f0f7b7dab7e36c20b757cebce0e8f4fc5b95de60 \
// -X "github.com/cosmos/cosmos-sdk/version.BuildTags=linux darwin amd64" // -X "github.com/cosmos/cosmos-sdk/version.BuildTags=linux darwin amd64"
@ -25,10 +24,8 @@ import (
var ( var (
// application's name // application's name
Name = "" Name = ""
// server binary name // application binary name
ServerName = "<appd>" AppName = "<appd>"
// client binary name
ClientName = "<appcli>"
// application's version string // application's version string
Version = "" Version = ""
// commit // commit
@ -39,24 +36,22 @@ var (
// Info defines the application version information. // Info defines the application version information.
type Info struct { type Info struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
ServerName string `json:"server_name" yaml:"server_name"` AppName string `json:"server_name" yaml:"server_name"`
ClientName string `json:"client_name" yaml:"client_name"` Version string `json:"version" yaml:"version"`
Version string `json:"version" yaml:"version"` GitCommit string `json:"commit" yaml:"commit"`
GitCommit string `json:"commit" yaml:"commit"` BuildTags string `json:"build_tags" yaml:"build_tags"`
BuildTags string `json:"build_tags" yaml:"build_tags"` GoVersion string `json:"go" yaml:"go"`
GoVersion string `json:"go" yaml:"go"`
} }
func NewInfo() Info { func NewInfo() Info {
return Info{ return Info{
Name: Name, Name: Name,
ServerName: ServerName, AppName: AppName,
ClientName: ClientName, Version: Version,
Version: Version, GitCommit: Commit,
GitCommit: Commit, BuildTags: BuildTags,
BuildTags: BuildTags, GoVersion: fmt.Sprintf("go version %s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
GoVersion: fmt.Sprintf("go version %s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
} }
} }

View File

@ -25,13 +25,12 @@ build tags:
func TestInfo_String(t *testing.T) { func TestInfo_String(t *testing.T) {
info := Info{ info := Info{
Name: "testapp", Name: "testapp",
ServerName: "testappd", AppName: "testappd",
ClientName: "testappcli", Version: "1.0.0",
Version: "1.0.0", GitCommit: "1b78457135a4104bc3af97f20654d49e2ea87454",
GitCommit: "1b78457135a4104bc3af97f20654d49e2ea87454", BuildTags: "netgo,ledger",
BuildTags: "netgo,ledger", GoVersion: "go version go1.14 linux/amd64",
GoVersion: "go version go1.14 linux/amd64",
} }
want := `testapp: 1.0.0 want := `testapp: 1.0.0
git commit: 1b78457135a4104bc3af97f20654d49e2ea87454 git commit: 1b78457135a4104bc3af97f20654d49e2ea87454

View File

@ -114,7 +114,7 @@ documents its respective events under 'xx_events.md'.
Example: Example:
$ %s query txs --%s 'message.sender=cosmos1...&message.action=withdraw_delegator_reward' --page 1 --limit 30 $ %s query txs --%s 'message.sender=cosmos1...&message.action=withdraw_delegator_reward' --page 1 --limit 30
`, eventFormat, version.ClientName, flagEvents), `, eventFormat, version.AppName, flagEvents),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
eventsRaw, _ := cmd.Flags().GetString(flagEvents) eventsRaw, _ := cmd.Flags().GetString(flagEvents)

View File

@ -41,7 +41,7 @@ The --offline flag makes sure that the client will not reach out to an external
Thus account number or sequence number lookups will not be performed and it is Thus account number or sequence number lookups will not be performed and it is
recommended to set such parameters manually. recommended to set such parameters manually.
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: makeMultiSignCmd(clientCtx), RunE: makeMultiSignCmd(clientCtx),

View File

@ -10,26 +10,26 @@ import (
// TxSign is simcli sign // TxSign is simcli sign
func TxSign(f *cli.Fixtures, signer, fileName string, flags ...string) (bool, string, string) { func TxSign(f *cli.Fixtures, signer, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx sign %v --keyring-backend=test --from=%s %v", f.SimcliBinary, f.Flags(), signer, fileName) cmd := fmt.Sprintf("%s tx sign %v --keyring-backend=test --from=%s %v", f.SimdBinary, f.Flags(), signer, fileName)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxBroadcast is simcli tx broadcast // TxBroadcast is simcli tx broadcast
func TxBroadcast(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) { func TxBroadcast(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx broadcast %v %v", f.SimcliBinary, f.Flags(), fileName) cmd := fmt.Sprintf("%s tx broadcast %v %v", f.SimdBinary, f.Flags(), fileName)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxEncode is simcli tx encode // TxEncode is simcli tx encode
func TxEncode(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) { func TxEncode(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx encode %v %v", f.SimcliBinary, f.Flags(), fileName) cmd := fmt.Sprintf("%s tx encode %v %v", f.SimdBinary, f.Flags(), fileName)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxValidateSignatures is simcli tx validate-signatures // TxValidateSignatures is simcli tx validate-signatures
func TxValidateSignatures(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) { func TxValidateSignatures(f *cli.Fixtures, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx validate-signatures %v --keyring-backend=test %v", f.SimcliBinary, cmd := fmt.Sprintf("%s tx validate-signatures %v --keyring-backend=test %v", f.SimdBinary,
f.Flags(), fileName) f.Flags(), fileName)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
@ -39,21 +39,21 @@ func TxValidateSignatures(f *cli.Fixtures, fileName string, flags ...string) (bo
func TxMultisign(f *cli.Fixtures, fileName, name string, signaturesFiles []string, func TxMultisign(f *cli.Fixtures, fileName, name string, signaturesFiles []string,
flags ...string) (bool, string, string) { flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx multisign --keyring-backend=test %v %s %s %s", f.SimcliBinary, f.Flags(), cmd := fmt.Sprintf("%s tx multisign --keyring-backend=test %v %s %s %s", f.SimdBinary, f.Flags(),
fileName, name, strings.Join(signaturesFiles, " "), fileName, name, strings.Join(signaturesFiles, " "),
) )
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags)) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags))
} }
func TxSignBatch(f *cli.Fixtures, signer, fileName string, flags ...string) (bool, string, string) { func TxSignBatch(f *cli.Fixtures, signer, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx sign-batch %v --keyring-backend=test --from=%s %v", f.SimcliBinary, f.Flags(), signer, fileName) cmd := fmt.Sprintf("%s tx sign-batch %v --keyring-backend=test --from=%s %v", f.SimdBinary, f.Flags(), signer, fileName)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxDecode is simcli tx decode // TxDecode is simcli tx decode
func TxDecode(f *cli.Fixtures, encodedTx string, flags ...string) (bool, string, string) { func TxDecode(f *cli.Fixtures, encodedTx string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx decode %v %v", f.SimcliBinary, f.Flags(), encodedTx) cmd := fmt.Sprintf("%s tx decode %v %v", f.SimdBinary, f.Flags(), encodedTx)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }

View File

@ -50,7 +50,7 @@ Example:
$ %s query %s balances [address] $ %s query %s balances [address]
$ %s query %s balances [address] --denom=[denom] $ %s query %s balances [address] --denom=[denom]
`, `,
version.ClientName, types.ModuleName, version.ClientName, types.ModuleName, version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -110,7 +110,7 @@ Example:
To query for the total supply of a specific coin denomination use: To query for the total supply of a specific coin denomination use:
$ %s query %s total --denom=[denom] $ %s query %s total --denom=[denom]
`, `,
version.ClientName, types.ModuleName, version.ClientName, types.ModuleName, version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -47,13 +47,13 @@ func MsgSendExec(clientCtx client.Context, from, to, amount fmt.Stringer, extraA
// TxSend is simcli tx send // TxSend is simcli tx send
func TxSend(f *cli.Fixtures, from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) { func TxSend(f *cli.Fixtures, from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx send --keyring-backend=test %s %s %s %v", f.SimcliBinary, from, to, amount, f.Flags()) cmd := fmt.Sprintf("%s tx send --keyring-backend=test %s %s %s %v", f.SimdBinary, from, to, amount, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// QueryAccount is simcli query account // QueryAccount is simcli query account
func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) authtypes.BaseAccount { func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) authtypes.BaseAccount {
cmd := fmt.Sprintf("%s query account %s %v", f.SimcliBinary, address, f.Flags()) cmd := fmt.Sprintf("%s query account %s %v", f.SimdBinary, address, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
@ -72,7 +72,7 @@ func QueryAccount(f *cli.Fixtures, address sdk.AccAddress, flags ...string) auth
// QueryBalances executes the bank query balances command for a given address and // QueryBalances executes the bank query balances command for a given address and
// flag set. // flag set.
func QueryBalances(f *cli.Fixtures, address sdk.AccAddress, flags ...string) sdk.Coins { func QueryBalances(f *cli.Fixtures, address sdk.AccAddress, flags ...string) sdk.Coins {
cmd := fmt.Sprintf("%s query bank balances %s %v", f.SimcliBinary, address, f.Flags()) cmd := fmt.Sprintf("%s query bank balances %s %v", f.SimdBinary, address, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var balances sdk.Coins var balances sdk.Coins
@ -84,7 +84,7 @@ func QueryBalances(f *cli.Fixtures, address sdk.AccAddress, flags ...string) sdk
// QueryTotalSupply returns the total supply of coins // QueryTotalSupply returns the total supply of coins
func QueryTotalSupply(f *cli.Fixtures, flags ...string) (totalSupply sdk.Coins) { func QueryTotalSupply(f *cli.Fixtures, flags ...string) (totalSupply sdk.Coins) {
cmd := fmt.Sprintf("%s query bank total %s", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query bank total %s", f.SimdBinary, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -95,7 +95,7 @@ func QueryTotalSupply(f *cli.Fixtures, flags ...string) (totalSupply sdk.Coins)
// QueryTotalSupplyOf returns the total supply of a given coin denom // QueryTotalSupplyOf returns the total supply of a given coin denom
func QueryTotalSupplyOf(f *cli.Fixtures, denom string, flags ...string) sdk.Int { func QueryTotalSupplyOf(f *cli.Fixtures, denom string, flags ...string) sdk.Int {
cmd := fmt.Sprintf("%s query bank total %s %s", f.SimcliBinary, denom, f.Flags()) cmd := fmt.Sprintf("%s query bank total %s %s", f.SimdBinary, denom, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)

View File

@ -76,7 +76,7 @@ for a validator and all their delegations.
Example: Example:
$ %s query distribution validator-outstanding-rewards cosmosvaloper1lwjmdnks33xwnmfayc64ycprww49n33mtm92ne $ %s query distribution validator-outstanding-rewards cosmosvaloper1lwjmdnks33xwnmfayc64ycprww49n33mtm92ne
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -123,7 +123,7 @@ func GetCmdQueryValidatorCommission(queryRoute string, cdc *codec.Codec) *cobra.
Example: Example:
$ %s query distribution commission cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query distribution commission cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -158,7 +158,7 @@ func GetCmdQueryValidatorSlashes(queryRoute string, cdc *codec.Codec) *cobra.Com
Example: Example:
$ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 0 100 $ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 0 100
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -212,7 +212,7 @@ Example:
$ %s query distribution rewards cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p $ %s query distribution rewards cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
$ %s query distribution rewards cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query distribution rewards cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -273,7 +273,7 @@ func GetCmdQueryCommunityPool(queryRoute string, cdc *codec.Codec) *cobra.Comman
Example: Example:
$ %s query distribution community-pool $ %s query distribution community-pool
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -90,7 +90,7 @@ Example:
$ %s tx distribution withdraw-rewards cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey $ %s tx distribution withdraw-rewards cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey
$ %s tx distribution withdraw-rewards cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey --commission $ %s tx distribution withdraw-rewards cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey --commission
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -133,7 +133,7 @@ func NewWithdrawAllRewardsCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx distribution withdraw-all-rewards --from mykey $ %s tx distribution withdraw-all-rewards --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.NoArgs, Args: cobra.NoArgs,
@ -172,7 +172,7 @@ func NewSetWithdrawAddrCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx distribution set-withdraw-addr cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p --from mykey $ %s tx distribution set-withdraw-addr cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -207,7 +207,7 @@ func NewFundCommunityPoolCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx distribution fund-community-pool 100uatom --from mykey $ %s tx distribution fund-community-pool 100uatom --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -254,7 +254,7 @@ Where proposal.json contains:
"deposit": "1000stake" "deposit": "1000stake"
} }
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -14,31 +14,31 @@ import (
// TxWithdrawRewards raises a txn to withdraw rewards // TxWithdrawRewards raises a txn to withdraw rewards
func TxWithdrawRewards(f *cli.Fixtures, valAddr sdk.ValAddress, from string, flags ...string) bool { func TxWithdrawRewards(f *cli.Fixtures, valAddr sdk.ValAddress, from string, flags ...string) bool {
cmd := fmt.Sprintf("%s tx distribution withdraw-rewards %s %v --keyring-backend=test --from=%s", f.SimcliBinary, valAddr, f.Flags(), from) cmd := fmt.Sprintf("%s tx distribution withdraw-rewards %s %v --keyring-backend=test --from=%s", f.SimdBinary, valAddr, f.Flags(), from)
return cli.ExecuteWrite(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWrite(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxSetWithdrawAddress helps to set the withdraw address for rewards associated with a delegator address // TxSetWithdrawAddress helps to set the withdraw address for rewards associated with a delegator address
func TxSetWithdrawAddress(f *cli.Fixtures, from, withDrawAddr string, flags ...string) (bool, string, string) { func TxSetWithdrawAddress(f *cli.Fixtures, from, withDrawAddr string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx distribution set-withdraw-addr %s --from %s %v --keyring-backend=test", f.SimcliBinary, withDrawAddr, from, f.Flags()) cmd := fmt.Sprintf("%s tx distribution set-withdraw-addr %s --from %s %v --keyring-backend=test", f.SimdBinary, withDrawAddr, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxWithdrawAllRewards raises a txn to withdraw all rewards of a delegator address // TxWithdrawAllRewards raises a txn to withdraw all rewards of a delegator address
func TxWithdrawAllRewards(f *cli.Fixtures, from string, flags ...string) (bool, string, string) { func TxWithdrawAllRewards(f *cli.Fixtures, from string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx distribution withdraw-all-rewards %v --keyring-backend=test --from=%s", f.SimcliBinary, f.Flags(), from) cmd := fmt.Sprintf("%s tx distribution withdraw-all-rewards %v --keyring-backend=test --from=%s", f.SimdBinary, f.Flags(), from)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxFundCommunityPool Funds the community pool with the specified amount // TxFundCommunityPool Funds the community pool with the specified amount
func TxFundCommunityPool(f *cli.Fixtures, from string, amount sdk.Coin, flags ...string) (bool, string, string) { func TxFundCommunityPool(f *cli.Fixtures, from string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx distribution fund-community-pool %v %v --keyring-backend=test --from=%s", f.SimcliBinary, amount, f.Flags(), from) cmd := fmt.Sprintf("%s tx distribution fund-community-pool %v %v --keyring-backend=test --from=%s", f.SimdBinary, amount, f.Flags(), from)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// QueryRewards returns the rewards of a delegator // QueryRewards returns the rewards of a delegator
func QueryRewards(f *cli.Fixtures, delAddr sdk.AccAddress, flags ...string) types.QueryDelegatorTotalRewardsResponse { func QueryRewards(f *cli.Fixtures, delAddr sdk.AccAddress, flags ...string) types.QueryDelegatorTotalRewardsResponse {
cmd := fmt.Sprintf("%s query distribution rewards %s %s", f.SimcliBinary, delAddr, f.Flags()) cmd := fmt.Sprintf("%s query distribution rewards %s %s", f.SimdBinary, delAddr, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -49,7 +49,7 @@ func QueryRewards(f *cli.Fixtures, delAddr sdk.AccAddress, flags ...string) type
// QueryValidatorOutstandingRewards distribution outstanding (un-withdrawn) rewards // QueryValidatorOutstandingRewards distribution outstanding (un-withdrawn) rewards
func QueryValidatorOutstandingRewards(f *cli.Fixtures, valAddr string) types.ValidatorOutstandingRewards { func QueryValidatorOutstandingRewards(f *cli.Fixtures, valAddr string) types.ValidatorOutstandingRewards {
cmd := fmt.Sprintf("%s query distribution validator-outstanding-rewards %s %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query distribution validator-outstanding-rewards %s %v", f.SimdBinary, valAddr, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -60,7 +60,7 @@ func QueryValidatorOutstandingRewards(f *cli.Fixtures, valAddr string) types.Val
// QueryParameters is simcli query distribution parameters // QueryParameters is simcli query distribution parameters
func QueryParameters(f *cli.Fixtures, flags ...string) types.Params { func QueryParameters(f *cli.Fixtures, flags ...string) types.Params {
cmd := fmt.Sprintf("%s query distribution params %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query distribution params %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -71,7 +71,7 @@ func QueryParameters(f *cli.Fixtures, flags ...string) types.Params {
// QueryCommission returns validator commission rewards from delegators to that validator. // QueryCommission returns validator commission rewards from delegators to that validator.
func QueryCommission(f *cli.Fixtures, valAddr string, flags ...string) types.ValidatorAccumulatedCommission { func QueryCommission(f *cli.Fixtures, valAddr string, flags ...string) types.ValidatorAccumulatedCommission {
cmd := fmt.Sprintf("%s query distribution commission %s %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query distribution commission %s %v", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -82,7 +82,7 @@ func QueryCommission(f *cli.Fixtures, valAddr string, flags ...string) types.Val
// QuerySlashes returns all slashes of a validator for a given block range. // QuerySlashes returns all slashes of a validator for a given block range.
func QuerySlashes(f *cli.Fixtures, valAddr string, flags ...string) []types.ValidatorSlashEvent { func QuerySlashes(f *cli.Fixtures, valAddr string, flags ...string) []types.ValidatorSlashEvent {
cmd := fmt.Sprintf("%s query distribution slashes %s 0 5 %v ", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query distribution slashes %s 0 5 %v ", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -93,7 +93,7 @@ func QuerySlashes(f *cli.Fixtures, valAddr string, flags ...string) []types.Vali
// QueryCommunityPool returns the amount of coins in the community pool // QueryCommunityPool returns the amount of coins in the community pool
func QueryCommunityPool(f *cli.Fixtures, flags ...string) sdk.DecCoins { func QueryCommunityPool(f *cli.Fixtures, flags ...string) sdk.DecCoins {
cmd := fmt.Sprintf("%s query distribution community-pool %v ", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query distribution community-pool %v ", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)

View File

@ -28,7 +28,7 @@ Example:
$ %s query %s DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660 $ %s query %s DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660
$ %s query %s --page=2 --limit=50 $ %s query %s --page=2 --limit=50
`, `,
version.ClientName, types.ModuleName, version.ClientName, types.ModuleName, version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
), ),
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),

View File

@ -9,7 +9,7 @@ import (
"github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/cli"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/genutil/types"
@ -18,14 +18,20 @@ import (
const flagGenTxDir = "gentx-dir" const flagGenTxDir = "gentx-dir"
// CollectGenTxsCmd - return the cobra command to collect genesis transactions // CollectGenTxsCmd - return the cobra command to collect genesis transactions
func CollectGenTxsCmd(ctx *server.Context, cdc codec.JSONMarshaler, genBalIterator types.GenesisBalancesIterator, defaultNodeHome string) *cobra.Command { func CollectGenTxsCmd(genBalIterator types.GenesisBalancesIterator, defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "collect-gentxs", Use: "collect-gentxs",
Short: "Collect genesis txs and output a genesis.json file", Short: "Collect genesis txs and output a genesis.json file",
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
config := ctx.Config serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
home, _ := cmd.Flags().GetString(cli.HomeFlag) home, _ := cmd.Flags().GetString(cli.HomeFlag)
config.SetRoot(home) config.SetRoot(home)
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config) nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(config)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to initialize node validator files") return errors.Wrap(err, "failed to initialize node validator files")
@ -58,11 +64,7 @@ func CollectGenTxsCmd(ctx *server.Context, cdc codec.JSONMarshaler, genBalIterat
} }
cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory")
cmd.Flags().String(flagGenTxDir, "", cmd.Flags().String(flagGenTxDir, "", "override default \"gentx\" directory from which collect and execute genesis transactions; default [--home]/config/gentx/")
"override default \"gentx\" directory from which collect and execute "+
"genesis transactions; default [--home]/config/gentx/")
return cmd return cmd
} }
// DONTCOVER

View File

@ -31,8 +31,7 @@ import (
// GenTxCmd builds the application's gentx command. // GenTxCmd builds the application's gentx command.
// nolint: errcheck // nolint: errcheck
func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, func GenTxCmd(mbm module.BasicManager, genBalIterator types.GenesisBalancesIterator, defaultNodeHome string) *cobra.Command {
genBalIterator types.GenesisBalancesIterator, defaultNodeHome, defaultCLIHome string) *cobra.Command {
ipDefault, _ := server.ExternalIP() ipDefault, _ := server.ExternalIP()
fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault)
@ -47,11 +46,16 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
%s`, defaultsDesc), %s`, defaultsDesc),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
serverCtx := server.GetServerContextFromCmd(cmd)
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
home, _ := cmd.Flags().GetString(flags.FlagHome) home, _ := cmd.Flags().GetString(flags.FlagHome)
config := ctx.Config config := serverCtx.Config
config.SetRoot(home) config.SetRoot(home)
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(ctx.Config)
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(serverCtx.Config)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to initialize node validator files") return errors.Wrap(err, "failed to initialize node validator files")
} }
@ -126,7 +130,8 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
if err != nil { if err != nil {
return errors.Wrap(err, "error creating tx builder") return errors.Wrap(err, "error creating tx builder")
} }
txBldr = txBldr.WithTxEncoder(authclient.GetTxEncoder(cdc))
txBldr = txBldr.WithTxEncoder(authclient.GetTxEncoder(clientCtx.Codec))
from, _ := cmd.Flags().GetString(flags.FlagFrom) from, _ := cmd.Flags().GetString(flags.FlagFrom)
fromAddress, _, err := client.GetFromFields(txBldr.Keybase(), from, false) fromAddress, _, err := client.GetFromFields(txBldr.Keybase(), from, false)
@ -134,9 +139,7 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
return errors.Wrap(err, "error getting from address") return errors.Wrap(err, "error getting from address")
} }
clientCtx := client.Context{}. clientCtx = clientCtx.WithInput(inBuf).WithFromAddress(fromAddress)
WithInput(inBuf).WithCodec(cdc).WithJSONMarshaler(cdc).
WithFromAddress(fromAddress)
// create a 'create-validator' message // create a 'create-validator' message
txBldr, msg, err := cli.BuildCreateValidatorMsg(clientCtx, createValCfg, txBldr, true) txBldr, msg, err := cli.BuildCreateValidatorMsg(clientCtx, createValCfg, txBldr, true)
@ -189,18 +192,15 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
}, },
} }
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "node's home directory") cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
cmd.Flags().String(flagClientHome, defaultCLIHome, "client's home directory")
cmd.Flags().String(flags.FlagName, "", "name of private key with which to sign the gentx") cmd.Flags().String(flags.FlagName, "", "name of private key with which to sign the gentx")
cmd.Flags().String(flags.FlagOutputDocument, "", cmd.Flags().String(flags.FlagOutputDocument, "", "write the genesis transaction JSON document to the given file instead of the default location")
"write the genesis transaction JSON document to the given file instead of the default location")
cmd.Flags().AddFlagSet(fsCreateValidator) cmd.Flags().AddFlagSet(fsCreateValidator)
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
cmd.MarkFlagRequired(flags.FlagName)
flags.PostCommands(cmd) flags.PostCommands(cmd)
cmd.MarkFlagRequired(flags.FlagName)
return cmd return cmd
} }
@ -213,7 +213,7 @@ func makeOutputFilepath(rootDir, nodeID string) (string, error) {
return filepath.Join(writePath, fmt.Sprintf("gentx-%v.json", nodeID)), nil return filepath.Join(writePath, fmt.Sprintf("gentx-%v.json", nodeID)), nil
} }
func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (authtypes.StdTx, error) { func readUnsignedGenTxFile(cdc codec.JSONMarshaler, r io.Reader) (authtypes.StdTx, error) {
var stdTx authtypes.StdTx var stdTx authtypes.StdTx
bytes, err := ioutil.ReadAll(r) bytes, err := ioutil.ReadAll(r)
@ -222,11 +222,10 @@ func readUnsignedGenTxFile(cdc *codec.Codec, r io.Reader) (authtypes.StdTx, erro
} }
err = cdc.UnmarshalJSON(bytes, &stdTx) err = cdc.UnmarshalJSON(bytes, &stdTx)
return stdTx, err return stdTx, err
} }
func writeSignedGenTx(cdc *codec.Codec, outputDocument string, tx authtypes.StdTx) error { func writeSignedGenTx(cdc codec.JSONMarshaler, outputDocument string, tx authtypes.StdTx) error {
outputFile, err := os.OpenFile(outputDocument, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644) outputFile, err := os.OpenFile(outputDocument, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644)
if err != nil { if err != nil {
return err return err

View File

@ -14,6 +14,7 @@ import (
tmrand "github.com/tendermint/tendermint/libs/rand" tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server"
@ -58,20 +59,23 @@ func displayInfo(cdc codec.JSONMarshaler, info printInfo) error {
// InitCmd returns a command that initializes all files needed for Tendermint // InitCmd returns a command that initializes all files needed for Tendermint
// and the respective application. // and the respective application.
func InitCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module.BasicManager, defaultNodeHome string) *cobra.Command { func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "init [moniker]", Use: "init [moniker]",
Short: "Initialize private validator, p2p, genesis, and application configuration files", Short: "Initialize private validator, p2p, genesis, and application configuration files",
Long: `Initialize validators's and node's configuration files.`, Long: `Initialize validators's and node's configuration files.`,
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
config := ctx.Config clientCtx := client.GetClientContextFromCmd(cmd)
home, _ := cmd.Flags().GetString(cli.HomeFlag) cdc := clientCtx.JSONMarshaler
serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
home, _ := cmd.Flags().GetString(cli.HomeFlag)
config.SetRoot(home) config.SetRoot(home)
chainID, _ := cmd.Flags().GetString(flags.FlagChainID) chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainID == "" { if chainID == "" {
chainID = fmt.Sprintf("test-chain-%v", tmrand.Str(6)) chainID = fmt.Sprintf("test-chain-%v", tmrand.Str(6))
} }

View File

@ -2,6 +2,8 @@ package cli
import ( import (
"bytes" "bytes"
"context"
"fmt"
"io" "io"
"os" "os"
"testing" "testing"
@ -9,11 +11,13 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
abciServer "github.com/tendermint/tendermint/abci/server" abci_server "github.com/tendermint/tendermint/abci/server"
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
tmcfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
@ -27,20 +31,37 @@ import (
var testMbm = module.NewBasicManager(genutil.AppModuleBasic{}) var testMbm = module.NewBasicManager(genutil.AppModuleBasic{})
func createDefaultTendermintConfig(rootDir string) (*tmcfg.Config, error) {
conf := tmcfg.DefaultConfig()
conf.SetRoot(rootDir)
tmcfg.EnsureRoot(rootDir)
if err := conf.ValidateBasic(); err != nil {
return nil, fmt.Errorf("error in config file: %v", err)
}
return conf, nil
}
func TestInitCmd(t *testing.T) { func TestInitCmd(t *testing.T) {
t.SkipNow()
home, cleanup := tests.NewTestCaseDir(t) home, cleanup := tests.NewTestCaseDir(t)
t.Cleanup(cleanup) t.Cleanup(cleanup)
logger := log.NewNopLogger() logger := log.NewNopLogger()
cfg, err := tcmd.ParseConfig() cfg, err := createDefaultTendermintConfig(home)
require.Nil(t, err) require.NoError(t, err)
ctx := server.NewContext(viper.New(), cfg, logger) serverCtx := server.NewContext(viper.New(), cfg, logger)
cdc := makeCodec() clientCtx := client.Context{}.WithJSONMarshaler(makeCodec())
cmd := InitCmd(ctx, cdc, testMbm, home)
require.NoError(t, cmd.RunE(nil, []string{"appnode-test"})) ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx)
cmd := InitCmd(testMbm, home)
cmd.SetArgs([]string{"appnode-test"})
require.NoError(t, cmd.ExecuteContext(ctx))
} }
func setupClientHome(t *testing.T) func() { func setupClientHome(t *testing.T) func() {
@ -50,29 +71,34 @@ func setupClientHome(t *testing.T) func() {
} }
func TestEmptyState(t *testing.T) { func TestEmptyState(t *testing.T) {
t.SkipNow()
t.Cleanup(setupClientHome(t)) t.Cleanup(setupClientHome(t))
home, cleanup := tests.NewTestCaseDir(t) home, cleanup := tests.NewTestCaseDir(t)
t.Cleanup(cleanup) t.Cleanup(cleanup)
logger := log.NewNopLogger() logger := log.NewNopLogger()
cfg, err := tcmd.ParseConfig() cfg, err := createDefaultTendermintConfig(home)
require.Nil(t, err) require.NoError(t, err)
ctx := server.NewContext(viper.New(), cfg, logger) serverCtx := server.NewContext(viper.New(), cfg, logger)
cdc := makeCodec() clientCtx := client.Context{}.WithJSONMarshaler(makeCodec())
cmd := InitCmd(ctx, cdc, testMbm, home) ctx := context.Background()
require.NoError(t, cmd.RunE(nil, []string{"appnode-test"})) ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx)
cmd := InitCmd(testMbm, home)
cmd.SetArgs([]string{"appnode-test", fmt.Sprintf("--%s=%s", cli.HomeFlag, home)})
require.NoError(t, cmd.ExecuteContext(ctx))
old := os.Stdout old := os.Stdout
r, w, _ := os.Pipe() r, w, _ := os.Pipe()
os.Stdout = w os.Stdout = w
cmd = server.ExportCmd(ctx, cdc, nil)
err = cmd.RunE(nil, nil) cmd = server.ExportCmd(nil)
require.NoError(t, err) cmd.SetArgs([]string{fmt.Sprintf("--%s=%s", cli.HomeFlag, home)})
require.NoError(t, cmd.ExecuteContext(ctx))
outC := make(chan string) outC := make(chan string)
go func() { go func() {
@ -95,23 +121,33 @@ func TestEmptyState(t *testing.T) {
func TestStartStandAlone(t *testing.T) { func TestStartStandAlone(t *testing.T) {
home, cleanup := tests.NewTestCaseDir(t) home, cleanup := tests.NewTestCaseDir(t)
t.Cleanup(cleanup) t.Cleanup(cleanup)
viper.Set(cli.HomeFlag, home)
t.Cleanup(setupClientHome(t)) t.Cleanup(setupClientHome(t))
logger := log.NewNopLogger() logger := log.NewNopLogger()
cfg, err := tcmd.ParseConfig() cfg, err := createDefaultTendermintConfig(home)
require.Nil(t, err) require.NoError(t, err)
ctx := server.NewContext(viper.New(), cfg, logger)
cdc := makeCodec() serverCtx := server.NewContext(viper.New(), cfg, logger)
initCmd := InitCmd(ctx, cdc, testMbm, home) clientCtx := client.Context{}.WithJSONMarshaler(makeCodec())
require.NoError(t, initCmd.RunE(initCmd, []string{"appnode-test"}))
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx)
cmd := InitCmd(testMbm, home)
cmd.SetArgs([]string{"appnode-test", fmt.Sprintf("--%s=%s", cli.HomeFlag, home)})
require.NoError(t, cmd.ExecuteContext(ctx))
app, err := mock.NewApp(home, logger) app, err := mock.NewApp(home, logger)
require.Nil(t, err) require.NoError(t, err)
svrAddr, _, err := server.FreeTCPAddr() svrAddr, _, err := server.FreeTCPAddr()
require.Nil(t, err) require.NoError(t, err)
svr, err := abciServer.NewServer(svrAddr, "socket", app)
require.Nil(t, err, "error creating listener") svr, err := abci_server.NewServer(svrAddr, "socket", app)
require.NoError(t, err, "error creating listener")
svr.SetLogger(logger.With("module", "abci-server")) svr.SetLogger(logger.With("module", "abci-server"))
err = svr.Start() err = svr.Start()
require.NoError(t, err) require.NoError(t, err)

View File

@ -9,8 +9,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
v036 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v0_36" v036 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v0_36"
@ -55,7 +55,7 @@ func GetMigrationVersions() []string {
} }
// MigrateGenesisCmd returns a command to execute genesis state migration. // MigrateGenesisCmd returns a command to execute genesis state migration.
func MigrateGenesisCmd(_ *server.Context, cdc *codec.Codec) *cobra.Command { func MigrateGenesisCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "migrate [target-version] [genesis-file]", Use: "migrate [target-version] [genesis-file]",
Short: "Migrate genesis to a specified target version", Short: "Migrate genesis to a specified target version",
@ -63,9 +63,12 @@ func MigrateGenesisCmd(_ *server.Context, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z $ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z
`, version.ServerName), `, version.AppName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
var err error var err error
target := args[0] target := args[0]
@ -111,7 +114,7 @@ $ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2
genDoc.ChainID = chainID genDoc.ChainID = chainID
} }
bz, err := cdc.MarshalJSONIndent(genDoc, "", " ") bz, err := codec.MarshalJSONIndent(cdc, genDoc)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to marshal genesis doc") return errors.Wrap(err, "failed to marshal genesis doc")
} }

View File

@ -1,35 +1,17 @@
package cli package cli
import ( import (
"context"
"io/ioutil" "io/ioutil"
"path" "path"
"testing" "testing"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/tests" "github.com/cosmos/cosmos-sdk/tests"
) )
func setupCmd(genesisTime string, chainID string) *cobra.Command {
c := &cobra.Command{
Use: "c",
Args: cobra.ArbitraryArgs,
Run: func(_ *cobra.Command, args []string) {},
}
c.Flags().String(flagGenesisTime, genesisTime, "")
c.Flags().String(flagChainID, chainID, "")
return c
}
func TestGetMigrationCallback(t *testing.T) { func TestGetMigrationCallback(t *testing.T) {
for _, version := range GetMigrationVersions() { for _, version := range GetMigrationVersions() {
require.NotNil(t, GetMigrationCallback(version)) require.NotNil(t, GetMigrationCallback(version))
@ -39,25 +21,28 @@ func TestGetMigrationCallback(t *testing.T) {
func TestMigrateGenesis(t *testing.T) { func TestMigrateGenesis(t *testing.T) {
home, cleanup := tests.NewTestCaseDir(t) home, cleanup := tests.NewTestCaseDir(t)
t.Cleanup(cleanup) t.Cleanup(cleanup)
viper.Set(cli.HomeFlag, home)
viper.Set(flags.FlagName, "moniker")
logger := log.NewNopLogger()
cfg, err := tcmd.ParseConfig()
require.Nil(t, err)
ctx := server.NewContext(viper.New(), cfg, logger)
cdc := makeCodec() cdc := makeCodec()
genesisPath := path.Join(home, "genesis.json") genesisPath := path.Join(home, "genesis.json")
target := "v0.36" target := "v0.36"
cmd := MigrateGenesisCmd()
cmd.SetErr(ioutil.Discard)
cmd.SetOut(ioutil.Discard)
clientCtx := client.Context{}.WithJSONMarshaler(cdc)
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
// Reject if we dont' have the right parameters or genesis does not exists // Reject if we dont' have the right parameters or genesis does not exists
require.Error(t, MigrateGenesisCmd(ctx, cdc).RunE(nil, []string{target, genesisPath})) cmd.SetArgs([]string{target, genesisPath})
require.Error(t, cmd.ExecuteContext(ctx))
// Noop migration with minimal genesis // Noop migration with minimal genesis
emptyGenesis := []byte(`{"chain_id":"test","app_state":{}}`) emptyGenesis := []byte(`{"chain_id":"test","app_state":{}}`)
err = ioutil.WriteFile(genesisPath, emptyGenesis, 0644) require.NoError(t, ioutil.WriteFile(genesisPath, emptyGenesis, 0644))
require.Nil(t, err)
cmd := setupCmd("", "test2") cmd.SetArgs([]string{target, genesisPath})
require.NoError(t, MigrateGenesisCmd(ctx, cdc).RunE(cmd, []string{target, genesisPath})) require.NoError(t, cmd.ExecuteContext(ctx))
// Every migration function shuold tests its own module separately
} }

View File

@ -8,23 +8,27 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/module"
) )
// Validate genesis command takes // Validate genesis command takes
func ValidateGenesisCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module.BasicManager) *cobra.Command { func ValidateGenesisCmd(mbm module.BasicManager) *cobra.Command {
return &cobra.Command{ return &cobra.Command{
Use: "validate-genesis [file]", Use: "validate-genesis [file]",
Args: cobra.RangeArgs(0, 1), Args: cobra.RangeArgs(0, 1),
Short: "validates the genesis file at the default location or at the location passed as an arg", Short: "validates the genesis file at the default location or at the location passed as an arg",
RunE: func(cmd *cobra.Command, args []string) (err error) { RunE: func(cmd *cobra.Command, args []string) (err error) {
serverCtx := server.GetServerContextFromCmd(cmd)
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.JSONMarshaler
// Load default if passed no args, otherwise load passed file // Load default if passed no args, otherwise load passed file
var genesis string var genesis string
if len(args) == 0 { if len(args) == 0 {
genesis = ctx.Config.GenesisFile() genesis = serverCtx.Config.GenesisFile()
} else { } else {
genesis = args[0] genesis = args[0]
} }
@ -45,8 +49,6 @@ func ValidateGenesisCmd(ctx *server.Context, cdc codec.JSONMarshaler, mbm module
return fmt.Errorf("error validating genesis file %s: %s", genesis, err.Error()) return fmt.Errorf("error validating genesis file %s: %s", genesis, err.Error())
} }
// TODO test to make sure initchain doesn't panic
fmt.Printf("File at %s is a valid genesis file\n", genesis) fmt.Printf("File at %s is a valid genesis file\n", genesis)
return nil return nil
}, },

View File

@ -55,7 +55,7 @@ proposal-id by running "%s query gov proposals".
Example: Example:
$ %s query gov proposal 1 $ %s query gov proposal 1
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -94,7 +94,7 @@ $ %s query gov proposals --voter cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
$ %s query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected) $ %s query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected)
$ %s query gov proposals --page=2 --limit=100 $ %s query gov proposals --page=2 --limit=100
`, `,
version.ClientName, version.ClientName, version.ClientName, version.ClientName, version.AppName, version.AppName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -182,7 +182,7 @@ func GetCmdQueryVote(queryRoute string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -252,7 +252,7 @@ Example:
$ %[1]s query gov votes 1 $ %[1]s query gov votes 1
$ %[1]s query gov votes 1 --page=2 --limit=100 $ %[1]s query gov votes 1 --page=2 --limit=100
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -316,7 +316,7 @@ func GetCmdQueryDeposit(queryRoute string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk $ %s query gov deposit 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -379,7 +379,7 @@ You can find the proposal-id by running "%s query gov proposals".
Example: Example:
$ %s query gov deposits 1 $ %s query gov deposits 1
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -437,7 +437,7 @@ the proposal-id by running "%s query gov proposals".
Example: Example:
$ %s query gov tally 1 $ %s query gov tally 1
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -486,7 +486,7 @@ func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query gov params $ %s query gov params
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.NoArgs, Args: cobra.NoArgs,
@ -531,7 +531,7 @@ $ %s query gov param voting
$ %s query gov param tallying $ %s query gov param tallying
$ %s query gov param deposit $ %s query gov param deposit
`, `,
version.ClientName, version.ClientName, version.ClientName, version.AppName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -577,7 +577,7 @@ func GetCmdQueryProposer(queryRoute string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query gov proposer 1 $ %s query gov proposer 1
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -101,7 +101,7 @@ Which is equivalent to:
$ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --deposit="10test" --from mykey $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --deposit="10test" --from mykey
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -154,7 +154,7 @@ find the proposal-id by running "%s query gov proposals".
Example: Example:
$ %s tx gov deposit 1 10stake --from mykey $ %s tx gov deposit 1 10stake --from mykey
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -200,7 +200,7 @@ find the proposal-id by running "%s query gov proposals".
Example: Example:
$ %s tx gov vote 1 yes --from mykey $ %s tx gov vote 1 yes --from mykey
`, `,
version.ClientName, version.ClientName, version.AppName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -18,7 +18,7 @@ import (
// QueryGovParamDeposit is simcli query gov param deposit // QueryGovParamDeposit is simcli query gov param deposit
func QueryGovParamDeposit(f *cli.Fixtures) types.DepositParams { func QueryGovParamDeposit(f *cli.Fixtures) types.DepositParams {
cmd := fmt.Sprintf("%s query gov param deposit %s", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query gov param deposit %s", f.SimdBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var depositParam types.DepositParams var depositParam types.DepositParams
@ -29,7 +29,7 @@ func QueryGovParamDeposit(f *cli.Fixtures) types.DepositParams {
// QueryGovParamVoting is simcli query gov param voting // QueryGovParamVoting is simcli query gov param voting
func QueryGovParamVoting(f *cli.Fixtures) types.VotingParams { func QueryGovParamVoting(f *cli.Fixtures) types.VotingParams {
cmd := fmt.Sprintf("%s query gov param voting %s", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query gov param voting %s", f.SimdBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var votingParam types.VotingParams var votingParam types.VotingParams
@ -40,7 +40,7 @@ func QueryGovParamVoting(f *cli.Fixtures) types.VotingParams {
// QueryGovParamTallying is simcli query gov param tallying // QueryGovParamTallying is simcli query gov param tallying
func QueryGovParamTallying(f *cli.Fixtures) types.TallyParams { func QueryGovParamTallying(f *cli.Fixtures) types.TallyParams {
cmd := fmt.Sprintf("%s query gov param tallying %s", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query gov param tallying %s", f.SimdBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var tallyingParam types.TallyParams var tallyingParam types.TallyParams
@ -51,7 +51,7 @@ func QueryGovParamTallying(f *cli.Fixtures) types.TallyParams {
// QueryGovProposal is simcli query gov proposal // QueryGovProposal is simcli query gov proposal
func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) types.Proposal { func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) types.Proposal {
cmd := fmt.Sprintf("%s query gov proposal %d %v", f.SimcliBinary, proposalID, f.Flags()) cmd := fmt.Sprintf("%s query gov proposal %d %v", f.SimdBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var proposal types.Proposal var proposal types.Proposal
@ -62,7 +62,7 @@ func QueryGovProposal(f *cli.Fixtures, proposalID int, flags ...string) types.Pr
// QueryGovProposals is simcli query gov proposals // QueryGovProposals is simcli query gov proposals
func QueryGovProposals(f *cli.Fixtures, flags ...string) types.Proposals { func QueryGovProposals(f *cli.Fixtures, flags ...string) types.Proposals {
cmd := fmt.Sprintf("%s query gov proposals %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query gov proposals %v", f.SimdBinary, f.Flags())
stdout, stderr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") stdout, stderr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
if strings.Contains(stderr, "no matching proposals found") { if strings.Contains(stderr, "no matching proposals found") {
return types.Proposals{} return types.Proposals{}
@ -77,7 +77,7 @@ func QueryGovProposals(f *cli.Fixtures, flags ...string) types.Proposals {
// QueryGovVote is simcli query gov vote // QueryGovVote is simcli query gov vote
func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags ...string) types.Vote { func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags ...string) types.Vote {
cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.SimcliBinary, proposalID, voter, f.Flags()) cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.SimdBinary, proposalID, voter, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var vote types.Vote var vote types.Vote
@ -88,7 +88,7 @@ func QueryGovVote(f *cli.Fixtures, proposalID int, voter sdk.AccAddress, flags .
// QueryGovVotes is simcli query gov votes // QueryGovVotes is simcli query gov votes
func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []types.Vote { func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []types.Vote {
cmd := fmt.Sprintf("%s query gov votes %d %v", f.SimcliBinary, proposalID, f.Flags()) cmd := fmt.Sprintf("%s query gov votes %d %v", f.SimdBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var votes []types.Vote var votes []types.Vote
@ -99,7 +99,7 @@ func QueryGovVotes(f *cli.Fixtures, proposalID int, flags ...string) []types.Vot
// QueryGovDeposit is simcli query gov deposit // QueryGovDeposit is simcli query gov deposit
func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress, flags ...string) types.Deposit { func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress, flags ...string) types.Deposit {
cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.SimcliBinary, proposalID, depositor, f.Flags()) cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.SimdBinary, proposalID, depositor, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var deposit types.Deposit var deposit types.Deposit
@ -110,7 +110,7 @@ func QueryGovDeposit(f *cli.Fixtures, proposalID int, depositor sdk.AccAddress,
// QueryGovDeposits is simcli query gov deposits // QueryGovDeposits is simcli query gov deposits
func QueryGovDeposits(f *cli.Fixtures, propsalID int, flags ...string) []types.Deposit { func QueryGovDeposits(f *cli.Fixtures, propsalID int, flags ...string) []types.Deposit {
cmd := fmt.Sprintf("%s query gov deposits %d %v", f.SimcliBinary, propsalID, f.Flags()) cmd := fmt.Sprintf("%s query gov deposits %d %v", f.SimdBinary, propsalID, f.Flags())
out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
var deposits []types.Deposit var deposits []types.Deposit
@ -125,7 +125,7 @@ func QueryGovDeposits(f *cli.Fixtures, propsalID int, flags ...string) []types.D
// TxGovSubmitProposal is simcli tx gov submit-proposal // TxGovSubmitProposal is simcli tx gov submit-proposal
func TxGovSubmitProposal(f *cli.Fixtures, from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) { func TxGovSubmitProposal(f *cli.Fixtures, from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx gov submit-proposal %v --keyring-backend=test --from=%s --type=%s", cmd := fmt.Sprintf("%s tx gov submit-proposal %v --keyring-backend=test --from=%s --type=%s",
f.SimcliBinary, f.Flags(), from, typ) f.SimdBinary, f.Flags(), from, typ)
cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit)
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
@ -133,14 +133,14 @@ func TxGovSubmitProposal(f *cli.Fixtures, from, typ, title, description string,
// TxGovDeposit is simcli tx gov deposit // TxGovDeposit is simcli tx gov deposit
func TxGovDeposit(f *cli.Fixtures, proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) { func TxGovDeposit(f *cli.Fixtures, proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx gov deposit %d %s --keyring-backend=test --from=%s %v", cmd := fmt.Sprintf("%s tx gov deposit %d %s --keyring-backend=test --from=%s %v",
f.SimcliBinary, proposalID, amount, from, f.Flags()) f.SimdBinary, proposalID, amount, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxGovVote is simcli tx gov vote // TxGovVote is simcli tx gov vote
func TxGovVote(f *cli.Fixtures, proposalID int, option types.VoteOption, from string, flags ...string) (bool, string, string) { func TxGovVote(f *cli.Fixtures, proposalID int, option types.VoteOption, from string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx gov vote %d %s --keyring-backend=test --from=%s %v", cmd := fmt.Sprintf("%s tx gov vote %d %s --keyring-backend=test --from=%s %v",
f.SimcliBinary, proposalID, option, from, f.Flags()) f.SimdBinary, proposalID, option, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
@ -152,7 +152,7 @@ func TxGovSubmitParamChangeProposal(f *cli.Fixtures,
cmd := fmt.Sprintf( cmd := fmt.Sprintf(
"%s tx gov submit-proposal param-change %s --keyring-backend=test --from=%s %v", "%s tx gov submit-proposal param-change %s --keyring-backend=test --from=%s %v",
f.SimcliBinary, proposalPath, from, f.Flags(), f.SimdBinary, proposalPath, from, f.Flags(),
) )
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
@ -166,7 +166,7 @@ func TxGovSubmitCommunityPoolSpendProposal(f *cli.Fixtures,
cmd := fmt.Sprintf( cmd := fmt.Sprintf(
"%s tx gov submit-proposal community-pool-spend %s --keyring-backend=test --from=%s %v", "%s tx gov submit-proposal community-pool-spend %s --keyring-backend=test --from=%s %v",
f.SimcliBinary, proposalPath, from, f.Flags(), f.SimdBinary, proposalPath, from, f.Flags(),
) )
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)

View File

@ -22,7 +22,7 @@ func NewTransferTxCmd(clientCtx client.Context) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "transfer [src-port] [src-channel] [receiver] [amount]", Use: "transfer [src-port] [src-channel] [receiver] [amount]",
Short: "Transfer a fungible token through IBC", Short: "Transfer a fungible token through IBC",
Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.ClientName), Example: fmt.Sprintf("%s tx ibc-transfer transfer [src-port] [src-channel] [receiver] [amount]", version.AppName),
Args: cobra.ExactArgs(4), Args: cobra.ExactArgs(4),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.InitWithInput(cmd.InOrStdin()) clientCtx = clientCtx.InitWithInput(cmd.InOrStdin())

View File

@ -26,9 +26,9 @@ func GetCmdQueryClientStates(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s query ibc client states $ %s query ibc client states
`, version.ClientName), `, version.AppName),
), ),
Example: fmt.Sprintf("%s query ibc client states", version.ClientName), Example: fmt.Sprintf("%s query ibc client states", version.AppName),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -62,7 +62,7 @@ func GetCmdQueryClientState(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s query ibc client state [client-id] $ %s query ibc client state [client-id]
`, version.ClientName), `, version.AppName),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -96,7 +96,7 @@ func GetCmdQueryConsensusState(clientCtx client.Context) *cobra.Command {
Use: "consensus-state [client-id] [height]", Use: "consensus-state [client-id] [height]",
Short: "Query the consensus state of a client at a given height", Short: "Query the consensus state of a client at a given height",
Long: "Query the consensus state for a particular light client at a given height", Long: "Query the consensus state for a particular light client at a given height",
Example: fmt.Sprintf("%s query ibc client consensus-state [client-id] [height]", version.ClientName), Example: fmt.Sprintf("%s query ibc client consensus-state [client-id] [height]", version.AppName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -133,7 +133,7 @@ func GetCmdQueryHeader(clientCtx client.Context) *cobra.Command {
Use: "header", Use: "header",
Short: "Query the latest header of the running chain", Short: "Query the latest header of the running chain",
Long: "Query the latest Tendermint header of the running chain", Long: "Query the latest Tendermint header of the running chain",
Example: fmt.Sprintf("%s query ibc client header", version.ClientName), Example: fmt.Sprintf("%s query ibc client header", version.AppName),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -159,7 +159,7 @@ func GetCmdNodeConsensusState(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s query ibc client node-state $ %s query ibc client node-state
`, version.ClientName), `, version.AppName),
), ),
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -22,7 +22,7 @@ func GetCmdQueryConnections(clientCtx client.Context) *cobra.Command {
Use: "connections", Use: "connections",
Short: "Query all connections", Short: "Query all connections",
Long: "Query all connections ends from a chain", Long: "Query all connections ends from a chain",
Example: fmt.Sprintf("%s query %s %s connections", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s connections", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -58,7 +58,7 @@ func GetCmdQueryConnection(clientCtx client.Context) *cobra.Command {
Use: "end [connection-id]", Use: "end [connection-id]",
Short: "Query stored connection end", Short: "Query stored connection end",
Long: "Query stored connection end", Long: "Query stored connection end",
Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s end [connection-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -90,7 +90,7 @@ func GetCmdQueryClientConnections(clientCtx client.Context) *cobra.Command {
Use: "path [client-id]", Use: "path [client-id]",
Short: "Query stored client connection paths", Short: "Query stored client connection paths",
Long: "Query stored client connection paths", Long: "Query stored client connection paths",
Example: fmt.Sprintf("%s query %s %s path [client-id]", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s path [client-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()

View File

@ -23,7 +23,7 @@ func NewConnectionOpenInitCmd(clientCtx client.Context) *cobra.Command {
Long: "Initialize a connection on chain A with a given counterparty chain B", Long: "Initialize a connection on chain A with a given counterparty chain B",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s tx %s %s open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json]", "%s tx %s %s open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json]",
version.ClientName, host.ModuleName, types.SubModuleName, version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(5), Args: cobra.ExactArgs(5),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -68,7 +68,7 @@ func NewConnectionOpenTryCmd(clientCtx client.Context) *cobra.Command {
`%s tx %s %s open-try connection-id] [client-id] \ `%s tx %s %s open-try connection-id] [client-id] \
[counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] \ [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] \
[counterparty-versions] [path/to/proof_init.json] [path/tp/proof_consensus.json]`, [counterparty-versions] [path/to/proof_init.json] [path/tp/proof_consensus.json]`,
version.ClientName, host.ModuleName, types.SubModuleName, version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(8), Args: cobra.ExactArgs(8),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -129,7 +129,7 @@ func NewConnectionOpenAckCmd(clientCtx client.Context) *cobra.Command {
Long: "Relay the acceptance of a connection open attempt from chain B to chain A", Long: "Relay the acceptance of a connection open attempt from chain B to chain A",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s tx %s %s open-ack [connection-id] [path/to/proof_try.json] [path/to/proof_consensus.json] [version]", "%s tx %s %s open-ack [connection-id] [path/to/proof_try.json] [path/to/proof_consensus.json] [version]",
version.ClientName, host.ModuleName, types.SubModuleName, version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(4), Args: cobra.ExactArgs(4),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -180,7 +180,7 @@ func NewConnectionOpenConfirmCmd(clientCtx client.Context) *cobra.Command {
Long: "Confirm to chain B that connection is open on chain A", Long: "Confirm to chain B that connection is open on chain A",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s tx %s %s open-confirm [connection-id] [path/to/proof_ack.json]", "%s tx %s %s open-confirm [connection-id] [path/to/proof_ack.json]",
version.ClientName, host.ModuleName, types.SubModuleName, version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -25,7 +25,7 @@ func GetCmdQueryChannels(clientCtx client.Context) *cobra.Command {
Use: "channels", Use: "channels",
Short: "Query all channels", Short: "Query all channels",
Long: "Query all channels from a chain", Long: "Query all channels from a chain",
Example: fmt.Sprintf("%s query %s %s channels", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s channels", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -63,7 +63,7 @@ func GetCmdQueryChannel(clientCtx client.Context) *cobra.Command {
Short: "Query a channel end", Short: "Query a channel end",
Long: "Query an IBC channel end from a port and channel identifiers", Long: "Query an IBC channel end from a port and channel identifiers",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s query %s %s end [port-id] [channel-id]", version.ClientName, host.ModuleName, types.SubModuleName, "%s query %s %s end [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -96,7 +96,7 @@ func GetCmdQueryConnectionChannels(clientCtx client.Context) *cobra.Command {
Use: "connections [connection-id]", Use: "connections [connection-id]",
Short: "Query all channels associated with a connection", Short: "Query all channels associated with a connection",
Long: "Query all channels associated with a connection", Long: "Query all channels associated with a connection",
Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s connections [connection-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -134,7 +134,7 @@ func GetCmdQueryChannelClientState(clientCtx client.Context) *cobra.Command {
Use: "client-state [port-id] [channel-id]", Use: "client-state [port-id] [channel-id]",
Short: "Query the client state associated with a channel", Short: "Query the client state associated with a channel",
Long: "Query the client state associated with a channel, by providing its port and channel identifiers.", Long: "Query the client state associated with a channel, by providing its port and channel identifiers.",
Example: fmt.Sprintf("%s query ibc channel client-state [port-id] [channel-id]", version.ClientName), Example: fmt.Sprintf("%s query ibc channel client-state [port-id] [channel-id]", version.AppName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(_ *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -161,7 +161,7 @@ func GetCmdQueryPacketCommitments(clientCtx client.Context) *cobra.Command {
Use: "packet-commitments [port-id] [channel-id]", Use: "packet-commitments [port-id] [channel-id]",
Short: "Query all packet commitments associated with a channel", Short: "Query all packet commitments associated with a channel",
Long: "Query all packet commitments associated with a channel", Long: "Query all packet commitments associated with a channel",
Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s packet-commitments [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -201,7 +201,7 @@ func GetCmdQueryPacketCommitment(clientCtx client.Context) *cobra.Command {
Short: "Query a packet commitment", Short: "Query a packet commitment",
Long: "Query a packet commitment", Long: "Query a packet commitment",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s query %s %s end [port-id] [channel-id]", version.ClientName, host.ModuleName, types.SubModuleName, "%s query %s %s end [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(3), Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -242,7 +242,7 @@ An unrelayed packet corresponds to:
- Unrelayed packet commitments: when no acknowledgement exists for the given sequence. - Unrelayed packet commitments: when no acknowledgement exists for the given sequence.
- Unrelayed packet acknowledgements: when an acknowledgement exists and a packet commitment also exists.`, - Unrelayed packet acknowledgements: when an acknowledgement exists and a packet commitment also exists.`,
Example: fmt.Sprintf("%s query %s %s unrelayed-packets [port-id] [channel-id] --sequences=1,2,3", version.ClientName, host.ModuleName, types.SubModuleName), Example: fmt.Sprintf("%s query %s %s unrelayed-packets [port-id] [channel-id] --sequences=1,2,3", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init() clientCtx = clientCtx.Init()
@ -294,7 +294,7 @@ func GetCmdQueryNextSequenceReceive(clientCtx client.Context) *cobra.Command {
Short: "Query a next receive sequence", Short: "Query a next receive sequence",
Long: "Query the next receive sequence for a given channel", Long: "Query the next receive sequence for a given channel",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"%s query %s %s next-sequence-receive [port-id] [channel-id]", version.ClientName, host.ModuleName, types.SubModuleName, "%s query %s %s next-sequence-receive [port-id] [channel-id]", version.AppName, host.ModuleName, types.SubModuleName,
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -42,7 +42,7 @@ func GetCmdCreateClient(cdc *codec.Codec) *cobra.Command {
Long: `Create a new tendermint IBC client. Long: `Create a new tendermint IBC client.
- 'trust-level' flag can be a fraction (eg: '1/3') or 'default' - 'trust-level' flag can be a fraction (eg: '1/3') or 'default'
- 'proof-specs' flag can be JSON input, a path to a .json file or 'default'`, - 'proof-specs' flag can be JSON input, a path to a .json file or 'default'`,
Example: fmt.Sprintf("%s tx ibc %s create [client-id] [path/to/consensus_state.json] [trusting_period] [unbonding_period] [max_clock_drift] --trust-level default --proof-specs [path/to/proof-specs.json] --from node0 --home ../node0/<app>cli --chain-id $CID", version.ClientName, ibctmtypes.SubModuleName), Example: fmt.Sprintf("%s tx ibc %s create [client-id] [path/to/consensus_state.json] [trusting_period] [unbonding_period] [max_clock_drift] --trust-level default --proof-specs [path/to/proof-specs.json] --from node0 --home ../node0/<app>cli --chain-id $CID", version.AppName, ibctmtypes.SubModuleName),
Args: cobra.ExactArgs(5), Args: cobra.ExactArgs(5),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
inBuf := bufio.NewReader(cmd.InOrStdin()) inBuf := bufio.NewReader(cmd.InOrStdin())
@ -136,7 +136,7 @@ func GetCmdUpdateClient(cdc *codec.Codec) *cobra.Command {
Long: "update existing tendermint client with a tendermint header", Long: "update existing tendermint client with a tendermint header",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"$ %s tx ibc %s update [client-id] [path/to/header.json] --from node0 --home ../node0/<app>cli --chain-id $CID", "$ %s tx ibc %s update [client-id] [path/to/header.json] --from node0 --home ../node0/<app>cli --chain-id $CID",
version.ClientName, ibctmtypes.SubModuleName, version.AppName, ibctmtypes.SubModuleName,
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -178,7 +178,7 @@ func GetCmdSubmitMisbehaviour(cdc *codec.Codec) *cobra.Command {
Long: "submit a client misbehaviour to invalidate to invalidate previous state roots and prevent future updates", Long: "submit a client misbehaviour to invalidate to invalidate previous state roots and prevent future updates",
Example: fmt.Sprintf( Example: fmt.Sprintf(
"$ %s tx ibc %s misbehaviour [path/to/evidence.json] --from node0 --home ../node0/<app>cli --chain-id $CID", "$ %s tx ibc %s misbehaviour [path/to/evidence.json] --from node0 --home ../node0/<app>cli --chain-id $CID",
version.ClientName, ibctmtypes.SubModuleName, version.AppName, ibctmtypes.SubModuleName,
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -26,7 +26,7 @@ func GetCmdCreateClient(cdc *codec.Codec) *cobra.Command {
Long: strings.TrimSpace(fmt.Sprintf(`create new localhost (loopback) client: Long: strings.TrimSpace(fmt.Sprintf(`create new localhost (loopback) client:
Example: Example:
$ %s tx ibc client localhost create --from node0 --home ../node0/<app>cli --chain-id $CID $ %s tx ibc client localhost create --from node0 --home ../node0/<app>cli --chain-id $CID
`, version.ClientName), `, version.AppName),
), ),
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -13,7 +13,7 @@ import (
// QueryMintingParams returns the current minting parameters // QueryMintingParams returns the current minting parameters
func QueryMintingParams(f *cli.Fixtures, flags ...string) types.Params { func QueryMintingParams(f *cli.Fixtures, flags ...string) types.Params {
cmd := fmt.Sprintf("%s query mint params %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query mint params %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -24,7 +24,7 @@ func QueryMintingParams(f *cli.Fixtures, flags ...string) types.Params {
// QueryInflation returns the current minting inflation value // QueryInflation returns the current minting inflation value
func QueryInflation(f *cli.Fixtures, flags ...string) sdk.Dec { func QueryInflation(f *cli.Fixtures, flags ...string) sdk.Dec {
cmd := fmt.Sprintf("%s query mint inflation %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query mint inflation %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -35,7 +35,7 @@ func QueryInflation(f *cli.Fixtures, flags ...string) sdk.Dec {
// QueryAnnualProvisions returns the current minting annual provisions value // QueryAnnualProvisions returns the current minting annual provisions value
func QueryAnnualProvisions(f *cli.Fixtures, flags ...string) sdk.Dec { func QueryAnnualProvisions(f *cli.Fixtures, flags ...string) sdk.Dec {
cmd := fmt.Sprintf("%s query mint annual-provisions %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query mint annual-provisions %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)

View File

@ -53,7 +53,7 @@ Where proposal.json contains:
"deposit": "1000stake" "deposit": "1000stake"
} }
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -12,7 +12,7 @@ import (
// QuerySigningInfo returns the signing info for a validator // QuerySigningInfo returns the signing info for a validator
func QuerySigningInfo(f *cli.Fixtures, val string) types.ValidatorSigningInfo { func QuerySigningInfo(f *cli.Fixtures, val string) types.ValidatorSigningInfo {
cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.SimcliBinary, val, f.Flags()) cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.SimdBinary, val, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -24,7 +24,7 @@ func QuerySigningInfo(f *cli.Fixtures, val string) types.ValidatorSigningInfo {
// QuerySlashingParams returns query slashing params // QuerySlashingParams returns query slashing params
func QuerySlashingParams(f *cli.Fixtures) types.Params { func QuerySlashingParams(f *cli.Fixtures) types.Params {
cmd := fmt.Sprintf("%s query slashing params %s", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query slashing params %s", f.SimdBinary, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)

View File

@ -55,7 +55,7 @@ func GetCmdQueryValidator(storeName string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query staking validator cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking validator cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -98,7 +98,7 @@ func GetCmdQueryValidators(storeName string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query staking validators $ %s query staking validators
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -135,7 +135,7 @@ func GetCmdQueryValidatorUnbondingDelegations(queryRoute string, cdc *codec.Code
Example: Example:
$ %s query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -182,7 +182,7 @@ func GetCmdQueryValidatorRedelegations(queryRoute string, cdc *codec.Codec) *cob
Example: Example:
$ %s query staking redelegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking redelegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -226,7 +226,7 @@ func GetCmdQueryDelegation(queryRoute string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query staking delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
@ -276,7 +276,7 @@ func GetCmdQueryDelegations(queryRoute string, cdc *codec.Codec) *cobra.Command
Example: Example:
$ %s query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p $ %s query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -321,7 +321,7 @@ func GetCmdQueryValidatorDelegations(queryRoute string, cdc *codec.Codec) *cobra
Example: Example:
$ %s query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -371,7 +371,7 @@ func GetCmdQueryUnbondingDelegation(queryRoute string, cdc *codec.Codec) *cobra.
Example: Example:
$ %s query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
@ -421,7 +421,7 @@ func GetCmdQueryUnbondingDelegations(queryRoute string, cdc *codec.Codec) *cobra
Example: Example:
$ %s query staking unbonding-delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p $ %s query staking unbonding-delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
@ -466,7 +466,7 @@ func GetCmdQueryRedelegation(queryRoute string, cdc *codec.Codec) *cobra.Command
Example: Example:
$ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`, `,
version.ClientName, version.AppName,
), ),
), ),
Args: cobra.ExactArgs(3), Args: cobra.ExactArgs(3),
@ -522,7 +522,7 @@ func GetCmdQueryRedelegations(queryRoute string, cdc *codec.Codec) *cobra.Comman
Example: Example:
$ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p $ %s query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -566,7 +566,7 @@ func GetCmdQueryHistoricalInfo(queryRoute string, cdc *codec.Codec) *cobra.Comma
Example: Example:
$ %s query staking historical-info 5 $ %s query staking historical-info 5
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -610,7 +610,7 @@ func GetCmdQueryPool(storeName string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query staking pool $ %s query staking pool
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -643,7 +643,7 @@ func GetCmdQueryParams(storeName string, cdc *codec.Codec) *cobra.Command {
Example: Example:
$ %s query staking params $ %s query staking params
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -5,12 +5,9 @@ import (
"os" "os"
"strings" "strings"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/spf13/cobra" "github.com/spf13/cobra"
flag "github.com/spf13/pflag" flag "github.com/spf13/pflag"
"github.com/spf13/viper" "github.com/spf13/viper"
cfg "github.com/tendermint/tendermint/config" cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto"
@ -19,11 +16,10 @@ import (
"github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/staking/types"
) )
//__________________________________________________________
var ( var (
defaultTokens = sdk.TokensFromConsensusPower(100) defaultTokens = sdk.TokensFromConsensusPower(100)
defaultAmount = defaultTokens.String() + sdk.DefaultBondDenom defaultAmount = defaultTokens.String() + sdk.DefaultBondDenom
@ -154,7 +150,7 @@ func NewDelegateCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx staking delegate cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 1000stake --from mykey $ %s tx staking delegate cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 1000stake --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -194,7 +190,7 @@ func NewRedelegateCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100stake --from mykey $ %s tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100stake --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -239,7 +235,7 @@ func NewUnbondCmd(clientCtx client.Context) *cobra.Command {
Example: Example:
$ %s tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey $ %s tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey
`, `,
version.ClientName, version.AppName,
), ),
), ),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -15,7 +15,7 @@ import (
// TxStakingCreateValidator is simcli tx staking create-validator // TxStakingCreateValidator is simcli tx staking create-validator
func TxStakingCreateValidator(f *cli.Fixtures, from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) { func TxStakingCreateValidator(f *cli.Fixtures, from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx staking create-validator %v --keyring-backend=test --from=%s"+ cmd := fmt.Sprintf("%s tx staking create-validator %v --keyring-backend=test --from=%s"+
" --pubkey=%s", f.SimcliBinary, f.Flags(), from, consPubKey) " --pubkey=%s", f.SimdBinary, f.Flags(), from, consPubKey)
cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05")
cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10") cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10")
cmd += fmt.Sprintf(" --min-self-delegation=%v", "1") cmd += fmt.Sprintf(" --min-self-delegation=%v", "1")
@ -25,7 +25,7 @@ func TxStakingCreateValidator(f *cli.Fixtures, from, consPubKey string, amount s
// TxStakingEditValidator is simcli tx staking update validator info // TxStakingEditValidator is simcli tx staking update validator info
func TxStakingEditValidator(f *cli.Fixtures, from, moniker, website, identity, details string, flags ...string) (bool, string, string) { func TxStakingEditValidator(f *cli.Fixtures, from, moniker, website, identity, details string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx staking edit-validator %v --keyring-backend=test --from=%s", f.SimcliBinary, f.Flags(), from) cmd := fmt.Sprintf("%s tx staking edit-validator %v --keyring-backend=test --from=%s", f.SimdBinary, f.Flags(), from)
cmd += fmt.Sprintf(" --moniker=%v --website=%s", moniker, website) cmd += fmt.Sprintf(" --moniker=%v --website=%s", moniker, website)
cmd += fmt.Sprintf(" --identity=%s --details=%s", identity, details) cmd += fmt.Sprintf(" --identity=%s --details=%s", identity, details)
@ -35,25 +35,25 @@ func TxStakingEditValidator(f *cli.Fixtures, from, moniker, website, identity, d
// TxStakingUnbond is simcli tx staking unbond // TxStakingUnbond is simcli tx staking unbond
func TxStakingUnbond(f *cli.Fixtures, from, shares string, validator sdk.ValAddress, flags ...string) bool { func TxStakingUnbond(f *cli.Fixtures, from, shares string, validator sdk.ValAddress, flags ...string) bool {
cmd := fmt.Sprintf("%s tx staking unbond --keyring-backend=test %s %v --from=%s %v", cmd := fmt.Sprintf("%s tx staking unbond --keyring-backend=test %s %v --from=%s %v",
f.SimcliBinary, validator, shares, from, f.Flags()) f.SimdBinary, validator, shares, from, f.Flags())
return cli.ExecuteWrite(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWrite(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxStakingDelegate is simcli tx staking delegate // TxStakingDelegate is simcli tx staking delegate
func TxStakingDelegate(f *cli.Fixtures, from, valOperAddr string, amount sdk.Coin, flags ...string) (bool, string, string) { func TxStakingDelegate(f *cli.Fixtures, from, valOperAddr string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx staking delegate %s %v --keyring-backend=test --from=%s %v", f.SimcliBinary, valOperAddr, amount, from, f.Flags()) cmd := fmt.Sprintf("%s tx staking delegate %s %v --keyring-backend=test --from=%s %v", f.SimdBinary, valOperAddr, amount, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// TxStakingRedelegate is simcli tx staking redelegate // TxStakingRedelegate is simcli tx staking redelegate
func TxStakingRedelegate(f *cli.Fixtures, from, srcVal, dstVal string, amount sdk.Coin, flags ...string) (bool, string, string) { func TxStakingRedelegate(f *cli.Fixtures, from, srcVal, dstVal string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx staking redelegate %s %s %v --keyring-backend=test --from=%s %v", f.SimcliBinary, srcVal, dstVal, amount, from, f.Flags()) cmd := fmt.Sprintf("%s tx staking redelegate %s %s %v --keyring-backend=test --from=%s %v", f.SimdBinary, srcVal, dstVal, amount, from, f.Flags())
return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass) return cli.ExecuteWriteRetStdStreams(f.T, cli.AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
} }
// QueryStakingValidator is simcli query staking validator // QueryStakingValidator is simcli query staking validator
func QueryStakingValidator(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) staking.Validator { func QueryStakingValidator(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) staking.Validator {
cmd := fmt.Sprintf("%s query staking validator %s %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking validator %s %v", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -65,7 +65,7 @@ func QueryStakingValidator(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...str
// QueryStakingValidators is simcli query staking validators // QueryStakingValidators is simcli query staking validators
func QueryStakingValidators(f *cli.Fixtures, flags ...string) []staking.Validator { func QueryStakingValidators(f *cli.Fixtures, flags ...string) []staking.Validator {
cmd := fmt.Sprintf("%s query staking validators %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query staking validators %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -77,7 +77,7 @@ func QueryStakingValidators(f *cli.Fixtures, flags ...string) []staking.Validato
// QueryStakingUnbondingDelegationsFrom is simcli query staking unbonding-delegations-from // QueryStakingUnbondingDelegationsFrom is simcli query staking unbonding-delegations-from
func QueryStakingUnbondingDelegationsFrom(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { func QueryStakingUnbondingDelegationsFrom(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation {
cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -89,7 +89,7 @@ func QueryStakingUnbondingDelegationsFrom(f *cli.Fixtures, valAddr sdk.ValAddres
// QueryStakingDelegationsTo is simcli query staking delegations-to // QueryStakingDelegationsTo is simcli query staking delegations-to
func QueryStakingDelegationsTo(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) []staking.Delegation { func QueryStakingDelegationsTo(f *cli.Fixtures, valAddr sdk.ValAddress, flags ...string) []staking.Delegation {
cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -101,7 +101,7 @@ func QueryStakingDelegationsTo(f *cli.Fixtures, valAddr sdk.ValAddress, flags ..
// QueryStakingPool is simcli query staking pool // QueryStakingPool is simcli query staking pool
func QueryStakingPool(f *cli.Fixtures, flags ...string) staking.Pool { func QueryStakingPool(f *cli.Fixtures, flags ...string) staking.Pool {
cmd := fmt.Sprintf("%s query staking pool %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query staking pool %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -113,7 +113,7 @@ func QueryStakingPool(f *cli.Fixtures, flags ...string) staking.Pool {
// QueryStakingParameters is simcli query staking parameters // QueryStakingParameters is simcli query staking parameters
func QueryStakingParameters(f *cli.Fixtures, flags ...string) staking.Params { func QueryStakingParameters(f *cli.Fixtures, flags ...string) staking.Params {
cmd := fmt.Sprintf("%s query staking params %v", f.SimcliBinary, f.Flags()) cmd := fmt.Sprintf("%s query staking params %v", f.SimdBinary, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -125,7 +125,7 @@ func QueryStakingParameters(f *cli.Fixtures, flags ...string) staking.Params {
// QueryStakingDelegation is simcli query staking delegation // QueryStakingDelegation is simcli query staking delegation
func QueryStakingDelegation(f *cli.Fixtures, from string, valAddr sdk.ValAddress, flags ...string) staking.Delegation { func QueryStakingDelegation(f *cli.Fixtures, from string, valAddr sdk.ValAddress, flags ...string) staking.Delegation {
cmd := fmt.Sprintf("%s query staking delegation %s %s %v", f.SimcliBinary, from, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking delegation %s %s %v", f.SimdBinary, from, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -137,7 +137,7 @@ func QueryStakingDelegation(f *cli.Fixtures, from string, valAddr sdk.ValAddress
// QueryStakingDelegations is simcli query staking delegations // QueryStakingDelegations is simcli query staking delegations
func QueryStakingDelegations(f *cli.Fixtures, from string, flags ...string) []staking.Delegation { func QueryStakingDelegations(f *cli.Fixtures, from string, flags ...string) []staking.Delegation {
cmd := fmt.Sprintf("%s query staking delegations %s %v", f.SimcliBinary, from, f.Flags()) cmd := fmt.Sprintf("%s query staking delegations %s %v", f.SimdBinary, from, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -149,7 +149,7 @@ func QueryStakingDelegations(f *cli.Fixtures, from string, flags ...string) []st
// QueryStakingRedelegation is simcli query staking redelegation // QueryStakingRedelegation is simcli query staking redelegation
func QueryStakingRedelegation(f *cli.Fixtures, delAdrr, srcVal, dstVal string, flags ...string) []staking.RedelegationResponse { func QueryStakingRedelegation(f *cli.Fixtures, delAdrr, srcVal, dstVal string, flags ...string) []staking.RedelegationResponse {
cmd := fmt.Sprintf("%s query staking redelegation %v %v %v %v", f.SimcliBinary, delAdrr, srcVal, dstVal, f.Flags()) cmd := fmt.Sprintf("%s query staking redelegation %v %v %v %v", f.SimdBinary, delAdrr, srcVal, dstVal, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -161,7 +161,7 @@ func QueryStakingRedelegation(f *cli.Fixtures, delAdrr, srcVal, dstVal string, f
// QueryStakingRedelegations is simcli query staking redelegation // QueryStakingRedelegations is simcli query staking redelegation
func QueryStakingRedelegations(f *cli.Fixtures, delAdrr string, flags ...string) []staking.RedelegationResponse { func QueryStakingRedelegations(f *cli.Fixtures, delAdrr string, flags ...string) []staking.RedelegationResponse {
cmd := fmt.Sprintf("%s query staking redelegations %v %v", f.SimcliBinary, delAdrr, f.Flags()) cmd := fmt.Sprintf("%s query staking redelegations %v %v", f.SimdBinary, delAdrr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -173,7 +173,7 @@ func QueryStakingRedelegations(f *cli.Fixtures, delAdrr string, flags ...string)
// QueryStakingRedelegationsFrom is simcli query staking redelegations-from // QueryStakingRedelegationsFrom is simcli query staking redelegations-from
func QueryStakingRedelegationsFrom(f *cli.Fixtures, valAddr string, flags ...string) []staking.RedelegationResponse { func QueryStakingRedelegationsFrom(f *cli.Fixtures, valAddr string, flags ...string) []staking.RedelegationResponse {
cmd := fmt.Sprintf("%s query staking redelegations-from %v %v", f.SimcliBinary, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking redelegations-from %v %v", f.SimdBinary, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -185,7 +185,7 @@ func QueryStakingRedelegationsFrom(f *cli.Fixtures, valAddr string, flags ...str
// QueryStakingUnbondingDelegation is simcli query staking unbonding-delegation // QueryStakingUnbondingDelegation is simcli query staking unbonding-delegation
func QueryStakingUnbondingDelegation(f *cli.Fixtures, delAdrr, valAddr string, flags ...string) staking.UnbondingDelegation { func QueryStakingUnbondingDelegation(f *cli.Fixtures, delAdrr, valAddr string, flags ...string) staking.UnbondingDelegation {
cmd := fmt.Sprintf("%s query staking unbonding-delegation %v %v %v", f.SimcliBinary, delAdrr, valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking unbonding-delegation %v %v %v", f.SimdBinary, delAdrr, valAddr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -197,7 +197,7 @@ func QueryStakingUnbondingDelegation(f *cli.Fixtures, delAdrr, valAddr string, f
// QueryStakingUnbondingDelegations is simcli query staking unbonding-delegations // QueryStakingUnbondingDelegations is simcli query staking unbonding-delegations
func QueryStakingUnbondingDelegations(f *cli.Fixtures, delAdrr string, flags ...string) []staking.UnbondingDelegation { func QueryStakingUnbondingDelegations(f *cli.Fixtures, delAdrr string, flags ...string) []staking.UnbondingDelegation {
cmd := fmt.Sprintf("%s query staking unbonding-delegations %v %v", f.SimcliBinary, delAdrr, f.Flags()) cmd := fmt.Sprintf("%s query staking unbonding-delegations %v %v", f.SimdBinary, delAdrr, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
@ -209,7 +209,7 @@ func QueryStakingUnbondingDelegations(f *cli.Fixtures, delAdrr string, flags ...
// QueryStakingHistoricalInfo is simcli query staking historical-info // QueryStakingHistoricalInfo is simcli query staking historical-info
func QueryStakingHistoricalInfo(f *cli.Fixtures, height uint, flags ...string) staking.HistoricalInfo { func QueryStakingHistoricalInfo(f *cli.Fixtures, height uint, flags ...string) staking.HistoricalInfo {
cmd := fmt.Sprintf("%s query staking historical-info %d %v", f.SimcliBinary, height, f.Flags()) cmd := fmt.Sprintf("%s query staking historical-info %d %v", f.SimdBinary, height, f.Flags())
out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "") out, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)