From a59930a327065f2d091840586da6c35b6fd07472 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 13 Mar 2019 16:09:05 +0400 Subject: [PATCH 1/5] localnet: fix $LOG variable (#3423) Fixes #3421 Before: it was creating a file named ${LOG:-tendermint.log} in .build/nodeX After: it creates a file named tendermint.log --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 61862e5c..ccc80204 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - "26656-26657:26656-26657" environment: - ID=0 - - LOG=$${LOG:-tendermint.log} + - LOG=${LOG:-tendermint.log} volumes: - ./build:/tendermint:Z networks: @@ -22,7 +22,7 @@ services: - "26659-26660:26656-26657" environment: - ID=1 - - LOG=$${LOG:-tendermint.log} + - LOG=${LOG:-tendermint.log} volumes: - ./build:/tendermint:Z networks: @@ -34,7 +34,7 @@ services: image: "tendermint/localnode" environment: - ID=2 - - LOG=$${LOG:-tendermint.log} + - LOG=${LOG:-tendermint.log} ports: - "26661-26662:26656-26657" volumes: @@ -48,7 +48,7 @@ services: image: "tendermint/localnode" environment: - ID=3 - - LOG=$${LOG:-tendermint.log} + - LOG=${LOG:-tendermint.log} ports: - "26663-26664:26656-26657" volumes: From 745713330736c5c751450245d88b8037cbee3aa6 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 14 Mar 2019 15:00:58 +0400 Subject: [PATCH 2/5] grpcdb: close Iterator/ReverseIterator after use (#3424) Fixes #3402 --- CHANGELOG_PENDING.md | 1 + libs/db/remotedb/grpcdb/server.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index c4136b55..e9d4a925 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -47,3 +47,4 @@ Special thanks to external contributors on this release: - [libs/pubsub] \#951, \#1880 use non-blocking send when dispatching messages [ADR-33](https://github.com/tendermint/tendermint/blob/develop/docs/architecture/adr-033-pubsub.md) - [p2p] \#3369 do not panic when filter times out - [cmd] \#3408 Fix `testnet` command's panic when creating non-validator configs (using `--n` flag) (@srmo) +- [libs/db/remotedb/grpcdb] \#3402 Close Iterator/ReverseIterator after use diff --git a/libs/db/remotedb/grpcdb/server.go b/libs/db/remotedb/grpcdb/server.go index bfe65e61..a032292b 100644 --- a/libs/db/remotedb/grpcdb/server.go +++ b/libs/db/remotedb/grpcdb/server.go @@ -138,6 +138,7 @@ func (s *server) SetSync(ctx context.Context, in *protodb.Entity) (*protodb.Noth func (s *server) Iterator(query *protodb.Entity, dis protodb.DB_IteratorServer) error { it := s.db.Iterator(query.Start, query.End) + defer it.Close() return s.handleIterator(it, dis.Send) } @@ -162,6 +163,7 @@ func (s *server) handleIterator(it db.Iterator, sendFunc func(*protodb.Iterator) func (s *server) ReverseIterator(query *protodb.Entity, dis protodb.DB_ReverseIteratorServer) error { it := s.db.ReverseIterator(query.Start, query.End) + defer it.Close() return s.handleIterator(it, dis.Send) } From 4162ebe8b586deccc0e7476d8abafb75138bfe58 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 19 Mar 2019 11:38:32 +0400 Subject: [PATCH 3/5] types: refactor PB2TM.ConsensusParams to take BlockTimeIota as an arg (#3442) See https://github.com/tendermint/tendermint/pull/3403/files#r266208947 In #3403 we unexposed BlockTimeIota from the ABCI, but it's still part of the ConsensusParams struct, so we have to remember to add it back after calling PB2TM.ConsensusParams. Instead, PB2TM.ConsensusParams should take it as an argument Fixes #3432 --- consensus/replay.go | 7 +------ types/protobuf.go | 9 ++++++--- types/protobuf_test.go | 4 +--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/consensus/replay.go b/consensus/replay.go index 6656da62..c8ab8a33 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -324,12 +324,7 @@ func (h *Handshaker) ReplayBlocks( } if res.ConsensusParams != nil { - // Preserve TimeIotaMs since it's not exposed to the application. - timeIotaMs := state.ConsensusParams.Block.TimeIotaMs - { - state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams) - } - state.ConsensusParams.Block.TimeIotaMs = timeIotaMs + state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams, state.ConsensusParams.Block.TimeIotaMs) } sm.SaveState(h.stateDB, state) } diff --git a/types/protobuf.go b/types/protobuf.go index 8cad4608..e10b9186 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -221,7 +221,9 @@ func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error) return tmVals, nil } -func (pb2tm) ConsensusParams(csp *abci.ConsensusParams) ConsensusParams { +// BlockParams.TimeIotaMs is not exposed to the application. Therefore a caller +// must provide it. +func (pb2tm) ConsensusParams(csp *abci.ConsensusParams, blockTimeIotaMs int64) ConsensusParams { params := ConsensusParams{ Block: BlockParams{}, Evidence: EvidenceParams{}, @@ -231,8 +233,9 @@ func (pb2tm) ConsensusParams(csp *abci.ConsensusParams) ConsensusParams { // we must defensively consider any structs may be nil if csp.Block != nil { params.Block = BlockParams{ - MaxBytes: csp.Block.MaxBytes, - MaxGas: csp.Block.MaxGas, + MaxBytes: csp.Block.MaxBytes, + MaxGas: csp.Block.MaxGas, + TimeIotaMs: blockTimeIotaMs, } } diff --git a/types/protobuf_test.go b/types/protobuf_test.go index 2e29a502..152c92d1 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -64,9 +64,7 @@ func TestABCIValidators(t *testing.T) { func TestABCIConsensusParams(t *testing.T) { cp := DefaultConsensusParams() abciCP := TM2PB.ConsensusParams(cp) - cp2 := PB2TM.ConsensusParams(abciCP) - // TimeIotaMs is not exposed to the application. - cp2.Block.TimeIotaMs = cp.Block.TimeIotaMs + cp2 := PB2TM.ConsensusParams(abciCP, cp.Block.TimeIotaMs) assert.Equal(t, *cp, cp2) } From 8e62a3d62a5b04a5a7126d00d75925c990aec9c6 Mon Sep 17 00:00:00 2001 From: Ismail Khoffi Date: Tue, 19 Mar 2019 12:19:02 +0100 Subject: [PATCH 4/5] Add #3421 to changelog and reorder alphabetically --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f714818..24955b08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,13 +81,14 @@ program](https://hackerone.com/tendermint). ### BUG FIXES: - [blockchain] [\#3358](https://github.com/tendermint/tendermint/pull/3358) Fix timer leak in `BlockPool` (@guagualvcha) - [cmd] [\#3408](https://github.com/tendermint/tendermint/issues/3408) Fix `testnet` command's panic when creating non-validator configs (using `--n` flag) (@srmo) +- [libs/db/remotedb/grpcdb] [\#3402](https://github.com/tendermint/tendermint/issues/3402) Close Iterator/ReverseIterator after use - [libs/pubsub] [\#951](https://github.com/tendermint/tendermint/issues/951), [\#1880](https://github.com/tendermint/tendermint/issues/1880) Use non-blocking send when dispatching messages [ADR-33](https://github.com/tendermint/tendermint/blob/develop/docs/architecture/adr-033-pubsub.md) - [lite] [\#3364](https://github.com/tendermint/tendermint/issues/3364) Fix `/validators` and `/abci_query` proxy endpoints (@guagualvcha) - [p2p/conn] [\#3347](https://github.com/tendermint/tendermint/issues/3347) Reject all-zero shared secrets in the Diffie-Hellman step of secret-connection - [p2p] [\#3369](https://github.com/tendermint/tendermint/issues/3369) Do not panic when filter times out - [p2p] [\#3359](https://github.com/tendermint/tendermint/pull/3359) Fix reconnecting report duplicate ID error due to race condition between adding peer to peerSet and starting it (@guagualvcha) -- [libs/db/remotedb/grpcdb] [\#3402](https://github.com/tendermint/tendermint/issues/3402) Close Iterator/ReverseIterator after use +- [test] [\#3421](https://github.com/tendermint/tendermint/issues/3421) Fix logfile names created by localnet via docker-compose.yml ## v0.30.2 From e276f35f86b3980e088a95aa70c96dbddcdf658b Mon Sep 17 00:00:00 2001 From: Ismail Khoffi Date: Tue, 19 Mar 2019 14:36:42 +0100 Subject: [PATCH 5/5] remove 3421 from changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24955b08..8968a7a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,7 +88,6 @@ program](https://hackerone.com/tendermint). - [p2p/conn] [\#3347](https://github.com/tendermint/tendermint/issues/3347) Reject all-zero shared secrets in the Diffie-Hellman step of secret-connection - [p2p] [\#3369](https://github.com/tendermint/tendermint/issues/3369) Do not panic when filter times out - [p2p] [\#3359](https://github.com/tendermint/tendermint/pull/3359) Fix reconnecting report duplicate ID error due to race condition between adding peer to peerSet and starting it (@guagualvcha) -- [test] [\#3421](https://github.com/tendermint/tendermint/issues/3421) Fix logfile names created by localnet via docker-compose.yml ## v0.30.2