diff --git a/src/adapters/axelar/AxelarSenderAdapter.sol b/src/adapters/axelar/AxelarSenderAdapter.sol index b383abb..91889c6 100644 --- a/src/adapters/axelar/AxelarSenderAdapter.sol +++ b/src/adapters/axelar/AxelarSenderAdapter.sol @@ -26,6 +26,10 @@ contract AxelarSenderAdapter is BaseSenderAdapter { CONSTRUCTOR ////////////////////////////////////////////////////////////////*/ constructor(address _gasService, address _gateway, address _gac) BaseSenderAdapter(_gac) { + if (_gasService == address(0) || _gateway == address(0)) { + revert Error.ZERO_ADDRESS_INPUT(); + } + gasService = IAxelarGasService(_gasService); gateway = IAxelarGateway(_gateway); } diff --git a/src/adapters/wormhole/WormholeSenderAdapter.sol b/src/adapters/wormhole/WormholeSenderAdapter.sol index 38504cf..f1277d1 100644 --- a/src/adapters/wormhole/WormholeSenderAdapter.sol +++ b/src/adapters/wormhole/WormholeSenderAdapter.sol @@ -24,6 +24,9 @@ contract WormholeSenderAdapter is BaseSenderAdapter { CONSTRUCTOR ////////////////////////////////////////////////////////////////*/ constructor(address _wormholeRelayer, address _gac) BaseSenderAdapter(_gac) { + if (_wormholeRelayer == address(0)) { + revert Error.ZERO_ADDRESS_INPUT(); + } relayer = IWormholeRelayer(_wormholeRelayer); } diff --git a/test/unit-tests/adapters/axelar/AxelarSenderAdapter.t.sol b/test/unit-tests/adapters/axelar/AxelarSenderAdapter.t.sol index 7e817ac..3f83b87 100644 --- a/test/unit-tests/adapters/axelar/AxelarSenderAdapter.t.sol +++ b/test/unit-tests/adapters/axelar/AxelarSenderAdapter.t.sol @@ -34,6 +34,24 @@ contract AxelarSenderAdapterTest is Setup { assertEq(address(adapter.senderGAC()), contractAddress[SRC_CHAIN_ID]["GAC"]); } + /// @dev constructor cannot be called with zero address gas service + function test_constructor_zero_address_relayer() public { + vm.expectRevert(Error.ZERO_ADDRESS_INPUT.selector); + new AxelarSenderAdapter(address(0), address(42), address(42)); + } + + /// @dev constructor cannot be called with zero address gateway + function test_constructor_zero_address_gateway() public { + vm.expectRevert(Error.ZERO_ADDRESS_INPUT.selector); + new AxelarSenderAdapter(address(42), address(0), address(42)); + } + + /// @dev constructor cannot be called with zero address GAC + function test_constructor_zero_address_gac() public { + vm.expectRevert(Error.ZERO_ADDRESS_INPUT.selector); + new AxelarSenderAdapter(address(42), address(42), address(0)); + } + /// @dev dispatches message function test_dispatch_message() public { vm.startPrank(senderAddr); diff --git a/test/unit-tests/adapters/wormhole/WormholeSenderAdapter.t.sol b/test/unit-tests/adapters/wormhole/WormholeSenderAdapter.t.sol index 58ad9b5..672c52d 100644 --- a/test/unit-tests/adapters/wormhole/WormholeSenderAdapter.t.sol +++ b/test/unit-tests/adapters/wormhole/WormholeSenderAdapter.t.sol @@ -33,6 +33,18 @@ contract WormholeSenderAdapterTest is Setup { assertEq(address(adapter.senderGAC()), contractAddress[SRC_CHAIN_ID]["GAC"]); } + /// @dev constructor cannot be called with zero address relayer + function test_constructor_zero_address_relayer() public { + vm.expectRevert(Error.ZERO_ADDRESS_INPUT.selector); + new WormholeSenderAdapter(address(0), address(42)); + } + + /// @dev constructor cannot be called with zero address GAC + function test_constructor_zero_address_gac() public { + vm.expectRevert(Error.ZERO_ADDRESS_INPUT.selector); + new WormholeSenderAdapter(address(42), address(0)); + } + /// @dev dispatches message function test_dispatch_message() public { vm.startPrank(senderAddr);