Commit Graph

7604 Commits

Author SHA1 Message Date
Marko
89f0bbbd76 libs/common: Refactor libs/common 4 (#4237)
* libs/common: Refactor libs/common 4

- move byte function out of cmn to its own pkg
- move tempfile out of cmn to its own pkg
- move throttletimer to its own pkg

ref #4147

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* add changelog entry

* fix linting issues
2019-12-11 23:16:35 +01:00
Anton Kaliaev
15e80d2448 config: add rocksdb as a db backend option (#4239)
Closes #3831

The support for rocksdb was added a while back in
https://github.com/tendermint/tm-db/pull/12. This commit merely updates
the documentation.
2019-12-11 21:15:27 +04:00
Anton Kaliaev
4da816a849 cli: add optional --genesis_hash flag to check genesis hash upon startup (#4238)
Closes #4113
2019-12-11 15:48:46 +04:00
Anton Kaliaev
0f69336148 docs: remove "0 means latest" from swagger docs (#4236)
Fixes #4014

The reason being when you call any endpoint supporting optional height
and use `height=0`, it will return an error. For example:

```
$ curl localhost:2667/consensus_params?height=0
{
  "jsonrpc": "2.0",
  "id": -1,
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "height must be greater than 0"
  }
}
```
2019-12-11 14:16:38 +04:00
Prince Sinha
2b30f02879 cli: add --db_backend and --db_dir flags to tendermint node cmd (#4235)
Fixes #4234
2019-12-11 12:59:57 +04:00
Marko
27b00cf8d1 libs/common: refactor libs common 3 (#4232)
* libs/common: refactor libs common 3

- move nil.go into types folder and make private
- move service & baseservice out of common into service pkg

ref #4147

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* add changelog entry
2019-12-11 09:31:25 +01:00
Prince Sinha
efc27ab0b9 abci/kvstore: return LastBlockHeight and LastBlockAppHash in Info (#4233)
Fixes #4177
2019-12-11 12:09:43 +04:00
Marko
afc4d7a61f libs/common: refactor libs/common 2 (#4231)
* libs/common: refactor libs/common 2

- move random function to there own pkg

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* change imports and usage throughout repo

* fix goimports

* add changelog entry
2019-12-10 18:38:34 +01:00
Marko
dfebac86f7 libs/common: refactor libs/common 01 (#4230)
* libs/common: Refactor libs/common 01

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* regenerate proto files, move intslice to where its used

* update kv.KVPair(s) to kv.Pair(s)

* add changelog entry

* make intInSlice private
2019-12-10 12:40:01 +01:00
Marko
6b1fef7f4d rpc: update swagger docs to openapi 3.0 (#4223)
* rpc: Update swagger docs to openapi 3.0

- closes #4144

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* adding content sections for schemas

* removal of produces & consumes

* add parameters

* remove x from examples & disable contract tests until dredd is stable
2019-12-10 09:14:49 +01:00
dongsamb
a61f19b12e set Go 1.13 as min required version (#4228) 2019-12-10 11:42:55 +04:00
dependabot-preview[bot]
8b1b5b21c6 build(deps): bump github.com/spf13/viper from 1.5.0 to 1.6.1 (#4224)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.5.0...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-09 10:50:40 +01:00
Sean Braithwaite
f309077465 update CONTRIBUTING.md (#4180)
* First pass at updating the contribution guidelines

* Update CONTRIBUTING.md

Co-Authored-By: Tess Rinearson <tess.rinearson@gmail.com>

* Update CONTRIBUTING.md

Co-Authored-By: Tess Rinearson <tess.rinearson@gmail.com>

* Update CONTRIBUTING.md

Co-Authored-By: Tess Rinearson <tess.rinearson@gmail.com>

* Update CONTRIBUTING.md

Co-Authored-By: Tess Rinearson <tess.rinearson@gmail.com>

* Align text flow with diagram

* tweaks based on feedback

* add text for existing issue

* tweaks
2019-12-09 10:35:51 +04:00
Tess Rinearson
d1ada18721 docs/introduction: add notes on architecture intro (#4175) 2019-12-06 16:59:50 +01:00
Marko
00c4b52a58 docs: fix broken ecosystem link (#4222)
I put it as the awesome repo ecosytem section as this is currently the only place where there is tendermint only ecosystem information.

- closes #4198

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-12-06 19:04:44 +04:00
Marko
70d94b8adf docs: Fix broken rpc link (#4221)
- chane rpc link to master branch rpc docs, current link leads to 404
- closes #4199

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-12-06 18:57:26 +04:00
Marko
3e2751d274 lint: Enable Golint (#4212)
* Fix many golint errors

* Fix golint errors in the 'lite' package

* Don't export Pool.store

* Fix typo

* Revert unwanted changes

* Fix errors in counter package

* Fix linter errors in kvstore package

* Fix linter error in example package

* Fix error in tests package

* Fix linter errors in v2 package

* Fix linter errors in consensus package

* Fix linter errors in evidence package

* Fix linter error in fail package

* Fix linter errors in query package

* Fix linter errors in core package

* Fix linter errors in node package

* Fix linter errors in mempool package

* Fix linter error in conn package

* Fix linter errors in pex package

* Rename PEXReactor export to Reactor

* Fix linter errors in trust package

* Fix linter errors in upnp package

* Fix linter errors in p2p package

* Fix linter errors in proxy package

* Fix linter errors in mock_test package

* Fix linter error in client_test package

* Fix linter errors in coretypes package

* Fix linter errors in coregrpc package

* Fix linter errors in rpcserver package

* Fix linter errors in rpctypes package

* Fix linter errors in rpctest package

* Fix linter error in json2wal script

* Fix linter error in wal2json script

* Fix linter errors in kv package

* Fix linter error in state package

* Fix linter error in grpc_client

* Fix linter errors in types package

* Fix linter error in version package

* Fix remaining errors

* Address review comments

* Fix broken tests

* Reconcile package coregrpc

* Fix golangci bot error

* Fix new golint errors

* Fix broken reference

* Enable golint linter

* minor changes to bring golint into line

* fix failing test

* fix pex reactor naming

* address PR comments
2019-12-05 10:12:08 +01:00
Sunny Aggarwal
b0bb8a1437 crypto: add sr25519 signature scheme (#4190)
* sr25519

* added amino encoding

* fixed dependencies

* Apply suggestions from code review

Co-Authored-By: Tess Rinearson <tess.rinearson@gmail.com>
Co-Authored-By: Marko <marbar3778@yahoo.com>

* file structure

* Apply suggestions from code review

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* address @melekes and @marbar3778 review

* removed nolint

* CHANGELOG and go-schnorrkel mod update
2019-12-05 09:41:38 +01:00
Jonathan Gimeno
06b8752a46 docs: add flag documentation (#4219) 2019-12-04 18:48:26 +01:00
Marko
92d18d7fcd Rename Tag(s) to Event(s) (#4046)
* Rename Tag(s) to Event(s)

- tag was replaced with event, but in some places it still mentions tag, would be easier to understand if we tried to replace it with event to not confuse people.

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* more  changes from tag -> event

* rename events to compositeKeys and keys

* Apply suggestions from code review

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* add minor documentation on how composite keys are constructed

* rename eventkey to compositekey

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* add changelog entry & add info to regenerate confid to changelog entry
2019-12-04 12:37:48 +01:00
w1t
1c46145be7 networks/remote: turn on GO111MODULE and use git clone instead of go get (#4203)
To execute the integration.sh, you need to run  "source ./integration.sh".  just execute command "./integration.sh" will not work. 

It is because "source ~/.profile" executes in a separate shell than the integration.sh script 
# **turn on the go module, default is auto. The value is off, if tendermint source code
#is downloaded under $GOPATH/src directory

echo "export GO111MODULE=on" >> ~/.profile

# ** use git clone instead of go get.
# once go module is on, go get will download source code to
# specific version directory under $GOPATH/pkg/mod the make
# script will not work
git clone https://github.com/tendermint/tendermint.git

#** need to install the package, otherwise tendermint testnet will not execute
make install
2019-12-04 15:17:57 +04:00
Anton Kaliaev
49ffb70e41 p2p: extract maxBackoffDurationForPeer func and remove 1 test (#4218)
* p2p/pex: extract maxBackoffDurationForPeer func

* p2p: remove unnecessary TestSwitchAcceptRoutineUnconditionalPeersFirst
2019-12-04 12:30:34 +04:00
dongsamb
701e9cac4d p2p: add unconditional_peer_ids and persistent_peers_max_dial_period (#4176)
implementation spec of Improved Trusted Peering ADR-050 by B-Harvest

- add unconditional_peer_ids and persistent_peers_max_dial_period to config
- add unconditionalPeerIDs map to Switch struct

default config value of persistent_peers_max_dial_period is 0s(disabled)

Refs #4072, #4053
2019-12-04 11:44:07 +04:00
Jonathan Gimeno
100078ca05 cli: add --cs.create_empty_blocks_interval flag (#4205)
Closes #4065
2019-12-02 14:20:23 +04:00
Sean Braithwaite
55278211ed Blockchain v2 Scheduler (#4043)
* Add processor prototype

* Change processor API

    + expose a simple `handle` function which mutates internal state

* schedule event handling

* rename schedule -> scheduler

* fill in handle function

* processor tests

* fix gofmt and ohter golangci issues

* scopelint var on range scope

* add check for short block received

* small test reorg

* ci fix changes

* go.mod revert

* some cleanup and review comments

* scheduler fixes and unit tests, also small processor changes.

changed scPeerPruned to include a list of pruned peers

touchPeer to check peer state and remove the blocks from blockStates if the peer removal causes the max peer height to be lower.

remove the block at sc.initHeight

changed peersInactiveSince, peersSlowerThan, getPeersAtHeight check peer state

prunablePeers to return a sorted list of peers

lastRate in markReceived() attempted to divide by 0, temp fix.

fixed allBlocksProcessed conditions

maxHeight() and minHeight() to return sc.initHeight if no ready peers present

make selectPeer() deterministic.

added handleBlockProcessError()

added termination cond. (sc.allBlocksProcessed()) to handleTryPrunePeer() and others.

changed pcBlockVerificationFailure to include peer of H+2 block along with the one for H+1

changed the processor to call purgePeer on block verification failure.

fixed processor tests

added scheduler tests.

* typo and ci fixes

* remove height from scBlockRequest, golangci fixes

* limit on blockState map, updated tests

* remove unused

* separate test for maxHeight(), used for sched. validation

* use Math.Min

* fix golangci

* Document the semantics of blockStates in the scheduler

* better docs

* distinguish between unknown and invalid blockstate

* Standardize peer filtering methods

* feedback

* s/getPeersAtHeight/getPeersAtHeightOrAbove

* small notes

* Update blockchain/v2/scheduler.go

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* Update comments based on feedback

* Add enum offset

* panic on nil block in processor

* remove unused max height calculation

* format shorter line
2019-12-02 11:01:24 +01:00
Sean Braithwaite
0523ecf632 docs: update ADR 43 with links to PRs (#4207) 2019-12-02 09:02:10 +04:00
Black3HDF
c066b39396 docs: fix broken links in consensus/readme.md (#4200) 2019-11-28 13:22:44 +04:00
Anca Zamfir
759ccebe54 types: prevent spurious validator power overflow warnings when changing the validator set (#4183)
Fix for #4164
The general problem is that in certain conditions an overflow warning is issued when attempting to update a validator set even if the final set's total voting power is not over the maximum allowed.
Root cause is that in verifyUpdates(), updates are verified wrt to total voting power in the order of validator address. It is then possible that a low address validator may increase its power such that the temporary total voting power count goes over MaxTotalVotingPower.

Scenarios where removing and adding/ updating validators with high voting power, in the same update operation, cause the same false warning and the updates are not applied.

Main changes to fix this are in verifyUpdate() that now does the verification starting with the decreases in power. It also takes into account the removals that are part of the update.

## Commits:

* tests for overflow detection and prevention

* test fix

* more tests

* fix the false overflow warnings and golint

* scopelint warning fix

* review comments

* variant with using sort by amount of change in power

* compute separately number new validators in update

* types: use a switch in processChanges

* more review comments

* types: use HasAddress in numNewValidators

* types: refactor verifyUpdates

copy updates, sort them by delta and use resulting slice to calculate
tvpAfterUpdatesBeforeRemovals.

* remove unused structs

* review comments

* update changelog
2019-11-26 17:05:25 +04:00
Zaki Manian
af3afc2817 p2p/conn: simplify secret connection handshake malleability fix with merlin (#4185)
* p2p/conn: simplify secret connection handshake malleability fix with merlin

Introduces new dependencies on github.com/gtank/merlin and sha3 as a cryptographic primitive

This also only uses the transcript hash as a MAC.

* p2p/conn: avoid string to byte conversion

https://github.com/uber-go/guide/blob/master/style.md#avoid-string-to-byte-conversion
2019-11-26 12:40:06 +01:00
Anton Kaliaev
ad715fe966 types: change Commit to consist of just signatures (#4146)
* types: change `Commit` to consist of just signatures

These are final changes towards removing votes from commit and leaving
only signatures (see ADR-25)

Fixes #1648

* bring back TestCommitToVoteSetWithVotesForAnotherBlockOrNilBlock

+ add absent flag to Vote to indicate that it's for another block

* encode nil votes as CommitSig with BlockIDFlagAbsent

+ make Commit#Precommits array of non-pointers
because precommit will never be nil

* add NewCommitSigAbsent and Absent() funcs

* uncomment validation in CommitSig#ValidateBasic

* add comments to ValidatorSet funcs

* add a changelog entry

* break instead of continue

continue does not make sense in these cases

* types: rename Commit#Precommits to Signatures

* swagger: fix /commit response

* swagger: change block_id_flag type

* fix merge conflicts
2019-11-26 14:10:38 +04:00
Anton Kaliaev
fb8b00f1d8 lite2: light client with weak subjectivity (#3989)
Refs #1771

ADR: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-044-lite-client-with-weak-subjectivity.md

## Commits:

* add Verifier and VerifyCommitTrusting

* add two more checks

make trustLevel an option

* float32 for trustLevel

* check newHeader time

* started writing lite Client

* unify Verify methods

* ensure h2.Header.bfttime < h1.Header.bfttime + tp

* move trust checks into Verify function

* add more comments

* more docs

* started writing tests

* unbonding period failures

* tests are green

* export ErrNewHeaderTooFarIntoFuture

* make golangci happy

* test for non-adjusted headers

* more precision

* providers and stores

* VerifyHeader and VerifyHeaderAtHeight funcs

* fix compile errors

* remove lastVerifiedHeight, persist new trusted header

* sequential verification

* remove TrustedStore option

* started writing tests for light client

* cover basic cases for linear verification

* bisection tests PASS

* rename BisectingVerification to SkippingVerification

* refactor the code

* add TrustedHeader method

* consolidate sequential verification tests

* consolidate skipping verification tests

* rename trustedVals to trustedNextVals

* start writing docs

* ValidateTrustLevel func and ErrOldHeaderExpired error

* AutoClient and example tests

* fix errors

* update doc

* remove ErrNewHeaderTooFarIntoFuture

This check is unnecessary given existing a) ErrOldHeaderExpired b)
h2.Time > now checks.

* return an error if we're at more recent height

* add comments

* add LastSignedHeaderHeight method to Store

I think it's fine if Store tracks last height

* copy over proxy from old lite package

* make TrustedHeader return latest if height=0

* modify LastSignedHeaderHeight to return an error if no headers exist

* copy over proxy impl

* refactor proxy and start http lite client

* Tx and BlockchainInfo methods

* Block method

* commit method

* code compiles again

* lite client compiles

* extract updateLiteClientIfNeededTo func

* move final parts

* add placeholder for tests

* force usage of lite http client in proxy

* comment out query tests for now

* explicitly mention tp: trusting period

* verify nextVals in VerifyHeader

* refactor bisection

* move the NextValidatorsHash check into updateTrustedHeaderAndVals

+ update the comment

* add ConsensusParams method to RPC client

* add ConsensusParams to rpc/mock/client

* change trustLevel type to a new cmn.Fraction type

+ update SkippingVerification comment

* stress out trustLevel is only used for non-adjusted headers

* fixes after Fede's review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* compare newHeader with a header from an alternative provider

* save pivot header

Refs https://github.com/tendermint/tendermint/pull/3989#discussion_r349122824

* check header can still be trusted in TrustedHeader

Refs https://github.com/tendermint/tendermint/pull/3989#discussion_r349101424

* lite: update Validators and Block endpoints

- Block no longer contains BlockMeta
- Validators now accept two additional params: page and perPage

* make linter happy
2019-11-25 19:07:40 +04:00
Marko
ceb105316b Docs theme latest (#4179)
* docs: remove specs, they live in spec repo (#4172)

* docs: remove specs, they live in spec repo

- moving specs to spec repo
- https://github.com/tendermint/spec/pull/62 PR for updating them

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* add makefile command to copy in sepcs from specREPO

- move cloning of spec repo to pre and post scripts

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-11-25 15:34:40 +01:00
Leslie Cheung
98e0b5297c doc: fix broken links (#4186)
replaces https://tendermint.com/docs" with "https://docs.tendermint.com/master"
2019-11-25 13:47:38 +04:00
Anton Kaliaev
c43143707a changelog: GotVoteFromUnwantedRoundError -> ErrGotVoteFromUnwantedRound
https://github.com/tendermint/tendermint/pull/4153#discussion_r348868269
2019-11-22 12:59:08 +04:00
Anton Kaliaev
edd6ee2a09 changelog: explain breaking changes better 2019-11-22 12:59:08 +04:00
Anton Kaliaev
d7d61e9a6c tools.mk: install protoc
- works only for Linux / Mac 64bit
- you need to call it manually - make protoc
- on Mac, brew install protoc might be favorable
2019-11-22 12:59:08 +04:00
Anton Kaliaev
0d0d151e2e tools.mk: use tags instead of revisions where possible 2019-11-22 12:59:08 +04:00
Anton Kaliaev
82e48426f2 Vagrantfile: update Go version 2019-11-22 12:59:08 +04:00
Anton Kaliaev
208a8d37e6 types: remove dots from errors in SignedHeader#ValidateBasic 2019-11-22 12:59:08 +04:00
Anton Kaliaev
43aed989ac cs: clarify where 24 comes from in maxMsgSizeBytes (wal.go) 2019-11-22 12:59:08 +04:00
Anton Kaliaev
d5ed8a794b types: change number_txs to num_txs json tag in BlockMeta
and EventDataNewBlockHeader
2019-11-22 12:59:08 +04:00
Anton Kaliaev
d840fa3f02 docs: mention that Evidence votes are now sorted 2019-11-22 12:59:08 +04:00
Alex Kogon
72f39e2d1f Fixed typo (#4181) 2019-11-21 17:23:37 -05:00
Anthony
fb9e667f18 prefix proto types (#4007)
Fixes #3986

This pull request is prefixing all the types in proto to avoid conflict.

When a go application is using Tendermint as a library and also define similar types in gogo proto some conflicts might occur (as types is a common package in go).

By prefixing the types with tendermint, this highly reduces the risk of conflicts.

BREAKING CHANGE.

This modification breaks the ABCI Application endpoint.

What was accessible before with `/types.ABCIApplication/Flush` is now accessible with `/tendermint.abci.types.ABCIApplication/Flush`.
2019-11-21 12:00:33 +04:00
Greg Zaitsev
ee6601ad48 cs: don't panic when block is not found in store (#4163)
Fixes #4069
2019-11-21 11:47:59 +04:00
Marko
f78a994e26 update tm-db to 0.3.0 (#4158)
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-11-20 16:47:09 +01:00
Marko
68b2873c9b docs: update wording (#4174)
* docs: update wording

- change grants to funding for abci server

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-11-20 16:18:39 +01:00
Marko
eeb6ee1a9a [Docs]: Minor doc touchups (#4171)
- change link for bounties for different lang abci servers to interchainio funding repo
- link awesome repo ecosystem section in main docs readme

- closes #4110
- closes #4125

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-11-20 13:23:07 +01:00
Gustavo Chaín
fc0d5bca61 types: prevent temporary power overflows on validator updates (#4165)
Closes #4164
2019-11-20 12:31:14 +01:00
Marko
2b906630fa tools/tm-bench: remove tm-bench in favor of tm-load-test (#4169)
- tm-bench has a deprecation warning for 5 releases now, with the major release coming I removed the file and updated the docs to point to `tm-load-test` located in the interchainio repo

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-11-20 11:59:50 +01:00