Skip to content

Commit 6d88b35

Browse files
committed
Use EXTCODEHASH instead of EXTCODESIZE
1 parent cfd0bad commit 6d88b35

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/deployer/Deployer.sol

+8-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ contract Deployer is TwoStepOwnable {
105105
mstore(add(ptr, initCode.length), _feeCollector)
106106
deployed := create(callvalue(), ptr, add(initCode.length, 0x20))
107107
}
108-
if (deployed == address(0) || deployed.code.length == 0) {
108+
if (
109+
deployed == address(0)
110+
|| deployed.codehash == 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
111+
) {
109112
revert DeployFailed();
110113
}
111114
emit Deployed(newNonce, deployed);
@@ -133,7 +136,10 @@ contract Deployer is TwoStepOwnable {
133136
unchecked {
134137
for (uint64 i = nonce; i != 0; --i) {
135138
address instance = AddressDerivation.deriveContract(address(this), i);
136-
if (!isUnsafe[instance] && instance.code.length > 0) {
139+
if (
140+
!isUnsafe[instance]
141+
&& instance.codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
142+
) {
137143
return instance;
138144
}
139145
}

0 commit comments

Comments
 (0)