Commit Graph

508 Commits

Author SHA1 Message Date
8da2a6a147 types/priv_validator: fixes for latest p2p and cmn 2018-02-09 17:24:30 -05:00
38d18ca11a Harden tests 2018-02-09 16:53:17 -05:00
32d9563a15 Format and consolidate 2018-02-09 16:53:17 -05:00
18f7e52562 Use secret connection 2018-02-09 16:53:17 -05:00
fec541373d Correct server protocol 2018-02-09 16:53:17 -05:00
ff600e9aa0 wip: check error of wire read 2018-02-09 16:53:17 -05:00
a49357b19e wip: Avoid underscore in var name 2018-02-09 16:53:17 -05:00
4b997c29ee wip: fix nil pointer deference 2018-02-09 16:53:17 -05:00
c27fda09dd wip: Comment types
* add comments to all public types
* fix comments to adhere to comment standards
2018-02-09 16:53:15 -05:00
459633fb4c types/priv_validator 2018-02-09 16:38:23 -05:00
15ef57c6d0 types: TxEventBuffer.Flush now uses capacity preserving slice clearing idiom
Fixes https://github.com/tendermint/tendermint/issues/1189

For every TxEventBuffer.Flush() invoking, we were invoking
a:
  b.events = make([]EventDataTx, 0, b.capacity)
whose intention is to innocently clear the events slice but
maintain the underlying capacity.

However, unfortunately this is memory and garbage collection intensive
which is linear in the number of events added. If an attack had access
to our code somehow, invoking .Flush() in tight loops would be a sure
way to cause huge GC pressure, and say if they added about 1e9
events maliciously, every Flush() would take at least 3.2seconds
which is enough to now control our application.

The new using of the capacity preserving slice clearing idiom
takes a constant time regardless of the number of elements with zero
allocations so we are killing many birds with one stone i.e
  b.events = b.events[:0]

For benchmarking results, please see
https://gist.github.com/odeke-em/532c14ab67d71c9c0b95518a7a526058
for a reference on how things can get out of hand easily.
2018-02-05 23:34:15 -08:00
7a5060dc52 replace data.Bytes with cmn.HexBytes 2018-02-03 03:47:01 -05:00
cd0fd06b0d update for sdk2 libs. need to fix kv test
NOTE we only updating for tmlibs and abci
2018-02-03 03:35:02 -05:00
4e3488c677 update types 2018-02-03 03:23:10 -05:00
1c01671ec6 improve vague error msg, closes #1158 2018-01-31 17:44:19 +00:00
57cc8ab977 Merge pull request #1143 from tendermint/1091-race-condition
call FlushSync before calling CommitSync
2018-01-24 14:22:43 -05:00
5f3048bd09 call FlushSync before calling CommitSync
if we call it after, we might receive a "fresh" transaction from
  `broadcast_tx_sync` before old transactions (which were not
  committed).

Refs #1091

```
Commit is called with a lock on the mempool, meaning no calls to CheckTx
can start. However, since CheckTx is called async in the mempool
connection, some CheckTx might have already "sailed", when the lock is
released in the mempool and Commit proceeds.

Then, that spurious CheckTx has not yet "begun" in the ABCI app (stuck
in transport?). Instead, ABCI app manages to start to process the
Commit. Next, the spurious, "sailed" CheckTx happens in the wrong place.
```
2018-01-23 16:56:14 +04:00
ee674f919f StopPeerForError in blockchain and consensus 2018-01-21 13:32:04 -05:00
b1485b181a Merge branch 'p2p-consolidate' into p2p-id 2018-01-13 15:20:23 -05:00
32311acd01 Vulnerability in light client proxy (#1081)
* Vulnerability in light client proxy

When calling GetCertifiedCommit the light client proxy would call
Certify and even on error return the Commit as if it had been correctly
certified.

Now it returns the error correctly and returns an empty Commit on error.

* Improve names for clarity

The lite package now contains StaticCertifier, DynamicCertifier and
InqueringCertifier. This also changes the method receivers from one
letter to two letter names, which will make future refactoring easier
and follows the coding standards.

* Fix test failures

* Rename files

* remove dead code
2018-01-09 10:36:11 -06:00
b9cbaf8f10 priv-val: fix timestamp for signing things that only differ by timestamp 2018-01-08 16:36:16 -05:00
cf42611187 Merge pull request #997 from tendermint/919-careful-with-validator-voting
check for overflow and underflow while choosing proposer
2018-01-07 16:48:39 -05:00
a17105fd46 p2p: peer.Key -> peer.ID 2018-01-01 22:39:05 -05:00
28bbeac763 state: send byzantine validators in BeginBlock 2017-12-29 11:26:55 -05:00
cb845ebff5 fix EvidencePool and VerifyEvidence 2017-12-28 23:15:54 -05:00
ae68fcb78a move fireEvents to ApplyBlock 2017-12-28 23:15:54 -05:00
f55135578c state: move methods to funcs 2017-12-28 23:15:54 -05:00
d0e0ac5fac types: better error messages for votes 2017-12-27 14:46:24 -05:00
6a4fd46479 fixes from rebase 2017-12-26 20:42:34 -05:00
0f293bfc2b remove some TODOs 2017-12-26 20:27:40 -05:00
c13e93d63e evidence: store tests and fixes 2017-12-26 20:27:40 -05:00
cc418e5dab state.VerifyEvidence enforces EvidenceParams.MaxAge 2017-12-26 20:27:32 -05:00
869d873d5c state.ApplyBlock takes evpool and calls MarkEvidenceAsCommitted 2017-12-26 20:27:32 -05:00
3271634e7a types: evidence cleanup 2017-12-26 20:26:21 -05:00
7a18fa887d evidence linked with consensus/node. compiles 2017-12-26 20:26:21 -05:00
6c4a0f9363 cleanup evidence pkg. state.VerifyEvidence 2017-12-26 20:26:21 -05:00
df3f4de7c3 check evidence is from validator; some cleanup 2017-12-26 20:25:14 -05:00
10c43c9edc introduce evidence store 2017-12-26 20:25:14 -05:00
48d778c4b3 types/params: introduce EvidenceParams 2017-12-26 20:24:12 -05:00
7d086e9524 check if we already have evidence 2017-12-26 20:21:17 -05:00
6e9433c7a8 post rebase fix 2017-12-26 20:21:17 -05:00
eeab0efa56 types: tx.go comments 2017-12-26 20:21:17 -05:00
77e45756f2 types: Evidences for merkle hashing; Evidence.String() 2017-12-26 20:21:17 -05:00
9cdcffbe4b types: comments; compiles; evidence test 2017-12-26 20:21:17 -05:00
50850cf8a2 verify sigs on both votes; note about indices 2017-12-26 20:21:17 -05:00
35587658cd verify evidence in block 2017-12-26 20:21:17 -05:00
4661c98c17 add pubkey to conflicting vote evidence 2017-12-26 20:21:17 -05:00
7928659f70 track evidence, include in block 2017-12-26 20:21:17 -05:00
028ee58580 call it LastResultsHash 2017-12-26 19:53:26 -05:00
73fb1c3a17 consolidate saveResults/SaveABCIResponses 2017-12-26 19:24:45 -05:00