types

package
v0.1.1-ibc-go-v7.3-was... Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 51 Imported by: 18

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ContractMemoryLimit is the memory limit of each contract execution (in MiB)
	// constant value so all nodes run with the same limit.
	ContractMemoryLimit = 32
	// MemoryCacheSize is the size of the wasm vm cache (in MiB), it is set to 0 to reduce unnecessary memory usage.
	// See: https://github.com/CosmWasm/cosmwasm/pull/1925
	MemoryCacheSize = 0
)
View Source
const (
	// EventTypeStoreWasmCode defines the event type for bytecode storage
	EventTypeStoreWasmCode = "store_wasm_code"
	// EventTypeMigrateContract defines the event type for a contract migration
	EventTypeMigrateContract = "migrate_contract"

	// AttributeKeyWasmChecksum denotes the checksum of the wasm code that was stored or migrated
	AttributeKeyWasmChecksum = "wasm_checksum"
	// AttributeKeyClientID denotes the client identifier of the wasm client
	AttributeKeyClientID = "client_id"
	// AttributeKeyNewChecksum denotes the checksum of the new wasm code.
	AttributeKeyNewChecksum = "new_checksum"

	AttributeValueCategory = ModuleName
)

IBC 08-wasm events

View Source
const (
	// DefaultGasMultiplier is how many CosmWasm gas points = 1 Cosmos SDK gas point.
	//
	// CosmWasm gas strategy is documented in https://github.com/CosmWasm/cosmwasm/blob/v1.0.0-beta/docs/GAS.md.
	// Cosmos SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/v0.42.10/store/types/gas.go#L198-L209.
	//
	// The original multiplier of 100 up to CosmWasm 0.16 was based on
	//     "A write at ~3000 gas and ~200us = 10 gas per us (microsecond) cpu/io
	//     Rough timing have 88k gas at 90us, which is equal to 1k sdk gas... (one read)"
	// as well as manual Wasmer benchmarks from 2019. This was then multiplied by 150_000
	// in the 0.16 -> 1.0 upgrade (https://github.com/CosmWasm/cosmwasm/pull/1120).
	//
	// The multiplier deserves more reproducible benchmarking and a strategy that allows easy adjustments.
	// This is tracked in https://github.com/CosmWasm/wasmd/issues/566 and https://github.com/CosmWasm/wasmd/issues/631.
	// Gas adjustments are consensus breaking but may happen in any release marked as consensus breaking.
	// Do not make assumptions on how much gas an operation will consume in places that are hard to adjust,
	// such as hardcoding them in contracts.
	//
	// Please note that all gas prices returned to wasmvm should have this multiplied.
	// Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938055852
	DefaultGasMultiplier uint64 = 140_000_000
	// DefaultInstanceCost is how much SDK gas we charge each time we load a WASM instance.
	// Creating a new instance is costly, and this helps put a recursion limit to contracts calling contracts.
	// Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938056803
	DefaultInstanceCost uint64 = 60_000
	// DefaultCompileCost is how much SDK gas is charged *per byte* for compiling WASM code.
	// Benchmarks and numbers were discussed in: https://github.com/CosmWasm/wasmd/pull/634#issuecomment-938056803
	DefaultCompileCost uint64 = 3
	// DefaultEventAttributeDataCost is how much SDK gas is charged *per byte* for attribute data in events.
	// This is used with len(key) + len(value)
	DefaultEventAttributeDataCost uint64 = 1
	// DefaultContractMessageDataCost is how much SDK gas is charged *per byte* of the message that goes to the contract
	// This is used with len(msg). Note that the message is deserialized in the receiving contract and this is charged
	// with wasm gas already. The derserialization of results is also charged in wasmvm. I am unsure if we need to add
	// additional costs here.
	// Note: also used for error fields on reply, and data on reply. Maybe these should be pulled out to a different (non-zero) field
	DefaultContractMessageDataCost uint64 = 0
	// DefaultPerAttributeCost is how much SDK gas we charge per attribute count.
	DefaultPerAttributeCost uint64 = 10
	// DefaultPerCustomEventCost is how much SDK gas we charge per event count.
	DefaultPerCustomEventCost uint64 = 20
	// DefaultEventAttributeDataFreeTier number of bytes of total attribute data we do not charge.
	DefaultEventAttributeDataFreeTier = 100
)
View Source
const (
	// ModuleName for the wasm client
	ModuleName = "08-wasm"

	// StoreKey is the store key string for 08-wasm
	StoreKey = ModuleName

	// Wasm is the client type for IBC light clients created using 08-wasm
	Wasm = ModuleName

	// KeyChecksums is the key under which all checksums are stored
	KeyChecksums = "checksums"
)
View Source
const (
	// DefaultDeserializationCostPerByte The formula should be `len(data) * deserializationCostPerByte`
	DefaultDeserializationCostPerByte = 1
)

While gas_register.go is a direct copy of https://github.com/CosmWasm/wasmd/blob/main/x/wasm/types/gas_register.go This file contains additional constructs that can be maintained separately. Most of these functions are slight modifications of keeper function from wasmd, which act on `WasmGasRegister` instead of `Keeper`.

Variables

View Source
var (
	ErrInvalid              = errorsmod.Register(ModuleName, 2, "invalid")
	ErrInvalidData          = errorsmod.Register(ModuleName, 3, "invalid data")
	ErrInvalidChecksum      = errorsmod.Register(ModuleName, 4, "invalid checksum")
	ErrInvalidClientMessage = errorsmod.Register(ModuleName, 5, "invalid client message")
	ErrRetrieveClientID     = errorsmod.Register(ModuleName, 6, "failed to retrieve client id")
	// Wasm specific
	ErrWasmEmptyCode                   = errorsmod.Register(ModuleName, 7, "empty wasm code")
	ErrWasmCodeTooLarge                = errorsmod.Register(ModuleName, 8, "wasm code too large")
	ErrWasmCodeExists                  = errorsmod.Register(ModuleName, 9, "wasm code already exists")
	ErrWasmChecksumNotFound            = errorsmod.Register(ModuleName, 10, "wasm checksum not found")
	ErrWasmSubMessagesNotAllowed       = errorsmod.Register(ModuleName, 11, "execution of sub messages is not allowed")
	ErrWasmEventsNotAllowed            = errorsmod.Register(ModuleName, 12, "returning events from a contract is not allowed")
	ErrWasmAttributesNotAllowed        = errorsmod.Register(ModuleName, 13, "returning attributes from a contract is not allowed")
	ErrWasmContractCallFailed          = errorsmod.Register(ModuleName, 14, "wasm contract call failed")
	ErrWasmInvalidResponseData         = errorsmod.Register(ModuleName, 15, "wasm contract returned invalid response data")
	ErrWasmInvalidContractModification = errorsmod.Register(ModuleName, 16, "wasm contract made invalid state modifications")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthWasm        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWasm          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWasm = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	VMGasRegister = NewDefaultWasmGasRegister()
)

