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

Message debug script #936

Merged
merged 7 commits into from
Aug 17, 2022
Merged

Message debug script #936

merged 7 commits into from
Aug 17, 2022

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Aug 15, 2022

Adds a basic script to help debug messages not being received.

This will:

  1. Print the whole parsed message and helpful info about the message
  2. Ensure the destination domain id is a valid one for the environment
  3. Check if the message has been processed yet
  4. Get the recipient EVM address and make an eth_getCode RPC to ensure there’s code at the address, identifying most bytes32 encoding issues
  5. Make a direct handle call to the recipient with the correct params with the from address set to the inbox address, reporting if it reverts and what the revert msg is

I'd love to see this be used for a super basic website so that it can be self-service for ppl.

Other features I think would be nice but aren't included in here:

  • If a message has been processed already, look at old Process events to find the tx hash of the process tx
  • Print how long it's been since the dispatch and what the expected latency is

====

Example usage:

A tx with malformed bytes32:

$ ts-node ./scripts/debug-message.ts --tx-hash 0x79e2b076077e046cd477b9051b2ba9525c5bfae9d0f03476f55329d2d4e474fd --origin-chain fuji -e testnet2
Message 1 of 1...
Leaf index: 6982
Raw bytes: 0x0000a869000000000000000000000000cf8842dd28985e62071b14ff7730f6c46978f72362732d7463cbb926f84c72338c351aff6bba40eb4f3629a400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Parsed message: {
  origin: 43113,
  sender: '0x000000000000000000000000cf8842dd28985e62071b14ff7730f6c46978f723',
  destination: 1651715444,
  recipient: '0x63cbb926f84c72338c351aff6bba40eb4f3629a4000000000000000000000000',
  body: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'
}
Destination chain: bsctestnet
Message hash: 0x1d91d24d8977f608e5cda528fdaeed53e3dfaf771e93a764ab2e902613bb6484
Message not yet processed
ERROR: recipient address 0x6bbA40Eb4F3629a4000000000000000000000000 is not a contract, maybe a malformed bytes32 recipient?
==========
Evaluated 1 messages

A message successfully processed:

$ ts-node ./scripts/debug-message.ts --tx-hash 0x216c074dcab8006edfe7df7f02694d794758172d41f2a40fcfdb52cd17349ba8 --origin-chain fuji -e testnet2
Message 1 of 1...
Leaf index: 7123
Raw bytes: 0x0000a869000000000000000000000000ea5c2bf4a08b3df3f43350f03d743951839b84da62732d74000000000000000000000000e36b6f15d686d37e250cce7a9613c915257d3d2e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000002710
Parsed message: {
  origin: 43113,
  sender: '0x000000000000000000000000ea5c2bf4a08b3df3f43350f03d743951839b84da',
  destination: 1651715444,
  recipient: '0x000000000000000000000000e36b6f15d686d37e250cce7a9613c915257d3d2e',
  body: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc0000000000000000000000000000000000000000000000000000000000002710000000000000000000000000cf846b002f771fbdf6caa88913005a6424d480cc00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000002710'
}
Destination chain: bsctestnet
Message hash: 0xa531d3ae67df11f6ab1fc6e80dd05af1cf415e355194c226112f94661780f3e0
Message has already been processed
==========
Evaluated 1 messages

@tkporter tkporter enabled auto-merge (squash) August 17, 2022 14:21
@tkporter tkporter merged commit f038027 into main Aug 17, 2022
@tkporter tkporter deleted the trevor/message-debug-script branch August 17, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants