harb/onchain/script/backtesting
openhands c8453f6a33 fix: Backtesting: replay red-team attack sequences against optimizer candidates (#536)
- Add AttackRunner.s.sol: structured forge script that reads attack ops from a
  JSONL file (ATTACK_FILE env), executes them against the local Anvil deployment,
  and emits full state snapshots (tick, positions, VWAP, optimizer output,
  adversary balances) as JSON lines after every recenter and at start/end.

- Add 5 canonical attack files in onchain/script/backtesting/attacks/:
  * il-crystallization-15.jsonl  — 15 buy-recenter cycles + sell (extraction)
  * il-crystallization-80.jsonl  — 80 buy-recenter cycles + sell (extraction)
  * fee-drain-oscillation.jsonl  — buy-recenter-sell-recenter oscillation
  * round-trip-safe.jsonl        — 20 full round-trips (regression: safe)
  * staking-safe.jsonl           — staking manipulation (regression: safe)

- Add scripts/harb-evaluator/export-attacks.py: parses red-team-stream.jsonl
  for tool_use Bash blocks containing cast send commands and converts them to
  AttackRunner-compatible JSONL (buy/sell/recenter/stake/unstake/mint_lp/burn_lp).

- Update scripts/harb-evaluator/red-team.sh: after each agent run, automatically
  exports the attack sequence via export-attacks.py and replays it with
  AttackRunner to capture structured snapshots in tmp/red-team-snapshots.jsonl.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 02:08:06 +00:00
..
attacks fix: Backtesting: replay red-team attack sequences against optimizer candidates (#536) 2026-03-11 02:08:06 +00:00
reports fix: Backtesting #6: Baseline strategies (HODL, full-range, fixed-width) + reporting (#320) 2026-02-27 13:08:53 +00:00
.gitignore fix: address review feedback on fetch-events.ts (#315) 2026-02-26 22:45:40 +00:00
AttackRunner.s.sol fix: Backtesting: replay red-team attack sequences against optimizer candidates (#536) 2026-03-11 02:08:06 +00:00
BacktestKraiken.sol fix: Backtesting #4: Deploy KrAIken contracts + recenter execution loop (#318) 2026-02-27 09:00:22 +00:00
BacktestRunner.s.sol fix: address review feedback on BaselineStrategies and Reporter 2026-02-27 13:43:49 +00:00
BaselineStrategies.sol fix: address review feedback on BaselineStrategies and Reporter 2026-02-27 13:43:49 +00:00
EventReplayer.sol fix: No allowance set before \token0.transfer\ in swap callback (#339) 2026-02-28 12:14:20 +00:00
fetch-events.ts fix: address review feedback on fetch-events.ts (#315) 2026-02-26 22:45:40 +00:00
FormatLib.sol fix: address review feedback on PositionTracker and StrategyExecutor 2026-02-27 12:02:29 +00:00
KrAIkenDeployer.sol fix: Backtesting #5: Position tracking + P&L metrics (#319) 2026-02-27 11:23:18 +00:00
MockToken.sol fix: Backtesting #2: Foundry script skeleton + Uniswap V3 shadow pool deployment (#316) 2026-02-27 05:08:27 +00:00
package.json fix: Backtesting #1: Event fetcher (Infura → JSON Lines cache) (#315) 2026-02-26 22:04:43 +00:00
PositionTracker.sol fix: Backtesting #6: Baseline strategies (HODL, full-range, fixed-width) + reporting (#320) 2026-02-27 13:08:53 +00:00
Reporter.sol fix: address review feedback on BaselineStrategies and Reporter 2026-02-27 13:43:49 +00:00
ShadowPoolDeployer.sol fix: Backtesting #5: Position tracking + P&L metrics (#319) 2026-02-27 11:23:18 +00:00
StrategyExecutor.sol fix: address review feedback on PositionTracker and StrategyExecutor 2026-02-27 12:02:29 +00:00
tsconfig.json fix: Backtesting #1: Event fetcher (Infura → JSON Lines cache) (#315) 2026-02-26 22:04:43 +00:00