Mask computed address in Create2 and Clones libraries (#4941)

Co-authored-by: ernestognw <ernestognw@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
Xenia
2024-03-25 14:33:45 +00:00
committed by GitHub
parent ad27fb654a
commit d398d68944
5 changed files with 43 additions and 2 deletions

View File

@ -82,7 +82,7 @@ library Create2 {
mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
mstore8(start, 0xff)
addr := keccak256(start, 85)
addr := and(keccak256(start, 85), 0xffffffffffffffffffffffffffffffffffffffff)
}
}
}