Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func ValidCommit(chainID string, commit *tmproto.Commit, valSet *tmproto.ValidatorSet) (err error)
- type ClientState
- func (cs ClientState) CheckHeaderAndUpdateState(ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, ...) (exported.ClientState, exported.ConsensusState, error)
- func (cs ClientState) CheckMisbehaviourAndUpdateState(ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, ...) (exported.ClientState, error)
- func (cs ClientState) CheckProposedHeaderAndUpdateState(ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, ...) (exported.ClientState, exported.ConsensusState, error)
- func (cs ClientState) ClientType() string
- func (*ClientState) Descriptor() ([]byte, []int)
- func (cs ClientState) GetChainID() string
- func (cs ClientState) GetFrozenHeight() exported.Height
- func (cs ClientState) GetLatestHeight() exported.Height
- func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec
- func (cs ClientState) IsExpired(latestTimestamp, now time.Time) bool
- func (cs ClientState) IsFrozen() bool
- func (m *ClientState) Marshal() (dAtA []byte, err error)
- func (m *ClientState) MarshalTo(dAtA []byte) (int, error)
- func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ClientState) ProtoMessage()
- func (m *ClientState) Reset()
- func (m *ClientState) Size() (n int)
- func (m *ClientState) String() string
- func (m *ClientState) Unmarshal(dAtA []byte) error
- func (cs ClientState) Validate() error
- func (cs ClientState) VerifyChannelState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyClientConsensusState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyClientState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyConnectionState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyNextSequenceRecv(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyPacketAcknowledgement(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyPacketCommitment(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyPacketReceiptAbsence(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, ...) error
- func (cs ClientState) VerifyUpgrade(ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, ...) error
- func (m *ClientState) XXX_DiscardUnknown()
- func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClientState) XXX_Merge(src proto.Message)
- func (m *ClientState) XXX_Size() int
- func (m *ClientState) XXX_Unmarshal(b []byte) error
- func (cs ClientState) ZeroCustomFields() exported.ClientState
- type ConsensusState
- func (ConsensusState) ClientType() string
- func (*ConsensusState) Descriptor() ([]byte, []int)
- func (cs ConsensusState) GetRoot() exported.Root
- func (cs ConsensusState) GetTimestamp() uint64
- func (m *ConsensusState) Marshal() (dAtA []byte, err error)
- func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error)
- func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ConsensusState) ProtoMessage()
- func (m *ConsensusState) Reset()
- func (m *ConsensusState) Size() (n int)
- func (m *ConsensusState) String() string
- func (m *ConsensusState) Unmarshal(dAtA []byte) error
- func (cs ConsensusState) ValidateBasic() error
- func (m *ConsensusState) XXX_DiscardUnknown()
- func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConsensusState) XXX_Merge(src proto.Message)
- func (m *ConsensusState) XXX_Size() int
- func (m *ConsensusState) XXX_Unmarshal(b []byte) error
- type Fraction
- func (*Fraction) Descriptor() ([]byte, []int)
- func (m *Fraction) GetDenominator() int64
- func (m *Fraction) GetNumerator() int64
- func (m *Fraction) Marshal() (dAtA []byte, err error)
- func (m *Fraction) MarshalTo(dAtA []byte) (int, error)
- func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Fraction) ProtoMessage()
- func (m *Fraction) Reset()
- func (m *Fraction) Size() (n int)
- func (m *Fraction) String() string
- func (f Fraction) ToTendermint() tmmath.Fraction
- func (m *Fraction) Unmarshal(dAtA []byte) error
- func (m *Fraction) XXX_DiscardUnknown()
- func (m *Fraction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Fraction) XXX_Merge(src proto.Message)
- func (m *Fraction) XXX_Size() int
- func (m *Fraction) XXX_Unmarshal(b []byte) error
- type Header
- func (h Header) ClientType() string
- func (h Header) ConsensusState() *ConsensusState
- func (*Header) Descriptor() ([]byte, []int)
- func (h Header) GetHeight() exported.Height
- func (h Header) GetTime() time.Time
- func (m *Header) GetTrustedHeight() types.Height
- func (m *Header) GetTrustedValidators() *types3.ValidatorSet
- func (m *Header) GetValidatorSet() *types3.ValidatorSet
- func (m *Header) Marshal() (dAtA []byte, err error)
- func (m *Header) MarshalTo(dAtA []byte) (int, error)
- func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Header) ProtoMessage()
- func (m *Header) Reset()
- func (m *Header) Size() (n int)
- func (m *Header) String() string
- func (m *Header) Unmarshal(dAtA []byte) error
- func (h Header) ValidateBasic() error
- func (m *Header) XXX_DiscardUnknown()
- func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Header) XXX_Merge(src proto.Message)
- func (m *Header) XXX_Size() int
- func (m *Header) XXX_Unmarshal(b []byte) error
- type Misbehaviour
- func (misbehaviour Misbehaviour) ClientType() string
- func (*Misbehaviour) Descriptor() ([]byte, []int)
- func (misbehaviour Misbehaviour) GetClientID() string
- func (misbehaviour Misbehaviour) GetHeight() exported.Height
- func (misbehaviour Misbehaviour) GetTime() time.Time
- func (m *Misbehaviour) Marshal() (dAtA []byte, err error)
- func (m *Misbehaviour) MarshalTo(dAtA []byte) (int, error)
- func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Misbehaviour) ProtoMessage()
- func (m *Misbehaviour) Reset()
- func (m *Misbehaviour) Size() (n int)
- func (misbehaviour Misbehaviour) String() string
- func (m *Misbehaviour) Unmarshal(dAtA []byte) error
- func (misbehaviour Misbehaviour) ValidateBasic() error
- func (m *Misbehaviour) XXX_DiscardUnknown()
- func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Misbehaviour) XXX_Merge(src proto.Message)
- func (m *Misbehaviour) XXX_Size() int
- func (m *Misbehaviour) XXX_Unmarshal(b []byte) error
Constants ¶
const (
SubModuleName = "tendermint-client"
)
const Tendermint string = "Tendermint"
Tendermint is used to indicate that the client uses the Tendermint Consensus Algorithm.
Variables ¶
var ( ErrInvalidChainID = sdkerrors.Register(SubModuleName, 2, "invalid chain-id") ErrInvalidTrustingPeriod = sdkerrors.Register(SubModuleName, 3, "invalid trusting period") ErrInvalidUnbondingPeriod = sdkerrors.Register(SubModuleName, 4, "invalid unbonding period") ErrInvalidHeaderHeight = sdkerrors.Register(SubModuleName, 5, "invalid header height") ErrInvalidHeader = sdkerrors.Register(SubModuleName, 6, "invalid header") ErrInvalidMaxClockDrift = sdkerrors.Register(SubModuleName, 7, "invalid max clock drift") ErrTrustingPeriodExpired = sdkerrors.Register(SubModuleName, 8, "time since latest trusted state has passed the trusting period") ErrUnbondingPeriodExpired = sdkerrors.Register(SubModuleName, 9, "time since latest trusted state has passed the unbonding period") ErrInvalidProofSpecs = sdkerrors.Register(SubModuleName, 10, "invalid proof specs") ErrInvalidValidatorSet = sdkerrors.Register(SubModuleName, 11, "invalid validator set") ErrInvalidConsensusParams = sdkerrors.Register(SubModuleName, 12, "invalid consensus params") )
IBC tendermint client sentinel errors
var ( ErrInvalidLengthTendermint = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTendermint = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTendermint = fmt.Errorf("proto: unexpected end of group") )
var DefaultTrustLevel = NewFractionFromTm(light.DefaultTrustLevel)
DefaultTrustLevel is the tendermint light client default trust level
Functions ¶
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the tendermint concrete client-related implementations and interfaces.
func ValidCommit ¶
ValidCommit checks if the given commit is a valid commit from the passed-in validatorset
CommitToVoteSet will panic if the commit cannot be converted to a valid voteset given the validatorset This implies that someone tried to submit misbehaviour that wasn't actually committed by the validatorset thus we should return an error here and reject the misbehaviour rather than panicing.
Types ¶
type ClientState ¶
type ClientState struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` TrustLevel Fraction `protobuf:"bytes,2,opt,name=trust_level,json=trustLevel,proto3" json:"trust_level" yaml:"trust_level"` // duration of the period since the LastestTimestamp during which the // submitted headers are valid for upgrade TrustingPeriod time.Duration `` /* 128-byte string literal not displayed */ // duration of the staking unbonding period UnbondingPeriod time.Duration `` /* 132-byte string literal not displayed */ // defines how much new (untrusted) header's Time can drift into the future. MaxClockDrift time.Duration `` /* 127-byte string literal not displayed */ // Block height when the client was frozen due to a misbehaviour FrozenHeight types.Height `protobuf:"bytes,6,opt,name=frozen_height,json=frozenHeight,proto3" json:"frozen_height" yaml:"frozen_height"` // Latest height the client was updated to LatestHeight types.Height `protobuf:"bytes,7,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height" yaml:"latest_height"` // Consensus params of the chain ConsensusParams *types1.ConsensusParams `` /* 130-byte string literal not displayed */ // Proof specifications used in verifying counterparty state ProofSpecs []*_go.ProofSpec `protobuf:"bytes,9,rep,name=proof_specs,json=proofSpecs,proto3" json:"proof_specs,omitempty" yaml:"proof_specs"` // Path at which next upgraded client will be committed UpgradePath string `protobuf:"bytes,10,opt,name=upgrade_path,json=upgradePath,proto3" json:"upgrade_path,omitempty" yaml:"upgrade_path"` // This flag, when set to true, will allow governance to recover a client // which has expired AllowUpdateAfterExpiry bool `` /* 166-byte string literal not displayed */ // This flag, when set to true, will allow governance to unfreeze a client // whose chain has experienced a misbehaviour event AllowUpdateAfterMisbehaviour bool `` /* 190-byte string literal not displayed */ }
ClientState from Tendermint tracks the current validator set, latest height, and a possible frozen height.
func NewClientState ¶
func NewClientState( chainID string, trustLevel Fraction, trustingPeriod, ubdPeriod, maxClockDrift time.Duration, latestHeight clienttypes.Height, consensusParams *abci.ConsensusParams, specs []*ics23.ProofSpec, upgradePath string, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour bool, ) *ClientState
NewClientState creates a new ClientState instance
func (ClientState) CheckHeaderAndUpdateState ¶
func (cs ClientState) CheckHeaderAndUpdateState( ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, header exported.Header, ) (exported.ClientState, exported.ConsensusState, error)
CheckHeaderAndUpdateState checks if the provided header is valid, and if valid it will: create the consensus state for the header.Height and update the client state if the header height is greater than the latest client state height It returns an error if: - the client or header provided are not parseable to tendermint types - the header is invalid - header height is less than or equal to the trusted header height - header version is not equal to trusted header version - header valset commit verification fails - header timestamp is past the trusting period in relation to the consensus state - header timestamp is less than or equal to the consensus state timestamp
UpdateClient may be used to either create a consensus state for: - a future height greater than the latest client state height - a past height that was skipped during bisection If we are updating to a past height, a consensus state is created for that height to be persisted in client store If we are updating to a future height, the consensus state is created and the client state is updated to reflect the new latest height UpdateClient must only be used to update within a single version, thus header version number and trusted height's version number must be the same. To update to a new version, use a separate upgrade path Tendermint client validity checking uses the bisection algorithm described in the [Tendermint spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md).
func (ClientState) CheckMisbehaviourAndUpdateState ¶
func (cs ClientState) CheckMisbehaviourAndUpdateState( ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, misbehaviour exported.Misbehaviour, ) (exported.ClientState, error)
CheckMisbehaviourAndUpdateState determines whether or not two conflicting headers at the same height would have convinced the light client.
NOTE: consensusState1 is the trusted consensus state that corresponds to the TrustedHeight of misbehaviour.Header1 Similarly, consensusState2 is the trusted consensus state that corresponds to misbehaviour.Header2
func (ClientState) CheckProposedHeaderAndUpdateState ¶
func (cs ClientState) CheckProposedHeaderAndUpdateState( ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, header exported.Header, ) (exported.ClientState, exported.ConsensusState, error)
CheckProposedHeaderAndUpdateState will try to update the client with the new header if and only if the proposal passes and one of the following two conditions is satisfied:
- AllowUpdateAfterExpiry=true and Expire(ctx.BlockTime) = true
- AllowUpdateAfterMisbehaviour and IsFrozen() = true
In case 2) before trying to update the client, the client will be unfrozen by resetting the FrozenHeight to the zero Height. If AllowUpdateAfterMisbehaviour is set to true, expired clients will also be updated even if AllowUpdateAfterExpiry is set to false. Note, that even if the update happens, it may not be successful. The header may fail validation checks and an error will be returned in that case.
func (*ClientState) Descriptor ¶
func (*ClientState) Descriptor() ([]byte, []int)
func (ClientState) GetChainID ¶
func (cs ClientState) GetChainID() string
GetChainID returns the chain-id
func (ClientState) GetFrozenHeight ¶
func (cs ClientState) GetFrozenHeight() exported.Height
GetFrozenHeight returns the height at which client is frozen NOTE: FrozenHeight is zero if client is unfrozen
func (ClientState) GetLatestHeight ¶
func (cs ClientState) GetLatestHeight() exported.Height
GetLatestHeight returns latest block height.
func (ClientState) GetProofSpecs ¶
func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec
GetProofSpecs returns the format the client expects for proof verification as a string array specifying the proof type for each position in chained proof
func (ClientState) IsExpired ¶
func (cs ClientState) IsExpired(latestTimestamp, now time.Time) bool
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 (ClientState) IsFrozen ¶
func (cs ClientState) IsFrozen() bool
IsFrozen returns true if the frozen height has been set.
func (*ClientState) Marshal ¶
func (m *ClientState) Marshal() (dAtA []byte, err error)
func (*ClientState) MarshalToSizedBuffer ¶
func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ClientState) ProtoMessage ¶
func (*ClientState) ProtoMessage()
func (*ClientState) Reset ¶
func (m *ClientState) Reset()
func (*ClientState) Size ¶
func (m *ClientState) Size() (n int)
func (*ClientState) String ¶
func (m *ClientState) String() string
func (*ClientState) Unmarshal ¶
func (m *ClientState) Unmarshal(dAtA []byte) error
func (ClientState) Validate ¶
func (cs ClientState) Validate() error
Validate performs a basic validation of the client state fields.
func (ClientState) VerifyChannelState ¶
func (cs ClientState) VerifyChannelState( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, portID, channelID string, channel exported.ChannelI, ) error
VerifyChannelState verifies a proof of the channel state of the specified channel end, under the specified port, stored on the target machine.
func (ClientState) VerifyClientConsensusState ¶
func (cs ClientState) VerifyClientConsensusState( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, counterpartyClientIdentifier string, consensusHeight exported.Height, prefix exported.Prefix, proof []byte, consensusState exported.ConsensusState, ) error
VerifyClientConsensusState verifies a proof of the consensus state of the Tendermint client stored on the target machine.
func (ClientState) VerifyClientState ¶
func (cs ClientState) VerifyClientState( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, counterpartyClientIdentifier string, proof []byte, clientState exported.ClientState, ) error
VerifyClientState verifies a proof of the client state of the running chain stored on the target machine
func (ClientState) VerifyConnectionState ¶
func (cs ClientState) VerifyConnectionState( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, connectionID string, connectionEnd exported.ConnectionI, ) error
VerifyConnectionState verifies a proof of the connection state of the specified connection end stored on the target machine.
func (ClientState) VerifyNextSequenceRecv ¶
func (cs ClientState) VerifyNextSequenceRecv( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, portID, channelID string, nextSequenceRecv uint64, ) error
VerifyNextSequenceRecv verifies a proof of the next sequence number to be received of the specified channel at the specified port.
func (ClientState) VerifyPacketAcknowledgement ¶
func (cs ClientState) VerifyPacketAcknowledgement( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, portID, channelID string, sequence uint64, acknowledgement []byte, ) error
VerifyPacketAcknowledgement verifies a proof of an incoming packet acknowledgement at the specified port, specified channel, and specified sequence.
func (ClientState) VerifyPacketCommitment ¶
func (cs ClientState) VerifyPacketCommitment( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, portID, channelID string, sequence uint64, commitmentBytes []byte, ) error
VerifyPacketCommitment verifies a proof of an outgoing packet commitment at the specified port, specified channel, and specified sequence.
func (ClientState) VerifyPacketReceiptAbsence ¶
func (cs ClientState) VerifyPacketReceiptAbsence( store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height, prefix exported.Prefix, proof []byte, portID, channelID string, sequence uint64, ) error
VerifyPacketReceiptAbsence verifies a proof of the absence of an incoming packet receipt at the specified port, specified channel, and specified sequence.
func (ClientState) VerifyUpgrade ¶
func (cs ClientState) VerifyUpgrade( ctx sdk.Context, cdc codec.BinaryMarshaler, clientStore sdk.KVStore, upgradedClient exported.ClientState, upgradeHeight exported.Height, proofUpgrade []byte, ) error
VerifyUpgrade checks if the upgraded client has been committed by the current client It will zero out all client-specific fields (e.g. TrustingPeriod and verify all data in client state that must be the same across all valid Tendermint clients for the new chain. VerifyUpgrade will return an error if:
- the upgradedClient is not a Tendermint ClientState
- the height of upgraded client is not greater than that of current client
- the latest height of the new client does not match the height in committed client
- any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, and ProofSpecs do not match parameters set by committed client
func (*ClientState) XXX_DiscardUnknown ¶
func (m *ClientState) XXX_DiscardUnknown()
func (*ClientState) XXX_Marshal ¶
func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ClientState) XXX_Merge ¶
func (m *ClientState) XXX_Merge(src proto.Message)
func (*ClientState) XXX_Size ¶
func (m *ClientState) XXX_Size() int
func (*ClientState) XXX_Unmarshal ¶
func (m *ClientState) XXX_Unmarshal(b []byte) error
func (ClientState) ZeroCustomFields ¶
func (cs ClientState) ZeroCustomFields() exported.ClientState
ZeroCustomFields returns a ClientState that is a copy of the current ClientState with all client customizable fields zeroed out
type ConsensusState ¶
type ConsensusState struct { // timestamp that corresponds to the block height in which the ConsensusState // was stored. Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` // commitment root (i.e app hash) Root types2.MerkleRoot `protobuf:"bytes,2,opt,name=root,proto3" json:"root"` NextValidatorsHash github_com_tendermint_tendermint_libs_bytes.HexBytes `` /* 207-byte string literal not displayed */ }
ConsensusState defines the consensus state from Tendermint.
func GetConsensusState ¶
func GetConsensusState(store sdk.KVStore, cdc codec.BinaryMarshaler, height exported.Height) (*ConsensusState, error)
GetConsensusState retrieves the consensus state from the client prefixed store. An error is returned if the consensus state does not exist.
func NewConsensusState ¶
func NewConsensusState( timestamp time.Time, root commitmenttypes.MerkleRoot, nextValsHash tmbytes.HexBytes, ) *ConsensusState
NewConsensusState creates a new ConsensusState instance.
func (ConsensusState) ClientType ¶
func (ConsensusState) ClientType() string
ClientType returns Tendermint
func (*ConsensusState) Descriptor ¶
func (*ConsensusState) Descriptor() ([]byte, []int)
func (ConsensusState) GetRoot ¶
func (cs ConsensusState) GetRoot() exported.Root
GetRoot returns the commitment Root for the specific
func (ConsensusState) GetTimestamp ¶
func (cs ConsensusState) GetTimestamp() uint64
GetTimestamp returns block time in nanoseconds at which the consensus state was stored
func (*ConsensusState) Marshal ¶
func (m *ConsensusState) Marshal() (dAtA []byte, err error)
func (*ConsensusState) MarshalToSizedBuffer ¶
func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ConsensusState) ProtoMessage ¶
func (*ConsensusState) ProtoMessage()
func (*ConsensusState) Reset ¶
func (m *ConsensusState) Reset()
func (*ConsensusState) Size ¶
func (m *ConsensusState) Size() (n int)
func (*ConsensusState) String ¶
func (m *ConsensusState) String() string
func (*ConsensusState) Unmarshal ¶
func (m *ConsensusState) Unmarshal(dAtA []byte) error
func (ConsensusState) ValidateBasic ¶
func (cs ConsensusState) ValidateBasic() error
ValidateBasic defines a basic validation for the tendermint consensus state.
func (*ConsensusState) XXX_DiscardUnknown ¶
func (m *ConsensusState) XXX_DiscardUnknown()
func (*ConsensusState) XXX_Marshal ¶
func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConsensusState) XXX_Merge ¶
func (m *ConsensusState) XXX_Merge(src proto.Message)
func (*ConsensusState) XXX_Size ¶
func (m *ConsensusState) XXX_Size() int
func (*ConsensusState) XXX_Unmarshal ¶
func (m *ConsensusState) XXX_Unmarshal(b []byte) error
type Fraction ¶
type Fraction struct { Numerator int64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` Denominator int64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"` }
Fraction defines the protobuf message type for tmmath.Fraction
func NewFractionFromTm ¶
NewFractionFromTm returns a new Fraction instance from a tmmath.Fraction
func (*Fraction) Descriptor ¶
func (*Fraction) GetDenominator ¶
func (*Fraction) GetNumerator ¶
func (*Fraction) MarshalToSizedBuffer ¶
func (*Fraction) ProtoMessage ¶
func (*Fraction) ProtoMessage()
func (Fraction) ToTendermint ¶
ToTendermint converts Fraction to tmmath.Fraction
func (*Fraction) XXX_DiscardUnknown ¶
func (m *Fraction) XXX_DiscardUnknown()
func (*Fraction) XXX_Marshal ¶
func (*Fraction) XXX_Unmarshal ¶
type Header ¶
type Header struct { *types3.SignedHeader `` /* 141-byte string literal not displayed */ ValidatorSet *types3.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty" yaml:"validator_set"` TrustedHeight types.Height `protobuf:"bytes,3,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height" yaml:"trusted_height"` TrustedValidators *types3.ValidatorSet `` /* 138-byte string literal not displayed */ }
Header defines the Tendermint client consensus Header. It encapsulates all the information necessary to update from a trusted Tendermint ConsensusState. The inclusion of TrustedHeight and TrustedValidators allows this update to process correctly, so long as the ConsensusState for the TrustedHeight exists, this removes race conditions among relayers The SignedHeader and ValidatorSet are the new untrusted update fields for the client. The TrustedHeight is the height of a stored ConsensusState on the client that will be used to verify the new untrusted header. The Trusted ConsensusState must be within the unbonding period of current time in order to correctly verify, and the TrustedValidators must hash to TrustedConsensusState.NextValidatorsHash since that is the last trusted validator set at the TrustedHeight.
func (Header) ClientType ¶
ClientType defines that the Header is a Tendermint consensus algorithm
func (Header) ConsensusState ¶
func (h Header) ConsensusState() *ConsensusState
ConsensusState returns the updated consensus state associated with the header
func (*Header) Descriptor ¶
func (Header) GetHeight ¶
GetHeight returns the current height. It returns 0 if the tendermint header is nil.
func (Header) GetTime ¶
GetTime returns the current block timestamp. It returns a zero time if the tendermint header is nil.
func (*Header) GetTrustedHeight ¶
func (*Header) GetTrustedValidators ¶
func (m *Header) GetTrustedValidators() *types3.ValidatorSet
func (*Header) GetValidatorSet ¶
func (m *Header) GetValidatorSet() *types3.ValidatorSet
func (*Header) MarshalToSizedBuffer ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (Header) ValidateBasic ¶
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
func (*Header) XXX_DiscardUnknown ¶
func (m *Header) XXX_DiscardUnknown()
func (*Header) XXX_Marshal ¶
func (*Header) XXX_Unmarshal ¶
type Misbehaviour ¶
type Misbehaviour struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` Header1 *Header `protobuf:"bytes,3,opt,name=header_1,json=header1,proto3" json:"header_1,omitempty" yaml:"header_1"` Header2 *Header `protobuf:"bytes,4,opt,name=header_2,json=header2,proto3" json:"header_2,omitempty" yaml:"header_2"` }
Misbehaviour is a wrapper over two conflicting Headers that implements Misbehaviour interface expected by ICS-02
func NewMisbehaviour ¶
func NewMisbehaviour(clientID, chainID string, header1, header2 *Header) *Misbehaviour
NewMisbehaviour creates a new Misbehaviour instance.
func (Misbehaviour) ClientType ¶
func (misbehaviour Misbehaviour) ClientType() string
ClientType is Tendermint light client
func (*Misbehaviour) Descriptor ¶
func (*Misbehaviour) Descriptor() ([]byte, []int)
func (Misbehaviour) GetClientID ¶
func (misbehaviour Misbehaviour) GetClientID() string
GetClientID returns the ID of the client that committed a misbehaviour.
func (Misbehaviour) GetHeight ¶
func (misbehaviour Misbehaviour) GetHeight() exported.Height
GetHeight returns the height at which misbehaviour occurred
NOTE: assumes that misbehaviour headers have the same height
func (Misbehaviour) GetTime ¶
func (misbehaviour Misbehaviour) GetTime() time.Time
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 (*Misbehaviour) Marshal ¶
func (m *Misbehaviour) Marshal() (dAtA []byte, err error)
func (*Misbehaviour) MarshalToSizedBuffer ¶
func (m *Misbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Misbehaviour) ProtoMessage ¶
func (*Misbehaviour) ProtoMessage()
func (*Misbehaviour) Reset ¶
func (m *Misbehaviour) Reset()
func (*Misbehaviour) Size ¶
func (m *Misbehaviour) Size() (n int)
func (Misbehaviour) String ¶
func (misbehaviour Misbehaviour) String() string
String implements Misbehaviour interface
func (*Misbehaviour) Unmarshal ¶
func (m *Misbehaviour) Unmarshal(dAtA []byte) error
func (Misbehaviour) ValidateBasic ¶
func (misbehaviour Misbehaviour) ValidateBasic() error
ValidateBasic implements Misbehaviour interface
func (*Misbehaviour) XXX_DiscardUnknown ¶
func (m *Misbehaviour) XXX_DiscardUnknown()
func (*Misbehaviour) XXX_Marshal ¶
func (m *Misbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Misbehaviour) XXX_Merge ¶
func (m *Misbehaviour) XXX_Merge(src proto.Message)
func (*Misbehaviour) XXX_Size ¶
func (m *Misbehaviour) XXX_Size() int
func (*Misbehaviour) XXX_Unmarshal ¶
func (m *Misbehaviour) XXX_Unmarshal(b []byte) error