@@ -21,9 +21,10 @@ pragma solidity 0.8.23;
2121import { IWormhole } from "../../lib/wormhole/ethereum/contracts/interfaces/IWormhole.sol " ;
2222import { IColonyNetwork } from "../colonyNetwork/IColonyNetwork.sol " ;
2323import { IColonyBridge } from "./IColonyBridge.sol " ;
24+ import { CallWithGuards } from "../common/CallWithGuards.sol " ;
2425import { DSAuth } from "../../lib/dappsys/auth.sol " ;
2526
26- contract WormholeBridgeForColony is DSAuth , IColonyBridge {
27+ contract WormholeBridgeForColony is DSAuth , IColonyBridge , CallWithGuards {
2728 address colonyNetwork;
2829 // ChainId => colonyBridge
2930 mapping (uint256 => address ) colonyBridges;
@@ -100,22 +101,15 @@ contract WormholeBridgeForColony is DSAuth, IColonyBridge {
100101
101102 // Do the thing
102103
103- (bool success , bytes memory returndata ) = address (colonyNetwork).call (wormholeMessage.payload);
104+ (bool success , bytes memory returndata ) = callWithGuards (
105+ colonyNetwork,
106+ wormholeMessage.payload
107+ );
108+ // Note that this is not a require because returndata might not be a string, and if we try
109+ // to decode it we'll get a revert.
104110 if (! success) {
105- // Stolen shamelessly from
106- // https://ethereum.stackexchange.com/questions/83528/how-can-i-get-the-revert-reason-of-a-call-in-solidity-so-that-i-can-use-it-in-th
107- // If the _res length is less than 68, then the transaction failed silently (without a revert message)
108- if (returndata.length >= 68 ) {
109- assembly {
110- // Slice the sighash.
111- returndata := add (returndata, 0x04 )
112- }
113- require (false , abi.decode (returndata, (string ))); // All that remains is the revert string
114- }
115- require (false , "require-execute-call-reverted-with-no-error " );
111+ revert (abi.decode (returndata, (string )));
116112 }
117-
118- require (success, "wormhole-bridge-receive-message-failed " );
119113 }
120114
121115 function sendMessage (
0 commit comments