localhost

package
v8.0.0-beta.1.0...-fb51220 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 11 Imported by: 11

Documentation

Overview

Package solomachine implements a concrete LightClientModule, ClientState, ConsensusState, Header and Misbehaviour types for the Localhost light client. This implementation is based off the ICS 09 specification (https://github.com/cosmos/ibc/blob/main/spec/client/ics-009-loopback-cilent)

Index

Constants

View Source
const (
	// ModuleName defines the 09-localhost light client module name
	ModuleName = "09-localhost"
)

Variables

View Source
var SentinelProof = []byte{0x01}

SentinelProof defines the 09-localhost sentinel proof. Submission of nil or empty proofs is disallowed in core IBC messaging. This serves as a placeholder value for relayers to leverage as the proof field in various message types. Localhost client state verification will fail if the sentintel proof value is not provided.

Functions

This section is empty.

Types

type LightClientModule

type LightClientModule struct {
	// contains filtered or unexported fields
}

LightClientModule implements the core IBC api.LightClientModule interface.

func NewLightClientModule

func NewLightClientModule(cdc codec.BinaryCodec, key storetypes.StoreKey) *LightClientModule

NewLightClientModule creates and returns a new 09-localhost LightClientModule.

func (LightClientModule) CheckForMisbehaviour

func (LightClientModule) CheckForMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage) bool

CheckForMisbehaviour is unsupported by the 09-localhost client type and performs a no-op, returning false.

func (LightClientModule) Initialize

func (LightClientModule) Initialize(_ sdk.Context, _ string, _, _ []byte) error

Initialize returns an error because it is stateless.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) LatestHeight

func (LightClientModule) LatestHeight(ctx sdk.Context, _ string) exported.Height

LatestHeight returns the context height.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) RecoverClient

func (LightClientModule) RecoverClient(_ sdk.Context, _, _ string) error

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

func (*LightClientModule) RegisterStoreProvider

func (l *LightClientModule) RegisterStoreProvider(storeProvider exported.ClientStoreProvider)

RegisterStoreProvider is called by core IBC when a LightClientModule is added to the router. It allows the LightClientModule to set a ClientStoreProvider which supplies isolated prefix client stores to IBC light client instances.

func (LightClientModule) Status

Status always returns Active. The 09-localhost status cannot be changed.

func (LightClientModule) TimestampAtHeight

func (LightClientModule) TimestampAtHeight(ctx sdk.Context, _ string, _ exported.Height) (uint64, error)

TimestampAtHeight returns the current block time retrieved from the application context. The localhost client does not store consensus states and thus cannot provide a timestamp for the provided height.

func (LightClientModule) UpdateState

UpdateState performs a no-op and returns the context height in the updated heights return value.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) UpdateStateOnMisbehaviour

func (LightClientModule) UpdateStateOnMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage)

UpdateStateOnMisbehaviour is unsupported by the 09-localhost client type and performs a no-op.

func (LightClientModule) VerifyClientMessage

func (LightClientModule) VerifyClientMessage(_ sdk.Context, _ string, _ exported.ClientMessage) error

VerifyClientMessage is unsupported by the 09-localhost client type and returns an error.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) VerifyMembership

func (l LightClientModule) VerifyMembership(
	ctx sdk.Context,
	clientID string,
	height exported.Height,
	delayTimePeriod uint64,
	delayBlockPeriod uint64,
	proof []byte,
	path exported.Path,
	value []byte,
) error

VerifyMembership is a generic proof verification method which verifies the existence of a given key and value within the IBC store. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). The caller must provide the full IBC store.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) VerifyNonMembership

func (l LightClientModule) VerifyNonMembership(
	ctx sdk.Context,
	clientID string,
	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 within the IBC store. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). The caller must provide the full IBC store.

CONTRACT: clientID is validated in 02-client router, thus clientID is assumed here to be 09-localhost.

func (LightClientModule) VerifyUpgradeAndUpdateState

func (LightClientModule) VerifyUpgradeAndUpdateState(_ sdk.Context, _ string, _, _, _, _ []byte) error

VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded.

Jump to

Keyboard shortcuts

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