Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply to Tendermint 0.33.3 #68

Merged
merged 139 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
88ac31f
docs: update theme version (#4315)
tac0turtle Jan 17, 2020
a3dc82b
deps: bump github.com/spf13/viper from 1.6.1 to 1.6.2 (#4318)
dependabot-preview[bot] Jan 17, 2020
b50cb26
rpc: check nil blockmeta (#4320)
tac0turtle Jan 17, 2020
9cbfe79
tests: bind test servers to 127.0.0.1 (#4322)
erikgrinaker Jan 18, 2020
2d510d2
rpc: PR#4320 follow up (#4323)
melekes Jan 20, 2020
5f2f975
adr: ADR-052: Tendermint Mode (#4302)
dongsam Jan 22, 2020
f95409e
lite2: move AutoClient into Client (#4326)
melekes Jan 22, 2020
1905ef7
lite2: improve auto update (#4334)
melekes Jan 22, 2020
082e211
docs: minor doc fixes (#4335)
tac0turtle Jan 23, 2020
696e13e
adr: ADR-051: Double Signing Risk Reduction (#4262)
dongsam Jan 24, 2020
48be9bc
Add IPv6 support for P2P integration tests (#4340)
Jan 27, 2020
59a922d
lite2: add Start, TrustedValidatorSet funcs (#4337)
melekes Jan 27, 2020
d90dc9d
rpc: add sort_order option to tx_search (#4342)
melekes Jan 27, 2020
6f93cfa
lite2: rename alternative providers to witnesses (#4344)
melekes Jan 28, 2020
c5ecd80
docs: update links to rpc (#4348)
tac0turtle Jan 28, 2020
85244a4
lite2: refactor cleanup() (#4343)
cmwaters Jan 28, 2020
587ac3a
node: use GRPCMaxOpenConnections when creating the gRPC server (#4349)
melekes Jan 29, 2020
79b99f0
lite2: batch save & delete operations in DB store (#4345)
melekes Jan 29, 2020
8b80de8
build(deps): bump google.golang.org/grpc from 1.26.0 to 1.27.0 (#4355)
dependabot-preview[bot] Jan 29, 2020
71d50f7
lite2: panic if witness is on another chain (#4356)
cmwaters Jan 30, 2020
b04b752
Add ADR-053: State Sync Prototype (#4352)
erikgrinaker Jan 30, 2020
ca03e43
deps: bump github.com/golang/protobuf from 1.3.2 to 1.3.3 (#4359)
dependabot-preview[bot] Jan 30, 2020
81e3cca
docs: update npm dependencies (#4364)
tessr Feb 3, 2020
1edb542
lite2: make witnesses mandatory (#4358)
melekes Feb 3, 2020
fa34ff9
abci: fix broken spec link (#4366)
tessr Feb 3, 2020
9b9f1be
docs: update guides proto paths (#4365)
tac0turtle Feb 3, 2020
df3eee4
lite2: replace primary provider with alternative when unavailable (#4…
cmwaters Feb 4, 2020
bb7a80e
lite2: fetch missing headers (#4362)
cmwaters Feb 6, 2020
af37db3
lite2: cross-check new header with all witnesses (#4373)
cmwaters Feb 6, 2020
3e2f299
deps: bump google.golang.org/grpc from 1.27.0 to 1.27.1 (#4372)
dependabot-preview[bot] Feb 6, 2020
66a544a
Fix broken /docs/spec links (#4376)
erikgrinaker Feb 7, 2020
b2832c6
lite2: validate TrustOptions, add NewClientFromTrustedStore (#4374)
melekes Feb 7, 2020
5ac81eb
docs: fix incorrect link (#4377)
erikgrinaker Feb 7, 2020
aeb6cc4
lite2: return if there are no headers in RemoveNoLongerTrustedHeaders…
melekes Feb 7, 2020
31fd99a
proto: add buf and protogen script (#4369)
tac0turtle Feb 11, 2020
da813e4
lite2: manage witness dropout (#4380)
cmwaters Feb 11, 2020
c494070
docs: fix spec links (#4384)
tac0turtle Feb 11, 2020
9a9e8c5
proto: minor linting to proto files (#4386)
tac0turtle Feb 11, 2020
4787f7c
refactored lite client tests
Feb 11, 2020
ab6ac6d
lite2: improve string output of all existing providers (#4387)
melekes Feb 11, 2020
16aae3a
Merge branch 'master' into callum/clean-lite-tests
melekes Feb 11, 2020
831ed8f
Merge pull request #4389 from tendermint/callum/clean-lite-tests
cmwaters Feb 11, 2020
b712c1c
autofile: resolve relative paths (#4390)
erikgrinaker Feb 11, 2020
2b709e7
make: remove sentry setup cmds (#4383)
tac0turtle Feb 12, 2020
67837e5
readme: fix link to original paper (#4391)
tac0turtle Feb 12, 2020
fb5751d
release: minor release 0.33.1 (#4401)
tac0turtle Feb 13, 2020
42d8bc5
upgrade: update upgrade.md for protobuf changes
tac0turtle Feb 13, 2020
e62b21c
Merge pull request #4404 from tendermint/rc2/0.33.1
Feb 13, 2020
774aff5
docs: update Light Client Protocol page (#4405)
melekes Feb 14, 2020
3b5794f
adr: light client implementation (#4397)
melekes Feb 14, 2020
30e5619
Merge branch 'v0.33' into release/v0.33.1
Feb 14, 2020
ec9424c
Merge pull request #4402 from tendermint/release/v0.33.1
melekes Feb 14, 2020
5f5e0e1
makefile: place phony markers after targets (#4408)
erikgrinaker Feb 14, 2020
58620af
lite2: modified sequence method to match bisection (#4403)
cmwaters Feb 14, 2020
c56fd04
lite2: disconnect from bad nodes (#4388)
melekes Feb 14, 2020
da88130
Docs staging (#4407)
fadeev Feb 15, 2020
5ea1ff9
rpc: fix issue with multiple subscriptions (#4406)
antho1404 Feb 17, 2020
f5901ea
lite2: divide verify functions (#4412)
cmwaters Feb 18, 2020
6c67e24
dep: bump gokit dep (#4424)
tac0turtle Feb 18, 2020
68f37ff
Use uint64 for consensus.Reactor.SwitchToConsensus() blocksSynced (#4…
erikgrinaker Feb 19, 2020
c680507
dep: maunally bump dep (#4436)
tac0turtle Feb 19, 2020
b09cdaf
rpc: fix tx_search pagination with ordered results (#4437)
erikgrinaker Feb 19, 2020
1874a97
lite: modified bisection to loop (#4400)
cmwaters Feb 19, 2020
403f43a
rpc: fix txsearch tests (#4438)
erikgrinaker Feb 19, 2020
ee993ba
blockchain: add v2 reactor (#4361)
brapse Feb 19, 2020
b7dab3b
consensus: reduce log severity for ErrVoteNonDeterministicSignature (…
tau3 Feb 19, 2020
7ab81a7
deps: bump github.com/stretchr/testify from 1.4.0 to 1.5.0 (#4435)
dependabot-preview[bot] Feb 19, 2020
24c8b35
rpc: fix TxSearch test nits (#4446)
erikgrinaker Feb 20, 2020
d00384f
build(deps): bump github.com/stretchr/testify from 1.5.0 to 1.5.1 (#4…
dependabot-preview[bot] Feb 20, 2020
8010f3b
build(deps): bump github.com/spf13/cobra from 0.0.3 to 0.0.6 (#4440)
dependabot-preview[bot] Feb 20, 2020
8f48c49
Fix some golangci-lint warnings (#4448)
erikgrinaker Feb 20, 2020
2c7af01
lite2: return already verified headers and verify earlier headers (#4…
cmwaters Feb 20, 2020
b0683b7
p2p: use curve25519.X25519() instead of ScalarMult() (#4449)
erikgrinaker Feb 21, 2020
8d1198b
ADR-053: update with implementation plan after prototype (#4427)
erikgrinaker Feb 21, 2020
c63fd32
circleci: run P2P IPv4 and IPv6 tests in parallel (#4459)
erikgrinaker Feb 21, 2020
fe11219
Fix unexported returns (#4450)
erikgrinaker Feb 21, 2020
f934ca8
lite2: don't save intermediate headers (#4452)
cmwaters Feb 24, 2020
25d92d0
types: VerifyCommitX return when +2/3 sigs are verified (#4445)
Feb 25, 2020
c4f7256
lite2: store current validator set (#4472)
melekes Feb 26, 2020
9231b52
lite2: cross-check first header and update tests (#4471)
cmwaters Feb 26, 2020
6daea31
lite2: remove expiration checks on functions that don't require them …
melekes Feb 26, 2020
b5ce8f2
deps: bump github.com/tendermint/tm-db from 0.4.0 to 0.4.1 (#4476)
dependabot-preview[bot] Feb 26, 2020
b9535a2
blockchain (v2): comment out TestReactorTerminationScenarios (#4480)
melekes Feb 26, 2020
c45baa0
blockchain (v2): async testing notes (#4484)
brapse Feb 27, 2020
875b106
github: edit templates for use in issues and pull requests (#4483)
tac0turtle Feb 27, 2020
6be0e13
lite2: prune-headers (#4478)
cmwaters Feb 27, 2020
b5f6bfa
lite2: return height as 2nd return param in TrustedValidatorSet (#4479)
melekes Feb 27, 2020
3f883bb
lite2: actually run example tests + clock drift (#4487)
melekes Feb 27, 2020
7814430
JSON tests related changes (#4461)
Shivani912 Feb 28, 2020
b73c0b7
build(deps): bump github.com/golang/protobuf from 1.3.3 to 1.3.4 (#4485)
dependabot-preview[bot] Feb 28, 2020
c837a57
rpc: stop txSearch result processing if context is done (#4418)
gterzian Feb 28, 2020
a122a55
docs: adr-046 add bisection algorithm details (#4496)
melekes Feb 28, 2020
6cebba5
swagger: update swagger port (#4498)
tac0turtle Feb 28, 2020
6f6843e
circleci: fix reproducible builds test (#4497)
erikgrinaker Feb 28, 2020
6c9e9b2
tool: add Mergify (#4490)
tac0turtle Feb 28, 2020
d1f7ef6
mergify: remove unnecessary conditions (#4501)
erikgrinaker Feb 28, 2020
72488db
mergify: use strict merges (#4502)
erikgrinaker Feb 28, 2020
c5fe733
test: simplified txsearch cancellation test (#4500)
erikgrinaker Feb 28, 2020
3f18e22
rpc: keep the original subscription "id" field when new RPCs come in …
michaelfig Feb 29, 2020
c33576e
example/kvstore: return ABCI query height (#4509)
erikgrinaker Mar 1, 2020
9bf8f41
lite2: fix tendermint lite sub command (#4505)
melekes Mar 2, 2020
67224fd
docs: `tendermint node --help` dumps all supported flags (#4511)
melekes Mar 2, 2020
51e1b4e
rpc: remove BlockStoreRPC in favor of BlockStore (#4510)
melekes Mar 2, 2020
3b2e1f2
cmd: show useful error when tm not initialised (#4512)
melekes Mar 2, 2020
a60d032
docs: write about debug kill and dump (#4516)
melekes Mar 3, 2020
c518a06
deps: bump github.com/Workiva/go-datastructures (#4519)
dependabot-preview[bot] Mar 3, 2020
ff78651
lite: add helper functions for initiating the light client (#4486)
cmwaters Mar 3, 2020
891afc2
cmd: fix debug kill and change debug dump archive filename format (#4…
melekes Mar 3, 2020
61380ff
build(deps): bump github.com/prometheus/client_golang (#4525)
dependabot-preview[bot] Mar 4, 2020
9e5b4af
.github: add markdown link checker (#4513)
tessr Mar 4, 2020
4936b23
adr-047: evidence handling (#4429)
melekes Mar 5, 2020
4c8e3c8
fix: proto-breakage (#4506)
mergify[bot] Mar 5, 2020
632b53d
fix addrbook tests (#4526)
mergify[bot] Mar 5, 2020
3a695d4
docs: fix links (#4531)
mergify[bot] Mar 5, 2020
7d00117
readme: add discord to readme (#4533)
mergify[bot] Mar 5, 2020
431618c
lite2: remove auto update (#4535)
melekes Mar 6, 2020
d3f965b
lite2: indicate success/failure of Update (#4536)
melekes Mar 6, 2020
bc89aad
rpc: create buffered subscriptions on /subscribe (#4521)
melekes Mar 6, 2020
b6f0aa3
lite2: replace primary when providing invalid header (#4523)
cmwaters Mar 6, 2020
f17717f
adr: crypto encoding for proto (#4481)
tac0turtle Mar 9, 2020
73c19bd
CONTRIBUTING: include instructions for installing protobuf
tessr Mar 9, 2020
cb8a2cc
build(deps): bump github.com/Workiva/go-datastructures (#4545)
dependabot-preview[bot] Mar 10, 2020
31bea92
libs/kv: remove unused type KI64Pair (#4542)
tessr Mar 10, 2020
c534291
rc1/v0.33.2(#4541)
tac0turtle Mar 11, 2020
b215e07
Merge pull request #4550 from tendermint/release/v0.33.2
melekes Mar 11, 2020
2544a5c
noop commit (#4553)
melekes Mar 11, 2020
7a3fac9
Apply Tendermint 0.33.1
zemyblue Mar 31, 2020
4473f22
Apply Tendermint 0.33.2
zemyblue Mar 31, 2020
591ab93
* Fix mod error
zemyblue Apr 1, 2020
2b22e4c
Remove checking breaking changes of protobuf in the CI
zemyblue Apr 1, 2020
0c0cb9f
mempool: reserve IDs in InitPeer instead of AddPeer
tessr Mar 27, 2020
9821af8
p2p: limit the number of incoming connections
melekes Apr 3, 2020
62c1a13
update changelog and version
melekes Apr 3, 2020
13eff7f
Merge pull request from GHSA-v24h-pjjv-mcp6
alessio Apr 9, 2020
373b978
Merge commit '13eff7f7ed80bb5deb8d294998dc429b29bf9fe3' into tendermi…
zemyblue Apr 20, 2020
555de6b
Merge pull request #65 from zemyblue/apply_0.33.3
zemyblue Apr 21, 2020
2bba46d
Merge branch 'tendermint_release' into feature/apply_0.33.3
zemyblue Apr 21, 2020
40befa3
Fix `TestReactorHelperMode` error in the `blockchain/v2/reactor_test.go`
zemyblue Apr 21, 2020
763b7c5
fix lint warnings.
zemyblue Apr 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lite2: make witnesses mandatory (#4358)
* lite2: make witnesses mandatory

at least one witness is required

* lite2: return an error if there are no witnesses

tendermint/tendermint#4358 (review)

* cmd/lite: add witnesses flag

* fix linter errors
  • Loading branch information
melekes authored Feb 3, 2020
commit 1edb542f99941153a4e9558abd7f3b8e46710d52
46 changes: 36 additions & 10 deletions cmd/tendermint/commands/lite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"net/http"
"strings"
"time"

"github.com/pkg/errors"
Expand All @@ -12,6 +13,7 @@ import (

tmos "github.com/tendermint/tendermint/libs/os"
lite "github.com/tendermint/tendermint/lite2"
"github.com/tendermint/tendermint/lite2/provider"
httpp "github.com/tendermint/tendermint/lite2/provider/http"
lproxy "github.com/tendermint/tendermint/lite2/proxy"
lrpc "github.com/tendermint/tendermint/lite2/rpc"
Expand All @@ -36,9 +38,10 @@ just with added trust and running locally.`,

var (
listenAddr string
nodeAddr string
primaryAddr string
chainID string
home string
witnessesAddrs string
maxOpenConnections int

trustingPeriod time.Duration
Expand All @@ -47,29 +50,51 @@ var (
)

func init() {
LiteCmd.Flags().StringVar(&listenAddr, "laddr", "tcp://localhost:8888", "Serve the proxy on the given address")
LiteCmd.Flags().StringVar(&nodeAddr, "node", "tcp://localhost:26657", "Connect to a Tendermint node at this address")
LiteCmd.Flags().StringVar(&listenAddr, "laddr", "tcp://localhost:8888",
"Serve the proxy on the given address")

LiteCmd.Flags().StringVar(&primaryAddr, "primary", "tcp://localhost:26657",
"Connect to a Tendermint node at this address")

LiteCmd.Flags().StringVar(&witnessesAddrs, "witnesses", "",
"Tendermint nodes to cross-check the primary node, comma-separated")

LiteCmd.Flags().StringVar(&chainID, "chain-id", "tendermint", "Specify the Tendermint chain ID")

LiteCmd.Flags().StringVar(&home, "home-dir", ".tendermint-lite", "Specify the home directory")
LiteCmd.Flags().IntVar(
&maxOpenConnections,
"max-open-connections",
900,
"Maximum number of simultaneous connections (including WebSocket).")

LiteCmd.Flags().DurationVar(&trustingPeriod, "trusting-period", 168*time.Hour, "Trusting period. Should be significantly less than the unbonding period")
LiteCmd.Flags().DurationVar(&trustingPeriod, "trusting-period", 168*time.Hour,
"Trusting period. Should be significantly less than the unbonding period")

LiteCmd.Flags().Int64Var(&trustedHeight, "trusted-height", 1, "Trusted header's height")

LiteCmd.Flags().BytesHexVar(&trustedHash, "trusted-hash", []byte{}, "Trusted header's hash")
}

func runProxy(cmd *cobra.Command, args []string) error {
liteLogger := logger.With("module", "lite")

logger.Info("Connecting to Tendermint node...")
// First, connect a client
node, err := rpcclient.NewHTTP(nodeAddr, "/websocket")
logger.Info("Connecting to the primary node...")
rpcClient, err := rpcclient.NewHTTP(chainID, primaryAddr)
if err != nil {
return errors.Wrap(err, "new HTTP client")
return errors.Wrapf(err, "http client for %s", primaryAddr)
}
primary := httpp.NewWithClient(chainID, rpcClient)

logger.Info("Connecting to the witness nodes...")
addrs := strings.Split(witnessesAddrs, ",")
witnesses := make([]provider.Provider, len(addrs))
for i, addr := range addrs {
p, err := httpp.New(chainID, addr)
if err != nil {
return errors.Wrapf(err, "http provider for %s", addr)
}
witnesses[i] = p
}

logger.Info("Creating client...")
Expand All @@ -84,7 +109,8 @@ func runProxy(cmd *cobra.Command, args []string) error {
Height: trustedHeight,
Hash: trustedHash,
},
httpp.NewWithClient(chainID, node),
primary,
witnesses,
dbs.New(db, chainID),
lite.Logger(liteLogger),
)
Expand All @@ -96,7 +122,7 @@ func runProxy(cmd *cobra.Command, args []string) error {
Addr: listenAddr,
Config: &rpcserver.Config{MaxOpenConnections: maxOpenConnections},
Codec: amino.NewCodec(),
Client: lrpc.NewClient(node, c),
Client: lrpc.NewClient(rpcClient, c),
Logger: liteLogger,
}
// Stop upon receiving SIGTERM or CTRL-C.
Expand Down
53 changes: 31 additions & 22 deletions lite2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,12 @@ func SequentialVerification() Option {
// applies to non-adjacent headers. For adjacent headers, sequential
// verification is used.
func SkippingVerification(trustLevel tmmath.Fraction) Option {
if err := ValidateTrustLevel(trustLevel); err != nil {
panic(err)
}
return func(c *Client) {
c.verificationMode = skipping
c.trustLevel = trustLevel
}
}

// Witnesses option can be used to supply providers, which will be used for
// cross-checking the primary provider. A witness can become a primary iff the
// current primary is unavailable.
func Witnesses(providers []provider.Provider) Option {
return func(c *Client) {
for _, witness := range providers {
if witness.ChainID() != c.ChainID() {
panic("Witness chainID is not equal to the Lite Client chainID")
}
}
c.witnesses = providers
}
}

// UpdatePeriod option can be used to change default polling period (5s).
func UpdatePeriod(d time.Duration) Option {
return func(c *Client) {
Expand Down Expand Up @@ -175,11 +158,16 @@ type Client struct {
// obtain the header & vals from the primary or they are invalid (e.g. trust
// hash does not match with the one from the header).
//
// Witnesses are providers, which will be used for cross-checking the primary
// provider. At least one witness must be given. A witness can become a primary
// iff the current primary is unavailable.
//
// See all Option(s) for the additional configuration.
func NewClient(
chainID string,
trustOptions TrustOptions,
primary provider.Provider,
witnesses []provider.Provider,
trustedStore store.Store,
options ...Option) (*Client, error) {

Expand All @@ -189,6 +177,7 @@ func NewClient(
verificationMode: skipping,
trustLevel: DefaultTrustLevel,
primary: primary,
witnesses: witnesses,
trustedStore: trustedStore,
updatePeriod: defaultUpdatePeriod,
removeNoLongerTrustedHeadersPeriod: defaultRemoveNoLongerTrustedHeadersPeriod,
Expand All @@ -201,6 +190,24 @@ func NewClient(
o(c)
}

// Validate the number of witnesses.
if len(c.witnesses) < 1 {
return nil, errors.New("expected at least one witness")
}

// Verify witnesses are all on the same chain.
for i, w := range witnesses {
if w.ChainID() != chainID {
return nil, errors.Errorf("witness #%d: %v is on another chain %s, expected %s",
i, w, w.ChainID(), chainID)
}
}

// Validate trust level.
if err := ValidateTrustLevel(c.trustLevel); err != nil {
return nil, err
}

if err := c.restoreTrustedHeaderAndNextVals(); err != nil {
return nil, err
}
Expand Down Expand Up @@ -523,11 +530,9 @@ func (c *Client) VerifyHeader(newHeader *types.SignedHeader, newVals *types.Vali
return errors.Errorf("header at more recent height #%d exists", c.trustedHeader.Height)
}

if len(c.witnesses) > 0 {
if err := c.compareNewHeaderWithRandomWitness(newHeader); err != nil {
c.logger.Error("Error when comparing new header with one from a witness", "err", err)
return err
}
if err := c.compareNewHeaderWithRandomWitness(newHeader); err != nil {
c.logger.Error("Error when comparing new header with one from a witness", "err", err)
return err
}

var err error
Expand Down Expand Up @@ -733,6 +738,10 @@ func (c *Client) fetchHeaderAndValsAtHeight(height int64) (*types.SignedHeader,

// compare header with one from a random witness.
func (c *Client) compareNewHeaderWithRandomWitness(h *types.SignedHeader) error {
if len(c.witnesses) == 0 {
return errors.New("could not find any witnesses")
}

// 1. Pick a witness.
witness := c.witnesses[tmrand.Intn(len(c.witnesses))]

Expand Down
Loading