Commit graph

730 commits

Author SHA1 Message Date
openhands
9bb223cf95 fix: Optimizer.sol also silently accepts negative mantissa inputs (#582)
Add require(mantissa >= 0) guards in calculateParams before the uint256()
casts on inputs[0] and inputs[1], preventing negative int256 values from
wrapping to huge uint256 numbers and corrupting liquidity calculations.
Add two regression tests covering the revert paths for both slots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 15:41:39 +00:00
johba
d84ff5f762 Merge pull request 'fix: fix: il-crystallization-80 attack times out (153 steps) (#597)' (#616) from fix/issue-597 into master 2026-03-12 16:26:03 +01:00
johba
66dcb2c2a2 Merge pull request 'fix: transpile() does not throw on <4 stack outputs (#584)' (#617) from fix/issue-584 into master 2026-03-12 16:16:45 +01:00
openhands
403a304c98 fix: tighten stack-depth guard to !== 4 to catch overflow (#584)
Reviewer noted that `< 4` only catches underflow; programs leaving 5+
values on the DYADIC stack silently passed isValid().  Change the guard
to `!== 4` so both under- and overflow are rejected, matching the
documented 'exactly 4 outputs' contract.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 14:48:15 +00:00
openhands
5dffed123d ci: retrigger after infra failure 2026-03-12 14:19:01 +00:00
openhands
e770191e56 fix: transpile() does not throw on <4 stack outputs (#584)
Replace silent ?? '0' fallbacks with an explicit length check that
throws when the DYADIC stack holds fewer than 4 values at program
termination.  isValid() in the evolution pipeline now correctly
rejects underflow programs instead of silently scoring them as valid
with zeroed outputs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 14:07:32 +00:00
johba
685a0e488e Merge pull request 'fix: feat: revm-based fitness evaluator for evolution at scale (#604)' (#613) from fix/issue-604 into master 2026-03-12 14:56:03 +01:00
openhands
fe385fb010 fix: fix: il-crystallization-80 attack times out (153 steps) (#597)
Add `buy_recenter_loop` batch op to AttackRunner — executes N×(buy→recenter)
cycles in a single Solidity loop, emitting snapshots after each recenter.
Rewrite il-crystallization-80.jsonl from 153 individual JSONL steps to 2 lines
using the new op with count=80, matching the intended attack name. Also corrects
the cycle count from 76 (previous file) to the intended 80.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 13:16:41 +00:00
openhands
9c42947903 fix: address review findings in FitnessEvaluator (#604)
- Wrap upgradeTo() in try/catch: malformed candidate bytecode no longer
  aborts the entire batch; emit {"fitness":0,"error":"upgrade_failed"} and
  continue to the next candidate
- Bootstrap recenter: require() after 5 retry attempts so silent failure
  (all scores identically equal to free WETH only) is surfaced as a hard
  test failure rather than silently producing meaningless results
- mint_lp: capture the NPM tokenId returned by mint() and push it to
  _mintedNpmTokenIds; burn_lp now uses a 1-based index into that array
  (same pattern as stake/unstake), making attack files fork-block-independent
- Remove dead atkBaseSnap variable and its compiler-warning suppression
- Remove orphaned vm.snapshot() after vm.revertTo() in the attack loop
- Fix misleading comment on delete _stakedPositionIds

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 12:31:11 +00:00
openhands
26b8876691 fix: feat: revm-based fitness evaluator for evolution at scale (#604)
Replace per-candidate Anvil+forge-script pipeline with in-process EVM
execution using Foundry's native revm backend, achieving 10-100× speedup
for evolutionary search at scale.

New files:
- onchain/test/FitnessEvaluator.t.sol — Forge test that forks Base once,
  deploys the full KRAIKEN stack, then for each candidate uses vm.etch to
  inject the compiled optimizer bytecode, UUPS-upgrades the proxy, runs all
  attack sequences with in-memory vm.snapshot/revertTo (no RPC overhead),
  and emits one {"candidate_id","fitness"} JSON line per candidate.
  Skips gracefully when BASE_RPC_URL is unset (CI-safe).

- tools/push3-evolution/revm-evaluator/batch-eval.sh — Wrapper that
  transpiles+compiles each candidate sequentially, writes a two-file
  manifest (ids.txt + bytecodes.txt), then invokes FitnessEvaluator.t.sol
  in a single forge test run and parses the score JSON from stdout.

Modified:
- tools/push3-evolution/evolve.sh — Adds EVAL_MODE env var (anvil|revm).
  When EVAL_MODE=revm, batch-scores every candidate in a generation with
  one batch-eval.sh call instead of N sequential fitness.sh processes;
  scores are looked up from the JSONL output in the per-candidate loop.
  Default remains EVAL_MODE=anvil for backward compatibility.

Key design decisions:
- Per-candidate Solidity compilation is unavoidable (each Push3 candidate
  produces different Solidity); the speedup is in the evaluation phase.
- vm.snapshot/revertTo in forge test are O(1) memory operations (true
  revm), not RPC calls — this is the core speedup vs Anvil.
- recenterAccess is set in bootstrap so TWAP stability checks are bypassed
  during attack sequences (mirrors the existing fitness.sh bootstrap).
- Test skips cleanly when BASE_RPC_URL is absent, keeping CI green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 11:54:41 +00:00
johba
4258045c8c Merge pull request 'fix: fix: Restore proper VWAP — gas-efficient volume-weighted pricing (revert TWAP) (#603)' (#605) from fix/issue-603 into master 2026-03-12 12:10:02 +01:00
johba
f17ca85e7d Merge pull request 'fix: Evolution pipeline UUPS upgrade + Foundry PATH (#593)' (#594) from fix/issue-593 into master 2026-03-12 10:40:04 +01:00
openhands
f9f1d15d8d ci: retrigger after infra failure 2026-03-12 09:06:08 +00:00
openhands
f844f76533 fix: OptimizerV3 — use canonical transpiler output, fix register mapping
Review bot caught r37/r39 inversion (anchorShare ↔ discoveryDepth).
Replaced inline approximation with verbatim transpiler output.
Removed stale NatSpec (no delegatecall), removed unused import.
2026-03-12 09:04:52 +00:00
openhands
0dd764b8b3 fix: fix: Restore proper VWAP — gas-efficient volume-weighted pricing (revert TWAP) (#603)
- Replace pool.observe() TWAP price source with current pool tick (pool.slot0()) sampled once per recenter
- Remove _getTWAPOrFallback() and TWAPFallback event (added by PR #575)
- _scrapePositions now takes int24 currentTick instead of uint256 prevTimestamp; price computed via _priceAtTick before the burn loop
- Volume weighting (ethFee * 100) is unchanged — fees proxy swap volume over the recenter interval
- Direction fix from #566 (shouldRecordVWAP only on sell events) is preserved
- Remove test_twapReflectsAveragePriceNotJustLastSwap (tested reverted TWAP behaviour)
- ORACLE_CARDINALITY / increaseObservationCardinalityNext retained for _isPriceStable()
- All 188 tests pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 08:50:07 +00:00
johba
a075f8bd61 Merge pull request 'fix: fix: Debug failing round-trip-safe attack in evolution fitness (#595)' (#602) from fix/issue-595 into master 2026-03-12 09:35:19 +01:00
openhands
acfdd2b22e fix: fix: Debug failing round-trip-safe attack in evolution fitness (#595)
After a buy→sell round-trip the net price movement is near zero, so
recenter() reverts with "amplitude not reached" and aborts the whole
AttackRunner script.

Wrap the recenter() call in a try/catch so amplitude failures are
caught and logged as a skipped step rather than propagating as a fatal
revert.  When recenter is skipped, no state snapshot is emitted and the
attack sequence continues — matching the intended semantics: round-trip
trading should not cause the fitness scorer to crash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 07:57:31 +00:00
johba
bd291bc9b9 Merge pull request 'fix: fix: Debug failing staking-safe attack in evolution fitness (#596)' (#598) from fix/issue-596 into master 2026-03-12 08:43:53 +01:00
openhands
78246ed399 fix: fix: Debug failing staking-safe attack in evolution fitness (#596)
Stake.nextPositionId starts at 654_321, so attack files cannot use literal
on-chain IDs (e.g. positionId=1 always reverts with PositionNotFound).

Fix AttackRunner to treat the JSONL positionId field as a 1-based index into
the list of positions created by stake ops during the current run:
- Add IStake.snatch returns (uint256) to the interface so the returned ID is
  captured.
- Track returned IDs in _stakedPositionIds[] (inserted in creation order).
- _executeUnstake resolves positionId to _stakedPositionIds[positionId-1]
  before calling exitPosition, matching the natural "unstake position 1"
  semantics in the attack DSL.

KRK approval for Stake was already present in _setup(); no other changes needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 07:10:13 +00:00
openhands
ade7e2033a fix: Evolution pipeline UUPS upgrade + Foundry PATH (#593)
- Add virtual to Optimizer.calculateParams() for UUPS override
- Create OptimizerV3.sol: UUPS-upgradeable optimizer with transpiled Push3 logic
- Update deploy-optimizer.sh to deploy OptimizerV3 instead of Optimizer
- Add ~/.foundry/bin to PATH in evolve.sh, fitness.sh, deploy-optimizer.sh
2026-03-12 06:47:35 +00:00
johba
6f3601711b Merge pull request 'fix: Push3 evolution: selection loop orchestrator (#546)' (#592) from fix/issue-546 into master 2026-03-11 23:31:51 +01:00
openhands
0496c94681 fix: address review findings in evolve.sh (#546)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 22:06:18 +00:00
openhands
2ee7feb621 fix: address review findings in evolve.sh (#546)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 21:29:14 +00:00
openhands
547e8beae8 fix: Push3 evolution: selection loop orchestrator (#546)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 20:56:19 +00:00
johba
b460e36bbc Merge pull request 'fix: Push3 evolution: fitness scoring wrapper (transpile → deploy → attack → score) (#545)' (#587) from fix/issue-545 into master 2026-03-11 21:42:28 +01:00
openhands
4564637f85 fix: Push3 evolution: fitness scoring wrapper (transpile → deploy → attack → score) (#545)
Address round-2 review findings:
- Move BASELINE_SNAP before deploy-optimizer.sh so cleanup fully reverts the
  deploy on a shared Anvil; fixes nonce/address collision when a second
  sequential evaluation reuses the same chain
- Revert deploy output to capture-and-suppress on success / surface on failure;
  removes per-candidate stderr noise in evolution loop batch runs
- Fix cast rpc anvil_mine arg order to match all other cast rpc calls in script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 20:16:54 +00:00
openhands
0f91234dbe fix: Push3 evolution: fitness scoring wrapper (transpile → deploy → attack → score) (#545)
Address review findings:
- Bug: add BASELINE_SNAP before bootstrap; cleanup reverts it on shared Anvil
  to undo setRecenterAccess/WETH-funding/recenter mutations (was dead code before)
- Bug: require ANVIL_FORK_URL when cold-starting Anvil — DeployLocal.sol needs
  live Base contracts (Uniswap V3 Factory, WETH) that don't exist on a plain fork
- Warning: flag DIRTY and emit warning when anvil_revert fails instead of || true
- Warning: tee deploy-optimizer.sh output to both log file and stderr so progress
  is visible and preserved for post-failure diagnosis
- Nit: replace 50×evm_mine loop with single anvil_mine 0x32 (49 fewer RTTs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 19:41:06 +00:00
openhands
a8db761de8 fix: Push3 evolution: fitness scoring wrapper (transpile → deploy → attack → score) (#545)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 19:02:00 +00:00
johba
514a55a1ac Merge pull request 'fix: Backtesting: replay red-team attack sequences against optimizer candidates (#536)' (#565) from fix/issue-536 into master 2026-03-11 19:24:27 +01:00
openhands
d6ca28ae32 fix: AttackRunner round-3 review findings
- **Bug**: Fix JSON malformation in _snapshotPositions — closing literal was '"}}}' (three
  braces) but only '"}}'  is needed (close discovery{} + positions{}). The third brace
  prematurely closed the root object, making every snapshot unparseable downstream.

- **Nit**: _executeStake local variable renamed taxRateIndex → taxRate to match the
  IStake interface and Stake.sol. JSONL field key '.taxRateIndex' is kept for backward
  compatibility with existing attack files; the comment and NatDoc header now say so.

- **Nit**: recenter_is_up now emits JSON null (not false) before the first recenter call,
  via a new _hasRecentered flag. Downstream parsers can distinguish "no recenter yet"
  from "last recenter moved price down" (false). _hasRecentered is set to true alongside
  _lastRecenterIsUp in the recenter handler.

- **Nit**: Added a comment to _logSnapshot explaining that pool.slot0() is a view call
  and forge-std finalises broadcast state before executing it, so tick/sqrtPrice are
  always post-broadcast accurate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 17:51:18 +00:00
openhands
297442083d fix: AttackRunner review findings — TVL accuracy, recenter capture, discovery ethValue
- **Bug**: `_positionEthValue` now sums both the ETH component and the KRK component
  (converted to ETH via `FullMath.mulDiv` at current sqrtPriceX96) so `lm_eth_total`
  correctly reflects LM TVL for all price ranges (below/in/above range).

- **Bug**: `recenter()` return value (`bool isUp` — price direction) is now captured in
  `_lastRecenterIsUp` state variable and emitted as `"recenter_is_up"` in every snapshot.
  Note: `recenter()` reverts on failure; `false` means price moved *down*, not a no-op.

- **Bug**: Discovery position now emits `"ethValue"` in its snapshot JSON object,
  matching the floor and anchor fields for symmetric automated parsing.

- **Warning**: `IStake.snatch` interface parameter renamed `taxRateIndex` → `taxRate` to
  match the actual `Stake.sol` signature (the value is a raw rate, not a lookup index).

- **Warning**: Unknown op codes in the JSONL file now emit a `console.log` warning
  instead of silently skipping, catching typos in attack sequences.

- **Nit**: `_setup()` now wraps 9 000 ETH (up from 1 000) to cover heavy buy sequences
  that would otherwise exhaust the adversary's WETH.

- **Nit**: `_computeVwapTick` documents the int128 overflow guard and its tick=0 sentinel
  meaning so callers can distinguish "VWAP unavailable" from tick zero.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 17:14:34 +00:00
johba
f19ff8846f Merge pull request 'fix: Push3 evolution: mutation operators for bytecode programs (#544)' (#583) from fix/issue-544 into master 2026-03-11 17:54:37 +01:00
openhands
a6b64d3219 fix: Push3 evolution: mutation operators for bytecode programs (#544)
Implements the five Push3 mutation operators and the meta-operator for
the optimizer evolution pipeline:

- mutateConstant: shifts a random integer literal by ±δ (clamped to 0)
- swapOperator: swaps ADD↔SUB, MUL↔DIV, GT↔LT, GTE↔LTE
- deleteInstruction: removes a random non-EXEC.IF instr; validates result
- insertInstruction: inserts stack-neutral pair (push 0 + DYADIC.POP)
- crossover: single-point crossover of two programs at instruction boundaries
- mutate: applies N random mutations from the four single-program operators

All mutations validate output via transpile() symbolic stack simulation.
Invalid mutations silently return the original program.

35 unit tests cover all operators, edge cases (empty program, single
instruction, deep stack), and the acceptance criterion that
mutate(optimizer_v3, 3) produces ≥10 distinct valid variants in 20 trials.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 16:24:24 +00:00
johba
02069464d4 Merge pull request 'fix: Push3 optimizer: dyadic rational input interface (8 slots) + 4-output redesign (#548)' (#581) from fix/issue-548 into master 2026-03-11 16:54:53 +01:00
openhands
5d204e5649 fix: Push3 optimizer: dyadic rational input interface (8 slots) + 4-output redesign (#548)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 15:23:36 +00:00
johba
c3792b2a63 Merge pull request 'fix: Replace anchor-midpoint VWAP with pool.observe() TWAP oracle (#575)' (#576) from fix/issue-575 into master 2026-03-11 12:00:06 +01:00
johba
4be783438f Merge pull request 'fix: fix: strip cast formatted annotations from red-team.sh (#577)' (#578) from fix/issue-577 into master 2026-03-11 11:55:34 +01:00
openhands
58729b98b4 fix: fix: strip cast formatted annotations from red-team.sh (#577)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 10:19:14 +00:00
openhands
f72f99aefa fix: Address review findings from PR #575
- Fix unsafe int32 intermediate cast: int56(int32(elapsed)) → int56(uint56(elapsed))
  to prevent TWAP tick sign inversion for intervals above int32 max (~68 years)
- Remove redundant lastRecenterTimestamp state variable; capture prevTimestamp
  from existing lastRecenterTime instead (saves ~20k gas per recenter)
- Use pool.increaseObservationCardinalityNext(ORACLE_CARDINALITY) in constructor
  instead of recomputing the pool address; extract magic 100 to named constant
- Add TWAPFallback(uint32 elapsed) event emitted when pool.observe() reverts
  so monitoring can distinguish degraded operation from normal bootstrap
- Remove conditional bypass paths in test_twapReflectsAveragePriceNotJustLastSwap;
  assert vwapAfter > 0 and vwapAfter > initialPriceX96 unconditionally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 10:02:47 +00:00
openhands
83e43386bc ci: retrigger after infra failure 2026-03-11 08:30:27 +00:00
openhands
53c14745cb fix: Replace anchor-midpoint VWAP with pool.observe() TWAP oracle (#575)
- Add lastRecenterTimestamp to track recenter interval for TWAP
- Increase pool observation cardinality to 100 in constructor
- In _scrapePositions, use pool.observe([elapsed, 0]) to get TWAP tick
  over the full interval between recenters; falls back to anchor midpoint
  when elapsed==0 or pool.observe() reverts (insufficient history)
- Add test_twapReflectsAveragePriceNotJustLastSwap: verifies TWAP-based
  VWAP reflects the average price across the recenter interval, not just
  the last-swap anchor snapshot

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 08:17:49 +00:00
johba
8c0683cbba Merge pull request 'fix: Red-team: replace ethPerToken with exact total-LM-ETH metric (#539)' (#540) from fix/issue-539 into master 2026-03-11 08:33:25 +01:00
johba
f70a7e71a2 Merge pull request 'fix: Investigate: VWAP not preventing IL crystallization during buy-only recenter cycles (#543)' (#566) from fix/issue-543 into master 2026-03-11 07:50:03 +01:00
openhands
4567ca1b6e ci: retrigger after infra failure 2026-03-11 06:28:02 +00:00
openhands
0834433db1 Fix PR #540 review findings
Critical fixes:
- LmTotalEth.s.sol: Fix imports to use @aperture/uni-v3-lib/ (lines 8-9)
- red-team.sh: Update memory regex to match lm.?eth pattern (line 266)

Additional improvements:
- red-team.sh: Update adversary balance claim to ~9000 ETH (after funding LM)
- red-team.sh: Add --no-color to forge invocation + emptiness guard
- red-team.sh: Document feeDestination storage slot 7 fragility

Tested:
- Regex pattern matches all expected formats (lm_eth, lmeth, LM-ETH, etc.)
- Import paths align with remappings.txt
2026-03-11 06:28:02 +00:00
openhands
0ddc1ccd80 fix: Red-team: replace ethPerToken with exact total-LM-ETH metric (#539)
Replace the ethPerToken metric (free balance / adjusted supply) with total
LM ETH (free + WETH + position-locked) using a forge script with exact
Uni V3 integer math. Collapses 4+ RPC calls and Python float approximation
into a single forge script call using LiquidityAmounts + TickMath.

Also updates red-team prompt, report format, memory extraction, and adds
roadmap items for #536-#538 (backtesting pipeline, Push3 evolution).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 06:28:02 +00:00
openhands
6b77a493a2 fix: address review feedback — update stale comments and tighten test guard (#543)
- _scrapePositions natspec: 'ETH inflow' → 'ETH outflow / price fell or at bootstrap'
- Inline comment above VWAP block: remove inverted 'KRK sold out / ETH inflow' rationale,
  replace with a neutral forward-reference to recenter() where the direction logic lives
- VWAPFloorProtection.t.sol: remove unused Kraiken and forge-std/Test.sol imports
  (both are already provided by UniSwapHelper)
- test_floorConservativeAfterBuyOnlyAttack: add assertFalse(token0isWeth) guard so a
  future change to the setUp parameter cannot silently invert the gap-direction assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 04:11:02 +00:00
openhands
e35a805138 fix: Investigate: VWAP not preventing IL crystallization during buy-only recenter cycles (#543)
Investigation findings:
- VWAP WAS being fed during buy-only cycles (shouldRecordVWAP = true on ETH inflow / price rising).
  Over 80 buy-recenter cycles VWAP converged toward the inflated current price.
- When VWAP ≈ currentTick, mirrorTick = currentTick + vwapDistance ≈ currentTick, placing
  the floor near the inflated price.  Adversary sells back through the high floor, extracting
  nearly all LM ETH.
- Optimizer parameters (anchorShare, CI) were not the primary cause.

Fix (LiquidityManager.sol):
  Flip shouldRecordVWAP from buy direction to sell direction.  VWAP is now recorded only when
  price falls (ETH outflow / sell events) or at initial bootstrap (cumulativeVolume == 0).
  Buy-only attack cycles leave VWAP frozen at the historical baseline, keeping mirrorTick and
  the floor conservatively anchored far from the inflated current price.

Also updated onchain/AGENTS.md to document the corrected recording direction.

Regression test (VWAPFloorProtection.t.sol):
  - test_vwapNotInflatedByBuyOnlyAttack: asserts getVWAP() stays at bootstrap after N buy cycles.
  - test_floorConservativeAfterBuyOnlyAttack: asserts floor center is far below inflated tick.
  - test_vwapBootstrapsOnFirstFeeEvent: confirms bootstrap path unchanged.
  - test_recenterSucceedsOnSellDirectionWithoutReverts: confirms sell-direction recenters work.

All 187 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 03:31:45 +00:00
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
openhands
9832b454df fix: PR #551 review findings - OptimizerV3Push3.sol + Optimizer.sol
Critical bugs fixed:
- OptimizerV3Push3: Add input validation for mantissa (inputs[0].mantissa <= 1e18)
- OptimizerInput struct: Move to shared IOptimizer.sol to eliminate duplication
- Update imports in Optimizer.sol, OptimizerV3Push3.sol, and test file

Warnings addressed:
- Document unused variables (_d2-_d7) with comments in OptimizerV3Push3
- Add shift validation: require(inputs[k].shift == 0, "shift not yet supported")
- Fix recordRecenter error style: use UnauthorizedAccount custom error

Tests: All 32 Optimizer + OptimizerV3Push3 tests passing
2026-03-10 23:13:57 +00:00