Merge pull request #432 from CosmWasm/wasmvm-0.14-alpha1
Wasmvm 0.14 alpha2
This commit is contained in:
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/CosmWasm/wasmd
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/CosmWasm/wasmvm v0.13.1-0.20210125204657-16df1fdaf712
|
||||
github.com/CosmWasm/wasmvm v0.14.0-alpha2
|
||||
github.com/cosmos/cosmos-sdk v0.41.4
|
||||
github.com/cosmos/iavl v0.15.3
|
||||
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b
|
||||
|
||||
4
go.sum
4
go.sum
@@ -19,6 +19,10 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQ
|
||||
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
|
||||
github.com/CosmWasm/wasmvm v0.13.1-0.20210125204657-16df1fdaf712 h1:8gMCeYi0In+3R+ox44SfXoY9a7KXngH8sDwsg+eLwB4=
|
||||
github.com/CosmWasm/wasmvm v0.13.1-0.20210125204657-16df1fdaf712/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
|
||||
github.com/CosmWasm/wasmvm v0.14.0-alpha1 h1:n6cKrufXvaAzDaUfw1wEr39hNBLv3BY2usUnShmAFwQ=
|
||||
github.com/CosmWasm/wasmvm v0.14.0-alpha1/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
|
||||
github.com/CosmWasm/wasmvm v0.14.0-alpha2 h1:IF+ZNYe6XxKmAZaAzX/Y2dXB1v3l+J0+Vyz69CtojOQ=
|
||||
github.com/CosmWasm/wasmvm v0.14.0-alpha2/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
|
||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
|
||||
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
|
||||
|
||||
@@ -616,7 +616,7 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) {
|
||||
wasmConfig := wasmTypes.DefaultWasmConfig()
|
||||
pk := paramskeeper.NewKeeper(encodingConfig.Marshaler, encodingConfig.Amino, keyParams, tkeyParams)
|
||||
|
||||
srcKeeper := NewKeeper(encodingConfig.Marshaler, keyWasm, pk.Subspace(wasmTypes.DefaultParamspace), authkeeper.AccountKeeper{}, nil, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, tempDir, wasmConfig, "", nil, nil)
|
||||
srcKeeper := NewKeeper(encodingConfig.Marshaler, keyWasm, pk.Subspace(wasmTypes.DefaultParamspace), authkeeper.AccountKeeper{}, nil, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, tempDir, wasmConfig, SupportedFeatures, nil, nil)
|
||||
return &srcKeeper, ctx, []sdk.StoreKey{keyWasm, keyParams}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ func TestInstantiate(t *testing.T) {
|
||||
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
if types.EnableGasVerification {
|
||||
require.Equal(t, uint64(0x118c2), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x118c0), gasAfter-gasBefore)
|
||||
}
|
||||
|
||||
// ensure it is stored properly
|
||||
@@ -441,8 +441,8 @@ func TestInstantiateWithContractDataResponse(t *testing.T) {
|
||||
ctx, keepers := CreateTestInput(t, false, SupportedFeatures, nil, nil)
|
||||
|
||||
wasmerMock := &wasmtesting.MockWasmer{
|
||||
InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error) {
|
||||
return &wasmvmtypes.InitResponse{Data: []byte("my-response-data")}, 0, nil
|
||||
InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
return &wasmvmtypes.Response{Data: []byte("my-response-data")}, 0, nil
|
||||
},
|
||||
AnalyzeCodeFn: wasmtesting.WithoutIBCAnalyzeFn,
|
||||
CreateFn: wasmtesting.NoOpCreateFn,
|
||||
@@ -515,7 +515,7 @@ func TestExecute(t *testing.T) {
|
||||
// make sure gas is properly deducted from ctx
|
||||
gasAfter := ctx.GasMeter().GasConsumed()
|
||||
if types.EnableGasVerification {
|
||||
require.Equal(t, uint64(0x11d3f), gasAfter-gasBefore)
|
||||
require.Equal(t, uint64(0x11d39), gasAfter-gasBefore)
|
||||
}
|
||||
// ensure bob now exists and got both payments released
|
||||
bobAcct = accKeeper.GetAccount(ctx, bob)
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestConstructorOptions(t *testing.T) {
|
||||
nil,
|
||||
"tempDir",
|
||||
types.DefaultWasmConfig(),
|
||||
"",
|
||||
SupportedFeatures,
|
||||
nil,
|
||||
nil,
|
||||
spec.srcOpt,
|
||||
|
||||
@@ -57,12 +57,12 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc
|
||||
|
||||
func TestGasCostOnQuery(t *testing.T) {
|
||||
const (
|
||||
GasNoWork uint64 = 43_084
|
||||
GasNoWork uint64 = 43_074
|
||||
// Note: about 100 SDK gas (10k wasmer gas) for each round of sha256
|
||||
GasWork50 uint64 = 48_711 // this is a little shy of 50k gas - to keep an eye on the limit
|
||||
GasWork50 uint64 = 48_744 // this is a little shy of 50k gas - to keep an eye on the limit
|
||||
|
||||
GasReturnUnhashed uint64 = 295
|
||||
GasReturnHashed uint64 = 270
|
||||
GasReturnUnhashed uint64 = 287
|
||||
GasReturnHashed uint64 = 262
|
||||
)
|
||||
|
||||
cases := map[string]struct {
|
||||
@@ -80,7 +80,7 @@ func TestGasCostOnQuery(t *testing.T) {
|
||||
msg: Recurse{
|
||||
Work: 50, // 50 rounds of sha256 inside the contract
|
||||
},
|
||||
expectedGas: GasWork50,
|
||||
expectedGas: GasWork50 + 1,
|
||||
},
|
||||
"recursion 1, no work": {
|
||||
gasLimit: 400_000,
|
||||
@@ -224,9 +224,9 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
|
||||
|
||||
const (
|
||||
// Note: about 100 SDK gas (10k wasmer gas) for each round of sha256
|
||||
GasWork2k uint64 = 270_359 // = InstanceCost + x // we have 6x gas used in cpu than in the instance
|
||||
GasWork2k uint64 = 271_797 // = InstanceCost + x // we have 6x gas used in cpu than in the instance
|
||||
// This is overhead for calling into a sub-contract
|
||||
GasReturnHashed uint64 = 276
|
||||
GasReturnHashed uint64 = 265
|
||||
)
|
||||
|
||||
cases := map[string]struct {
|
||||
@@ -252,8 +252,8 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
|
||||
Work: 2000,
|
||||
},
|
||||
expectQueriesFromContract: 5,
|
||||
// FIXME: why -3... confused a bit by calculations, seems like rounding issues
|
||||
expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) - 3,
|
||||
// FIXME: why +1 ... confused a bit by calculations, seems like rounding issues
|
||||
expectedGas: GasWork2k + 5*(GasWork2k+GasReturnHashed) + 1,
|
||||
},
|
||||
// this is where we expect an error...
|
||||
// it has enough gas to run 4 times and die on the 5th (4th time dispatching to sub-contract)
|
||||
|
||||
BIN
x/wasm/internal/keeper/testdata/burner.wasm
vendored
BIN
x/wasm/internal/keeper/testdata/burner.wasm
vendored
Binary file not shown.
@@ -9,7 +9,7 @@ fi
|
||||
|
||||
tag="$1"
|
||||
|
||||
for contract in burner hackatom reflect staking; do
|
||||
for contract in burner hackatom ibc_reflect ibc_reflect_send reflect staking; do
|
||||
url="https://github.com/CosmWasm/cosmwasm/releases/download/$tag/${contract}.wasm"
|
||||
echo "Downloading $url ..."
|
||||
wget -O "${contract}.wasm" "$url"
|
||||
|
||||
BIN
x/wasm/internal/keeper/testdata/hackatom.wasm
vendored
BIN
x/wasm/internal/keeper/testdata/hackatom.wasm
vendored
Binary file not shown.
BIN
x/wasm/internal/keeper/testdata/hackatom.wasm.gzip
vendored
BIN
x/wasm/internal/keeper/testdata/hackatom.wasm.gzip
vendored
Binary file not shown.
BIN
x/wasm/internal/keeper/testdata/ibc_reflect.wasm
vendored
BIN
x/wasm/internal/keeper/testdata/ibc_reflect.wasm
vendored
Binary file not shown.
Binary file not shown.
BIN
x/wasm/internal/keeper/testdata/reflect.wasm
vendored
BIN
x/wasm/internal/keeper/testdata/reflect.wasm
vendored
Binary file not shown.
BIN
x/wasm/internal/keeper/testdata/staking.wasm
vendored
BIN
x/wasm/internal/keeper/testdata/staking.wasm
vendored
Binary file not shown.
@@ -17,10 +17,10 @@ var _ types.WasmerEngine = &MockWasmer{}
|
||||
type MockWasmer struct {
|
||||
CreateFn func(codeID wasmvm.WasmCode) (wasmvm.Checksum, error)
|
||||
AnalyzeCodeFn func(codeID wasmvm.Checksum) (*wasmvmtypes.AnalysisReport, error)
|
||||
InstantiateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error)
|
||||
ExecuteFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error)
|
||||
InstantiateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error)
|
||||
ExecuteFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error)
|
||||
QueryFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) ([]byte, uint64, error)
|
||||
MigrateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.MigrateResponse, uint64, error)
|
||||
MigrateFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error)
|
||||
GetCodeFn func(codeID wasmvm.Checksum) (wasmvm.WasmCode, error)
|
||||
CleanupFn func()
|
||||
IBCChannelOpenFn func(codeID wasmvm.Checksum, env wasmvmtypes.Env, channel wasmvmtypes.IBCChannel, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (uint64, error)
|
||||
@@ -87,14 +87,14 @@ func (m *MockWasmer) AnalyzeCode(codeID wasmvm.Checksum) (*wasmvmtypes.AnalysisR
|
||||
return m.AnalyzeCodeFn(codeID)
|
||||
}
|
||||
|
||||
func (m *MockWasmer) Instantiate(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error) {
|
||||
func (m *MockWasmer) Instantiate(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
if m.InstantiateFn == nil {
|
||||
panic("not supposed to be called!")
|
||||
}
|
||||
return m.InstantiateFn(codeID, env, info, initMsg, store, goapi, querier, gasMeter, gasLimit)
|
||||
}
|
||||
|
||||
func (m *MockWasmer) Execute(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) {
|
||||
func (m *MockWasmer) Execute(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
if m.ExecuteFn == nil {
|
||||
panic("not supposed to be called!")
|
||||
}
|
||||
@@ -108,7 +108,7 @@ func (m *MockWasmer) Query(codeID wasmvm.Checksum, env wasmvmtypes.Env, queryMsg
|
||||
return m.QueryFn(codeID, env, queryMsg, store, goapi, querier, gasMeter, gasLimit)
|
||||
}
|
||||
|
||||
func (m *MockWasmer) Migrate(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.MigrateResponse, uint64, error) {
|
||||
func (m *MockWasmer) Migrate(codeID wasmvm.Checksum, env wasmvmtypes.Env, migrateMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
if m.MigrateFn == nil {
|
||||
panic("not supposed to be called!")
|
||||
}
|
||||
@@ -139,17 +139,17 @@ func SelfCallingInstMockWasmer(executeCalled *bool) *MockWasmer {
|
||||
anyCodeID := bytes.Repeat([]byte{0x1}, 32)
|
||||
return anyCodeID, nil
|
||||
},
|
||||
InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.InitResponse, uint64, error) {
|
||||
return &wasmvmtypes.InitResponse{
|
||||
InstantiateFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, initMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
return &wasmvmtypes.Response{
|
||||
Messages: []wasmvmtypes.CosmosMsg{
|
||||
{Wasm: &wasmvmtypes.WasmMsg{Execute: &wasmvmtypes.ExecuteMsg{ContractAddr: env.Contract.Address, Msg: []byte(`{}`)}}},
|
||||
},
|
||||
}, 1, nil
|
||||
},
|
||||
AnalyzeCodeFn: WithoutIBCAnalyzeFn,
|
||||
ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) {
|
||||
ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
*executeCalled = true
|
||||
return &wasmvmtypes.HandleResponse{}, 1, nil
|
||||
return &wasmvmtypes.Response{}, 1, nil
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ type contractExecutable interface {
|
||||
querier wasmvm.Querier,
|
||||
gasMeter wasmvm.GasMeter,
|
||||
gasLimit uint64,
|
||||
) (*wasmvmtypes.HandleResponse, uint64, error)
|
||||
) (*wasmvmtypes.Response, uint64, error)
|
||||
}
|
||||
|
||||
//MakeIBCInstantiable adds some noop functions to not fail when contract is used for instantiation
|
||||
@@ -273,8 +273,8 @@ func HashOnlyCreateFn(code wasmvm.WasmCode) (wasmvm.Checksum, error) {
|
||||
return hash[:], nil
|
||||
}
|
||||
|
||||
func NoOpInstantiateFn(wasmvm.Checksum, wasmvmtypes.Env, wasmvmtypes.MessageInfo, []byte, wasmvm.KVStore, wasmvm.GoAPI, wasmvm.Querier, wasmvm.GasMeter, uint64) (*wasmvmtypes.InitResponse, uint64, error) {
|
||||
return &wasmvmtypes.InitResponse{}, 0, nil
|
||||
func NoOpInstantiateFn(wasmvm.Checksum, wasmvmtypes.Env, wasmvmtypes.MessageInfo, []byte, wasmvm.KVStore, wasmvm.GoAPI, wasmvm.Querier, wasmvm.GasMeter, uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
return &wasmvmtypes.Response{}, 0, nil
|
||||
}
|
||||
|
||||
func NoOpCreateFn(_ wasmvm.WasmCode) (wasmvm.Checksum, error) {
|
||||
|
||||
@@ -199,8 +199,8 @@ func NewEnv(ctx sdk.Context, contractAddr sdk.AccAddress) wasmvmtypes.Env {
|
||||
// NewInfo initializes the MessageInfo for a contract instance
|
||||
func NewInfo(creator sdk.AccAddress, deposit sdk.Coins) wasmvmtypes.MessageInfo {
|
||||
return wasmvmtypes.MessageInfo{
|
||||
Sender: creator.String(),
|
||||
SentFunds: NewWasmCoins(deposit),
|
||||
Sender: creator.String(),
|
||||
Funds: NewWasmCoins(deposit),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ type WasmerEngine interface {
|
||||
querier wasmvm.Querier,
|
||||
gasMeter wasmvm.GasMeter,
|
||||
gasLimit uint64,
|
||||
) (*wasmvmtypes.InitResponse, uint64, error)
|
||||
) (*wasmvmtypes.Response, uint64, error)
|
||||
|
||||
// Execute calls a given contract. Since the only difference between contracts with the same CodeID is the
|
||||
// data in their local storage, and their address in the outside world, we need no ContractID here.
|
||||
@@ -58,7 +58,7 @@ type WasmerEngine interface {
|
||||
querier wasmvm.Querier,
|
||||
gasMeter wasmvm.GasMeter,
|
||||
gasLimit uint64,
|
||||
) (*wasmvmtypes.HandleResponse, uint64, error)
|
||||
) (*wasmvmtypes.Response, 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.
|
||||
@@ -89,7 +89,7 @@ type WasmerEngine interface {
|
||||
querier wasmvm.Querier,
|
||||
gasMeter wasmvm.GasMeter,
|
||||
gasLimit uint64,
|
||||
) (*wasmvmtypes.MigrateResponse, uint64, error)
|
||||
) (*wasmvmtypes.Response, uint64, error)
|
||||
|
||||
// GetCode will load the original wasm code for the given code id.
|
||||
// This will only succeed if that code id was previously returned from
|
||||
|
||||
@@ -145,10 +145,10 @@ type player struct {
|
||||
|
||||
// Execute starts the ping pong game
|
||||
// Contracts finds all connected channels and broadcasts a ping message
|
||||
func (p *player) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) {
|
||||
func (p *player) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
p.execCalls++
|
||||
if p.execCalls%2 == 1 { // skip checkTx step because of no rollback with `chain.GetContext()`
|
||||
return &wasmvmtypes.HandleResponse{}, 0, nil
|
||||
return &wasmvmtypes.Response{}, 0, nil
|
||||
}
|
||||
// start game
|
||||
var start startGame
|
||||
@@ -164,7 +164,7 @@ func (p *player) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmt
|
||||
|
||||
p.incrementCounter(sentBallsCountKey, store)
|
||||
store.Set(lastBallSentKey, sdk.Uint64ToBigEndian(start.Value))
|
||||
return &wasmvmtypes.HandleResponse{
|
||||
return &wasmvmtypes.Response{
|
||||
Messages: []wasmvmtypes.CosmosMsg{
|
||||
{
|
||||
IBC: &wasmvmtypes.IBCMsg{
|
||||
|
||||
@@ -315,7 +315,7 @@ type sendViaIBCTransferContract struct {
|
||||
t *testing.T
|
||||
}
|
||||
|
||||
func (s *sendViaIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) {
|
||||
func (s *sendViaIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
var in startTransfer
|
||||
if err := json.Unmarshal(executeMsg, &in); err != nil {
|
||||
return nil, 0, err
|
||||
@@ -332,7 +332,7 @@ func (s *sendViaIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtyp
|
||||
},
|
||||
}
|
||||
|
||||
return &wasmvmtypes.HandleResponse{Messages: []wasmvmtypes.CosmosMsg{{IBC: ibcMsg}}}, 0, nil
|
||||
return &wasmvmtypes.Response{Messages: []wasmvmtypes.CosmosMsg{{IBC: ibcMsg}}}, 0, nil
|
||||
}
|
||||
|
||||
var _ wasmtesting.IBCContractCallbacks = &sendEmulatedIBCTransferContract{}
|
||||
@@ -345,7 +345,7 @@ type sendEmulatedIBCTransferContract struct {
|
||||
contractAddr string
|
||||
}
|
||||
|
||||
func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.HandleResponse, uint64, error) {
|
||||
func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.Response, uint64, error) {
|
||||
var in startTransfer
|
||||
if err := json.Unmarshal(executeMsg, &in); err != nil {
|
||||
return nil, 0, err
|
||||
@@ -365,7 +365,7 @@ func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasm
|
||||
TimeoutTimestamp: &in.Timeout,
|
||||
},
|
||||
}
|
||||
return &wasmvmtypes.HandleResponse{Messages: []wasmvmtypes.CosmosMsg{{IBC: ibcMsg}}}, 0, nil
|
||||
return &wasmvmtypes.Response{Messages: []wasmvmtypes.CosmosMsg{{IBC: ibcMsg}}}, 0, nil
|
||||
}
|
||||
|
||||
func (c *sendEmulatedIBCTransferContract) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, packet wasmvmtypes.IBCPacket, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
|
||||
|
||||
Reference in New Issue
Block a user