cosmos-sdk
cosmos-sdk copied to clipboard
Multiple events are merged into one in transactin result log
Summary of Bug
Hi there! I seems like the JSON string in the tx_result.log field is wrong. Multiple events get merged together.
The issue leads to problems with the relayer (ts-relayer in my case). It reads the log but then only finds one packet to send, not all of them. In the meantime we changed to reading tx events directy, but the log should still be correct I guess.
At https://github.com/tendermint/tendermint/issues/9595 it was pointed out that this is likely a Cosmos SDK bug.
Version
Juno Testnet (SDK 0.45.x, Tendermint 0.34.x)
Steps to Reproduce
In the following you see 19 events
curl -sS "https://juno-testnet-rpc.polkachu.com/tx?hash=0xF64B8C6A320A9C25FD1EA60B00194817B069C9CBEF19B736117D9339F33F2E51" | jq .result.tx_result.events
Output JSON with 19 events
[
{
"type": "coin_spent",
"attributes": [
{
"key": "c3BlbmRlcg==",
"value": "anVubzEwMHM0NXM0aDk0cWRrY2FmbW1ycWZsdGxyZ3lxd3luNmUwNWp4Mg==",
"index": true
},
{
"key": "YW1vdW50",
"value": "MzY5NDV1anVub3g=",
"index": true
}
]
},
{
"type": "coin_received",
"attributes": [
{
"key": "cmVjZWl2ZXI=",
"value": "anVubzE3eHBmdmFrbTJhbWc5NjJ5bHM2Zjg0ejNrZWxsOGM1bHh0cW12cA==",
"index": true
},
{
"key": "YW1vdW50",
"value": "MzY5NDV1anVub3g=",
"index": true
}
]
},
{
"type": "transfer",
"attributes": [
{
"key": "cmVjaXBpZW50",
"value": "anVubzE3eHBmdmFrbTJhbWc5NjJ5bHM2Zjg0ejNrZWxsOGM1bHh0cW12cA==",
"index": true
},
{
"key": "c2VuZGVy",
"value": "anVubzEwMHM0NXM0aDk0cWRrY2FmbW1ycWZsdGxyZ3lxd3luNmUwNWp4Mg==",
"index": true
},
{
"key": "YW1vdW50",
"value": "MzY5NDV1anVub3g=",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "c2VuZGVy",
"value": "anVubzEwMHM0NXM0aDk0cWRrY2FmbW1ycWZsdGxyZ3lxd3luNmUwNWp4Mg==",
"index": true
}
]
},
{
"type": "tx",
"attributes": [
{
"key": "ZmVl",
"value": "MzY5NDV1anVub3g=",
"index": true
}
]
},
{
"type": "tx",
"attributes": [
{
"key": "YWNjX3NlcQ==",
"value": "anVubzEwMHM0NXM0aDk0cWRrY2FmbW1ycWZsdGxyZ3lxd3luNmUwNWp4Mi8xMjQ5Mg==",
"index": true
}
]
},
{
"type": "tx",
"attributes": [
{
"key": "c2lnbmF0dXJl",
"value": "Sm42eW9WYlFPdFIxWlNHRW1lQmQ4c2VaOTl5RHlqdlJ2eU8rR1hGL1FGaDh3bzR2Tm5EckFFUzNxNmk0Sy9XTnhhdkNFRDAxVXNSK0hJYVB2djdRNkE9PQ==",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "YWN0aW9u",
"value": "L2Nvc213YXNtLndhc20udjEuTXNnRXhlY3V0ZUNvbnRyYWN0",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "bW9kdWxl",
"value": "d2FzbQ==",
"index": true
},
{
"key": "c2VuZGVy",
"value": "anVubzEwMHM0NXM0aDk0cWRrY2FmbW1ycWZsdGxyZ3lxd3luNmUwNWp4Mg==",
"index": true
}
]
},
{
"type": "execute",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzE0eWYyNHBmY3pjc2xjaGRyMDR1NXAyeXc5enhmNmN2czN2aGU5cjlzcmY1cGc2eTJwN25xZHFuN2tu",
"index": true
}
]
},
{
"type": "execute",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
}
]
},
{
"type": "wasm",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
},
{
"key": "YWN0aW9u",
"value": "ZXhlY3V0ZV9nZXRfbmV4dF9yYW5kb21uZXNz",
"index": true
}
]
},
{
"type": "send_packet",
"attributes": [
{
"key": "cGFja2V0X2NoYW5uZWxfb3JkZXJpbmc=",
"value": "T1JERVJfVU5PUkRFUkVE",
"index": true
},
{
"key": "cGFja2V0X2Nvbm5lY3Rpb24=",
"value": "Y29ubmVjdGlvbi0zMQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGE=",
"value": "eyJhZnRlciI6IjE2NjYxNjkwMDM0MTM1NzgyNjkiLCJzZW5kZXIiOiJqdW5vMTR5ZjI0cGZjemNzbGNoZHIwNHU1cDJ5dzl6eGY2Y3ZzM3ZoZTlyOXNyZjVwZzZ5MnA3bnFkcW43a24iLCJqb2JfaWQiOiJzaW1vbi1yb2xsLTEifQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGFfaGV4",
"value": "N2IyMjYxNjY3NDY1NzIyMjNhMjIzMTM2MzYzNjMxMzYzOTMwMzAzMzM0MzEzMzM1MzczODMyMzYzOTIyMmMyMjczNjU2ZTY0NjU3MjIyM2EyMjZhNzU2ZTZmMzEzNDc5NjYzMjM0NzA2NjYzN2E2MzczNmM2MzY4NjQ3MjMwMzQ3NTM1NzAzMjc5NzczOTdhNzg2NjM2NjM3NjczMzM3NjY4NjUzOTcyMzk3MzcyNjYzNTcwNjczNjc5MzI3MDM3NmU3MTY0NzE2ZTM3NmI2ZTIyMmMyMjZhNmY2MjVmNjk2NDIyM2EyMjczNjk2ZDZmNmUyZDcyNmY2YzZjMmQzMTIyN2Q=",
"index": true
},
{
"key": "cGFja2V0X2RzdF9jaGFubmVs",
"value": "Y2hhbm5lbC0xMA==",
"index": true
},
{
"key": "cGFja2V0X2RzdF9wb3J0",
"value": "d2FzbS5ub2lzMWo3bTRmNjhscnVjZWc1eHEzZ2ZrZmRnZGd6MDJ2aHZscTJwNjd2Zjl2M2h3ZHlkYWF0M3NhanpjeTU=",
"index": true
},
{
"key": "cGFja2V0X3NlcXVlbmNl",
"value": "NzUyNA==",
"index": true
},
{
"key": "cGFja2V0X3NyY19jaGFubmVs",
"value": "Y2hhbm5lbC00Mg==",
"index": true
},
{
"key": "cGFja2V0X3NyY19wb3J0",
"value": "d2FzbS5qdW5vMWU3dnM3Nm1hcmtzaHVzMzlleWZlZmgyeTN0OWd1Z2U0dDBrdnF5YTNxNnZhbWdzZWpoNHE4bHh0cTk=",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfaGVpZ2h0",
"value": "MC0w",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfdGltZXN0YW1w",
"value": "MTY2NjE3MjYwMDQxMzU3ODI2OQ==",
"index": true
}
]
},
{
"type": "execute",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
}
]
},
{
"type": "wasm",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
},
{
"key": "YWN0aW9u",
"value": "ZXhlY3V0ZV9nZXRfbmV4dF9yYW5kb21uZXNz",
"index": true
}
]
},
{
"type": "send_packet",
"attributes": [
{
"key": "cGFja2V0X2NoYW5uZWxfb3JkZXJpbmc=",
"value": "T1JERVJfVU5PUkRFUkVE",
"index": true
},
{
"key": "cGFja2V0X2Nvbm5lY3Rpb24=",
"value": "Y29ubmVjdGlvbi0zMQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGE=",
"value": "eyJhZnRlciI6IjE2NjYxNjkwMDM0MTM1NzgyNjkiLCJzZW5kZXIiOiJqdW5vMTR5ZjI0cGZjemNzbGNoZHIwNHU1cDJ5dzl6eGY2Y3ZzM3ZoZTlyOXNyZjVwZzZ5MnA3bnFkcW43a24iLCJqb2JfaWQiOiJzaW1vbi1yb2xsLTIifQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGFfaGV4",
"value": "N2IyMjYxNjY3NDY1NzIyMjNhMjIzMTM2MzYzNjMxMzYzOTMwMzAzMzM0MzEzMzM1MzczODMyMzYzOTIyMmMyMjczNjU2ZTY0NjU3MjIyM2EyMjZhNzU2ZTZmMzEzNDc5NjYzMjM0NzA2NjYzN2E2MzczNmM2MzY4NjQ3MjMwMzQ3NTM1NzAzMjc5NzczOTdhNzg2NjM2NjM3NjczMzM3NjY4NjUzOTcyMzk3MzcyNjYzNTcwNjczNjc5MzI3MDM3NmU3MTY0NzE2ZTM3NmI2ZTIyMmMyMjZhNmY2MjVmNjk2NDIyM2EyMjczNjk2ZDZmNmUyZDcyNmY2YzZjMmQzMjIyN2Q=",
"index": true
},
{
"key": "cGFja2V0X2RzdF9jaGFubmVs",
"value": "Y2hhbm5lbC0xMA==",
"index": true
},
{
"key": "cGFja2V0X2RzdF9wb3J0",
"value": "d2FzbS5ub2lzMWo3bTRmNjhscnVjZWc1eHEzZ2ZrZmRnZGd6MDJ2aHZscTJwNjd2Zjl2M2h3ZHlkYWF0M3NhanpjeTU=",
"index": true
},
{
"key": "cGFja2V0X3NlcXVlbmNl",
"value": "NzUyNQ==",
"index": true
},
{
"key": "cGFja2V0X3NyY19jaGFubmVs",
"value": "Y2hhbm5lbC00Mg==",
"index": true
},
{
"key": "cGFja2V0X3NyY19wb3J0",
"value": "d2FzbS5qdW5vMWU3dnM3Nm1hcmtzaHVzMzlleWZlZmgyeTN0OWd1Z2U0dDBrdnF5YTNxNnZhbWdzZWpoNHE4bHh0cTk=",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfaGVpZ2h0",
"value": "MC0w",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfdGltZXN0YW1w",
"value": "MTY2NjE3MjYwMDQxMzU3ODI2OQ==",
"index": true
}
]
},
{
"type": "execute",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
}
]
},
{
"type": "wasm",
"attributes": [
{
"key": "X2NvbnRyYWN0X2FkZHJlc3M=",
"value": "anVubzFlN3ZzNzZtYXJrc2h1czM5ZXlmZWZoMnkzdDlndWdlNHQwa3ZxeWEzcTZ2YW1nc2VqaDRxOGx4dHE5",
"index": true
},
{
"key": "YWN0aW9u",
"value": "ZXhlY3V0ZV9nZXRfbmV4dF9yYW5kb21uZXNz",
"index": true
}
]
},
{
"type": "send_packet",
"attributes": [
{
"key": "cGFja2V0X2NoYW5uZWxfb3JkZXJpbmc=",
"value": "T1JERVJfVU5PUkRFUkVE",
"index": true
},
{
"key": "cGFja2V0X2Nvbm5lY3Rpb24=",
"value": "Y29ubmVjdGlvbi0zMQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGE=",
"value": "eyJhZnRlciI6IjE2NjYxNjkwMDM0MTM1NzgyNjkiLCJzZW5kZXIiOiJqdW5vMTR5ZjI0cGZjemNzbGNoZHIwNHU1cDJ5dzl6eGY2Y3ZzM3ZoZTlyOXNyZjVwZzZ5MnA3bnFkcW43a24iLCJqb2JfaWQiOiJzaW1vbi1yb2xsLTMifQ==",
"index": true
},
{
"key": "cGFja2V0X2RhdGFfaGV4",
"value": "N2IyMjYxNjY3NDY1NzIyMjNhMjIzMTM2MzYzNjMxMzYzOTMwMzAzMzM0MzEzMzM1MzczODMyMzYzOTIyMmMyMjczNjU2ZTY0NjU3MjIyM2EyMjZhNzU2ZTZmMzEzNDc5NjYzMjM0NzA2NjYzN2E2MzczNmM2MzY4NjQ3MjMwMzQ3NTM1NzAzMjc5NzczOTdhNzg2NjM2NjM3NjczMzM3NjY4NjUzOTcyMzk3MzcyNjYzNTcwNjczNjc5MzI3MDM3NmU3MTY0NzE2ZTM3NmI2ZTIyMmMyMjZhNmY2MjVmNjk2NDIyM2EyMjczNjk2ZDZmNmUyZDcyNmY2YzZjMmQzMzIyN2Q=",
"index": true
},
{
"key": "cGFja2V0X2RzdF9jaGFubmVs",
"value": "Y2hhbm5lbC0xMA==",
"index": true
},
{
"key": "cGFja2V0X2RzdF9wb3J0",
"value": "d2FzbS5ub2lzMWo3bTRmNjhscnVjZWc1eHEzZ2ZrZmRnZGd6MDJ2aHZscTJwNjd2Zjl2M2h3ZHlkYWF0M3NhanpjeTU=",
"index": true
},
{
"key": "cGFja2V0X3NlcXVlbmNl",
"value": "NzUyNg==",
"index": true
},
{
"key": "cGFja2V0X3NyY19jaGFubmVs",
"value": "Y2hhbm5lbC00Mg==",
"index": true
},
{
"key": "cGFja2V0X3NyY19wb3J0",
"value": "d2FzbS5qdW5vMWU3dnM3Nm1hcmtzaHVzMzlleWZlZmgyeTN0OWd1Z2U0dDBrdnF5YTNxNnZhbWdzZWpoNHE4bHh0cTk=",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfaGVpZ2h0",
"value": "MC0w",
"index": true
},
{
"key": "cGFja2V0X3RpbWVvdXRfdGltZXN0YW1w",
"value": "MTY2NjE3MjYwMDQxMzU3ODI2OQ==",
"index": true
}
]
}
]
However, when looking at the log field, the encoded JSON document only has 4 events:
curl -sS "https://juno-testnet-rpc.polkachu.com/tx?hash=0xF64B8C6A320A9C25FD1EA60B00194817B069C9CBEF19B736117D9339F33F2E51" | jq .result.tx_result.log -r | jq
Output parsed log
[
{
"events": [
{
"type": "execute",
"attributes": [
{
"key": "_contract_address",
"value": "juno14yf24pfczcslchdr04u5p2yw9zxf6cvs3vhe9r9srf5pg6y2p7nqdqn7kn"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
}
]
},
{
"type": "message",
"attributes": [
{
"key": "action",
"value": "/cosmwasm.wasm.v1.MsgExecuteContract"
},
{
"key": "module",
"value": "wasm"
},
{
"key": "sender",
"value": "juno100s45s4h94qdkcafmmrqfltlrgyqwyn6e05jx2"
}
]
},
{
"type": "send_packet",
"attributes": [
{
"key": "packet_channel_ordering",
"value": "ORDER_UNORDERED"
},
{
"key": "packet_connection",
"value": "connection-31"
},
{
"key": "packet_data",
"value": "{\"after\":\"1666169003413578269\",\"sender\":\"juno14yf24pfczcslchdr04u5p2yw9zxf6cvs3vhe9r9srf5pg6y2p7nqdqn7kn\",\"job_id\":\"simon-roll-1\"}"
},
{
"key": "packet_data_hex",
"value": "7b226166746572223a2231363636313639303033343133353738323639222c2273656e646572223a226a756e6f3134796632347066637a63736c636864723034753570327977397a7866366376733376686539723973726635706736793270376e7164716e376b6e222c226a6f625f6964223a2273696d6f6e2d726f6c6c2d31227d"
},
{
"key": "packet_dst_channel",
"value": "channel-10"
},
{
"key": "packet_dst_port",
"value": "wasm.nois1j7m4f68lruceg5xq3gfkfdgdgz02vhvlq2p67vf9v3hwdydaat3sajzcy5"
},
{
"key": "packet_sequence",
"value": "7524"
},
{
"key": "packet_src_channel",
"value": "channel-42"
},
{
"key": "packet_src_port",
"value": "wasm.juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "packet_timeout_height",
"value": "0-0"
},
{
"key": "packet_timeout_timestamp",
"value": "1666172600413578269"
},
{
"key": "packet_channel_ordering",
"value": "ORDER_UNORDERED"
},
{
"key": "packet_connection",
"value": "connection-31"
},
{
"key": "packet_data",
"value": "{\"after\":\"1666169003413578269\",\"sender\":\"juno14yf24pfczcslchdr04u5p2yw9zxf6cvs3vhe9r9srf5pg6y2p7nqdqn7kn\",\"job_id\":\"simon-roll-2\"}"
},
{
"key": "packet_data_hex",
"value": "7b226166746572223a2231363636313639303033343133353738323639222c2273656e646572223a226a756e6f3134796632347066637a63736c636864723034753570327977397a7866366376733376686539723973726635706736793270376e7164716e376b6e222c226a6f625f6964223a2273696d6f6e2d726f6c6c2d32227d"
},
{
"key": "packet_dst_channel",
"value": "channel-10"
},
{
"key": "packet_dst_port",
"value": "wasm.nois1j7m4f68lruceg5xq3gfkfdgdgz02vhvlq2p67vf9v3hwdydaat3sajzcy5"
},
{
"key": "packet_sequence",
"value": "7525"
},
{
"key": "packet_src_channel",
"value": "channel-42"
},
{
"key": "packet_src_port",
"value": "wasm.juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "packet_timeout_height",
"value": "0-0"
},
{
"key": "packet_timeout_timestamp",
"value": "1666172600413578269"
},
{
"key": "packet_channel_ordering",
"value": "ORDER_UNORDERED"
},
{
"key": "packet_connection",
"value": "connection-31"
},
{
"key": "packet_data",
"value": "{\"after\":\"1666169003413578269\",\"sender\":\"juno14yf24pfczcslchdr04u5p2yw9zxf6cvs3vhe9r9srf5pg6y2p7nqdqn7kn\",\"job_id\":\"simon-roll-3\"}"
},
{
"key": "packet_data_hex",
"value": "7b226166746572223a2231363636313639303033343133353738323639222c2273656e646572223a226a756e6f3134796632347066637a63736c636864723034753570327977397a7866366376733376686539723973726635706736793270376e7164716e376b6e222c226a6f625f6964223a2273696d6f6e2d726f6c6c2d33227d"
},
{
"key": "packet_dst_channel",
"value": "channel-10"
},
{
"key": "packet_dst_port",
"value": "wasm.nois1j7m4f68lruceg5xq3gfkfdgdgz02vhvlq2p67vf9v3hwdydaat3sajzcy5"
},
{
"key": "packet_sequence",
"value": "7526"
},
{
"key": "packet_src_channel",
"value": "channel-42"
},
{
"key": "packet_src_port",
"value": "wasm.juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "packet_timeout_height",
"value": "0-0"
},
{
"key": "packet_timeout_timestamp",
"value": "1666172600413578269"
}
]
},
{
"type": "wasm",
"attributes": [
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "action",
"value": "execute_get_next_randomness"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "action",
"value": "execute_get_next_randomness"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "action",
"value": "execute_get_next_randomness"
}
]
}
]
}
]
As you can see for the "type": "execute", multiple events get merged into one event:
{
"type": "execute",
"attributes": [
{
"key": "_contract_address",
"value": "juno14yf24pfczcslchdr04u5p2yw9zxf6cvs3vhe9r9srf5pg6y2p7nqdqn7kn"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
},
{
"key": "_contract_address",
"value": "juno1e7vs76markshus39eyfefh2y3t9guge4t0kvqya3q6vamgsejh4q8lxtq9"
}
]
}
The full JSON outputs can be found at https://gist.github.com/webmaster128/14d273b3b462c1c653f51e3e1edb8cd5.
we send events back per tx, we don't do any sort of grouping on our side. This is tender mints endpoint . I think we need to reopen there.
The flattening is explicitely implemented here:
// Flatten returns a flattened version of StringEvents by grouping all attributes
// per unique event type.
func (se StringEvents) Flatten() StringEvents {
which is used in
msgLogs = append(msgLogs, sdk.NewABCIMessageLog(uint32(i), msgResult.Log, msgEvents))
I am not at all familiar with this codebase but it seems like this was implemented here on purpose at some point.
FWIW, the flattened logs are in submitted order, and those with multiple fields are in submitted order as well. Thus the idx on the unique fields remains consistent to allow for grouping.
Though I agree its super annoying to have to do that anyways.
Is there still an issue here @webmaster128?
Yes, so the text document written to the log string has a structure that does not match the events field and loses important structure. This makes the use of that field very inconvenient as soon as there are multiple events of the same type. @minxylynx's comment proposes a workaround that not easy to implement but it sounds like he put a lot of effort into restoring the structure that is lost. I found the code that is implementing this behaviour as mentioned above, which confirms this is not a Tendermint bug. But I still doubt this is the desired behaviour.
IIRC, we flatten due to Tendermint constraints (a string). Do you have a concrete proposal?
FWIW, the flattened logs are in submitted order, and those with multiple fields are in submitted order as well. Thus the idx on the unique fields remains consistent to allow for grouping.
Though I agree its super annoying to have to do that anyways.
The problem is when you use custom events, they are pushed into a map and you don't know which one came first.
So if your transaction emits the event in the following order.
wasm-custom-1
wasm-custom-2
transfer
They can come out with a totally different order transfer,wasm-custom-2, wasm-custom-1
IIRC, we flatten due to Tendermint constraints (a string). Do you have a concrete proposal?
Usually we use the log field which afaik comes from the sdk as pointed by @webmaster128 added through this https://github.com/cosmos/cosmos-sdk/pull/4648
Do you have a concrete proposal?
Yes, so the log string is a structured JSON document anyways. At the very top it looks like this:
[
{
"events": [
{
So nothing should stop us from filling this events array the same way the transaction events are stored, i.e. just remove the merging of multiple events just because they have the same type.
wow blast from the past on the linked pr. We will look into what we can do to assist you guys here.
Thank you for fixing this!