From 29b5dbeadee54abab539c866b8df265c3adf8ee6 Mon Sep 17 00:00:00 2001 From: Vectorized Date: Tue, 18 Feb 2025 03:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Fix=20CallContextChecker?= =?UTF-8?q?=20EIP-7702=20check=20(#1356)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/CallContextChecker.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/CallContextChecker.sol b/src/utils/CallContextChecker.sol index 080b3be55..2408f99e4 100644 --- a/src/utils/CallContextChecker.sol +++ b/src/utils/CallContextChecker.sol @@ -35,8 +35,9 @@ contract CallContextChecker { /// @solidity memory-safe-assembly assembly { extcodecopy(address(), 0x00, 0x00, 0x20) - result := - and(eq(0xef0100, shr(232, mload(0x00))), lt(sub(extcodesize(address()), 1), 23)) + // Note: checking that it starts with hex"ef01" is the most general and futureproof. + // 7702 bytecode is `abi.encodePacked(hex"ef01", uint8(version), address(delegation))`. + result := eq(0xef01, shr(240, mload(0x00))) } }