Skip to content

feat: implement Soroban analysis rules (#767 #768 #769 #770) - #785

Merged
mijinummi merged 3 commits into
MDTechLabs:mainfrom
demilade18-git:feat/soroban-rules-767-768-769-770
Aug 28, 2026
Merged

feat: implement Soroban analysis rules (#767 #768 #769 #770)#785
mijinummi merged 3 commits into
MDTechLabs:mainfrom
demilade18-git:feat/soroban-rules-767-768-769-770

Conversation

@demilade18-git

Copy link
Copy Markdown
Contributor

Summary

Implements all four Soroban analysis rules assigned to @demilade18-git.


#767 – Detect Inefficient Soroban Vector Operations

File: packages/rules/soroban/src/collections/vector-ops-check.ts

SorobanVectorOpsCheckRule detects:

  • Repeated vector traversals within the same function (O(n) metered calls per pass)
  • Front-insertion/removal patterns (.push_front, .insert(0,…), .remove(0))
  • Unnecessary vector copies (.clone() on a Vec)

#768 – Detect Inefficient Soroban Map Operations

File: packages/rules/soroban/src/collections/map-ops-check.ts

SorobanMapOpsCheckRule detects:

  • Repeated lookups of the same key within a function
  • Unconditional .set() / .insert() without an existence guard
  • Full map traversals (.iter(), .keys(), .values())

#769 – Implement Soroban Loop Cost Analyzer

File: packages/rules/src/soroban/loop_cost_analyzer.rs

LoopCostAnalyzerRule detects:

  • Storage operations (env.storage()…) inside loop bodies
  • Nested loops (O(n²)+ cost)
  • Cross-contract calls inside loops

#770 – Detect Unbounded Soroban Iteration

File: packages/rules/src/soroban/unbounded_iteration.rs

UnboundedIterationRule detects:

  • for loops iterating over dynamically-sized collections/ranges
  • while true / while !done / while running patterns
  • Bare loop {} blocks without an obvious bounded break condition

Integration

  • Both Rust rules registered in SorobanRuleEngine::add_default_rules()
  • pub mod declarations added to packages/rules/src/soroban/mod.rs
  • New TS rules exported from packages/rules/soroban/src/index.ts

Closes #767
Closes #768
Closes #769
Closes #770

…chLabs#768 MDTechLabs#769 MDTechLabs#770

- MDTechLabs#767: Add SorobanVectorOpsCheckRule (TS) – detects repeated traversal,
  front insertion, and unnecessary vector copies
- MDTechLabs#768: Add SorobanMapOpsCheckRule (TS) – detects repeated key lookups,
  unnecessary updates, and avoidable full map traversals
- MDTechLabs#769: Add LoopCostAnalyzerRule (Rust) – detects storage ops, nested
  loops, and cross-contract calls inside loop bodies
- MDTechLabs#770: Add UnboundedIterationRule (Rust) – detects for/while/loop
  blocks whose iteration count is not statically bounded

Register Rust rules in SorobanRuleEngine::add_default_rules() and
export TS rules from packages/rules/soroban/src/index.ts.
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@demilade18-git Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mijinummi

Copy link
Copy Markdown
Collaborator

kindly fix conflict @demilade18-git

@mijinummi
mijinummi merged commit 87149f4 into MDTechLabs:main Aug 28, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants