mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 19:21:44 +00:00
one source
although we may want multiple alternative sources for a) backup in case primary fails b) checking primary source
This commit is contained in:
@ -160,22 +160,22 @@ type Verifier struct {
|
|||||||
|
|
||||||
mode mode
|
mode mode
|
||||||
trustLevel float
|
trustLevel float
|
||||||
trustLevelAdj float
|
|
||||||
|
|
||||||
// Already validated, stored locally
|
// Source of new FullCommit(s).
|
||||||
|
source Provider
|
||||||
|
|
||||||
|
// Where trusted FullCommit(s) are stored.
|
||||||
trusted PersistentProvider
|
trusted PersistentProvider
|
||||||
|
|
||||||
// New info, like a node rpc, or other import method.
|
|
||||||
sources Provider
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Since providers themselves don't know when they have received a new header
|
Since providers themselves don't know when they have received a new header (or
|
||||||
(or may choose to do so upon a request), we must add a new function to
|
may choose to do so upon a request), we must add a new function to `Verifier` -
|
||||||
`Verifier` - `Verify(height int64) error`.
|
`Verify(height int64) error`. It will try to fetch a new header & validator set
|
||||||
|
and verify it.
|
||||||
|
|
||||||
It should also provide `AutoVerify(period)` option to try & verify new headers
|
`Verifier` should also have `AutoVerify(period)` option to execute
|
||||||
in the background (optional).
|
`Verify(currentHeight + 1)` in the background periodically (optional).
|
||||||
|
|
||||||
**Sequential vs bisecting verifier**
|
**Sequential vs bisecting verifier**
|
||||||
|
|
||||||
@ -190,8 +190,8 @@ func SequentialVerification() Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// trustLevel - maximum change between two not consequitive headers in terms of
|
// trustLevel - maximum change between two not consequitive headers in terms of
|
||||||
// validators & // their respective voting power, required to trust a new header
|
// validators & their respective voting power, required to trust a new header
|
||||||
// (default: // 1/3).
|
// (default: 1/3).
|
||||||
func BisectingVerification(trustLevel float) Option {
|
func BisectingVerification(trustLevel float) Option {
|
||||||
if trustLevel > 1 || trustLevel < 1/3 {
|
if trustLevel > 1 || trustLevel < 1/3 {
|
||||||
panic(fmt.Sprintf("trustLevel must be within [1/3, 1], given %v", trustLevel))
|
panic(fmt.Sprintf("trustLevel must be within [1/3, 1], given %v", trustLevel))
|
||||||
@ -224,14 +224,10 @@ front). For IBC, it will be a `keeper` provider.
|
|||||||
**Minimal test for (1)**
|
**Minimal test for (1)**
|
||||||
|
|
||||||
```go
|
```go
|
||||||
sources = []rpcclient.Client{
|
|
||||||
rpcclient.NewHTTP(remote1, "/websocket"),
|
|
||||||
rpcclient.NewHTTP(remote2, "/websocket"),
|
|
||||||
}
|
|
||||||
c, err := lite.NewClient(
|
c, err := lite.NewClient(
|
||||||
chainID,
|
chainID,
|
||||||
lite.TrustOptions{TrustPeriod: 336 * time.Hour},
|
lite.TrustOptions{TrustPeriod: 336 * time.Hour},
|
||||||
sources,
|
rpcclient.NewHTTP(remote1, "/websocket"),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -246,7 +242,7 @@ assert.Equal(t, chainID, commit.ChainID)
|
|||||||
```go
|
```go
|
||||||
type Client struct {
|
type Client struct {
|
||||||
verifier *Verifier
|
verifier *Verifier
|
||||||
clients []rpcclient.Client
|
client rpcclient.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var rpcclient.Client = (*Client)(nil)
|
var rpcclient.Client = (*Client)(nil)
|
||||||
@ -255,13 +251,10 @@ var rpcclient.Client = (*Client)(nil)
|
|||||||
**Minimal test for (2)**
|
**Minimal test for (2)**
|
||||||
|
|
||||||
```go
|
```go
|
||||||
sources = []lite.Provider{
|
|
||||||
ibc.New(chainID),
|
|
||||||
}
|
|
||||||
c, err := lite.NewVerifier(
|
c, err := lite.NewVerifier(
|
||||||
chainID,
|
chainID,
|
||||||
lite.TrustOptions{TrustPeriod: 24 * time.Hour},
|
lite.TrustOptions{TrustPeriod: 24 * time.Hour},
|
||||||
sources,
|
ibc.New(chainID),
|
||||||
Trusted(ibcKeeper{}),
|
Trusted(ibcKeeper{}),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -270,6 +263,11 @@ err = c.Verify(height)
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Evidence Handling and Reporting**
|
||||||
|
|
||||||
|
light client should also be able to submit evidence of malfeasance and handle
|
||||||
|
evidence coming from a full node or another source.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
Accepted.
|
Accepted.
|
||||||
|
Reference in New Issue
Block a user