840 Commits

Author SHA1 Message Date
Denis Fadeev
0a159c2613 Updated docs website
* Added "Edit this page" box
* Fixed link styles
* Fixed build-time errors
* Updated VuePress and dependencies

<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰    
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description


<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

Closes: #XXX
______

For contributor use:

- [ ] Wrote tests
- [ ] Updated CHANGELOG_PENDING.md
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Updated relevant documentation (`docs/`) and code comments
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Applied Appropriate Labels
2020-04-22 09:06:43 +00:00
Anton Kaliaev
41c11ad2c1 evidence: handling evidence from light client(s) (#4532)
Closes: #4530

This PR contains logic for both submitting an evidence by the light client (lite2 package) and receiving it on the Tendermint side (/broadcast_evidence RPC and/or EvidenceReactor#Receive). Upon receiving the ConflictingHeadersEvidence (introduced by this PR), the Tendermint validates it, then breaks it down into smaller pieces (DuplicateVoteEvidence, LunaticValidatorEvidence, PhantomValidatorEvidence, PotentialAmnesiaEvidence). Afterwards, each piece of evidence is verified against the state of the full node and added to the pool, from which it's reaped upon block creation.

* rpc/client: do not pass height param if height ptr is nil

* rpc/core: validate incoming evidence!

* only accept ConflictingHeadersEvidence if one

of the headers is committed from this full node's perspective

This simplifies the code. Plus, if there are multiple forks, we'll
likely to receive multiple ConflictingHeadersEvidence anyway.

* swap CommitSig with Vote in LunaticValidatorEvidence

Vote is needed to validate signature

* no need to embed client

http is a provider and should not be used as a client
2020-04-22 11:29:05 +04:00
Anton Kaliaev
0d6e28cb56 docs: mention unbonding period in MaxAgeNumBlocks/MaxAgeDuration
Closes #4670
2020-04-21 13:10:15 +00:00
Callum Waters
55909aac68 docs/architecture: create adr 56: prove amnesia attack
## Description

ADR to address the process for proving an amnesia attack (as a form of global evidence) from `PotentialAmnesiaEvidence` detected by light clients


______

For contributor use:

- [ ] Wrote tests
- [ ] Updated CHANGELOG_PENDING.md
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Updated relevant documentation (`docs/`) and code comments
- [ ] Re-reviewed `Files changed` in the Github PR explorer
2020-04-20 07:08:57 +00:00
dependabot-preview[bot]
9e0d6a9958 build(deps): bump @vuepress/plugin-google-analytics in /docs (#4692)
Bumps [@vuepress/plugin-google-analytics](https://github.com/vuejs/vuepress/tree/HEAD/packages/@vuepress/plugin-google-analytics) from 1.3.1 to 1.4.1.
- [Release notes](https://github.com/vuejs/vuepress/releases)
- [Changelog](https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vuejs/vuepress/commits/v1.4.1/packages/@vuepress/plugin-google-analytics)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-17 10:34:46 +02:00
Marko
cadcbb2bf5 docs: amend adr-54 with changes in the sdk (#4684) 2020-04-16 12:00:33 +02:00
Marko
de2728f6c8 docs/architecture: add adr-55 for proto repo design (#4623) 2020-04-15 16:57:59 +02:00
Denis Fadeev
d14bd944ba Docs website update (#4658) 2020-04-08 18:52:04 +02:00
Erik Grinaker
ce50dda66c ADR-053: strengthen and simplify the state sync ABCI interface (#4610)
* adr-053: strengthened and simplified ABCI interface

* remove internal_error reason and open questions

* add follow-up task for block backfill

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-04-02 13:37:00 +00:00
Anton Kaliaev
6c88d2ba1f lite2: make maxClockDrift an option (#4616)
Closes #4607
2020-03-31 16:33:33 +04:00
Callum Waters
5c380cdacb lite2: use bisection for some of backward verification (#4575)
Closes: #4537

Uses SignedHeaderBefore to find header before unverified header and then bisection to verify the header. Only when header is between first and last trusted header height else if before the first trusted header height then regular backwards verification is used.
2020-03-31 16:20:22 +04:00
Marko
7164c67205 docs: validator setup & Key info (#4604)
- defined what variables needed to be changed in the `config.toml` in order to run a validator.
- Briefly explained how a sentry node archtecture should look
- add section explaing importance of key secruity

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2020-03-27 16:17:23 +00:00
Callum Waters
a25faed5f0 lite2: cache headers in bisection (#4562)
Closes: #4546

The algorithm uses an array to store the headers and validators and populates it at every bisection (which is an unsuccessful verification). When a successful verification finally occurs it updates the new trusted header, trims that header from the cache (the array) and sets the depth pointer back to 0. Instead of retrieving new headers it will use the cached headers, incrementing in depth until it reaches the end of the cache which by then it will start to retrieve new headers from the provider. 

Mathematically, this method doesn't properly bisect after the first round but it will always choose a pivot header that is within 1/8th of the upper header's height. I.e. if we are trying to jump 128 headers, the maximum offset from bisection height (64) is 64 + 16(128/8) = 80, therefore a better heuristic would be to obtain the new pivot header height as the middle of these two numbers which would therefore mean to multiply it by 9/16ths instead of 1/2  (sorry this might be a bit more complicated in writing but I can try better explain if someone is interested). Therefore I would also, upon consensus, propose that we change the pivot height to 9/16th's of the previous height
2020-03-26 12:38:02 +01:00
Marko
130b16529d minor link fixing (#4598) 2020-03-23 17:51:54 +01:00
Denis Fadeev
033cac2b75 Update docs website (#4564)
* update theme

* Update version

* Updated Questions section in the footer

* Remove links to Riot chat

* Typo

* Add Discord link

* Update docs theme to the latest version

* Use docs-staging branch for staging website

* Resolve merge conflicts

* Update version

* Add google analytics

Co-authored-by: Marko <marbar3778@yahoo.com>
2020-03-13 14:34:31 +00:00
Marko
f17717f3a3 adr: crypto encoding for proto (#4481)
* adr: crypto encoding for proto work

- this adr is meant to help with deciding on how to move forward with keys in tendermint.

* minor change

* fix gomod

* add a third option

* fix spelling

* add first part of descision

* breakdown keys and where they are used

* add some wording

* minor wording fix

* question

* change proto messages

* minor update

* undo go.mod changes

* add a few things based on comemnts

* push, push it real good

* minor explanation on interface type

* touch up
2020-03-09 08:44:37 +00:00
Anton Kaliaev
d3f965ba68 lite2: indicate success/failure of Update (#4536)
error itself is not enough since it only signals if there were any
errors. Either (types.SignedHeader) or (success bool) is needed to
indicate the status of the operation. Returning a header is optimal
since most of the clients will want to get a newly verified header
anyway.
2020-03-06 17:10:28 +04:00
Anton Kaliaev
431618cef6 lite2: remove auto update (#4535)
We first introduced auto-update as a separate struct AutoClient, which
was wrapping Client and calling Update periodically.

// AutoClient can auto update itself by fetching headers every N seconds.
type AutoClient struct {
    base         *Client
    updatePeriod time.Duration
    quit         chan struct{}

    trustedHeaders chan *types.SignedHeader
    errs           chan error
}

// NewAutoClient creates a new client and starts a polling goroutine.
func NewAutoClient(base *Client, updatePeriod time.Duration) *AutoClient {
    c := &AutoClient{
        base:           base,
        updatePeriod:   updatePeriod,
        quit:           make(chan struct{}),
        trustedHeaders: make(chan *types.SignedHeader),
        errs:           make(chan error),
    }
    go c.autoUpdate()
    return c
}

// TrustedHeaders returns a channel onto which new trusted headers are posted.
func (c *AutoClient) TrustedHeaders() <-chan *types.SignedHeader {
    return c.trustedHeaders
}

// Err returns a channel onto which errors are posted.
func (c *AutoClient) Errs() <-chan error {
    return c.errs
}

// Stop stops the client.
func (c *AutoClient) Stop() {
    close(c.quit)
}

func (c *AutoClient) autoUpdate() {
    ticker := time.NewTicker(c.updatePeriod)
    defer ticker.Stop()

    for {
        select {
        case <-ticker.C:
            lastTrustedHeight, err := c.base.LastTrustedHeight()
            if err != nil {
                c.errs <- err
                continue
            }

            if lastTrustedHeight == -1 {
                // no headers yet => wait
                continue
            }

            newTrustedHeader, err := c.base.Update(time.Now())
            if err != nil {
                c.errs <- err
                continue
            }

            if newTrustedHeader != nil {
                 c.trustedHeaders <- newTrustedHeader
            }
        case <-c.quit:
            return
        }
    }
}

Later we merged it into the Client itself with the assumption that most clients will want it.

But now I am not sure. Neither IBC nor cosmos/relayer are using it. It increases complexity (Start/Stop methods).

That said, I think it makes sense to remove it until we see a need for it (until we better understand usage behavior). We can always introduce it later 😅. Maybe in the form of AutoClient.
2020-03-06 13:33:07 +04:00
mergify[bot]
3a695d4b6f docs: fix links (#4531)
* docs: fix links

- fix broken links

closes #4522

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

* fix more links

* add enable and disable

* remvoe deadlink
2020-03-05 10:48:29 +00:00
Anton Kaliaev
4936b23dae adr-047: evidence handling (#4429)
Closes #4213 and #4182
2020-03-05 11:28:32 +04:00
Anton Kaliaev
a60d032b07 docs: write about debug kill and dump (#4516)
* docs: write about debug kill and dump

Closes #4325

* wrap file tree in code blocks
2020-03-03 08:37:29 +00:00
Anton Kaliaev
67224fd174 docs: tendermint node --help dumps all supported flags (#4511)
Closes #4211
2020-03-02 13:09:54 +00:00
Anton Kaliaev
9bf8f41ac9 lite2: fix tendermint lite sub command (#4505)
* lite2: fix tendermint lite sub command

- better logging
- chainID as an argument
- more examples

* one more log msg

* lite2: fire update right away after start

* turn off auto update in verification tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-03-02 06:51:36 +00:00
Erik Grinaker
c33576e72a example/kvstore: return ABCI query height (#4509)
* example/kvstore: return ABCI query height

* CHANGELOG: added PR link

* Updated tests
2020-03-01 20:03:28 +00:00
Anton Kaliaev
a122a555de docs: adr-046 add bisection algorithm details (#4496)
* docs: adr-046 add bisection algorithm details

Closes #4329

* format fig. 1 title

* docs: adr-046 we no longer download headers in TrustedHeader

https://github.com/tendermint/tendermint/pull/4496#issuecomment-592446054
2020-02-28 11:53:06 +01:00
Anton Kaliaev
b5f6bfa4f9 lite2: return height as 2nd return param in TrustedValidatorSet (#4479)
Closes #4473
2020-02-27 16:10:01 +01:00
Anton Kaliaev
6daea31f50 lite2: remove expiration checks on functions that don't require them (#4477)
closes: #4455

Verifying backwards checks that the trustedHeader hasn't expired both before and after the loop in case of verifying many headers (a longer operation), but not during the loop itself.

TrustedHeader() no longer checks whether the header saved in the store has expired.

Tests have been updated to reflect the changes

## Commits:

* verify headers backwards out of trust period

* removed expiration check in trusted header func

* modified tests to reflect changes

* wrote new tests for backwards verification

* modified TrustedHeader and TrustedValSet functions

* condensed test functions

* condensed test functions further

* fix build error

* update doc

* add comments

* remove unnecessary declaration

* extract latestHeight check into a separate func

Co-authored-by: Callum Waters <cmwaters19@gmail.com>
2020-02-26 16:15:05 +01:00
Callum Waters
9231b52e0d lite2: cross-check first header and update tests (#4471)
closes #4464
2020-02-26 12:56:20 +01:00
Anton Kaliaev
c4f7256766 lite2: store current validator set (#4472)
Before we were storing trustedHeader (height=1) and trustedNextVals
(height=2).

After this change, we will be storing trustedHeader (height=1) and
trustedVals (height=1). This a) simplifies the code b) fixes #4399
inconsistent pairing issue c) gives a relayer access to the current
validator set #4470.

The only downside is more jumps during bisection. If validator set
changes between trustedHeader and the next header (by 2/3 or more), the
light client will be forced to download the next header and check that
2/3+ signed the transition. But we don't expect validator set change too
much and too often, so it's an acceptable compromise.

Closes #4470 and #4399
2020-02-26 10:20:51 +01:00
Erik Grinaker
8d1198b39a ADR-053: update with implementation plan after prototype (#4427) 2020-02-21 13:28:05 +01:00
Sean Braithwaite
ee993ba8ff blockchain: add v2 reactor (#4361)
The work includes the reactor which ties together all the seperate routines involved in the design of the blockchain v2 refactor. This PR replaces #4067 which got far too large and messy after a failed attempt to rebase.

## Commits:

* Blockchainv 2 reactor:

	+ I cleaner copy of the work done in #4067 which fell too far behind and was a nightmare to rebase.
	+ The work includes the reactor which ties together all the seperate routines involved in the design of the blockchain v2 refactor.

* fixes after merge

* reorder iIO interface methodset

* change iO -> IO

* panic before send nil block

* rename switchToConsensus -> trySwitchToConsensus

* rename tdState -> tmState

* Update blockchain/v2/reactor.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* remove peer when it sends a block unsolicited

* check for not ready in markReceived

* fix error

* fix the pcFinished event

* typo fix

* add documentation for processor fields

* simplify time.Since

* try and make the linter happy

* some doc updates

* fix channel diagram

* Update adr-043-blockchain-riri-org.md

* panic on nil switch

* liting fixes

* account for nil block in bBlockResponseMessage

* panic on duplicate block enqueued by processor

* linting

* goimport reactor_test.go

Co-authored-by: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
Co-authored-by: Anca Zamfir <ancazamfir@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
2020-02-19 16:00:14 +01:00
Denis Fadeev
da8813071b Docs staging (#4407)
* update theme

* Update version

* Updated Questions section in the footer

* Remove links to Riot chat

* Typo

* Add Discord link

Co-authored-by: Marko <marbar3778@yahoo.com>
2020-02-15 21:07:48 +01:00
Anton Kaliaev
3b5794ffe9 adr: light client implementation (#4397)
* adr: light client implementation

Closes #2133

* note on chain IDs

* explain why witnesses are required

* if chain forks maliciously, chain ID stays the same

* add a note about min witnesses while cross-checking
2020-02-14 11:35:14 +01:00
Anton Kaliaev
774aff5f7d docs: update Light Client Protocol page (#4405)
* docs: update Light Client Protocol page

Closes #4331

* one way to get hash & height
2020-02-14 11:22:17 +01:00
Marko
2b709e79e7 make: remove sentry setup cmds (#4383)
* make: remove sentry setup cmds

removal of make comands for sentry setup. it was unclear if they were being maintained and there has not been a mention of people using them

- closes #4379

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

* remove depreacted readme

* add not being maintained section to docs
2020-02-12 12:45:24 +01:00
Erik Grinaker
66a544a640 Fix broken /docs/spec links (#4376) 2020-02-07 12:53:28 +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
81e3cca340 docs: update npm dependencies (#4364) 2020-02-03 12:56:34 +01:00
Erik Grinaker
b04b752e5b Add ADR-053: State Sync Prototype (#4352) 2020-01-30 11:57:24 +01: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
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
2020-01-23 08:57:42 +01: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
Marko
88ac31f875 docs: update theme version (#4315)
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2020-01-17 11:31:44 +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
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
22280400a6 docs: link fixes in readme (#4268)
- fixed some links in the readme
- deleted some unused things from themakefile

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-12-21 20:48:34 +01:00
Marko
7368ba358b prometheus/metrics: three new metrics for consensus (#4263)
* prometheus/metrics: two new metrics for consensus

- add consensus_validator_power metric so if a node is a validator it can see its own power in prometheus
- add last_signed_height metric so if a node is a validator it can be aware of at which height the most recent time it signed.

- closes: #3773
- closes: #3083

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

* check if signature is present

* minor change and check if sig is not absent

* add changelog entry

* Update consensus/state.go

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

* Update CHANGELOG_PENDING.md

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

* Update CHANGELOG_PENDING.md

* add label with validator address

* change address to vali_address

* add metric missed blocks

* add changelog entry for missed blocks metric

* address naming & add docs
2019-12-19 18:04:57 +01:00
Ethan Buchman
bd77284d5b docs: update app-architecture.md (#4259)
Address #4089 by clarifying the different uses of "application"
2019-12-18 11:57:59 +04:00
Ayush Kaul
eec9b2c9c8 delete tm-monitor tool #4247 (#4255)
* delete tm-monitor tool #4247

* removed docs

* remove gox
2019-12-17 15:50:32 +01:00