Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

cometbls source pure

Constants 2

Variables 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)
source

IBC tendermint client sentinel errors

Functions 15

func DecodeProofs

1func DecodeProofs(buf []byte) ([]ics23.CommitmentProof, error)
source

DecodeProofs decodes a protobuf-encoded MerkleProof (repeated CommitmentProof field 1).

func EncodeConsensusState

1func EncodeConsensusState(cs *ConsensusState) ([]byte, error)
source

EncodeConsensusState ABI-encodes a ConsensusState (96 bytes). Root.Hash must be exactly 32 bytes.

func EncodeHeader

1func EncodeHeader(h *Header) ([]byte, error)
source

EncodeHeader ABI-encodes a Header. ValidatorsHash, NextValidatorsHash and AppHash must each be exactly 32 bytes.

func EncodeMisbehaviour

1func EncodeMisbehaviour(m *Misbehaviour) ([]byte, error)
source

EncodeMisbehaviour protobuf-encodes a Misbehaviour: field 1 is Header1 and field 2 is Header2, each an ABI-encoded header.

func NewClientState

1func NewClientState(
2	chainID string,
3	trustingPeriod,
4	unbondingPeriod uint64,
5	maxClockDrift uint64,
6	frozenHeight types.Height,
7	latestHeight types.Height,
8	contractAddress types.H256,
9) *ClientState
source

func NewCometblsLightClient

1func NewCometblsLightClient(clientState *ClientState, consensusState *ConsensusState) (*CometblsLightClient, error)
source

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 NewConsensusState

1func NewConsensusState(
2	timestamp uint64,
3	root MerkleRoot,
4	nextValidatorsHash []byte,
5) *ConsensusState
source

func DecodeHeader

1func DecodeHeader(buf []byte) (*Header, error)
source

DecodeHeader ABI-decodes a Header.

func NewHeader

1func NewHeader(
2	signedHeader *LightHeader,
3	trustedHeight *types.Height,
4	zeroKnowledgeProof []byte,
5) *Header
source

func NewLightHeader

1func NewLightHeader(height, timeSeconds int64, timeNanos int32, validatorsHash, nextValidatorsHash, appHash []byte) *LightHeader
source

func DecodeMisbehaviour

1func DecodeMisbehaviour(buf []byte) (*Misbehaviour, error)
source

DecodeMisbehaviour protobuf-decodes a Misbehaviour.

Types 7

type ClientState

struct
1type ClientState struct {
2	ChainID         string
3	TrustingPeriod  uint64
4	UnbondingPeriod uint64
5	MaxClockDrift   uint64
6	FrozenHeight    types.Height
7	LatestHeight    types.Height
8	ContractAddress types.H256
9}
source

Methods on ClientState

func ClientType

method on ClientState
1func (ClientState) ClientType() string
source

ClientType is tendermint.

func GetChainID

method on ClientState
1func (cs *ClientState) GetChainID() string
source

GetChainID returns the chain-id

func GetLatestHeight

method on ClientState
1func (cs *ClientState) GetLatestHeight() types.Height
source

GetLatestHeight returns latest block height.

func GetLatestRevisionHeight

method on ClientState
1func (cs *ClientState) GetLatestRevisionHeight() uint64
source

GetLatestRevisionHeight returns latest block height.

func IsExpired

method on ClientState
1func (cs *ClientState) IsExpired(latestTimestamp, now uint64) bool
source

IsExpired 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 ClientState
1func (cs *ClientState) Validate() error
source

Validate performs a basic validation of the client state fields.

func ZeroCustomFields

method on ClientState
1func (cs *ClientState) ZeroCustomFields() *ClientState
source

ZeroCustomFields returns a ClientState that is a copy of the current ClientState with all client customizable fields zeroed out

type CometblsLightClient

struct
1type CometblsLightClient struct {
2	clientState            *ClientState
3	consensusStateByHeight *bptree.BPTree // height:*ConsensusState
4}
source

CometblsLightClient 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 GetLatestHeight

method on CometblsLightClient
1func (c *CometblsLightClient) GetLatestHeight() uint64
source

func GetTimestamp

method on CometblsLightClient
1func (c *CometblsLightClient) GetTimestamp() types.Timestamp
source

func GetTimestampAtHeight

method on CometblsLightClient
1func (c *CometblsLightClient) GetTimestampAtHeight(height uint64) (types.Timestamp, error)
source

func Misbehaviour

method on CometblsLightClient
1func (c *CometblsLightClient) Misbehaviour(caller address, misbehaviour []byte, relayer address) ([]byte, error)
source

func Status

method on CometblsLightClient
1func (c *CometblsLightClient) Status() lightclient.Status
source

func VerifyCreation

method on CometblsLightClient
1func (c *CometblsLightClient) VerifyCreation(caller address, relayer address) (types.ClientCreationResult, error)
source

type ConsensusState

struct
1type ConsensusState struct {
2	Timestamp          uint64
3	Root               MerkleRoot
4	NextValidatorsHash []byte
5}
source

Methods on ConsensusState

func ClientType

method on ConsensusState
1func (ConsensusState) ClientType() string
source

func GetRoot

method on ConsensusState
1func (cs *ConsensusState) GetRoot() MerkleRoot
source

func GetRootHash

method on ConsensusState
1func (cs *ConsensusState) GetRootHash() []byte
source

func GetTimestamp

method on ConsensusState
1func (cs *ConsensusState) GetTimestamp() uint64
source

func ValidateBasic

method on ConsensusState
1func (cs *ConsensusState) ValidateBasic() error
source

type Header

struct
1type Header struct {
2	SignedHeader       *LightHeader
3	TrustedHeight      *types.Height
4	ZeroKnowledgeProof []byte
5}
source

Methods on Header

func GetHeight

method on Header
1func (h *Header) GetHeight() types.Height
source

GetHeight 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 Header
1func (h *Header) GetTime() time.Time
source

func ValidateBasic

method on Header
1func (h *Header) ValidateBasic() error
source

ValidateBasic 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

ident
1type LightHeader = cometblszk.LightHeader
source

LightHeader 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

struct
1type MerkleRoot struct {
2	Hash []byte
3}
source

MerkleRoot is the commitment root (app hash). Mirrors ibc.core.commitment.v1.MerkleRoot.

Methods on MerkleRoot

func Empty

method on MerkleRoot
1func (mr MerkleRoot) Empty() bool
source

Empty returns true if the root is empty

func GetHash

method on MerkleRoot
1func (mr MerkleRoot) GetHash() []byte
source

GetHash implements RootI interface

type Misbehaviour

struct
1type Misbehaviour struct {
2	Header1 *Header
3	Header2 *Header
4}
source

Methods on Misbehaviour

func ClientType

method on Misbehaviour
1func (Misbehaviour) ClientType() string
source

func GetTime

method on Misbehaviour
1func (m *Misbehaviour) GetTime() time.Time
source

GetTime 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 Misbehaviour
1func (m *Misbehaviour) ValidateBasic() error
source

ValidateBasic implements Misbehaviour interface

Imports 16

Source Files 14