types

package
v10.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: MIT Imports: 41 Imported by: 1

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).
	// In the 2.0 upgrade, this was reduced by a factor of 1000 (https://github.com/CosmWasm/cosmwasm/pull/1884).
	//
	// 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
	// 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
	// DefaultInstanceCostDiscount is charged instead of DefaultInstanceCost for cases where
	// we assume the contract is loaded from an in-memory cache.
	// For a long time it was implicitly just 0 in those cases.
	// Now we use something small that roughly reflects the 45µs startup time (30x cheaper than DefaultInstanceCost).
	DefaultInstanceCostDiscount uint64 = 2_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
	// Deprecated: in favor of collections.KeySet
	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`.

View Source
const MaxWasmSize uint64 = 3 * 1024 * 1024

MaxWasmSize denotes the maximum size (in bytes) a contract is allowed to be.

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")
	ErrVMError                         = errorsmod.Register(ModuleName, 17, "wasm VM error")
)
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 ChecksumsKey = collections.NewPrefix(0)

ChecksumsKey is the key under which all checksums are stored

View Source
var CostJSONDeserialization = wasmvmtypes.UFraction{
	Numerator:   DefaultDeserializationCostPerByte * DefaultGasMultiplier,
	Denominator: 1,
}
View Source
var (
	VMGasRegister = NewDefaultWasmGasRegister()
)

default: 0.15 gas. see https://github.com/CosmWasm/wasmd/pull/898#discussion_r937727200

Functions

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 IsGzip

func IsGzip(input []byte) bool

IsGzip returns checks if the file contents are gzip compressed

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 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.

type Checksums deprecated

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

Deprecated: This message is deprecated in favor of storing the checksums using a Collections.KeySet.

Deprecated: Do not use.

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) storetypes.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 GetClientState

func GetClientState(store storetypes.KVStore, cdc codec.BinaryCodec) (*ClientState, bool)

GetClientState retrieves the client state from the store using the provided KVStore and codec. It returns the unmarshaled ClientState and a boolean indicating if the state was found.

func NewClientState

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

NewClientState creates a new ClientState instance.

func (ClientState) ClientType

func (ClientState) ClientType() string

ClientType is Wasm light client.

func (*ClientState) Descriptor

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

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

func (m *ClientState) String() string

func (*ClientState) Unmarshal

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

func (ClientState) Validate

func (cs ClientState) Validate() error

Validate performs a basic validation of the client state fields.

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

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 EmptyResult

type EmptyResult struct{}

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

type GasRegister

type GasRegister interface {
	// UncompressCosts costs to unpack a new wasm contract
	UncompressCosts(byteLength int) storetypes.Gas
	// SetupContractCost are charged when interacting with a Wasm contract, i.e. every time
	// the contract is prepared for execution through any entry point (execute/instantiate/sudo/query/ibc_*/...).
	SetupContractCost(discount bool, msgLen int) storetypes.Gas
	// ReplyCosts costs to handle a message reply
	ReplyCosts(discount bool, reply wasmvmtypes.Reply) storetypes.Gas
	// EventCosts costs to persist an event
	EventCosts(attrs []wasmvmtypes.EventAttribute, events wasmvmtypes.Array[wasmvmtypes.Event]) 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{}

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

NewMsgStoreCode creates a new MsgStoreCode instance

func (*MsgStoreCode) Descriptor

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

func (*MsgStoreCode) GetSigner

func (m *MsgStoreCode) GetSigner() string

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 storetypes.GasMeter, gr GasRegister) MultipliedGasMeter

func (MultipliedGasMeter) GasConsumed

func (m MultipliedGasMeter) GasConsumed() storetypes.Gas

type QueryChecksumsRequest

type QueryChecksumsRequest struct {
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

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

func (*QueryChecksumsRequest) Descriptor

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

func (*QueryChecksumsRequest) GetPagination

func (m *QueryChecksumsRequest) GetPagination() *query.PageRequest

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"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,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) GetPagination

func (m *QueryChecksumsResponse) GetPagination() *query.PageResponse

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 checksum
	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"`
	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 QueryRouter

type QueryRouter interface {
	// Route returns the GRPCQueryHandler for a given query route path or nil
	// if not found
	Route(path string) baseapp.GRPCQueryHandler
}

type QueryServer

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

QueryServer is the server API for Query service.

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             commitmenttypesv2.MerklePath `json:"merkle_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             commitmenttypesv2.MerklePath `json:"merkle_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 slice of capabilities supported by the chain
	// See https://github.com/CosmWasm/wasmd/blob/9e44af168570391b0b69822952f206d35320d473/app/wasm.go#L3-L16
	// 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 WasmEngine

