* cs: check for SkipTimeoutCommit or wait timeout in handleTxsAvailable
Previously, if create_empty_blocks was set to false, TM sometimes could
create 2 consecutive blocks without actually waiting for timeoutCommit
(1 sec. by default).
```
I[2019-08-29|07:32:43.874] Executed block module=state height=47 validTxs=10 invalidTxs=0
I[2019-08-29|07:32:43.876] Committed state module=state height=47 txs=10 appHash=F88C010000000000
I[2019-08-29|07:32:44.885] Executed block module=state height=48 validTxs=2 invalidTxs=0
I[2019-08-29|07:32:44.887] Committed state module=state height=48 txs=2 appHash=FC8C010000000000
I[2019-08-29|07:32:44.908] Executed block module=state height=49 validTxs=8 invalidTxs=0
I[2019-08-29|07:32:44.909] Committed state module=state height=49 txs=8 appHash=8C8D010000000000
I[2019-08-29|07:32:45.886] Executed block module=state height=50 validTxs=2 invalidTxs=0
I[2019-08-29|07:32:45.895] Committed state module=state height=50 txs=2 appHash=908D010000000000
I[2019-08-29|07:32:45.908] Executed block module=state height=51 validTxs=8 invalidTxs=0
I[2019-08-29|07:32:45.909] Committed state module=state height=51 txs=8 appHash=A08D010000000000
```
This commit fixes that by adding a check to handleTxsAvailable.
Fixes#3908
* update changelog
* schedule timeoutCommit if StartTime is in the future
or SkipTimeoutCommit=true && we DON'T have all the votes
* fix TestReactorCreatesBlockWhenEmptyBlocksFalse
by checking if we have LastCommit or not
* address Ethan's comments
* Remove unnecessary type conversions
* Consolidate repeated strings into consts
* Clothe return statements
* Update blockchain/v1/reactor_fsm_test.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
This PR repairs linter errors seen when running the following commands:
golangci-lint run --no-config --disable-all=true --enable=unconvert
golangci-lint run --no-config --disable-all=true --enable=goconst
golangci-lint run --no-config --disable-all=true --enable=nakedret
Contributes to #3262
- depndabot couldnt update a few deps as they needed to beupdated together.
- PRs: #3946, 3938 can be closed with this PR
Signedoff-by: Marko Baricevic <marbar3778@yahoo.com>
* update gogo/protobuf version from v1.2.1 to v1.3.0
Also errcheck from v1.1.0 to v1.2.0
See full diff in
- https://github.com/gogo/protobuf/compare/v1.2.1...v1.3.0
- https://github.com/kisielk/errcheck/compare/v1.1.0...v1.2.0
Changelog:
Tested versions:
go 1.12.9
protoc 3.7.1
Improvements:
plugin/stringer - Handle repeated and/or nullable types a bit better now.
plugin/size - Remove the loop in sovXXX by using bit twiddling.
Thanks: https://github.com/apelisse
plugin/marshalto - Implemented a reverse marshal strategy which allows for faster marshalling. This now avoids a recursive (and repeated) call to Size().
Thanks: https://github.com/apelisse
plugin/compare - Added support for for oneof types.
Bug fixes:
protoc-gen-gogo/generator - Fix assignment to entry in nil map.
Thanks: https://github.com/tgulacsi
protoc-gen-gogo/generator - Allows plugins to call RecordTypeUse without panicking.
Thanks: https://github.com/fedenusy
proto/extensions - Fixed set extension regression. We did not clear the extensions before setting.
io/uint32 - fix uint32reader bug that causes ReadMsg to recreate buffer when lengths are the same.
Thanks: https://github.com/SebiSujar
proto/table_merge: Fix merge of non-nullable slices.
Thanks: https://github.com/euroelessar
Upstream commits:
merged in golang/protobuf commit 318d17de72 - Add UnimplementedServer for server interface
merged in golang/protobuf commit b85cd75de7 - protoc-gen-go/grpc: inline errUnimplemented function
merged in golang/protobuf commit d3c38a4eb4 - protoc-gen-go/grpc: use status and code packages only if needed
merged in golang/protobuf commit e91709a02e - fix indentation in jsonpb with Any messages
merged in golang/protobuf commit 8d0c54c124 - protoc-gen-go: generate XXX_OneofWrappers instead of XXX_OneofFuncs
Misc:
extensions.md - Markdown update.
Thanks: https://github.com/TennyZhuang
Readme.md - Added user.
go/protoc update - Updated to go1.12.x and protoc 3.7.1
Makefile update - fix go vet shadow tool reference
test/mixbench - Update mixbench tool. Expose runnable benchmarks via flags.
* update certstrap
* update golangci-lint from v1.13.2 to v1.17.1
* update gox as well
* test
* comment out golangci temporary
* comment out go-deadlock deps
When using the RPC client in my test suite (with -race enabled), I do a lot of Subscribe/Unsubscribe operations, at some point (randomly) the race detector returns the following warning:
WARNING: DATA RACE
Read at 0x00c0009dbe30 by goroutine 31:
runtime.mapiterinit()
/usr/local/go/src/runtime/map.go:804 +0x0
github.com/tendermint/tendermint/rpc/client.(*WSEvents).redoSubscriptionsAfter()
/go/pkg/mod/github.com/tendermint/tendermint@v0.31.5/rpc/client/httpclient.go:364 +0xc0
github.com/tendermint/tendermint/rpc/client.(*WSEvents).eventListener()
/go/pkg/mod/github.com/tendermint/tendermint@v0.31.5/rpc/client/httpclient.go:393 +0x3c6
Turns out that the redoSubscriptionAfter is not protecting the access to subscriptions.
The following change protects the read access to the subscription map behind the mutex
* manually swagging
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* three definitions with polymorphism
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* added blockchain and block
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* low quality generation, commit, block_response and validators
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* genesis and consensus states endpoints
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix indentation
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* consensus parameters
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix indentation
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add height to consensus parameters endpoint
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* unconfirmed_txs and num_unconfirmed_txs
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add missing query parameter
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add ABCI queries
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* added index document for swagger documentation
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add missing routes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* contract tests added on CCI
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* contract tests job should be in the test suite
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* simplify requirements to test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* typo
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* build is a prerequisite to start localnet
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reduce nodejs size, move goodman to get_tools, add docs, fix comments
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Update scripts/get_tools.sh
That's cleaner, thanks!
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* xz not supported by cci image, let's keep it simple
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* REMOVE-indirect debug of CCI paths
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* dirty experiment, volume is empty but binary has been produced
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* dirty experiment, volume is empty but binary has been produced
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* dirty experiment going on
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* locally works, CCI have difficulties with second layaer containers volumes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* restore experiment, use machine instead of docker for contract tests
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* simplify a bit
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* rollback on machine golang
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Document the changes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Changelog
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comments
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Initiat commit of lite client with
with weak subjectivity ADR
* Apply suggestions from code review
Co-Authored-By: Marko <marbar3778@yahoo.com>
* Update docs/architecture/adr-044-lite-client-with-weak-subjectivity.md
Co-Authored-By: Christopher Goes <cwgoes@pluranimity.org>
* Apply suggestions from code review
Co-Authored-By: Christopher Goes <cwgoes@pluranimity.org>
* Apply suggestions from code review
Co-Authored-By: Anca Zamfir <ancazamfir@users.noreply.github.com>
* fix typo and format the code block
* address cwgoes comments
* add Positive/Negative points
* change status to accepted
* Apply suggestions from code review
Co-Authored-By: Christopher Goes <cwgoes@pluranimity.org>
* link the spec and explain headers caching
* Add test for bcBlockRequestMessage ValidateBasic method
* Add test for bcNoBlockResponseMessage ValidateBasic method
* Add test for bcStatusRequestMessage ValidateBasic method
* Add test for bcStatusResponseMessage ValidateBasic method
* Add blockchain v1 reactor ValidateBasic tests
* Add test for NewRoundStepMessage ValidateBasic method
* Add test for NewValidBlockMessage ValidateBasic method
* Test BlockParts Size
* Import cmn package
* Add test for ProposalPOLMessage ValidateBasic method
* Add test for BlockPartMessage ValidateBasic method
* Add test for HasVoteMessage ValidateBasic method
* Add test for VoteSetMaj23Message ValidateBasic method
* Add test for VoteSetBitsMessage ValidateBasic method
* Fix linter errors
* Improve readability
* Add test for BaseConfig ValidateBasic method
* Add test for RPCConfig ValidateBasic method
* Add test for P2PConfig ValidateBasic method
* Add test for MempoolConfig ValidateBasic method
* Add test for FastSyncConfig ValidateBasic method
* Add test for ConsensusConfig ValidateBasic method
* Add test for InstrumentationConfig ValidateBasic method
* Add test for BlockID ValidateBasic method
* Add test for SignedHeader ValidateBasic method
* Add test for MockGoodEvidence and MockBadEvidence ValidateBasic methods
* Remove debug logging
Co-Authored-By: Marko <marbar3778@yahoo.com>
* Update MempoolConfig field
* Test a single struct field at a time, for maintainability
Fixes#2740
* init of (2/2) common errors
* Remove instances of cmn.Error (2/2)
- Replace usage of cmnError and errorWrap
- ref #3862
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* comment wording
* simplify IsErrXXX functions
* log panic along with stopping the MConnection
+ use `trySend` the replicate peer sending
+ expose `next()` as a chan of events as output
+ expose `final()` as a chan of error, for the final error
+ add `ready()` as chan struct when routine is ready
* (1/2) of replace errors.go with github.com/pkg/errors
ref #3862
- step one in removing instances of errors.go in favor of github.com/pkg/errors
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* gofmt
* add in /store
+ ensure that we stop accepting messages once `stop` has been called
to avoid the case in which we attempt to write to a channel which
has already been closed
+ `routine.send` returns false when routine is not running
+ this will prevent panics sending to channels which have been
closed
+ Make output channels routine specific removing the risk of someone
writting to a channel which was closed by another touine.
+ consistency changes between the routines and the demuxer
* Add Schedule:
+ The schedule is a data structure used to determine the optimal
schedule of requests to the optimal set of peers in order to perform
fast-sync as fast and efficiently as possible.
* Add some doc strings
* fix golangci
* Add Schedule:
+ The schedule is a data structure used to determine the optimal
schedule of requests to the optimal set of peers in order to perform
fast-sync as fast and efficiently as possible.
* Add some doc strings
* remove globals from tests
This PR is related to #3107 and a continuation of #3351
It is important to emphasise that in the privval original design, client/server and listening/dialing roles are inverted and do not follow a conventional interaction.
Given two hosts A and B:
Host A is listener/client
Host B is dialer/server (contains the secret key)
When A requires a signature, it needs to wait for B to dial in before it can issue a request.
A only accepts a single connection and any failure leads to dropping the connection and waiting for B to reconnect.
The original rationale behind this design was based on security.
Host B only allows outbound connections to a list of whitelisted hosts.
It is not possible to reach B unless B dials in. There are no listening/open ports in B.
This PR results in the following changes:
Refactors ping/heartbeat to avoid previously existing race conditions.
Separates transport (dialer/listener) from signing (client/server) concerns to simplify workflow.
Unifies and abstracts away the differences between unix and tcp sockets.
A single signer endpoint implementation unifies connection handling code (read/write/close/connection obj)
The signer request handler (server side) is customizable to increase testability.
Updates and extends unit tests
A high level overview of the classes is as follows:
Transport (endpoints): The following classes take care of establishing a connection
SignerDialerEndpoint
SignerListeningEndpoint
SignerEndpoint groups common functionality (read/write/timeouts/etc.)
Signing (client/server): The following classes take care of exchanging request/responses
SignerClient
SignerServer
This PR also closes#3601
Commits:
* refactoring - work in progress
* reworking unit tests
* Encapsulating and fixing unit tests
* Improve tests
* Clean up
* Fix/improve unit tests
* clean up tests
* Improving service endpoint
* fixing unit test
* fix linter issues
* avoid invalid cache values (improve later?)
* complete implementation
* wip
* improved connection loop
* Improve reconnections + fixing unit tests
* addressing comments
* small formatting changes
* clean up
* Update node/node.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_client.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_client_test.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* check during initialization
* dropping connecting when writing fails
* removing break
* use t.log instead
* unifying and using cmn.GetFreePort()
* review fixes
* reordering and unifying drop connection
* closing instead of signalling
* refactored service loop
* removed superfluous brackets
* GetPubKey can return errors
* Revert "GetPubKey can return errors"
This reverts commit 68c06f19b4.
* adding entry to changelog
* Update CHANGELOG_PENDING.md
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_client.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_dialer_endpoint.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_dialer_endpoint.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_dialer_endpoint.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_dialer_endpoint.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* Update privval/signer_listener_endpoint_test.go
Co-Authored-By: jleni <juan.leni@zondax.ch>
* updating node.go
* review fixes
* fixes linter
* fixing unit test
* small fixes in comments
* addressing review comments
* addressing review comments 2
* reverting suggestion
* Update privval/signer_client_test.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update privval/signer_client_test.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* Update privval/signer_listener_endpoint_test.go
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
* do not expose brokenSignerDialerEndpoint
* clean up logging
* unifying methods
shorten test time
signer also drops
* reenabling pings
* improving testability + unit test
* fixing go fmt + unit test
* remove unused code
* Addressing review comments
* simplifying connection workflow
* fix linter/go import issue
* using base service quit
* updating comment
* Simplifying design + adjusting names
* fixing linter issues
* refactoring test harness + fixes
* Addressing review comments
* cleaning up
* adding additional error check