Functions

func AcceptListStargateQuerier

func AcceptListStargateQuerier(acceptedQueries []string) func(sdk.Context, *wasmvmtypes.StargateQuery) ([]byte, error)

AcceptListStargateQuerier allows all queries that are in the provided accept list. This function returns protobuf encoded responses in bytes.

func AddChecksum

func AddChecksum(ctx sdk.Context, cdc codec.BinaryCodec, storeKey storetypes.StoreKey, checksum Checksum) error

AddChecksum adds a checksum to the list of stored checksums in state.

func DefaultPerByteUncompressCost

func DefaultPerByteUncompressCost() wasmvmtypes.UFraction

DefaultPerByteUncompressCost is how much SDK gas we charge per source byte to unpack

func GzipIt

func GzipIt(input []byte) ([]byte, error)

GzipIt compresses the input ([]byte)

func HasChecksum

func HasChecksum(ctx sdk.Context, cdc codec.BinaryCodec, checksum Checksum) bool

HasChecksum returns true if the given checksum exists in the store and false otherwise.

func IsGzip

func IsGzip(input []byte) bool

IsGzip returns checks if the file contents are gzip compressed

func Logger

func Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func MaxWasmByteSize

func MaxWasmByteSize() uint64

MaxWasmByteSize returns the maximum allowed number of bytes for wasm bytecode

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the Wasm concrete client-related implementations and interfaces.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func RejectCustomQuerier

func RejectCustomQuerier() func(sdk.Context, json.RawMessage) ([]byte, error)

RejectCustomQuerier rejects all custom queries

func RemoveChecksum

func RemoveChecksum(ctx sdk.Context, cdc codec.BinaryCodec, storeKey storetypes.StoreKey, checksum Checksum) error

RemoveChecksum removes the given checksum from the list of stored checksums in state.

func Uncompress

func Uncompress(gzipSrc []byte, limit uint64) ([]byte, error)

Uncompress expects a valid gzip source to unpack or fails. See IsGzip

func ValidateClientID

func ValidateClientID(clientID string) error

ValidateClientID validates the client identifier by ensuring that it conforms to the 02-client identifier format and that it is a 08-wasm clientID.

func ValidateWasmChecksum

func ValidateWasmChecksum(checksum Checksum) error

ValidateWasmChecksum validates that the checksum is of the correct length

func ValidateWasmCode

func ValidateWasmCode(code []byte) error

ValidateWasmCode valides that the size of the wasm code is in the allowed range and that the contents are of a wasm binary.

Types

type CheckForMisbehaviourMsg

type CheckForMisbehaviourMsg struct {
	ClientMessage []byte `json:"client_message"`
}

CheckForMisbehaviourMsg is a queryMsg sent to the contract to check for misbehaviour.

type CheckForMisbehaviourResult

type CheckForMisbehaviourResult struct {
	FoundMisbehaviour bool `json:"found_misbehaviour"`
}

CheckForMisbehaviourResult is the expected return type of the checkForMisbehaviourMsg query. It returns a boolean indicating if misbehaviour was detected.

type Checksum

type Checksum = wasmvmtypes.Checksum

Checksum is a type alias used for wasm byte code checksums.

func CreateChecksum

func CreateChecksum(code []byte) (Checksum, error)

CreateChecksum creates a sha256 checksum from the given wasm code, it forwards the call to the wasmvm package. The code is checked for the following conditions: - code length is zero. - code length is less than 4 bytes (magic number length). - code does not start with the wasm magic number.

func GetAllChecksums

func GetAllChecksums(ctx sdk.Context, cdc codec.BinaryCodec) ([]Checksum, error)

GetAllChecksums is a helper to get all checksums from the store. It returns an empty slice if no checksums are found

type Checksums

type Checksums struct {
	Checksums [][]byte `protobuf:"bytes,1,rep,name=checksums,proto3" json:"checksums,omitempty"`
}

Checksums defines a list of all checksums that are stored

func (*Checksums) Descriptor

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

func (*Checksums) GetChecksums

func (m *Checksums) GetChecksums() [][]byte

func (*Checksums) Marshal

func (m *Checksums) Marshal() (dAtA []byte, err error)

func (*Checksums) MarshalTo

func (m *Checksums) MarshalTo(dAtA []byte) (int, error)

func (*Checksums) MarshalToSizedBuffer

func (m *Checksums) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Checksums) ProtoMessage

func (*Checksums) ProtoMessage()

func (*Checksums) Reset

func (m *Checksums) Reset()

func (*Checksums) Size

func (m *Checksums) Size() (n int)

func (*Checksums) String

func (m *Checksums) String() string

func (*Checksums) Unmarshal

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

func (*Checksums) XXX_DiscardUnknown

func (m *Checksums) XXX_DiscardUnknown()

func (*Checksums) XXX_Marshal

func (m *Checksums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Checksums) XXX_Merge

func (m *Checksums) XXX_Merge(src proto.Message)

func (*Checksums) XXX_Size

func (m *Checksums) XXX_Size() int

func (*Checksums) XXX_Unmarshal

func (m *Checksums) XXX_Unmarshal(b []byte) error

type ClientKeeper

type ClientKeeper interface {
	ClientStore(ctx sdk.Context, clientID string) sdk.KVStore
	GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)
	SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState)
}

ClientKeeper defines the expected client keeper

type ClientMessage

type ClientMessage struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}

Wasm light client message (either header(s) or misbehaviour)

func (ClientMessage) ClientType

func (ClientMessage) ClientType() string

ClientType is a Wasm light client.

func (*ClientMessage) Descriptor

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

func (*ClientMessage) Marshal

func (m *ClientMessage) Marshal() (dAtA []byte, err error)

func (*ClientMessage) MarshalTo

func (m *ClientMessage) MarshalTo(dAtA []byte) (int, error)

func (*ClientMessage) MarshalToSizedBuffer

func (m *ClientMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClientMessage) ProtoMessage

func (*ClientMessage) ProtoMessage()

func (*ClientMessage) Reset

func (m *ClientMessage) Reset()

func (*ClientMessage) Size

func (m *ClientMessage) Size() (n int)

func (*ClientMessage) String

func (m *ClientMessage) String() string

func (*ClientMessage) Unmarshal

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

func (ClientMessage) ValidateBasic

func (c ClientMessage) ValidateBasic() error

ValidateBasic defines a basic validation for the wasm client message.

func (*ClientMessage) XXX_DiscardUnknown

func (m *ClientMessage) XXX_DiscardUnknown()

func (*ClientMessage) XXX_Marshal

func (m *ClientMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClientMessage) XXX_Merge

func (m *ClientMessage) XXX_Merge(src proto.Message)

func (*ClientMessage) XXX_Size

func (m *ClientMessage) XXX_Size() int

func (*ClientMessage) XXX_Unmarshal

func (m *ClientMessage) XXX_Unmarshal(b []byte) error

type ClientState

type ClientState struct {
	// bytes encoding the client state of the underlying light client
	// implemented as a Wasm contract.
	Data         []byte       `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Checksum     []byte       `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"`
	LatestHeight types.Height `protobuf:"bytes,3,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"`
}

Wasm light client's Client state

func NewClientState

func NewClientState(data []byte, checksum []byte, height clienttypes.Height) *ClientState

NewClientState creates a new ClientState instance.

func (ClientState) CheckForMisbehaviour

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

CheckForMisbehaviour detects misbehaviour in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage

func (ClientState) CheckSubstituteAndUpdateState

func (cs ClientState) CheckSubstituteAndUpdateState(ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, substituteClientStore sdk.KVStore, substituteClient exported.ClientState) error

CheckSubstituteAndUpdateState 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 (ClientState) ClientType

func (ClientState) ClientType() string

ClientType is Wasm light client.

func (*ClientState) Descriptor

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

func (ClientState) ExportMetadata

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

ExportMetadata exports all the consensus metadata in the client store so they can be included in clients genesis and imported by a ClientKeeper

func (ClientState) GetLatestHeight

func (cs ClientState) GetLatestHeight() exported.Height

GetLatestHeight returns latest block height.

func (ClientState) GetTimestampAtHeight

func (cs ClientState) GetTimestampAtHeight(
	ctx sdk.Context,
	clientStore sdk.KVStore,
	_ 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 sdk.KVStore, state exported.ConsensusState) error

Initialize checks that the initial consensus state is an 08-wasm consensus state and sets the client state, consensus state in the provided client store. It also initializes the wasm contract for the 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) MigrateContract

func (cs ClientState) MigrateContract(
	ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore,
	clientID string, newChecksum, migrateMsg []byte,
) error

MigrateContract calls the migrate entry point on the contract with the given migrateMsg. The contract must exist and the checksum must be found in the store. If the checksum is the same as the current checksum, an error is returned. This does not update the checksum in the client state.

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

func (cs ClientState) Status(ctx sdk.Context, clientStore sdk.KVStore, cdc codec.BinaryCodec) exported.Status

Status 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 (*ClientState) String

func (m *ClientState) String() string

func (*ClientState) Unmarshal

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

func (ClientState) UpdateState

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

Client state and new consensus states are updated in the store by the contract

func (ClientState) UpdateStateOnMisbehaviour

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

UpdateStateOnMisbehaviour should perform appropriate state changes on a client state given that misbehaviour has been detected and verified Client state is updated in the store by contract.

func (ClientState) Validate

func (cs ClientState) Validate() error

Validate performs a basic validation of the client state fields.

func (ClientState) VerifyClientMessage

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

VerifyClientMessage must verify a 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 (ClientState) VerifyMembership

func (cs ClientState) VerifyMembership(
	ctx sdk.Context,
	clientStore sdk.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). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.

func (ClientState) VerifyNonMembership

func (cs ClientState) VerifyNonMembership(
	ctx sdk.Context,
	clientStore sdk.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). If a zero proof height is passed in, it will fail to retrieve the associated consensus state.

func (ClientState) VerifyUpgradeAndUpdateState

func (cs ClientState) VerifyUpgradeAndUpdateState(
	ctx sdk.Context,
	cdc codec.BinaryCodec,
	clientStore sdk.KVStore,
	upgradedClient exported.ClientState,
	upgradedConsState exported.ConsensusState,
	proofUpgradeClient,
	proofUpgradeConsState []byte,
) error

VerifyUpgradeAndUpdateState, on a successful verification expects the contract to update the new client state, consensus state, and any other client metadata.

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

type ConsensusState

type ConsensusState struct {
	// bytes encoding the consensus state of the underlying light client
	// implemented as a Wasm contract.
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}

Wasm light client's ConsensusState

func NewConsensusState

func NewConsensusState(data []byte) *ConsensusState

NewConsensusState creates a new ConsensusState instance.

func (ConsensusState) ClientType

func (ConsensusState) ClientType() string

ClientType returns Wasm type.

func (*ConsensusState) Descriptor

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

func (ConsensusState) GetTimestamp

func (ConsensusState) GetTimestamp() uint64

GetTimestamp returns block time in nanoseconds of the header that created consensus state.

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

func (cs ConsensusState) ValidateBasic() error

ValidateBasic defines a basic validation for the wasm 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 Contract

type Contract struct {
	// contract byte code
	CodeBytes []byte `protobuf:"bytes,1,opt,name=code_bytes,json=codeBytes,proto3" json:"code_bytes,omitempty"`
}

Contract stores contract code

func (*Contract) Descriptor

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

func (*Contract) Marshal

func (m *Contract) Marshal() (dAtA []byte, err error)

func (*Contract) MarshalTo

func (m *Contract) MarshalTo(dAtA []byte) (int, error)

func (*Contract) MarshalToSizedBuffer

func (m *Contract) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Contract) ProtoMessage

func (*Contract) ProtoMessage()

func (*Contract) Reset

func (m *Contract) Reset()

func (*Contract) Size

func (m *Contract) Size() (n int)

func (*Contract) String

func (m *Contract) String() string

func (*Contract) Unmarshal

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

func (*Contract) XXX_DiscardUnknown

func (m *Contract) XXX_DiscardUnknown()

func (*Contract) XXX_Marshal

func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Contract) XXX_Merge

func (m *Contract) XXX_Merge(src proto.Message)

func (*Contract) XXX_Size

func (m *Contract) XXX_Size() int

func (*Contract) XXX_Unmarshal

func (m *Contract) XXX_Unmarshal(b []byte) error

type ContractResult

ContractResult is a type constraint that defines the expected results that can be returned by a contract call/query.

type CustomQuerier

type CustomQuerier func(ctx sdk.Context, request json.RawMessage) ([]byte, error)

type EmptyResult

type EmptyResult struct{}

EmptyResult is the default return type of any contract call that does not require a custom return type.

type ExportMetadataMsg

type ExportMetadataMsg struct{}

ExportMetadataMsg is a queryMsg sent to the contract to query the exported metadata of the wasm client.

type ExportMetadataResult

type ExportMetadataResult struct {
	GenesisMetadata []clienttypes.GenesisMetadata `json:"genesis_metadata"`
}

ExportMetadataResult is the expected return type of the exportMetadataMsg query. It returns the exported metadata of the wasm client.

type GasRegister

type GasRegister interface {
	// NewContractInstanceCosts costs to create a new contract instance from code
	NewContractInstanceCosts(pinned bool, msgLen int) storetypes.Gas
	// CompileCosts costs to persist and "compile" a new wasm contract
	CompileCosts(byteLength int) storetypes.Gas
	// UncompressCosts costs to unpack a new wasm contract
	UncompressCosts(byteLength int) storetypes.Gas
	// InstantiateContractCosts costs when interacting with a wasm contract
	InstantiateContractCosts(pinned bool, msgLen int) storetypes.Gas
	// ReplyCosts costs to to handle a message reply
	ReplyCosts(pinned bool, reply wasmvmtypes.Reply) storetypes.Gas
	// EventCosts costs to persist an event
	EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) storetypes.Gas
	// ToWasmVMGas converts from Cosmos SDK gas units to [CosmWasm gas] (aka. wasmvm gas)
	//
	// [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md
	ToWasmVMGas(source storetypes.Gas) uint64
	// FromWasmVMGas converts from [CosmWasm gas] (aka. wasmvm gas) to Cosmos SDK gas units
	//
	// [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md
	FromWasmVMGas(source uint64) storetypes.Gas
}

GasRegister abstract source for gas costs

type GenesisState

type GenesisState struct {
	// uploaded light client wasm contracts
	Contracts []Contract `protobuf:"bytes,1,rep,name=contracts,proto3" json:"contracts"`
}

GenesisState defines 08-wasm's keeper genesis state

func NewGenesisState

func NewGenesisState(contracts []Contract) *GenesisState

NewGenesisState creates an 08-wasm GenesisState instance.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetContracts

func (m *GenesisState) GetContracts() []Contract

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type InstantiateMessage

type InstantiateMessage struct {
	ClientState    []byte `json:"client_state"`
	ConsensusState []byte `json:"consensus_state"`
	Checksum       []byte `json:"checksum"`
}

InstantiateMessage is the message that is sent to the contract's instantiate entry point.

type MigrateClientStoreMsg

type MigrateClientStoreMsg struct{}

MigrateClientStore is a sudoMsg sent to the contract to verify a given substitute client and update to its state.

type MsgClient

type MsgClient interface {
	// StoreCode defines a rpc handler method for MsgStoreCode.
	StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error)
	// RemoveChecksum defines a rpc handler method for MsgRemoveChecksum.
	RemoveChecksum(ctx context.Context, in *MsgRemoveChecksum, opts ...grpc.CallOption) (*MsgRemoveChecksumResponse, error)
	// MigrateContract defines a rpc handler method for MsgMigrateContract.
	MigrateContract(ctx context.Context, in *MsgMigrateContract, opts ...grpc.CallOption) (*MsgMigrateContractResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgMigrateContract

type MsgMigrateContract struct {
	// signer address
	Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
	// the client id of the contract
	ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
	// checksum is the sha256 hash of the new wasm byte code for the contract
	Checksum []byte `protobuf:"bytes,3,opt,name=checksum,proto3" json:"checksum,omitempty"`
	// the json encoded message to be passed to the contract on migration
	Msg []byte `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"`
}

MsgMigrateContract defines the request type for the MigrateContract rpc.

func NewMsgMigrateContract

func NewMsgMigrateContract(signer, clientID string, checksum, migrateMsg []byte) *MsgMigrateContract

MsgMigrateContract creates a new MsgMigrateContract instance

func (*MsgMigrateContract) Descriptor

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

func (*MsgMigrateContract) GetChecksum

func (m *MsgMigrateContract) GetChecksum() []byte

func (*MsgMigrateContract) GetClientId

func (m *MsgMigrateContract) GetClientId() string

func (*MsgMigrateContract) GetMsg

func (m *MsgMigrateContract) GetMsg() []byte

func (*MsgMigrateContract) GetSigner

func (m *MsgMigrateContract) GetSigner() string

func (MsgMigrateContract) GetSigners

func (m MsgMigrateContract) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (*MsgMigrateContract) Marshal

func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error)

func (*MsgMigrateContract) MarshalTo

func (m *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error)

func (*MsgMigrateContract) MarshalToSizedBuffer

func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgMigrateContract) ProtoMessage

func (*MsgMigrateContract) ProtoMessage()

func (*MsgMigrateContract) Reset

func (m *MsgMigrateContract) Reset()

func (*MsgMigrateContract) Size

func (m *MsgMigrateContract) Size() (n int)

func (*MsgMigrateContract) String

func (m *MsgMigrateContract) String() string

func (*MsgMigrateContract) Unmarshal

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

func (MsgMigrateContract) ValidateBasic

func (m MsgMigrateContract) ValidateBasic() error

ValidateBasic implements sdk.HasValidateBasic

func (*MsgMigrateContract) XXX_DiscardUnknown

func (m *MsgMigrateContract) XXX_DiscardUnknown()

func (*MsgMigrateContract) XXX_Marshal

func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgMigrateContract) XXX_Merge

func (m *MsgMigrateContract) XXX_Merge(src proto.Message)

func (*MsgMigrateContract) XXX_Size

func (m *MsgMigrateContract) XXX_Size() int

func (*MsgMigrateContract) XXX_Unmarshal

func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error

type MsgMigrateContractResponse

type MsgMigrateContractResponse struct {
}

MsgMigrateContractResponse defines the response type for the MigrateContract rpc

func (*MsgMigrateContractResponse) Descriptor

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

func (*MsgMigrateContractResponse) Marshal

func (m *MsgMigrateContractResponse) Marshal() (dAtA []byte, err error)

func (*MsgMigrateContractResponse) MarshalTo

func (m *MsgMigrateContractResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgMigrateContractResponse) MarshalToSizedBuffer

func (m *MsgMigrateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgMigrateContractResponse) ProtoMessage

func (*MsgMigrateContractResponse) ProtoMessage()

func (*MsgMigrateContractResponse) Reset

func (m *MsgMigrateContractResponse) Reset()

func (*MsgMigrateContractResponse) Size

func (m *MsgMigrateContractResponse) Size() (n int)

func (*MsgMigrateContractResponse) String

func (m *MsgMigrateContractResponse) String() string

func (*MsgMigrateContractResponse) Unmarshal

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

func (*MsgMigrateContractResponse) XXX_DiscardUnknown

func (m *MsgMigrateContractResponse) XXX_DiscardUnknown()

func (*MsgMigrateContractResponse) XXX_Marshal

func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgMigrateContractResponse) XXX_Merge

func (m *MsgMigrateContractResponse) XXX_Merge(src proto.Message)

func (*MsgMigrateContractResponse) XXX_Size

func (m *MsgMigrateContractResponse) XXX_Size() int

func (*MsgMigrateContractResponse) XXX_Unmarshal

