Commit graph

852 commits

Author SHA1 Message Date
openhands
bf2d261cd9 ci: retrigger 2026-03-14 13:31:23 +00:00
openhands
af8bd07c7d feat: add red-team discovered IL crystallization attack (31.9 ETH optimal)
Single-cycle attack extracts 21.3 ETH (2.13%) from 1000 ETH LM:
  buy 31.9 ETH → recenter → sell all KRK

Key finding: thin pre-recenter positions allow massive price impact,
recenter rebuilds deep positions at manipulated price, sell through
deep positions recovers most ETH. IL crystallized during recenter.

This is the optimal single-buy amount — 31.95+ hits max tick,
<31 ETH extracts proportionally less.
2026-03-14 13:31:23 +00:00
openhands
dbf78de793 fix: bootstrap + red-team on forked networks
Bootstrap fixes:
- Idempotency check: skip if Kraiken already deployed on Anvil
- anvil_setCode to strip ERC-4337 code from deployer + feeDest
- DeployLocal.sol: feeDest derived from keccak256('harb.local.feeDest')

Red-team fixes:
- New bootstrap-light.sh: Anvil-only, ~30s deploy
- red-team.sh uses bootstrap-light instead of full docker compose
- anvil_setBalance for feeDest before impersonation
- forge --color never, path resolution, docker chown

