-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# ICS 02: Client | ||
|
||
Package `client` defines types and method to store and update light clients which tracks on other chain's state. | ||
The main type is `Client`, which provides `commitment.Root` to verify state proofs and `ConsensusState` to | ||
verify header proofs. | ||
|
||
## Spec | ||
|
||
```typescript | ||
interface ConsensusState { | ||
height: uint64 | ||
root: CommitmentRoot | ||
validityPredicate: ValidityPredicate | ||
eqivocationPredicate: EquivocationPredicate | ||
} | ||
|
||
interface ClientState { | ||
consensusState: ConsensusState | ||
verifiedRoots: Map<uint64, CommitmentRoot> | ||
frozen: bool | ||
} | ||
|
||
interface Header { | ||
height: uint64 | ||
proof: HeaderProof | ||
state: Maybe[ConsensusState] | ||
root: CommitmentRoot | ||
} | ||
|
||
type ValidityPredicate = (ConsensusState, Header) => Error | ConsensusState | ||
|
||
type EquivocationPredicate = (ConsensusState, Header, Header) => bool | ||
``` | ||
## Impl | ||
### types.go | ||
`spec: interface ConsensusState` is implemented by `type ConsensusState`. `ConsensusState.{GetHeight(), GetRoot(), | ||
Validate(), Equivocation()}` each corresponds to `spec: ConsensusState.{height, root, validityPredicate, | ||
equivocationPredicate}`. `ConsensusState.Kind()` returns `Kind`, which is an enum indicating the type of the | ||
consensus algorithm. | ||
|
||
`spec: interface Header` is implemented by `type Header`. `Header{GetHeight(), Proof(), State(), GetRoot()}` | ||
each corresponds to `spec: Header.{height, proof, state, root}`. | ||
|
||
### manager.go | ||
|
||
`spec: interface ClientState` is implemented by `type Object`. // TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters