Upgrade wasmvm v0.15.x

This commit is contained in:
Alex Peters
2021-06-25 15:51:37 +02:00
parent a29b298ea3
commit b0b1fa88bc
39 changed files with 725 additions and 330 deletions

View File

@@ -270,26 +270,30 @@ func TestHandleExecute(t *testing.T) {
// from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167
assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa})
// this should be standard x/wasm init event, plus 2 bank send event, plus a special event from the contract
require.Equal(t, 4, len(res.Events), prettyEvents(res.Events))
// this should be standard message event, plus x/wasm init event, plus 2 bank send event, plus a special event from the contract
require.Equal(t, 5, len(res.Events), prettyEvents(res.Events))
require.Equal(t, "transfer", res.Events[0].Type)
require.Len(t, res.Events[0].Attributes, 3)
assertAttribute(t, "recipient", contractBech32Addr, res.Events[0].Attributes[0])
assertAttribute(t, "sender", fred.String(), res.Events[0].Attributes[1])
assertAttribute(t, "amount", "5000denom", res.Events[0].Attributes[2])
// custom contract event
// custom contract event attribute
assert.Equal(t, "wasm", res.Events[1].Type)
assertAttribute(t, "contract_address", contractBech32Addr, res.Events[1].Attributes[0])
assertAttribute(t, "action", "release", res.Events[1].Attributes[1])
// custom contract event
assert.Equal(t, "wasm-hackatom", res.Events[2].Type)
assertAttribute(t, "contract_address", contractBech32Addr, res.Events[1].Attributes[0])
assertAttribute(t, "action", "release", res.Events[1].Attributes[1])
// second transfer (this without conflicting message)
assert.Equal(t, "transfer", res.Events[2].Type)
assertAttribute(t, "recipient", bob.String(), res.Events[2].Attributes[0])
assertAttribute(t, "sender", contractBech32Addr, res.Events[2].Attributes[1])
assertAttribute(t, "amount", "105000denom", res.Events[2].Attributes[2])
assert.Equal(t, "transfer", res.Events[3].Type)
assertAttribute(t, "recipient", bob.String(), res.Events[3].Attributes[0])
assertAttribute(t, "sender", contractBech32Addr, res.Events[3].Attributes[1])
assertAttribute(t, "amount", "105000denom", res.Events[3].Attributes[2])
// finally, standard x/wasm tag
assert.Equal(t, "message", res.Events[3].Type)
assertAttribute(t, "module", "wasm", res.Events[3].Attributes[0])
assert.Equal(t, "message", res.Events[4].Type)
assertAttribute(t, "module", "wasm", res.Events[4].Attributes[0])
// ensure bob now exists and got both payments released
bobAcct = data.acctKeeper.GetAccount(data.ctx, bob)