func (m *MsgMigrateContractResponse) XXX_Unmarshal(b []byte) error

type MsgRemoveChecksum

type MsgRemoveChecksum struct {
	// signer address
	Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
	// checksum is the sha256 hash to be removed from the store
	Checksum []byte `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"`
}

MsgRemoveChecksum defines the request type for the MsgRemoveChecksum rpc.

func NewMsgRemoveChecksum

func NewMsgRemoveChecksum(signer string, checksum []byte) *MsgRemoveChecksum

NewMsgRemoveChecksum creates a new MsgRemoveChecksum instance

func (*MsgRemoveChecksum) Descriptor

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

func (*MsgRemoveChecksum) GetChecksum

func (m *MsgRemoveChecksum) GetChecksum() []byte

func (*MsgRemoveChecksum) GetSigner

func (m *MsgRemoveChecksum) GetSigner() string

func (MsgRemoveChecksum) GetSigners

func (m MsgRemoveChecksum) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (*MsgRemoveChecksum) Marshal

func (m *MsgRemoveChecksum) Marshal() (dAtA []byte, err error)

func (*MsgRemoveChecksum) MarshalTo

func (m *MsgRemoveChecksum) MarshalTo(dAtA []byte) (int, error)

func (*MsgRemoveChecksum) MarshalToSizedBuffer

func (m *MsgRemoveChecksum) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRemoveChecksum) ProtoMessage

func (*MsgRemoveChecksum) ProtoMessage()

func (*MsgRemoveChecksum) Reset

func (m *MsgRemoveChecksum) Reset()

func (*MsgRemoveChecksum) Size

func (m *MsgRemoveChecksum) Size() (n int)

func (*MsgRemoveChecksum) String

func (m *MsgRemoveChecksum) String() string

func (*MsgRemoveChecksum) Unmarshal

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

func (MsgRemoveChecksum) ValidateBasic

func (m MsgRemoveChecksum) ValidateBasic() error

ValidateBasic implements sdk.HasValidateBasic

func (*MsgRemoveChecksum) XXX_DiscardUnknown

func (m *MsgRemoveChecksum) XXX_DiscardUnknown()

func (*MsgRemoveChecksum) XXX_Marshal

func (m *MsgRemoveChecksum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRemoveChecksum) XXX_Merge

func (m *MsgRemoveChecksum) XXX_Merge(src proto.Message)

func (*MsgRemoveChecksum) XXX_Size

func (m *MsgRemoveChecksum) XXX_Size() int

func (*MsgRemoveChecksum) XXX_Unmarshal

func (m *MsgRemoveChecksum) XXX_Unmarshal(b []byte) error

type MsgRemoveChecksumResponse

type MsgRemoveChecksumResponse struct {
}

MsgStoreChecksumResponse defines the response type for the StoreCode rpc

func (*MsgRemoveChecksumResponse) Descriptor

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

func (*MsgRemoveChecksumResponse) Marshal

func (m *MsgRemoveChecksumResponse) Marshal() (dAtA []byte, err error)

func (*MsgRemoveChecksumResponse) MarshalTo

func (m *MsgRemoveChecksumResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgRemoveChecksumResponse) MarshalToSizedBuffer

func (m *MsgRemoveChecksumResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRemoveChecksumResponse) ProtoMessage

func (*MsgRemoveChecksumResponse) ProtoMessage()

func (*MsgRemoveChecksumResponse) Reset

func (m *MsgRemoveChecksumResponse) Reset()

func (*MsgRemoveChecksumResponse) Size

func (m *MsgRemoveChecksumResponse) Size() (n int)

func (*MsgRemoveChecksumResponse) String

func (m *MsgRemoveChecksumResponse) String() string

func (*MsgRemoveChecksumResponse) Unmarshal

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

func (*MsgRemoveChecksumResponse) XXX_DiscardUnknown

func (m *MsgRemoveChecksumResponse) XXX_DiscardUnknown()

func (*MsgRemoveChecksumResponse) XXX_Marshal

func (m *MsgRemoveChecksumResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRemoveChecksumResponse) XXX_Merge

func (m *MsgRemoveChecksumResponse) XXX_Merge(src proto.Message)

func (*MsgRemoveChecksumResponse) XXX_Size

func (m *MsgRemoveChecksumResponse) XXX_Size() int

func (*MsgRemoveChecksumResponse) XXX_Unmarshal

func (m *MsgRemoveChecksumResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// StoreCode defines a rpc handler method for MsgStoreCode.
	StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error)
	// RemoveChecksum defines a rpc handler method for MsgRemoveChecksum.
	RemoveChecksum(context.Context, *MsgRemoveChecksum) (*MsgRemoveChecksumResponse, error)
	// MigrateContract defines a rpc handler method for MsgMigrateContract.
	MigrateContract(context.Context, *MsgMigrateContract) (*MsgMigrateContractResponse, error)
}

MsgServer is the server API for Msg service.

type MsgStoreCode

type MsgStoreCode struct {
	// signer address
	Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
	// wasm byte code of light client contract. It can be raw or gzip compressed
	WasmByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"`
}

MsgStoreCode defines the request type for the StoreCode rpc.

func NewMsgStoreCode

func NewMsgStoreCode(signer string, code []byte) *MsgStoreCode

MsgStoreCode creates a new MsgStoreCode instance

func (*MsgStoreCode) Descriptor

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

func (*MsgStoreCode) GetSigner

func (m *MsgStoreCode) GetSigner() string

func (MsgStoreCode) GetSigners

func (m MsgStoreCode) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (*MsgStoreCode) GetWasmByteCode

func (m *MsgStoreCode) GetWasmByteCode() []byte

func (*MsgStoreCode) Marshal

func (m *MsgStoreCode) Marshal() (dAtA []byte, err error)

func (*MsgStoreCode) MarshalTo

func (m *MsgStoreCode) MarshalTo(dAtA []byte) (int, error)

func (*MsgStoreCode) MarshalToSizedBuffer

func (m *MsgStoreCode) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgStoreCode) ProtoMessage

func (*MsgStoreCode) ProtoMessage()

func (*MsgStoreCode) Reset

func (m *MsgStoreCode) Reset()

func (*MsgStoreCode) Size

func (m *MsgStoreCode) Size() (n int)

func (*MsgStoreCode) String

func (m *MsgStoreCode) String() string

func (*MsgStoreCode) Unmarshal

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

func (MsgStoreCode) ValidateBasic

func (m MsgStoreCode) ValidateBasic() error

ValidateBasic implements sdk.HasValidateBasic

func (*MsgStoreCode) XXX_DiscardUnknown

func (m *MsgStoreCode) XXX_DiscardUnknown()

func (*MsgStoreCode) XXX_Marshal

func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgStoreCode) XXX_Merge

