Skip to content

Commit

Permalink
added more destriptive error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jun 11, 2024
1 parent ef0dc87 commit 1b6520a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/axelar/AxelarTransceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract AxelarTransceiver is IAxelarTransceiver, AxelarGMPExecutable, Transceiv
string memory destinationChain = slot.idToAxelarChainId[recipientChainId];

if (bytes(destinationChain).length == 0 || bytes(destinationContract).length == 0) {
revert InvalidChainId(recipientChainId);
revert InvalidChainId(recipientChainId, destinationChain, destinationContract);
}

bytes memory payload = abi.encode(nttManager, nttManagerMessage, recipientNttManagerAddress);
Expand Down
2 changes: 1 addition & 1 deletion src/axelar/interfaces/IAxelarTransceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface IAxelarTransceiver is ITransceiver {

/// @notice Chain Id passed is not valid.
/// @param chainId The wormhole chainId.
error InvalidChainId(uint16 chainId);
error InvalidChainId(uint16 chainId, string chainName, string destinationContract);

/// @notice Emmited when a transceiver message is sent.
/// @param recipientChainId The wormhole chainId of the destination chain.
Expand Down
4 changes: 3 additions & 1 deletion test/axelar/AxelarTransceiver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ contract AxelarTransceiverTest is Test {
TransceiverStructs.TransceiverInstruction(0, bytes(""));

vm.prank(address(manager));
vm.expectRevert(abi.encodeWithSignature("InvalidChainId(uint16)", chainId));
vm.expectRevert(
abi.encodeWithSignature("InvalidChainId(uint16,string,string)", chainId, "", "")
);
transceiver.sendMessage(
chainId, instruction, nttManagerMessage, recipientNttManagerAddress, refundAddress
);
Expand Down

0 comments on commit 1b6520a

Please sign in to comment.