Skip to content

Commit

Permalink
Add zero address checks for L*BitcoinDepositor initializers (#805)
Browse files Browse the repository at this point in the history
Depends on: #804

Here we add the missing zero-address checks to prevent incorrectly set
values.
  • Loading branch information
tomaszslabon authored Apr 3, 2024
2 parents d98594c + ef2da9a commit 26f87a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions solidity/contracts/l2/L1BitcoinDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ contract L1BitcoinDepositor is
__AbstractTBTCDepositor_initialize(_tbtcBridge, _tbtcVault);
__Ownable_init();

require(_wormhole != address(0), "Wormhole address cannot be zero");
require(
_wormholeRelayer != address(0),
"WormholeRelayer address cannot be zero"
);
require(
_wormholeTokenBridge != address(0),
"WormholeTokenBridge address cannot be zero"
);
require(
_l2WormholeGateway != address(0),
"L2WormholeGateway address cannot be zero"
);

tbtcToken = IERC20Upgradeable(ITBTCVault(_tbtcVault).tbtcToken());
wormhole = IWormhole(_wormhole);
wormholeRelayer = IWormholeRelayer(_wormholeRelayer);
Expand Down
9 changes: 9 additions & 0 deletions solidity/contracts/l2/L2BitcoinDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ contract L2BitcoinDepositor is IWormholeReceiver, OwnableUpgradeable {
) external initializer {
__Ownable_init();

require(
_wormholeRelayer != address(0),
"WormholeRelayer address cannot be zero"
);
require(
_l2WormholeGateway != address(0),
"L2WormholeGateway address cannot be zero"
);

wormholeRelayer = IWormholeRelayer(_wormholeRelayer);
l2WormholeGateway = IL2WormholeGateway(_l2WormholeGateway);
l1ChainId = _l1ChainId;
Expand Down

0 comments on commit 26f87a6

Please sign in to comment.