Skip to content

[PERF] Build Single-Transaction Multi-Slot Storage Vector Fetcher #658

Description

@mijinummi

Labels: medium-difficulty, solidity, storage, gasguard
Difficulty: Medium
Module: contracts/storage/


🧠 Concept

Create a utility function that packs reads from multiple contiguous storage slots into a single dynamic bytes32[] output buffer via Yul loops.

⚠️ Problem

Querying multiple non-contiguous state variables across client applications requires multiple RPC requests or standard abi.encode bloat.

📁 Implementation Scope

  • contracts/storage/StorageSlotFetcher.sol
  • test/storage/StorageSlotFetcher.test.ts

🛠️ Requirements

  1. Accept array of slot keys (bytes32[] slots).
  2. Iterate through slots using low-level sload in Yul and construct returned buffer directly in memory.

🎯 Acceptance Criteria

  • Fetches up to 100 storage slots in a single view invocation efficiently.
  • Keeps gas usage per slot read minimal by eliminating ABI boilerplate.

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