Documentation ¶
Index ¶
- Constants
- func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error)
- func DefaultQuerier(contractAddr string, coins types.Array[types.Coin]) types.Querier
- func Execute(cache Cache, checksum []byte, env []byte, info []byte, msg []byte, ...) ([]byte, types.GasReport, error)
- func GetCode(cache Cache, checksum []byte) ([]byte, error)
- func GetMetrics(cache Cache) (*types.Metrics, error)
- func IBCChannelClose(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func IBCChannelConnect(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func IBCChannelOpen(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func IBCPacketAck(cache Cache, checksum []byte, env []byte, ack []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func IBCPacketReceive(cache Cache, checksum []byte, env []byte, packet []byte, ...) ([]byte, types.GasReport, error)
- func IBCPacketTimeout(cache Cache, checksum []byte, env []byte, packet []byte, ...) ([]byte, types.GasReport, error)
- func Instantiate(cache Cache, checksum []byte, env []byte, info []byte, msg []byte, ...) ([]byte, types.GasReport, error)
- func LibwasmvmVersion() (string, error)
- func Migrate(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func MockCanonicalizeAddress(human string) ([]byte, uint64, error)
- func MockEnv() types.Env
- func MockEnvBin(t testing.TB) []byte
- func MockFailureCanonicalizeAddress(human string) ([]byte, uint64, error)
- func MockFailureHumanizeAddress(canon []byte) (string, uint64, error)
- func MockFailureValidateAddress(human string) (uint64, error)
- func MockHumanizeAddress(canon []byte) (string, uint64, error)
- func MockIBCChannel(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannel
- func MockIBCChannelCloseConfirm(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelCloseMsg
- func MockIBCChannelCloseInit(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelCloseMsg
- func MockIBCChannelConnectAck(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelConnectMsg
- func MockIBCChannelConnectConfirm(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelConnectMsg
- func MockIBCChannelOpenInit(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelOpenMsg
- func MockIBCChannelOpenTry(channelID string, ordering types.IBCOrder, ibcVersion string) types.IBCChannelOpenMsg
- func MockIBCPacket(myChannel string, data []byte) types.IBCPacket
- func MockIBCPacketAck(myChannel string, data []byte, ack types.IBCAcknowledgement) types.IBCPacketAckMsg
- func MockIBCPacketReceive(myChannel string, data []byte) types.IBCPacketReceiveMsg
- func MockIBCPacketTimeout(myChannel string, data []byte) types.IBCPacketTimeoutMsg
- func MockInfo(sender types.HumanAddress, funds []types.Coin) types.MessageInfo
- func MockInfoBin(t testing.TB, sender types.HumanAddress) []byte
- func MockInfoWithFunds(sender types.HumanAddress) types.MessageInfo
- func MockValidateAddress(input string) (gasCost uint64, _ error)
- func NewMockAPI() *types.GoAPI
- func NewMockFailureAPI() *types.GoAPI
- func Pin(cache Cache, checksum []byte) error
- func Query(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func ReleaseCache(cache Cache)
- func RemoveCode(cache Cache, checksum []byte) error
- func Reply(cache Cache, checksum []byte, env []byte, reply []byte, ...) ([]byte, types.GasReport, error)
- func StoreCode(cache Cache, wasm []byte) ([]byte, error)
- func StoreCodeUnchecked(cache Cache, wasm []byte) ([]byte, error)
- func Sudo(cache Cache, checksum []byte, env []byte, msg []byte, gasMeter *types.GasMeter, ...) ([]byte, types.GasReport, error)
- func TestBankQuerierAllBalances(t *testing.T)
- func TestBankQuerierBalance(t *testing.T)
- func TestMockApi(t *testing.T)
- func TestReflectCustomQuerier(t *testing.T)
- func Unpin(cache Cache, checksum []byte) error
- type BankQuerier
- type Cache
- type CapitalizedQuery
- type CustomQuerier
- type CustomQuery
- type CustomResponse
- type DBState
- type ErrorGasOverflow
- type ErrorOutOfGas
- type Lookup
- func (l Lookup) Delete(key []byte)
- func (l Lookup) Get(key []byte) []byte
- func (l Lookup) Iterator(start, end []byte) types.Iterator
- func (l Lookup) ReverseIterator(start, end []byte) types.Iterator
- func (l Lookup) Set(key, value []byte)
- func (l *Lookup) SetGasMeter(meter MockGasMeter)
- func (l *Lookup) WithGasMeter(meter MockGasMeter) *Lookup
- type MockGasMeter
- type MockQuerier
- type NoCustom
- type Querier
- type ReflectCustom
Constants ¶
const ( GetPrice uint64 = 99000 SetPrice uint64 = 187000 RemovePrice uint64 = 142000 RangePrice uint64 = 261000 )
Note: these gas prices are all in *wasmer gas* and (sdk gas * 100)
We making simple values and non-clear multiples so it is easy to see their impact in test output Also note we do not charge for each read on an iterator (out of simplicity and not needed for tests)
const ( CostCanonical uint64 = 440 CostHuman uint64 = 550 )
const CanonicalLength = 32
const DEFAULT_QUERIER_GAS_LIMIT = 1_000_000
const MOCK_CONTRACT_ADDR = "contract"
Variables ¶
This section is empty.
Functions ¶
func AnalyzeCode ¶
func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error)
func DefaultQuerier ¶
func IBCChannelClose ¶
func IBCChannelConnect ¶
func IBCChannelOpen ¶
func IBCPacketAck ¶
func IBCPacketReceive ¶
func IBCPacketTimeout ¶
func Instantiate ¶
func LibwasmvmVersion ¶
func MockEnvBin ¶
func MockIBCChannel ¶
func MockIBCChannelCloseInit ¶
func MockIBCChannelOpenInit ¶
func MockIBCChannelOpenTry ¶
func MockIBCPacketAck ¶
func MockIBCPacketAck(myChannel string, data []byte, ack types.IBCAcknowledgement) types.IBCPacketAckMsg
func MockIBCPacketReceive ¶
func MockIBCPacketReceive(myChannel string, data []byte) types.IBCPacketReceiveMsg
func MockIBCPacketTimeout ¶
func MockIBCPacketTimeout(myChannel string, data []byte) types.IBCPacketTimeoutMsg
func MockInfo ¶
func MockInfo(sender types.HumanAddress, funds []types.Coin) types.MessageInfo
func MockInfoBin ¶
func MockInfoBin(t testing.TB, sender types.HumanAddress) []byte
func MockInfoWithFunds ¶
func MockInfoWithFunds(sender types.HumanAddress) types.MessageInfo
func MockValidateAddress ¶
func NewMockAPI ¶
func NewMockFailureAPI ¶
func ReleaseCache ¶
func ReleaseCache(cache Cache)
func RemoveCode ¶
func TestBankQuerierBalance ¶
func TestMockApi ¶
Types ¶
type BankQuerier ¶
func NewBankQuerier ¶
type CapitalizedQuery ¶
type CapitalizedQuery struct {
Text string `json:"text"`
}
type CustomQuerier ¶
type CustomQuerier interface {
Query(request json.RawMessage) ([]byte, error)
}
type CustomQuery ¶
type CustomQuery struct { Ping *struct{} `json:"ping,omitempty"` Capitalized *CapitalizedQuery `json:"capitalized,omitempty"` }
type CustomResponse ¶
type CustomResponse struct {
Msg string `json:"msg"`
}
CustomResponse is the response for all `CustomQuery`s
type ErrorGasOverflow ¶
type ErrorGasOverflow struct {
Descriptor string
}
ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.
type ErrorOutOfGas ¶
type ErrorOutOfGas struct {
Descriptor string
}
ErrorOutOfGas defines an error thrown when an action results in out of gas.
type Lookup ¶
type Lookup struct {
// contains filtered or unexported fields
}
func NewLookup ¶
func NewLookup(meter MockGasMeter) *Lookup
func (Lookup) ReverseIterator ¶
ReverseIterator wraps the underlying DB's ReverseIterator method panicing on error.
func (*Lookup) SetGasMeter ¶
func (l *Lookup) SetGasMeter(meter MockGasMeter)
func (*Lookup) WithGasMeter ¶
func (l *Lookup) WithGasMeter(meter MockGasMeter) *Lookup
type MockGasMeter ¶
func NewMockGasMeter ¶
func NewMockGasMeter(limit types.Gas) MockGasMeter
NewMockGasMeter returns a reference to a new mockGasMeter.
type MockQuerier ¶
type MockQuerier struct { Bank BankQuerier Custom CustomQuerier // contains filtered or unexported fields }
func (MockQuerier) GasConsumed ¶
func (q MockQuerier) GasConsumed() uint64
func (*MockQuerier) Query ¶
func (q *MockQuerier) Query(request types.QueryRequest, _gasLimit uint64) ([]byte, error)
type ReflectCustom ¶
type ReflectCustom struct{}
ReflectCustom fulfills the requirements for testing `reflect` contract
func (ReflectCustom) Query ¶
func (q ReflectCustom) Query(request json.RawMessage) ([]byte, error)