types

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

View Source
const (
	Mock string = "mock-client"
)
View Source
const (
	ModuleName = "mock-client"
)

Variables

View Source
var (
	ErrInvalidHeaderHeight     = cosmossdkerrors.Register(ModuleName, 5, "invalid header height")
	ErrInvalidProof            = cosmossdkerrors.Register(ModuleName, 6, "invalid Mock proof")
	ErrProcessedTimeNotFound   = cosmossdkerrors.Register(ModuleName, 8, "processed time not found")
	ErrProcessedHeightNotFound = cosmossdkerrors.Register(ModuleName, 9, "processed height not found")
	ErrDelayPeriodNotPassed    = cosmossdkerrors.Register(ModuleName, 10, "packet-specified delay period has not been reached")
)
View Source
var (
	ErrInvalidLengthMock        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMock          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMock = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the ibc channel submodule interfaces to protobuf Any.

Types

type ClientState

type ClientState struct {
	LatestHeight types.Height `protobuf:"bytes,1,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"`
}

func NewClientState

func NewClientState(latestHeight clienttypes.Height) *ClientState

NewClientState creates a new ClientState instance.

func (ClientState) CheckForMisbehaviour added in v0.3.0

func (cs ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool

CheckForMisbehaviour never detects misbehaviour and always returns false.

func (ClientState) CheckSubstituteAndUpdateState

func (cs ClientState) CheckSubstituteAndUpdateState(
	_ sdk.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, _ exported.ClientState,
) error

CheckSubstituteAndUpdateState always returns an error because Mock client doesn't support substitute.

func (ClientState) ClientType

func (cs ClientState) ClientType() string

ClientType returns a type of the client.

func (*ClientState) Descriptor

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

func (ClientState) ExportMetadata

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

ExportMetadata always panics. This function is used only for testing.

func (ClientState) GetLatestHeight

func (cs ClientState) GetLatestHeight() exported.Height

GetLatestHeight returns the latest height. Return exported.Height to satisfy ClientState interface

func (ClientState) GetTimestampAtHeight added in v0.3.0

func (cs ClientState) GetTimestampAtHeight(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
) (uint64, error)

GetTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height.

func (ClientState) Initialize

func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error

Initialize will check that initial consensus state is equal to the latest consensus state of the initial client.

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

Status returns the status of the mock client. It always returns active.

func (*ClientState) String

func (m *ClientState) String() string

func (*ClientState) Unmarshal

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

func (ClientState) UnpackInterfaces

func (cs ClientState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method

func (ClientState) UpdateState added in v0.3.0

func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height

UpdateState may be used to either create a consensus state for: - a future height greater than the latest client state height - a past height that was skipped during bisection If we are updating to a past height, a consensus state is created for that height to be persisted in client store If we are updating to a future height, the consensus state is created and the client state is updated to reflect the new latest height A list containing the updated consensus height is returned. UpdateState must only be used to update within a single revision, thus header revision number and trusted height's revision number must be the same. To update to a new revision, use a separate upgrade path

func (ClientState) UpdateStateOnMisbehaviour added in v0.3.0

func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, _ exported.ClientMessage)

UpdateStateOnMisbehaviour updates state upon misbehaviour, freezing the ClientState. For Mock, misbehaviour isn't defined and so this function never be called.

func (ClientState) Validate

func (cs ClientState) Validate() error

Validate performs a basic validation of the client state fields.

func (*ClientState) VerifyClientMessage added in v0.3.0

func (cs *ClientState) VerifyClientMessage(
	ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore,
	clientMsg exported.ClientMessage,
) error

VerifyClientMessage checks if the clientMessage is of type Header

func (ClientState) VerifyMembership added in v0.3.0

func (cs ClientState) VerifyMembership(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
	delayTimePeriod uint64,
	delayBlockPeriod uint64,
	proof []byte,
	path exported.Path,
	value []byte,
) error

VerifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24).

func (ClientState) VerifyNonMembership added in v0.3.0

func (cs ClientState) VerifyNonMembership(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
	delayTimePeriod uint64,
	delayBlockPeriod uint64,
	proof []byte,
	path exported.Path,
) error

VerifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24).

func (ClientState) VerifyUpgradeAndUpdateState

func (cs ClientState) VerifyUpgradeAndUpdateState(
	_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore,
	_ exported.ClientState, _ exported.ConsensusState, _, _ []byte,
) error

VerifyUpgradeAndUpdateState returns an error since Mock client does not support upgrades

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 a ClientState that is a copy of the current ClientState with all client customizable fields zeroed out (but Mock ClientState has no such field)

type ConsensusState

type ConsensusState struct {
	Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}

func (ConsensusState) ClientType

func (ConsensusState) ClientType() string

ClientType returns mock-client type.

func (*ConsensusState) Descriptor

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

func (ConsensusState) GetRoot

func (cs ConsensusState) GetRoot() exported.Root

GetRoot returns nil since mock-client do not have roots.

func (ConsensusState) GetTimestamp

func (cs ConsensusState) GetTimestamp() uint64

GetTimestamp returns zero.

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

func (cs ConsensusState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method

func (ConsensusState) ValidateBasic

func (cs ConsensusState) ValidateBasic() error

ValidateBasic defines basic validation for the mock-client consensus state.

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 Header struct {
	Height    types.Height `protobuf:"bytes,1,opt,name=height,proto3" json:"height"`
	Timestamp uint64       `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}

func (Header) ClientType

func (Header) ClientType() string

ClientType return the client identifier of mock-client.

func (*Header) Descriptor

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

func (Header) GetHeight

func (h Header) GetHeight() exported.Height

GetHeight returns the current sequence number as the height. Return clientexported.Height to satisfy interface Revision number is always 0 for a solo-machine

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 ensures that the sequence, signature and public key have all been initialized.

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