Skip to content

[CORE] Build CLI Storage Slot Visualizer & Re-Packing Auto-Fixer #664

Description

@mijinummi

Labels: high-difficulty, rust, cli, storage, gasguard
Difficulty: High
Module: gasguard-cli/src/commands/optimize_storage.rs


🧠 Concept

Add a GasGuard CLI tool (gasguard optimize-storage <Contract.sol>) that parses contract state variables, models EVM storage packing, and outputs an optimal variable layout.

⚠️ Problem

Manually calculating variable bit sizes to pack storage slots across complex inheritance trees is difficult and prone to missing packing opportunities.

📁 Implementation Scope

  • gasguard-cli/src/commands/optimize_storage.rs
  • gasguard-cli/src/storage_model.rs

🛠️ Requirements

  1. Parse contract definitions and extract state variable types and order.
  2. Simulate EVM storage slot packing ($256$-bit boundaries).
  3. Compute and display the optimal variable ordering, alongside the calculated slot savings.

🎯 Acceptance Criteria

  • Command correctly identifies sub-optimal storage layouts across contract inheritance hierarchies.
  • Displays before/after storage slot visual maps in terminal output.

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