Skip to content

[CORE] Implement Zero-Overhead Universal Delegatecall Forwarder in Yul #691

Description

@mijinummi

Labels: high-difficulty, yul, proxy, gasguard
Difficulty: High
Module: contracts/proxy/


🧠 Concept

Construct a minimal delegatecall forwarder contract entirely in Yul assembly that forwards incoming calldata directly to implementation logic and returns outputs transparently.

⚠️ Problem

High-level proxy router implementations introduce stack manipulation instructions, increasing execution overhead on every proxied transaction.

📁 Implementation Scope

  • contracts/proxy/YulProxyForwarder.sol
  • test/proxy/YulProxyForwarder.test.ts

🛠️ Requirements

  1. Copy incoming calldata to memory location 0x00 using calldatacopy(0, 0, calldatasize()).
  2. Execute delegatecall(gas(), implementation, 0, calldatasize(), 0, 0).
  3. Copy return payload using returndatacopy and execute return or revert.

🎯 Acceptance Criteria

  • Proxy forwarding overhead stays under $100\text{ gas}$ per invocation.
  • Transparently returns output data or reverts on failure.

Metadata

Metadata

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