Skip to content

Commit 56c3ae4

Browse files
authored
Merge branch 'develop' into fedekunze/README
2 parents c155a82 + 9b246ec commit 56c3ae4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3517
-2132
lines changed

CHANGELOG.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
# Changelog
22

3-
## 0.13.0 (TBD)
3+
## 0.13.1 (April 3, 2018)
4+
5+
BUG FIXES
6+
7+
* [x/ibc] Fix CLI and relay for IBC txs
8+
* [x/stake] Various fixes/improvements
9+
10+
## 0.13.0 (April 2, 2018)
411

512
BREAKING CHANGES
613

7-
* [baseapp] `AddRoute` takes an `InitGenesis` function for per-module
8-
initialization
914
* [basecoin] Remove cool/sketchy modules -> moved to new `democoin`
1015
* [basecoin] NewBasecoinApp takes a `map[string]dbm.DB` as temporary measure
1116
to allow mounting multiple stores with their own DB until they can share one
12-
* [staking] Renamed to `simplestake`
17+
* [x/staking] Renamed to `simplestake`
1318
* [builder] Functions don't take `passphrase` as argument
1419
* [server] GenAppState returns generated seed and address
1520
* [basecoind] `init` command outputs JSON of everything necessary for testnet
1621
* [basecoind] `basecoin.db -> data/basecoin.db`
1722
* [basecli] `data/keys.db -> keys/keys.db`
18-
* [cool] Mapper -> Keeper
1923

2024
FEATURES
2125

2226
* [types] `Coin` supports direct arithmetic operations
2327
* [basecoind] Add `show_validator` and `show_node_id` commands
24-
* [staking] Initial merge of full staking module!
28+
* [x/stake] Initial merge of full staking module!
2529
* [democoin] New example application to demo custom modules
2630

2731
IMPROVEMENTS
@@ -45,9 +49,9 @@ BREAKING CHANGES
4549
* [types] Replace tx.GetFeePayer with FeePayer(tx) - returns the first signer
4650
* [types] NewStdTx takes the Fee
4751
* [types] ParseAccount -> AccountDecoder; ErrTxParse -> ErrTxDecoder
48-
* [auth] AnteHandler deducts fees
49-
* [bank] Move some errors to `types`
50-
* [bank] Remove sequence and signature from Input
52+
* [x/auth] AnteHandler deducts fees
53+
* [x/bank] Move some errors to `types`
54+
* [x/bank] Remove sequence and signature from Input
5155

5256
FEATURES
5357

@@ -71,8 +75,8 @@ IMPROVEMENTS
7175
* [specs] Staking
7276

7377
BUG FIXES
74-
* [auth] Fix setting pubkey on new account
75-
* [auth] Require signatures to include the sequences
78+
* [x/auth] Fix setting pubkey on new account
79+
* [x/auth] Require signatures to include the sequences
7680
* [baseapp] Dont panic on nil handler
7781
* [basecoin] Check for empty bytes in account and tx
7882

Gopkg.lock

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
name = "github.com/tendermint/iavl"
7171

7272
[[constraint]]
73-
version = "~0.17.1"
73+
version = "~0.18.0-rc1"
7474
name = "github.com/tendermint/tendermint"
7575

76-
[[constraint]]
77-
version = "~0.7.1"
76+
[[override]]
77+
version = "~0.8.1"
7878
name = "github.com/tendermint/tmlibs"
7979

8080
[prune]

Makefile

+15-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PACKAGES=$(shell go list ./... | grep -v '/vendor/')
22
COMMIT_HASH := $(shell git rev-parse --short HEAD)
33
BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}"
44

5-
all: check_tools get_vendor_deps build test
5+
all: check_tools get_vendor_deps build build_examples test
66

77
########################################
88
### CI
@@ -13,13 +13,16 @@ ci: get_tools get_vendor_deps build test_cover
1313
### Build
1414

