audit: add LEP-6 shadow scoring for storage truth#119
audit: add LEP-6 shadow scoring for storage truth#119j-rafique wants to merge 1 commit intoLEP-6-report-ingestionfrom
Conversation
The shadow scoring implementation is well-structured with thorough test coverage across result classes, decay, escalation, contradictions, and trust band scaling. Two minor items flagged:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| ReporterSupernodeAccount: reporterAccount, | ||
| ReliabilityScore: next, | ||
| LastUpdatedEpoch: epochID, | ||
| TrustBand: reporterTrustBandForScore(next, k.GetParams(ctx).WithDefaults()), |
There was a problem hiding this comment.
k.GetParams(ctx).WithDefaults() is called here and again at line 247 inside applyTicketDeteriorationDelta, even though the params are already fetched at the top of applyStorageTruthScores (line 41) and passed into storageTruthBookkeepingForResult. These inner functions re-read from the store on every invocation. With N results per report, that is 2N redundant store reads per SubmitEpochReport. Consider threading the already-fetched params into these two methods as a parameter.
Fix it with Roo Code or mention @roomote and request a fix.
| if value > 0 { | ||
| return (value * numerator) / denominator | ||
| } | ||
| return -(((-value) * numerator) / denominator) |
There was a problem hiding this comment.
value * numerator can silently overflow when value is large. Since scores use saturated arithmetic and can theoretically reach math.MaxInt64, calling scaleInt64TowardZero(math.MaxInt64, 50, 100) would overflow the multiplication, wrapping to a negative value and producing an incorrect result. In practice this requires extreme score accumulation, but the rest of the scoring pipeline is careful about saturation. A safe pattern would be to divide first: value / denominator * numerator + (value % denominator * numerator) / denominator, or check for overflow before multiplying.
Fix it with Roo Code or mention @roomote and request a fix.
No description provided.