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 <frangio.1@gmail.com>
(cherry picked from commit 81336aefb5)
This commit is contained in:
committed by
Francisco Giordano
parent
41c7b25a65
commit
4337192dc0
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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 (2022-07-19)
|
## 4.7.1 (2022-07-19)
|
||||||
|
|
||||||
* `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))
|
* `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))
|
||||||
|
|||||||
@ -21,7 +21,7 @@ library LibArbitrumL2 {
|
|||||||
address public constant ARBSYS = 0x0000000000000000000000000000000000000064;
|
address public constant ARBSYS = 0x0000000000000000000000000000000000000064;
|
||||||
|
|
||||||
function isCrossChain(address arbsys) internal view returns (bool) {
|
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) {
|
function crossChainSender(address arbsys) internal view returns (address) {
|
||||||
if (!isCrossChain(arbsys)) revert NotCrossChainCall();
|
if (!isCrossChain(arbsys)) revert NotCrossChainCall();
|
||||||
|
|
||||||
return
|
return ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing();
|
||||||
ArbitrumL2_Bridge(arbsys).wasMyCallersAddressAliased()
|
|
||||||
? ArbitrumL2_Bridge(arbsys).myCallersAddressWithoutAliasing()
|
|
||||||
: msg.sender;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,14 +70,10 @@ contract BridgeArbitrumL1Outbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contract BridgeArbitrumL2Mock is BaseRelayMock {
|
contract BridgeArbitrumL2Mock is BaseRelayMock {
|
||||||
function isTopLevelCall() public view returns (bool) {
|
function wasMyCallersAddressAliased() public view returns (bool) {
|
||||||
return _currentSender != address(0);
|
return _currentSender != address(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function wasMyCallersAddressAliased() public pure returns (bool) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function myCallersAddressWithoutAliasing() public view returns (address) {
|
function myCallersAddressWithoutAliasing() public view returns (address) {
|
||||||
return _currentSender;
|
return _currentSender;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user