1515
# This can be unified later, here for easy demos
16-
gaia:
17-
go build $(BUILD_FLAGS) -o build/gaiad ./examples/gaia/gaiad
18-
go build $(BUILD_FLAGS) -o build/gaiacli ./examples/gaia/gaiacli
19-
2016
build:
21-
@rm -rf $(shell pwd)/examples/basecoin/vendor/
22-
@rm -rf $(shell pwd)/examples/democoin/vendor/
17+
ifeq ($(OS),Windows_NT)
18+
go build $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaiad
19+
go build $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaiacli
20+
else
21+
go build $(BUILD_FLAGS) -o build/gaiad ./cmd/gaiad
22+
go build $(BUILD_FLAGS) -o build/gaiacli ./cmd/gaiacli
23+
endif
24+
25+
build_examples:
2326
ifeq ($(OS),Windows_NT)
2427
go build $(BUILD_FLAGS) -o build/basecoind.exe ./examples/basecoin/cmd/basecoind
2528
go build $(BUILD_FLAGS) -o build/basecli.exe ./examples/basecoin/cmd/basecli
@@ -33,6 +36,10 @@ else
3336
endif
3437

3538
install:
39+
go install $(BUILD_FLAGS) ./cmd/gaiad
40+
go install $(BUILD_FLAGS) ./cmd/gaiacli
41+
42+
install_examples:
3643
go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecoind
3744
go install $(BUILD_FLAGS) ./examples/basecoin/cmd/basecli
3845
go install $(BUILD_FLAGS) ./examples/democoin/cmd/democoind
@@ -84,12 +91,9 @@ test: test_unit # test_cli
8491
# go test -coverprofile=c.out && go tool cover -html=c.out
8592

8693
test_unit:
87-
@rm -rf examples/basecoin/vendor/
88-
@rm -rf examples/democoin/vendor/
8994
@go test $(PACKAGES)
9095

9196
test_cover:
92-
@rm -rf examples/basecoin/vendor/
9397
@bash tests/test_cover.sh
9498

9599
benchmark:
@@ -123,4 +127,4 @@ devdoc_update:
123127
# To avoid unintended conflicts with file names, always add to .PHONY
124128
# unless there is a reason not to.
125129
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
126-
.PHONY: build dist check_tools get_tools get_vendor_deps draw_deps test test_unit test_tutorial benchmark devdoc_init devdoc devdoc_save devdoc_update
130+
.PHONY: build build_examples install install_examples dist check_tools get_tools get_vendor_deps draw_deps test test_unit test_tutorial benchmark devdoc_init devdoc devdoc_save devdoc_update

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ The key directories of the SDK are:
7070

7171
## Getting Started
7272

73-
See the [documentation](https://cosmos-sdk.readthedocs.io).
73+
See the [documentation](https://cosmos-sdk.readthedocs.io).

baseapp/baseapp.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,6 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC
248248
// TODO Return something intelligent
249249
panic(err)
250250
}
251-
err = app.Router().InitGenesis(app.deliverState.ctx, *genesisState)
252-
if err != nil {
253-
// TODO Return something intelligent
254-
panic(err)
255-
}
256251

257252
// NOTE: we don't commit, but BeginBlock for block 1
258253
// starts from this deliverState
@@ -266,7 +261,7 @@ func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
266261
queryable, ok := app.cms.(sdk.Queryable)
267262
if !ok {
268263
msg := "application doesn't support queries"
269-
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
264+
return sdk.ErrUnknownRequest(msg).QueryResult()
270265
}
271266
return queryable.Query(req)
272267
}

baseapp/baseapp_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func TestDeliverTx(t *testing.T) {
249249

250250
counter += 1
251251
return sdk.Result{}
252-
}, nil)
252+
})
253253

254254
tx := testUpdatePowerTx{} // doesn't matter
255255
header := abci.Header{AppHash: []byte("apphash")}
@@ -284,7 +284,7 @@ func TestQuery(t *testing.T) {
284284
store := ctx.KVStore(capKey)
285285
store.Set(key, value)
286286
return sdk.Result{}
287-
}, nil)
287+
})
288288

