cometbls source pure
2
const MaxChainIDLen
2
var ErrInvalidChainID, ErrInvalidHeight, ErrInvalidProof, ErrInvalidConsensus, ErrInvalidNextValidatorsHash, ErrInvalidTrustingPeriod, ErrInvalidUnbondingPeriod, ErrInvalidHeaderHeight, ErrInvalidMisbehaviour, ErrInvalidHeader, ErrInvalidMaxClockDrift, ErrProcessedTimeNotFound, ErrProcessedHeightNotFound, ErrDelayPeriodNotPassed, ErrTrustingPeriodExpired, ErrUnbondingPeriodExpired, ErrInvalidProofSpecs, ErrInvalidValidatorSet, ErrInvalidHeaderTimestamp, ErrInvalidMisbehaviourHeaderSequence, ErrMathOverflow, ErrMisbehaviourNotFound, ErrDecodeState
1var (
2 ErrInvalidChainID = errors.New("invalid chain-id")
3 ErrInvalidHeight = errors.New("invalid height")
4 ErrInvalidProof = errors.New("invalid proof")
5 ErrInvalidConsensus = errors.New("invalid consensus state")
6 ErrInvalidNextValidatorsHash = errors.New("invalid next validators hash")
7 ErrInvalidTrustingPeriod = errors.New("invalid trusting period")
8 ErrInvalidUnbondingPeriod = errors.New("invalid unbonding period")
9 ErrInvalidHeaderHeight = errors.New("invalid header height")
10 ErrInvalidMisbehaviour = errors.New("invalid misbehaviour")
11 ErrInvalidHeader = errors.New("invalid header")
12 ErrInvalidMaxClockDrift = errors.New("invalid max clock drift")
13 ErrProcessedTimeNotFound = errors.New("processed time not found")
14 ErrProcessedHeightNotFound = errors.New("processed height not found")
15 ErrDelayPeriodNotPassed = errors.New("packet-specified delay period has not been reached")
16 ErrTrustingPeriodExpired = errors.New("time since latest trusted state has passed the trusting period")
17 ErrUnbondingPeriodExpired = errors.New("time since latest trusted state has passed the unbonding period")
18 ErrInvalidProofSpecs = errors.New("invalid proof specs")
19 ErrInvalidValidatorSet = errors.New("invalid validator set")
20 ErrInvalidHeaderTimestamp = errors.New("invalid header timestamp")
21 ErrInvalidMisbehaviourHeaderSequence = errors.New("invalid misbehaviour header sequence")
22 ErrMathOverflow = errors.New("math operation with overflow")
23 ErrMisbehaviourNotFound = errors.New("misbehaviour not found")
24 ErrDecodeState = errors.New("decode state error")
25)IBC tendermint client sentinel errors
var FrozenHeight
15
func DecodeProofs
DecodeProofs decodes a protobuf-encoded MerkleProof (repeated CommitmentProof field 1).
func EncodeClientState
func EncodeConsensusState
EncodeConsensusState ABI-encodes a ConsensusState (96 bytes). Root.Hash must be exactly 32 bytes.
func EncodeHeader
EncodeHeader ABI-encodes a Header. ValidatorsHash, NextValidatorsHash and AppHash must each be exactly 32 bytes.
func EncodeMisbehaviour
EncodeMisbehaviour protobuf-encodes a Misbehaviour: field 1 is Header1 and field 2 is Header2, each an ABI-encoded header.
func DecodeClientState
func NewClientState
func NewCometblsLightClient
1func NewCometblsLightClient(clientState *ClientState, consensusState *ConsensusState) (*CometblsLightClient, error)NewCometblsLightClient builds the Gno object-form light client from decoded client and consensus state. Core ClientImpl adapters decode MsgCreateClient bytes before calling this constructor.
func DecodeConsensusState
func NewConsensusState
func DecodeHeader
DecodeHeader ABI-decodes a Header.
func NewHeader
func NewLightHeader
func DecodeMisbehaviour
DecodeMisbehaviour protobuf-decodes a Misbehaviour.
func NewMisbehaviour
7
type ClientState
structMethods on ClientState
func ClientType
method on ClientStateClientType is tendermint.
func GetChainID
method on ClientStateGetChainID returns the chain-id
func GetContractAddress
method on ClientStatefunc GetFrozenRevisionHeight
method on ClientStatefunc GetLatestHeight
method on ClientStateGetLatestHeight returns latest block height.
func GetLatestRevisionHeight
method on ClientStateGetLatestRevisionHeight returns latest block height.
func GetMaxClockDrift
method on ClientStatefunc GetTrustingPeriod
method on ClientStatefunc GetUnbondingPeriod
method on ClientStatefunc IsExpired
method on ClientStateIsExpired returns whether or not the client has passed the trusting period since the last update (in which case no headers are considered valid).
func Validate
method on ClientStateValidate performs a basic validation of the client state fields.
func ZeroCustomFields
method on ClientStateZeroCustomFields returns a ClientState that is a copy of the current ClientState with all client customizable fields zeroed out
type CometblsLightClient
structCometblsLightClient is the stateful object implementing lightclient.Interface.
It holds the client state and the consensus states keyed by height, mirroring the host store's per-client entry as a self-contained pure object. The core host routes by clientId to the stored light-client object; this object owns its own state and is verified directly against lightclient.Interface.
Methods on CometblsLightClient
func GetCounterpartyChainID
method on CometblsLightClientfunc GetLatestHeight
method on CometblsLightClientfunc GetTimestamp
method on CometblsLightClientfunc GetTimestampAtHeight
method on CometblsLightClientfunc Misbehaviour
method on CometblsLightClientfunc Status
method on CometblsLightClientfunc VerifyCreation
method on CometblsLightClientfunc VerifyHeader
method on CometblsLightClient1func (c *CometblsLightClient) VerifyHeader(caller address, headerBytes []byte, relayer address) (types.StateUpdate, error)func VerifyMembership
method on CometblsLightClient1func (c *CometblsLightClient) VerifyMembership(height uint64, key []byte, proof []byte, value []byte) errorfunc VerifyNonMembership
method on CometblsLightClient1func (c *CometblsLightClient) VerifyNonMembership(height uint64, key []byte, proof []byte) errortype ConsensusState
structMethods on ConsensusState
func ClientType
method on ConsensusStatefunc GetNextValidatorsHash
method on ConsensusStatefunc GetRoot
method on ConsensusStatefunc GetRootHash
method on ConsensusStatefunc GetTimestamp
method on ConsensusStatefunc ValidateBasic
method on ConsensusStatetype Header
structMethods on Header
func ClientType
method on Headerfunc ConsensusState
method on Headerfunc GetHeight
method on HeaderGetHeight returns the height of the signed (untrusted) header. CometBLS carries a single revision, so it shares the trusted height's revision number.
func GetTime
method on Headerfunc ValidateBasic
method on HeaderValidateBasic calls the SignedHeader ValidateBasic function and checks that validatorsets are not nil. NOTE: TrustedHeight and TrustedValidators may be empty when creating client with MsgCreateClient
type LightHeader
identLightHeader is the bespoke CometBLS light header. It is an alias of crypto/cometblszk.LightHeader so a SignedHeader feeds VerifyZKP directly without re-mapping, and its TimeSeconds/TimeNanos split mirrors the ABI wire format (see headerSchema in encoding.gno).
type MerkleRoot
structMerkleRoot is the commitment root (app hash). Mirrors ibc.core.commitment.v1.MerkleRoot.
type Misbehaviour
structMethods on Misbehaviour
func ClientType
method on Misbehaviourfunc GetTime
method on MisbehaviourGetTime returns the timestamp at which misbehaviour occurred. It uses the maximum value from both headers to prevent producing an invalid header outside of the misbehaviour age range.
func ValidateBasic
method on MisbehaviourValidateBasic implements Misbehaviour interface
16
- bytes stdlib
- crypto/cometblszk stdlib
- crypto/sha256 stdlib
- encoding/hex stdlib
- errors stdlib
- gno.land/p/aib/encoding/proto package
- gno.land/p/aib/ibc/types package
- gno.land/p/aib/ics23 package
- gno.land/p/nt/bptree/v0 package
- gno.land/p/nt/ufmt/v0 package
- gno.land/p/onbloc/encoding/abi package
- gno.land/p/onbloc/ibc/union/lightclient package
- gno.land/p/onbloc/ibc/union/types package
- strconv stdlib
- strings stdlib
- time stdlib