Address fixes (all Base mainnet, in both FitnessEvaluator + AttackRunner):
- V3_FACTORY: 0x33128a8fC17869897dcE68Ed026d694621f6FDfD
- SWAP_ROUTER: 0x2626664c2603336E57B271c5C0b26F421741e481
- NPM_ADDR: 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
2026-03-14 13:31:23 +00:00
johba
8607c097eb Merge pull request 'ci: use local git mirror as clone reference' (#758) from fix/ci-local-mirror into master 2026-03-14 14:30:24 +01:00
johba
b7a76aa0e1 Merge pull request 'fix: feat: LLM seed — Defensive Floor Hugger optimizer (#672)' (#759) from fix/issue-672 into master 2026-03-14 14:17:36 +01:00
openhands
ecc64d20b7 fix: feat: LLM seed — Defensive Floor Hugger optimizer (#672) 2026-03-14 12:48:34 +00:00
openhands
fafe317fa5 fix: feat: LLM seed — Defensive Floor Hugger optimizer (#672)
Add llm_floor_hugger.push3: pure-constant Push3 optimizer that keeps
anchorShare=0.05e18, anchorWidth=5 ticks, discoveryDepth=0.05e18, CI=0.
Ignores all staking/tax inputs — floor position is always maximised.
Transpiles without error; manifest.jsonl updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 12:48:22 +00:00
openhands
22e328e12b ci: use local git mirror as clone reference
Eliminates Codeberg git clone rate limiting. The mirror at
/git-mirrors/harb.git (synced every 2 min) provides objects locally,
so the clone step only fetches deltas from Codeberg.

Volume mounted via WOODPECKER_BACKEND_DOCKER_VOLUMES.
2026-03-14 12:44:08 +00:00
johba
057737e293 Merge pull request 'fix: fix: EVAL_MODE defaults to anvil — should default to revm (#751)' (#754) from fix/issue-751 into master 2026-03-14 13:37:20 +01:00
openhands
cd86774ac8 fix: address review findings for #751 — STATE.md and script header docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 12:17:23 +00:00
openhands
21ff729509 fix: fix: EVAL_MODE defaults to anvil — should default to revm (#751) 2026-03-14 11:56:57 +00:00
openhands
83ab1683f5 fix: fix: EVAL_MODE defaults to anvil — should default to revm (#751)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 11:56:52 +00:00
johba
fd1a06ec9f Merge pull request 'fix: feat: evolve.sh auto-incrementing per-run results directory (#752)' (#753) from fix/issue-752 into master 2026-03-14 12:47:13 +01:00
openhands
266500fde1 fix: address review findings for #752 — regex and STATE.md cleanup
- Fix run_NNN scan regex: r'run(\d+)' → r'run_(\d+)' so it correctly
  matches the underscore-separated directory names the script creates
  (previously always resolved to 001, overwriting the same dir each run)
- Remove [in-progress] tag from STATE.md entry for #752

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 11:27:53 +00:00
openhands
280253b498 fix: feat: evolve.sh auto-incrementing per-run results directory (#752) 2026-03-14 11:08:10 +00:00
openhands
b5bf53b010 fix: feat: evolve.sh auto-incrementing per-run results directory (#752)
- --output now accepts a base dir (default: evolved/) instead of requiring
  an explicit path each run
- On each invocation, scan base dir for existing run_NNN/ subdirectories,
  find the highest N, and create run_(N+1)/ for this run's outputs
- All generation JSONL files, best.push3, diff.txt, and evolution.log are
  written to the new run dir — previous runs are never overwritten
- Log header now shows both Base dir and Output (run dir) for clarity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 11:08:04 +00:00
johba
6ff8282a7e Merge pull request 'fix: Remove recenterAccess — make recenter() public with TWAP enforcement (#706)' (#713) from fix/issue-706 into master 2026-03-14 10:48:59 +01:00
openhands
0d3aee15b4 fix: address AI review findings for #706 recenterAccess removal
- DeployBase.sol: remove broken inline second recenter() (would always
  revert with 'recenter cooldown' in same Forge broadcast); replace with
  operator instructions to run the new BootstrapVWAPPhase2.s.sol script
  at least 60 s after deployment
- BootstrapVWAPPhase2.s.sol: new script for the second VWAP bootstrap
  recenter on Base mainnet deployments
- StrategyExecutor.sol: update stale docstring that still described the
  removed recenterAccess bypass; reflect permissionless model with vm.warp
- TestBase.sol: remove vestigial recenterCaller parameter from all four
  setupEnvironment* functions (parameter was silently ignored after
  setRecenterAccess was removed); update all callers across six test files
- bootstrap-common.sh: fix misleading retry recenter in
  seed_application_state() — add evm_increaseTime 61 before evm_mine so
  the recenter cooldown actually clears and the retry can succeed

All 210 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 09:15:48 +00:00
johba
42e0d93df9 Merge pull request 'fix: ENVIRONMENT.md describes Anvil as Base Sepolia but backtesting scripts use Base mainnet addresses (#729)' (#742) from fix/issue-729 into master 2026-03-14 09:58:25 +01:00
openhands
52ed8ef233 fix: red-team.sh sudo strips FORK_URL before docker compose sees it (#729)
red-team.sh called bare `sudo docker compose up/down` which applies
env_reset and drops FORK_URL before anvil-entrypoint.sh can read it.
Change both calls to `sudo -E` so the caller's FORK_URL override is
propagated to docker-compose and into the anvil container.

Update ENVIRONMENT.md to reflect that a plain `FORK_URL=... bash
red-team.sh` invocation now works correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 08:30:49 +00:00
openhands
5b4e867c4b fix: address AI review feedback on ENVIRONMENT.md Network Contexts section
- Fix factual error: bootstrap deploys KRAIKEN protocol contracts and uses
  the existing V3 Factory; it does not re-deploy Uniswap V3 infrastructure
- Fix count/characterisation: intro now says "two network contexts" (dev
  Anvil + backtesting tools) and clarifies FitnessEvaluator uses revm
  in-process, not Anvil
- Fix sudo env-stripping hazard: replace bare `export FORK_URL` instruction
  with `FORK_URL=... sudo -E bash red-team.sh` so the variable is not
  silently dropped by sudo
- Nit: add --match-test testBatchEvaluate to the FitnessEvaluator example
  to match the test file's own documented usage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 08:10:40 +00:00
openhands
f55eaae230 fix: ENVIRONMENT.md describes Anvil as Base Sepolia but backtesting scripts use Base mainnet addresses (#729)
- Clarify that the dev Anvil defaults to Base Sepolia but can be overridden
  with FORK_URL (confirmed from containers/anvil-entrypoint.sh)
- Add "Network Contexts" section distinguishing three distinct Anvil usages:
  1. Dev stack Anvil (docker-compose): Base Sepolia by default
  2. red-team.sh: requires FORK_URL=mainnet because it uses Base mainnet
     periphery addresses (V3_FACTORY, SwapRouter02, NPM)
  3. FitnessEvaluator.t.sol: independent mainnet fork via BASE_RPC_URL,
     unrelated to the docker-compose stack

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 07:28:27 +00:00
johba
319632e7ae Merge pull request 'fix: V3_FACTORY address lacks a source comment (#730)' (#740) from fix/issue-730 into master 2026-03-14 08:24:28 +01:00
openhands
bc2ed50451 fix: V3_FACTORY address lacks a source comment (#730)
Add inline Basescan URL comment identifying V3_FACTORY as the Uniswap V3
Factory on Base mainnet, consistent with the existing comment style used
for NPM_ADDR in both files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 06:57:02 +00:00
johba
76e5d72c3d Merge pull request 'fix: calculateParams in OptimizerV3Push3 has no NatSpec after this PR (#735)' (#737) from fix/issue-735 into master 2026-03-14 07:48:45 +01:00
openhands
2c849ec456 fix: calculateParams in OptimizerV3Push3 has no NatSpec after this PR (#735)
Move the orphaned NatSpec block (originally for calculateParams) from
above getLiquidityParams to directly precede calculateParams, and give
getLiquidityParams only its own @inheritdoc block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 06:20:37 +00:00
johba
7aedcc549e Merge pull request 'fix: push3-evolution description missing crossover operator (#659)' (#736) from fix/issue-659 into master 2026-03-14 07:07:10 +01:00
openhands
0a59de9b12 fix: push3-evolution description missing crossover operator (#659) 2026-03-14 05:46:48 +00:00
johba
fd3c569c82 Merge pull request 'fix: OptimizerV3 / OptimizerV3Push3 not explicitly typed against IOptimizer (#661)' (#734) from fix/issue-661 into master 2026-03-14 06:40:43 +01:00
openhands
6978d1399f fix: OptimizerV3 / OptimizerV3Push3 not explicitly typed against IOptimizer (#661)
- Optimizer: add `is IOptimizer` and mark getLiquidityParams() with
  `override`, making the interface conformance explicit at the base level.
  OptimizerV3 inherits it transitively via Optimizer.
- OptimizerV3Push3: add `is IOptimizer` and implement getLiquidityParams()
  that calls calculateParams() with zeroed inputs, returning bear-mode
  defaults (ci=0, anchorShare=0.3e18, anchorWidth=100, discoveryDepth=0.3e18).
  Behaviour is identical to the previous try/catch fallback used by
  LiquidityManager and the backtesting deployer.
- Update backtesting comments to reflect that getLiquidityParams() now
  exists on OptimizerV3Push3 (returns bear defaults via zeroed inputs).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 05:08:32 +00:00
johba
de93cb8997 Merge pull request 'fix: generation_N.jsonl candidate_id format mismatch vs filenames (#669)' (#733) from fix/issue-669 into master 2026-03-14 05:47:50 +01:00
openhands
b6c07b1d93 fix: generation_N.jsonl candidate_id format mismatch vs filenames (#669) 2026-03-14 04:27:59 +00:00
openhands
0aa819f168 fix: generation_N.jsonl candidate_id format mismatch vs filenames (#669) 2026-03-14 04:07:00 +00:00
johba
12253d6ee8 Merge pull request 'fix: batch-eval.sh header comment claims wrong candidate_id format (#668)' (#732) from fix/issue-668 into master 2026-03-14 04:57:06 +01:00
openhands
958b8cfaa0 fix: batch-eval.sh header comment claims wrong candidate_id format (#668) 2026-03-14 03:36:43 +00:00
johba
3660b68048 Merge pull request 'fix: Bare integer interpolation in agent-prompt heredoc at line 494 (#671)' (#731) from fix/issue-671 into master 2026-03-14 04:34:26 +01:00
openhands
44df166b73 fix: Bare integer interpolation in agent-prompt heredoc at line 494 (#671)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 03:07:55 +00:00
johba
0ea2840ed0 Merge pull request 'fix: NPM_ADDR may be Base Sepolia address in both files (#686)' (#727) from fix/issue-686 into master 2026-03-14 03:59:07 +01:00
openhands
729191d8ca ci: retrigger after infra failure 2026-03-14 02:32:22 +00:00
openhands
cbab4c36da fix: NPM_ADDR may be Base Sepolia address in both files (#686)
Replace 0x27F971cb582BF9E50F397e4d29a5C7A34f11faA2 (Base Sepolia
NonfungiblePositionManager) with the correct Base mainnet address
0x03a520B32c04bf3beef7BEb72E919cF822Ed34F3 in all four files that
referenced it, and add an inline comment citing the chain and source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 02:22:51 +00:00
johba
93e3495252 Merge pull request 'fix: Other clamped params lack named constants (#703)' (#725) from fix/issue-703 into master 2026-03-14 03:07:43 +01:00
openhands
9b53f409b7 fix: update e2e tests for public recenter() — remove recenterAccess references
recenterAccess() was removed from LiquidityManager in this PR.
The old tests called recenterAccess() (selector 0xdef51130) which now
reverts, causing both recenter tests to fail.

Update tests to match the new public recenter() behavior:
- Test 1: verify any address may call recenter() without "access denied"
- Test 2: same caller pattern, guard errors are still acceptable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 01:44:15 +00:00
openhands
f3ddec9427 fix: Other clamped params lack named constants (#703)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 01:40:41 +00:00
johba
051d236eb2 Merge pull request 'fix: evo_run004_champion fitness inflated by token value (#670) (#704)' (#722) from fix/issue-704 into master 2026-03-14 02:28:07 +01:00
openhands
c42a1ca768 fix: evo_run004_champion fitness inflated by token value (#670) (#704)
- Add fitness_flags="token_value_inflation" to evo_run004_champion in
  manifest.jsonl so callers can detect the inflated value without
  discarding the entry entirely.
- Add effective_fitness() helper in evolve.sh pool admission (step 5)
  that returns 0 for any entry with a token_value_inflation flag,
  preventing inflated scores from biasing the top-100 evolved pool
  ranking or eviction decisions.
- Document in evolve.sh that raw fitness values are only comparable
  within the same evaluation run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 01:08:13 +00:00
johba
d0eae8b261 Merge pull request 'fix: Issue template (push3-seed.yaml) doesn't enumerate manifest.jsonl fields (#705)' (#717) from fix/issue-705 into master 2026-03-14 01:57:24 +01:00
openhands
038c9ca7bc fix: Issue template (push3-seed.yaml) doesn't enumerate manifest.jsonl fields (#705) 2026-03-14 00:37:06 +00:00
openhands
6d23073e2f fix: Issue template (push3-seed.yaml) doesn't enumerate manifest.jsonl fields (#705) 2026-03-14 00:17:04 +00:00
johba
c5a7941259 Merge pull request 'fix: int(e.get('fitness', 0)) crashes on null-fitness manifest entries (#711)' (#715) from fix/issue-711 into master 2026-03-14 01:07:07 +01:00
openhands
b7d0b63ca1 fix: int(e.get('fitness', 0)) crashes on null-fitness manifest entries (#711) 2026-03-13 23:37:00 +00:00