@@ -358,10 +358,9 @@ contract Bridge is EssentialContract, IBridge {
358
358
whenNotPaused
359
359
sameChain (message.destChainId)
360
360
{
361
- // If isLastAttempt is true, the caller must be the message.owner.
362
- // TODO(Brecht): why not allow anyone to call when message.gasLimit == 0?
363
- // There is no fee to be earned, and there won't be any gas limit anyway.
364
- if (isLastAttempt) {
361
+ // If the gasLimit is set to 0 or isLastAttempt is true, the caller must
362
+ // be the message.owner.
363
+ if (message.gasLimit == 0 || isLastAttempt) {
365
364
if (msg .sender != message.owner) revert B_PERMISSION_DENIED ();
366
365
}
367
366
@@ -544,37 +543,13 @@ contract Bridge is EssentialContract, IBridge {
544
543
}
545
544
}
546
545
547
- /// @notice Checks if the signal was received.
548
- /// @param signalService The signalService
549
- /// @param signal The signal.
550
- /// @param chainId The ID of the chain the signal is stored on
551
- /// @param proof The merkle inclusion proof.
552
- /// @return True if the message was received.
553
- function _proveSignalReceived (
554
- address signalService ,
555
- bytes32 signal ,
556
- uint64 chainId ,
557
- bytes calldata proof
558
- )
559
- private
560
- view
561
- returns (bool )
562
- {
563
- bytes memory data = abi.encodeCall (
564
- ISignalService.proveSignalReceived,
565
- (chainId, resolve (chainId, "bridge " , false ), signal, proof)
566
- );
567
- (bool success , bytes memory ret ) = signalService.staticcall (data);
568
- return success ? abi.decode (ret, (bool )) : false ;
569
- }
570
-
571
546
/// @notice Resets the call context
572
- function _resetContext () internal {
547
+ function _resetContext () private {
573
548
_storeContext (bytes32 (0 ), address (0 ), uint64 (0 ));
574
549
}
575
550
576
551
/// @notice Stores the call context
577
- function _storeContext (bytes32 msgHash , address from , uint64 srcChainId ) internal {
552
+ function _storeContext (bytes32 msgHash , address from , uint64 srcChainId ) private {
578
553
assembly {
579
554
tstore (_CTX_SLOT, msgHash)
580
555
tstore (add (_CTX_SLOT, 1 ), from)
@@ -583,7 +558,7 @@ contract Bridge is EssentialContract, IBridge {
583
558
}
584
559
585
560
/// @notice Loads the call context
586
- function _loadContext () internal view returns (Context memory ) {
561
+ function _loadContext () private view returns (Context memory ) {
587
562
bytes32 msgHash;
588
563
address from;
589
564
uint64 srcChainId;
@@ -594,4 +569,28 @@ contract Bridge is EssentialContract, IBridge {
594
569
}
595
570
return Context ({ msgHash: msgHash, from: from, srcChainId: srcChainId });
596
571
}
572
+
573
+ /// @notice Checks if the signal was received.
574
+ /// @param signalService The signalService
575
+ /// @param signal The signal.
576
+ /// @param chainId The ID of the chain the signal is stored on
577
+ /// @param proof The merkle inclusion proof.
578
+ /// @return True if the message was received.
579
+ function _proveSignalReceived (
580
+ address signalService ,
581
+ bytes32 signal ,
582
+ uint64 chainId ,
583
+ bytes calldata proof
584
+ )
585
+ private
586
+ view
587
+ returns (bool )
588
+ {
589
+ bytes memory data = abi.encodeCall (
590
+ ISignalService.proveSignalReceived,
591
+ (chainId, resolve (chainId, "bridge " , false ), signal, proof)
592
+ );
593
+ (bool success , bytes memory ret ) = signalService.staticcall (data);
594
+ return success ? abi.decode (ret, (bool )) : false ;
595
+ }
597
596
}
0 commit comments