289289
query := abci.RequestQuery{
290290
Path: "/main/key",
@@ -349,7 +349,7 @@ func TestValidatorChange(t *testing.T) {
349349
app.Router().AddRoute(msgType, func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
350350
// TODO
351351
return sdk.Result{}
352-
}, nil)
352+
})
353353

354354
// Load latest state, which should be empty.
355355
err := app.LoadLatestVersion(capKey)

baseapp/router.go

+3-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
package baseapp
22

33
import (
4-
"encoding/json"
5-
"fmt"
64
"regexp"
75

86
sdk "github.com/cosmos/cosmos-sdk/types"
97
)
108

119
// Router provides handlers for each transaction type.
1210
type Router interface {
13-
AddRoute(r string, h sdk.Handler, i sdk.InitGenesis) (rtr Router)
11+
AddRoute(r string, h sdk.Handler) (rtr Router)
1412
Route(path string) (h sdk.Handler)
15-
InitGenesis(ctx sdk.Context, data map[string]json.RawMessage) error
1613
}
1714

1815
// map a transaction type to a handler and an initgenesis function
1916
type route struct {
2017
r string
2118
h sdk.Handler
22-
i sdk.InitGenesis
2319
}
2420

2521
type router struct {
@@ -38,11 +34,11 @@ func NewRouter() *router {
3834
var isAlpha = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString
3935

4036
// AddRoute - TODO add description
41-
func (rtr *router) AddRoute(r string, h sdk.Handler, i sdk.InitGenesis) Router {
37+
func (rtr *router) AddRoute(r string, h sdk.Handler) Router {
4238
if !isAlpha(r) {
4339
panic("route expressions can only contain alphanumeric characters")
4440
}
45-
rtr.routes = append(rtr.routes, route{r, h, i})
41+
rtr.routes = append(rtr.routes, route{r, h})
4642

4743
return rtr
4844
}
@@ -57,20 +53,3 @@ func (rtr *router) Route(path string) (h sdk.Handler) {
5753
}
5854
return nil
5955
}
60-
61-
// InitGenesis - call `InitGenesis`, where specified, for all routes
62-
// Return the first error if any, otherwise nil
63-
func (rtr *router) InitGenesis(ctx sdk.Context, data map[string]json.RawMessage) error {
64-
for _, route := range rtr.routes {
65-
if route.i != nil {
66-
encoded, found := data[route.r]
67-
if !found {
68-
return sdk.ErrGenesisParse(fmt.Sprintf("Expected module genesis information for module %s but it was not present", route.r))
69-
}
70-
if err := route.i(ctx, encoded); err != nil {
71-
return err
72-
}
73-
}
74-
}
75-
return nil
76-
}

client/context/viper.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package context
2+
3+
import (
4+
"github.com/spf13/viper"
5+
6+
rpcclient "github.com/tendermint/tendermint/rpc/client"
7+
8+
"github.com/cosmos/cosmos-sdk/client"
9+
"github.com/cosmos/cosmos-sdk/client/core"
10+
)
11+
12+
func NewCoreContextFromViper() core.CoreContext {
13+
nodeURI := viper.GetString(client.FlagNode)
14+
var rpc rpcclient.Client
15+
if nodeURI != "" {
16+
rpc = rpcclient.NewHTTP(nodeURI, "/websocket")
17+
}
18+
return core.CoreContext{
19+
ChainID: viper.GetString(client.FlagChainID),
20+
Height: viper.GetInt64(client.FlagHeight),
21+
TrustNode: viper.GetBool(client.FlagTrustNode),
22+
FromAddressName: viper.GetString(client.FlagName),
23+
NodeURI: nodeURI,
24+
Sequence: viper.GetInt64(client.FlagSequence),
25+
Client: rpc,
26+
}
27+
}

0 commit comments

Comments
 (0)