Skip to content

[PERF] Build Bitmask Multi-Signature Approval Tracker in Yul #752

Description

@mijinummi

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


🧠 Concept

Construct a multi-owner signature approval tracker that records up to 256 owner approval states within a single bytes32 storage slot using bitwise toggles.

⚠️ Problem

Tracking approval states using mapping(address => bool) or mapping(uint256 => bool) writes to separate storage slots per approval ($20,000\text{ gas}$ initial write).

📁 Implementation Scope

  • contracts/access/BitmaskApprovalTracker.sol
  • test/access/BitmaskApprovalTracker.test.ts

🛠️ Requirements

  1. Map owner indices ($0\text{--}255$) to bit positions in a bytes32 state variable.
  2. Implement inline assembly checks and toggles using AND, OR, and XOR.

🎯 Acceptance Criteria

  • Tracks up to 256 approvals within a single storage slot.
  • Demonstrates significant gas savings compared to storage mapping patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions