mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
@@ -4,6 +4,7 @@
|
||||
* 13-02-2020: Initial draft
|
||||
* 26-02-2020: Cross-checking the first header
|
||||
* 28-02-2020: Bisection algorithm details
|
||||
* 31-03-2020: Verify signature got changed
|
||||
|
||||
## Context
|
||||
|
||||
@@ -100,6 +101,10 @@ type Store interface {
|
||||
FirstSignedHeaderHeight() (int64, error)
|
||||
|
||||
SignedHeaderAfter(height int64) (*types.SignedHeader, error)
|
||||
|
||||
Prune(size uint16) error
|
||||
|
||||
Size() uint16
|
||||
}
|
||||
```
|
||||
|
||||
@@ -110,12 +115,13 @@ database, used in Tendermint). In the future, remote adapters are possible
|
||||
```go
|
||||
func Verify(
|
||||
chainID string,
|
||||
h1 *types.SignedHeader,
|
||||
h1NextVals *types.ValidatorSet,
|
||||
h2 *types.SignedHeader,
|
||||
h2Vals *types.ValidatorSet,
|
||||
trustedHeader *types.SignedHeader, // height=X
|
||||
trustedVals *types.ValidatorSet, // height=X or height=X+1
|
||||
untrustedHeader *types.SignedHeader, // height=Y
|
||||
untrustedVals *types.ValidatorSet, // height=Y
|
||||
trustingPeriod time.Duration,
|
||||
now time.Time,
|
||||
maxClockDrift time.Duration,
|
||||
trustLevel tmmath.Fraction) error {
|
||||
```
|
||||
|
||||
@@ -124,6 +130,9 @@ cases of adjacent and non-adjacent headers. In the former case, it compares the
|
||||
hashes directly (2/3+ signed transition). Otherwise, it verifies 1/3+
|
||||
(`trustLevel`) of trusted validators are still present in new validators.
|
||||
|
||||
While `Verify` function is certainly handy, `VerifyAdjacent` and
|
||||
`VerifyNonAdjacent` should be used most often to avoid logic errors.
|
||||
|
||||
### Bisection algorithm details
|
||||
|
||||
Non-recursive bisection algorithm was implemented despite the spec containing
|
||||
|
||||
Reference in New Issue
Block a user