Skip to content

[CORE] Implement Direct Yul Proxy for EVM Precompiles (0x01 - 0x09) #667

Description

@mijinummi

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


🧠 Concept

Construct a Yul proxy module that formats inputs and handles responses for native EVM precompiled contracts (ecrecover, sha256, modexp, bn256Pairing) with zero memory footprint expansion.

⚠️ Problem

High-level Solidity interactions with precompiled contracts introduce memory padding and type-casting overhead before executing the external precompile call.

📁 Implementation Scope

  • contracts/precompiles/PrecompileForwarder.sol
  • test/precompiles/PrecompileForwarder.test.ts

🛠️ Requirements

  1. Build specific Yul invocations for modexp (0x05) and bn256Pairing (0x08).
  2. Write arguments directly into scratch space and invoke via staticcall.
  3. Check returned status and copy result back to target execution stack.

🎯 Acceptance Criteria

  • Executes cryptographic operations against EVM precompiles with minimal setup gas overhead.
  • Unit tests pass across all standard EVM precompile addresses (0x01 through 0x09).

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