Labels: high-difficulty, algorithms, solidity, optimization
Difficulty: High
Module: packages/rules/solidity/src/optimizers/
🧠 Concept
Develop a combinatorial storage packing algorithm using dynamic programming (Knapsack Variant) that calculates the optimal field arrangement for complex Solidity contracts.
⚠️ Problem
State variables in contracts with dozens of fields are rarely ordered efficiently, causing teams to spend unnecessary gas on un-packed storage slots.
📁 Implementation Scope
packages/rules/solidity/src/optimizers/slot-packer.ts
packages/rules/solidity/src/optimizers/slot-packer.spec.ts
🛠️ Requirements
- Extract variable declarations, types, and bit-sizes from contract AST.
- Solve optimal variable packing into 32-byte (256-bit) slots while honoring inheritance layouts.
- Output a refactored contract declaration string minimizing total required storage slots.
🎯 Acceptance Criteria
Labels:
high-difficulty,algorithms,solidity,optimizationDifficulty: High
Module:
packages/rules/solidity/src/optimizers/🧠 Concept
Develop a combinatorial storage packing algorithm using dynamic programming (Knapsack Variant) that calculates the optimal field arrangement for complex Solidity contracts.
State variables in contracts with dozens of fields are rarely ordered efficiently, causing teams to spend unnecessary gas on un-packed storage slots.
📁 Implementation Scope
packages/rules/solidity/src/optimizers/slot-packer.tspackages/rules/solidity/src/optimizers/slot-packer.spec.ts🛠️ Requirements
🎯 Acceptance Criteria