How to Debug Sent Messages
This guide provides instructions on debugging sent messages using command-line tools and hardhat. It covers retrieving message status, inspecting arguments of emitted events by the Endpoint, and more. If you have not deployed your custom protocol yet, refer to the Getting Started guide before proceeding.
Retrieving Account Balance
To get the balance of any account on an EVM-compatible network, execute the command below. It will print the specified account balance.
npx hardhat balance --acc <address> --network <network_name>
Fetching Block Data
To retrieve block details from an EVM-compatible network, execute the command below. It will output the block number, block hash, and creation timestamp.
npx hardhat getBlock --num <block_number> --network <network_name>
Extracting Transaction Details
To obtain details of a specific transaction, execute the command below. It will output the sender address, the receiver address, msg.value, payload, and block number.
npx hardhat getTxData --hash <tx_hash> --network <network_name>
Printing Proposal Data
If a proposal was sent to the Endpoint, parse the emitted event by executing the below command. It will output the destination chain ID, msg.value, selector slot, agent parameters, sender address, destination address, encoded payload.
npx hardhat proposal --hash <tx_hash> --network <network_name>
Retrieving Proposal and TEIB Message Hash
To find the message hash associated with a transaction hash from the source network, execute the command below. If a proposal is found in the transaction receipt, it will be reconstructed, and the corresponding message hashes will be displayed.
npx hardhat getMsgHash --hash <source_tx_hash> --network <network_name>
Status Codes
0 = NOT_INITIALIZED
1 = INVALID
2 = SAVED
3 = TRANSMITTED
4 = QUEUED
5 = PENDING
6 = PROTOCOL_FAILED
7 = EXTENSION_NOT_REGISTERED
8 = EXTENSION_NOT_REACHABLE
9 = EXTENSION_PANICKED
10 = UNDERESTIMATED
11 = SUCCESS
12 = FAILED
13 = OUT_OF_GAS
Retrieve Source & Destination Chain ID
If you're working on the Mainnet environment, change "teib" to "eib".
The below command will output the status of the message with the specified hash, including the source and destination chain ID.
npx hardhat getChainIds --hash <teib_tx_hash> --network teib
Retrieve Initial msg.value
msg.value
If you're working on the Mainnet environment, change "teib" to "eib".
The below command will output the reward value of the specified hash.
npx hardhat getReward --hash <teib_tx_hash> --network teib
Retrieve Entire Message
If you're working on the Mainnet environment, change "teib" to "eib".
The below command will retrieve the full message, including status, nonce, and initial proposal.
npx hardhat getMsg --hash <teib_tx_hash> --network teib
Check Message Status by Hash
If you're working on the Mainnet environment, change "teib" to "eib".
To determine the current status of a sent message, execute the below command. If the transaction is found, the output will display its current status along with information from the initial proposal.
npx hardhat getMsgStatusByHash --hash <teib_tx_hash> --network teib
Checking Message Execution on Destination Endpoint
The below command will retrieve the execution status of the provided hash on the specified network. There are 3 possible execution statuses, described below.
npx hardhat getMsgExecution --hash <teib_tx_hash> --network <dest_network_name>
Status Codes
0 - Does not exist
1 - Executed
2 - Protocol failed
Retrieving the Last Received Message by Sender
To get the last received message using a sender address, execute the command below. If the message is found, it will output message length and the message itself in bytes, which is the decoded representation.
npx hardhat getLastMessage --sender <sender_address> --network <network_name>
Get Estimate Fee
To get estimated fee for message execution on destination chain + UIP commissions execute the below command.
npx hardhat estimateFee --srcchainid <source chain id> --destchainid <destination chain id> --gaslimit <custom gas limit>
Last updated
Was this helpful?