From 81336aefb52d5777cd140cf2eac31fdf65d9bc95 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Mon, 25 Jul 2022 22:42:37 +0200 Subject: [PATCH] Fix arbitrum L1 to L2 crosschain call detection (#3578) * Fix arbitrum L1 to L2 crosschain call detection * fix BridgeArbitrumL2Mock * update changelog Co-authored-by: Francisco Giordano --- CHANGELOG.md | 4 ++++ contracts/crosschain/arbitrum/LibArbitrumL2.sol | 7 ++----- contracts/mocks/crosschain/bridges.sol | 6 +----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1200341c93..5a147482a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ ERC-721 integrators that interpret contract state from events should make sure that they implement the clearing of approval that is implicit in every transfer according to the EIP. Previous versions of OpenZeppellin Contracts emitted an explicit `Approval` event even though it was not required by the specification, and this is no longer the case. +## 4.7.2 + + * `LibArbitrumL2`, `CrossChainEnabledArbitrumL2`: Fixed detection of cross-chain calls for EOAs. Previously, calls from EOAs would be classified as cross-chain calls. ([#3578](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3578)) + ## 4.7.1 * `SignatureChecker`: Fix an issue that causes `isValidSignatureNow` to revert when the target contract returns ill-encoded data. ([#3552](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3552)) diff --git a/contracts/crosschain/arbitrum/LibArbitrumL2.sol b/contracts/crosschain/arbitrum/LibArbitrumL2.sol index 1410afd30f2..6db146ecae7 100644 --- a/contracts/crosschain/arbitrum/LibArbitrumL2.sol +++ b/contracts/crosschain/arbitrum/LibArbitrumL2.sol @@ -21,7 +21,7 @@ library LibArbitrumL2 { address public constant ARBSYS = 0x0000000000000000000000000000000000000064; function isCrossChain(address arbsys) internal view returns (bool) { - return ArbitrumL2_Bridge(arbsys).isTopLevelCall(); + return ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased(); } /** @@ -35,9 +35,6 @@ library LibArbitrumL2 { function crossChainSender(address arbsys) internal view returns (address) { if (!isCrossChain(arbsys)) revert NotCrossChainCall(); - return - ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased() - ? ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing() - : msg.sender; + return ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing(); } } diff --git a/contracts/mocks/crosschain/bridges.sol b/contracts/mocks/crosschain/bridges.sol index 1339f4371c0..35c7f4c0625 100644 --- a/contracts/mocks/crosschain/bridges.sol +++ b/contracts/mocks/crosschain/bridges.sol @@ -70,14 +70,10 @@ contract BridgeArbitrumL1Outbox { } contract BridgeArbitrumL2Mock is BaseRelayMock { - function isTopLevelCall() public view returns (bool) { + function wasMyCallersAddressAliased() public view returns (bool) { return _currentSender != address(0); } - function wasMyCallersAddressAliased() public pure returns (bool) { - return true; - } - function myCallersAddressWithoutAliasing() public view returns (address) { return _currentSender; }