-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,21 +131,19 @@ contract FastBridgeV2 is Admin, IFastBridgeV2 { | |
|
||
/// @inheritdoc IFastBridgeV2 | ||
function relay(bytes memory request, address relayer) public payable { | ||
if (relayer == address(0)) revert ZeroAddress(); | ||
bytes32 transactionId = keccak256(request); | ||
BridgeTransaction memory transaction = getBridgeTransaction(request); | ||
if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect(); | ||
|
||
// check haven't exceeded deadline for relay to happen | ||
if (block.timestamp > transaction.deadline) revert DeadlineExceeded(); | ||
|
||
if (bridgeRelayDetails[transactionId].relayer != address(0)) revert TransactionRelayed(); | ||
|
||
// mark bridge transaction as relayed | ||
if (bridgeRelayDetails[transactionId].blockNumber != 0) revert TransactionRelayed(); | ||
|
||
bridgeRelayDetails[transactionId] = BridgeRelay({ | ||
blockNumber: uint48(block.number), | ||
blockTimestamp: uint48(block.timestamp), | ||
relayer: relayer | ||
}); | ||
bridgeRelayDetails[transactionId] = | ||
BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer}); | ||
|
||
// transfer tokens to recipient on destination chain and gas rebate if requested | ||
address to = transaction.destRecipient; | ||
|
@@ -178,11 +176,11 @@ contract FastBridgeV2 is Admin, IFastBridgeV2 { | |
rebate | ||
); | ||
} | ||
|
||
/// @inheritdoc IFastBridgeV2 | ||
function bridgeRelays(bytes32 transactionId) external view returns (bool) { | ||
function bridgeRelays(bytes32 transactionId) public view returns (bool) { | ||
// has this transactionId been relayed? | ||
return bridgeRelayDetails[transactionId].blockNumber != 0; | ||
return bridgeRelayDetails[transactionId].relayer != address(0); | ||
} | ||
Check notice Code scanning / Slither Block timestamp Low
FastBridgeV2.bridgeRelays(bytes32) uses timestamp for comparisons
Dangerous comparisons: - bridgeRelayDetails[transactionId].relayer != address(0) |
||
|
||
/// @inheritdoc IFastBridge | ||
|
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