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)
Note the client identifier is expected to be: 09-localhost. This is validated by core IBC in the 02-client submodule.
Index ¶
- Constants
- Variables
- type LightClientModule
- func (LightClientModule) CheckForMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage) bool
- func (LightClientModule) Initialize(_ sdk.Context, _ string, _, _ []byte) error
- func (LightClientModule) LatestHeight(ctx sdk.Context, _ string) exported.Height
- func (LightClientModule) RecoverClient(_ sdk.Context, _, _ string) error
- func (LightClientModule) Status(_ sdk.Context, _ string) exported.Status
- func (LightClientModule) TimestampAtHeight(ctx sdk.Context, _ string, _ exported.Height) (uint64, error)
- func (LightClientModule) UpdateState(ctx sdk.Context, _ string, _ exported.ClientMessage) []exported.Height
- func (LightClientModule) UpdateStateOnMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage)
- func (LightClientModule) VerifyClientMessage(_ sdk.Context, _ string, _ exported.ClientMessage) error
- func (l LightClientModule) VerifyMembership(ctx sdk.Context, clientID string, height exported.Height, ...) error
- func (l LightClientModule) VerifyNonMembership(ctx sdk.Context, clientID string, height exported.Height, ...) error
- func (LightClientModule) VerifyUpgradeAndUpdateState(_ sdk.Context, _ string, _, _, _, _ []byte) error
Constants ¶
const (
// ModuleName defines the 09-localhost light client module name
ModuleName = "09-localhost"
)
Variables ¶
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 ¶
Initialize returns an error because it is stateless.
func (LightClientModule) LatestHeight ¶
LatestHeight returns the context height.
func (LightClientModule) RecoverClient ¶
func (LightClientModule) RecoverClient(_ sdk.Context, _, _ string) error
RecoverClient returns an error. The localhost cannot be modified by proposals.
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 ¶
func (LightClientModule) UpdateState(ctx sdk.Context, _ string, _ exported.ClientMessage) []exported.Height
UpdateState performs a no-op and returns the context height in the updated heights return value.
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.
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.
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.
func (LightClientModule) VerifyUpgradeAndUpdateState ¶
func (LightClientModule) VerifyUpgradeAndUpdateState(_ sdk.Context, _ string, _, _, _, _ []byte) error
VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded.