From ac67894e0f4cb6a9dacf870a29a9c6bd43840719 Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:00:51 -0500 Subject: [PATCH] improve: L06 Inconsistent And Misleading Events Emitted When Bridging To HubPool (#21) --- contracts/Arbitrum_SpokePool.sol | 2 -- contracts/Linea_SpokePool.sol | 3 --- contracts/Ovm_SpokePool.sol | 3 --- contracts/PolygonZkEVM_SpokePool.sol | 1 - contracts/Polygon_SpokePool.sol | 2 -- contracts/Scroll_SpokePool.sol | 2 -- contracts/ZkSync_SpokePool.sol | 2 -- 7 files changed, 15 deletions(-) diff --git a/contracts/Arbitrum_SpokePool.sol b/contracts/Arbitrum_SpokePool.sol index 47b5d089a..5a4c305cd 100644 --- a/contracts/Arbitrum_SpokePool.sol +++ b/contracts/Arbitrum_SpokePool.sol @@ -27,7 +27,6 @@ contract Arbitrum_SpokePool is SpokePool, CircleCCTPAdapter { // are necessary params used when bridging tokens to L1. mapping(address => address) public whitelistedTokens; - event ArbitrumTokensBridged(address indexed l1Token, address target, uint256 numberOfTokensBridged); event SetL2GatewayRouter(address indexed newL2GatewayRouter); event WhitelistedTokens(address indexed l2Token, address indexed l1Token); @@ -107,7 +106,6 @@ contract Arbitrum_SpokePool is SpokePool, CircleCCTPAdapter { "" // _data. We don't need to send any data for the bridging action. ); } - emit ArbitrumTokensBridged(address(0), hubPool, amountToReturn); } function _setL2GatewayRouter(address _l2GatewayRouter) internal { diff --git a/contracts/Linea_SpokePool.sol b/contracts/Linea_SpokePool.sol index efa921c0f..199fa6dab 100644 --- a/contracts/Linea_SpokePool.sol +++ b/contracts/Linea_SpokePool.sol @@ -105,7 +105,6 @@ contract Linea_SpokePool is SpokePool { /************************************** * EVENTS * **************************************/ - event LineaTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged); event SetL2TokenBridge(address indexed newTokenBridge, address oldTokenBridge); event SetL2MessageService(address indexed newMessageService, address oldMessageService); event SetL2UsdcBridge(address indexed newUsdcBridge, address oldUsdcBridge); @@ -231,8 +230,6 @@ contract Linea_SpokePool is SpokePool { IERC20(l2TokenAddress).safeIncreaseAllowance(address(l2TokenBridge), amountToReturn); l2TokenBridge.bridgeToken{ value: msg.value }(l2TokenAddress, amountToReturn, hubPool); } - - emit LineaTokensBridged(l2TokenAddress, hubPool, amountToReturn); } function _requireAdminSender() internal view override { diff --git a/contracts/Ovm_SpokePool.sol b/contracts/Ovm_SpokePool.sol index 22d3a6622..8df5b772c 100644 --- a/contracts/Ovm_SpokePool.sol +++ b/contracts/Ovm_SpokePool.sol @@ -48,7 +48,6 @@ contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter { // to support non-standard ERC20 tokens on Optimism, such as DIA and SNX which both use custom bridges. mapping(address => address) public tokenBridges; - event OptimismTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged, uint256 l1Gas); event SetL1Gas(uint32 indexed newL1Gas); event SetL2TokenBridge(address indexed l2Token, address indexed tokenBridge); @@ -166,8 +165,6 @@ contract Ovm_SpokePool is SpokePool, CircleCCTPAdapter { l1Gas, // _l1Gas. Unused, but included for potential forward compatibility considerations "" // _data. We don't need to send any data for the bridging action. ); - - emit OptimismTokensBridged(l2TokenAddress, hubPool, amountToReturn, l1Gas); } // Apply OVM-specific transformation to cross domain admin address on L1. diff --git a/contracts/PolygonZkEVM_SpokePool.sol b/contracts/PolygonZkEVM_SpokePool.sol index 62e106e33..51bfe002d 100644 --- a/contracts/PolygonZkEVM_SpokePool.sol +++ b/contracts/PolygonZkEVM_SpokePool.sol @@ -54,7 +54,6 @@ contract PolygonZkEVM_SpokePool is SpokePool, IBridgeMessageReceiver { * EVENTS * **************************************/ event SetPolygonZkEVMBridge(address indexed newPolygonZkEVMBridge, address indexed oldPolygonZkEVMBridge); - event PolygonZkEVMTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged); event ReceivedMessageFromL1(address indexed caller, address indexed originAddress); // Note: validating calls this way ensures that strange calls coming from the onMessageReceived won't be diff --git a/contracts/Polygon_SpokePool.sol b/contracts/Polygon_SpokePool.sol index f04b2994b..dc54a9ef9 100644 --- a/contracts/Polygon_SpokePool.sol +++ b/contracts/Polygon_SpokePool.sol @@ -56,7 +56,6 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter bytes32 private constant FILL_LOCK_IDENTIFIER = "Fill"; bytes32 private constant EXECUTE_LOCK_IDENTIFIER = "Execute"; - event PolygonTokensBridged(address indexed token, address indexed receiver, uint256 amount); event SetFxChild(address indexed newFxChild); event SetPolygonTokenBridger(address indexed polygonTokenBridger); event ReceivedMessageFromL1(address indexed caller, address indexed rootMessageSender); @@ -247,7 +246,6 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter // Note: WrappedNativeToken is WMATIC on matic, so this tells the tokenbridger that this is an unwrappable native token. polygonTokenBridger.send(PolygonIERC20Upgradeable(l2TokenAddress), amountToReturn); } - emit PolygonTokensBridged(l2TokenAddress, address(this), amountToReturn); } function _wrap() internal { diff --git a/contracts/Scroll_SpokePool.sol b/contracts/Scroll_SpokePool.sol index 4927fc4b2..00464d402 100644 --- a/contracts/Scroll_SpokePool.sol +++ b/contracts/Scroll_SpokePool.sol @@ -27,7 +27,6 @@ contract Scroll_SpokePool is SpokePool { * EVENTS * **************************************/ - event ScrollTokensBridged(address indexed token, address indexed receiver, uint256 amount); event SetL2GatewayRouter(address indexed newGatewayRouter, address oldGatewayRouter); event SetL2ScrollMessenger(address indexed newScrollMessenger, address oldScrollMessenger); @@ -101,7 +100,6 @@ contract Scroll_SpokePool is SpokePool { // See: https://github.com/scroll-tech/scroll/blob/0a8164ee5b63ed5d3bd5e7b39d91445a3176e142/contracts/src/L2/gateways/IL2ERC20Gateway.sol#L69-L80 0 ); - emit ScrollTokensBridged(l2TokenAddress, hubPool, amountToReturn); } /** diff --git a/contracts/ZkSync_SpokePool.sol b/contracts/ZkSync_SpokePool.sol index d340dafb1..a96bc0734 100644 --- a/contracts/ZkSync_SpokePool.sol +++ b/contracts/ZkSync_SpokePool.sol @@ -33,7 +33,6 @@ contract ZkSync_SpokePool is SpokePool { ZkBridgeLike public zkErc20Bridge; event SetZkBridge(address indexed erc20Bridge, address indexed oldErc20Bridge); - event ZkSyncTokensBridged(address indexed l2Token, address target, uint256 numberOfTokensBridged); /// @custom:oz-upgrades-unsafe-allow constructor constructor( @@ -110,7 +109,6 @@ contract ZkSync_SpokePool is SpokePool { } else { zkErc20Bridge.withdraw(hubPool, l2TokenAddress, amountToReturn); } - emit ZkSyncTokensBridged(l2TokenAddress, hubPool, amountToReturn); } function _setZkBridge(ZkBridgeLike _zkErc20Bridge) internal {