type WasmEngine interface {
	// StoreCode will compile the Wasm code, and store the resulting compiled module
	// as well as the original code. Both can be referenced later via Checksum.
	// This must be done one time for given code, after which it can be
	// instantiated many times, and each instance called many times.
	//
	// Returns both the checksum, as well as the gas cost of compilation (in CosmWasm Gas) or an error.
	StoreCode(code wasmvm.WasmCode, gasLimit uint64) (wasmvmtypes.Checksum, uint64, error)

	// StoreCodeUnchecked will compile the wasm code, and store the resulting pre-compile
	// as well as the original code. Both can be referenced later via checksum
	// This must be done one time for given code, after which it can be
	// instantiated many times, and each instance called many times.
	// It does the same as StoreCode but without the static checks.
	// This allows restoring previous contract code in genesis and state-sync that may have been initially stored under different configuration constraints.
	StoreCodeUnchecked(code wasmvm.WasmCode) (wasmvm.Checksum, error)

	// Instantiate will create a new contract based on the given checksum.
	// We can set the initMsg (contract "genesis") here, and it then receives
	// an account and address and can be invoked (Execute) many times.
	//
	// Storage should be set with a PrefixedKVStore that this code can safely access.
	//
	// Under the hood, we may recompile the wasm, use a cached native compile, or even use a cached instance
	// for performance.
	Instantiate(
		checksum wasmvm.Checksum,
		env wasmvmtypes.Env,
		info wasmvmtypes.MessageInfo,
		initMsg []byte,
		store wasmvm.KVStore,
		goapi wasmvm.GoAPI,
		querier wasmvm.Querier,
		gasMeter wasmvm.GasMeter,
		gasLimit uint64,
		deserCost wasmvmtypes.UFraction,
	) (*wasmvmtypes.ContractResult, uint64, error)

	// Query allows a client to execute a contract-specific query. If the result is not empty, it should be
	// valid json-encoded data to return to the client.
	// The meaning of path and data can be determined by the code. Path is the suffix of the abci.QueryRequest.Path
	Query(
		checksum wasmvm.Checksum,
		env wasmvmtypes.Env,
		queryMsg []byte,
		store wasmvm.KVStore,
		goapi wasmvm.GoAPI,
		querier wasmvm.Querier,
		gasMeter wasmvm.GasMeter,
		gasLimit uint64,
		deserCost wasmvmtypes.UFraction,
	) (*wasmvmtypes.QueryResult, uint64, error)

	// Migrate will migrate an existing contract to a new code binary.
	// This takes storage of the data from the original contract and the checksum of the new contract that should
	// replace it. This allows it to run a migration step if needed, or return an error if unable to migrate
	// the given data.
	//
	// MigrateMsg has some data on how to perform the migration.
	Migrate(
		checksum wasmvm.Checksum,
		env wasmvmtypes.Env,
		migrateMsg []byte,
		store wasmvm.KVStore,
		goapi wasmvm.GoAPI,
		querier wasmvm.Querier,
		gasMeter wasmvm.GasMeter,
		gasLimit uint64,
		deserCost wasmvmtypes.UFraction,
	) (*wasmvmtypes.ContractResult, uint64, error)

	// Sudo allows native Go modules to make privileged (sudo) calls on the contract.
	// The contract can expose entry points that cannot be triggered by any transaction, but only via
	// native Go modules, and delegate the access control to the system.
	//
	// These work much like Migrate (same scenario) but allows custom apps to extend the privileged entry points
	// without forking cosmwasm-vm.
	Sudo(
		checksum wasmvm.Checksum,
		env wasmvmtypes.Env,
		sudoMsg []byte,
		store wasmvm.KVStore,
		goapi wasmvm.GoAPI,
		querier wasmvm.Querier,
		gasMeter wasmvm.GasMeter,
		gasLimit uint64,
		deserCost wasmvmtypes.UFraction,
	) (*wasmvmtypes.ContractResult, uint64, error)

	// GetCode will load the original wasm code for the given checksum.
	// This will only succeed if that checksum was previously returned from
	// a call to Create.
	//
	// This can be used so that the (short) checksum is stored in the iavl tree
	// and the larger binary blobs (wasm and pre-compiles) are all managed by the
	// rust library
	GetCode(checksum wasmvm.Checksum) (wasmvm.WasmCode, error)

	// Pin pins a code to an in-memory cache, such that is
	// always loaded quickly when executed.
	// Pin is idempotent.
	Pin(checksum wasmvm.Checksum) error

	// Unpin removes the guarantee of a contract to be pinned (see Pin).
	// After calling this, the code may or may not remain in memory depending on
	// the implementor's choice.
	// Unpin is idempotent.
	Unpin(checksum wasmvm.Checksum) error
}

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

func (g WasmGasRegister) ConsumeRuntimeGas(ctx sdk.Context, gas uint64)

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

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

ReplyCosts costs to handle a message reply. Set discount to true in cases where you can reasonably assume the contract is loaded from an in-memory cache (e.g. pinned contracts or replies).

func (WasmGasRegister) RuntimeGasForContract

func (g WasmGasRegister) RuntimeGasForContract(ctx sdk.Context) uint64

func (WasmGasRegister) SetupContractCost

func (g WasmGasRegister) SetupContractCost(discount bool, msgLen int) storetypes.Gas

SetupContractCost costs when interacting with a wasm contract. Set discount to true in cases where you can reasonably assume the contract is loaded from an in-memory cache (e.g. pinned contracts or replies).

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 are charged when interacting with a Wasm contract.
	// "Instance" refers to the in-memory Instance of the Wasm runtime, not the contract address on chain.
	// InstanceCost are part of a contract's setup cost.
	InstanceCost storetypes.Gas
	// InstanceCostDiscount is a discounted version of InstanceCost. It is charged whenever
	// we can reasonably assume that a contract is in one of the in-memory caches. E.g.
	// when the contract is pinned or we send a reply to a contract that was executed before.
	// See also https://github.com/CosmWasm/wasmd/issues/1798 for more thinking around
	// discount cases.
	InstanceCostDiscount storetypes.Gas
	// CompileCost 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