Labels: medium-difficulty, yul, security, gasguard
Difficulty: Medium
Module: contracts/utils/
🧠 Concept
Replace high-level .code.length checks with a dedicated Yul helper that evaluates extcodesize directly.
⚠️ Problem
High-level contract checks in Solidity create additional stack management instructions before executing the extcodesize opcode.
📁 Implementation Scope
contracts/utils/CodeCheckLib.sol
test/utils/CodeCheckLib.test.ts
🛠️ Requirements
- Implement
isContract(address target) returns (bool result) using inline Yul:
result := gt(extcodesize(target), 0)
- Ensure function is declared
internal pure.
🎯 Acceptance Criteria
Labels:
medium-difficulty,yul,security,gasguardDifficulty: Medium
Module:
contracts/utils/🧠 Concept
Replace high-level
.code.lengthchecks with a dedicated Yul helper that evaluatesextcodesizedirectly.High-level contract checks in Solidity create additional stack management instructions before executing the
extcodesizeopcode.📁 Implementation Scope
contracts/utils/CodeCheckLib.soltest/utils/CodeCheckLib.test.ts🛠️ Requirements
isContract(address target) returns (bool result)using inline Yul:result := gt(extcodesize(target), 0)internal pure.🎯 Acceptance Criteria