func (m *MsgStoreCode) XXX_Merge(src proto.Message)

func (*MsgStoreCode) XXX_Size

func (m *MsgStoreCode) XXX_Size() int

func (*MsgStoreCode) XXX_Unmarshal

func (m *MsgStoreCode) XXX_Unmarshal(b []byte) error

type MsgStoreCodeResponse

type MsgStoreCodeResponse struct {
	// checksum is the sha256 hash of the stored code
	Checksum []byte `protobuf:"bytes,1,opt,name=checksum,proto3" json:"checksum,omitempty"`
}

MsgStoreCodeResponse defines the response type for the StoreCode rpc

func (*MsgStoreCodeResponse) Descriptor

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

func (*MsgStoreCodeResponse) GetChecksum

func (m *MsgStoreCodeResponse) GetChecksum() []byte

func (*MsgStoreCodeResponse) Marshal

func (m *MsgStoreCodeResponse) Marshal() (dAtA []byte, err error)

func (*MsgStoreCodeResponse) MarshalTo

func (m *MsgStoreCodeResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgStoreCodeResponse) MarshalToSizedBuffer

func (m *MsgStoreCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgStoreCodeResponse) ProtoMessage

func (*MsgStoreCodeResponse) ProtoMessage()

func (*MsgStoreCodeResponse) Reset

func (m *MsgStoreCodeResponse) Reset()

func (*MsgStoreCodeResponse) Size

func (m *MsgStoreCodeResponse) Size() (n int)

func (*MsgStoreCodeResponse) String

func (m *MsgStoreCodeResponse) String() string

func (*MsgStoreCodeResponse) Unmarshal

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

func (*MsgStoreCodeResponse) XXX_DiscardUnknown

func (m *MsgStoreCodeResponse) XXX_DiscardUnknown()

func (*MsgStoreCodeResponse) XXX_Marshal

func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgStoreCodeResponse) XXX_Merge

func (m *MsgStoreCodeResponse) XXX_Merge(src proto.Message)

func (*MsgStoreCodeResponse) XXX_Size

func (m *MsgStoreCodeResponse) XXX_Size() int

func (*MsgStoreCodeResponse) XXX_Unmarshal

func (m *MsgStoreCodeResponse) XXX_Unmarshal(b []byte) error

type MultipliedGasMeter

type MultipliedGasMeter struct {
	GasRegister GasRegister
	// contains filtered or unexported fields
}

MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier

func NewMultipliedGasMeter

func NewMultipliedGasMeter(originalMeter sdk.GasMeter, gr GasRegister) MultipliedGasMeter

func (MultipliedGasMeter) GasConsumed

func (m MultipliedGasMeter) GasConsumed() sdk.Gas

type QueryChecksumsRequest

type QueryChecksumsRequest struct {
}

QueryChecksumsRequest is the request type for the Query/Checksums RPC method.

func (*QueryChecksumsRequest) Descriptor

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

func (*QueryChecksumsRequest) Marshal

func (m *QueryChecksumsRequest) Marshal() (dAtA []byte, err error)

func (*QueryChecksumsRequest) MarshalTo

func (m *QueryChecksumsRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryChecksumsRequest) MarshalToSizedBuffer

func (m *QueryChecksumsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryChecksumsRequest) ProtoMessage

func (*QueryChecksumsRequest) ProtoMessage()

func (*QueryChecksumsRequest) Reset

func (m *QueryChecksumsRequest) Reset()

func (*QueryChecksumsRequest) Size

func (m *QueryChecksumsRequest) Size() (n int)

func (*QueryChecksumsRequest) String

func (m *QueryChecksumsRequest) String() string

func (*QueryChecksumsRequest) Unmarshal

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

func (*QueryChecksumsRequest) XXX_DiscardUnknown

func (m *QueryChecksumsRequest) XXX_DiscardUnknown()

func (*QueryChecksumsRequest) XXX_Marshal

func (m *QueryChecksumsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryChecksumsRequest) XXX_Merge

func (m *QueryChecksumsRequest) XXX_Merge(src proto.Message)

func (*QueryChecksumsRequest) XXX_Size

func (m *QueryChecksumsRequest) XXX_Size() int

func (*QueryChecksumsRequest) XXX_Unmarshal

func (m *QueryChecksumsRequest) XXX_Unmarshal(b []byte) error

type QueryChecksumsResponse

type QueryChecksumsResponse struct {
	// checksums is a list of the hex encoded checksums of all wasm codes stored.
	Checksums []string `protobuf:"bytes,1,rep,name=checksums,proto3" json:"checksums,omitempty"`
}

QueryChecksumsResponse is the response type for the Query/Checksums RPC method.

func (*QueryChecksumsResponse) Descriptor

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

func (*QueryChecksumsResponse) GetChecksums

func (m *QueryChecksumsResponse) GetChecksums() []string

func (*QueryChecksumsResponse) Marshal

func (m *QueryChecksumsResponse) Marshal() (dAtA []byte, err error)

func (*QueryChecksumsResponse) MarshalTo

func (m *QueryChecksumsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryChecksumsResponse) MarshalToSizedBuffer

func (m *QueryChecksumsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryChecksumsResponse) ProtoMessage

func (*QueryChecksumsResponse) ProtoMessage()

func (*QueryChecksumsResponse) Reset

func (m *QueryChecksumsResponse) Reset()

func (*QueryChecksumsResponse) Size

func (m *QueryChecksumsResponse) Size() (n int)

func (*QueryChecksumsResponse) String

func (m *QueryChecksumsResponse) String() string

func (*QueryChecksumsResponse) Unmarshal

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

func (*QueryChecksumsResponse) XXX_DiscardUnknown

func (m *QueryChecksumsResponse) XXX_DiscardUnknown()

func (*QueryChecksumsResponse) XXX_Marshal

func (m *QueryChecksumsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryChecksumsResponse) XXX_Merge

func (m *QueryChecksumsResponse) XXX_Merge(src proto.Message)

func (*QueryChecksumsResponse) XXX_Size

func (m *QueryChecksumsResponse) XXX_Size() int

func (*QueryChecksumsResponse) XXX_Unmarshal

func (m *QueryChecksumsResponse) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// Get all Wasm checksums
	Checksums(ctx context.Context, in *QueryChecksumsRequest, opts ...grpc.CallOption) (*QueryChecksumsResponse, error)
	// Get Wasm code for given code hash
	Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryCodeRequest

type QueryCodeRequest struct {
	// checksum is a hex encoded string of the code stored.
	Checksum string `protobuf:"bytes,1,opt,name=checksum,proto3" json:"checksum,omitempty"`
}

QueryCodeRequest is the request type for the Query/Code RPC method.

func (*QueryCodeRequest) Descriptor

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

