Documentation ¶
Index ¶
- Constants
- func CommitmentOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
- func DefaultProofRuntime() (prt *merkle.ProofRuntime)
- func Ics23CompatibleProofRuntime() (prt *merkle.ProofRuntime)
- func Ics23ProofRuntime() (prt *merkle.ProofRuntime)
- func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
- func QueryKeyWithProof(node rpcclient.Client, key []byte, storeName string, height int64) ([]byte, []byte, []byte, error)
- func RequireProof(subpath string) bool
- type Codec
- type CommitID
- type CommitInfo
- type CommitmentOp
- type ConsensusState
- type Header
- type KeyValueMerkleProof
- func (kvmp *KeyValueMerkleProof) SetKeyVerifier(keyChecker KeyVerifier)
- func (kvmp *KeyValueMerkleProof) SetOpsVerifier(verifier merkle.ProofOpsVerifier)
- func (kvmp *KeyValueMerkleProof) SetProofRuntime(prt *merkle.ProofRuntime)
- func (kvmp *KeyValueMerkleProof) SetVerifiers(verifiers []merkle.ProofOpVerifier)
- func (kvmp *KeyValueMerkleProof) Validate() bool
- type KeyVerifier
- type MultiStoreProof
- type MultiStoreProofOp
- type StoreCore
- type StoreInfo
Constants ¶
const ( ProofOpIAVLCommitment = "ics23:iavl" ProofOpSimpleMerkleCommitment = "ics23:simple" )
const ProofOpMultiStore = "multistore"
the multi-store proof operation constant value
Variables ¶
This section is empty.
Functions ¶
func CommitmentOpDecoder ¶
func CommitmentOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
CommitmentOpDecoder takes a merkle.ProofOp and attempts to decode it into a CommitmentOp ProofOperator The proofOp.Data is just a marshalled CommitmentProof. The Key of the CommitmentOp is extracted from the unmarshalled proof.
func DefaultProofRuntime ¶
func DefaultProofRuntime() (prt *merkle.ProofRuntime)
func Ics23CompatibleProofRuntime ¶
func Ics23CompatibleProofRuntime() (prt *merkle.ProofRuntime)
func Ics23ProofRuntime ¶
func Ics23ProofRuntime() (prt *merkle.ProofRuntime)
func MultiStoreProofOpDecoder ¶
func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
MultiStoreProofOpDecoder returns a multi-store merkle proof operator from a given proof operation.
func QueryKeyWithProof ¶
func RequireProof ¶
RequireProof return whether proof is require for the subpath
Types ¶
type CommitInfo ¶
func (CommitInfo) CommitID ¶
func (ci CommitInfo) CommitID() CommitID
func (CommitInfo) Hash ¶
func (ci CommitInfo) Hash() []byte
Hash returns the simple merkle root hash of the stores sorted by name.
type CommitmentOp ¶
type CommitmentOp struct { Type string Spec *ics23.ProofSpec Key []byte Proof *ics23.CommitmentProof }
CommitmentOp implements merkle.ProofOperator by wrapping an ics23 CommitmentProof It also contains a Key field to determine which key the proof is proving. NOTE: CommitmentProof currently can either be ExistenceProof or NonexistenceProof
Type and Spec are classified by the kind of merkle proof it represents allowing the code to be reused by more types. Spec is never on the wire, but mapped from type in the code.
func (CommitmentOp) GetKey ¶
func (op CommitmentOp) GetKey() []byte
func (CommitmentOp) ProofOp ¶
func (op CommitmentOp) ProofOp() merkle.ProofOp
ProofOp implements ProofOperator interface and converts a CommitmentOp into a merkle.ProofOp format that can later be decoded by CommitmentOpDecoder back into a CommitmentOp for proof verification
func (CommitmentOp) Run ¶
func (op CommitmentOp) Run(args [][]byte) ([][]byte, error)
Run takes in a list of arguments and attempts to run the proof op against these arguments. Returns the root wrapped in [][]byte if the proof op succeeds with given args. If not, it will return an error.
CommitmentOp will accept args of length 1 or length 0 If length 1 args is passed in, then CommitmentOp will attempt to prove the existence of the key with the value provided by args[0] using the embedded CommitmentProof and return the CommitmentRoot of the proof. If length 0 args is passed in, then CommitmentOp will attempt to prove the absence of the key in the CommitmentOp and return the CommitmentRoot of the proof.
type ConsensusState ¶
type ConsensusState struct { ChainID string Height uint64 AppHash []byte CurValidatorSetHash []byte NextValidatorSet *tmtypes.ValidatorSet }
func DecodeConsensusState ¶
func DecodeConsensusState(input []byte) (ConsensusState, error)
input: | chainID | height | appHash | curValidatorSetHash | [{validator pubkey, voting power}] | | 32 bytes | 8 bytes | 32 bytes | 32 bytes | [{32 bytes, 8 bytes}] |
func GetInitConsensusState ¶
func GetInitConsensusState(node rpcclient.Client, height int64) (*ConsensusState, error)
func (*ConsensusState) ApplyHeader ¶
func (cs *ConsensusState) ApplyHeader(header *Header) (bool, error)
func (ConsensusState) EncodeConsensusState ¶
func (cs ConsensusState) EncodeConsensusState() ([]byte, error)
output: | chainID | height | appHash | curValidatorSetHash | [{validator pubkey, voting power}] | | 32 bytes | 8 bytes | 32 bytes | 32 bytes | [{32 bytes, 8 bytes}] |
type Header ¶
type Header struct { tmtypes.SignedHeader ValidatorSet *tmtypes.ValidatorSet `json:"validator_set"` NextValidatorSet *tmtypes.ValidatorSet `json:"next_validator_set"` }
func DecodeHeader ¶
func QueryTendermintHeader ¶
func (*Header) EncodeHeader ¶
type KeyValueMerkleProof ¶
type KeyValueMerkleProof struct { Key []byte Value []byte StoreName string AppHash []byte Proof *merkle.Proof // contains filtered or unexported fields }
func DecodeKeyValueMerkleProof ¶
func DecodeKeyValueMerkleProof(input []byte) (*KeyValueMerkleProof, error)
input: | storeName | key length | key | value length | value | appHash | proof | | 32 bytes | 32 bytes | | 32 bytes | | 32 bytes | |
func (*KeyValueMerkleProof) SetKeyVerifier ¶
func (kvmp *KeyValueMerkleProof) SetKeyVerifier(keyChecker KeyVerifier)
func (*KeyValueMerkleProof) SetOpsVerifier ¶
func (kvmp *KeyValueMerkleProof) SetOpsVerifier(verifier merkle.ProofOpsVerifier)
func (*KeyValueMerkleProof) SetProofRuntime ¶
func (kvmp *KeyValueMerkleProof) SetProofRuntime(prt *merkle.ProofRuntime)
func (*KeyValueMerkleProof) SetVerifiers ¶
func (kvmp *KeyValueMerkleProof) SetVerifiers(verifiers []merkle.ProofOpVerifier)
func (*KeyValueMerkleProof) Validate ¶
func (kvmp *KeyValueMerkleProof) Validate() bool
type KeyVerifier ¶
type MultiStoreProof ¶
type MultiStoreProof struct {
StoreInfos []StoreInfo
}
MultiStoreProof defines a collection of store proofs in a multi-store
func NewMultiStoreProof ¶
func NewMultiStoreProof(storeInfos []StoreInfo) *MultiStoreProof
func (*MultiStoreProof) ComputeRootHash ¶
func (proof *MultiStoreProof) ComputeRootHash() []byte
ComputeRootHash returns the root hash for a given multi-store proof.
type MultiStoreProofOp ¶
type MultiStoreProofOp struct { // To encode in ProofOp.Data. Proof *MultiStoreProof `json:"proof"` // contains filtered or unexported fields }
TODO: document
func NewMultiStoreProofOp ¶
func NewMultiStoreProofOp(key []byte, proof *MultiStoreProof) MultiStoreProofOp
func (MultiStoreProofOp) GetKey ¶
func (op MultiStoreProofOp) GetKey() []byte
GetKey returns the key for a multi-store proof operation.
func (MultiStoreProofOp) ProofOp ¶
func (op MultiStoreProofOp) ProofOp() merkle.ProofOp
ProofOp return a merkle proof operation from a given multi-store proof operation.
func (MultiStoreProofOp) Run ¶
func (op MultiStoreProofOp) Run(args [][]byte) ([][]byte, error)
Run executes a multi-store proof operation for a given value. It returns the root hash if the value matches all the store's commitID's hash or an error otherwise.
func (MultiStoreProofOp) String ¶
func (op MultiStoreProofOp) String() string
String implements the Stringer interface for a mult-store proof operation.