!5298odin/luvi-guards-fuzz → developed50a23295

LUVI fuzz targets with G as the oracle

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

1commits
11files
1.2klines changed
1.1klines to read
0production lines
2fuzz targets
2findings pinned

Where the diff is

3-minute explainer

What changed

G, the oracle

Per-op bounds on hedged LP equity change; failures change nothing.

  • swap: |norm| ≤ tol + rounding
  • synth mint/burn: norm ≥ −tol
  • add/withdraw ≥ −1 unit · donate > 0

FuzzLuviPoolOps

Random op sequences through real handlers, checked after every op.

headeraddswapmintwithdrawcheck each

Double swaps

Middle pool rebuilt from first swap event, observed too.

beforemidafter

else a false −e²/4 drop

FuzzLuviTracker

Seven identities of the index on states up to 1e38.

deterministicstationaryreversibleprice neutraldG = dQLUVI*

Pinned findings

m > 1 synth loss; overhang deposits overflow. Neither live on mainnet.

  • m=2 burn: −e³/32
  • overflow panic in calculatePoolUnits
  • flip after !5295

Shared fixture

setupManagerWith takes *check.C or testing.TB via testFatal.

*check.Ctesting.TBtestFatal

Line by line · every changed logic line, narrated

13:10runtime
16code chapters
100%logic lines narrated (813/813)
7flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

Cache context
Branched store; writes land only when write() is called. Handlers run in one per tx.
G
Synth-aware LUVI index: accumulated change in hedged LP equity across observations; the fuzz oracle. type_luvi.go ↗
Go native fuzzing
testing.F targets; seeds and testdata/fuzz run as normal tests without -fuzz. go.dev ↗
gocheck
gopkg.in/check.v1 framework used by the handler suites. pkg.go.dev ↗
LUVI
Liquidity Unit Value Index: sqrt(A·R) per pool unit, the value of one LP unit. luvi-invariant.md ↗
luvicheck.Monitor
Block-by-block checker that flags G drops beyond tolerance and LP unit ledger mismatches. luvicheck.go ↗
Overhang
Synth supply S ≥ 2A; pool units clamp and LP equity Q goes negative. luvi-invariant.md ↗
VirtualMultSynthsBasisPoints
Virtual depth multiplier m for synth swaps; 10,000 (m=1) on mainnet, 20,000 on mocknet. docs/mimir.md ↗