func (*QueryCodeRequest) GetChecksum

func (m *QueryCodeRequest) GetChecksum() string

func (*QueryCodeRequest) Marshal

func (m *QueryCodeRequest) Marshal() (dAtA []byte, err error)

func (*QueryCodeRequest) MarshalTo

func (m *QueryCodeRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryCodeRequest) MarshalToSizedBuffer

func (m *QueryCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCodeRequest) ProtoMessage

func (*QueryCodeRequest) ProtoMessage()

func (*QueryCodeRequest) Reset

func (m *QueryCodeRequest) Reset()

func (*QueryCodeRequest) Size

func (m *QueryCodeRequest) Size() (n int)

func (*QueryCodeRequest) String

func (m *QueryCodeRequest) String() string

func (*QueryCodeRequest) Unmarshal

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

func (*QueryCodeRequest) XXX_DiscardUnknown

func (m *QueryCodeRequest) XXX_DiscardUnknown()

func (*QueryCodeRequest) XXX_Marshal

func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCodeRequest) XXX_Merge

func (m *QueryCodeRequest) XXX_Merge(src proto.Message)

func (*QueryCodeRequest) XXX_Size

func (m *QueryCodeRequest) XXX_Size() int

func (*QueryCodeRequest) XXX_Unmarshal

func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error

type QueryCodeResponse

type QueryCodeResponse struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}

QueryCodeResponse is the response type for the Query/Code RPC method.

func (*QueryCodeResponse) Descriptor

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

func (*QueryCodeResponse) GetData

func (m *QueryCodeResponse) GetData() []byte

func (*QueryCodeResponse) Marshal

func (m *QueryCodeResponse) Marshal() (dAtA []byte, err error)

func (*QueryCodeResponse) MarshalTo

func (m *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryCodeResponse) MarshalToSizedBuffer

func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCodeResponse) ProtoMessage

func (*QueryCodeResponse) ProtoMessage()

func (*QueryCodeResponse) Reset

func (m *QueryCodeResponse) Reset()

func (*QueryCodeResponse) Size

func (m *QueryCodeResponse) Size() (n int)

func (*QueryCodeResponse) String

func (m *QueryCodeResponse) String() string

func (*QueryCodeResponse) Unmarshal

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

func (*QueryCodeResponse) XXX_DiscardUnknown

func (m *QueryCodeResponse) XXX_DiscardUnknown()

func (*QueryCodeResponse) XXX_Marshal

func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCodeResponse) XXX_Merge

func (m *QueryCodeResponse) XXX_Merge(src proto.Message)

func (*QueryCodeResponse) XXX_Size

func (m *QueryCodeResponse) XXX_Size() int

func (*QueryCodeResponse) XXX_Unmarshal

func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error

type QueryMsg

type QueryMsg struct {
	Status               *StatusMsg               `json:"status,omitempty"`
	ExportMetadata       *ExportMetadataMsg       `json:"export_metadata,omitempty"`
	TimestampAtHeight    *TimestampAtHeightMsg    `json:"timestamp_at_height,omitempty"`
	VerifyClientMessage  *VerifyClientMessageMsg  `json:"verify_client_message,omitempty"`
	CheckForMisbehaviour *CheckForMisbehaviourMsg `json:"check_for_misbehaviour,omitempty"`
}

QueryMsg is used to encode messages that are sent to the contract's query entry point. The json omitempty tag is mandatory since it omits any empty (default initialized) fields from the encoded JSON, this is required in order to be compatible with Rust's enum matching as used in the contract. Only one field should be set at a time.

type QueryPlugins

type QueryPlugins struct {
	Custom   CustomQuerier
	Stargate StargateQuerier
}

QueryPlugins is a list of queriers that can be used to extend the default querier.

func NewDefaultQueryPlugins

func NewDefaultQueryPlugins() *QueryPlugins

NewDefaultQueryPlugins returns the default set of query plugins

func (QueryPlugins) HandleQuery

func (e QueryPlugins) HandleQuery(ctx sdk.Context, _ string, request wasmvmtypes.QueryRequest) ([]byte, error)

HandleQuery implements the ibcwasm.QueryPluginsI interface.

func (QueryPlugins) Merge

Merge merges the query plugin with a provided one.

type QueryServer

type QueryServer interface {
	// Get all Wasm checksums
	Checksums(context.Context, *QueryChecksumsRequest) (*QueryChecksumsResponse, error)
	// Get Wasm code for given code hash
	Code(context.Context, *QueryCodeRequest) (*QueryCodeResponse, error)
}

QueryServer is the server API for Query service.

type StargateQuerier

type StargateQuerier func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)

type StatusMsg

type StatusMsg struct{}

StatusMsg is a queryMsg sent to the contract to query the status of the wasm client.

type StatusResult

type StatusResult struct {
	Status string `json:"status"`
}

StatusResult is the expected return type of the statusMsg query. It returns the status of the wasm client.

type SudoMsg

type SudoMsg struct {
	UpdateState                 *UpdateStateMsg                 `json:"update_state,omitempty"`
	UpdateStateOnMisbehaviour   *UpdateStateOnMisbehaviourMsg   `json:"update_state_on_misbehaviour,omitempty"`
	VerifyUpgradeAndUpdateState *VerifyUpgradeAndUpdateStateMsg `json:"verify_upgrade_and_update_state,omitempty"`
	VerifyMembership            *VerifyMembershipMsg            `json:"verify_membership,omitempty"`
	VerifyNonMembership         *VerifyNonMembershipMsg         `json:"verify_non_membership,omitempty"`
	MigrateClientStore          *MigrateClientStoreMsg          `json:"migrate_client_store,omitempty"`
}

SudoMsg is used to encode messages that are sent to the contract's sudo entry point. The json omitempty tag is mandatory since it omits any empty (default initialized) fields from the encoded JSON, this is required in order to be compatible with Rust's enum matching as used in the contract. Only one field should be set at a time.

type TimestampAtHeightMsg

type TimestampAtHeightMsg struct {
	Height clienttypes.Height `json:"height"`
}

TimestampAtHeightMsg is a queryMsg sent to the contract to query the timestamp at a given height.

type TimestampAtHeightResult

type TimestampAtHeightResult struct {
	Timestamp uint64 `json:"timestamp"`
}

TimestampAtHeightResult is the expected return type of the timestampAtHeightMsg query. It returns the timestamp for a light client at a given height.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) MigrateContract

func (*UnimplementedMsgServer) RemoveChecksum

func (*UnimplementedMsgServer) StoreCode

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Checksums

func (*UnimplementedQueryServer) Code

type UpdateStateMsg

type UpdateStateMsg struct {
	ClientMessage []byte `json:"client_message"`
}

UpdateStateMsg is a sudoMsg sent to the contract to update the client state.

