Labels: medium-difficulty, yul, cryptography, gasguard
Difficulty: Medium
Module: contracts/crypto/
🧠 Concept
Create an inline Yul assembly helper for invoking the SHA2-256 precompile (address 0x02) directly from calldata without staging payload bytes in memory.
⚠️ Problem
Using high-level sha256(bytes) copies calldata payloads into temporary memory buffers before triggering the precompile call.
📁 Implementation Scope
contracts/crypto/YulSHA256.sol
test/crypto/YulSHA256.test.ts
🛠️ Requirements
- Pass input calldata ranges directly to precompile address
0x02 via Yul staticcall.
- Write precompile output directly to scratch space (
0x00) and return the resulting digest.
🎯 Acceptance Criteria
Labels:
medium-difficulty,yul,cryptography,gasguardDifficulty: Medium
Module:
contracts/crypto/🧠 Concept
Create an inline Yul assembly helper for invoking the
SHA2-256precompile (address0x02) directly from calldata without staging payload bytes in memory.Using high-level
sha256(bytes)copies calldata payloads into temporary memory buffers before triggering the precompile call.📁 Implementation Scope
contracts/crypto/YulSHA256.soltest/crypto/YulSHA256.test.ts🛠️ Requirements
0x02via Yulstaticcall.0x00) and return the resulting digest.🎯 Acceptance Criteria
sha256()outputs across all input sizes.