52 Commits

Author SHA1 Message Date
Juan Leni
f7f034a8be privval: refactor Remote signers (#3370)
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 68c06f19b4650389d7e5ab1659b318889028202c.

* 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
2019-08-05 19:09:10 +04:00
dongsamb
f1cf10150a gitignore: add .vendor-new (#3566) 2019-04-16 08:49:03 +04:00
Zach
886a83dfb8 docs: Add assets/instructions for local docs build (#2453)
* ungitignore
* add docs/.vuepress to enable local builds
* config.js needs to be here, one less step
* docs: make spec in sidebar nicer
* docs: local build instructions
2018-09-21 13:39:55 +02:00
xiaoping
dea4e96f66 fix docs links (#2352) 2018-09-10 10:42:48 +04:00
b00f
0f931eeb10 types: allow genesis file to have 0 validators (#2148)
* fixing issue 2015

* Remove comments for code review

* Update tests
2018-08-14 19:02:53 +04:00
Ethan Buchman
2d1c5a1ce6 Merge remote-tracking branch 'origin/develop' into jae/literefactor4 2018-08-02 19:12:22 -04:00
Zach
66fe5b7bae rpc: Improve slate for Jenkins (#2070) 2018-07-25 23:37:08 +02:00
Ethan Buchman
ea31c4836a Merge branch 'develop' into jae/literefactor4 2018-07-23 23:28:14 -04:00
Silas Davis
398f3779cc
Add gogoproto marshallers to proto files in order to make use of
gogoproto.nullable compatible with GRPC downstream of ABCI and libs
protbuf types
2018-07-17 11:51:38 +01:00
Zach Ramsay
65487586f8 fix conflict 2018-07-10 11:13:39 -04:00
Zach Ramsay
e54c0f804f docs re-orgnization 2018-07-05 16:08:42 -04:00
Zach
07747de305 add docs/DOCS_README.md for devs, closes #1885 (#1905) 2018-07-05 11:44:15 +04:00
Jae Kwon
b51ed132f7 Fix test/p2p/pex circle tests; update consensus 2018-06-27 16:24:21 -07:00
Jae Kwon
37ef5485b4 Add logs to lite/*; Fix rpc status to return consensus height, not blockstore height 2018-06-26 16:53:06 -07:00
Zach
867550dd8b docs: update abci links (#1796) 2018-06-23 00:16:51 +02:00
Alexander Simmerl
693a973997
abci: Remove nested .gitignore 2018-06-22 20:28:54 +02:00
Liamsi
368c236c75 mv go-crypto files to crypto dir 2018-06-20 15:30:44 -07:00
Zach Ramsay
e82ab1c374 moar fixes 2018-06-07 09:41:57 -04:00
Anton Kaliaev
a885af0826
Merge pull request #1574 from tendermint/847-separate-internal-pubsub
[pubsub] Prioritise internal subscribers (e.g. reactor) over external (e.g. RPC)
2018-05-24 21:09:56 +04:00
Zach Ramsay
126ddca1a6 remove debora scripts (#1610) 2018-05-23 08:01:07 -04:00
Anton Kaliaev
bb9aa85d22
copy events and pubsub packages from tmlibs
Refs #847
2018-05-21 10:51:47 +04:00
Zach Ramsay
315c475b79 docs: build updates
ref: https://github.com/tendermint/tools/pull/79
2018-04-03 04:48:40 -07:00
Constantine
152290db7e Add \health rpc endpoint (#1306)
* Init `\health` rpc endpoint

* remove additional info from `\health` rpc endpoint

* Cleanup imports

* Added time threshold for health check

* Update rpc doc

* Remove unnecessary checks for blocktime creation lag

* Clean up of unnecessary config usage
2018-03-19 19:39:37 +03:00
Adrian Brink
0a7a190cd1 Fix vagrantfile
If you get an error, please run `vagrant box update`.
2018-01-26 01:16:07 -05:00
Anton Kaliaev
c74a359c46
fixes per Bucky's review 2017-10-24 12:14:21 +04:00
Anton Kaliaev
f927f0a736 Merge branch 'master' into develop 2017-10-06 12:16:07 +04:00
Anton Kaliaev
9e4c25761c
relative links [ci skip] 2017-10-04 23:33:31 +04:00
Anton Kaliaev
7ab861358a
[tm-bench] update alpine version 2017-07-29 12:54:28 -04:00
Ethan Frey
0edd1297a9 Got basic key test working 2017-06-19 17:07:12 +02:00
Gary Tomato
fb457c2c9c DigitalOcean example and genesis file creation added 2017-05-30 17:39:50 -04:00
Adrian Brink
2bf8c40cff Add extra memory to virtual machine and add coverage report to gitignore. 2017-05-01 17:29:44 +02:00
Ethan Frey
0bfae964e1 Moved keys cmd to top level 2017-04-19 17:07:12 +02:00
Ethan Frey
aecc32d363 Make dependencies explicit in glide.yaml 2017-04-10 19:51:02 +02:00
Jae Kwon
e49fdf7be7 Add HD functions 2017-04-08 22:57:59 -07:00
Anton Kaliaev
d3b54b204f
tm-monitor 0.1.0 2017-03-01 23:01:52 +04:00
Anton Kaliaev
1275458c3f
collect and add docker logs to CircleCI artifacts (Refs #387)
How: 1) we start syslog docker container 2) all other containers use
syslog logging driver to ship their logs to that container
2017-02-14 19:02:11 +04:00
Anton Kaliaev
cc2457f7d5
dist command to make binaries and package them for distribution 2017-01-23 14:45:13 +04:00
Anton Kalyaev
30328548f7 test/p2p: kill and restart all nodes 2016-12-22 01:42:51 -05:00
Anton Kalyaev
6488894210 add .vagrant to .gitignore 2016-12-21 19:18:18 -05:00
Jae Kwon
9d71a0409c Add Glide files for project management 2016-01-05 13:19:41 -08:00
Ethan Buchman
3f7f3dd37f add git commit hash to nodeInfo 2015-07-12 02:16:33 +00:00
Jae Kwon
cfb4a40855 adding more debug logs 2015-05-04 22:22:39 -07:00
Jae Kwon
5557923245 remote client_methods.go.bak 2015-04-24 14:41:50 -07:00
Jae Kwon
22fdb6ca2f ~/.tendermint -> .tendermint 2015-04-16 16:35:51 -07:00
Jae Kwon
98fa3b7b9c Adding cmd again and fixing .gitignore. 2015-04-08 14:31:20 -07:00
Jae Kwon
cc18136af8 RPC refactor to separate core from core_client and the rest of RPC.
Other random changes.
2015-04-07 11:44:25 -07:00
Jae Kwon
5cb57d3eaa Use BlockCache for RPC/mempool and added TxId()
TxId() uses signbytes
2015-03-29 18:43:27 -07:00
Matthew Wampler-Doty
bfe472987f Ingoring OS X nonsense 2015-03-16 03:51:14 -07:00
Jae Kwon
4424a85fbd start writing rpc 2014-12-16 05:43:23 -08:00
Jae Kwon
fa382a3b05 numeric fields are all native unboxed. 2014-08-30 16:28:51 -07:00