-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor and test: addressing internal audit and adding full coverage
- Loading branch information
Showing
7 changed files
with
249 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,22 +13,17 @@ error IncorrectDataLength(uint256 expected, uint256 provided); | |
/// @param chainId Chain Id. | ||
error WrongSelector(bytes4 functionSig, uint256 chainId); | ||
|
||
/// @dev Provided wrong L2 bridge mediator address. | ||
/// @param provided Provided address. | ||
/// @param expected Expected address. | ||
error WrongL2BridgeMediator(address provided, address expected); | ||
|
||
/// @title ProcessBridgedDataArbitrum - Smart contract for verifying the Guard CM bridged data on Arbitrum | ||
/// @author Aleksandr Kuperman - <[email protected]> | ||
/// @author Andrey Lebedev - <[email protected]> | ||
/// @author Mariapia Moscatiello - <[email protected]> | ||
contract ProcessBridgedDataArbitrum is VerifyBridgedData { | ||
// unsafeCreateRetryableTicket selector in bridge mediator L1 | ||
bytes4 public constant CREATE_TICKET_UNSAFE = bytes4(keccak256(bytes("unsafeCreateRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,uint256,bytes)"))); | ||
bytes4 public constant CREATE_TICKET_UNSAFE = bytes4(keccak256(bytes("unsafeCreateRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,bytes)"))); | ||
// createRetryableTicket selector in bridge mediator L1 | ||
bytes4 public constant CREATE_TICKET = bytes4(keccak256(bytes("createRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,uint256,bytes)"))); | ||
bytes4 public constant CREATE_TICKET = bytes4(keccak256(bytes("createRetryableTicket(address,uint256,uint256,address,address,uint256,uint256,bytes)"))); | ||
// Minimum payload length for message on Arbitrum accounting for all required encoding and at least one selector | ||
uint256 public constant MIN_ARBITRUM_PAYLOAD_LENGTH = 584; | ||
uint256 public constant MIN_ARBITRUM_PAYLOAD_LENGTH = 324; | ||
|
||
/// @dev Processes bridged data: checks the header and verifies the payload. | ||
/// @param data Full data bytes with the header. | ||
|
@@ -57,8 +52,8 @@ contract ProcessBridgedDataArbitrum is VerifyBridgedData { | |
} | ||
|
||
// Decode the payload depending on the selector | ||
(address targetAddress, , , , , , , , bytes memory targetPayload) = | ||
abi.decode(payload, (address, uint256, uint256, address, address, uint256, uint256, uint256, bytes)); | ||
(address targetAddress, , , , , , , bytes memory targetPayload) = | ||
abi.decode(payload, (address, uint256, uint256, address, address, uint256, uint256, bytes)); | ||
|
||
// Verify the scope of the data | ||
_verifyData(targetAddress, targetPayload, chainId); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.