DefiantLabs / cosmos-tax-cli

An opensource cosmos tax tool!
https://defiantlabs.net
Apache License 2.0
25 stars 6 forks source link

MsgRecvPacket error while processing wormhole packet data #504

Open pharr117 opened 8 months ago

pharr117 commented 8 months ago

The receiver address for the wormhole Recv message contains a bad string in the receiver inside the data object. The error happens during insertion in the database since it is not proper UTF-8:

10:22AM INF Indexing 1 TXs from block 11980422
10:22AM INF Indexing 20 TXs from block 11980423
10:22AM INF Indexing 10 TXs from block 11980424
10:22AM ERR Error getting/creating receiver address for msg 1 of tx hash E26846FCAE22AAF984731AF38673EC49F9B4DA3280F1B00D763C8CF1B963F55A. Err: ERROR: invalid byte sequence for encoding "UTF8": 0x00 (SQLSTATE 22021)
10:22AM ERR Error getting/creating receiver address for msg 1 of tx hash E26846FCAE22AAF984731AF38673EC49F9B4DA3280F1B00D763C8CF1B963F55A. Err: ERROR: invalid byte sequence for encoding "UTF8": 0x00 (SQLSTATE 22021)
10:22AM FTL Error indexing block 11980424. error="ERROR: invalid byte sequence for encoding \"UTF8\": 0x00 (SQLSTATE 22021)"

image

Even mintscan (as of time of writing this) is having trouble parsing out the data:

https://www.mintscan.io/osmosis/tx/E26846FCAE22AAF984731AF38673EC49F9B4DA3280F1B00D763C8CF1B963F55A?height=11980424

image

pharr117 commented 8 months ago

We may need to pull in something from the Wormhole package in order to parse this out:

https://github.com/wormhole-foundation/wormhole/tree/main/sdk

They provide some utils to parse wormhole addresses. Docs are here:

  1. Arch: https://docs.wormhole.com/wormhole/explore-wormhole/components
  2. CosmWasm refs: https://docs.wormhole.com/wormhole/blockchain-environments/cosmwasm

I am not entirely sure just yet if it will be possible to pull this into an address, it could represent some other chain data that is not a Cosmos address.

pharr117 commented 8 months ago

After #503, we will need to do the following to fix these TXes, couple options:

  1. reindex-message-type - Use this to reindex ALL TXes that contain this message type, this would be a shotgun approach
  2. Build a script to comb the database for RecvPacket messages that do NOT have any data after the block, and reindex using an explicit list.
misko9 commented 8 months ago

Hey @pharr117, yes, the receiver address is malformed. The write acknowledge shows an error ack so the tx was refunded, not transferred.

pharr117 commented 8 months ago

@misko9 thanks for pointing that out, I see how we can parse out the write_acknowledgement event and check for errors. Thanks for the info!