tendermint

package
v0.0.0-...-a76333c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubModuleName = "tendermint-client"
)

Variables

View Source
var (
	ErrInvalidChainID         = types.Register(moduleName, 2, "invalid chain-id")
	ErrInvalidTrustingPeriod  = types.Register(moduleName, 3, "invalid trusting period")
	ErrInvalidUnbondingPeriod = types.Register(moduleName, 4, "invalid unbonding period")
	ErrInvalidHeaderHeight    = types.Register(moduleName, 5, "invalid header height")
	ErrInvalidHeader          = types.Register(moduleName, 6, "invalid header")
	ErrInvalidMaxClockDrift   = types.Register(moduleName, 7, "invalid max clock drift")
	ErrProcessedTimeNotFound  = types.Register(moduleName, 8, "processed time not found")
	ErrDelayPeriodNotPassed   = types.Register(moduleName, 9, "packet-specified delay period has not been reached")
	ErrTrustingPeriodExpired  = types.Register(moduleName, 10, "time since latest trusted state has passed the trusting period")
	ErrUnbondingPeriodExpired = types.Register(moduleName, 11, "time since latest trusted state has passed the unbonding period")
	ErrInvalidProofSpecs      = types.Register(moduleName, 12, "invalid proof specs")
	ErrInvalidValidatorSet    = types.Register(moduleName, 13, "invalid validator set")
)

IBC tendermint client sentinel errors

View Source
var (
	ErrInvalidLengthTendermint        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTendermint          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTendermint = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

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"`
	// duration of the period since the LastestTimestamp during which the
	// submitted headers are valid for upgrade
	TrustingPeriod time.Duration `protobuf:"bytes,3,opt,name=trusting_period,json=trustingPeriod,proto3,stdduration" json:"trusting_period"`
	// duration of the staking unbonding period
	UnbondingPeriod time.Duration `protobuf:"bytes,4,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period"`
	// defines how much new (untrusted) header's Time can drift into the future.
	MaxClockDrift time.Duration `protobuf:"bytes,5,opt,name=max_clock_drift,json=maxClockDrift,proto3,stdduration" json:"max_clock_drift"`
	// latest height the client was updated to
	LatestHeight client.Height `protobuf:"bytes,6,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"`
	// proof specifications used in verifying counterparty state
	ProofSpecs []*_go.ProofSpec `protobuf:"bytes,7,rep,name=proof_specs,json=proofSpecs,proto3" json:"proof_specs,omitempty"`
	// commitment merkle prefix of the counterparty chain.
	MerklePrefix commitment.MerklePrefix `protobuf:"bytes,8,opt,name=MerklePrefix,proto3" json:"MerklePrefix"`
	// period of transaction confirmation delay
	TimeDelay uint64 `protobuf:"varint,9,opt,name=timeDelay,proto3" json:"timeDelay,omitempty"`
	// json structure, some additional options can be stored here
	Extra []byte `protobuf:"bytes,10,opt,name=extra,proto3" json:"extra,omitempty"`
}

ClientState from Tendermint tracks the current validator set, latest height, and a possible frozen height.

func (ClientState) ClientType

func (cs ClientState) ClientType() string

ClientType is tendermint.

func (*ClientState) Descriptor

func (*ClientState) Descriptor() ([]byte, []int)

func (ClientState) GetChainId

func (cs ClientState) GetChainId() string

GetChainId returns the chain-id

func (ClientState) GetDelayBlock

func (cs ClientState) GetDelayBlock() uint64

GetDelayBlock returns the number of blocks delayed in transaction confirmation.

func (ClientState) GetDelayTime

func (cs ClientState) GetDelayTime() uint64

GetDelayTime returns the period of transaction confirmation delay.

func (ClientState) GetLatestHeight

func (cs ClientState) GetLatestHeight() types.Height

func (ClientState) GetPrefix

func (cs ClientState) GetPrefix() types.Prefix

GetPrefix returns the prefix path for proof key.

func (*ClientState) Marshal

func (m *ClientState) Marshal() (dAtA []byte, err error)

func (*ClientState) MarshalTo

func (m *ClientState) MarshalTo(dAtA []byte) (int, 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) 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

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               commitment.MerkleRoot                                `protobuf:"bytes,2,opt,name=root,proto3" json:"root"`
	NextValidatorsHash github_com_tendermint_tendermint_libs_bytes.HexBytes `` /* 179-byte string literal not displayed */
}

ConsensusState defines the consensus state from Tendermint.

func NewConsensusState

