Commit Graph

7647 Commits

Author SHA1 Message Date
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
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
a18380901f test: branch for fix of ci (#4266)
* test:

- testing replacing syscall with os.FindProces

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

* address pr comments
2019-12-20 11:42:42 +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
dependabot-preview[bot]
d86706b0e8 deps: bump google.golang.org/grpc from 1.25.1 to 1.26.0 (#4264)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.25.1 to 1.26.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.25.1...v1.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-19 10:22:43 +04:00
Anton Kaliaev
fff7f450be cs: set missing_validators(_power) metrics to 0 for 1st block (#4194)
also

    - do not send any LastCommitInfo.Votes for 1st block.
    - use cs.LastValidators (not cs.Validators) in recordMetrics when counting missing validators

note:

remember that the first LastCommit is intentionally empty, so it makes
sense for LastCommitInfo.Votes to also be empty. Because we can't really
tell if validator signed or not. Similar for ^ metrics, we can't say if
particular validator was missing or not.

Closes #4192
2019-12-18 19:46:21 +04: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
Marko
9bd0f9e634 lint: golint issue fixes (#4258)
* lint: golint issue fixes

- on my local machine golint is a lot stricter than the bot so slowly going through and fixing things.

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

* more fixes from golint

* remove isPeerPersistentFn

* add changelog entry
2019-12-17 13:02:45 +01:00
Prince Sinha
f0777277ad rpc: added proposer in consensus_state (#4250)
* added proposer in consensus_state

* added proposer in consensus_state

* proposer changes

* added proposer in consensus_state

* proposer added
2019-12-16 15:47:36 +01:00
Alexander Bezobchuk
4bfec797e8 cli: debug sub-command (#4227)
## Issue

Implement a new subcommand: tendermint debug. This subcommand itself has two subcommands:

    $ tendermint debug kill <pid> </path/to/out.zip> --home=</path/to/app.d>

Writes debug info into a compressed archive. The archive will contain the following:

├── config.toml
├── consensus_state.json
├── net_info.json
├── stacktrace.out
├── status.json
└── wal

The Tendermint process will be killed.

    $ tendermint debug dump </path/to/out> --home=</path/to/app.d>

This command will perform similar to kill except it only polls the node and dumps debugging data every frequency seconds to a compressed archive under a given destination directory. Each archive will contain:

├── consensus_state.json
├── goroutine.out
├── heap.out
├── net_info.json
├── status.json
└── wal

Note:

    goroutine.out and heap.out will only be written if a profile address is provided and is operational.
    This command is blocking and will log any error.

replaces: #3327
closes: #3249

## Commits:

* Implement debug tool command stubs

* Implement net getters and zip logic

* Update zip dir API and add home flag

* Add simple godocs for kill aux functions

* Move IO util to new file and implement copy WAL func

* Implement copy config function

* Implement killProc

* Remove debug fmt

* Validate output file input

* Direct STDERR to file

* Godoc updates

* Sleep prior to killing tail proc

* Minor cleanup of godocs

* Move debug command and add make target

* Rename command handler function

* Add example to command long descr

* Move current implementation to cmd/tendermint/commands/debug

* Update kill cmd long description

* Implement dump command

* Add pending log entry

* Add gosec nolint

* Add error check for Mkdir

* Add os.IsNotExist(err)

* Add to debugging section in running-in-prod doc
2019-12-13 12:46:23 +04:00
Cuong Manh Le
c9708105f0 consensus/types: fix BenchmarkRoundStateDeepCopy panics (#4244)
Fixes #4243
2019-12-12 17:32:33 +01:00
Marko
7b52f51700 libs/common: Refactor libs/common 5 (#4240)
* libs/common: Refactor libs/common 5

- move mathematical functions and types out of `libs/common` to math pkg
- move net functions out of `libs/common` to net pkg
- move string functions out of `libs/common` to strings pkg
- move async functions out of `libs/common` to async pkg
- move bit functions out of `libs/common` to bits pkg
- move cmap functions out of `libs/common` to cmap pkg
- move os functions out of `libs/common` to os pkg

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

* fix testing issues

* fix tests

closes #41417

woooooooooooooooooo kill the cmn pkg

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

* add changelog entry

* fix goimport issues

* run gofmt
2019-12-12 09:33:27 +01:00
Anton Kaliaev
7e02211246 scripts: remove install scripts (#4242)
Closes #4202

- nobody's supporting them
- users who want to try TM should use pre-build binaries
- devs should be able to install using git clone (or use Vagrant)
- validators don't use them (my guess)
2019-12-12 12:11:28 +04:00
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