exported

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 4 Imported by: 174

Documentation

Index

Constants

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

	// Solomachine is used to indicate that the light client is a solo machine.
	Solomachine string = "06-solomachine"

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

	// Localhost is the client type for a localhost client. It is also used as the clientID
	// for the localhost client.
	Localhost string = "09-localhost"

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

	// Frozen is a status type of a client. A frozen client is not allowed to be used.
	Frozen Status = "Frozen"

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

type Acknowledgement interface {
	Success() bool
	Acknowledgement() []byte
}

Acknowledgement defines the interface used to return acknowledgements in the OnRecvPacket callback.

type ChannelI

type ChannelI interface {
	GetState() int32
	GetOrdering() int32
	GetCounterparty() CounterpartyChannelI
	GetConnectionHops() []string
	GetVersion() string
	ValidateBasic() error
}

ChannelI defines the standard interface for a channel end.

type ClientState

type ClientState interface {
	proto.Message

	ClientType() string
	GetLatestHeight() Height
	Validate() error

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

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

	CheckHeaderAndUpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, Header) (ClientState, ConsensusState, error)
	CheckMisbehaviourAndUpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, Misbehaviour) (ClientState, error)
	CheckSubstituteAndUpdateState(ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, substituteClientStore sdk.KVStore, substituteClient ClientState) (ClientState, error)

	// Upgrade functions
	// NOTE: proof heights are not included as upgrade to a new revision is expected to pass only on the last
	// height committed by the current revision. Clients are responsible for ensuring that the planned last
	// height of the current revision is somehow encoded in the proof verification process.
	// This is to ensure that no premature upgrades occur, since upgrade plans committed to by the counterparty
	// may be cancelled or modified before the last planned height.
	VerifyUpgradeAndUpdateState(
		ctx sdk.Context,
		cdc codec.BinaryCodec,
		store sdk.KVStore,
		newClient ClientState,
		newConsState ConsensusState,
		proofUpgradeClient,
		proofUpgradeConsState []byte,
	) (ClientState, ConsensusState, error)
	// Utility function that zeroes out any client customizable fields in client state
	// Ledger enforced fields are maintained while all custom fields are zero values
	// Used to verify upgrades
	ZeroCustomFields() ClientState

	VerifyClientState(
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		prefix Prefix,
		counterpartyClientIdentifier string,
		proof []byte,
		clientState ClientState,
	) error
	VerifyClientConsensusState(
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		counterpartyClientIdentifier string,
		consensusHeight Height,
		prefix Prefix,
		proof []byte,
		consensusState ConsensusState,
	) error
	VerifyConnectionState(
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		prefix Prefix,
		proof []byte,
		connectionID string,
		connectionEnd ConnectionI,
	) error
	VerifyChannelState(
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		prefix Prefix,
		proof []byte,
		portID,
		channelID string,
		channel ChannelI,
	) error
	VerifyPacketCommitment(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		delayTimePeriod uint64,
		delayBlockPeriod uint64,
		prefix Prefix,
		proof []byte,
		portID,
		channelID string,
		sequence uint64,
		commitmentBytes []byte,
	) error
	VerifyPacketAcknowledgement(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		delayTimePeriod uint64,
		delayBlockPeriod uint64,
		prefix Prefix,
		proof []byte,
		portID,
		channelID string,
		sequence uint64,
		acknowledgement []byte,
	) error
	VerifyPacketReceiptAbsence(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		delayTimePeriod uint64,
		delayBlockPeriod uint64,
		prefix Prefix,
		proof []byte,
		portID,
		channelID string,
		sequence uint64,
	) error
	VerifyNextSequenceRecv(
		ctx sdk.Context,
		store sdk.KVStore,
		cdc codec.BinaryCodec,
		height Height,
		delayTimePeriod uint64,
		delayBlockPeriod uint64,
		prefix Prefix,
		proof []byte,
		portID,
		channelID string,
		nextSequenceRecv uint64,
	) error
}

ClientState defines the required common functions for light clients.

type ConnectionI

type ConnectionI interface {
	GetClientID() string
	GetState() int32
	GetCounterparty() CounterpartyConnectionI
	GetVersions() []Version
	GetDelayPeriod() uint64
	ValidateBasic() error
}

ConnectionI describes the required methods for a connection.

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 CounterpartyChannelI

type CounterpartyChannelI interface {
	GetPortID() string
	GetChannelID() string
	ValidateBasic() error
}

CounterpartyChannelI defines the standard interface for a channel end's counterparty.

type CounterpartyConnectionI

type CounterpartyConnectionI interface {
	GetClientID() string
	GetConnectionID() string
	GetPrefix() Prefix
	ValidateBasic() error
}

CounterpartyConnectionI describes the required methods for a counterparty connection.

type GenesisMetadata

type GenesisMetadata interface {
	// return store key that contains metadata without clientID-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 Misbehaviour

type Misbehaviour interface {
	proto.Message

	ClientType() string
	GetClientID() string
	ValidateBasic() error
}

Misbehaviour defines counterparty misbehaviour for a specific consensus type

type PacketI

type PacketI interface {
	GetSequence() uint64
	GetTimeoutHeight() Height
	GetTimeoutTimestamp() uint64
	GetSourcePort() string
	GetSourceChannel() string
	GetDestPort() string
	GetDestChannel() string
	GetData() []byte
	ValidateBasic() error
}

PacketI defines the standard interface for IBC 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

func (Status) String

func (s Status) String() string

String returns the string representation of a client status.

type Version

type Version interface {
	GetIdentifier() string
	GetFeatures() []string
	VerifyProposedVersion(Version) error
}

Version defines an IBC version used in connection handshake negotiation.

Jump to

Keyboard shortcuts

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