Commit Graph

7667 Commits

Author SHA1 Message Date
Erik Grinaker
66a544a640 Fix broken /docs/spec links (#4376) 2020-02-07 12:53:28 +01:00
dependabot-preview[bot]
3e2f299885 deps: bump google.golang.org/grpc from 1.27.0 to 1.27.1 (#4372)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.27.0 to 1.27.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.27.0...v1.27.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-06 16:51:30 +01:00
Callum Waters
af37db39b0 lite2: cross-check new header with all witnesses (#4373)
As opposed to checking a random witness, all witnesses provided should be used as a reference against the header provided by the primary node. This increases security (at the tradeoff of speed) but also gives control to the user. The more witnesses provided, the more secure the lite client can be.
2020-02-06 15:36:13 +01:00
Callum Waters
bb7a80ec7e lite2: fetch missing headers (#4362)
Closes #4328

When TrustedHeader(height) is called, if the height is less than the trusted height but the header is not in the trusted store then a function finds the previous lowest height with a trusted header and performs a forwards sequential verification to the header of the height that was given. If no error is found it updates the trusted store with the header and validator set for that height and can then return them to the user.

Commits:

* drafted trusted header

* created function to find previous trusted height

* updates missing headers less than the trusted height

* minor cosmetic tweaks

* incorporated suggestions

* lite2: implement Backwards verification

and add SignedHeaderAfter func to Store interface

Refs https://github.com/tendermint/tendermint/issues/4328#issuecomment-581878549

* remove unused method

* write tests

* start with next height in SignedHeaderAfter func

* fix linter errors

* address Callum's comments

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-02-06 12:30:37 +01:00
Callum Waters
df3eee455c lite2: replace primary provider with alternative when unavailable (#4354)
Closes issue #4338

Uses a wrapper function around both the signedHeader and validatorSet calls to the primary provider which attempts to retrieve the information 5 times before deeming the provider unavailable and replacing the primary provider with the first alternative before trying recursively again (until all alternatives are depleted)

Employs a mutex lock for any operations involving the providers of the light client to ensure no operations occurs whilst the new primary is chosen.

Commits:

* created swapProvider function

* eliminates old primary provider after replacement. Uses a mutex when changing providers

* renamed to replaceProvider

* created wrapped functions for signed header and val set

* created test for primary provider replacement

* implemented suggested revisions

* created Witnesses() and Primary()

* modified backoffAndJitterTime

* modified backoffAndJitterTime

* changed backoff base and jitter to functional arguments

* implemented suggested changes

* removed backoff function

* changed exp function to match go version

* halved the backoff time

* removed seeding and added comments

* fixed incorrect test

* extract backoff timeout calc into a function

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-02-04 13:02:20 +01:00
Marko
9b9f1beef3 docs: update guides proto paths (#4365)
* update guides with correct path to libs/kv proto files

* Apply suggestions from code review

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

* format something to rerun ci

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-02-03 18:15:27 +01:00
Tess Rinearson
fa34ff96b8 abci: fix broken spec link (#4366) 2020-02-03 15:00:31 +01:00
Anton Kaliaev
1edb542f99 lite2: make witnesses mandatory (#4358)
* lite2: make witnesses mandatory

at least one witness is required

* lite2: return an error if there are no witnesses

https://github.com/tendermint/tendermint/pull/4358#pullrequestreview-350635444

* cmd/lite: add witnesses flag

* fix linter errors
2020-02-03 13:59:16 +01:00
Tess Rinearson
81e3cca340 docs: update npm dependencies (#4364) 2020-02-03 12:56:34 +01:00
dependabot-preview[bot]
ca03e43d93 deps: bump github.com/golang/protobuf from 1.3.2 to 1.3.3 (#4359)
Bumps [github.com/golang/protobuf](https://github.com/golang/protobuf) from 1.3.2 to 1.3.3.
- [Release notes](https://github.com/golang/protobuf/releases)
- [Commits](https://github.com/golang/protobuf/compare/v1.3.2...v1.3.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-30 15:34:07 +04:00
Erik Grinaker
b04b752e5b Add ADR-053: State Sync Prototype (#4352) 2020-01-30 11:57:24 +01:00
Callum Waters
71d50f7ab5 lite2: panic if witness is on another chain (#4356)
Closes #4350

Checks that the chain ID of the witness and that of the lite client are the same before updating the witness list.
2020-01-30 11:21:17 +04:00
dependabot-preview[bot]
8b80de830f build(deps): bump google.golang.org/grpc from 1.26.0 to 1.27.0 (#4355)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.26.0...v1.27.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 12:41:44 +01:00
Anton Kaliaev
79b99f052b lite2: batch save & delete operations in DB store (#4345)
Closes #4330
2020-01-29 10:14:32 +04:00
Anton Kaliaev
587ac3a563 node: use GRPCMaxOpenConnections when creating the gRPC server (#4349)
not MaxOpenConnections

Fixes #4311

Also, set MaxBodyBytes, MaxHeaderBytes and WriteTimeout similar to HTTP
server.
2020-01-29 10:04:42 +04:00
Callum Waters
85244a42ea lite2: refactor cleanup() (#4343)
* lite2: add Start method

There are few reasons to do that:

1) separation of state and dynamics (some users will want to delay
   starting the light client; does not matter we should not allow them
   to create a light client object)
2) less important, but some users might not need autoUpdateRoutine and
   removeNoLongerTrustedHeadersRoutine routines

* lite2: wait till routines are finished in Stop

because they are started in Start, it feels more natural to wait for
them to finish in Stop.

* lite2: add TrustedValidatorSet func

* refactor cleanup code

* changed restore header and val function to handle negative height

* reverted restoreTrustedHeaderAndNextVals() functionality

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-01-28 20:16:16 +04:00
Marko
c5ecd802a2 docs: update links to rpc (#4348)
* docs: update links to rpc

- links to rpc have not been updated. thank you @okwme

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

* Update docs/app-dev/indexing-transactions.md
2020-01-28 12:33:28 +01:00
Anton Kaliaev
6f93cfa548 lite2: rename alternative providers to witnesses (#4344)
Closes #4341
2020-01-28 14:30:14 +04:00
Anton Kaliaev
d90dc9db26 rpc: add sort_order option to tx_search (#4342)
I have added order_by which can be "asc" or "desc" (should be in string format) in the tx_search RPC method.

Fixes: #3333

Author: @princesinha19
2020-01-27 21:20:56 +04:00
Anton Kaliaev
59a922d38a lite2: add Start, TrustedValidatorSet funcs (#4337)
* lite2: add Start method

There are few reasons to do that:

1) separation of state and dynamics (some users will want to delay
   starting the light client; does not matter we should not allow them
   to create a light client object)
2) less important, but some users might not need autoUpdateRoutine and
   removeNoLongerTrustedHeadersRoutine routines

* lite2: wait till routines are finished in Stop

because they are started in Start, it feels more natural to wait for
them to finish in Stop.

* lite2: add TrustedValidatorSet func
2020-01-27 19:49:04 +04:00
Erik Grinaker
48be9bcb09 Add IPv6 support for P2P integration tests (#4340) 2020-01-27 10:40:54 +01:00
dongsamb
696e13e1ff adr: ADR-051: Double Signing Risk Reduction (#4262)
* Add adr-051 to docs

* add details

* Update docs/architecture/adr-051-double-signing-protection-with-tendermint-mode.md

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

* rename adr-051 for only double singing protection

* remove contents about tendermint mode

* change title to Double Signing Rist Reduction

* rename adr md file

* add a adr link to ToC

Co-authored-by: b-harvest <38277329+dlguddus@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-01-24 11:02:35 +04:00
Marko
082e211ef9 docs: minor doc fixes (#4335)
* docs: minor doc fixes

- minor doc fixes that i ran into while reading things
- test if we have github actions

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

* no github actions yet

* add with

* revert and change wording
v0.33.0-dev1
2020-01-23 08:57:42 +01:00
Anton Kaliaev
1905ef7ca8 lite2: improve auto update (#4334)
* lite2: advance to latest header

without any exponential steps

rename autoUpdate to autoUpdateRoutine

* lite2: wait in Cleanup until goroutines finished running
2020-01-22 20:26:47 +04:00
Anton Kaliaev
f95409e070 lite2: move AutoClient into Client (#4326)
* lite2: move AutoClient into Client

Most of the users will want auto update feature, so it makes sense to
move it into the Client itself, rather than having a separate
abstraction (it makes the code cleaner, but introduces an extra thing
the user will need to learn).

Also, add `FirstTrustedHeight` func to Client to get first trusted height.

* fix db store tests

* separate examples for auto and manual clients

* AutoUpdate tries to update to latest state

NOT 1 header at a time

* fix errors

* lite2: make Logger an option

remove SetLogger func

* fix lite cmd

* lite2: make concurrency assumptions explicit

* fixes after my own review

* no need for nextHeightFn

sequence func will download intermediate headers

* correct comment
2020-01-22 15:19:03 +04:00
dongsamb
5f2f97548f adr: ADR-052: Tendermint Mode (#4302)
* Separate ADR Tendermint Mode from ADR-051

* Update docs/architecture/adr-052-tendermint-mode.md

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

* Apply suggestions from code review

Co-Authored-By: Marko <marbar3778@yahoo.com>

* Apply suggestions from code review

Co-Authored-By: Marko <marbar3778@yahoo.com>

* remove line of mode info of rpc

* Add link to ADR table of contents

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
Co-authored-by: Marko <marbar3778@yahoo.com>


    Fullnode mode : fullnode mode does not have any capability to participate on consensus
    Validator mode : this mode is exactly same as existing state machine behavior. sync without voting on consensus, and participate consensus when fully synced
    Seed mode : lightweight seed mode only for maintain an address book, p2p like TenderSeed

Separate ADR Tendermint Mode from ADR-051 #4262
2020-01-22 11:03:05 +04:00
Anton Kaliaev
2d510d2f27 rpc: PR#4320 follow up (#4323)
* rpc: update urls to rpc website

* rpc: check blockMeta is not nil in Commit

Refs #4319
2020-01-20 14:41:26 +04:00
Erik Grinaker
9cbfe7950d tests: bind test servers to 127.0.0.1 (#4322) 2020-01-18 19:01:18 +01:00
Marko
b50cb26664 rpc: check nil blockmeta (#4320)
* rpc: check nil blockmeta

- fixes #4319

- check if block meta is nil

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

* add changelog entry
2020-01-17 18:32:31 +01:00
dependabot-preview[bot]
a3dc82b10f deps: bump github.com/spf13/viper from 1.6.1 to 1.6.2 (#4318)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.6.1...v1.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-17 16:12:14 +04:00
Marko
88ac31f875 docs: update theme version (#4315)
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2020-01-17 11:31:44 +01:00
Marko
5aa209a156 Rc1 0.33 (#4306)
* rc for 0.33

* address some pr comments

* some adds to upgrade.md

* undo version
2020-01-15 12:43:13 +01:00
dependabot-preview[bot]
32bb813b0a build(deps): bump github.com/pkg/errors from 0.9.0 to 0.9.1 (#4310)
Bumps [github.com/pkg/errors](https://github.com/pkg/errors) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/pkg/errors/releases)
- [Commits](https://github.com/pkg/errors/compare/v0.9.0...v0.9.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-15 12:21:35 +01:00
Anton Kaliaev
7e3c66e28f docs: add link for installing Tendermint (#4307)
* docs: add link for installing Tendermint

to Go guides

Refs #4286

* remind users to checkout latest release

when installing from github source
2020-01-15 14:51:58 +04:00
Marko
a3a09285de changelog: add 0.32.9 changelog to master (#4305)
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2020-01-13 19:20:28 +01:00
Marko
6b71b928be dep: update tm-db to 0.4.0 (#4289)
* dep: update tm-db to 0.4.0

- update 0.4.0 as it is a breaking change and cannot be handled by depndabot

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

*  more work towards error handling

* error and emtpy bytes handling

* work on tests

* add changelog entry, change some error handling

* address some pr comments

* panic in a few more places

* move error higher up

* redo some error handling

* fix some bz == nil to len(bz) == 0

* change statebytes
2020-01-13 18:45:16 +01:00
Anton Kaliaev
faf783331d cmd/lite: switch to new lite2 package (#4300)
* cmd/lite: switch to new lite2 package

* update changelog

* shorten the trusting period explanation
2020-01-13 14:49:53 +04:00
dependabot-preview[bot]
5f0f54f239 deps: bump github.com/pkg/errors from 0.8.1 to 0.9.0 (#4301)
Bumps [github.com/pkg/errors](https://github.com/pkg/errors) from 0.8.1 to 0.9.0.
- [Release notes](https://github.com/pkg/errors/releases)
- [Commits](https://github.com/pkg/errors/compare/v0.8.1...v0.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-13 14:33:57 +04:00
Anton Kaliaev
86adc2c89f lite: follow up from #3989 (#4209)
* rename adjusted to adjacent

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

* rename ErrTooMuchChange to ErrNotEnoughVotingPowerSigned

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

* verify commit is properly signed

* remove no longer trusted headers

* restore trustedHeader and trustedNextVals

* check trustedHeader using options

Refs https://github.com/tendermint/tendermint/pull/4209#issuecomment-562462165

* use correct var when checking if headers are adjacent

in bisection func
+ replace TODO with a comment

https://github.com/tendermint/tendermint/pull/3989#discussion_r352125455

* return header in VerifyHeaderAtHeight

because that way we avoid DB call

+ add godoc comments
+ check if there are no headers yet in AutoClient

https://github.com/tendermint/tendermint/pull/3989#pullrequestreview-315454506

* TestVerifyAdjacentHeaders: add 2 more test-cases

+ add TestVerifyReturnsErrorIfTrustLevelIsInvalid

* lite: avoid overflow when parsing key in db store!

* lite: rename AutoClient#Err to Errs

* lite: add a test for AutoClient

* lite: fix keyPattern and call itr.Next in db store

* lite: add two tests for db store

* lite: add TestClientRemovesNoLongerTrustedHeaders

* lite: test Client#Cleanup

* lite: test restoring trustedHeader

https://github.com/tendermint/tendermint/pull/4209#issuecomment-562462165

* lite: comment out unused code in test_helpers

* fix TestVerifyReturnsErrorIfTrustLevelIsInvalid after merge

* change defaultRemoveNoLongerTrustedHeadersPeriod

and add docs

* write more doc

* lite: uncomment testable examples

* use stdlog.Fatal to stop AutoClient tests

* make lll linter happy

* separate errors for 2 cases

- the validator set of a skipped header cannot be trusted, i.e. <1/3rd
  of h1 validator set has signed (new error, something like
  ErrNewValSetCantBeTrusted)
- the validator set is trusted but < 2/3rds has signed
  (ErrNewHeaderCantBeTrusted)

https://github.com/tendermint/tendermint/pull/4209#discussion_r360331253

* remove all headers (even the last one) that are outside

of the trusting period. By doing this, we avoid checking the
trustedHeader's hash in checkTrustedHeaderUsingOptions (case #1).

https://github.com/tendermint/tendermint/pull/4209#discussion_r360332460

* explain restoreTrustedHeaderAndNextVals better

https://github.com/tendermint/tendermint/pull/4209#discussion_r360602328

* add ConfirmationFunction option

for optionally prompting for user input Y/n before removing headers

Refs https://github.com/tendermint/tendermint/pull/4209#discussion_r360602945

* make cleaning optional

https://github.com/tendermint/tendermint/pull/4209#discussion_r364838189

* return error when user refused to remove headers

* check for double votes in VerifyCommitTrusting

* leave only ErrNewValSetCantBeTrusted error

to differenciate between h2Vals.VerifyCommit and
h1NextVals.VerifyCommitTrusting

* fix example tests

* remove unnecessary if condition

https://github.com/tendermint/tendermint/pull/4209#discussion_r365171847

It will be handled by the above switch.

* verifyCommitBasic does not depend on vals

Co-authored-by: Marko <marbar3778@yahoo.com>
2020-01-13 11:56:48 +04:00
Anton Kaliaev
db235c8df0 cs: check if cs.privValidator is nil (#4295)
before getting its address in recordMetrics

Refs https://github.com/tendermint/tendermint/pull/4294#discussion_r364347586
2020-01-09 16:25:59 +04:00
Greg Szabo
15aa8d82b3 rpc/client: add basic authentication (#4291)
Closes #4248
2020-01-09 13:42:30 +04:00
Marko
6d91c1faf4 evidence: introduce time.Duration to evidence params (#4254)
* evidence: introduce time.Duration to evidence params

- add time.duration to evidence
- this pr is taking pr #2606 and updating it to use both time and height

- closes #2565

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

* fix testing and genesis cfg in signer harness

* remove debugging fmt

* change maxageheight to maxagenumblocks, rename other things to block instead of height

* further check of duration

* check duration to not send peers outdated evidence

* change some lines, onward and upward

* refactor evidence package

* add a changelog pending entry

* make mockbadevidence have time and use it

* add what could possibly be called a test case

* remove mockbadevidence and mockgoodevidence in favor of mockevidence

* add a comment for err that is returned

* add a changelog for removal of good & bad evidence

* add a test for adding evidence

* fix test

* add ev to types in testcase

* Update evidence/pool_test.go

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

* Update evidence/pool_test.go

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

* fix tests

* fix linting

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-01-08 10:46:37 +01:00
Marko
d7f4ce30ca metrics: only increase last_signed_height if commitSig for block (#4283)
- follow up to #4263
- when a commit is nil, then it should be counted as a missed commit

Signed-off-by: Marko Baricevic marbar3778@yahoo.com
2020-01-07 12:09:26 +04:00
Peter Mrekaj
8f5d58f32e rpc: modify New* functions to return error (#4274)
The New* client functions return an error instead
of panicking when the remote address is invalid.

Fixes #3953
2020-01-07 10:07:03 +04:00
Prince Sinha
7be74c73b7 rpc: add method block_by_hash (#4257)
* added RPC method block_by_hash

* created hash => height

* changes typings

* block_by_hash changes

* Update store/store.go

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

* Update store/store.go

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

* Update store/store.go

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

* Update store/store.go

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

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-01-06 18:47:18 +04:00
dependabot-preview[bot]
55410593d0 deps: bump github.com/go-logfmt/logfmt from 0.4.0 to 0.5.0 (#4282)
Bumps [github.com/go-logfmt/logfmt](https://github.com/go-logfmt/logfmt) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/go-logfmt/logfmt/releases)
- [Changelog](https://github.com/go-logfmt/logfmt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logfmt/logfmt/compare/v0.4.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 16:41:58 +04:00
Sunny Aggarwal
279482ce99 crypto: fix sr25519 from raw import (#4272)
* fix raw import sr25519

* add sr25519 to multisig codec

* bump go-schnorrkel

Co-authored-by: Marko <marbar3778@yahoo.com>

Fixes sr25519 pubkey generation and signing when importing from raw bytes
2020-01-03 12:25:32 +04:00
Anton Kaliaev
7f655d8e9e rpc: pass outCapacity to eventBus#Subscribe when subscribing using a l… (#4279)
* pass `outCapacity` to `eventBus#Subscribe` when subscribing using a local client

Fixes #4256

* use outCap directly
2020-01-03 12:10:36 +04:00
Marko
ffe5dff8d9 make: add back tools cmd (#4281)
previous PR seems to have deleted the tools cmd, this adds it back in

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2020-01-02 20:48:01 +01:00
Anton Kaliaev
7d7b47a39a cmd/debug: execute p.Signal only when p is not nil (#4271)
* cmd/debug: execute p.Signal when p is not nil

https://github.com/tendermint/tendermint/pull/4266#discussion_r360015827

* replace else with else if
2019-12-22 22:42:40 +04:00