Labels: good-first-issue, gasguard-rules, solidity, gasguard
Difficulty: Easy
Module: rules/g023_memory_array_allocation.rs
🧠 Concept
Add static rule G023 to detect memory array declarations initialized with large fixed sizes that are only partially populated during execution.
⚠️ Problem
Allocating memory arrays with oversized initial lengths expands the free memory space prematurely, triggering unnecessary memory expansion gas fees.
📁 Implementation Scope
rules/g023_memory_array_allocation.rs
test/fixtures/g023_samples.sol
🛠️ Requirements
- Analyze memory array allocations (
new uint256[](size)).
- Cross-reference initialized length against maximum loop bounds populated in the function scope.
- Flag over-allocated array declarations.
🎯 Acceptance Criteria
Labels:
good-first-issue,gasguard-rules,solidity,gasguardDifficulty: Easy
Module:
rules/g023_memory_array_allocation.rs🧠 Concept
Add static rule
G023to detect memory array declarations initialized with large fixed sizes that are only partially populated during execution.Allocating memory arrays with oversized initial lengths expands the free memory space prematurely, triggering unnecessary memory expansion gas fees.
📁 Implementation Scope
rules/g023_memory_array_allocation.rstest/fixtures/g023_samples.sol🛠️ Requirements
new uint256[](size)).🎯 Acceptance Criteria