Commit Graph

136 Commits

Author SHA1 Message Date
Anton Kaliaev
1b9e0261b6 merge initProvider and makeProvider 2019-08-16 11:43:45 +04:00
Anton Kaliaev
97131a1544 add more docs from ADR-44 2019-08-15 16:22:26 +04:00
Anton Kaliaev
2f96903494 rename BaseVerifier to verifier, remove Verifier interface 2019-08-15 16:01:06 +04:00
Anton Kaliaev
6b38564409 refactor dbprovider 2019-08-15 15:42:22 +04:00
Anton Kaliaev
355834a691 one commit above 2019-08-15 12:10:16 +04:00
Anton Kaliaev
f9061f11e6 refactor multiprovider 2019-08-15 12:09:38 +04:00
Anton Kaliaev
46c3d0baec move concurrent_provider to its own file 2019-08-15 12:09:15 +04:00
Anton Kaliaev
91e69bbdac Merge branch 'master' into jae/verifyingcachineprovider 2019-08-14 16:03:33 +04:00
Marko
8a282a5fee replace errors.go with github.com/pkg/errors (2/2) (#3890)
* init of (2/2) common errors

* Remove instances of cmn.Error (2/2)

- Replace usage of cmnError and errorWrap
- ref #3862

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

* comment wording

* simplify IsErrXXX functions

* log panic along with stopping the MConnection
2019-08-11 21:03:40 +04:00
Marko
a1eb2f6c6b tm-cmn to tm-db (#3850)
* tm-cmn to tm-db

* go.mod changes

* go.mod changes

* more go.mod

* fix tm-db

* ci fix, pending change
2019-07-31 11:34:17 +02:00
Marko
98cb8c9783 add staticcheck linting (#3828)
cleanup to add linter

    grpc change:
        https://godoc.org/google.golang.org/grpc#WithContextDialer
        https://godoc.org/google.golang.org/grpc#WithDialer
        grpc/grpc-go#2627
    prometheous change:
        due to UninstrumentedHandler, being deprecated in the future
    empty branch = empty if or else statement
        didn't delete them entirely but commented
        couldn't find a reason to have them
    could not replicate the issue #3406
        but if want to keep it commented then we should comment out the if statement as well
2019-07-25 09:35:30 +04:00
Marko
816dfce8fe libs: Remove db from tendermint in favor of tendermint/tm-cmn (#3811)
* Remove db from tendemrint in favor of tendermint/tm-cmn

- remove db from `libs`
- update dependancy, there have been no breaking changes in the updated deps
	- https://github.com/grpc/grpc-go/releases
	- https://github.com/golang/protobuf/releases

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

* changelog add

* gofmt

* more gofmt
2019-07-19 09:54:45 +04:00
Zaki Manian
415d9579e1 Add the compare validator powers proposal as discussed with Zarko in the ADR 2019-07-16 19:55:09 -07:00
Anton Kaliaev
88b7c53dcf fix comment and use errors.New instead of fmt.Errorf 2019-07-09 19:38:14 +04:00
Anton Kaliaev
f95b11e07a fix HeightAndHashPresent func 2019-07-09 17:55:55 +04:00
Anton Kaliaev
1f03ceb0ba refactor verifying/provider
- mention unbonding period
- use log.Logger instead of fmt
2019-07-09 17:52:10 +04:00
Anton Kaliaev
45a447aa2f move PrivKeys to internal folder
read https://golang.org/cmd/go/#hdr-Internal_Directories if you want to
know how internal directories work
2019-07-09 17:42:04 +04:00
Anton Kaliaev
ceff0af81d restructure code in verifying/provider 2019-07-08 16:45:22 +04:00
Anton Kaliaev
06720dcd6b add a safety check in ConcurrentProvider#UpdateToHeight 2019-07-08 15:57:47 +04:00
Anton Kaliaev
6810bab382 refactor ConcurrentProvider 2019-07-08 15:42:15 +04:00
Anton Kaliaev
4b2e323728 remove extra comments in lite/commit 2019-07-08 13:32:08 +04:00
Anton Kaliaev
ac330194b9 refactor lite/client package 2019-07-08 13:23:58 +04:00
Zaki Manian
b441a71221 Make ConcurrentProvider public 2019-07-07 22:09:53 -07:00
Zaki Manian
39e589e3c7 Fix VerifyingProvider Nit 2019-07-07 21:55:00 -07:00
Zaki Manian
24cd2eba8e Fixup tests 2019-07-07 21:47:39 -07:00
Zaki Manian
6746befb44 Add linear non bisceting verifier 2019-07-06 20:20:37 -07:00
Zaki Manian
fb3663cfb1 verifyAndSave now internally checks if the commit is validate before proceeding.
Fix a comment for clarity
2019-07-06 19:05:10 -07:00
Zaki Manian
b97a8b69ed Update lite/verifying/provider.go
Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com>
2019-07-06 11:48:48 -07:00
Marko Baricevic
0be87cdcba privkey fix 2019-07-06 09:49:39 +02:00
Marko Baricevic
49bea520cf change trust to trusted 2019-07-06 09:47:47 +02:00
Marko Baricevic
3acc6e60e8 import and type calls fix 2019-07-06 09:46:01 +02:00
Zaki Manian
0a145b83be Update lite/verifying/provider.go
Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com>
2019-07-05 20:52:21 -07:00
Zaki Manian
d15f0f8df0 Fix some CI bot nits 2019-07-05 20:44:00 -07:00
Zaki Manian
02c467237e Fix DB backed name change 2019-07-05 20:23:38 -07:00
Zaki Manian
165a3d15fb Fix conflicts with upsteam changes 2019-07-05 20:23:23 -07:00
yutianwu
fcce9ed4db fix lint 2019-05-21 14:23:50 +08:00
yutianwu
c21b4fcc93 fix bug of proxy 2019-05-21 14:12:40 +08:00
Anton Kaliaev
a7358bc69f libs/db: conditional compilation (#3628)
* libs/db: conditional compilation

For cleveldb: go build -tags cleveldb
For boltdb: go build -tags boltdb

Fixes #3611

* document db_backend param better

* remove deprecated LevelDBBackend

* update changelog

* add missing lines

* add new line

* fix TestRemoteDB

* add a line about boltdb tag

* Revert "remove deprecated LevelDBBackend"

This reverts commit 1aa85453f7.

* make PR non breaking

* change DEPRECATED label format

https://stackoverflow.com/a/36360323/820520
2019-05-07 12:33:47 +04:00
Zaki Manian
ce9cde0888 Apply suggestions from code review
Some typo fixes from review

Co-Authored-By: zmanian <zaki@manian.org>
2019-05-02 08:41:05 -07:00
Zaki Manian
7635b1ed7e Handle error 2019-05-01 17:32:49 -07:00
Zaki Manian
59d3d40dbf Added the Verify method to implement Provider 2019-04-30 10:01:36 -07:00
Jack Zampolin
0a87ddef96 Abstract out provider init logic and logger 2019-04-26 13:38:39 -04:00
Jack Zampolin
236cdf87aa NewProvider function complete 2019-04-25 15:11:30 -04:00
Zaki Manian
88b69a956f Improve getTargetCommit with better business logic 2019-04-24 17:58:19 -04:00
jaekwon
1a86c869e8 WIP 2019-04-17 11:27:37 -07:00
Ismail Khoffi
1e3469789d Ensure WriteTimeout > TimeoutBroadcastTxCommit (#3443)
* Make sure config.TimeoutBroadcastTxCommit < rpcserver.WriteTimeout()

* remove redundant comment

* libs/rpc/http_server: move Read/WriteTimeout into Config

* increase defaults for read/write timeouts

Based on this article
https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration

* WriteTimeout should be larger than TimeoutBroadcastTxCommit

* set a deadline for subscribing to txs

* extract duration into const

* add two changelog entries

* Update CHANGELOG_PENDING.md

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

* Update CHANGELOG_PENDING.md

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

* 12 -> 10

* changelog

* changelog
2019-03-19 19:45:51 -04:00
Anton Kaliaev
d741c7b478 limit number of /subscribe clients and queries per client (#3269)
* limit number of /subscribe clients and queries per client

Add the following config variables (under [rpc] section):
  * max_subscription_clients
  * max_subscriptions_per_client
  * timeout_broadcast_tx_commit

Fixes #2826

new HTTPClient interface for subscriptions

finalize HTTPClient events interface

remove EventSubscriber

fix data race

```
WARNING: DATA RACE
Read at 0x00c000a36060 by goroutine 129:
  github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe.func1()
      /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:168 +0x1f0

Previous write at 0x00c000a36060 by goroutine 132:
  github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe()
      /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:191 +0x4e0
  github.com/tendermint/tendermint/rpc/client.WaitForOneEvent()
      /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178
  github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1()
      /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:827 +0x162

Goroutine 129 (running) created at:
  github.com/tendermint/tendermint/rpc/client.(*Local).Subscribe()
      /go/src/github.com/tendermint/tendermint/rpc/client/localclient.go:164 +0x4b7
  github.com/tendermint/tendermint/rpc/client.WaitForOneEvent()
      /go/src/github.com/tendermint/tendermint/rpc/client/helpers.go:64 +0x178
  github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync.func1()
      /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:139 +0x298
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:827 +0x162

Goroutine 132 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:878 +0x659
  github.com/tendermint/tendermint/rpc/client_test.TestTxEventsSentWithBroadcastTxSync()
      /go/src/github.com/tendermint/tendermint/rpc/client/event_test.go:119 +0x186
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:827 +0x162
==================
```

lite client works (tested manually)

godoc comments

httpclient: do not close the out channel

use TimeoutBroadcastTxCommit

no timeout for unsubscribe

but 1s Local (5s HTTP) timeout for resubscribe

format code

change Subscribe#out cap to 1

and replace config vars with RPCConfig

TimeoutBroadcastTxCommit can't be greater than rpcserver.WriteTimeout

rpc: Context as first parameter to all functions

reformat code

fixes after my own review

fixes after Ethan's review

add test stubs

fix config.toml

* fixes after manual testing

- rpc: do not recommend to use BroadcastTxCommit because it's slow and wastes
Tendermint resources (pubsub)
- rpc: better error in Subscribe and BroadcastTxCommit
- HTTPClient: do not resubscribe if err = ErrAlreadySubscribed

* fixes after Ismail's review

* Update rpc/grpc/grpc_test.go

Co-Authored-By: melekes <anton.kalyaev@gmail.com>
2019-03-11 22:45:58 +04:00
Yumin Xia
b021f1e505 libs/db: close batch (#3397)
ClevelDB requires closing when WriteBatch is no longer needed, https://godoc.org/github.com/jmhodges/levigo#WriteBatch.Close

Fixes the memory leak in https://github.com/cosmos/cosmos-sdk/issues/3842
2019-03-10 12:46:32 +04:00
Anton Kaliaev
b6a510a3e7 make ineffassign linter pass (#3386)
Refs #3262

This fixes two small bugs:

1) lite/dbprovider: return `ok` instead of true in parse* functions. It's weird that we're ignoring `ok` value before.
2) consensus/state: previously because of the shadowing we almost never output "Error with msg". Now we declare both `added` and `err` in the beginning of the function, so there's no shadowing.
2019-03-08 09:46:09 +04:00
zjubfd
3421e4dcd7 make lightd availbe (#3364)
1."abci_query": rpcserver.NewRPCFunc(c.ABCIQuery, "path,data,prove")
"validators": rpcserver.NewRPCFunc(c.Validators, "height"),
the parameters and function do not match, cause index out of range error.
2. the prove of query is forced to be true, while default option is false.
3. fix the wrong key of merkle
2019-03-02 16:36:52 -05:00