Skip to content

Commit 4337192

Browse files
Amxxfrangio
andcommitted
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 <[email protected]> (cherry picked from commit 81336ae)
1 parent 41c7b25 commit 4337192

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 4.7.2
4+
5+
* `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))
6+
37
## 4.7.1 (2022-07-19)
48

59
* `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))

contracts/crosschain/arbitrum/LibArbitrumL2.sol

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ library LibArbitrumL2 {
2121
address public constant ARBSYS = 0x0000000000000000000000000000000000000064;
2222

2323
function isCrossChain(address arbsys) internal view returns (bool) {
24-
return ArbitrumL2_Bridge(arbsys).isTopLevelCall();
24+
return ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased();
2525
}
2626

2727
/**
@@ -35,9 +35,6 @@ library LibArbitrumL2 {
3535
function crossChainSender(address arbsys) internal view returns (address) {
3636
if (!isCrossChain(arbsys)) revert NotCrossChainCall();
3737

38-
return
39-
ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased()
40-
? ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing()
41-
: msg.sender;
38+
return ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing();
4239
}
4340
}

contracts/mocks/crosschain/bridges.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,10 @@ contract BridgeArbitrumL1Outbox {
7070
}
7171

7272
contract BridgeArbitrumL2Mock is BaseRelayMock {
73-
function isTopLevelCall() public view returns (bool) {
73+
function wasMyCallersAddressAliased() public view returns (bool) {
7474
return _currentSender != address(0);
7575
}
7676

77-
function wasMyCallersAddressAliased() public pure returns (bool) {
78-
return true;
79-
}
80-
8177
function myCallersAddressWithoutAliasing() public view returns (address) {
8278
return _currentSender;
8379
}

0 commit comments

Comments
 (0)