Documentation
¶
Overview ¶
Package wasm implements a concrete LightClientModule, ClientState, ConsensusState, ClientMessage and types for the proxy light client module communicating with underlying Wasm light clients. This implementation is based off the ICS 08 specification (https://github.com/cosmos/ibc/blob/main/spec/client/ics-008-wasm-client)
By default the 08-wasm module requires cgo and libwasmvm dependencies available on the system. However, users of this module may want to depend only on types, without incurring the dependency on cgo or libwasmvm. In this case, it is possible to build the code with either cgo disabled or a custom build directive: nolink_libwasmvm. This allows disabling linking of libwasmvm and not forcing users to have specific libraries available on their systems.
Please refer to the 08-wasm module documentation for more information.
Note that client identifiers are expected to be in the form: 08-wasm-{N}. Client identifiers are generated and validated by core IBC, unexpected client identifiers will result in errors.
Index ¶
- type AppModule
- func (AppModule) ConsensusVersion() uint64
- func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage)
- func (AppModule) IsAppModule()
- func (AppModule) IsOnePerModuleType()
- func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg
- func (am AppModule) RegisterServices(cfg module.Configurator)
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
- func (AppModuleBasic) GetQueryCmd() *cobra.Command
- func (AppModuleBasic) GetTxCmd() *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
- func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino)
- func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error
- type LightClientModule
- func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool
- func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error
- func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) exported.Height
- func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error
- func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Status
- func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error)
- func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height
- func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage)
- func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg 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 (l LightClientModule) VerifyUpgradeAndUpdateState(ctx sdk.Context, clientID string, newClient []byte, newConsState []byte, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppModule ¶
type AppModule struct {
AppModuleBasic
// contains filtered or unexported fields
}
AppModule represents the AppModule for this module
func NewAppModule ¶
NewAppModule creates a new 08-wasm module
func (AppModule) ConsensusVersion ¶
ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ExportGenesis ¶
func (AppModule) InitGenesis ¶
func (AppModule) IsAppModule ¶
func (AppModule) IsAppModule()
IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsOnePerModuleType ¶
func (AppModule) IsOnePerModuleType()
IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (AppModule) ProposalMsgs ¶
func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg
ProposalMsgs returns msgs used for governance proposals for simulations.
func (AppModule) RegisterServices ¶
func (am AppModule) RegisterServices(cfg module.Configurator)
RegisterServices registers module services.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the basic application module used by the Wasm light client. Only the RegisterInterfaces function needs to be implemented. All other function perform a no-op.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage
DefaultGenesis returns an empty state, i.e. no contracts
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd() *cobra.Command
GetQueryCmd implements AppModuleBasic interface
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd() *cobra.Command
GetTxCmd implements AppModuleBasic interface
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name returns the tendermint module name.
func (AppModuleBasic) RegisterGRPCGatewayRoutes ¶
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for Wasm client module.
func (AppModuleBasic) RegisterInterfaces ¶
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC to unmarshal Wasm light client types.
func (AppModuleBasic) RegisterLegacyAminoCodec ¶
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino)
RegisterLegacyAminoCodec performs a no-op. The Wasm client does not support amino.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error
ValidateGenesis performs a no-op.
type LightClientModule ¶
type LightClientModule struct {
// contains filtered or unexported fields
}
LightClientModule implements the core IBC api.LightClientModule interface.
func NewLightClientModule ¶
func NewLightClientModule(keeper wasmkeeper.Keeper, storeProvider clienttypes.StoreProvider) LightClientModule
NewLightClientModule creates and returns a new 08-wasm LightClientModule.
func (LightClientModule) CheckForMisbehaviour ¶
func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool
CheckForMisbehaviour obtains the client state associated with the client identifier, it detects misbehaviour in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage.
func (LightClientModule) Initialize ¶
func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error
Initialize unmarshals the provided client and consensus states and performs basic validation. It sets the client state and consensus state in the client store. It also initializes the wasm contract for the client.
func (LightClientModule) LatestHeight ¶
LatestHeight returns the latest height for the client state for the given client identifier. If no client is present for the provided client identifier a zero value height is returned.
func (LightClientModule) RecoverClient ¶
func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error
RecoverClient asserts that the substitute client is a wasm client. It obtains the client state associated with the subject client and calls into the appropriate contract endpoint. It will verify that a substitute client state is valid and update the subject client state. Note that this method is used only for recovery and will not allow changes to the checksum.
func (LightClientModule) Status ¶
Status obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. It returns the status of the wasm client. The client may be: - Active: frozen height is zero and client is not expired - Frozen: frozen height is not zero - Expired: the latest consensus state timestamp + trusting period <= current time - Unauthorized: the client type is not registered as an allowed client type
A frozen client will become expired, so the Frozen status has higher precedence.
func (LightClientModule) TimestampAtHeight ¶
func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error)
TimestampAtHeight obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. It returns the timestamp in nanoseconds of the consensus state at the given height.
func (LightClientModule) UpdateState ¶
func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height
UpdateState obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. Client state and new consensus states are updated in the store by the contract.
func (LightClientModule) UpdateStateOnMisbehaviour ¶
func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage)
UpdateStateOnMisbehaviour obtains the client state associated with the client identifier performs appropriate state changes on a client state given that misbehaviour has been detected and verified. Client state is updated in the store by the contract.
func (LightClientModule) VerifyClientMessage ¶
func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error
VerifyClientMessage obtains the client state associated with the client identifier, it then must verify the ClientMessage. A ClientMessage could be a Header, Misbehaviour, or batch update. It must handle each type of ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState, and UpdateStateOnMisbehaviour will assume that the content of the ClientMessage has been verified and can be trusted. An error should be returned if the ClientMessage fails to verify.
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 obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. 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). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.
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 obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. 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). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.
func (LightClientModule) VerifyUpgradeAndUpdateState ¶
func (l LightClientModule) VerifyUpgradeAndUpdateState( ctx sdk.Context, clientID string, newClient []byte, newConsState []byte, upgradeClientProof, upgradeConsensusStateProof []byte, ) error
VerifyUpgradeAndUpdateState obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. The new client and consensus states will be unmarshaled and an error is returned if the new client state is not at a height greater than the existing client. On a successful verification, it expects the contract to update the new client state, consensus state, and any other client metadata.
Directories
¶
| Path | Synopsis |
|---|---|
|
client
|
|
|
internal
|
|
|
simapp/params
Package params defines the simulation parameters in the simapp.
|
Package params defines the simulation parameters in the simapp. |
|
simapp/simd
command
|
|
|
Package types is a reverse proxy.
|
Package types is a reverse proxy. |