From bbaad229825d6d97de348025aa03f1a5b36c185a Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 22 Mar 2018 23:00:01 -0400 Subject: [PATCH 1/3] update dep --- Gopkg.lock | 59 +++++++++++++++++++++++++++++++----------------------- Gopkg.toml | 26 ++++++++++++------------ 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 91e0b41e2..894d98ead 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,9 +2,10 @@ [[projects]] + branch = "master" name = "github.com/btcsuite/btcd" packages = ["btcec"] - revision = "50de9da05b50eb15658bb350f6ea24368a111ab7" + revision = "2be2f12b358dc57d70b8f501b00be450192efbc3" [[projects]] name = "github.com/davecgh/go-spew" @@ -19,10 +20,10 @@ revision = "95f809107225be108efcf10a3509e4ea6ceef3c4" [[projects]] - branch = "master" name = "github.com/fortytw2/leaktest" packages = ["."] - revision = "3b724c3d7b8729a35bf4e577f71653aec6e53513" + revision = "a5ef70473c97b71626b9abeda80ee92ba2a7de9e" + version = "v1.2.0" [[projects]] name = "github.com/fsnotify/fsnotify" @@ -96,6 +97,7 @@ ".", "hcl/ast", "hcl/parser", + "hcl/printer", "hcl/scanner", "hcl/strconv", "hcl/token", @@ -103,7 +105,7 @@ "json/scanner", "json/token" ] - revision = "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8" + revision = "f40e974e75af4e271d97ce0fc917af5898ae7bda" [[projects]] name = "github.com/inconshreveable/mousetrap" @@ -126,12 +128,14 @@ [[projects]] name = "github.com/magiconair/properties" packages = ["."] - revision = "49d762b9817ba1c2e9d0c69183c2b4a8b8f1d934" + revision = "c3beff4c2358b44d0493c7dda585e7db7ff28ae6" + version = "v1.7.6" [[projects]] + branch = "master" name = "github.com/mitchellh/mapstructure" packages = ["."] - revision = "b4575eea38cca1123ec2dc90c26529b5c5acfcff" + revision = "00c29f56e2386353d58c599509e8dc3801b0d716" [[projects]] name = "github.com/pelletier/go-toml" @@ -169,8 +173,8 @@ [[projects]] name = "github.com/spf13/cast" packages = ["."] - revision = "acbeb36b902d72a7a4c18e8f3241075e7ab763e4" - version = "v1.1.0" + revision = "8965335b8c7107321228e3e3702cab9832751bac" + version = "v1.2.0" [[projects]] name = "github.com/spf13/cobra" @@ -193,8 +197,8 @@ [[projects]] name = "github.com/spf13/viper" packages = ["."] - revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7" - version = "v1.0.0" + revision = "b5e8006cbee93ec955a89ab31e0e3ce3204f3736" + version = "v1.0.2" [[projects]] name = "github.com/stretchr/testify" @@ -206,6 +210,7 @@ version = "v1.2.1" [[projects]] + branch = "master" name = "github.com/syndtr/goleveldb" packages = [ "leveldb", @@ -221,10 +226,9 @@ "leveldb/table", "leveldb/util" ] - revision = "34011bf325bce385408353a30b101fe5e923eb6e" + revision = "169b1b37be738edb2813dab48c97a549bcf99bb5" [[projects]] - branch = "develop" name = "github.com/tendermint/abci" packages = [ "client", @@ -234,7 +238,8 @@ "server", "types" ] - revision = "9e0e00bef42aebf6b402f66bf0f3dc607de8a6f3" + revision = "46686763ba8ea595ede16530ed4a40fb38f49f94" + version = "v0.10.2" [[projects]] branch = "master" @@ -278,10 +283,11 @@ "pubsub/query", "test" ] - revision = "1b9b5652a199ab0be2e781393fb275b66377309d" - version = "v0.7.0" + revision = "24da7009c3d8c019b40ba4287495749e3160caca" + version = "v0.7.1" [[projects]] + branch = "master" name = "golang.org/x/crypto" packages = [ "curve25519", @@ -293,7 +299,7 @@ "ripemd160", "salsa20/salsa" ] - revision = "1875d0a70c90e57f11972aefd42276df65e895b9" + revision = "88942b9c40a4c9d203b82b3731787b672d6e809b" [[projects]] branch = "master" @@ -307,12 +313,13 @@ "lex/httplex", "trace" ] - revision = "cbe0f9307d0156177f9dd5dc85da1a31abc5f2fb" + revision = "6078986fec03a1dcc236c34816c71b0e05018fda" [[projects]] + branch = "master" name = "golang.org/x/sys" packages = ["unix"] - revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd" + revision = "91ee8cde435411ca3f1cd365e8f20131aed4d0a1" [[projects]] name = "golang.org/x/text" @@ -332,12 +339,14 @@ "unicode/norm", "unicode/rangetable" ] - revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3" + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" [[projects]] + branch = "master" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "4eb30f4778eed4c258ba66527a0d4f9ec8a36c45" + revision = "f8c8703595236ae70fdf8789ecb656ea0bcdcf46" [[projects]] name = "google.golang.org/grpc" @@ -360,18 +369,18 @@ "tap", "transport" ] - revision = "401e0e00e4bb830a10496d64cd95e068c5bf50de" - version = "v1.7.3" + revision = "5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e" + version = "v1.7.5" [[projects]] name = "gopkg.in/yaml.v2" packages = ["."] - revision = "d670f9405373e636a5a2765eea47fac0c9bc91a4" - version = "v2.0.0" + revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5" + version = "v2.1.1" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "ed9db0be72a900f4812675f683db20eff9d64ef4511dc00ad29a810da65909c2" + inputs-digest = "4dca5dbd2d280d093d7c8fc423606ab86d6ad1b241b076a7716c2093b5a09231" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 61406ad66..098d5ea9b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -35,23 +35,23 @@ [[constraint]] name = "github.com/go-kit/kit" - version = "0.6.0" + version = "~0.6.0" [[constraint]] name = "github.com/gogo/protobuf" - version = "1.0.0" + version = "~1.0.0" [[constraint]] name = "github.com/golang/protobuf" - version = "1.0.0" + version = "~1.0.0" [[constraint]] name = "github.com/gorilla/websocket" - version = "1.2.0" + version = "~1.2.0" [[constraint]] name = "github.com/pkg/errors" - version = "0.8.0" + version = "~0.8.0" [[constraint]] branch = "master" @@ -59,36 +59,36 @@ [[constraint]] name = "github.com/spf13/cobra" - version = "0.0.1" + version = "~0.0.1" [[constraint]] name = "github.com/spf13/viper" - version = "1.0.0" + version = "~1.0.0" [[constraint]] name = "github.com/stretchr/testify" - version = "1.2.1" + version = "~1.2.1" [[constraint]] name = "github.com/tendermint/abci" - branch = "develop" + version = "~0.10.2" [[constraint]] name = "github.com/tendermint/go-crypto" - version = "0.5.0" + version = "~0.5.0" [[constraint]] name = "github.com/tendermint/go-wire" source = "github.com/tendermint/go-amino" - version = "0.7.3" + version = "~0.7.3" [[constraint]] name = "github.com/tendermint/tmlibs" - version = "0.7.0" + version = "~0.7.1" [[constraint]] name = "google.golang.org/grpc" - version = "1.7.3" + version = "~1.7.3" [prune] go-tests = true From 116a4ec70549db22125bc53c733622fbac517be9 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 23 Mar 2018 12:47:02 +0100 Subject: [PATCH 2/3] temporary fix I assume there is a deeper issue with how UnmarshalBinary works in go-amino (i.e., when loading array of some objects, the empty array becomes []object{nil}). Note when Marshaling, the object is nil. --- state/state_test.go | 4 ++-- state/txindex/kv/kv_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/state/state_test.go b/state/state_test.go index 02c94253e..1c5a860d5 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -78,8 +78,8 @@ func TestABCIResponsesSaveLoad1(t *testing.T) { // build mock responses block := makeBlock(state, 2) abciResponses := NewABCIResponses(block) - abciResponses.DeliverTx[0] = &abci.ResponseDeliverTx{Data: []byte("foo"), Tags: []cmn.KVPair{}} - abciResponses.DeliverTx[1] = &abci.ResponseDeliverTx{Data: []byte("bar"), Log: "ok", Tags: []cmn.KVPair{}} + abciResponses.DeliverTx[0] = &abci.ResponseDeliverTx{Data: []byte("foo"), Tags: []cmn.KVPair{}, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}} + abciResponses.DeliverTx[1] = &abci.ResponseDeliverTx{Data: []byte("bar"), Log: "ok", Tags: []cmn.KVPair{}, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}} abciResponses.EndBlock = &abci.ResponseEndBlock{ValidatorUpdates: []abci.Validator{ { PubKey: crypto.GenPrivKeyEd25519().PubKey().Bytes(), diff --git a/state/txindex/kv/kv_test.go b/state/txindex/kv/kv_test.go index ba2830e81..7ffc36e50 100644 --- a/state/txindex/kv/kv_test.go +++ b/state/txindex/kv/kv_test.go @@ -20,7 +20,7 @@ func TestTxIndex(t *testing.T) { indexer := NewTxIndex(db.NewMemDB()) tx := types.Tx("HELLO WORLD") - txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}}} + txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}}} hash := tx.Hash() batch := txindex.NewBatch(1) @@ -35,7 +35,7 @@ func TestTxIndex(t *testing.T) { assert.Equal(t, txResult, loadedTxResult) tx2 := types.Tx("BYE BYE WORLD") - txResult2 := &types.TxResult{1, 0, tx2, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}}} + txResult2 := &types.TxResult{1, 0, tx2, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}}} hash2 := tx2.Hash() err = indexer.Index(txResult2) @@ -146,12 +146,12 @@ func TestIndexAllTags(t *testing.T) { func txResultWithTags(tags []cmn.KVPair) *types.TxResult { tx := types.Tx("HELLO WORLD") - return &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: tags}} + return &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: tags, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}}} } func benchmarkTxIndex(txsCount int, b *testing.B) { tx := types.Tx("HELLO WORLD") - txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}}} + txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeTypeOK, Log: "", Tags: []cmn.KVPair{}, Fee: cmn.KI64Pair{Key: []uint8{}, Value: 0}}} dir, err := ioutil.TempDir("", "tx_index_db") if err != nil { From 214817ed1765a1df5727d295e05120fc68b4b6d1 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 23 Mar 2018 13:29:40 +0100 Subject: [PATCH 3/3] do not add peer to switch if it fails to start --- p2p/switch.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/p2p/switch.go b/p2p/switch.go index 63deace29..fa037a9b8 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -547,7 +547,9 @@ func (sw *Switch) addPeer(pc peerConn) error { // All good. Start peer if sw.IsRunning() { - sw.startInitPeer(peer) + if err = sw.startInitPeer(peer); err != nil { + return err + } } // Add the peer to .peers. @@ -561,14 +563,17 @@ func (sw *Switch) addPeer(pc peerConn) error { return nil } -func (sw *Switch) startInitPeer(peer *peer) { +func (sw *Switch) startInitPeer(peer *peer) error { err := peer.Start() // spawn send/recv routines if err != nil { // Should never happen sw.Logger.Error("Error starting peer", "peer", peer, "err", err) + return err } for _, reactor := range sw.reactors { reactor.AddPeer(peer) } + + return nil }