Skip to content

feat(soroban): add event emissions, auth cost, resource budget & priority engine (#779-782) - #783

Open
NteinPrecious wants to merge 1 commit into
MDTechLabs:mainfrom
NteinPrecious:feat/soroban-analysis-779-782
Open

feat(soroban): add event emissions, auth cost, resource budget & priority engine (#779-782)#783
NteinPrecious wants to merge 1 commit into
MDTechLabs:mainfrom
NteinPrecious:feat/soroban-analysis-779-782

Conversation

@NteinPrecious

Copy link
Copy Markdown
Contributor

Summary

Implements four Soroban static analysis features requested in the Stellar Wave milestone.


Issue #779 — Detect Redundant Soroban Event Emissions

  • File: packages/rules/soroban/src/events/redundant-event-emissions.ts
  • Parses function bodies and groups env.events().publish() calls by topic + payload.
  • Reports duplicate emissions with line numbers and a consolidation suggestion.
  • Rust rule: RedundantEventEmissionsRule in rule_engine.rs.

Issue #780 — Soroban Authorization Cost Analyzer

  • File: packages/rules/soroban/src/authorization/authorization-analyzer.ts
  • Three checks: repeated auth calls (A1), auth inside a loop (A2), redundant dual-auth (A3).
  • Rust rule: AuthorizationCostRule — flags >2 auth calls per function and auth-in-loop.

Issue #781 — Soroban Resource Budget Estimator

  • File: packages/rules/soroban/src/budget/resource-budget-estimator.ts
  • Accepts a list of AnalysisFinding objects and produces a ResourceBudgetReport with per-category scores (CPU, memory, ledger, fees) on a 0–100 scale.
  • Rust rule: ResourceBudgetEstimatorRule — counts storage/loop/event/auth ops per function.

Issue #782 — Soroban Optimization Priority Engine

  • File: packages/rules/soroban/src/prioritization/optimization-priority-engine.ts
  • Scores findings using configurable weights: severity (45%), resource impact (35%), fix complexity inverse (20%).
  • rank() and topN() APIs for sorted output.
  • Rust rule: OptimizationPriorityRule — surfaces the highest-density function per impl block.

Files Changed

File Change
packages/rules/soroban/src/events/redundant-event-emissions.ts new
packages/rules/soroban/src/authorization/authorization-analyzer.ts new
packages/rules/soroban/src/budget/resource-budget-estimator.ts new
packages/rules/soroban/src/prioritization/optimization-priority-engine.ts new
packages/rules/soroban/src/index.ts updated — exports all four modules
packages/rules/src/soroban/rule_engine.rs updated — four new Rust rules registered

Closes #779
Closes #780
Closes #781
Closes #782

… and priority engine

Closes MDTechLabs#779 — Detect Redundant Soroban Event Emissions
Closes MDTechLabs#780 — Implement Soroban Authorization Cost Analyzer
Closes MDTechLabs#781 — Implement Soroban Resource Budget Estimator
Closes MDTechLabs#782 — Implement Soroban Optimization Priority Engine

Added TypeScript analyzers under packages/rules/soroban/src/:
- events/redundant-event-emissions.ts  (MDTechLabs#779)
- authorization/authorization-analyzer.ts  (MDTechLabs#780)
- budget/resource-budget-estimator.ts  (MDTechLabs#781)
- prioritization/optimization-priority-engine.ts  (MDTechLabs#782)

Added corresponding Rust rules in packages/rules/src/soroban/rule_engine.rs
and registered them in add_default_rules.
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@NteinPrecious 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant