Skip to content

Commit 093d219

Browse files
authored
♻️ ERC7821 Swiss cheese dirty upper bits cleaning (#1454)
1 parent 700840b commit 093d219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/accounts/ERC7821.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ contract ERC7821 is Receiver {
235235
assembly {
236236
let c := add(calls.offset, calldataload(add(calls.offset, shl(5, i))))
237237
// Replaces `to` with `address(this)` if `address(0)` is provided.
238-
// We'll skip cleaning the upper 96 bits of `to` as it is ignored in `call`.
239-
to := or(mul(address(), iszero(calldataload(c))), calldataload(c))
238+
let t := shr(96, shl(96, calldataload(c)))
239+
to := or(mul(address(), iszero(t)), t)
240240
value := calldataload(add(c, 0x20))
241241
let o := add(c, calldataload(add(c, 0x40)))
242242
data.offset := add(o, 0x20)

0 commit comments

Comments
 (0)