Merge remote-tracking branch 'origin/develop' into rigel/deliver-max-gas
|
@ -245,6 +245,7 @@ IMPROVEMENTS
|
|||
* [cli] [\#2128](https://github.com/cosmos/cosmos-sdk/issues/2128) fixed segfault when exporting directly after `gaiad init`
|
||||
* [cli] [\#1255](https://github.com/cosmos/cosmos-sdk/issues/1255) open KeyBase in read-only mode
|
||||
for query-purpose CLI commands
|
||||
* [docs] Added commands for querying governance deposits, votes and tally
|
||||
|
||||
* Gaia
|
||||
* [x/stake] [#2023](https://github.com/cosmos/cosmos-sdk/pull/2023) Terminate iteration loop in `UpdateBondedValidators` and `UpdateBondedValidatorsFull` when the first revoked validator is encountered and perform a sanity check.
|
||||
|
@ -289,6 +290,7 @@ BUG FIXES
|
|||
* Gaia
|
||||
* [x/stake] Return correct Tendermint validator update set on `EndBlocker` by not
|
||||
including non previously bonded validators that have zero power. [#2189](https://github.com/cosmos/cosmos-sdk/issues/2189)
|
||||
* [docs] Fixed light client section links
|
||||
|
||||
* SDK
|
||||
* [\#1988](https://github.com/cosmos/cosmos-sdk/issues/1988) Make us compile on OpenBSD (disable ledger) [#1988] (https://github.com/cosmos/cosmos-sdk/issues/1988)
|
||||
|
|
|
@ -418,12 +418,12 @@
|
|||
revision = "e5840949ff4fff0c56f9b6a541e22b63581ea9df"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:10b3a599325740c84a7c81f3f3cb2e1fdb70b3ea01b7fa28495567a2519df431"
|
||||
digest = "1:ad9c4c1a4e7875330b1f62906f2830f043a23edb5db997e3a5ac5d3e6eadf80a"
|
||||
name = "github.com/tendermint/go-amino"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "6dcc6ddc143e116455c94b25c1004c99e0d0ca12"
|
||||
version = "v0.14.0"
|
||||
revision = "dc14acf9ef15f85828bfbc561ed9dd9d2a284885"
|
||||
version = "v0.14.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9f8c4c93658315a795ffd3e0c943d39f78067dd8382b8d7bcfaf6686b92f3978"
|
||||
|
@ -434,7 +434,7 @@
|
|||
version = "v0.11.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5b1373b03f39e6f6061cd91f3829100527ebb5f94240c092bf9e5d314b153501"
|
||||
digest = "1:ba2ba7d6a0853472bdb7a64c4f9c1d5f9cba0eb7aac0b024654104387bf5eb57"
|
||||
name = "github.com/tendermint/tendermint"
|
||||
packages = [
|
||||
"abci/client",
|
||||
|
@ -500,8 +500,8 @@
|
|||
"version",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "48ab899923c564bbf2fa2f1244c11cb930e28132"
|
||||
version = "v0.26.1-rc3"
|
||||
revision = "80d0a362500fea2dd089258319075a54e5d40a2d"
|
||||
version = "v0.26.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7886f86064faff6f8d08a3eb0e8c773648ff5a2e27730831e2bfbf07467f6666"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
[[override]]
|
||||
name = "github.com/tendermint/go-amino"
|
||||
version = "v0.14.0"
|
||||
version = "v0.14.1"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/tendermint/iavl"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
[[override]]
|
||||
name = "github.com/tendermint/tendermint"
|
||||
version = "v0.26.1-rc3" # TODO replace w/ 0.26.1
|
||||
version = "v0.26.1"
|
||||
|
||||
## deps without releases:
|
||||
|
||||
|
|
96
Makefile
|
@ -1,15 +1,14 @@
|
|||
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
|
||||
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
|
||||
VERSION := $(shell git describe --tags --long | sed 's/v\(.*\)/\1/')
|
||||
BUILD_TAGS = netgo ledger
|
||||
VERSION := $(subst v,,$(shell git describe --tags --long))
|
||||
BUILD_TAGS = netgo
|
||||
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}"
|
||||
GCC := $(shell command -v gcc 2> /dev/null)
|
||||
LEDGER_ENABLED ?= true
|
||||
UNAME_S := $(shell uname -s)
|
||||
GOTOOLS = \
|
||||
github.com/golang/dep/cmd/dep \
|
||||
github.com/alecthomas/gometalinter \
|
||||
github.com/rakyll/statik
|
||||
GOBIN ?= $(GOPATH)/bin
|
||||
all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test
|
||||
|
||||
########################################
|
||||
|
@ -20,23 +19,30 @@ ci: get_tools get_vendor_deps install test_cover test_lint test
|
|||
########################################
|
||||
### Build/Install
|
||||
|
||||
check-ledger:
|
||||
ifeq ($(LEDGER_ENABLED),true)
|
||||
ifeq ($(UNAME_S),OpenBSD)
|
||||
$(info "OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988)")
|
||||
TMP_BUILD_TAGS := $(BUILD_TAGS)
|
||||
BUILD_TAGS = $(filter-out ledger, $(TMP_BUILD_TAGS))
|
||||
else
|
||||
ifndef GCC
|
||||
$(error "gcc not installed for ledger support, please install or set LEDGER_ENABLED to false in the Makefile")
|
||||
endif
|
||||
endif
|
||||
else
|
||||
TMP_BUILD_TAGS := $(BUILD_TAGS)
|
||||
BUILD_TAGS = $(filter-out ledger, $(TMP_BUILD_TAGS))
|
||||
ifeq ($(OS),Windows_NT)
|
||||
GCCEXE = $(shell where gcc.exe 2> NUL)
|
||||
ifeq ($(GCCEXE),)
|
||||
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
|
||||
else
|
||||
BUILD_TAGS += ledger
|
||||
endif
|
||||
else
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S),OpenBSD)
|
||||
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
|
||||
else
|
||||
GCC = $(shell command -v gcc 2> /dev/null)
|
||||
ifeq ($(GCC),)
|
||||
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
|
||||
else
|
||||
BUILD_TAGS += ledger
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
build: check-ledger update_gaia_lite_docs
|
||||
build:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
go build $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaia/cmd/gaiad
|
||||
go build $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaia/cmd/gaiacli
|
||||
|
@ -60,15 +66,15 @@ endif
|
|||
|
||||
build_examples:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
go build $(BUILD_FLAGS) -o build/basecoind.exe ./examples/basecoin/cmd/basecoind
|
||||
go build $(BUILD_FLAGS) -o build/basecli.exe ./examples/basecoin/cmd/basecli
|
||||
go build $(BUILD_FLAGS) -o build/democoind.exe ./examples/democoin/cmd/democoind
|
||||
go build $(BUILD_FLAGS) -o build/democli.exe ./examples/democoin/cmd/democli
|
||||
go build $(BUILD_FLAGS) -o build/basecoind.exe ./docs/examples/basecoin/cmd/basecoind
|
||||
go build $(BUILD_FLAGS) -o build/basecli.exe ./docs/examples/basecoin/cmd/basecli
|
||||
go build $(BUILD_FLAGS) -o build/democoind.exe ./docs/examples/democoin/cmd/democoind
|
||||
go build $(BUILD_FLAGS) -o build/democli.exe ./docs/examples/democoin/cmd/democli
|
||||
else
|
||||
go build $(BUILD_FLAGS) -o build/basecoind ./examples/basecoin/cmd/basecoind
|
||||
go build $(BUILD_FLAGS) -o build/basecli ./examples/basecoin/cmd/basecli
|
||||
go build $(BUILD_FLAGS) -o build/democoind ./examples/democoin/cmd/democoind
|
||||
go build $(BUILD_FLAGS) -o build/democli ./examples/democoin/cmd/democli
|
||||
go build $(BUILD_FLAGS) -o build/basecoind ./docs/examples/basecoin/cmd/basecoind
|
||||
go build $(BUILD_FLAGS) -o build/basecli ./docs/examples/basecoin/cmd/basecli
|
||||
go build $(BUILD_FLAGS) -o build/democoind ./docs/examples/democoin/cmd/democoind
|
||||
go build $(BUILD_FLAGS) -o build/democli ./docs/examples/democoin/cmd/democli
|
||||
endif
|
||||
|
||||
install: check-ledger update_gaia_lite_docs
|
||||
|
@ -76,10 +82,10 @@ install: check-ledger update_gaia_lite_docs
|
|||
go install $(BUILD_FLAGS) ./cmd/gaia/cmd/gaiacli
|
||||
|
||||
install_examples:
|
||||
go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecoind
|
||||
go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecli
|
||||
go install $(BUILD_FLAGS) ./examples/democoin/cmd/democoind
|
||||
go install $(BUILD_FLAGS) ./examples/democoin/cmd/democli
|
||||
go install $(BUILD_FLAGS) ./docs/examples/basecoin/cmd/basecoind
|
||||
go install $(BUILD_FLAGS) ./docs/examples/basecoin/cmd/basecli
|
||||
go install $(BUILD_FLAGS) ./docs/examples/democoin/cmd/democoind
|
||||
go install $(BUILD_FLAGS) ./docs/examples/democoin/cmd/democli
|
||||
|
||||
install_cosmos-sdk-cli:
|
||||
go install $(BUILD_FLAGS) ./cmd/cosmos-sdk-cli
|
||||
|
@ -101,33 +107,36 @@ check_tools:
|
|||
|
||||
update_tools:
|
||||
@echo "--> Updating tools to correct version"
|
||||
./scripts/get_tools.sh
|
||||
$(MAKE) -C scripts get_tools
|
||||
|
||||
update_dev_tools:
|
||||
@echo "--> Downloading linters (this may take awhile)"
|
||||
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
|
||||
go get -u github.com/tendermint/lint/golint
|
||||
|
||||
get_tools:
|
||||
get_tools: $(GOBIN)/dep $(GOBIN)/gometalinter $(GOBIN)/statik
|
||||
@echo "--> Installing tools"
|
||||
./scripts/get_tools.sh
|
||||
$(MAKE) -C scripts get_tools
|
||||
|
||||
get_dev_tools:
|
||||
$(GOBIN)/%:
|
||||
$(MAKE) -C scripts $(subst $(GOBIN)/,,$(@))
|
||||
|
||||
get_dev_tools: get_tools
|
||||
@echo "--> Downloading linters (this may take awhile)"
|
||||
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
|
||||
go get github.com/tendermint/lint/golint
|
||||
|
||||
get_vendor_deps:
|
||||
get_vendor_deps: get_tools
|
||||
@echo "--> Generating vendor directory via dep ensure"
|
||||
@rm -rf .vendor-new
|
||||
@dep ensure -v -vendor-only
|
||||
|
||||
update_vendor_deps:
|
||||
update_vendor_deps: get_tools
|
||||
@echo "--> Running dep ensure"
|
||||
@rm -rf .vendor-new
|
||||
@dep ensure -v
|
||||
|
||||
draw_deps:
|
||||
draw_deps: get_tools
|
||||
@# requires brew install graphviz or apt-get install graphviz
|
||||
go get github.com/RobotsAndPencils/goviz
|
||||
@goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png
|
||||
|
@ -150,8 +159,8 @@ test_cli:
|
|||
@go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test` -tags=cli_test
|
||||
|
||||
test_examples:
|
||||
@go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/examples/basecoin/cli_test` -tags=cli_test
|
||||
@go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/examples/democoin/cli_test` -tags=cli_test
|
||||
@go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/docs/examples/basecoin/cli_test` -tags=cli_test
|
||||
@go test -count 1 -p 1 `go list github.com/cosmos/cosmos-sdk/docs/examples/democoin/cli_test` -tags=cli_test
|
||||
|
||||
test_unit:
|
||||
@VERSION=$(VERSION) go test $(PACKAGES_NOSIMULATION)
|
||||
|
@ -173,12 +182,7 @@ test_sim_gaia_fast:
|
|||
|
||||
test_sim_gaia_import_export:
|
||||
@echo "Running Gaia import/export simulation. This may take several minutes..."
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=4 -v -timeout 24h
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=11 -v -timeout 24h
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=12 -v -timeout 24h
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=13 -v -timeout 24h
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=414 -v -timeout 24h
|
||||
@go test ./cmd/gaia/app -run TestGaiaImportExport -SimulationEnabled=true -SimulationNumBlocks=50 -SimulationBlockSize=200 -SimulationCommit=true -SimulationSeed=4142 -v -timeout 24h
|
||||
@bash scripts/import-export-sim.sh 50
|
||||
|
||||
test_sim_gaia_multi_seed:
|
||||
@echo "Running multi-seed Gaia simulation. This may take awhile!"
|
||||
|
@ -256,7 +260,7 @@ localnet-stop:
|
|||
# unless there is a reason not to.
|
||||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
|
||||
.PHONY: build build_cosmos-sdk-cli build_examples install install_examples install_cosmos-sdk-cli install_debug dist \
|
||||
check_tools check_dev_tools get_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \
|
||||
check_tools check_dev_tools get_dev_tools get_vendor_deps draw_deps test test_cli test_unit \
|
||||
test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \
|
||||
build-linux build-docker-gaiadnode localnet-start localnet-stop \
|
||||
format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \
|
||||
|
|
20
PENDING.md
|
@ -5,7 +5,9 @@ BREAKING CHANGES
|
|||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [cli] [\#2728](https://github.com/cosmos/cosmos-sdk/pull/2728) Seperate `tx` and `query` subcommands by module
|
||||
* [cli] [\#2727](https://github.com/cosmos/cosmos-sdk/pull/2727) Fix unbonding command flow
|
||||
* [cli] [\#2786](https://github.com/cosmos/cosmos-sdk/pull/2786) Fix redelegation command flow
|
||||
|
||||
* Gaia
|
||||
|
||||
|
@ -18,10 +20,17 @@ BREAKING CHANGES
|
|||
FEATURES
|
||||
|
||||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
* [gov] [\#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Added governance parameter
|
||||
query REST endpoints.
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
|
||||
* [gov][cli] [\#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Added governance
|
||||
parameter query commands.
|
||||
* [stake][cli] [\#2027] Add CLI query command for getting all delegations to a specific validator.
|
||||
|
||||
* Gaia
|
||||
* [x/gov] [#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Implemented querier
|
||||
for getting governance parameters.
|
||||
|
||||
* SDK
|
||||
* [simulator] \#2682 MsgEditValidator now looks at the validator's max rate, thus it now succeeds a significant portion of the time
|
||||
|
@ -37,11 +46,14 @@ IMPROVEMENTS
|
|||
* [\#2749](https://github.com/cosmos/cosmos-sdk/pull/2749) Add --chain-id flag to gaiad testnet
|
||||
|
||||
* Gaia
|
||||
- #2773 Require moniker to be provided on `gaiad init`.
|
||||
- #2672 [Makefile] Updated for better Windows compatibility and ledger support logic, get_tools was rewritten as a cross-compatible Makefile.
|
||||
|
||||
* SDK
|
||||
- [x/mock/simulation] [\#2720] major cleanup, introduction of helper objects, reorganization
|
||||
|
||||
* Tendermint
|
||||
- #2796 Update to go-amino 0.14.1
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
@ -52,9 +64,11 @@ BUG FIXES
|
|||
|
||||
* Gaia
|
||||
* [\#2723] Use `cosmosvalcons` Bech32 prefix in `tendermint show-address`
|
||||
* [\#2742](https://github.com/cosmos/cosmos-sdk/issues/2742) Fix time format of TimeoutCommit override
|
||||
|
||||
* [\#2742](https://github.com/cosmos/cosmos-sdk/issues/2742) Fix time format of TimeoutCommit override
|
||||
|
||||
* SDK
|
||||
|
||||
- \#2733 [x/gov, x/mock/simulation] Fix governance simulation, update x/gov import/export
|
||||
|
||||
* Tendermint
|
||||
* [\#2797](https://github.com/tendermint/tendermint/pull/2797) AddressBook requires addresses to have IDs; Do not crap out immediately after sending pex addrs in seed mode
|
||||
|
|
17
README.md
|
@ -17,27 +17,26 @@ It is being used to build `Gaia`, the first implementation of the [Cosmos Hub](h
|
|||
**WARNING**: The SDK has mostly stabilized, but we are still making some
|
||||
breaking changes.
|
||||
|
||||
**Note**: Requires [Go 1.10+](https://golang.org/dl/)
|
||||
**Note**: Requires [Go 1.11+](https://golang.org/dl/)
|
||||
|
||||
## Gaia Testnet
|
||||
|
||||
To install the binaries, read the [install instructions](./docs/gaia/installation.md)
|
||||
|
||||
To join the latest testnet, follow
|
||||
[the guide](./docs/getting-started/join-testnet.md).
|
||||
[the guide](./docs/gaia/join-testnet.md).
|
||||
|
||||
For status updates and genesis files, see the
|
||||
[testnets repo](https://github.com/cosmos/testnets).
|
||||
|
||||
## Install
|
||||
|
||||
See the
|
||||
[install instructions](./docs/getting-started/installation.md).
|
||||
|
||||
## Quick Start
|
||||
|
||||
See the [Cosmos Docs](https://cosmos.network/docs/)
|
||||
To learn how the SDK works from a high-level perspective, go to the [SDK Intro](./docs/intro/README.md).
|
||||
|
||||
- [Getting started with the SDK](./docs/sdk/core/intro.md)
|
||||
- [SDK Examples](/examples)
|
||||
If you want to get started quickly and learn how to build on top of the SDK, please follow the [SDK Application Tutorial](https://github.com/cosmos/sdk-application-tutorial). You can also fork the tutorial's repo to get started building your own Cosmos SDK application.
|
||||
|
||||
For more, please go to the [Cosmos SDK Docs](./docs/README.md)
|
||||
|
||||
## Disambiguation
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@ package client
|
|||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/spf13/cobra"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
type cliConfig struct {
|
||||
Home string `toml:"home"`
|
||||
ChainID string `toml:"chain_id"`
|
||||
TrustNode bool `toml:"trust_node"`
|
||||
Encoding string `toml:"encoding"`
|
||||
Output string `toml:"output"`
|
||||
Node string `toml:"node"`
|
||||
Trace bool `toml:"trace"`
|
||||
|
@ -41,23 +41,24 @@ func runConfigCmd(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
stdin := BufferStdin()
|
||||
|
||||
gaiaCLIHome, err := handleGaiaCLIHome(home, stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
node, err := handleNode(stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
trustNode, err := handleTrustNode(stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
encoding := "btc"
|
||||
output := "text"
|
||||
var chainID string
|
||||
chainID, err = types.DefaultChainID()
|
||||
chainID, err := types.DefaultChainID()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Couldn't populate ChainID, so using an empty one.")
|
||||
}
|
||||
|
@ -66,8 +67,7 @@ func runConfigCmd(cmd *cobra.Command, args []string) error {
|
|||
Home: gaiaCLIHome,
|
||||
ChainID: chainID,
|
||||
TrustNode: trustNode,
|
||||
Encoding: encoding,
|
||||
Output: output,
|
||||
Output: "text",
|
||||
Node: node,
|
||||
Trace: false,
|
||||
}
|
||||
|
|
|
@ -539,7 +539,7 @@ func TestBonding(t *testing.T) {
|
|||
|
||||
require.Equal(t, int64(40), coins.AmountOf(denom).Int64())
|
||||
|
||||
// query validator
|
||||
// query delegation
|
||||
bond := getDelegation(t, port, addr, operAddrs[0])
|
||||
require.Equal(t, amt, bond.Shares)
|
||||
|
||||
|
@ -547,6 +547,10 @@ func TestBonding(t *testing.T) {
|
|||
require.Len(t, delegatorDels, 1)
|
||||
require.Equal(t, amt, delegatorDels[0].Shares)
|
||||
|
||||
// query all delegations to validator
|
||||
bonds := getValidatorDelegations(t, port, operAddrs[0])
|
||||
require.Len(t, bonds, 2)
|
||||
|
||||
bondedValidators := getDelegatorValidators(t, port, addr)
|
||||
require.Len(t, bondedValidators, 1)
|
||||
require.Equal(t, operAddrs[0], bondedValidators[0].OperatorAddr)
|
||||
|
@ -731,26 +735,33 @@ func TestProposalsQuery(t *testing.T) {
|
|||
cleanup, _, _, port := InitializeTestLCD(t, 1, []sdk.AccAddress{addrs[0], addrs[1]})
|
||||
defer cleanup()
|
||||
|
||||
depositParam := getDepositParam(t, port)
|
||||
halfMinDeposit := depositParam.MinDeposit.AmountOf(stakeTypes.DefaultBondDenom).Int64() / 2
|
||||
getVotingParam(t, port)
|
||||
getTallyingParam(t, port)
|
||||
|
||||
// Addr1 proposes (and deposits) proposals #1 and #2
|
||||
resultTx := doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], 5)
|
||||
resultTx := doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit)
|
||||
var proposalID1 uint64
|
||||
cdc.MustUnmarshalBinaryLengthPrefixed(resultTx.DeliverTx.GetData(), &proposalID1)
|
||||
tests.WaitForHeight(resultTx.Height+1, port)
|
||||
resultTx = doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], 5)
|
||||
|
||||
resultTx = doSubmitProposal(t, port, seeds[0], names[0], passwords[0], addrs[0], halfMinDeposit)
|
||||
var proposalID2 uint64
|
||||
cdc.MustUnmarshalBinaryLengthPrefixed(resultTx.DeliverTx.GetData(), &proposalID2)
|
||||
tests.WaitForHeight(resultTx.Height+1, port)
|
||||
|
||||
// Addr2 proposes (and deposits) proposals #3
|
||||
resultTx = doSubmitProposal(t, port, seeds[1], names[1], passwords[1], addrs[1], 5)
|
||||
resultTx = doSubmitProposal(t, port, seeds[1], names[1], passwords[1], addrs[1], halfMinDeposit)
|
||||
var proposalID3 uint64
|
||||
cdc.MustUnmarshalBinaryLengthPrefixed(resultTx.DeliverTx.GetData(), &proposalID3)
|
||||
tests.WaitForHeight(resultTx.Height+1, port)
|
||||
|
||||
// Addr2 deposits on proposals #2 & #3
|
||||
resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID2, 5)
|
||||
resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID2, halfMinDeposit)
|
||||
tests.WaitForHeight(resultTx.Height+1, port)
|
||||
resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID3, 5)
|
||||
|
||||
resultTx = doDeposit(t, port, seeds[1], names[1], passwords[1], addrs[1], proposalID3, halfMinDeposit)
|
||||
tests.WaitForHeight(resultTx.Height+1, port)
|
||||
|
||||
// check deposits match proposal and individual deposits
|
||||
|
@ -1207,6 +1218,17 @@ func getValidator(t *testing.T, port string, validatorAddr sdk.ValAddress) stake
|
|||
return validator
|
||||
}
|
||||
|
||||
func getValidatorDelegations(t *testing.T, port string, validatorAddr sdk.ValAddress) []stake.Delegation {
|
||||
res, body := Request(t, port, "GET", fmt.Sprintf("/stake/validators/%s/delegations", validatorAddr.String()), nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var delegations []stake.Delegation
|
||||
err := cdc.UnmarshalJSON([]byte(body), &delegations)
|
||||
require.Nil(t, err)
|
||||
|
||||
return delegations
|
||||
}
|
||||
|
||||
func getValidatorUnbondingDelegations(t *testing.T, port string, validatorAddr sdk.ValAddress) []stake.UnbondingDelegation {
|
||||
res, body := Request(t, port, "GET", fmt.Sprintf("/stake/validators/%s/unbonding_delegations", validatorAddr.String()), nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
@ -1231,6 +1253,36 @@ func getValidatorRedelegations(t *testing.T, port string, validatorAddr sdk.ValA
|
|||
|
||||
// ============= Governance Module ================
|
||||
|
||||
func getDepositParam(t *testing.T, port string) gov.DepositParams {
|
||||
res, body := Request(t, port, "GET", "/gov/parameters/deposit", nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var depositParams gov.DepositParams
|
||||
err := cdc.UnmarshalJSON([]byte(body), &depositParams)
|
||||
require.Nil(t, err)
|
||||
return depositParams
|
||||
}
|
||||
|
||||
func getVotingParam(t *testing.T, port string) gov.VotingParams {
|
||||
res, body := Request(t, port, "GET", "/gov/parameters/voting", nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var votingParams gov.VotingParams
|
||||
err := cdc.UnmarshalJSON([]byte(body), &votingParams)
|
||||
require.Nil(t, err)
|
||||
return votingParams
|
||||
}
|
||||
|
||||
func getTallyingParam(t *testing.T, port string) gov.TallyParams {
|
||||
res, body := Request(t, port, "GET", "/gov/parameters/tallying", nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
||||
var tallyParams gov.TallyParams
|
||||
err := cdc.UnmarshalJSON([]byte(body), &tallyParams)
|
||||
require.Nil(t, err)
|
||||
return tallyParams
|
||||
}
|
||||
|
||||
func getProposal(t *testing.T, port string, proposalID uint64) gov.Proposal {
|
||||
res, body := Request(t, port, "GET", fmt.Sprintf("/gov/proposals/%d", proposalID), nil)
|
||||
require.Equal(t, http.StatusOK, res.StatusCode, body)
|
||||
|
|
|
@ -950,6 +950,30 @@ paths:
|
|||
description: Invalid validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/validators/{validatorAddr}/delegations:
|
||||
parameters:
|
||||
- in: path
|
||||
name: validatorAddr
|
||||
description: Bech32 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Get all delegations from a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/validators/{validatorAddr}/unbonding_delegations:
|
||||
parameters:
|
||||
- in: path
|
||||
|
@ -1427,7 +1451,7 @@ paths:
|
|||
/gov/proposals/{proposalId}/votes/{voter}:
|
||||
get:
|
||||
summary: Query vote
|
||||
description: Query vote information by proposalId and voter address
|
||||
description: Query vote information by proposal Id and voter address
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
|
@ -1454,6 +1478,83 @@ paths:
|
|||
description: Found no vote
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/parameters/deposit:
|
||||
get:
|
||||
summary: Query governance deposit parameters
|
||||
description: Query governance deposit parameters. The max_deposit_period units are in nanoseconds.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
min_deposit:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Coin"
|
||||
max_deposit_period:
|
||||
type: string
|
||||
example: "86400000000000"
|
||||
400:
|
||||
description: <other_path> is not a valid query request path
|
||||
404:
|
||||
description: Found no deposit parameters
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/parameters/tallying:
|
||||
get:
|
||||
summary: Query governance tally parameters
|
||||
description: Query governance tally parameters
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
properties:
|
||||
threshold:
|
||||
type: string
|
||||
example: "0.5000000000"
|
||||
veto:
|
||||
type: string
|
||||
example: "0.3340000000"
|
||||
governance_penalty:
|
||||
type: string
|
||||
example: "0.0100000000"
|
||||
400:
|
||||
description: <other_path> is not a valid query request path
|
||||
404:
|
||||
description: Found no tally parameters
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/parameters/voting:
|
||||
get:
|
||||
summary: Query governance voting parameters
|
||||
description: Query governance voting parameters. The voting_period units are in nanoseconds.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
properties:
|
||||
voting_period:
|
||||
type: string
|
||||
example: "86400000000000"
|
||||
400:
|
||||
description: <other_path> is not a valid query request path
|
||||
404:
|
||||
description: Found no voting parameters
|
||||
500:
|
||||
description: Internal Server Error
|
||||
|
||||
definitions:
|
||||
CheckTxResult:
|
||||
|
|
|
@ -4,9 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -16,6 +14,9 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
gapp "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
@ -25,6 +26,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/tests"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
|
@ -22,15 +22,8 @@ func todoNotImplemented(_ *cobra.Command, _ []string) error {
|
|||
return errors.New("todo: Command not yet implemented")
|
||||
}
|
||||
|
||||
// AddCommands adds a number of rpc-related subcommands
|
||||
func AddCommands(cmd *cobra.Command) {
|
||||
cmd.AddCommand(
|
||||
initClientCommand(),
|
||||
statusCommand(),
|
||||
)
|
||||
}
|
||||
|
||||
func initClientCommand() *cobra.Command {
|
||||
// InitClientCommand initializes client commands
|
||||
func InitClientCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "Initialize light client",
|
||||
|
|
|
@ -14,7 +14,8 @@ import (
|
|||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
func statusCommand() *cobra.Command {
|
||||
// StatusCommand returns the status of the network
|
||||
func StatusCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "status",
|
||||
Short: "Query remote node for status",
|
||||
|
|
|
@ -2,20 +2,11 @@ package tx
|
|||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// AddCommands adds a number of tx-query related subcommands
|
||||
func AddCommands(cmd *cobra.Command, cdc *codec.Codec) {
|
||||
cmd.AddCommand(
|
||||
SearchTxCmd(cdc),
|
||||
QueryTxCmd(cdc),
|
||||
)
|
||||
}
|
||||
|
||||
// register REST routes
|
||||
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
|
||||
r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, cliCtx)).Methods("GET")
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
tmversion "github.com/tendermint/tendermint/version"
|
||||
)
|
||||
|
||||
var remoteBasecoinPath = "github.com/cosmos/cosmos-sdk/examples/basecoin"
|
||||
var remoteBasecoinPath = "github.com/cosmos/cosmos-sdk/docs/examples/basecoin"
|
||||
|
||||
// Replacer to replace all instances of basecoin/basecli/BasecoinApp to project specific names
|
||||
// Gets initialized when initCmd is executing after getting the project name from user
|
||||
|
|
|
@ -251,6 +251,8 @@ func (app *GaiaApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci
|
|||
gov.InitGenesis(ctx, app.govKeeper, genesisState.GovData)
|
||||
mint.InitGenesis(ctx, app.mintKeeper, genesisState.MintData)
|
||||
distr.InitGenesis(ctx, app.distrKeeper, genesisState.DistrData)
|
||||
|
||||
// validate genesis state
|
||||
err = GaiaValidateGenesisState(genesisState)
|
||||
if err != nil {
|
||||
panic(err) // TODO find a way to do this w/o panics
|
||||
|
|
|
@ -237,7 +237,7 @@ func TestGaiaCLICreateValidator(t *testing.T) {
|
|||
initialPool.BondedTokens = initialPool.BondedTokens.Add(sdk.NewDec(100)) // Delegate tx on GaiaAppGenState
|
||||
|
||||
// create validator
|
||||
cvStr := fmt.Sprintf("gaiacli tx create-validator %v", flags)
|
||||
cvStr := fmt.Sprintf("gaiacli tx stake create-validator %v", flags)
|
||||
cvStr += fmt.Sprintf(" --from=%s", "bar")
|
||||
cvStr += fmt.Sprintf(" --pubkey=%s", barCeshPubKey)
|
||||
cvStr += fmt.Sprintf(" --amount=%v", fmt.Sprintf("2%s", stakeTypes.DefaultBondDenom))
|
||||
|
@ -268,12 +268,16 @@ func TestGaiaCLICreateValidator(t *testing.T) {
|
|||
barAcc = executeGetAccount(t, fmt.Sprintf("gaiacli query account %s %v", barAddr, flags))
|
||||
require.Equal(t, int64(8), barAcc.GetCoins().AmountOf(stakeTypes.DefaultBondDenom).Int64(), "%v", barAcc)
|
||||
|
||||
validator := executeGetValidator(t, fmt.Sprintf("gaiacli query validator %s --output=json %v", sdk.ValAddress(barAddr), flags))
|
||||
validator := executeGetValidator(t, fmt.Sprintf("gaiacli query stake validator %s --output=json %v", sdk.ValAddress(barAddr), flags))
|
||||
require.Equal(t, validator.OperatorAddr, sdk.ValAddress(barAddr))
|
||||
require.True(sdk.DecEq(t, sdk.NewDec(2), validator.Tokens))
|
||||
|
||||
validatorDelegations := executeGetValidatorDelegations(t, fmt.Sprintf("gaiacli query stake delegations-to %s --output=json %v", sdk.ValAddress(barAddr), flags))
|
||||
require.Len(t, validatorDelegations, 1)
|
||||
require.NotZero(t, validatorDelegations[0].Shares)
|
||||
|
||||
// unbond a single share
|
||||
unbondStr := fmt.Sprintf("gaiacli tx unbond begin %v", flags)
|
||||
unbondStr := fmt.Sprintf("gaiacli tx stake unbond begin %v", flags)
|
||||
unbondStr += fmt.Sprintf(" --from=%s", "bar")
|
||||
unbondStr += fmt.Sprintf(" --validator=%s", sdk.ValAddress(barAddr))
|
||||
unbondStr += fmt.Sprintf(" --shares-amount=%v", "1")
|
||||
|
@ -286,19 +290,19 @@ func TestGaiaCLICreateValidator(t *testing.T) {
|
|||
barAcc = executeGetAccount(t, fmt.Sprintf("gaiacli query account %v %v", barCech, flags))
|
||||
require.Equal(t, int64(9), barAcc.GetCoins().AmountOf(stakeTypes.DefaultBondDenom).Int64(), "%v", barAcc)
|
||||
*/
|
||||
validator = executeGetValidator(t, fmt.Sprintf("gaiacli query validator %s --output=json %v", sdk.ValAddress(barAddr), flags))
|
||||
validator = executeGetValidator(t, fmt.Sprintf("gaiacli query stake validator %s --output=json %v", sdk.ValAddress(barAddr), flags))
|
||||
require.Equal(t, "1.0000000000", validator.Tokens.String())
|
||||
|
||||
validatorUbds := executeGetValidatorUnbondingDelegations(t,
|
||||
fmt.Sprintf("gaiacli query unbonding-delegations-from %s --output=json %v",
|
||||
fmt.Sprintf("gaiacli query stake unbonding-delegations-from %s --output=json %v",
|
||||
sdk.ValAddress(barAddr), flags))
|
||||
require.Len(t, validatorUbds, 1)
|
||||
require.Equal(t, "1", validatorUbds[0].Balance.Amount.String())
|
||||
|
||||
params := executeGetParams(t, fmt.Sprintf("gaiacli query parameters --output=json %v", flags))
|
||||
params := executeGetParams(t, fmt.Sprintf("gaiacli query stake parameters --output=json %v", flags))
|
||||
require.True(t, defaultParams.Equal(params))
|
||||
|
||||
pool := executeGetPool(t, fmt.Sprintf("gaiacli query pool --output=json %v", flags))
|
||||
pool := executeGetPool(t, fmt.Sprintf("gaiacli query stake pool --output=json %v", flags))
|
||||
require.Equal(t, initialPool.BondedTokens, pool.BondedTokens)
|
||||
}
|
||||
|
||||
|
@ -313,16 +317,20 @@ func TestGaiaCLISubmitProposal(t *testing.T) {
|
|||
tests.WaitForTMStart(port)
|
||||
tests.WaitForNextNBlocksTM(2, port)
|
||||
|
||||
executeGetDepositParam(t, fmt.Sprintf("gaiacli query gov param deposit %v", flags))
|
||||
executeGetVotingParam(t, fmt.Sprintf("gaiacli query gov param voting %v", flags))
|
||||
executeGetTallyingParam(t, fmt.Sprintf("gaiacli query gov param tallying %v", flags))
|
||||
|
||||
fooAddr, _ := executeGetAddrPK(t, fmt.Sprintf("gaiacli keys show foo --output=json --home=%s", gaiacliHome))
|
||||
|
||||
fooAcc := executeGetAccount(t, fmt.Sprintf("gaiacli query account %s %v", fooAddr, flags))
|
||||
require.Equal(t, int64(50), fooAcc.GetCoins().AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
|
||||
proposalsQuery, _ := tests.ExecuteT(t, fmt.Sprintf("gaiacli query proposals %v", flags), "")
|
||||
proposalsQuery, _ := tests.ExecuteT(t, fmt.Sprintf("gaiacli query gov proposals %v", flags), "")
|
||||
require.Equal(t, "No matching proposals found", proposalsQuery)
|
||||
|
||||
// submit a test proposal
|
||||
spStr := fmt.Sprintf("gaiacli tx submit-proposal %v", flags)
|
||||
spStr := fmt.Sprintf("gaiacli tx gov submit-proposal %v", flags)
|
||||
spStr += fmt.Sprintf(" --from=%s", "foo")
|
||||
spStr += fmt.Sprintf(" --deposit=%s", fmt.Sprintf("5%s", stakeTypes.DefaultBondDenom))
|
||||
spStr += fmt.Sprintf(" --type=%s", "Text")
|
||||
|
@ -349,19 +357,19 @@ func TestGaiaCLISubmitProposal(t *testing.T) {
|
|||
fooAcc = executeGetAccount(t, fmt.Sprintf("gaiacli query account %s %v", fooAddr, flags))
|
||||
require.Equal(t, int64(45), fooAcc.GetCoins().AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
|
||||
proposal1 := executeGetProposal(t, fmt.Sprintf("gaiacli query proposal --proposal-id=1 --output=json %v", flags))
|
||||
proposal1 := executeGetProposal(t, fmt.Sprintf("gaiacli query gov proposal --proposal-id=1 --output=json %v", flags))
|
||||
require.Equal(t, uint64(1), proposal1.GetProposalID())
|
||||
require.Equal(t, gov.StatusDepositPeriod, proposal1.GetStatus())
|
||||
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query proposals %v", flags), "")
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query gov proposals %v", flags), "")
|
||||
require.Equal(t, " 1 - Test", proposalsQuery)
|
||||
|
||||
deposit := executeGetDeposit(t,
|
||||
fmt.Sprintf("gaiacli query deposit --proposal-id=1 --depositer=%s --output=json %v",
|
||||
fmt.Sprintf("gaiacli query gov deposit --proposal-id=1 --depositer=%s --output=json %v",
|
||||
fooAddr, flags))
|
||||
require.Equal(t, int64(5), deposit.Amount.AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
|
||||
depositStr := fmt.Sprintf("gaiacli tx deposit %v", flags)
|
||||
depositStr := fmt.Sprintf("gaiacli tx gov deposit %v", flags)
|
||||
depositStr += fmt.Sprintf(" --from=%s", "foo")
|
||||
depositStr += fmt.Sprintf(" --deposit=%s", fmt.Sprintf("10%s", stakeTypes.DefaultBondDenom))
|
||||
depositStr += fmt.Sprintf(" --proposal-id=%s", "1")
|
||||
|
@ -381,22 +389,23 @@ func TestGaiaCLISubmitProposal(t *testing.T) {
|
|||
|
||||
// test query deposit
|
||||
deposits := executeGetDeposits(t,
|
||||
fmt.Sprintf("gaiacli query deposits --proposal-id=1 --output=json %v", flags))
|
||||
fmt.Sprintf("gaiacli query gov deposits --proposal-id=1 --output=json %v", flags))
|
||||
require.Len(t, deposits, 1)
|
||||
require.Equal(t, int64(15), deposits[0].Amount.AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
|
||||
deposit = executeGetDeposit(t,
|
||||
fmt.Sprintf("gaiacli query deposit --proposal-id=1 --depositer=%s --output=json %v",
|
||||
fmt.Sprintf("gaiacli query gov deposit --proposal-id=1 --depositer=%s --output=json %v",
|
||||
fooAddr, flags))
|
||||
require.Equal(t, int64(15), deposit.Amount.AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
|
||||
fooAcc = executeGetAccount(t, fmt.Sprintf("gaiacli query account %s %v", fooAddr, flags))
|
||||
|
||||
require.Equal(t, int64(35), fooAcc.GetCoins().AmountOf(stakeTypes.DefaultBondDenom).Int64())
|
||||
proposal1 = executeGetProposal(t, fmt.Sprintf("gaiacli query proposal --proposal-id=1 --output=json %v", flags))
|
||||
proposal1 = executeGetProposal(t, fmt.Sprintf("gaiacli query gov proposal --proposal-id=1 --output=json %v", flags))
|
||||
require.Equal(t, uint64(1), proposal1.GetProposalID())
|
||||
require.Equal(t, gov.StatusVotingPeriod, proposal1.GetStatus())
|
||||
|
||||
voteStr := fmt.Sprintf("gaiacli tx vote %v", flags)
|
||||
voteStr := fmt.Sprintf("gaiacli tx gov vote %v", flags)
|
||||
voteStr += fmt.Sprintf(" --from=%s", "foo")
|
||||
voteStr += fmt.Sprintf(" --proposal-id=%s", "1")
|
||||
voteStr += fmt.Sprintf(" --option=%s", "Yes")
|
||||
|
@ -414,23 +423,23 @@ func TestGaiaCLISubmitProposal(t *testing.T) {
|
|||
executeWrite(t, voteStr, app.DefaultKeyPass)
|
||||
tests.WaitForNextNBlocksTM(2, port)
|
||||
|
||||
vote := executeGetVote(t, fmt.Sprintf("gaiacli query vote --proposal-id=1 --voter=%s --output=json %v", fooAddr, flags))
|
||||
vote := executeGetVote(t, fmt.Sprintf("gaiacli query gov vote --proposal-id=1 --voter=%s --output=json %v", fooAddr, flags))
|
||||
require.Equal(t, uint64(1), vote.ProposalID)
|
||||
require.Equal(t, gov.OptionYes, vote.Option)
|
||||
|
||||
votes := executeGetVotes(t, fmt.Sprintf("gaiacli query votes --proposal-id=1 --output=json %v", flags))
|
||||
votes := executeGetVotes(t, fmt.Sprintf("gaiacli query gov votes --proposal-id=1 --output=json %v", flags))
|
||||
require.Len(t, votes, 1)
|
||||
require.Equal(t, uint64(1), votes[0].ProposalID)
|
||||
require.Equal(t, gov.OptionYes, votes[0].Option)
|
||||
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query proposals --status=DepositPeriod %v", flags), "")
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query gov proposals --status=DepositPeriod %v", flags), "")
|
||||
require.Equal(t, "No matching proposals found", proposalsQuery)
|
||||
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query proposals --status=VotingPeriod %v", flags), "")
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query gov proposals --status=VotingPeriod %v", flags), "")
|
||||
require.Equal(t, " 1 - Test", proposalsQuery)
|
||||
|
||||
// submit a second test proposal
|
||||
spStr = fmt.Sprintf("gaiacli tx submit-proposal %v", flags)
|
||||
spStr = fmt.Sprintf("gaiacli tx gov submit-proposal %v", flags)
|
||||
spStr += fmt.Sprintf(" --from=%s", "foo")
|
||||
spStr += fmt.Sprintf(" --deposit=%s", fmt.Sprintf("5%s", stakeTypes.DefaultBondDenom))
|
||||
spStr += fmt.Sprintf(" --type=%s", "Text")
|
||||
|
@ -440,7 +449,7 @@ func TestGaiaCLISubmitProposal(t *testing.T) {
|
|||
executeWrite(t, spStr, app.DefaultKeyPass)
|
||||
tests.WaitForNextNBlocksTM(2, port)
|
||||
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query proposals --limit=1 %v", flags), "")
|
||||
proposalsQuery, _ = tests.ExecuteT(t, fmt.Sprintf("gaiacli query gov proposals --limit=1 %v", flags), "")
|
||||
require.Equal(t, " 2 - Apples", proposalsQuery)
|
||||
}
|
||||
|
||||
|
@ -553,7 +562,6 @@ func TestGaiaCLIConfig(t *testing.T) {
|
|||
config, err := ioutil.ReadFile(path.Join(gaiacliHome, "config", "config.toml"))
|
||||
require.NoError(t, err)
|
||||
expectedConfig := fmt.Sprintf(`chain_id = "%s"
|
||||
encoding = "btc"
|
||||
home = "%s"
|
||||
node = "%s"
|
||||
output = "text"
|
||||
|
@ -572,7 +580,6 @@ trust_node = true
|
|||
|
||||
// ensure it works without an initialized gaiad state
|
||||
expectedConfig = fmt.Sprintf(`chain_id = ""
|
||||
encoding = "btc"
|
||||
home = "%s"
|
||||
node = "%s"
|
||||
output = "text"
|
||||
|
@ -751,6 +758,15 @@ func executeGetValidatorRedelegations(t *testing.T, cmdStr string) []stake.Redel
|
|||
return reds
|
||||
}
|
||||
|
||||
func executeGetValidatorDelegations(t *testing.T, cmdStr string) []stake.Delegation {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var delegations []stake.Delegation
|
||||
cdc := app.MakeCodec()
|
||||
err := cdc.UnmarshalJSON([]byte(out), &delegations)
|
||||
require.NoError(t, err, "out %v\n, err %v", out, err)
|
||||
return delegations
|
||||
}
|
||||
|
||||
func executeGetPool(t *testing.T, cmdStr string) stake.Pool {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var pool stake.Pool
|
||||
|
@ -772,6 +788,33 @@ func executeGetParams(t *testing.T, cmdStr string) stake.Params {
|
|||
//___________________________________________________________________________________
|
||||
// gov
|
||||
|
||||
func executeGetDepositParam(t *testing.T, cmdStr string) gov.DepositParams {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var depositParam gov.DepositParams
|
||||
cdc := app.MakeCodec()
|
||||
err := cdc.UnmarshalJSON([]byte(out), &depositParam)
|
||||
require.NoError(t, err, "out %v\n, err %v", out, err)
|
||||
return depositParam
|
||||
}
|
||||
|
||||
func executeGetVotingParam(t *testing.T, cmdStr string) gov.VotingParams {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var votingParam gov.VotingParams
|
||||
cdc := app.MakeCodec()
|
||||
err := cdc.UnmarshalJSON([]byte(out), &votingParam)
|
||||
require.NoError(t, err, "out %v\n, err %v", out, err)
|
||||
return votingParam
|
||||
}
|
||||
|
||||
func executeGetTallyingParam(t *testing.T, cmdStr string) gov.TallyParams {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var tallyingParam gov.TallyParams
|
||||
cdc := app.MakeCodec()
|
||||
err := cdc.UnmarshalJSON([]byte(out), &tallyingParam)
|
||||
require.NoError(t, err, "out %v\n, err %v", out, err)
|
||||
return tallyingParam
|
||||
}
|
||||
|
||||
func executeGetProposal(t *testing.T, cmdStr string) gov.Proposal {
|
||||
out, _ := tests.ExecuteT(t, cmdStr, "")
|
||||
var proposal gov.Proposal
|
||||
|
|
|
@ -13,18 +13,10 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/client/lcd"
|
||||
"github.com/cosmos/cosmos-sdk/client/rpc"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
distrcmd "github.com/cosmos/cosmos-sdk/x/distribution/client/cli"
|
||||
govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli"
|
||||
slashingcmd "github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
|
||||
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
||||
|
||||
_ "github.com/cosmos/cosmos-sdk/client/lcd/statik"
|
||||
)
|
||||
|
||||
|
@ -40,7 +32,7 @@ const (
|
|||
var (
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "gaiacli",
|
||||
Short: "Gaia light-client",
|
||||
Short: "Command line interface for interacting with gaiad",
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -57,90 +49,23 @@ func main() {
|
|||
// TODO: setup keybase, viper object, etc. to be passed into
|
||||
// the below functions and eliminate global vars, like we do
|
||||
// with the cdc
|
||||
rootCmd.AddCommand(client.ConfigCmd())
|
||||
|
||||
// add standard rpc commands
|
||||
rpc.AddCommands(rootCmd)
|
||||
|
||||
//Add query commands
|
||||
queryCmd := &cobra.Command{
|
||||
Use: "query",
|
||||
Aliases: []string{"q"},
|
||||
Short: "Querying subcommands",
|
||||
}
|
||||
queryCmd.AddCommand(
|
||||
rpc.BlockCommand(),
|
||||
rpc.ValidatorCommand(),
|
||||
)
|
||||
tx.AddCommands(queryCmd, cdc)
|
||||
queryCmd.AddCommand(client.LineBreak)
|
||||
queryCmd.AddCommand(client.GetCommands(
|
||||
authcmd.GetAccountCmd(storeAcc, cdc, authcmd.GetAccountDecoder(cdc)),
|
||||
stakecmd.GetCmdQueryDelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryDelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryUnbondingDelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryUnbondingDelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryRedelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryRedelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidator(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidators(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidatorUnbondingDelegations(queryRouteStake, cdc),
|
||||
stakecmd.GetCmdQueryValidatorRedelegations(queryRouteStake, cdc),
|
||||
stakecmd.GetCmdQueryParams(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryPool(storeStake, cdc),
|
||||
govcmd.GetCmdQueryProposal(storeGov, cdc),
|
||||
govcmd.GetCmdQueryProposals(storeGov, cdc),
|
||||
govcmd.GetCmdQueryVote(storeGov, cdc),
|
||||
govcmd.GetCmdQueryVotes(storeGov, cdc),
|
||||
govcmd.GetCmdQueryDeposit(storeGov, cdc),
|
||||
govcmd.GetCmdQueryDeposits(storeGov, cdc),
|
||||
slashingcmd.GetCmdQuerySigningInfo(storeSlashing, cdc),
|
||||
)...)
|
||||
|
||||
//Add query commands
|
||||
txCmd := &cobra.Command{
|
||||
Use: "tx",
|
||||
Short: "Transactions subcommands",
|
||||
}
|
||||
|
||||
//Add auth and bank commands
|
||||
txCmd.AddCommand(
|
||||
client.PostCommands(
|
||||
bankcmd.GetBroadcastCommand(cdc),
|
||||
authcmd.GetSignCommand(cdc, authcmd.GetAccountDecoder(cdc)),
|
||||
)...)
|
||||
txCmd.AddCommand(client.LineBreak)
|
||||
|
||||
txCmd.AddCommand(
|
||||
client.PostCommands(
|
||||
stakecmd.GetCmdCreateValidator(cdc),
|
||||
stakecmd.GetCmdEditValidator(cdc),
|
||||
stakecmd.GetCmdDelegate(cdc),
|
||||
stakecmd.GetCmdRedelegate(storeStake, cdc),
|
||||
stakecmd.GetCmdUnbond(storeStake, cdc),
|
||||
distrcmd.GetCmdWithdrawRewards(cdc),
|
||||
distrcmd.GetCmdSetWithdrawAddr(cdc),
|
||||
govcmd.GetCmdDeposit(cdc),
|
||||
bankcmd.SendTxCmd(cdc),
|
||||
govcmd.GetCmdSubmitProposal(cdc),
|
||||
slashingcmd.GetCmdUnjail(cdc),
|
||||
govcmd.GetCmdVote(cdc),
|
||||
)...)
|
||||
// Construct Root Command
|
||||
rootCmd.AddCommand(
|
||||
queryCmd,
|
||||
txCmd,
|
||||
rpc.InitClientCommand(),
|
||||
rpc.StatusCommand(),
|
||||
client.ConfigCmd(),
|
||||
queryCmd(cdc),
|
||||
txCmd(cdc),
|
||||
client.LineBreak,
|
||||
lcd.ServeCommand(cdc),
|
||||
client.LineBreak,
|
||||
)
|
||||
|
||||
// add proxy, version and key info
|
||||
rootCmd.AddCommand(
|
||||
keys.Commands(),
|
||||
client.LineBreak,
|
||||
version.VersionCmd,
|
||||
)
|
||||
|
||||
// prepare and add flags
|
||||
// Add flags and prefix all env exposed with GA
|
||||
executor := cli.PrepareMainCmd(rootCmd, "GA", app.DefaultCLIHome)
|
||||
err := initConfig(rootCmd)
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/rpc"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli"
|
||||
slashingcmd "github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
|
||||
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
)
|
||||
|
||||
func queryCmd(cdc *amino.Codec) *cobra.Command {
|
||||
//Add query commands
|
||||
queryCmd := &cobra.Command{
|
||||
Use: "query",
|
||||
Aliases: []string{"q"},
|
||||
Short: "Querying subcommands",
|
||||
}
|
||||
|
||||
// Group staking queries under a subcommand
|
||||
stakeQueryCmd := &cobra.Command{
|
||||
Use: "stake",
|
||||
Short: "Querying commands for the staking module",
|
||||
}
|
||||
|
||||
stakeQueryCmd.AddCommand(client.GetCommands(
|
||||
stakecmd.GetCmdQueryDelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryDelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryUnbondingDelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryUnbondingDelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryRedelegation(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryRedelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidator(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidators(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidatorDelegations(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryValidatorUnbondingDelegations(queryRouteStake, cdc),
|
||||
stakecmd.GetCmdQueryValidatorRedelegations(queryRouteStake, cdc),
|
||||
stakecmd.GetCmdQueryParams(storeStake, cdc),
|
||||
stakecmd.GetCmdQueryPool(storeStake, cdc))...)
|
||||
|
||||
// Group gov queries under a subcommand
|
||||
govQueryCmd := &cobra.Command{
|
||||
Use: "gov",
|
||||
Short: "Querying commands for the governance module",
|
||||
}
|
||||
|
||||
govQueryCmd.AddCommand(client.GetCommands(
|
||||
govcmd.GetCmdQueryProposal(storeGov, cdc),
|
||||
govcmd.GetCmdQueryProposals(storeGov, cdc),
|
||||
govcmd.GetCmdQueryVote(storeGov, cdc),
|
||||
govcmd.GetCmdQueryVotes(storeGov, cdc),
|
||||
govcmd.GetCmdQueryParams(storeGov, cdc),
|
||||
govcmd.GetCmdQueryDeposit(storeGov, cdc),
|
||||
govcmd.GetCmdQueryDeposits(storeGov, cdc))...)
|
||||
|
||||
// Group slashing queries under a subcommand
|
||||
slashingQueryCmd := &cobra.Command{
|
||||
Use: "slashing",
|
||||
Short: "Querying commands for the slashing module",
|
||||
}
|
||||
|
||||
slashingQueryCmd.AddCommand(client.GetCommands(
|
||||
slashingcmd.GetCmdQuerySigningInfo(storeSlashing, cdc))...)
|
||||
|
||||
// Query commcmmand structure
|
||||
queryCmd.AddCommand(
|
||||
rpc.BlockCommand(),
|
||||
rpc.ValidatorCommand(),
|
||||
tx.SearchTxCmd(cdc),
|
||||
tx.QueryTxCmd(cdc),
|
||||
client.LineBreak,
|
||||
client.GetCommands(authcmd.GetAccountCmd(storeAcc, cdc, authcmd.GetAccountDecoder(cdc)))[0],
|
||||
stakeQueryCmd,
|
||||
govQueryCmd,
|
||||
slashingQueryCmd,
|
||||
)
|
||||
|
||||
return queryCmd
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
distrcmd "github.com/cosmos/cosmos-sdk/x/distribution/client/cli"
|
||||
govcmd "github.com/cosmos/cosmos-sdk/x/gov/client/cli"
|
||||
slashingcmd "github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
|
||||
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
)
|
||||
|
||||
func txCmd(cdc *amino.Codec) *cobra.Command {
|
||||
//Add transaction generation commands
|
||||
txCmd := &cobra.Command{
|
||||
Use: "tx",
|
||||
Short: "Transactions subcommands",
|
||||
}
|
||||
|
||||
stakeTxCmd := &cobra.Command{
|
||||
Use: "stake",
|
||||
Short: "Staking transaction subcommands",
|
||||
}
|
||||
|
||||
stakeTxCmd.AddCommand(client.PostCommands(
|
||||
stakecmd.GetCmdCreateValidator(cdc),
|
||||
stakecmd.GetCmdEditValidator(cdc),
|
||||
stakecmd.GetCmdDelegate(cdc),
|
||||
stakecmd.GetCmdRedelegate(storeStake, cdc),
|
||||
stakecmd.GetCmdUnbond(storeStake, cdc),
|
||||
)...)
|
||||
|
||||
distTxCmd := &cobra.Command{
|
||||
Use: "dist",
|
||||
Short: "Distribution transactions subcommands",
|
||||
}
|
||||
|
||||
distTxCmd.AddCommand(client.PostCommands(
|
||||
distrcmd.GetCmdWithdrawRewards(cdc),
|
||||
distrcmd.GetCmdSetWithdrawAddr(cdc),
|
||||
)...)
|
||||
|
||||
govTxCmd := &cobra.Command{
|
||||
Use: "gov",
|
||||
Short: "Governance transactions subcommands",
|
||||
}
|
||||
|
||||
govTxCmd.AddCommand(client.PostCommands(
|
||||
govcmd.GetCmdDeposit(cdc),
|
||||
govcmd.GetCmdVote(cdc),
|
||||
govcmd.GetCmdSubmitProposal(cdc),
|
||||
)...)
|
||||
|
||||
slashingTxCmd := &cobra.Command{
|
||||
Use: "slashing",
|
||||
Short: "Slashing transactions subcommands",
|
||||
}
|
||||
|
||||
slashingTxCmd.AddCommand(client.PostCommands(
|
||||
slashingcmd.GetCmdUnjail(cdc),
|
||||
)...)
|
||||
|
||||
txCmd.AddCommand(
|
||||
//Add auth and bank commands
|
||||
client.PostCommands(
|
||||
bankcmd.SendTxCmd(cdc),
|
||||
bankcmd.GetBroadcastCommand(cdc),
|
||||
authcmd.GetSignCommand(cdc, authcmd.GetAccountDecoder(cdc)),
|
||||
)...)
|
||||
|
||||
txCmd.AddCommand(
|
||||
client.LineBreak,
|
||||
stakeTxCmd,
|
||||
distTxCmd,
|
||||
govTxCmd,
|
||||
slashingTxCmd,
|
||||
)
|
||||
|
||||
return txCmd
|
||||
}
|
|
@ -51,25 +51,27 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec, appInit server.AppInit) *cob
|
|||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
config := ctx.Config
|
||||
config.SetRoot(viper.GetString(cli.HomeFlag))
|
||||
|
||||
chainID := viper.GetString(client.FlagChainID)
|
||||
if chainID == "" {
|
||||
chainID = fmt.Sprintf("test-chain-%v", common.RandStr(6))
|
||||
}
|
||||
|
||||
nodeID, _, err := InitializeNodeValidatorFiles(config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if viper.GetString(flagMoniker) != "" {
|
||||
config.Moniker = viper.GetString(flagMoniker)
|
||||
}
|
||||
config.Moniker = viper.GetString(flagMoniker)
|
||||
|
||||
var appState json.RawMessage
|
||||
genFile := config.GenesisFile()
|
||||
|
||||
if appState, err = initializeEmptyGenesis(cdc, genFile, chainID,
|
||||
viper.GetBool(flagOverwrite)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = ExportGenesisFile(genFile, chainID, nil, appState); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -91,5 +93,7 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec, appInit server.AppInit) *cob
|
|||
cmd.Flags().BoolP(flagOverwrite, "o", false, "overwrite the genesis.json file")
|
||||
cmd.Flags().String(client.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
|
||||
cmd.Flags().String(flagMoniker, "", "set the validator's moniker")
|
||||
cmd.MarkFlagRequired(flagMoniker)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -2,15 +2,16 @@ package init
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/server/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -28,12 +29,16 @@ func TestInitCmd(t *testing.T) {
|
|||
logger := log.NewNopLogger()
|
||||
cfg, err := tcmd.ParseConfig()
|
||||
require.Nil(t, err)
|
||||
|
||||
ctx := server.NewContext(cfg, logger)
|
||||
cdc := app.MakeCodec()
|
||||
appInit := server.AppInit{
|
||||
AppGenState: mock.AppGenState,
|
||||
}
|
||||
cmd := InitCmd(ctx, cdc, appInit)
|
||||
|
||||
viper.Set(flagMoniker, "gaianode-test")
|
||||
|
||||
err = cmd.RunE(nil, nil)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
@ -53,14 +58,19 @@ func setupClientHome(t *testing.T) func() {
|
|||
func TestEmptyState(t *testing.T) {
|
||||
defer server.SetupViper(t)()
|
||||
defer setupClientHome(t)()
|
||||
|
||||
logger := log.NewNopLogger()
|
||||
cfg, err := tcmd.ParseConfig()
|
||||
require.Nil(t, err)
|
||||
|
||||
ctx := server.NewContext(cfg, logger)
|
||||
cdc := app.MakeCodec()
|
||||
appInit := server.AppInit{
|
||||
AppGenState: mock.AppGenStateEmpty,
|
||||
}
|
||||
|
||||
viper.Set(flagMoniker, "gaianode-test")
|
||||
|
||||
cmd := InitCmd(ctx, cdc, appInit)
|
||||
err = cmd.RunE(nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
@ -69,6 +79,7 @@ func TestEmptyState(t *testing.T) {
|
|||
r, w, _ := os.Pipe()
|
||||
os.Stdout = w
|
||||
cmd = server.ExportCmd(ctx, cdc, nil)
|
||||
|
||||
err = cmd.RunE(nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
@ -12,105 +12,39 @@ module.exports = {
|
|||
nav: [{ text: "Back to Cosmos", link: "https://cosmos.network" }],
|
||||
sidebar: [
|
||||
{
|
||||
title: "Introduction",
|
||||
title: "Overview",
|
||||
collapsable: false,
|
||||
children: [
|
||||
"/introduction/cosmos-hub",
|
||||
"/introduction/tendermint-cosmos",
|
||||
"/introduction/tendermint"
|
||||
"/intro/README",
|
||||
"/intro/sdk-app-architecture",
|
||||
"/intro/ocap"
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Getting Started",
|
||||
title: "Gaia",
|
||||
collapsable: false,
|
||||
children: [
|
||||
"/getting-started/voyager",
|
||||
"/getting-started/installation",
|
||||
"/getting-started/join-testnet",
|
||||
"/getting-started/networks"
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Cosmos SDK",
|
||||
collapsable: false,
|
||||
children: [
|
||||
["/sdk/overview", "Overview"],
|
||||
["/sdk/core/intro", "Core"],
|
||||
"/sdk/core/app1",
|
||||
"/sdk/core/app2",
|
||||
"/sdk/core/app3",
|
||||
"/sdk/core/app4",
|
||||
"/sdk/core/app5",
|
||||
// "/sdk/modules",
|
||||
"/sdk/clients"
|
||||
]
|
||||
},
|
||||
// {
|
||||
// title: "Specifications",
|
||||
// collapsable: false,
|
||||
// children: [
|
||||
// ["/specs/overview", "Overview"],
|
||||
// "/specs/governance",
|
||||
// "/specs/ibc",
|
||||
// "/specs/staking",
|
||||
// "/specs/icts",
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
title: "SDK by Examples - Simple Governance",
|
||||
collapsable: false,
|
||||
children: [
|
||||
["/sdk/sdk-by-examples/simple-governance/intro", "Intro"],
|
||||
"/sdk/sdk-by-examples/simple-governance/setup-and-design",
|
||||
"/sdk/sdk-by-examples/simple-governance/app-init",
|
||||
"/sdk/sdk-by-examples/simple-governance/simple-gov-module",
|
||||
"/sdk/sdk-by-examples/simple-governance/bridging-it-all",
|
||||
"/sdk/sdk-by-examples/simple-governance/running-the-application"
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Light Client",
|
||||
collapsable: false,
|
||||
children: [
|
||||
"/lite/",
|
||||
"/lite/getting_started"
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Lotion JS",
|
||||
collapsable: false,
|
||||
children: [
|
||||
["/lotion/overview", "Overview"]
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Validators",
|
||||
collapsable: false,
|
||||
children: [
|
||||
["/validators/overview", "Overview"],
|
||||
["/validators/security", "Security"],
|
||||
["/validators/validator-setup", "Validator Setup"],
|
||||
"/validators/validator-faq"
|
||||
"/gaia/installation",
|
||||
"/gaia/join-testnet",
|
||||
"/gaia/networks",
|
||||
"/gaia/validators/overview",
|
||||
"/gaia/validators/security",
|
||||
"/gaia/validators/validator-faq",
|
||||
"/gaia/validators/validator-setup",
|
||||
"/gaia/ledger"
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Clients",
|
||||
collapsable: false,
|
||||
children: [
|
||||
["/clients/service-providers", "Service Providers"]
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Resources",
|
||||
collapsable: false,
|
||||
children: [
|
||||
// ["/resources/faq" "General"],
|
||||
"/resources/delegator-faq",
|
||||
["/resources/whitepaper", "Whitepaper - English"],
|
||||
["/resources/whitepaper-ko", "Whitepaper - 한국어"],
|
||||
["/resources/whitepaper-zh-CN", "Whitepaper - 中文"],
|
||||
["/resources/whitepaper-pt", "Whitepaper - Português"]
|
||||
]
|
||||
"/clients/README",
|
||||
"/lite/", // this renders the readme
|
||||
"/lite/getting_started",
|
||||
"/lite/specification",
|
||||
"/clients/cli",
|
||||
"/clients/service-providers"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Docs Build Workflow
|
||||
## Updating the docs
|
||||
|
||||
If you want to open a PR on the Cosmos SDK to update the documentation, please follow the guidelines in the [`CONTRIBUTING.md`](https://github.com/cosmos/cosmos-sdk/tree/master/CONTRIBUTING.md)
|
||||
|
||||
## Docs Build Workflow
|
||||
|
||||
The documentation for the Cosmos SDK is hosted at:
|
||||
|
||||
|
@ -15,34 +19,34 @@ Besides, gaia-lite API docs are also provided by gaia-lite. The default API docs
|
|||
https://localhost:1317/swagger-ui/
|
||||
```
|
||||
|
||||
## How It Works
|
||||
### How It Works
|
||||
|
||||
There is a Jenkins job listening for changes in the `/docs` directory, on both
|
||||
the `master` and `develop` branches. Any updates to files in this directory
|
||||
on those branches will automatically trigger a website deployment. Under the hood,
|
||||
a private website repository has make targets consumed by a standard Jenkins task.
|
||||
|
||||
## README
|
||||
### README
|
||||
|
||||
The [README.md](./README.md) is also the landing page for the documentation
|
||||
on the website. During the Jenkins build, the current commit is added to the bottom
|
||||
of the README.
|
||||
|
||||
## Config.js
|
||||
### Config.js
|
||||
|
||||
The [config.js](./.vuepress/config.js) generates the sidebar and Table of Contents
|
||||
on the website docs. Note the use of relative links and the omission of
|
||||
file extensions. Additional features are available to improve the look
|
||||
of the sidebar.
|
||||
|
||||
## Links
|
||||
### Links
|
||||
|
||||
**NOTE:** Strongly consider the existing links - both within this directory
|
||||
and to the website docs - when moving or deleting files.
|
||||
|
||||
Relative links should be used nearly everywhere, having discovered and weighed the following:
|
||||
|
||||
### Relative
|
||||
#### Relative
|
||||
|
||||
Where is the other file, relative to the current one?
|
||||
|
||||
|
@ -50,7 +54,7 @@ Where is the other file, relative to the current one?
|
|||
- confusing / annoying to have things like: `../../../../myfile.md`
|
||||
- requires more updates when files are re-shuffled
|
||||
|
||||
### Absolute
|
||||
#### Absolute
|
||||
|
||||
Where is the other file, given the root of the repo?
|
||||
|
||||
|
@ -58,12 +62,12 @@ Where is the other file, given the root of the repo?
|
|||
- this is much nicer: `/docs/hereitis/myfile.md`
|
||||
- if you move that file around, the links inside it are preserved (but not to it, of course)
|
||||
|
||||
### Full
|
||||
#### Full
|
||||
|
||||
The full GitHub URL to a file or directory. Used occasionally when it makes sense
|
||||
to send users to the GitHub.
|
||||
|
||||
## Building Locally
|
||||
### Building Locally
|
||||
|
||||
To build and serve the documentation locally, run:
|
||||
|
||||
|
@ -94,12 +98,12 @@ python -m SimpleHTTPServer 8080
|
|||
|
||||
then navigate to localhost:8080 in your browser.
|
||||
|
||||
## Consistency
|
||||
### Consistency
|
||||
|
||||
Because the build processes are identical (as is the information contained herein), this file should be kept in sync as
|
||||
much as possible with its [counterpart in the Tendermint Core repo](https://github.com/tendermint/tendermint/blob/develop/docs/DOCS_README.md).
|
||||
|
||||
## Update and Build the RPC docs
|
||||
### Update and Build the RPC docs
|
||||
|
||||
1. Execute the following command at the root directory to install the swagger-ui generate tool.
|
||||
```
|
||||
|
|
|
@ -1,24 +1,38 @@
|
|||
# Welcome to the Cosmos Docs!
|
||||
# Welcome to the SDK Docs!
|
||||
|
||||
![cosmonaut reading the cosmos docs in space](./graphics/cosmos-docs.jpg)
|
||||
Welcome to the SDK docs!
|
||||
|
||||
Cosmos is a decentralized network of independent parallel blockchains, each powered by classical BFT consensus algorithms like Tendermint.
|
||||
|
||||
The first blockchain in the Cosmos Network is the Cosmos Hub, whose native token is the Atom. Cosmos is a permission-less network, meaning that anybody can build a blockchain on it.
|
||||
![cosmonaut reading the cosmos docs in space](./cosmos-docs.jpg)
|
||||
|
||||
Cosmos can interoperate with multiple other applications and cryptocurrencies. By creating a new zone, you can plug any blockchain system into the Cosmos hub and pass tokens back and forth between those zones, without the need for an intermediary.
|
||||
## Learn the SDK
|
||||
|
||||
## Quick Start
|
||||
### SDK Intro
|
||||
|
||||
- [Getting started with the SDK](./sdk/core/intro.md)
|
||||
- [SDK Examples](../examples)
|
||||
- [Join the testnet](./getting-started/join-testnet.md#run-a-full-node)
|
||||
If you are a newcomer and would like to learn more about the Cosmos SDK, this **[intro](./intro/README.md)** is a good starting place.
|
||||
|
||||
### SDK tutorial
|
||||
|
||||
If you like to learn by doing, you can follow the **[SDK application tutorial](https://github.com/cosmos/sdk-application-tutorial)**. It showcases how to build an SDK-based blockchain from scratch, and teaches you about the basic principles the SDK in the process.
|
||||
|
||||
## Use the SDK
|
||||
|
||||
The following sections contain the information you need if you want to build a fully-functional SDK-based blockchain:
|
||||
|
||||
>*NOTE*: We are currently working on improving the docs. Some info might be missing. If that is the case, try the Cosmos [Forum](https://forum.cosmos.network). Failing that, [open an issue](https://github.com/cosmos/cosmos-sdk/issues/new).
|
||||
|
||||
- [Introduction](./intro/README.md): Contains introductory high-level material on the Cosmos SDK.
|
||||
- [Gaia](./gaia/README.md): Contains all documentation related to the gaia application (current name for the Cosmos-Hub).
|
||||
- [Clients](./clients/README.md): Documentation about SDK clients like the SDK Command-Line interface and the SDK Light-client.
|
||||
- [Specifications](./spec/README.md): Contains SDK and modules specifications.
|
||||
|
||||
If you are reading this on the Cosmos Website, please know that you can find more information on [github](https://github.com/cosmos/cosmos-sdk/tree/develop/docs). Also if you find any issues with the documentation please [*open a Pull Request*](https://github.com/cosmos/cosmos-sdk/compare?expand=1), or at least [*open an Issue*](https://github.com/cosmos/cosmos-sdk/issues/new) to update the docs!
|
||||
|
||||
## Join the public testnet for the Cosmos Hub
|
||||
|
||||
To install the latest version of the `gaia` application and join the public testnet, **click [here](./gaia/README.md#join-the-cosmos-hub-public-testnet)**
|
||||
|
||||
## Edit the Documentation
|
||||
|
||||
See [this file](./DOCS_README.md) for details of the build process and
|
||||
considerations when making changes.
|
||||
|
||||
## Version
|
||||
|
||||
This documentation is built from the following commit:
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
# ADR 002: SDK Documentation Structure
|
||||
|
||||
## Context
|
||||
|
||||
There is a need for a scalable structure of the SDK documentation. Current documentation includes a lot of non-related SDK material, is difficult to maintain and hard to follow as a user.
|
||||
|
||||
Ideally, we would have:
|
||||
- All docs related to dev frameworks or tools live in their respective github repos (sdk repo would contain sdk docs, hub repo would contain hub docs, lotion repo would contain lotion docs, etc.)
|
||||
- All other docs (faqs, whitepaper, high-level material about Cosmos) would live on the website.
|
||||
|
||||
## Decision
|
||||
|
||||
Re-structure the `/docs` folder of the SDK github repo as follows:
|
||||
|
||||
```
|
||||
docs/
|
||||
├── README
|
||||
├── intro/
|
||||
├── gaia/
|
||||
│ ├── overview.md
|
||||
│ ├── install.md
|
||||
│ ├── join-testnet.md
|
||||
│ ├── validator-node.md
|
||||
│ ├── validator-faq.md
|
||||
│ └── delegator-faq.md
|
||||
├── reference/
|
||||
│ ├── baseapp
|
||||
│ ├── types
|
||||
│ ├── store
|
||||
│ ├── server
|
||||
│ ├── modules/
|
||||
│ │ ├── keeper
|
||||
│ │ ├── handler
|
||||
│ │ ├── cli
|
||||
│ ├── gas
|
||||
│ └── commands
|
||||
├── examples/
|
||||
│ ├── basecoin/
|
||||
│ └── democoin/
|
||||
├── clients/
|
||||
│ ├── lite/
|
||||
│ ├── service-providers
|
||||
├── spec/
|
||||
└── architecture/
|
||||
```
|
||||
|
||||
The files in each sub-folders do not matter and will likely change. What matters is the sectioning:
|
||||
|
||||
- `README`: Landing page of the docs.
|
||||
- `into`: Introductory material. Goal is to have a short explainer of the SDK and then channel people to the resource they need. The [sdk-tutorial](https://github.com/cosmos/sdk-application-tutorial/) will be highlighted, as well as the `godocs`.
|
||||
- `gaia`: Contains all docs related to the `gaia` application. Will later be renamed to `cosmos-hub` or `chub` and probably moved to its own repository.
|
||||
- `reference`: Contains high-level explanations of the abstractions of the SDK. It does not contain specific code implementation and does not need to be updated often. **It is not an API specification of the interfaces**. API spec is the `godoc`.
|
||||
- `examples`: Contain a couple examples of sdk application like `basecoin` and `democoin`. Developers need to maintain them up-to-date and make sure they compile as the SDK gets upgraded.
|
||||
- `clients`: Contains specs and info about the various SDK clients.
|
||||
- `spec`: Contains specs of modules, and others.
|
||||
- `architecture`: Contains architecture-related docs like the present one.
|
||||
|
||||
Website docs sidebar will only include the following sections:
|
||||
|
||||
- `README`
|
||||
- `intro`
|
||||
- `gaia`
|
||||
- `reference`
|
||||
- `clients`
|
||||
|
||||
`architecture` and `examples` need not be displayed on the website. As for `modules`, we might need to think about creating a modules manager, but this is out of scope for this document.
|
||||
|
||||
## Status
|
||||
|
||||
Proposed
|
||||
|
||||
## Consequences
|
||||
|
||||
### Positive
|
||||
|
||||
- Much clearer organisation of the SDK docs.
|
||||
- The `/docs` folder now only contains SDK and gaia related material. Later, it will only contain SDK related material.
|
||||
- Developers only have to update `/docs` folder when they open a PR (and not `/examples` for example).
|
||||
- Easier for developers to find what they need to update in the docs thanks to reworked architecture.
|
||||
- Cleaner vuepress build for website docs.
|
||||
- Will help build an executable doc (cf https://github.com/cosmos/cosmos-sdk/issues/2611)
|
||||
|
||||
### Neutral
|
||||
|
||||
- We need to move a bunch of deprecated stuff to `/_attic` folder.
|
||||
- We need to integrate content in `docs/sdk/docs/core` in `reference`.
|
||||
- We need to move all the content that currently lives in `docs` and does not fit in new structure (like `lotion`, intro material, whitepaper) to the website repository.
|
||||
- Update `DOCS_README.md`
|
||||
|
||||
## References
|
||||
|
||||
- https://github.com/cosmos/cosmos-sdk/issues/1460
|
||||
- https://github.com/cosmos/cosmos-sdk/pull/2695
|
||||
- https://github.com/cosmos/cosmos-sdk/issues/2611
|
|
@ -1,22 +0,0 @@
|
|||
# Architecture Decision Records (ADR)
|
||||
|
||||
This is a location to record all high-level architecture decisions in the cosmos-sdk project.
|
||||
|
||||
You can read more about the ADR concept in this [blog post](https://product.reverb.com/documenting-architecture-decisions-the-reverb-way-a3563bb24bd0#.78xhdix6t).
|
||||
|
||||
An ADR should provide:
|
||||
|
||||
- Context on the relevant goals and the current state
|
||||
- Proposed changes to achieve the goals
|
||||
- Summary of pros and cons
|
||||
- References
|
||||
- Changelog
|
||||
|
||||
Note the distinction between an ADR and a spec. The ADR provides the context, intuition, reasoning, and
|
||||
justification for a change in architecture, or for the architecture of something
|
||||
new. The spec is much more compressed and streamlined summary of everything as
|
||||
it stands today.
|
||||
|
||||
If recorded decisions turned out to be lacking, convene a discussion, record the new decisions here, and then modify the code to match.
|
||||
|
||||
Note the context/background should be written in the present tense.
|
|
@ -1,54 +0,0 @@
|
|||
# ADR 001: Global Message Counter
|
||||
|
||||
## Context
|
||||
|
||||
There is a desire for modules to have a concept of orderings between messages.
|
||||
|
||||
One such example is in staking, we currently use an "intra bond tx counter" and
|
||||
bond height.
|
||||
The purpose these two serve is to providing an ordering for validators with equal stake,
|
||||
for usage in the power-ranking of validators.
|
||||
We can't use address here, as that would create a bad incentive to grind
|
||||
addresses that optimized the sort function, which lowers the private key's
|
||||
security.
|
||||
Instead we order by whose transaction appeared first, as tracked by bondHeight
|
||||
and intra bond tx counter.
|
||||
|
||||
This logic however should not be unique to staking.
|
||||
It is very conceivable that many modules in the future will want to be able to
|
||||
know the ordering of messages / objects after they were initially created.
|
||||
|
||||
## Decision
|
||||
|
||||
Create a global message counter field of type int64.
|
||||
Note that with int64's, there is no fear of overflow under normal use,
|
||||
as it is only getting incremented by one,
|
||||
and thus has a space of 9 quintillion values to go through.
|
||||
|
||||
This counter must be persisted in state, but can just be read and written on
|
||||
begin/end block respectively.
|
||||
This field will get incremented upon every DeliverTx,
|
||||
regardless if the transaction succeeds or not.
|
||||
It must also be incremented within the check state for CheckTx.
|
||||
The global message ordering field should be set within the context
|
||||
so that modules can access it.
|
||||
|
||||
## Corollary - Intra block ordering
|
||||
In the event that there is desire to just have an intra block msg counter,
|
||||
this can easily be derived from the global message counter.
|
||||
Simply subtract current counter from first global message counter in the block.
|
||||
Thus the relevant module could easily implement this.
|
||||
|
||||
## Status
|
||||
Proposed
|
||||
|
||||
## Consequences
|
||||
|
||||
### Positive
|
||||
* Moves message ordering out of the set of things staking must keep track of
|
||||
* Abstracts the logic well so other modules can use it
|
||||
|
||||
### Negative
|
||||
* Another thing to implement prelaunch. (Though this should be easy to implement)
|
||||
|
||||
### Neutral
|
|
@ -1,32 +0,0 @@
|
|||
# ADR {ADR-NUMBER}: {TITLE}
|
||||
|
||||
## Changelog
|
||||
* {date}: {changelog}
|
||||
|
||||
## Context
|
||||
> This section contains all the context one needs to understand the current state, and why there is a problem. It should be as succinct as possible and introduce the high level idea behind the solution.
|
||||
|
||||
## Decision
|
||||
> This section explains all of the details of the proposed solution, including implementation details.
|
||||
It should also describe affects / corollary items that may need to be changed as a part of this.
|
||||
If the proposed change will be large, please also indicate a way to do the change to maximize ease of review.
|
||||
(e.g. the optimal split of things to do between separate PR's)
|
||||
|
||||
## Status
|
||||
> A decision may be "proposed" if it hasn't been agreed upon yet, or "accepted" once it is agreed upon. If a later ADR changes or reverses a decision, it may be marked as "deprecated" or "superseded" with a reference to its replacement.
|
||||
|
||||
{Deprecated|Proposed|Accepted}
|
||||
|
||||
## Consequences
|
||||
> This section describes the consequences, after applying the decision. All consequences should be summarized here, not just the "positive" ones.
|
||||
|
||||
### Positive
|
||||
|
||||
### Negative
|
||||
|
||||
### Neutral
|
||||
|
||||
## References
|
||||
> Are there any relevant PR comments, issues that led up to this, or articles referrenced for why we made the given design choice? If so link them here!
|
||||
|
||||
* {reference link}
|
|
@ -0,0 +1,18 @@
|
|||
# Clients
|
||||
|
||||
This section explains contains information on clients for SDK based blockchain.
|
||||
|
||||
>*NOTE*: This section is a WIP.
|
||||
|
||||
## Light-client
|
||||
|
||||
Light-clients enable users to interact with your application without having to download the entire state history but with a good level of security.
|
||||
|
||||
- [Overview of light clients](./lite/README.md)
|
||||
- [Starting a light-client server](./lite/getting_started.md)
|
||||
- [Light-client specification](./lite/specification.md)
|
||||
|
||||
## Other clients
|
||||
|
||||
- [Command-Line interface for SDK-based blockchain](./cli.md)
|
||||
- [Service provider doc](./service-providers.md)
|
|
@ -1,8 +1,3 @@
|
|||
# CLI
|
||||
|
||||
See `gaiacli --help` for more details.
|
||||
|
||||
Also see the [testnet
|
||||
tutorial](https://github.com/cosmos/cosmos-sdk/tree/develop/cmd/gaia/testnets).
|
||||
|
||||
TODO: cleanup the UX and document this properly.
|
||||
> TODO: Rewrite this section to explain how CLI works for a generic SDK app.
|
||||
|
|
|
@ -13,7 +13,7 @@ To start a REST server, we need to specify the following parameters:
|
|||
For example::
|
||||
|
||||
```bash
|
||||
gaiacli rest-server --chain-id=test \
|
||||
gaiacli advanced rest-server --chain-id=test \
|
||||
--laddr=tcp://localhost:1317 \
|
||||
--node tcp://localhost:26657 \
|
||||
--trust-node=false
|
||||
|
@ -22,7 +22,7 @@ gaiacli rest-server --chain-id=test \
|
|||
The server listens on HTTPS by default. You can set the SSL certificate to be used by the server with these additional flags:
|
||||
|
||||
```bash
|
||||
gaiacli rest-server --chain-id=test \
|
||||
gaiacli advanced rest-server --chain-id=test \
|
||||
--laddr=tcp://localhost:1317 \
|
||||
--node tcp://localhost:26657 \
|
||||
--trust-node=false \
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
@ -16,65 +16,61 @@ maintaining any full blockchain nodes.
|
|||
|
||||
### What is a lite Client
|
||||
|
||||
The LCD is split into two separate components. The first component is generic for any Tendermint
|
||||
The Cosmos SDK Light Client (Gaia-lite) is split into two separate components. The first component is generic for any Tendermint
|
||||
based application. It handles the security and connectivity aspects of following the header chain
|
||||
and verify proofs from full nodes against locally trusted validator set. Furthermore it exposes
|
||||
exactly the same API as any Tendermint Core node. The second component is specific for the Cosmos
|
||||
Hub (Gaiad). It works as a query endpoint and exposes the application specific functionality, which
|
||||
Hub (`gaiad`). It works as a query endpoint and exposes the application specific functionality, which
|
||||
can be arbitrary. All queries against the application state have to go through the query endpoint.
|
||||
The advantage of the query endpoint is that it can verify the proofs that the application returns.
|
||||
|
||||
### High-Level Architecture
|
||||
|
||||
An application developer that would like to build a third party integration can ship his application
|
||||
with the LCD for the Cosmos Hub (or any other zone) and only needs to initialise it. Afterwards his
|
||||
application can interact with the zone as if it was running against a full node.
|
||||
|
||||
![high-level](pics/high-level.png)
|
||||
|
||||
An application developer that wants to build an third party application for the Cosmos Hub (or any
|
||||
other zone) should build it against it's canonical API. That API is a combination of multiple parts.
|
||||
An application developer that wants to build a third party client application for the Cosmos Hub (or any
|
||||
other zone) should build it against its canonical API. That API is a combination of multiple parts.
|
||||
All zones have to expose ICS0 (TendermintAPI). Beyond that any zone is free to choose any
|
||||
combination of module APIs, depending on which modules the state machine uses. The Cosmos Hub will
|
||||
initially support ICS0 (TendermintAPI), ICS1 (KeyAPI), ICS20 (TokenAPI), ICS21 (StakingAPI) and
|
||||
ICS22 (GovernanceAPI).
|
||||
initially support [ICS0](https://cosmos.network/rpc/#/ICS0) (TendermintAPI), [ICS1](https://cosmos.network/rpc/#/ICS1) (KeyAPI), [ICS20](https://cosmos.network/rpc/#/ICS20) (TokenAPI), [ICS21](https://cosmos.network/rpc/#/ICS21) (StakingAPI),
|
||||
[ICS22](https://cosmos.network/rpc/#/ICS22) (GovernanceAPI) and [ICS23](https://cosmos.network/rpc/#/ICS23) (SlashingAPI).
|
||||
|
||||
All applications are expected to only run against the LCD. The LCD is the only piece of software
|
||||
![high-level](./pics/high-level.png)
|
||||
|
||||
All applications are expected to only run against Gaia-lite. Gaia-lite is the only piece of software
|
||||
that offers stability guarantees around the zone API.
|
||||
|
||||
### Comparision
|
||||
|
||||
A full node of ABCI is different from its lite client in the following ways:
|
||||
|
||||
|| Full Node | LCD | Description|
|
||||
|| Full Node | Gaia-lite | Description|
|
||||
|-| ------------- | ----- | -------------- |
|
||||
| Execute and verify transactions|Yes|No|Full node will execute and verify all transactions while LCD won't|
|
||||
| Verify and save blocks|Yes|No|Full node will verify and save all blocks while LCD won't|
|
||||
| Participate consensus| Yes|No|Only when the full node is a validtor, it will participate consensus. LCD nodes never participate consensus|
|
||||
| Bandwidth cost|Huge|Little|Full node will receive all blocks. if the bandwidth is limited, it will fall behind the main network. What's more, if it happens to be a validator,it will slow down the consensus process. LCD requires little bandwidth. Only when serving local request, it will cost bandwidth|
|
||||
| Execute and verify transactions|Yes|No|Full node will execute and verify all transactions while Gaia-lite won't|
|
||||
| Verify and save blocks|Yes|No|Full node will verify and save all blocks while Gaia-lite won't|
|
||||
| Participate consensus| Yes|No|Only when the full node is a validtor, it will participate consensus. Lite nodes never participate consensus|
|
||||
| Bandwidth cost|Huge|Little|Full node will receive all blocks. if the bandwidth is limited, it will fall behind the main network. What's more, if it happens to be a validator,it will slow down the consensus process. Light clients requires little bandwidth. Only when serving local request, it will cost bandwidth|
|
||||
| Computing resource|Huge|Little|Full node will execute all transactions and verify all blocks which require much computing resource|
|
||||
| Storage resource|Huge|Little|Full node will save all blocks and ABCI states. LCD just saves validator sets and some checkpoints|
|
||||
| Power consume|Huge|Little|Full nodes have to be deployed on machines which have high performance and will be running all the time. So power consume will be huge. LCD can be deployed on the same machines as users' applications, or on independent machines but with poor performance. Besides, LCD can be shutdown anytime when necessary. So LCD only consume very little power, even mobile devices can meet the power requirement|
|
||||
| Provide APIs|All cosmos APIs|Modular APIs|Full node supports all cosmos APIs. LCD provides modular APIs according to users' configuration|
|
||||
| Secuity level| High|High|Full node will verify all transactions and blocks by itself. LCD can't do this, but it can query any data from other full nodes and verify the data independently. So both full node and LCD don't need to trust any third nodes, they all can achieve high security|
|
||||
| Storage resource|Huge|Little|Full node will save all blocks and ABCI states. Gaia-lite just saves validator sets and some checkpoints|
|
||||
| Power consume|Huge|Little|Full nodes have to be deployed on machines which have high performance and will be running all the time. So power consume will be huge. Gaia-lite can be deployed on the same machines as users' applications, or on independent machines but with poor performance. Besides, lite clients can be shutdown anytime when necessary. So Gaia-lite only consume very little power, even mobile devices can meet the power requirement|
|
||||
| Provide APIs|All cosmos APIs|Modular APIs|Full node supports all cosmos APIs. Gaia-lite provides modular APIs according to users' configuration|
|
||||
| Secuity level| High|High|Full node will verify all transactions and blocks by itself. A light client can't do this, but it can query any data from other full nodes and verify the data independently. So both full nodes and light clients don't need to trust any third nodes, they all can achieve high security|
|
||||
|
||||
According to the above table, LCD can meet all users' functionality and security requirements, but
|
||||
According to the above table, Gaia-lite can meet all users' functionality and security requirements, but
|
||||
only requires little resource on bandwidth, computing, storage and power.
|
||||
|
||||
## Achieving Security
|
||||
|
||||
### Trusted Validator Set
|
||||
|
||||
The base design philosophy of the LCD follows two rules:
|
||||
The base design philosophy of Gaia-lite follows two rules:
|
||||
|
||||
1. **Doesn't trust any blockchain nodes, including validator nodes and other full nodes**
|
||||
2. **Only trusts the whole validator set**
|
||||
|
||||
The original trusted validator set should be prepositioned into its trust store, usually this
|
||||
validator set comes from genesis file. During runtime, if LCD detects a different validator set,
|
||||
validator set comes from genesis file. During runtime, if Gaia-lite detects a different validator set,
|
||||
it will verify it and save new validated validator set to the trust store.
|
||||
|
||||
![validator-set-change](pics/validatorSetChange.png)
|
||||
![validator-set-change](./pics/validatorSetChange.png)
|
||||
|
||||
### Trust Propagation
|
||||
|
||||
|
@ -83,8 +79,8 @@ validator set evolution. Validator set is the foundation of trust, and the trust
|
|||
other blockchain data, such as block and transaction. The propagate architecture is shown as
|
||||
follows:
|
||||
|
||||
![change-process](pics/trustPropagate.png)
|
||||
![change-process](./pics/trustPropagate.png)
|
||||
|
||||
In general, by trusted validator set, LCD can verify each block commit which contains all pre-commit
|
||||
In general, by trusted validator set, a light client can verify each block commit which contains all pre-commit
|
||||
data and block header data. Then the block hash, data hash and appHash are trusted. Based on this
|
||||
and merkle proof, all transactions data and ABCI states can be verified too.
|
|
@ -12,7 +12,7 @@ we need to extract name, height and store root hash from these substores to buil
|
|||
Merkle leaf nodes, then calculate hash from leaf nodes to root. The root hash of the simple Merkle
|
||||
tree is the AppHash which will be included in block header.
|
||||
|
||||
![Simple Merkle Tree](pics/simpleMerkleTree.png)
|
||||
![Simple Merkle Tree](./pics/simpleMerkleTree.png)
|
||||
|
||||
As we have discussed in [LCD trust-propagation](https://github.com/irisnet/cosmos-sdk/tree/bianjie/lcd_spec/docs/spec/lcd#trust-propagation),
|
||||
the AppHash can be verified by checking voting power against a trusted validator set. Here we just
|
||||
|
@ -65,7 +65,7 @@ type KeyExistsProof struct {
|
|||
The data structure of exist proof is shown as above. The process to build and verify existance proof
|
||||
is shown as follows:
|
||||
|
||||
![Exist Proof](pics/existProof.png)
|
||||
![Exist Proof](./pics/existProof.png)
|
||||
|
||||
Steps to build proof:
|
||||
|
||||
|
@ -92,12 +92,12 @@ the postition of the target key in the whole key set of this IAVL tree. As shown
|
|||
out the left key and the right key. If we can demonstrate that both left key and right key
|
||||
definitely exist, and they are adjacent nodes. Thus the target key definitely doesn't exist.
|
||||
|
||||
![Absence Proof1](pics/absence1.png)
|
||||
![Absence Proof1](./pics/absence1.png)
|
||||
|
||||
If the target key is larger than the right most leaf node or less than the left most key, then the
|
||||
target key definitely doesn't exist.
|
||||
|
||||
![Absence Proof2](pics/absence2.png)![Absence Proof3](pics/absence3.png)
|
||||
![Absence Proof2](./pics/absence2.png)![Absence Proof3](./pics/absence3.png)
|
||||
|
||||
```go
|
||||
type proofLeafNode struct {
|
||||
|
@ -147,7 +147,7 @@ in commitID equals to proof RootHash. If not, the proof is invalid. Then sort th
|
|||
commitInfo array by the hash of substore name. Finally, build the simple Merkle tree with all
|
||||
substore commitInfo array and verify if the Merkle root hash equal to appHash.
|
||||
|
||||
![substore proof](pics/substoreProof.png)
|
||||
![substore proof](./pics/substoreProof.png)
|
||||
|
||||
```go
|
||||
func SimpleHashFromTwoHashes(left []byte, right []byte) []byte {
|
||||
|
@ -187,7 +187,7 @@ Above sections refer appHash frequently. But where does the trusted appHash come
|
|||
appHash exist in block header, so next we need to verify blocks header at specific height against
|
||||
LCD trusted validator set. The validation flow is shown as follows:
|
||||
|
||||
![commit verification](pics/commitValidation.png)
|
||||
![commit verification](./pics/commitValidation.png)
|
||||
|
||||
When the trusted validator set doesn't match the block header, we need to try to update our
|
||||
validator set to the height of this block. LCD have a rule that each validator set change should not
|
||||
|
@ -198,7 +198,7 @@ validator set update be accomplished.
|
|||
|
||||
For instance:
|
||||
|
||||
![Update validator set to height](pics/updateValidatorToHeight.png)
|
||||
![Update validator set to height](./pics/updateValidatorToHeight.png)
|
||||
|
||||
* Update to 10000, tooMuchChangeErr
|
||||
* Update to 5050, tooMuchChangeErr
|
|
@ -1,6 +0,0 @@
|
|||
# REST
|
||||
|
||||
See `gaiacli rest-server --help` for more.
|
||||
|
||||
Also see the
|
||||
[work in progress API specification](https://github.com/cosmos/cosmos-sdk/pull/1314)
|
|
@ -83,7 +83,7 @@ It will display all the available commands. For each command, you can use the `-
|
|||
|
||||
## Setting up the Rest Server
|
||||
|
||||
The Rest Server acts as an intermediary between the front-end and the full-node. You don't need to run the Rest Server on the same machine as the full-node. If you intend to run the Rest Server on another machine, you need to go through the [Installation and configuration](#installation-and-configuration) again on this machine.
|
||||
The Rest Server acts as an intermediary between the front-end and the full-node. You don't need to run the Rest Server on the same machine as the full-node.
|
||||
|
||||
To start the Rest server:
|
||||
|
||||
|
@ -109,4 +109,6 @@ The Rest API documents all the available endpoints that you can use to interract
|
|||
|
||||
The API is divided into ICS standards for each category of endpoints. For example, the [ICS20](https://cosmos.network/rpc/#/ICS20/) describes the API to interact with tokens.
|
||||
|
||||
To give more flexibility to implementers, we have separated the different steps that are involved in the process of sending transactions. You will be able to generate unsigned transactions (example with [coin transfer](https://cosmos.network/rpc/#/ICS20/post_bank_accounts__address__transfers)), [sign](https://cosmos.network/rpc/#/ICS20/post_tx_sign) and [broadcast](https://cosmos.network/rpc/#/ICS20/post_tx_broadcast) them with different API endpoints. This allows service providers to use their own signing mechanism for instance.
|
||||
To give more flexibility to implementers, we have included the ability to generate unsigned transactions, [sign](https://cosmos.network/rpc/#/ICS20/post_tx_sign) and [broadcast](https://cosmos.network/rpc/#/ICS20/post_tx_broadcast) them with different API endpoints. This allows service providers to use their own signing mechanism for instance.
|
||||
|
||||
In order to generate an unsigned transaction (example with [coin transfer](https://cosmos.network/rpc/#/ICS20/post_bank_accounts__address__transfers)), you need to use the flag `?generate_only`.
|
||||
|
|
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 283 KiB |
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
|
@ -5,7 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
|
@ -7,8 +7,8 @@ import (
|
|||
_ "github.com/cosmos/cosmos-sdk/client/lcd/statik"
|
||||
"github.com/cosmos/cosmos-sdk/client/rpc"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
|
@ -39,10 +39,14 @@ func main() {
|
|||
// with the cdc.
|
||||
|
||||
// add standard rpc, and tx commands
|
||||
rpc.AddCommands(rootCmd)
|
||||
rootCmd.AddCommand(client.LineBreak)
|
||||
tx.AddCommands(rootCmd, cdc)
|
||||
rootCmd.AddCommand(client.LineBreak)
|
||||
rootCmd.AddCommand(
|
||||
rpc.InitClientCommand(),
|
||||
rpc.StatusCommand(),
|
||||
client.LineBreak,
|
||||
tx.SearchTxCmd(cdc),
|
||||
tx.QueryTxCmd(cdc),
|
||||
client.LineBreak,
|
||||
)
|
||||
|
||||
// add query/post commands (custom to binary)
|
||||
rootCmd.AddCommand(
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
|
@ -17,11 +17,11 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/pow"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/simplestake"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/sketchy"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/pow"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/simplestake"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/sketchy"
|
||||
)
|
||||
|
||||
const (
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
|
@ -3,10 +3,11 @@ package clitest
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/tests"
|
||||
"github.com/stretchr/testify/require"
|
|
@ -16,11 +16,11 @@ import (
|
|||
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/types"
|
||||
coolcmd "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool/client/cli"
|
||||
powcmd "github.com/cosmos/cosmos-sdk/examples/democoin/x/pow/client/cli"
|
||||
simplestakingcmd "github.com/cosmos/cosmos-sdk/examples/democoin/x/simplestake/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/types"
|
||||
coolcmd "github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool/client/cli"
|
||||
powcmd "github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/pow/client/cli"
|
||||
simplestakingcmd "github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/simplestake/client/cli"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
@ -52,10 +52,15 @@ func main() {
|
|||
// with the cdc
|
||||
|
||||
// add standard rpc, and tx commands
|
||||
rpc.AddCommands(rootCmd)
|
||||
rootCmd.AddCommand(client.LineBreak)
|
||||
tx.AddCommands(rootCmd, cdc)
|
||||
rootCmd.AddCommand(client.LineBreak)
|
||||
|
||||
rootCmd.AddCommand(
|
||||
rpc.InitClientCommand(),
|
||||
rpc.StatusCommand(),
|
||||
client.LineBreak,
|
||||
tx.SearchTxCmd(cdc),
|
||||
tx.QueryTxCmd(cdc),
|
||||
client.LineBreak,
|
||||
)
|
||||
|
||||
// add query/post commands (custom to binary)
|
||||
// start with commands common to basecoin
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
gaiaInit "github.com/cosmos/cosmos-sdk/cmd/gaia/init"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
|
@ -5,8 +5,8 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/pow"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/pow"
|
||||
)
|
||||
|
||||
var _ auth.Account = (*AppAccount)(nil)
|
|
@ -10,7 +10,7 @@ import (
|
|||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/mock"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/mock"
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/examples/democoin/x/cool"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|