exported

package
v0.1.0 Latest Latest
Warning

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

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

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 = "tendermint"

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

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

	// TSS is the client type for a TSS client.
	TSS string = "tss"

	// 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 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

	CheckMsg(sdk.Msg) error

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

	// Upgrade and Misbehaviour functions
	UpgradeState(sdk.Context, codec.BinaryCodec, sdk.KVStore, 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
}

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

	// 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
	GetSourceChain() string
	GetDestChain() string
	GetRelayChain() string
	GetDataList() [][]byte
	GetPorts() []string
	ValidateBasic() error
}

PacketI defines the standard interface for XIBC 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, []byte, Path, []byte) error
	VerifyNonMembership([]*ics23.ProofSpec, []byte, 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 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