Commit graph

13 commits

Author SHA1 Message Date
johba
69ba4fd44e fix: Floor Ratchet 2000-trade oscillation needs a dedicated full-sequence red-team run (#1082)
- Expand floor-ratchet-oscillation.jsonl to 2000 buy→recenter cycles
  (10 rounds × 200 cycles at 5 ETH/buy with stake/unstake/sell phases)
- Fix AttackRunner buy_recenter_loop: add vm.warp/vm.roll for recenter
  cooldown bypass and TWAP convergence; use single-signer broadcast
- Fix AttackRunner mine op: advance timestamp alongside block number
- Replace pending 2026-03-22 evidence with completed 2026-03-23 run
- Result: INCREASED (+1230 bps). TWAP oracle blocked 99.9% of recenters.
  Floor ratchet risk from #630 is defeated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 09:12:00 +00:00
johba
9d11c848e9 fix: correct worked example attack index reference (attacks[1], not attack 2)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 04:04:40 +00:00
johba
caedd5c4e6 fix: Fee-income calculation model needs documentation to make delta_bps auditable (#1084)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 03:23:23 +00:00
johba
937f2a833b fix: Investigate: adversary parasitic LP extracts 29% from holder, all recenters fail (#517)
Root cause: PRICE_STABILITY_INTERVAL (300s) was too long relative to
MIN_RECENTER_INTERVAL (60s). After any significant trade moving the tick
>1000 positions, the 5-minute TWAP lagged behind the current price by
hundreds of ticks, exceeding MAX_TICK_DEVIATION (50). Recenter reverted
with "price deviated from oracle" for ~285s — creating a window where
the LM could not reposition and adversary parasitic LP could extract
value from passive holders.

Fix: Reduce PRICE_STABILITY_INTERVAL from 300s to 30s. This ensures
TWAP converges within the 60s cooldown while still preventing same-block
manipulation (30s > ~12s Ethereum mainnet block time).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 19:45:35 +00:00
johba
180119aabf fix: address review — consistent evidence fields, unstake all positions
- Evidence file: change result to PENDING (not INCREASED) with delta_bps 0,
  since this is a registration placeholder, not a measured run
- Attack file: add missing unstake for position 6 so all staking positions
  are cleaned up

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:06:45 +00:00
johba
af3fd56d55 fix: Floor Ratchet attack not yet defeated — needs explicit test (#1067)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 16:38:44 +00:00
johba
de014e9b13 fix: feat: implement evidence/resources and evidence/protocol logging (#1059)
- Add evidence/resources/ and evidence/protocol/ directories with .gitkeep
- Add schemas for resources/ and protocol/ to evidence/README.md
- Create formulas/run-resources.toml (sense formula: disk/RAM/API/CI metrics,
  daily cron 06:00 UTC, verdict: ok/warn/critical)
- Create formulas/run-protocol.toml (sense formula: TVL/fees/positions/
  rebalance frequency via LmTotalEth.s.sol + cast, daily cron 07:00 UTC,
  verdict: healthy/degraded/offline)
- Update STATE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 19:39:23 +00:00
johba
46e928ea97 fix: Red-team schema should add candidate_commit field (#1066) (#1075)
Fixes #1066

## Changes
Done. Here's what was changed:

**`evidence/README.md`**
- Added `"candidate_commit": "abc1234"` to the red-team schema JSON example
- Added `candidate_commit | string | Git commit SHA of the optimizer under test` row to the field table

**`scripts/harb-evaluator/red-team.sh`**
- Captures `CANDIDATE_COMMIT` from `git rev-parse HEAD` at startup (alongside existing `CANDIDATE_NAME`/`OPTIMIZER_PROFILE`)
- Added a new step (9a-pre) that writes `evidence/red-team/YYYY-MM-DD.json` at the end of each run, including `candidate_commit` plus all other schema fields (`candidate`, `optimizer_profile`, `lm_eth_before`, `lm_eth_after`, `eth_extracted`, `floor_held`, `verdict`, `attacks`)

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/1075
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-21 13:47:13 +01:00
johba
fd80aec3be evidence: fix nits — strategies count, percentage calculation
- strategies_tested=7 (independent measurements only), strategies_total=9
- Fix attack 4 percentage: 374/2050 ≈ 18%, not 37%

Re: #1058

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 06:45:40 +00:00
johba
443593e66f evidence: fix review round 2 — slippage explanation, methodology note
Addresses re-review feedback:

1. Attack 4 (2050 ETH): delta_bps=3746 is from extreme slippage
   through thin liquidity beyond concentrated positions, not just
   1% fees. Insight corrected to explain the slippage mechanism.
2. Floor Ratchet: renamed to "initial phase only", insight explicitly
   notes the 2000-trade oscillation variant is NOT tested here and
   is tracked as follow-up issue #1082.
3. Added methodology field explaining snapshot-isolation semantics
   (why lm_eth_after == lm_eth_before).
4. Restored two dropped strategies (discovery WETH consumption,
   one-way sell) with notes that they are subsumed by other attacks.

Re: #1058

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 06:43:45 +00:00
johba
b883cde275 evidence: fix red-team baseline — accurate per-attack measurements
Addresses REQUEST_CHANGES review on PR #1065:

1. candidate: "Optimizer" (matches DeployLocal.sol deployment)
2. optimizer_profile: "default" (not push3-default — base Optimizer)
3. candidate_commit: master HEAD SHA for reproducibility
4. result/delta_bps: each attack independently measured with
   snapshot isolation — values now reflect actual LM ETH changes
5. Floor Ratchet attack tested: INCREASED +1179 bps. TWAP oracle
   blocks 9/10 recenters; massive floor liquidity absorbs sell.
6. lm_eth values as strings to avoid JS safe-integer truncation
7. lm_eth_before = lm_eth_after (attacks reverted between tests)

Re: #1058

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 06:31:33 +00:00
johba
abaeb9949d evidence: first red-team baseline — floor held, 8 strategies tested
All 8 adversarial strategies failed to extract ETH from LiquidityManager.
LM ETH actually increased from ~1000 to ~1050 ETH due to fee income.
Key defense: 1% pool fee + atomic recenter + massive floor liquidity.

Closes #1058

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 06:30:59 +00:00
openhands
7dbee803fb fix: Evidence directory structure for process results (#973)
Add evidence/ with subdirs for evolution, red-team, holdout, and user-test.
Each subdir has a .gitkeep and README.md documents the JSON schema for all four
process types so formulas and the planner have a canonical contract to read/write.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 08:28:04 +00:00