exported

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// TypeClientMisbehaviour is the shared evidence misbehaviour type
	TypeClientMisbehaviour string = "client_misbehaviour"

	// Tendermint is used to indicate that the client uses the Tendermint Consensus Algorithm.
	Tendermint string = "007-tendermint"

	// BSC is the client type for a bianance smart chain client.
	BSC string = "008-bsc"

	// ETH is the client type for a Ethereum client.
	ETH string = "009-eth"

	// Active is a status type of a client. An active client is allowed to be used.
	Active Status = "Active"

	// Expired is a status type of a client. An expired client is not allowed to be used.
	Expired Status = "Expired"

	// Unknown indicates there was an error in determining the status of a client.
	Unknown Status = "Unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanPacketI added in v0.2.0

type CleanPacketI interface {
	GetSequence() uint64
	GetSourceChain() string
	GetDestChain() string
	GetRelayChain() string
	ValidateBasic() error
}

CleanPacketI defines the standard interface for TIBC clean packets

type ClientState

type ClientState interface {
	proto.Message

	ClientType() string
	GetLatestHeight() Height
	Validate() error
	GetDelayTime() uint64
	GetDelayBlock() uint64
	GetPrefix() Prefix

	// Initialize function
	// Clients must validate the initial consensus state, and may store any client-specific metadata
	// necessary for correct light client operation
	Initialize(sdk.Context, codec.BinaryCodec, sdk.KVStore, ConsensusState) error

	// Status function
	// Clients must return their status. Only Active clients are allowed to process packets.
	Status(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec) Status

	// ExportMetadata function
	ExportMetadata(sdk.KVStore) []GenesisMetadata

	// Update and Misbehaviour functions
	CheckHeaderAndUpdateState(
		sdk.Context,
		codec.BinaryCodec,
		sdk.KVStore,
		Header,
	) (ClientState, ConsensusState, error)

	// State verification functions
	// Verify the commitment of the cross-chain data package
	VerifyPacketCommitment(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		proof []byte,
		sourceChain,
		destChain string,
		sequence uint64,
		commitmentBytes []byte,
	) error

	// Verify the Acknowledgement of the cross-chain data package
	VerifyPacketAcknowledgement(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		proof []byte,
		sourceChain,
		destChain string,
		sequence uint64,
		ackBytes []byte,
	) error

	// Verify the CleanCommitment of the cross-chain data package
	VerifyPacketCleanCommitment(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		proof []byte,
		sourceChain string,
		destChain string,
		sequence uint64,
	) error
}

ClientState defines the required common functions for light clients.

type ConsensusState

type ConsensusState interface {
	proto.Message

	ClientType() string // Consensus kind

	// GetRoot returns the commitment root of the consensus state,
	// which is used for key-value pair verification.
	GetRoot() Root

	// GetTimestamp returns the timestamp (in nanoseconds) of the consensus state
	GetTimestamp() uint64

	ValidateBasic() error
}

ConsensusState is the state of the consensus process

type GenesisMetadata

type GenesisMetadata interface {
	// return store key that contains metadata without chainName-prefix
	GetKey() []byte
	// returns metadata value
	GetValue() []byte
}

GenesisMetadata is a wrapper interface over clienttypes.GenesisMetadata all clients must use the concrete implementation in types

type Header interface {
	proto.Message

	ClientType() string
	GetHeight() Height
	ValidateBasic() error
}

Header is the consensus state update information

type Height

type Height interface {
	IsZero() bool
	LT(Height) bool
	LTE(Height) bool
	EQ(Height) bool
	GT(Height) bool
	GTE(Height) bool
	GetRevisionNumber() uint64
	GetRevisionHeight() uint64
	Increment() Height
	Decrement() (Height, bool)
	String() string
}

Height is a wrapper interface over clienttypes.Height all clients must use the concrete implementation in types

type PacketI

type PacketI interface {
	GetSequence() uint64
	GetPort() string
	GetSourceChain() string
	GetDestChain() string
	GetRelayChain() string
	GetData() []byte
	ValidateBasic() error
}

PacketI defines the standard interface for TIBC clean packets

type Path

type Path interface {
	String() string
	Empty() bool
}

Path implements spec:CommitmentPath. A path is the additional information provided to the verification function.

type Prefix

type Prefix interface {
	Bytes() []byte
	Empty() bool
}

Prefix implements spec:CommitmentPrefix. Prefix represents the common "prefix" that a set of keys shares.

type Proof

type Proof interface {
	VerifyMembership([]*ics23.ProofSpec, Root, Path, []byte) error
	VerifyNonMembership([]*ics23.ProofSpec, Root, Path) error
	Empty() bool

	ValidateBasic() error
}

Proof implements spec:CommitmentProof. Proof can prove whether the key-value pair is a part of the Root or not. Each proof has designated key-value pair it is able to prove. Proofs includes key but value is provided dynamically at the verification time.

type Root

type Root interface {
	GetHash() []byte
	Empty() bool
}

Root implements spec:CommitmentRoot. A root is constructed from a set of key-value pairs, and the inclusion or non-inclusion of an arbitrary key-value pair can be proven with the proof.

type Status

type Status string

Status represents the status of a client

Jump to

Keyboard shortcuts

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