feat(soroban): implement TTL analyzer with short-TTL detection (#885) - #955
Merged
mijinummi merged 1 commit intoSep 25, 2026
Merged
Conversation
|
@Apostle-whykay 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements the Soroban TTL Analyzer in
packages/analyzers/soroban/ttl/and exposes it throughpackages/rules/soroban/ttl/. The analyzer covers every requirement in #885:set/extend_ttl) and the tier they target,extend_tovalues (and threshold/extend_to pairs that can never extend anything),Related Issue
Closes #885
Changes
packages/analyzers/soroban/ttl/(new)types.ts—TtlOperation,TtlFinding,TtlAnalysisMetrics,SorobanTtlAnalysisResult, tuning options.ttl-analyzer.tsdetectTtlOperations(source)— scans for.set(...)/.extend_ttl(...)calls and classifies the receiver tier (persistent/instance/temporary).analyzeShortTtlValues(source, options?)— flagsextend_tobelow the one-day floor as high and below the 30-day recommendation as medium; flagsthreshold >= extend_to, non-positive thresholds and a missingextend_toas high invalid ranges. Named constants the analyzer cannot evaluate are skipped rather than guessed.SorobanTtlAnalyzer.analyze()/analyzeTtl()— aggregate report that also reuses the existing storage analyzer for missing (Detect Missing Soroban TTL Extensions #886) and excessive (Detect Excessive Soroban TTL Extensions #887) extensions, so all TTL findings are available from one entry point with unified metrics.SOROBAN_LEDGER_CLOSE_SECONDS,SOROBAN_LEDGERS_PER_DAY,SOROBAN_RECOMMENDED_MIN_TTL_LEDGERS(30 days),SOROBAN_ABSOLUTE_MIN_TTL_LEDGERS(1 day).index.ts— public surface.packages/rules/soroban/ttl/short-ttl.rule.ts(new) —SorobanShortTtlRule(soroban-short-ttl) +detectShortTtlValues.ttl.rule.ts(new) —SorobanTtlRule(soroban-ttl-analyzer) aggregate rule exposinganalyze()warnings andgetFullAnalysis(), plusdetectTtlIssues().index.ts— exports the two new rules (already re-exported bypackages/rules/soroban/src/index.ts).Tests
packages/analyzers/soroban/ttl/__tests__/ttl-analyzer.spec.ts— literal parsing, operation/tier detection, loop detection, short-TTL severity, ineffective/inverted ranges, missingextend_to, named-constant skipping, custom thresholds, aggregate metrics, comment/string masking, healthy contract.packages/rules/soroban/ttl/__tests__/ttl-rule.spec.ts— rule ids, warning shape (line,key,severity,suggestion), aggregate finding kinds andgetFullAnalysis.Verification
../common/source-utilsand../storage/ttl-analyzermodules: 28 tests passed (28) across 2 files.tsc --noEmit --strictpasses on the new analyzer/rule modules.index.tsre-exports).