types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SubModuleName for the localhost (loopback) client
	SubModuleName = "localhost"
)

Variables

View Source
var (
	ErrInvalidLengthLocalhost        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowLocalhost          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupLocalhost = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrConsensusStatesNotStored = sdkerrors.Register(SubModuleName, 2, "localhost does not store consensus states")
)

Localhost sentinel errors

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the ibc interfaces submodule implementations to protobuf Any.

Types

type ClientState

type ClientState struct {
	// self chain ID
	ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"`
	// self latest block height
	Height types.Height `protobuf:"bytes,2,opt,name=height,proto3" json:"height"`
}

ClientState defines a loopback (localhost) client. It requires (read-only) access to keys outside the client prefix.

func NewClientState

func NewClientState(chainID string, height clienttypes.Height) *ClientState

NewClientState creates a new ClientState instance

func (*ClientState) CheckHeaderAndUpdateState

CheckHeaderAndUpdateState updates the localhost client. It only needs access to the context

func (ClientState) CheckMisbehaviourAndUpdateState

func (cs ClientState) CheckMisbehaviourAndUpdateState(
	_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Misbehaviour,
) (exported.ClientState, error)

CheckMisbehaviourAndUpdateState implements ClientState Since localhost is the client of the running chain, misbehaviour cannot be submitted to it Thus, CheckMisbehaviourAndUpdateState returns an error for localhost

func (ClientState) CheckProposedHeaderAndUpdateState

func (cs ClientState) CheckProposedHeaderAndUpdateState(
	ctx sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, _ exported.Header,
) (exported.ClientState, exported.ConsensusState, error)

CheckProposedHeaderAndUpdateState returns an error. The localhost cannot be modified by proposals.

func (ClientState) ClientType

func (cs ClientState) ClientType() string

ClientType is localhost.

func (*ClientState) Descriptor

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

func (ClientState) ExportMetadata

func (cs ClientState) ExportMetadata(_ sdk.KVStore) []exported.GenesisMetadata

ExportMetadata is a no-op for localhost client

func (ClientState) GetChainID

func (cs ClientState) GetChainID() string

GetChainID returns an empty string

func (ClientState) GetFrozenHeight

func (cs ClientState) GetFrozenHeight() exported.Height

GetFrozenHeight returns an uninitialized IBC Height.

func (ClientState) GetLatestHeight

func (cs ClientState) GetLatestHeight() exported.Height

GetLatestHeight returns the latest height stored.

func (ClientState) GetProofSpecs

func (cs ClientState) GetProofSpecs() []*ics23.ProofSpec

GetProofSpecs returns nil since localhost does not have to verify proofs

func (ClientState) Initialize

func (cs ClientState) Initialize(_ sdk.Context, _ codec.BinaryMarshaler, _ sdk.KVStore, consState exported.ConsensusState) error

Initialize ensures that initial consensus state for localhost is nil

func (ClientState) IsFrozen

func (cs ClientState) IsFrozen() bool

IsFrozen returns false.

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) VerifyChannelState

func (cs ClientState) VerifyChannelState(
	store sdk.KVStore,
	cdc codec.BinaryMarshaler,
	_ exported.Height,
	prefix exported.Prefix,
	_ []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 local machine.

func (ClientState) VerifyClientConsensusState

VerifyClientConsensusState returns nil since a local host client does not store consensus states.

func (ClientState) VerifyClientState

func (cs ClientState) VerifyClientState(
	store sdk.KVStore, cdc codec.BinaryMarshaler,
	_ exported.Height, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState,
) error

VerifyClientState verifies that the localhost client state is stored locally

func (ClientState) VerifyConnectionState

func (cs ClientState) VerifyConnectionState(
	store sdk.KVStore,
	cdc codec.BinaryMarshaler,
	_ exported.Height,
	_ exported.Prefix,
	_ []byte,
	connectionID string,
	connectionEnd exported.ConnectionI,
) error

VerifyConnectionState verifies a proof of the connection state of the specified connection end stored locally.

func (ClientState) VerifyNextSequenceRecv

func (cs ClientState) VerifyNextSequenceRecv(
	store sdk.KVStore,
	_ codec.BinaryMarshaler,
	_ exported.Height,
	_ uint64,
	_ uint64,
	_ exported.Prefix,
	_ []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,
	_ codec.BinaryMarshaler,
	_ exported.Height,
	_ uint64,
	_ uint64,
	_ exported.Prefix,
	_ []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,
	_ codec.BinaryMarshaler,
	_ exported.Height,
	_ uint64,
	_ uint64,
	_ exported.Prefix,
	_ []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,
	_ codec.BinaryMarshaler,
	_ exported.Height,
	_ uint64,
	_ uint64,
	_ exported.Prefix,
	_ []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) VerifyUpgradeAndUpdateState

VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded

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 the same client state since there are no custom fields in localhost

Jump to

Keyboard shortcuts

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