Commit Graph

88 Commits

Author SHA1 Message Date
Ismail Khoffi 8888595b94 [R4R] Fixed sized and reordered fields for Vote/Proposal/Heartbeat SignBytes (#2598)
* WIP: switching to fixed offsets for SignBytes

* add version field to sign bytes and update order

* more comments on test-cases and add a tc with a chainID

* remove amino:"write_empty" tag

- it doesn't affect if default fixed size fields ((u)int64) are
written or not
- add comment about int->int64 casting

* update CHANGELOG_PENDING

* update documentation

* add back link to issue #1622 in documentation

* remove JSON tags and add (failing test-case)

* fix failing test

* update test-vectors due to added `Type` field

* change Type field from string to byte and add new type alias

- SignedMsgType replaces VoteTypePrevote, VoteTypePrecommit and adds new
ProposalType to separate votes from proposal when signed

- update test-vectors

* fix remains from rebasing

* use SignMessageType instead of byte everywhere

* fixes from review
2018-10-12 19:21:46 -04:00
Zarko Milosevic 2363d88979 consensus: Wait for proposal or timeout before prevote (#2540)
* Fix termination issues and improve tests

* Improve formatting and tests based on reviewer feedback
2018-10-12 16:13:01 -04:00
Anton Kaliaev e1538bf67e state: require block.Time of the fist block to be genesis time (#2594)
* require block.Time of the fist block to be genesis time

Refs #2587:

```
We only start validating block.Time when Height > 1, because there is no
commit to compute the median timestamp from for the first block. This
means a faulty proposer could make the first block with whatever time
they want.

Instead, we should require the timestamp of block 1 to match the genesis
time.

I discovered this while refactoring the ValidateBlock tests to be
table-driven while working on tests for #2560.
```

* do not accept blocks with negative height

* update changelog and spec

* nanos precision for test genesis time

* Fix failing test (#2607)
2018-10-12 01:03:58 -04:00
Alessio Treglia 3744e8271d [R4R] Pass nil to NewValidatorSet() when genesis file's Validators field is nil (#2617)
* Pass nil to NewValidatorSet() when genesis file's Validators field is nil

Closes: #2616

* Update CHANGELOG_PENDING.md
2018-10-11 23:37:21 -04:00
Ethan Buchman feb08fa4f8
ed25519: use golang/x/crypto fork (#2558)
* ed25519: use golang/x/crypto fork

* changelog

* gix GenerateFromPassword

* fixes from review
2018-10-11 10:01:53 -04:00
Anton Kaliaev 9a6cdaddf2
fix contributor's name in CHANGELOG_PENDING (#2599)
Refs https://github.com/tendermint/tendermint/pull/2506#issuecomment-428458974
2018-10-10 21:29:13 +04:00
Dev Ojha 12fa9d1cab crypto/merkle: Remove byter in favor of plain byte slices (#2595)
* crypto/merkle: Remove byter in favor of plain byte slices

This PR is fully backwards compatible in terms of function output!
(The Go API differs though) The only test case changes was to refactor
it to be table driven.

* Update godocs per review comments
2018-10-10 12:46:09 -04:00
Ethan Buchman 6ec52a9233
types: cap evidence in block validation (#2560)
* cap evidence in block validation

* state: use table-driven test for ValidateBlockHeader

* state: test evidence cap

* fixes from review
2018-10-09 13:31:21 -04:00
Dev Ojha d7341c4057 distribution: Lock binary dependencies to specific commits (#2550) 2018-10-09 19:28:15 +02:00
goolAdapter 4b2bf023dd libs: Fix event concurrency flaw (#2519)
* fix event concurrency flaw
* modify changelog
* fix a mistake
* fix a lint issue
* modify changelog
* modify for review issue
* modify for review issue
* modify for review issue
2018-10-08 15:36:31 +02:00
Dev Ojha b1e7fac787 crypto/random: Use chacha20, add forward secrecy (#2562)
Ref #2099
2018-10-08 15:15:56 +02:00
goolAdapter 5f88fe0e9b fix p2p switch FlushThrottle value (#2569) 2018-10-08 10:05:12 +04:00
Ethan Buchman f471fc4963
abci: codespace (#2557)
* abci: codespace

* changelog
2018-10-06 09:20:15 -04:00
Dev Ojha dfda7b442f types: Remove pubkey from validator hash (#2512)
* types: Remove pubkey from validator hash

* undo lock file change

* Update Spec
2018-10-05 19:26:52 -04:00
Dev Ojha c648c93807 Fix random distribution in bitArray.PickRandom (#2534)
* Fix random distribution in bitArray.PickRandom

Previously it was very biased. 63 "_" followed by a single "x" had
much greater odds of being chosen. Additionally, the last element was
skewed. This fixes that by first preproccessing the set of all true
indices, and then randomly selecting a single element from there.

This commit also makes the code here significantly simpler, and
improves test cases.

* unlock mtx right after we select true indices
2018-10-05 11:00:50 +04:00
Zarko Milosevic 12675ecd92 consensus: Wait timeout precommit before starting new round (#2493)
* Disable transitioning to new round upon 2/3+ of Precommit nils

Pull in ensureVote test function from https://github.com/tendermint/tendermint/pull/2132

* Add several ensureX test methods to wrap channel read with timeout

* Revert panic in tests
2018-10-04 09:37:13 -04:00
Anton Kaliaev cb2e58411f add a missing changelog entry 2018-10-03 11:29:04 +04:00
ValarDragon 0755a5203d bit_array: Simplify subtraction
also, fix potential bug in Or function
2018-10-03 11:29:04 +04:00
goolAdapter 5c6999cf8f fix evidence db iter leak (#2516)
Also make reversing a slice more efficient
2018-10-02 11:52:56 +04:00
Anton Kaliaev 32e274cff0 config: Refactor ValidateBasic (#2503)
* timeouts as time.Duration are also breaking for old configs
* split BaseConfig#ValidateBasic into smaller methods
2018-10-01 14:38:35 +02:00
Ethan Buchman 52e21cebcf
remove some xxx comments and the config.mempool.recheck_empty (#2505)
* remove some XXX

* config: remove Mempool.RecheckEmpty

* docs: remove recheck_empty
2018-09-30 13:28:34 -04:00
Ethan Buchman f36ed7e7ff
General Merkle Follow Up (#2510)
* tmlibs -> libs

* update changelog

* address some comments from review of #2298
2018-09-28 23:32:13 -04:00
Ismail Khoffi fc073746a0 privval: Switch to amino encoding in SignBytes (#2459)
* switch to amino for SignBytes and add Reply with error message

- currently only Vote is done

* switch Reply type in socket for other messages

 - add error description on error

* add TODOs regarding error handling

* address comments from peer review session (thx @xla)

 - contains all changes besides the test-coverage / error'ing branches

* increase test coverage:

 - add tests for each newly introduced error'ing code path

* return error if received wrong response

* add test for wrong response branches (ErrUnexpectedResponse)

* update CHANGELOG_PENDING and related documentation (spec)

* fix typo: s/CanonicallockID/CanonicalBlockID

* fixes from review
2018-09-28 19:57:29 -04:00
Anton Kaliaev 47bc15c27a disable mempool WAL by default (#2490) 2018-09-28 19:28:42 -04:00
Anton Kaliaev 4c4a95ca53 config: Add ValidateBasic (#2485)
* add missing options to config.toml template and docs
Refs #2232
* config#ValidateBasic
Refs #2232
* [config] timeouts as time.Duration, not ints
Why:
- native type provides better guarantees than ", in ms" comment (harder
to shoot yourself in the leg)
- flexibility: you can change units
2018-09-26 12:04:44 +02:00
goolAdapter 110b07fb3f libs: Call Flush() before rename #2428 (#2439)
* fix Group.RotateFile need call Flush() before rename. #2428
* fix some review issue. #2428
 refactor Group's config: replace  setting member with initial option
* fix a handwriting mistake
* fix a time window error between rename and write.
* fix a syntax mistake.
* change option name Get_ to With_
* fix review issue
* fix review issue
2018-09-25 13:22:45 +02:00
Matthew Slipper 587116dae1 metrics: Add additional metrics to p2p and consensus (#2425)
* Add additional metrics to p2p and consensus
Partially addresses https://github.com/cosmos/cosmos-sdk/issues/2169.
* WIP
* Updates from code review
* Updates from code review
* Add instrumentation namespace to configuration
* Fix test failure
* Updates from code review
* Add quotes
* Add atomic load
* Use storeint64
* Use addInt64 in writePacketMsgTo
2018-09-25 13:14:38 +02:00
Anton Kaliaev d12e55c494 node: Respond always to OS interrupts (#2479)
* stop node upon receiving SIGTERM or CTRL-Ceven during genesis sleep by setting up interrupt before starting a node

Closes #2434

* call Start, not OnStart when starting a component to avoid:

```
E[09-24|10:13:15.805] Not stopping PubSub -- have not been started yet module=pubsub impl=PubSub
```

being printed on exit
2018-09-25 12:24:18 +02:00
Ethan Buchman ee8b8bbefb flush changelog pending, bump version 2018-09-21 17:41:02 -04:00
Ethan Buchman dde0936fb8 linkify changelog 2018-09-21 17:37:40 -04:00
Ethan Buchman 2dfde37f44 update changelog and upgrading 2018-09-21 17:34:36 -04:00
Zarko Milosevic f99e4010f2 Add stats related channel between consensus state and reactor (#2388) 2018-09-21 14:36:48 -04:00
Alessio Treglia f11db8c1b0 Pass http.ServeTLS() errors back to the caller (#2461)
Closes: #2460

* Pass http.ServeTLS() errors back to the caller
* Update CHANGELOG
* Amend StartHTTPServer() too for consistency's sake
* Revert "Amend StartHTTPServer() too for consistency's sake"
This reverts commit 23bfb4c2e917f581702291fe3ea69fce23f8c89d.
2018-09-21 18:12:29 +02:00
Ethan Buchman 7b727bf3d0
Minor changelog fixes (#2449)
* readme: add some libs to semver

* changelog: some updates
2018-09-20 11:55:36 -04:00
Anton Kaliaev bd951171db docs: Add missing changelog entry and comment (#2451)
Follow-up on https://github.com/tendermint/tendermint/pull/2411
2018-09-20 11:14:02 +02:00
Dev Ojha 0d6b75bd53 common: Delete unused functions (#2452)
These functions were not used anywhere within tendermint, or the
cosmos-sdk. (The functionality is already duplicated in the cosmos-sdk
types package)

* common: Delete unused functions within byteslice
* remove more unused code from strings.go and int.go
* Remove more unused code from int.go
* Fix testcase
2018-09-20 11:12:42 +02:00
bradyjoestar 26aa978456 Make mempool cache a proper LRU (#2407)
Closes #2399
2018-09-19 21:40:22 +04:00
Dev Ojha c0cdb9d441 libs : Remove libs/common/word.go (#2431)
We didn't use this code anywhere in the codebase. As such, we probably
should reduce the surface area we support. In the event that we do
in fact require 256 bit words inside of tendermint, we should adapt
the stdlibs' internal word representations, which also handles SIMD.

Inside of the SDK, a separate solution for big ints / larger words
is employed, which uses big ints. This in turn does utilize the stdlibs
SIMD support.
2018-09-19 15:38:30 +02:00
Zarko Milosevic 2fbf810cd8 Delay starting node until Genesis time (#2389) 2018-09-18 13:16:50 +04:00
Anton Kaliaev 788474d08d
change consensus_block_interval_seconds metric type to gauge
Otherwise, it's impossible to see outliers
https://github.com/tendermint/tendermint/issues/1835#issuecomment-402054099
2018-09-18 12:16:01 +04:00
Anton Kaliaev 38bced2440
[types] add Address to GenesisValidator (#2418)
Refs #1714
2018-09-18 11:59:52 +04:00
Anton Kaliaev fc7f9bcaf6 rpc: Transform /status result.node_info.other into map (#2417)
* [rpc] transform /status result.node_info.other into map
* amino does not support maps, duh

Refs #2391
2018-09-17 18:39:52 +02:00
Dev Ojha 1ea64fc27f Make mempool aware of MaxGas requirement (#2360)
* Make mempool aware of MaxGas requirement

* update spec

* Add tests

* Switch GasWanted from kv store to persistent kv store

* Fix typo in test name

* switch back to using kvstore, not persistent kv store
2018-09-12 16:41:19 -04:00
Ethan Buchman b616e54c9b changelog and version 2018-09-05 19:26:55 -04:00
Ethan Buchman fae21c9f52 linkify changelog pending 2018-09-05 19:25:33 -04:00
Ethan Buchman c9510d0f50 name drop external contribs in changelog 2018-09-05 18:26:12 -04:00
Ethan Buchman 892b170818
Bucky/changelog (#2339)
* update changelog pending

* fixes from review
2018-09-05 18:02:45 -04:00
Anton Kaliaev eb5cf0f0dd ignore existing peers in DialPeersAsync (#2327)
* ignore existing peers in DialPeersAsync

Fixes #2253

* rename HasPeerWithAddress to IsDialingOrExistingAddress

[breaking] remove Switch#IsDialing

* check if addrBook is nil

to be consistent with other usages of addrBook across Switch

* different log messages for 2 use-cases
2018-09-05 11:52:22 -04:00
JamesRay d0bb1ab2b0 Filter out empty addresses in persistent_peers/seeds lists (#2323)
Fixes #2320
2018-09-05 10:13:25 +04:00
cong d27cd972d2 Index tx.height (#2324)
Refs #2051
2018-09-05 10:00:10 +04:00