-
Notifications
You must be signed in to change notification settings - Fork 566
/
commitment.go
44 lines (36 loc) · 1.28 KB
/
commitment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package exported
import ics23 "github.com/cosmos/ics23/go"
// ICS 023 Types Implementation
//
// This file includes types defined under
// https://github.com/cosmos/ibc/tree/master/spec/core/ics-023-vector-commitments
// spec:Path and spec:Value are defined as bytestring
// Root implements spec:CommitmentRoot.
// A root is constructed from a set of key-value pairs,
// and the inclusion or non-inclusion of an arbitrary key-value pair
// can be proven with the proof.
type Root interface {
GetHash() []byte
Empty() bool
}
// Prefix implements spec:CommitmentPrefix.
// Prefix represents the common "prefix" that a set of keys shares.
type Prefix interface {
Bytes() []byte
Empty() bool
}
// Path implements spec:CommitmentPath.
// A path is the additional information provided to the verification function.
type Path interface {
Empty() bool
}
// Proof implements spec:CommitmentProof.
// Proof can prove whether the key-value pair is a part of the Root or not.
// Each proof has designated key-value pair it is able to prove.
// Proofs include key but value is provided dynamically at the verification time.
type Proof interface {
VerifyMembership([]*ics23.ProofSpec, Root, Path, []byte) error
VerifyNonMembership([]*ics23.ProofSpec, Root, Path) error
Empty() bool
ValidateBasic() error
}