Anton Kaliaev
245794a3fd
types: remove VerifyFutureCommit ( #4961 )
It was previously used by the now removed `lite` package.
5 years ago
Marko
b4aca980e9
proto: change to use gogofaster ( #4957 )
5 years ago
Marko
b9af87c4ea
state: proto migration ( #4951 )
5 years ago
Marko
ee91312d34
proto: add more to/from ( #4956 )
## Description
adding in some more to/from methods/functions
Closes: #XXX
5 years ago
Marko
dc49dcc1c1
evidence: json tags for DuplicateVoteEvidence ( #4959 )
## Description
Add json tags to duplicate evidence
Closes : #4958
5 years ago
Marko
a88537bb88
ints: stricter numbers ( #4939 )
5 years ago
Marko
7c576f02ab
keys: change to []bytes ( #4950 )
5 years ago
Marko
c2578e2262
light: rename lite2 to light & remove lite ( #4946 )
This PR removes lite & renames lite2 to light throughout the repo
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
Closes : #4944
5 years ago
Marko
99d88cbe2f
crypto: remove key suffixes ( #4941 )
## Description
- remove keyname suffix from keys
Closes : #2228
5 years ago
Marko
0da7d87351
proto: move mempool to proto ( #4940 )
* proto: move mempool to proto
- changes according to moving the mempool reactor to proto
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
Closes : #2883
5 years ago
Callum Waters
8cd3dec102
types: create ValidateBasic() funcs for validator and validator set ( #4905 )
5 years ago
Erik Grinaker
f1000794f2
types/test: remove slow test cases in TestValSetUpdatePriorityOrderTests ( #4903 )
These test cases are extremely slow when running with the race detector, often taking more that 2 minutes on my local machine. I can easily see them timing out on the much slower CI machines, causing these failures:
```
panic: test timed out after 5m0s
goroutine 234 [running]:
testing.(*M).startAlarm.func1()
/usr/local/go/src/testing/testing.go:1460 +0x11c
created by time.goFunc
/usr/local/go/src/time/sleep.go:168 +0x52
goroutine 1 [chan receive, 4 minutes]:
testing.(*T).Run(0xc000172c60, 0x107a5a2, 0x22, 0x11bfc68, 0x1)
/usr/local/go/src/testing/testing.go:1044 +0x699
testing.runTests.func1(0xc000172c60)
/usr/local/go/src/testing/testing.go:1285 +0xa7
testing.tRunner(0xc000172c60, 0xc00012bcc8)
/usr/local/go/src/testing/testing.go:992 +0x1ec
testing.runTests(0xc00000e2c0, 0x1901500, 0x72, 0x72, 0x0)
/usr/local/go/src/testing/testing.go:1283 +0x528
testing.(*M).Run(0xc000214380, 0x0)
/usr/local/go/src/testing/testing.go:1200 +0x300
github.com/tendermint/tendermint/types.TestMain(0xc000214380)
/go/src/github.com/tendermint/tendermint/types/block_test.go:30 +0x59
main.main()
_testmain.go:380 +0x334
goroutine 255 [runnable]:
bytes.Equal(...)
/usr/local/go/src/bytes/bytes.go:20
github.com/tendermint/tendermint/types.(*ValidatorSet).GetByAddress(0xc005499020, 0xc006056650, 0x5, 0x8, 0x13af, 0xc005514100)
/go/src/github.com/tendermint/tendermint/types/validator_set.go:253 +0xfd
github.com/tendermint/tendermint/types.verifyUpdates.func1(0xc00614b940, 0xc005499020, 0x47cd)
/go/src/github.com/tendermint/tendermint/types/validator_set.go:415 +0x84
github.com/tendermint/tendermint/types.verifyUpdates(0xc006110000, 0x11b7, 0x1780, 0xc005499020, 0xb52ff, 0x0, 0x0, 0x5c9)
/go/src/github.com/tendermint/tendermint/types/validator_set.go:429 +0x220
github.com/tendermint/tendermint/types.(*ValidatorSet).updateWithChangeSet(0xc005499020, 0xc00602c000, 0x1780, 0x1780, 0xc006098201, 0xc00608d4b8, 0xc006037bf8)
/go/src/github.com/tendermint/tendermint/types/validator_set.go:600 +0x2f3
github.com/tendermint/tendermint/types.(*ValidatorSet).UpdateWithChangeSet(0xc005499020, 0xc00602c000, 0x1780, 0x1780, 0x1780, 0x1780)
/go/src/github.com/tendermint/tendermint/types/validator_set.go:636 +0x78
github.com/tendermint/tendermint/types.applyChangesToValSet(0xc0005c8ea0, 0x0, 0x0, 0xc005499020, 0xc0005d1160, 0x3, 0x3)
/go/src/github.com/tendermint/tendermint/types/validator_set_test.go:1169 +0x1bb
github.com/tendermint/tendermint/types.verifyValSetUpdatePriorityOrder(0xc0005c8ea0, 0xc005499020, 0x0, 0x0, 0xc005600000, 0x2710, 0x2710, 0xc0055c8000, 0x5c9, 0x5c9, ...)
/go/src/github.com/tendermint/tendermint/types/validator_set_test.go:1239 +0x217
github.com/tendermint/tendermint/types.TestValSetUpdatePriorityOrderTests(0xc0005c8ea0)
/go/src/github.com/tendermint/tendermint/types/validator_set_test.go:1228 +0x1205
testing.tRunner(0xc0005c8ea0, 0x11bfc68)
/usr/local/go/src/testing/testing.go:992 +0x1ec
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1043 +0x661
FAIL github.com/tendermint/tendermint/types 300.677s
FAIL
```
5 years ago
Callum Waters
2014357a19
evidence: remove header from phantom evidence ( #4892 )
5 years ago
Anton Kaliaev
187120a04d
types: remove unnecessary sort call ( #4876 )
in TestValSetUpdatePriorityOrderTests https://app.circleci.com/pipelines/github/tendermint/tendermint/3849/workflows/6d241fc8-72a8-4a3b-b3fc-887a48518f82/jobs/114996
also, reduce the number of reactors in TestReactorBroadcastTxMessage https://app.circleci.com/pipelines/github/tendermint/tendermint/3797/workflows/935cda34-dfb3-46e9-8257-92277171c91b/jobs/114562
5 years ago
Marko
e03b61abd2
proto: add proto files for ibc unblock ( #4853 )
## Description
these proto files are meant to help unblock ibc in their quest of migrating the ibc module to proto.
Closes: #XXX
5 years ago
Callum Waters
c0682a3bed
evidence: prevent proposer from proposing duplicate pieces of evidence ( #4839 )
prevent proposer from proposing duplicate pieces of evidence
5 years ago
Anton Kaliaev
84b9bde9cd
types: assert specific error in TestValSetUpdateOverflowRelated
Closes #4183
5 years ago
Anton Kaliaev
b7b721c484
change use of errors.Wrap to fmt.Errorf with %w verb
Closes #4603
Commands used (VIM):
```
:args `rg -l errors.Wrap`
:argdo normal @q | update
```
where q is a macros rewriting the `errors.Wrap` to `fmt.Errorf`.
5 years ago
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
5 years ago
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
5 years ago
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
5 years ago
Anton Kaliaev
826a7150b7
types: remove extra validation in VerifyCommit
plus make sure LastCommit is always non-nil
5 years ago
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.
5 years ago
Anton Kaliaev
8b2ed8933a
consensus: fix TestSimulateValidatorsChange
* consensus: fix TestSimulateValidatorsChange
* fix selfIndex calculation
* exit from goroutine after 1 sec
* reuse the function
5 years ago
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
5 years ago
Marko
b7c2d7a977
lint: enable nolintlinter, disable on tests
## Description
- enable nolintlint
- disable linting on tests
Closes: #XXX
5 years ago
Anton Kaliaev
336b929eaa
types: return an error if voting power overflows
in VerifyCommitTrusting
Closes #4755
5 years ago
Callum
c6acc54145
replaced other evidence mocks
5 years ago
Callum
08aa4765b0
create tests for validating evidence
5 years ago
Marko
a5a84e11f1
evidence: remove pubkey from duplicate vote evidence
this pr brings over the removal of pubkey from duplicatevote evidence from proto-breakage
ref #4580
5 years ago
Alexander Bezobchuk
9f29672e23
types: implement Header#ValidateBasic ( #4638 )
- Move core stateless validation of the Header type to a ValidateBasic method.
- Call header.ValidateBasic during a SignedHeader validation.
- Call header.ValidateBasic during a PhantomValidatorEvidence validation.
- Call header.ValidateBasic during a LunaticValidatorEvidence validation.
lite tests are skipped since the package is deprecated, no need to waste time on it
closes : #4572
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
5 years ago
Marko
7a6ca0c1bf
evidence: remove unused param ( #4726 )
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
5 years ago
Diep Pham
843d63f935
indexer: allow indexing an event at runtime ( #4466 )
The PR added a new field `index` to event attribute, that will cause indexer service to index the event if set to true.
5 years ago
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
5 years ago
Anton Kaliaev
0d6e28cb56
docs: mention unbonding period in MaxAgeNumBlocks/MaxAgeDuration
Closes #4670
5 years ago
Erik Grinaker
b79602981a
fix linter warnings
5 years ago
Marko
499f9ed153
lint: add review dog ( #4652 )
* lint: add review dog
- golangci is being deprecated on the 15th
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
5 years ago
Callum Waters
379848eab7
lite2: Prevent falsely returned double voting error ( #4620 )
* prevent faulty double voting error
* create test
* clean tests
* clean tests
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
5 years ago
Marko
044f1bf288
format: add format cmd & goimport repo ( #4586 )
* format: add format cmd & goimport repo
- replaced format command
- added goimports to format command
- ran goimports
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* fix outliers & undo proto file changes
5 years ago
Marko
fdc2efc083
fix: fix spelling of comment ( #4566 )
- :P
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
5 years ago
Marko
48f073d796
privval: return error on getpubkey ( #4534 )
closes #3602
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
5 years ago
Shivani Joshi
78144306dd
JSON tests related changes ( #4461 )
* test functions take time.Now and other minor changes
* updated remaining test files
* Update validation_test.go
* fix typo
* go fmt
* import time
Co-authored-by: Marko <marbar3778@yahoo.com>
5 years ago
Alessio Treglia
25d92d05f8
types: VerifyCommitX return when +2/3 sigs are verified ( #4445 )
Closes #4417
5 years ago
Erik Grinaker
8f48c49543
Fix some golangci-lint warnings ( #4448 )
5 years ago
Marko
9a9e8c5bb3
proto: minor linting to proto files ( #4386 )
* proto: minor linting
minor linting after working with the proto files in the sdk.
there is no logic change just spacing fixes
Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
* hardcore linting
5 years ago
Erik Grinaker
5ac81eb198
docs: fix incorrect link ( #4377 )
5 years ago
Erik Grinaker
66a544a640
Fix broken /docs/spec links ( #4376 )
5 years ago
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>
5 years ago
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>
5 years ago
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
5 years ago