Labels: medium-difficulty, gasguard-rules, ast, gasguard
Difficulty: Medium
Module: rules/g025_loop_decrement.rs
🧠 Concept
Implement static rule G025 to detect loop structures that use post-decrement operators (i--) instead of pre-decrement operators (--i).
⚠️ Problem
Post-decrement operations (i--) copy original values to stack locations before applying decrements, creating redundant stack manipulation instructions compared to --i.
📁 Implementation Scope
rules/g025_loop_decrement.rs
test/fixtures/g025_samples.sol
🛠️ Requirements
- Analyze loop step statements in AST loop nodes.
- Identify post-decrement expressions on loop counter variables.
- Emit recommendation to replace post-decrement (
i--) with pre-decrement (--i).
🎯 Acceptance Criteria
Labels:
medium-difficulty,gasguard-rules,ast,gasguardDifficulty: Medium
Module:
rules/g025_loop_decrement.rs🧠 Concept
Implement static rule
G025to detect loop structures that use post-decrement operators (i--) instead of pre-decrement operators (--i).Post-decrement operations (
i--) copy original values to stack locations before applying decrements, creating redundant stack manipulation instructions compared to--i.📁 Implementation Scope
rules/g025_loop_decrement.rstest/fixtures/g025_samples.sol🛠️ Requirements
i--) with pre-decrement (--i).🎯 Acceptance Criteria