From 64e261abf85beec5394c8102a9a9751c9524f332 Mon Sep 17 00:00:00 2001 From: tre Date: Fri, 18 Oct 2024 11:42:32 -0700 Subject: [PATCH] feat(L2toL2CDM): improve gas estimation --- .../src/L2/L2ToL2CrossDomainMessenger.sol | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol b/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol index 0d7b46080fc93..95af6b00486cd 100644 --- a/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol @@ -10,6 +10,7 @@ import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomai import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { SafeCall } from "src/libraries/SafeCall.sol"; import { TransientReentrancyAware } from "src/libraries/TransientContext.sol"; +import { Constants } from "src/libraries/Constants.sol"; /// @notice Thrown when a non-written slot in transient storage is attempted to be read from. error NotEntered(); @@ -92,12 +93,6 @@ contract L2ToL2CrossDomainMessenger is IL2ToL2CrossDomainMessenger, ISemver, Tra /// @param messageHash Hash of the message that was relayed. event RelayedMessage(uint256 indexed source, uint256 indexed messageNonce, bytes32 indexed messageHash); - /// @notice Emitted whenever a message fails to be relayed on this chain. - /// @param source Chain ID of the source chain. - /// @param messageNonce Nonce associated with the messsage sent - /// @param messageHash Hash of the message that failed to be relayed. - event FailedRelayedMessage(uint256 indexed source, uint256 indexed messageNonce, bytes32 indexed messageHash); - /// @notice Retrieves the sender of the current cross domain message. If not entered, reverts. /// @return sender_ Address of the sender of the current cross domain message. function crossDomainMessageSender() external view onlyEntered returns (address sender_) { @@ -204,7 +199,7 @@ contract L2ToL2CrossDomainMessenger is IL2ToL2CrossDomainMessenger, ISemver, Tra successfulMessages[messageHash] = true; emit RelayedMessage(source, nonce, messageHash); } else { - emit FailedRelayedMessage(source, nonce, messageHash); + revert("L2ToL2CrossDomainMessenger: failed to relay message"); } _storeMessageMetadata(0, address(0));