gno
gno copied to clipboard
bug(tm2/gnovm): multi-msg call overwrites previous event
Bug: multi-msg call overwrites previous event
related pr #1653
Description
event gets overwrite in multi-msg transaction call
Steps to reproduce
deploy first contract
package event2
import (
"std"
)
func Hello() {
inner()
std.Emit("t", "k", "v")
}
func inner() {
std.Emit("t", "k", "v")
}
deploy second contract
package event
import (
"std"
e2 "gno.land/r/demo/event2"
)
func Hello() {
inner()
std.Emit("t", "k", "v")
}
func inner() {
e2.Hello()
std.Emit("t", "k", "v")
}
func Other() {
std.Emit("other", "k", "v")
}
call with multi-msg like below (with adena)
await adena.DoContract({
messages: [{
"type": "/vm.m_call",
"value": {
"caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
"send": "",
"pkg_path": "gno.land/r/demo/event",
"func": "Hello",
"args": []
}
},{
"type": "/vm.m_call",
"value": {
"caller": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5",
"send": "",
"pkg_path": "gno.land/r/demo/event",
"func": "Other",
"args": []
}
}],
gasFee: 1,
gasWanted: 2000000
});
Expected behaviour
should print each function's events
Actual behaviour
{
"jsonrpc": "2.0",
"id": "",
"result": {
"height": "43",
"results": {
"deliver_tx": [
{
"ResponseBase": {
"Error": null,
"Data": null,
"Events": [
{
"@type": "/tm.gnoEvent",
"pkg_path": "gno.land/r/demo/event",
"type": "other",
"func": "Other",
"attrs": [
{
"key": "k",
"value": "v"
}
]
},
{
"@type": "/tm.gnoEvent",
"pkg_path": "gno.land/r/demo/event",
"type": "other",
"func": "Other",
"attrs": [
{
"key": "k",
"value": "v"
}
]
}
],
"Log": "msg:0,success:true,log:,events:[]\nmsg:1,success:true,log:,events:[]",
"Info": ""
},
"GasWanted": "2000000",
"GasUsed": "270168"
}
],
"end_block": {
"ResponseBase": {
"Error": null,
"Data": null,
"Events": null,
"Log": "",
"Info": ""
},
"ValidatorUpdates": null,
"ConsensusParams": null,
"Events": null
},
"begin_block": {
"ResponseBase": {
"Error": null,
"Data": null,
"Events": null,
"Log": "",
"Info": ""
}
}
}
}
}
number of event looks good, but contents are being over-write by last called function's event
~~I'll investigate on this weekend~~
Maybe fixed