1type Interface interface {
2 // Initialize is called upon client creation, it allows the client to perform
3 // validation on the client state and initial consensus state. The light
4 // client module is responsible for setting any client-specific data in the
5 // store. This includes the client state, initial consensus state and any
6 // associated metadata.
7 Initialize(ClientState, ConsensusState) error
8
9 // VerifyClientMessage must verify a ClientMessage. A ClientMessage could be
10 // a Header, Misbehaviour, or batch update. It must handle each type of
11 // ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState,
12 // and UpdateStateOnMisbehaviour will assume that the content of the
13 // ClientMessage has been verified and can be trusted. An error should be
14 // returned if the ClientMessage fails to verify.
15 VerifyClientMessage(ClientMessage) error
16
17 // Checks for evidence of a misbehaviour in Header or Misbehaviour type. It
18 // assumes the ClientMessage has already been verified.
19 CheckForMisbehaviour(ClientMessage) bool
20
21 // UpdateStateOnMisbehaviour should perform appropriate state changes on a
22 // client state given that misbehaviour has been detected and verified.
23 UpdateStateOnMisbehaviour(ClientMessage)
24
25 // UpdateState updates and stores as necessary any associated information for
26 // an IBC client, such as the ClientState and corresponding ConsensusState.
27 // Upon successful update, a list of consensus heights is returned. It
28 // assumes the ClientMessage has already been verified.
29 UpdateState(ClientMessage) []types.Height
30
31 // VerifyMembership is a generic proof verification method which verifies a
32 // proof of the existence of a value at a given CommitmentPath at the
33 // specified height. The caller is expected to construct the full
34 // CommitmentPath from a CommitmentPrefix and a standardized path (as defined
35 // in ICS 24).
36 VerifyMembership(height types.Height, proofs []ics23.CommitmentProof,
37 path types.MerklePath, value []byte) error
38
39 // VerifyNonMembership is a generic proof verification method which verifies
40 // the absence of a given CommitmentPath at a specified height. The caller
41 // is expected to construct the full CommitmentPath from a CommitmentPrefix
42 // and a standardized path (as defined in ICS 24).
43 VerifyNonMembership(height types.Height,
44 proofs []ics23.CommitmentProof, path types.MerklePath) error
45
46 // Status must return the status of the client. Only Active clients are
47 // allowed to process packets.
48 Status() Status
49
50 // LatestHeight returns the latest height of the client. If no client is
51 // present for the provided client identifier a zero value height may be
52 // returned.
53 LatestHeight() types.Height
54
55 // TimestampAtHeight must return the timestamp in seconds for the consensus
56 // state associated with the provided height.
57 TimestampAtHeight(types.Height) (uint64, error)
58
59 // RecoverClient must verify that the provided substitute may be used to
60 // recover the subject (receiver) client, and copy the substitute's updated
61 // client and consensus state into the subject. The caller is responsible
62 // for verifying Status() on both sides and authorization beforehand.
63 RecoverClient(substitute Interface) error
64
65 // Upgrade functions NOTE: proof heights are not included as upgrade to a new
66 // revision is expected to pass only on the last height committed by the
67 // current revision. Clients are responsible for ensuring that the planned
68 // last height of the current revision is somehow encoded in the proof
69 // verification process. This is to ensure that no premature upgrades occur,
70 // since upgrade plans committed to by the counterparty may be cancelled or
71 // modified before the last planned height. If the upgrade is verified, the
72 // upgraded client and consensus states must be set in the client store.
73 VerifyUpgradeAndUpdateState(newClient, newConsState, upgradeClientProof,
74 upgradeConsensusStateProof any) error
75}