Skip to content

[PERF] Implement Gas-Optimized Contract Existence Check in Yul #660

Description

@mijinummi

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

  1. Implement isContract(address target) returns (bool result) using inline Yul:
    result := gt(extcodesize(target), 0)
  2. Ensure function is declared internal pure.

🎯 Acceptance Criteria

  • Provides fast, gas-efficient verification of deployment status for target addresses.
  • Operates cleanly across local unit tests and testnets.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions