Commit Graph

7934 Commits

Author SHA1 Message Date
Marko
8d63d7192f abci: regenerate proto files
## Description

regenerate proto stubs

I do find max_num to be vague. possibly renaming to max_entries or max_evidence_entries may be more descriptive?

Closes: #XXX
2020-05-11 16:54:54 +00:00
Callum Waters
7cb3d90e01 evidence: create proof of lock change and implement it in evidence store (#4746)
creates a proof of lock change which is an array of votes that proves the validator was permitted to change locked block and vote again. This proof is stored in the evidence pool and is used as a part of amnesia evidence
2020-05-11 17:06:01 +02:00
dependabot-preview[bot]
18f178bf3b build(deps): Bump github.com/spf13/viper from 1.6.3 to 1.7.0 (#4814) 2020-05-11 14:23:06 +00:00
Erik Grinaker
d28b47ced7 test: revert Go 1.13→1.14 bump
Since we support 1.13 and above, let's use that as a baseline for tests.
2020-05-11 14:10:31 +00:00
Marko
8dbca7aab3 swagger: remove duplicate blockID
## Description

remove duplicate BlockID in swagger files

Closes: #XXX
2020-05-11 13:59:16 +00:00
Anton Kaliaev
2afae13a48 privval: retry GetPubKey/SignVote/SignProposal N times before
returning an error

Closes #4707
2020-05-11 13:42:19 +00:00
Callum Waters
a620e5fd96 evidence: cap evidence to an absolute number (#4780)
The number of evidence that can be committed in a single block is capped by a new evidence parameter called MaxNum
2020-05-11 15:28:08 +02:00
dependabot-preview[bot]
fed2502618 build(deps): Bump vuepress-theme-cosmos from 1.0.163 to 1.0.164 in /docs (#4815) 2020-05-11 12:55:25 +00:00
Erik Grinaker
960c7402fe test: fix p2p test build breakage caused by Debian testing
Debian testing caused Docker image build failures:

```
The following packages have unmet dependencies:
 
 libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6 is to be installed
 
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
```

It does not appear that we actually need testing, so removing it.
2020-05-11 12:42:11 +00:00
Anton Kaliaev
398000a10d pex: use highwayhash for pex bucket
Closes #2998

Spec PR: https://github.com/tendermint/spec/pull/94
2020-05-08 08:16:29 +00:00
Anton Kaliaev
52784f67d0 mempool: allow ReapX and CheckTx functions to run in parallel
allow ReapX and CheckTx functions to run in parallel, making it not possible to block certain proposers from creating a new block.

Closes: #2972
2020-05-08 04:17:01 +00:00
Erik Grinaker
81c2798df0 abci: fix protobuf lint issues
Fix some linter issues to conform with the Protobuf style guide.

The state sync enum changes are ok to break since it's not released yet. Personally I find the uppercase kind of ugly, but that's what the guide says. Couldn't find a way to generate camel case in Go, short of specifying custom names for each and every enum variant.

Another option would be to simply disable the enum case lint.
2020-05-07 14:40:22 +00:00
Marko
678010c45e fix linters & switch to official linter (#4808) 2020-05-07 16:17:43 +02:00
Callum Waters
9535c47067 consensus: fix and rename TestStateLockPOLRelock (#4796)
correct test in consensus so that node relocks on same block and then changes lock when majority of another block is reached
2020-05-07 12:48:48 +02:00
Erik Grinaker
eb443f4b77 blockchain/v2: integrate with state sync
Integrates the blockchain v2 reactor with state sync, fixes #4765. This mostly involves deferring fast syncing until after state sync completes. I tried a few different approaches, this was the least effort:

* `Reactor.events` is `nil` if no fast sync is in progress, in which case events are not dispatched - most importantly `AddPeer`.

* Accept status messages from unknown peers in the scheduler and register them as ready. On fast sync startup, broadcast status requests to all existing peers.

* When switching from state sync, first send a `bcResetState` message to the processor and scheduler to update their states - most importantly the initial block height.

* When fast sync completes, shut down event loop, scheduler and processor, and set `events` channel to `nil`.
2020-05-07 10:34:01 +00:00
Anton Kaliaev
826a7150b7 types: remove extra validation in VerifyCommit
plus make sure LastCommit is always non-nil
2020-05-07 09:49:51 +00:00
Erik Grinaker
413e554fd0 rpc: handle panics during panic handling
Fixes #4802. The Go HTTP server has a global panic handler for requests, so it was not as severe as first thought.

This fix can still panic, since we try to send a `500` response - if that happens, the Go HTTP server will terminate the connection. Otherwise, the client will get a 200 response, which we should avoid. I'm sort of torn on whether it's even necessary to include this fix, instead of just letting the HTTP server deal with it.
2020-05-07 09:38:50 +00:00
Anton Kaliaev
d202fab478 types: simplify VerifyCommitTrusting
Closes #4783 

It looks like we're validating Commit twice. Also, height and blockID params were coming from the commit, so no need to pass them separately.
2020-05-07 09:24:31 +00:00
Anton Kaliaev
8b2ed8933a consensus: fix TestSimulateValidatorsChange
* consensus: fix TestSimulateValidatorsChange

* fix selfIndex calculation

* exit from goroutine after 1 sec

* reuse the function
2020-05-07 09:14:21 +00:00
Anton Kaliaev
25890a6635 types: sort validators by voting power
thus enabling faster commit verification assuming non uniform distribution of power.

Closes #2478

spec: https://github.com/tendermint/spec/pull/91
2020-05-06 07:37:36 +00:00
Anton Kaliaev
f6435f2c73 consensus: add comment as to why use mocks during replay (#4785)
Closes #4766
2020-05-06 10:32:25 +04:00
Marko
d37b8da013 p2p: return err on signChallenge (#4795)
* remove panic & todo in secret_connection
2020-05-05 17:29:41 +02:00
dependabot-preview[bot]
9f500067d3 build(deps): Bump github.com/golang/protobuf from 1.4.0 to 1.4.1 (#4794) 2020-05-05 12:47:11 +00:00
Callum Waters
47cfadb0aa evidence: refactor evidence mocks throughout packages (#4787)
Predominantly following the discussions regarding the conventions of using mocks, I have decided to revert back to the previous state where mocks were specialized and stored in the separate packages that used them rather then have a generalized mock in the evidence package.

This also was a problem as the state package were running tests too slow and occasionally timing out unnecessarily.

For the replay file I renamed mockEvidencePool to emptyEvidencePool to illustrate that it was intentionally like this and not give the impression that testing software was being used in production

Closes: #4786
2020-05-05 13:11:44 +04:00
Marko
b7c2d7a977 lint: enable nolintlinter, disable on tests
## Description
- enable nolintlint
- disable linting on tests

Closes: #XXX
2020-05-04 07:49:53 +00:00
Anton Kaliaev
336b929eaa types: return an error if voting power overflows
in VerifyCommitTrusting

Closes #4755
2020-05-04 07:35:47 +00:00
Marko
e4427b7292 linting: remove unused variable
## Description

left over variable
2020-04-30 11:39:42 +00:00
Erik Grinaker
663243c446 state: export InitStateVersion
This is useful for custom state sync `StateProvider` implementations that need to build new states for bootstrapping the node. It will also be useful when implementing other mechanisms to bootstrap nodes, e.g. #4642 and #3713.
2020-04-30 11:29:04 +00:00
Marko
ffc73ba03d ci: checkout code before git diff check (#4779) 2020-04-29 21:48:10 +02:00
Callum Waters
d1bd596bce mempool: move mock into mempool directory 2020-04-29 15:55:47 +02:00
Callum
61dbdf4f12 go formatting 2020-04-29 15:26:02 +02:00
Callum
15a9f1760d move mempool mock directory 2020-04-29 15:25:01 +02:00
Marko
1e925acd04 ci: check git diff on each job (#4770) 2020-04-29 14:55:15 +02:00
Callum Waters
fd71c6844f evidence: check evidence is pending before validating evidence
checks evidence store first to potentially save the work of having to verify again

fixes #4728
2020-04-29 14:16:04 +02:00
Callum Waters
ba967c077b Merge branch 'master' into callum/4728-check-evidence 2020-04-29 14:04:04 +02:00
Erik Grinaker
8108ac9d17 blockchain/v2: respect fast_sync option (#4772)
Not thoroughly tested, but seems to work. Will do further testing as this is integrated with state sync.

Fixes #4688.
2020-04-29 13:54:37 +02:00
Erik Grinaker
42483a2b91 adr-053: update after state sync merge (#4768) 2020-04-29 12:04:28 +02:00
Tess Rinearson
f55758929d build(deps): manually bump github.com/prometheus/client_golang from 1.5.1 to 1.6.0 (#4758)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.5.1...v1.6.0)

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-29 11:22:16 +02:00
Erik Grinaker
dcc19272f9 blockchain/v2: fix excessive CPU usage due to spinning on closed channels (#4761)
The event loop uses a `select` on multiple channels. However, reading from a closed channel in Go always yields the channel's zero value. The processor and scheduler close their channels when done, and since these channels are always ready to receive, the event loop keeps spinning on them.

This changes `routine.terminate()` to not close the channel, and also removes `stopDemux` and instead uses `events` channel closure to signal event loop termination.

Fixes #4687.
2020-04-29 11:03:04 +02:00
Erik Grinaker
511ab6717c add state sync reactor (#4705)
Fixes #828. Adds state sync, as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md). See related PRs in Cosmos SDK (https://github.com/cosmos/cosmos-sdk/pull/5803) and Gaia (https://github.com/cosmos/gaia/pull/327).

This is split out of the previous PR #4645, and branched off of the ABCI interface in #4704. 

* Adds a new P2P reactor which exchanges snapshots with peers, and bootstraps an empty local node from remote snapshots when requested.

* Adds a new configuration section `[statesync]` that enables state sync and configures the light client. Also enables `statesync:info` logging by default.

* Integrates state sync into node startup. Does not support the v2 blockchain reactor, since it needs some reorganization to defer startup.
2020-04-29 10:47:00 +02:00
Erik Grinaker
569981325a add ABCI interface for state sync snapshots (#4704)
Adds the ABCI interface for [state sync](https://github.com/tendermint/tendermint/issues/828) as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md), and bumps ABCIVersion to `0.17.0`.

The interface adds a new ABCI connection which Tendermint can use to query and load snapshots from the app (for serving snapshots to other nodes), and to offer and apply snapshots to the app (for state syncing a local node from peers).

Split out from the original PR in #4645, state sync reactor will be submitted as a separate PR. The interface is implemented by the Cosmos SDK in https://github.com/cosmos/cosmos-sdk/pull/5803.
2020-04-29 10:32:09 +02:00
Callum
82eb56b3e0 Merge remote-tracking branch 'origin/callum/4728-check-evidence' into callum/4728-check-evidence 2020-04-29 07:02:37 +02:00
Callum
c6acc54145 replaced other evidence mocks 2020-04-29 07:01:12 +02:00
Callum Waters
3da6d94001 Merge branch 'master' into callum/4728-check-evidence 2020-04-29 06:33:42 +02:00
Marko
7a87a784bf ci: only run when applicable (#4752)
- only run tests when .go, .mod, .sum files have been touched
- only run proto checks when .proto files have been touched

Signed-off-by: Marko Baricevic marbar3778@yahoo.com
2020-04-28 16:07:11 +02:00
Tess Rinearson
be42442e10 .github: fix whitespace for auto-comment (#4750) 2020-04-28 14:12:53 +02:00
Anton Kaliaev
071bcfe169 docs: state we don't support non constant time crypto
on 32 bit architectures or ARM

Closes #2103
2020-04-28 11:33:42 +00:00
Anton Kaliaev
f23f21f001 evidence: protect valToLastHeight w/ mtx
to prevent data races

note: when we check the ConflictingHeadersEvidence, the copy is used.

Closes #4749

Also, iterate over valToLastHeight instead of loading validators. While it might be slower than accessing a single key in goleveldb, the new code is better adapted to ConsensusParams changes.
2020-04-28 11:04:45 +00:00
Callum
6dc971052a replace old mocks with new mock 2020-04-28 12:59:18 +02:00
Callum
08aa4765b0 create tests for validating evidence 2020-04-28 12:54:13 +02:00