Commit graph

1385 commits

Author SHA1 Message Date
johba
db1c26838d fix: _isPriceStable fallback interval can still revert on pools with very short history (#610)
Wrap the fallback pool.observe() call in a try/catch so that pools with
insufficient observation history for both the primary (30s) and fallback
(6000s) intervals return false (price unstable) instead of reverting with
an opaque Uniswap V3 error. This prevents recenter() from failing for
unpermissioned callers on newly created pools.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 20:31:04 +00:00
johba
1691128f91 Merge pull request 'fix: Investigate: adversary parasitic LP extracts 29% from holder, all recenters fail (#517)' (#1125) from fix/issue-517 into master 2026-03-22 21:16:03 +01: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
367652ec94 Merge pull request 'fix: Add audit badge and contract addresses prominently on landing (#147)' (#1123) from fix/issue-147 into master 2026-03-22 20:06:05 +01:00
johba
18166a1916 ci: retrigger pipeline
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 18:40:55 +00:00
openhands
d77081022f fix: Add audit badge and contract addresses prominently on landing (#147)
Add SecurityInfo component displayed after LiveStats on the landing page:
- Unaudited badge with planned Q3 2026 audit date
- KRAIKEN Token and Stake contract addresses with copy-to-clipboard buttons
- BaseScan and source code links
- Responsive layout for mobile viewports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 18:28:02 +00:00
johba
ef65cf6146 fix: Add audit badge and contract addresses prominently on landing (#147)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 18:20:07 +00:00
johba
723476d4f6 Merge pull request 'fix: testMomentumFullBearAtNegMaxDelta has no slot assertions (#1011)' (#1121) from fix/issue-1011 into master 2026-03-22 19:14:46 +01:00
johba
d2c1e83962 fix: testMomentumFullBearAtNegMaxDelta has no slot assertions (#1011)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:50:41 +00:00
johba
65f931ceac Merge pull request 'fix: Floor Ratchet attack not yet defeated — needs explicit test (#1067)' (#1120) from fix/issue-1067 into master 2026-03-22 18:34:52 +01: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
7396bd371f Merge pull request 'fix: run-attack-suite is spec-only — no implementation in red-team.sh (#1000)' (#1119) from fix/issue-1000 into master 2026-03-22 17:26:11 +01:00
johba
36cda487e6 fix: forward attack_dir input to red-team.sh invocation in formula
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:54:41 +00:00
johba
52ba6b2f38 fix: run-attack-suite is spec-only — no implementation in red-team.sh (#1000)
Implement the attack catalogue loop (step 5a) in red-team.sh that was
previously a forward spec in the formula. The loop replays every *.jsonl
attack file through AttackRunner.s.sol with snapshot revert between files,
records LM total ETH before/after each attack, and injects results into
the adversarial agent prompt so it knows which strategies are already
catalogued.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:30:46 +00:00
johba
311b8192f6 Merge pull request 'fix: Catch block skips clamping that try block applies (#1019)' (#1118) from fix/issue-1019 into master 2026-03-22 16:06:02 +01:00
johba
dd98283589 Merge pull request 'chore: planner run — prerequisite tree update' (#1117) from chore/planner-20260322-1426 into master 2026-03-22 15:46:02 +01:00
johba
bdc17645f9 fix: Catch block skips clamping that try block applies (#1019)
Add defence-in-depth assert statements in recenter()'s catch block to
verify bear-mode constants (CI=0, AS=30%, AW=100, DD=0.3e18) satisfy
the same bounds the try-path clamps to (MAX_PARAM_SCALE, MAX_ANCHOR_WIDTH).

Add test verifying bear defaults are within clamping bounds and that the
catch path deploys all three positions (floor, anchor, discovery).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 14:31:49 +00:00
johba
b8f442eeb2 chore: planner run 2026-03-22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 14:26:40 +00:00
johba
94309cd5a6 Merge pull request 'fix: bootstrap-light.sh lacks Push3 candidate injection (#999)' (#1116) from fix/issue-999 into master 2026-03-22 15:16:04 +01:00
johba
ead80eb3cb Merge pull request 'chore: planner run — prerequisite tree update' (#1115) from chore/planner-20260322-1318 into master 2026-03-22 14:36:03 +01:00
johba
349bd2c2c6 fix: bootstrap-light.sh lacks Push3 candidate injection (#999)
Add CANDIDATE env var support to bootstrap-light.sh. When set to a
.push3 file path, the script:
1. Invokes push3-transpiler to regenerate OptimizerV3Push3.sol
2. Extracts the function body into OptimizerV3Push3Lib.sol
3. Deploys contracts normally via DeployLocal.sol
4. Deploys OptimizerV3 and upgrades the UUPS proxy via upgradeTo()

Also updates formulas/run-red-team.toml to reflect the implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 13:19:48 +00:00
johba
cbc41ad57c chore: planner run 2026-03-22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:18:41 +00:00
johba
29b8f7d426 Merge pull request 'fix: Overflow guard missing for slots 1-7 in both Optimizer.sol and OptimizerV3Push3.sol (#997)' (#1114) from fix/issue-997 into master 2026-03-22 13:56:02 +01:00
johba
cea4bf779b ci: retry pipeline
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:25:24 +00:00
johba
c59bb81a40 fix: Overflow guard missing for slots 1-7 in both Optimizer.sol and OptimizerV3Push3.sol (#997)
Add <= 1e18 upper-bound check for all 8 input slots in the validation
loops of both Optimizer.calculateParams() and OptimizerV3Push3Lib.calculateParams().

Previously only slot 0 (percentageStaked) had an overflow guard —
slots 1-7 (averageTaxRate and future indicators) could silently accept
values > 1e18, violating the documented [0, 1e18] invariant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:11:03 +00:00
johba
b8ee408b73 Merge pull request 'chore: planner run — prerequisite tree update' (#1113) from chore/planner-20260322-1104 into master 2026-03-22 12:46:03 +01:00
johba
1b4de1c081 Merge pull request 'fix: Attack file schema for burn_lp needs documentation and migration (#615)' (#1111) from fix/issue-615 into master 2026-03-22 12:45:03 +01:00
johba
27ff88c31b ci: retry pipeline 2026-03-22 11:16:37 +00:00
johba
bcfb81eab5 chore: planner run 2026-03-22
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:04:35 +00:00
johba
c9ffef279f Merge pull request 'docs: RESOURCES.md — add dispatch mechanism and formula inventory' (#1112) from docs/resources-dispatch into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1112
2026-03-22 11:56:19 +01:00
johba
9267537a14 docs: RESOURCES.md — add dispatch mechanism, formula inventory, and constraints
Planner needs to know HOW to use resources, not just that they exist.
Adds action dispatch instructions, lists all available formulas, and
documents the port 8545 constraint for concurrent formula runs.

Supports disinto #544 (planner formula dispatch awareness).
2026-03-22 11:56:03 +01:00
johba
112182d2e2 Merge pull request 'chore: planner run — prerequisite tree update' (#1110) from chore/planner-20260322-1044 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1110
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-22 11:55:46 +01:00
johba
ce9be22d2e fix: Attack file schema for burn_lp needs documentation and migration (#615)
Add SCHEMA.md documenting the JSONL attack file format with all operation
definitions, field types, and the burn_lp tokenId convention divergence
between AttackRunner (.positionIndex) and FitnessEvaluator (.tokenId).

Add schema-version header comments to all existing attack files and teach
both consumers to skip comment lines starting with //.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:53:07 +00:00
johba
02ca80fd5a chore: planner run 2026-03-22 2026-03-22 10:44:42 +00:00
johba
e22e6ac7bb Merge pull request 'fix: Attack files have hardcoded tokenIds that are fork-block-sensitive (#614)' (#1109) from fix/issue-614 into master 2026-03-22 11:34:45 +01:00
johba
0b6442a87c fix: Attack files have hardcoded tokenIds that are fork-block-sensitive (#614)
Make burn_lp ops fork-block-independent by using a 1-based positionIndex
(resolved at runtime from prior mint_lp ops) instead of hardcoded NFT
tokenIds. Mirrors the existing pattern used by unstake/_stakedPositionIds.

Also log a warning when burn_lp encounters zero liquidity instead of
silently becoming a no-op.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:11:58 +00:00
johba
a5d74ced81 Merge pull request 'fix: config.ts reads infrastructure.weth but no tooling generates it (#611)' (#1108) from fix/issue-611 into master 2026-03-22 11:04:14 +01:00
johba
e14dbf59dc ci: retry pipeline 2026-03-22 09:40:43 +00:00
johba
6a1bb71463 fix: config.ts reads infrastructure.weth but no tooling generates it (#611)
Add infrastructure.weth to deployments-local.json output in both
bootstrap-common.sh (write_deployments_json) and bootstrap-light.sh,
so non-Base local forks get the correct WETH address from the
deployment file instead of silently falling back to the Base hardcode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 09:29:28 +00:00
johba
b2bbdd28ed Merge pull request 'chore: seed prerequisite tree + RESOURCES.md' (#1106) from chore/seed-planner-tree into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1106
2026-03-22 09:10:15 +01:00
johba
c238bd1f57 chore: seed prerequisite tree + RESOURCES.md
Prerequisite tree seeded from VISION.md milestones with current issue state.
Top 3 constraints: contract safety (#1031/#997/#1067), OptimizerV3 tests (#1054),
evolution commits via PR (#1047).

RESOURCES.md lists evolution box, Codeberg accounts, CI, and RPC access.

Part of disinto #502 (planner v2).
2026-03-22 09:09:58 +01:00
johba
5c9cf81589 Merge pull request 'fix: shouldRecordVWAP else-branch fires incorrectly when lastRecenterTick==0 after bootstrap (#609)' (#1102) from fix/issue-609 into master 2026-03-22 09:06:03 +01:00
johba
cb4525c46c Merge pull request 'chore: gardener housekeeping 2026-03-22' (#1097) from chore/gardener-20260322-0607 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1097
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-22 08:47:28 +01:00
johba
83a1b576e4 chore: gardener housekeeping 2026-03-22
- Update all AGENTS.md watermarks to HEAD (5f01d55)
- Add feeDestinationLocked and recenterAccess removal to onchain/AGENTS.md guardrails
- Add gardener/dust.jsonl accumulator (6 dust items: onchain comments, evidence schema docs)

Issues actioned via API:
- Closed #1085 as duplicate of #1082
- Promoted #1079, #1082, #1084 to backlog with acceptance criteria
- Unblocked #607, #609, #610, #611, #614, #615 (dev-crash blockers, no technical blockers)
- Added dependency-resolved comment to #1054 (dep #970 now closed)
2026-03-22 08:47:11 +01:00
johba
63dafd82ca fix: shouldRecordVWAP else-branch fires incorrectly when lastRecenterTick==0 after bootstrap (#609)
Add `_hasRecenterTick` boolean guard to decouple bootstrap detection from
VWAP volume tracking. Before this fix, the bootstrap condition relied solely
on `cumulativeVolume == 0`, which made `lastRecenterTick==0` ambiguous:
it could mean "never recentered" or "previous recenter landed at tick 0
(price = 1.0 token ratio)".

The new guard ensures the direction comparison in the else-branch only
runs after a recenter has explicitly set `lastRecenterTick`, eliminating
the tick-0 ambiguity. Belt-and-suspenders: both `!_hasRecenterTick` and
`cumulativeVolume == 0` trigger bootstrap.

Tests added:
- test_hasRecenterTickGuardPreventsTick0Ambiguity
- test_vwapFrozenDuringBuyOnlyAfterSellRecenter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 07:28:08 +00:00
johba
f99e7b9e8b Merge pull request 'fix: No Foundry test for OptimizerV3 calculateParams correctness (#607)' (#1098) from fix/issue-607 into master 2026-03-22 08:06:02 +01:00
johba
87912b06da fix: No Foundry test for OptimizerV3 calculateParams correctness (#607)
Add table-driven Foundry tests for OptimizerV3.calculateParams covering:
- Bear regime at 0%, 1%, 50%, 91% staking (all tax rates)
- Bull/bear boundary at 92% with tax index transitions
- Bull/bear at 95% with penalty=50 exact boundary
- EffIdx shift behavior at 96% (taxIdx 13→14 discontinuity)
- Bull at 97% with max tax, 100% always bull
- Edge cases: all-zero inputs, zero tax at high staking
- Mantissa overflow guard
- Unused slots ignored
- Fuzz: no reverts, output always exactly bear or bull

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:31:06 +00:00
johba
a3de10bf1d Merge pull request 'fix: fitness_flags not propagated to manifest entries for newly admitted candidates (#990)' (#1096) from fix/issue-990 into master 2026-03-22 07:14:02 +01:00
johba
abac7f7ed7 fix: use None instead of '' for absent fitness_flags to match schema
Review feedback: d.get('fitness_flags') without a default preserves the
null vs absent distinction mandated by the manifest schema (string | null).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:02:20 +00:00