type UpdateStateOnMisbehaviourMsg

type UpdateStateOnMisbehaviourMsg struct {
	ClientMessage []byte `json:"client_message"`
}

UpdateStateOnMisbehaviourMsg is a sudoMsg sent to the contract to update its state on misbehaviour.

type UpdateStateResult

type UpdateStateResult struct {
	Heights []clienttypes.Height `json:"heights"`
}

UpdateStateResult is the expected return type of the updateStateMsg sudo call. It returns the updated consensus heights.

type VerifyClientMessageMsg

type VerifyClientMessageMsg struct {
	ClientMessage []byte `json:"client_message"`
}

VerifyClientMessageMsg is a queryMsg sent to the contract to verify a client message.

type VerifyMembershipMsg

type VerifyMembershipMsg struct {
	Height           clienttypes.Height         `json:"height"`
	DelayTimePeriod  uint64                     `json:"delay_time_period"`
	DelayBlockPeriod uint64                     `json:"delay_block_period"`
	Proof            []byte                     `json:"proof"`
	Path             commitmenttypes.MerklePath `json:"path"`
	Value            []byte                     `json:"value"`
}

VerifyMembershipMsg is a sudoMsg sent to the contract to verify a membership proof.

type VerifyNonMembershipMsg

type VerifyNonMembershipMsg struct {
	Height           clienttypes.Height         `json:"height"`
	DelayTimePeriod  uint64                     `json:"delay_time_period"`
	DelayBlockPeriod uint64                     `json:"delay_block_period"`
	Proof            []byte                     `json:"proof"`
	Path             commitmenttypes.MerklePath `json:"path"`
}

VerifyNonMembershipMsg is a sudoMsg sent to the contract to verify a non-membership proof.

type VerifyUpgradeAndUpdateStateMsg

type VerifyUpgradeAndUpdateStateMsg struct {
	UpgradeClientState         []byte `json:"upgrade_client_state"`
	UpgradeConsensusState      []byte `json:"upgrade_consensus_state"`
	ProofUpgradeClient         []byte `json:"proof_upgrade_client"`
	ProofUpgradeConsensusState []byte `json:"proof_upgrade_consensus_state"`
}

VerifyUpgradeAndUpdateStateMsg is a sudoMsg sent to the contract to verify an upgrade and update its state.

type WasmConfig

type WasmConfig struct {
	// DataDir is the directory for Wasm blobs and various caches
	DataDir string
	// SupportedCapabilities is a comma separated list of capabilities supported by the chain
	// See https://github.com/CosmWasm/wasmd/blob/e5049ba686ab71164a01f6e71e54347710a1f740/app/wasm.go#L3-L15
	// for more information.
	SupportedCapabilities string
	// ContractDebugMode is a flag to log what contracts print. It must be false on all
	// production nodes, and only enabled in test environments or debug non-validating nodes.
	ContractDebugMode bool
}

WasmConfig defines configuration parameters for the 08-wasm wasm virtual machine instance. It includes the `dataDir` intended to be used for wasm blobs and internal caches, as well as a comma separated list of features or capabilities the user wishes to enable. A boolean flag is provided to enable debug mode.

func DefaultWasmConfig

func DefaultWasmConfig(homePath string) WasmConfig

DefaultWasmConfig returns the default settings for WasmConfig. The homePath is the path to the directory where the data directory for Wasm blobs and caches will be stored.

type WasmGasRegister

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

WasmGasRegister implements GasRegister interface

func NewDefaultWasmGasRegister

func NewDefaultWasmGasRegister() WasmGasRegister

NewDefaultWasmGasRegister creates instance with default values

func NewWasmGasRegister

func NewWasmGasRegister(c WasmGasRegisterConfig) WasmGasRegister

NewWasmGasRegister constructor

func (WasmGasRegister) CompileCosts

func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas

CompileCosts costs to persist and "compile" a new wasm contract

func (WasmGasRegister) EventCosts

EventCosts costs to persist an event

func (WasmGasRegister) FromWasmVMGas

func (g WasmGasRegister) FromWasmVMGas(source uint64) storetypes.Gas

FromWasmVMGas converts from CosmWasm gas (aka. wasmvm gas) to Cosmos SDK gas units

func (WasmGasRegister) InstantiateContractCosts

func (g WasmGasRegister) InstantiateContractCosts(pinned bool, msgLen int) storetypes.Gas

InstantiateContractCosts costs when interacting with a wasm contract

func (WasmGasRegister) NewContractInstanceCosts

func (g WasmGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) storetypes.Gas

NewContractInstanceCosts costs to create a new contract instance from code

func (WasmGasRegister) ReplyCosts

func (g WasmGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) storetypes.Gas

ReplyCosts costs to to handle a message reply

func (WasmGasRegister) ToWasmVMGas

func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64

ToWasmVMGas converts from Cosmos SDK gas units to CosmWasm gas (aka. wasmvm gas)

func (WasmGasRegister) UncompressCosts

func (g WasmGasRegister) UncompressCosts(byteLength int) storetypes.Gas

UncompressCosts costs to unpack a new wasm contract

type WasmGasRegisterConfig

type WasmGasRegisterConfig struct {
	// InstanceCost costs when interacting with a wasm contract
	InstanceCost storetypes.Gas
	// CompileCosts costs to persist and "compile" a new wasm contract
	CompileCost storetypes.Gas
	// UncompressCost costs per byte to unpack a contract
	UncompressCost wasmvmtypes.UFraction
	// GasMultiplier is how many cosmwasm gas points = 1 sdk gas point
	// SDK reference costs can be found here: https://github.com/cosmos/cosmos-sdk/blob/02c6c9fafd58da88550ab4d7d494724a477c8a68/store/types/gas.go#L153-L164
	GasMultiplier storetypes.Gas
	// EventPerAttributeCost is how much SDK gas is charged *per byte* for attribute data in events.
	// This is used with len(key) + len(value)
	EventPerAttributeCost storetypes.Gas
	// EventAttributeDataCost is how much SDK gas is charged *per byte* for attribute data in events.
	// This is used with len(key) + len(value)
	EventAttributeDataCost storetypes.Gas
	// EventAttributeDataFreeTier number of bytes of total attribute data that is free of charge
	EventAttributeDataFreeTier uint64
	// ContractMessageDataCost SDK gas charged *per byte* of the message that goes to the contract
	// This is used with len(msg)
	ContractMessageDataCost storetypes.Gas
	// CustomEventCost cost per custom event
	CustomEventCost uint64
}

WasmGasRegisterConfig config type

func DefaultGasRegisterConfig

func DefaultGasRegisterConfig() WasmGasRegisterConfig

DefaultGasRegisterConfig default values

Jump to

Keyboard shortcuts

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