func NewConsensusState(
	timestamp time.Time, root commitment.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() types.Root

GetRoot returns the commitment Root for the specific

func (ConsensusState) GetTimestamp

func (cs ConsensusState) GetTimestamp() uint64

GetTimestamp returns block time in nanoseconds of the header that created consensus state

func (*ConsensusState) Marshal

func (m *ConsensusState) Marshal() (dAtA []byte, err error)

func (*ConsensusState) MarshalTo

func (m *ConsensusState) MarshalTo(dAtA []byte) (int, 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. NOTE: ProcessedTimestamp may be zero if this is an initial consensus state passed in by relayer as opposed to a consensus state constructed by the chain.

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 EthermintConfig

type EthermintConfig struct {
	Prefix          []byte `json:"prefix"`
	ContractAddress string `json:"contract_address"`
}

type Fraction

type Fraction struct {
	Numerator   uint64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
	Denominator uint64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"`
}

Fraction defines the protobuf message type for tmmath.Fraction that only supports positive values.

func (*Fraction) Descriptor

func (*Fraction) Descriptor() ([]byte, []int)

func (*Fraction) GetDenominator

func (m *Fraction) GetDenominator() uint64

func (*Fraction) GetNumerator

func (m *Fraction) GetNumerator() uint64

func (*Fraction) Marshal

func (m *Fraction) Marshal() (dAtA []byte, err error)

func (*Fraction) MarshalTo

func (m *Fraction) MarshalTo(dAtA []byte) (int, error)

func (*Fraction) MarshalToSizedBuffer

func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Fraction) ProtoMessage

func (*Fraction) ProtoMessage()

func (*Fraction) Reset

func (m *Fraction) Reset()

func (*Fraction) Size

func (m *Fraction) Size() (n int)

func (*Fraction) String

func (m *Fraction) String() string

func (Fraction) ToTendermint

func (f Fraction) ToTendermint() tmmath.Fraction

ToTendermint converts Fraction to tmmath.Fraction

func (*Fraction) Unmarshal

func (m *Fraction) Unmarshal(dAtA []byte) error

func (*Fraction) XXX_DiscardUnknown

func (m *Fraction) XXX_DiscardUnknown()

func (*Fraction) XXX_Marshal

func (m *Fraction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Fraction) XXX_Merge

func (m *Fraction) XXX_Merge(src proto.Message)

func (*Fraction) XXX_Size

func (m *Fraction) XXX_Size() int

func (*Fraction) XXX_Unmarshal

func (m *Fraction) XXX_Unmarshal(b []byte) error
type Header struct {
	*types.SignedHeader `protobuf:"bytes,1,opt,name=signed_header,json=signedHeader,proto3,embedded=signed_header" json:"signed_header,omitempty"`
	ValidatorSet        *types.ValidatorSet `protobuf:"bytes,2,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"`
	TrustedHeight       client.Height       `protobuf:"bytes,3,opt,name=trusted_height,json=trustedHeight,proto3" json:"trusted_height"`
	TrustedValidators   *types.ValidatorSet `protobuf:"bytes,4,opt,name=trusted_validators,json=trustedValidators,proto3" json:"trusted_validators,omitempty"`
}

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 TmHeaderToPrHeader

func TmHeaderToPrHeader(h tmtypes.Header) Header

func (Header) ClientType

func (h Header) ClientType() string

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) Descriptor() ([]byte, []int)

func (Header) GetHeight

func (h Header) GetHeight() types.Height

GetHeight returns the current height. It returns 0 if the tendermint header is nil. NOTE: the header.Header is checked to be non nil in ValidateBasic.

func (Header) GetTime

func (h Header) GetTime() time.Time

GetTime returns the current block timestamp. It returns a zero time if the tendermint header is nil. NOTE: the header.Header is checked to be non nil in ValidateBasic.

func (*Header) GetTrustedHeight

func (m *Header) GetTrustedHeight() client.Height

func (*Header) GetTrustedValidators

func (m *Header) GetTrustedValidators() *types.ValidatorSet

func (*Header) GetValidatorSet

func (m *Header) GetValidatorSet() *types.ValidatorSet

func (*Header) Marshal

func (m *Header) Marshal() (dAtA []byte, err error)

func (*Header) MarshalTo

func (m *Header) MarshalTo(dAtA []byte) (int, error)

func (*Header) MarshalToSizedBuffer

func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) Size

func (m *Header) Size() (n int)

func (*Header) String

func (m *Header) String() string

func (*Header) Unmarshal

func (m *Header) Unmarshal(dAtA []byte) error

func (Header) ValidateBasic

func (h Header) ValidateBasic() error

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 (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Header) XXX_Merge

func (m *Header) XXX_Merge(src proto.Message)

func (*Header) XXX_Size

func (m *Header) XXX_Size() int

func (*Header) XXX_Unmarshal

func (m *Header) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL