Skip to content

Commit

Permalink
feat(protocol): revert Bridge receive() checks (#13128)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Feb 10, 2023
1 parent 3f6aa52 commit 675611d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 3 additions & 6 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ contract Bridge is EssentialContract, IBridge {

event MessageStatusChanged(
bytes32 indexed msgHash,
LibBridgeStatus.MessageStatus status
LibBridgeStatus.MessageStatus status,
address transactor
);

event DestChainEnabled(uint256 indexed chainId, bool enabled);
Expand All @@ -48,11 +49,7 @@ contract Bridge is EssentialContract, IBridge {

/// Allow Bridge to receive ETH from the TokenVault or EtherVault.
receive() external payable {
// Ensure the sender is either the Ether vault or the token vault.
require(
msg.sender == this.resolve("token_vault", false) ||
msg.sender == this.resolve("ether_vault", true)
);
// TODO(dave,PR#13110): require the sender is the TokenVault or EtherVault
}

/// @dev Initializer to be called after being deployed behind a proxy.
Expand Down
12 changes: 10 additions & 2 deletions packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ library LibBridgeStatus {
FAILED
}

event MessageStatusChanged(bytes32 indexed msgHash, MessageStatus status);
event MessageStatusChanged(
bytes32 indexed msgHash,
MessageStatus status,
address transactor
);

/**
* @dev If messageStatus is same as in the messageStatus mapping,
Expand All @@ -38,7 +42,11 @@ library LibBridgeStatus {
) internal {
if (getMessageStatus(msgHash) != status) {
_setMessageStatus(msgHash, status);
emit LibBridgeStatus.MessageStatusChanged(msgHash, status);
emit LibBridgeStatus.MessageStatusChanged(
msgHash,
status,
msg.sender
);
}
}

Expand Down

0 comments on commit 675611d

Please sign in to comment.