Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events in log field are merged in an unintended fashion #9595

Closed
webmaster128 opened this issue Oct 19, 2022 · 5 comments
Closed

Events in log field are merged in an unintended fashion #9595

webmaster128 opened this issue Oct 19, 2022 · 5 comments
Assignees

Comments

@webmaster128
Copy link

Hi there! I seems like the JSON string in the tx_result.log field is wrong.

In the following you see 19 events

curl -sS "https://juno-testnet-rpc.polkachu.com/tx?hash=0xF64B8C6A320A9C25FD1EA60B00194817B069C9CBEF19B736117D9339F33F2E51" | jq .result.tx_result.events

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

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.

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.

I'm posting it here as this is what I'm for different event types using Tendermint RPC (Juno, Tendermint 0.34.x). Let me know if it is an issue on a different place in the stack.

@williambanfield
Copy link
Contributor

Hey! I believe this issue should be filed against the Cosmos SDK.

Tendermint accepts the Event and Log information in the DeliverTx response from the application in the response to the ApplyBlock call. Tendermint saves the Log and Events values and then loads and serves them under the /tx endpoint. It doesn't actually modify or generate them, that's an application-level concern.

I'm not certain how the SDK puts the response together, but in BaseApp.DeliverTx I do see it setting the Log and Events.

@williambanfield
Copy link
Contributor

Since this appears to be an SDK issue, I'm going to close. Please re-open if this is incorrect.

@tac0turtle
Copy link
Contributor

Cosmos-sdk sends events by tx not grouped with each other, this was an issue with tendermint before as well. It might have been reverted

@webmaster128
Copy link
Author

Cosmos-sdk sends events by tx not grouped with each other

The bug is in the log field, which seems to be a plain string. Do you know where this string is generated?

@tac0turtle
Copy link
Contributor

its in runTx, we append the events to a string. A bit lost since we append events not based on attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done/Merged
Development

No branches or pull requests

3 participants