Skip to content

[PERF] Build Single-Transaction Bulk Storage Reset Utility in Yul #709

Description

@mijinummi

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


🧠 Concept

Create an assembly helper that clears contiguous ranges of storage slots within a single execution loop to claim maximum gas refunds post-EIP-3529.

⚠️ Problem

Post-Cancun/EIP-3529 EVM rules reduce self-destruct refunds, requiring explicit zeroing of storage slots (SSTORE with value 0) to claim storage refunds.

📁 Implementation Scope

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

🛠️ Requirements

  1. Accept start slot key and total slot count parameters.
  2. Iterate through contiguous storage slots in Yul assembly and execute sstore(slot, 0).

🎯 Acceptance Criteria

  • Clears target storage slot ranges in an $O(n)$ assembly loop.
  • Maximize available gas refund credits for cleanup operations.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardStellar WaveIssues in the Stellar wave programThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions