Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): revert Bridge receive() checks #13128

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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