Skip to content

[CORE] Train Heuristic Regression Engine for Gas Cost Anomaly Detection #606

Description

@mijinummi

Labels: high-difficulty, ml, heuristics
Difficulty: High
Module: libs/ml-engine/


🧠 Concept

Train a lightweight regression model that analyzes contract AST complexity features (cyclomatic complexity, state reads, memory allocations) to predict gas behavior on unseen code patterns.

⚠️ Problem

Rule-based static analysis only catches explicitly coded patterns; heuristic models can flag unusually complex code blocks that static rules miss.

📁 Implementation Scope

  • libs/ml-engine/src/feature-extractor.ts
  • libs/ml-engine/src/predictor.ts

🛠️ Requirements

  1. Extract structural code features (loop depth, variable count, storage accesses) into feature vectors.
  2. Evaluate feature vectors against pre-trained regression models to generate a "Gas Complexity Index."
  3. Highlight functions whose predicted gas usage strays significantly from industry baseline averages.

🎯 Acceptance Criteria

  • Successfully outputs complexity index scores for submitted source code.
  • Flags high-complexity functions lacking explicit static rule matches.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions