Skip to content

Commit

Permalink
Fix missing event in Wormhole chain id map update
Browse files Browse the repository at this point in the history
  • Loading branch information
ermyas committed Oct 8, 2023
1 parent 2799a18 commit f85f71e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/adapters/axelar/AxelarSenderAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "./interfaces/IAxelarGasService.sol";
import "./libraries/StringAddressConversion.sol";

contract AxelarSenderAdapter is BaseSenderAdapter {
/// @notice event emitted when chain id mapping is updated
event ChainIDMappingUpdated(uint256[] origIds, string[] axlIds);

string public constant name = "AXELAR";
Expand Down
4 changes: 4 additions & 0 deletions src/adapters/wormhole/WormholeSenderAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import "../../libraries/Types.sol";

/// @notice sender adapter for wormhole bridge
contract WormholeSenderAdapter is BaseSenderAdapter {
/// @notice event emitted when chain id mapping is updated
event ChainIDMappingUpdated(uint256[] origIds, uint16[] whIds);

string public constant name = "WORMHOLE";
IWormholeRelayer public immutable relayer;

Expand Down Expand Up @@ -86,5 +89,6 @@ contract WormholeSenderAdapter is BaseSenderAdapter {
++i;
}
}
emit ChainIDMappingUpdated(_origIds, _whIds);
}
}
5 changes: 5 additions & 0 deletions test/unit-tests/adapters/wormhole/WormholeSenderAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ contract WormholeSenderAdapterTest is Setup {
event MessageDispatched(
bytes32 indexed messageId, address indexed from, uint256 indexed receiverChainId, address to, bytes data
);
event ChainIDMappingUpdated(uint256[] origIds, uint16[] whIds);

address senderAddr;
WormholeSenderAdapter adapter;
Expand Down Expand Up @@ -105,6 +106,10 @@ contract WormholeSenderAdapterTest is Setup {
origIds[0] = DST_CHAIN_ID;
uint16[] memory whIds = new uint16[](1);
whIds[0] = 42;

vm.expectEmit(true, true, true, true, address(adapter));
emit ChainIDMappingUpdated(origIds, whIds);

adapter.setChainIdMap(origIds, whIds);

assertEq(adapter.chainIdMap(DST_CHAIN_ID), 42);
Expand Down

0 comments on commit f85f71e

Please sign in to comment.