Commit graph

49 commits

Author SHA1 Message Date
openhands
8cfbf74e89 fix: address review feedback on bootstrap recovery (#644)
- Fix positions() ABI selector: uint256 -> uint8 (Stage enum)
- Replace fixed sleeps with polling loops checking on-chain timestamps
- Add trailing period to 'amplitude not reached.' error hint
- Remove 'was never set' feeDestination scenario (always set by deploy)
- Clarify warning comment scope in bootstrap-common.sh

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:59:21 +00:00
openhands
fbe8384342 fix: No recovery path if VWAP bootstrap fails mid-sequence (#644)
Add recovery procedure documentation and automated recovery script for
when the VWAP bootstrap fails partway through (e.g. second recenter
reverts due to insufficient price movement).

- Add "Recovery from failed mid-sequence bootstrap" section to
  docs/mainnet-bootstrap.md with diagnosis steps and manual recovery
- Create scripts/recover-bootstrap.sh to automate diagnosis and retry
- Add warning comments in BootstrapVWAPPhase2.s.sol, DeployBase.sol,
  and bootstrap-common.sh referencing the recovery procedure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:24:05 +00:00
openhands
cf87ade05a fix: manifest.jsonl schema is undocumented — no canonical field list exists anywhere (#718)
Add a Push3 Seed Pool section to docs/ARCHITECTURE.md documenting all
manifest.jsonl fields (file, origin, date, fitness, fitness_flags, run,
generation, note) with type, required/optional status, and allowed values.
References the machine-readable manifest.schema.json for validation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 11:58:37 +00:00
openhands
1d5390be96 fix: Pre-existing: feeDestination source reference also points to wrong line (#913)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 20:18:44 +00:00
openhands
3770fa9554 fix: Staking pool exclusion also has an undocumented conditional guard (#889) 2026-03-17 12:16:45 +00:00
openhands
7628e428c7 fix: ARCHITECTURE.md staking pool bullet missing its own conditional guard (#892) 2026-03-17 11:05:54 +00:00
openhands
296c7a2dea fix: ARCHITECTURE.md staking pool bullet missing its own conditional guard (#892) 2026-03-17 10:49:05 +00:00
openhands
f491f30f90 fix: ARCHITECTURE.md staking pool bullet missing its own conditional guard (#892) 2026-03-17 10:26:47 +00:00
openhands
1d121ab24f fix: txn-bot port 43069 not published to host (#899)
Add ports mapping 127.0.0.1:43069:43069 to txn-bot service in
docker-compose.yml, matching the pattern used by ponder. Add txnBot
status URL to ENVIRONMENT.md Common URLs section for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 07:07:31 +00:00
openhands
6a01d55ced fix: txnBot not covered by any phase documentation (#895) 2026-03-16 21:37:27 +00:00
openhands
dc2de3d470 fix: ARCHITECTURE.md omits conditional guard on feeDestination exclusion (#663) 2026-03-16 18:06:57 +00:00
openhands
ad56669fe3 fix: PRODUCT-TRUTH.md Fee Destination section omits the same conditional guard (#664) 2026-03-16 17:37:12 +00:00
openhands
10c90e4c50 fix: address AI review findings on SECURITY_REVIEW.md and deployment.md (#838)
- M-2: update body to show current deployer-only setFeeDestination()
  implementation and conditional locking; mark as partially resolved;
  downgrade severity from Medium to Low; update conclusion entry
- I-1: mark as resolved — Recentered event declared at line 66 and
  emitted at line 224 of LiquidityManager.sol
- I-2: correct VWAP direction (records on sells/ETH outflow, not buys);
  update stale line reference from 146-158 to 177-191
- deployment.md §6.5: replace vague 'assess severity' step 1 with
  concrete action (upgrade optimizer to bear defaults via §6.2)
- deployment.md §8 timeline: remove stale 'Set recenter access' row;
  update 'First recenter' dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 15:15:33 +00:00
openhands
9b75817300 fix: SECURITY_REVIEW.md references obsolete recenterAccess pattern (#838)
- Update M-3 finding: recenterAccess was removed; MIN_RECENTER_INTERVAL
  (60s) cooldown now enforced unconditionally — downgrade severity to
  Informational (resolved)
- Update Access Control Summary: remove recenterAccess rows, reflect
  permissionless recenter() with cooldown
- Update Conclusion: mark M-3 as resolved
- Fix stale M-1 impact note that mentioned recenterAccess as a workaround
- deployment.md: remove Section 3.2 "Set Recenter Access" (setRecenterAccess
  no longer exists); update 3.3 first-recenter comment
- deployment.md: replace recenterAccess() verification call with
  lastRecenterTime() check
- deployment.md §6.1: rewrite Pause Recentering note — no access-control
  switch exists, cooldown is the only rate limiter
- deployment.md §6.5: remove stale setRecenterAccess(0xdEaD) instruction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 14:43:37 +00:00
openhands
0d09f598d9 fix: Hardcoded TWAP/cooldown values not documented (#825)
Document MIN_RECENTER_INTERVAL (60 s, LiquidityManager.sol:61) and
PRICE_STABILITY_INTERVAL (300 s, PriceOracle.sol:14) in
docs/ARCHITECTURE.md and docs/PRODUCT-TRUTH.md so that agent-facing
and product-facing copy stays traceable to source constants.

Add an inline HTML comment in red-team-program.md next to the
hardcoded 60s/300s sentence pointing to the two source constants,
making drift detectable during code review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 19:51:52 +00:00
openhands
d3917c551f fix: ThreePositionStrategy class comment still advertises 1-100% anchor width (#786)
- Fix class-level NatSpec: use accurate wording (width computed from
  anchorWidth param provided by Optimizer) instead of imprecise
  LiquidityManager attribution
- Fix inline comment in _setAnchorPosition (same stale 1-100% claim)
- Update PRODUCT-TRUTH.md and ARCHITECTURE.md which had the same
  incorrect 1-100% range claim

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 08:51:12 +00:00
openhands
4d16a51650 fix: address review feedback on mainnet-bootstrap runbook (#728)
- docs/mainnet-bootstrap.md: fix Step 4c to use SwapRouter02 7-field
  struct (no deadline field); the 8-field ABI was for SwapRouter v1 but
  the address is SwapRouter02
- docs/mainnet-bootstrap.md: correct Step 1 to no longer falsely claim
  that pre-bootstrap transactions succeed when Forge aborts on simulation
  failure; Step 1 now reflects the try/catch behaviour added below
- docs/mainnet-bootstrap.md: Step 6 drops --private-key flag (Foundry
  ignores it when vm.startBroadcast(privateKey) is called internally)
  and documents that the .secret seed-phrase file must be present
- docs/mainnet-bootstrap.md: remove no-op `export LM_ADDRESS="$LM_ADDRESS"`
- docs/mainnet-bootstrap.md: cite exact line range (101-145) in
  Troubleshooting workaround instead of informal marker description
- onchain/script/DeployBase.sol: wrap liquidityManager.recenter() and
  seed buy in try/catch so a fresh-pool TWAP revert skips the inline
  bootstrap with a warning rather than aborting the entire simulation
- onchain/script/DeployBase.sol: fix --fork-url to --rpc-url in the
  post-deploy console.log hint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 18:35:48 +00:00
openhands
023c661ee7 fix: No mainnet VWAP bootstrap runbook (#728)
Add docs/mainnet-bootstrap.md with the full two-phase bootstrap
sequence: pool init, 300 s TWAP warm-up wait, first recenter + seed
buy (exact cast commands), 60 s cooldown wait, second recenter via
BootstrapVWAPPhase2.s.sol, and verification/troubleshooting steps.

Update the inline bootstrap comment in DeployBase.sol to warn that the
attempt always reverts on a fresh pool and direct operators to the new
runbook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 18:04:11 +00: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
openhands
0a59de9b12 fix: push3-evolution description missing crossover operator (#659) 2026-03-14 05:46:48 +00:00
openhands
b5cf1ea600 fix: ARCHITECTURE.md missing tools/ directory entry (#561) 2026-03-13 06:37:02 +00:00
openhands
b902b89e3b fix: address review findings — CREATE2 guard, transition test, docs
- LiquidityManager.setFeeDestination: add CREATE2 bypass guard — also
  blocks re-assignment when the current feeDestination has since acquired
  bytecode (was a plain address when set, contract deployed to it later)
- LiquidityManager.setFeeDestination: expand NatSpec to document the
  EOA-mutability trade-off and the CREATE2 guard explicitly
- Test: add testSetFeeDestinationEOAToContract_Locks covering the
  realistic EOA→contract transition (the primary lock-activation path)
- red-team.sh: add comment that DEPLOYER_PK is Anvil account-0 and must
  only be used against a local ephemeral Anvil instance
- ARCHITECTURE.md: document feeDestination conditional-lock semantics and
  contrast with Kraiken's strictly set-once liquidityManager/stakingPool

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 17:13:50 +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
e09a995733 fix: KRK fees to feeDestination undocumented (#458) 2026-03-06 00:32:18 +00:00
openhands
496a464baf fix: KRK fees to feeDestination undocumented (#458) 2026-03-06 00:01:28 +00:00
openhands
5c7b488753 docs: clarify fees go to protocol treasury, not holders
- Add Fee Destination section to PRODUCT-TRUTH.md
- Explicitly ban 'fees grow your KRK value' and 'auto-compounding' claims
- Clarify holder value comes from asymmetric slippage, not fee reinvestment
- Fix misleading 'floor always goes up if fee income exceeds sell pressure'
- Update ARCHITECTURE.md feeDestination annotation
2026-03-05 12:02:45 +01:00
openhands
6432c07b12 fix: correct txnBot description in ARCHITECTURE.md directory map 2026-03-03 04:56:40 +00:00
openhands
57b256b7e0 fix: services/txnBot missing from ARCHITECTURE.md directory map (#369) 2026-03-03 04:11:08 +00:00
openhands
47174c3dfe fix: ENVIRONMENT.md documents contracts.env with VITE_ prefixes that do not match the actual file (#386)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 01:21:48 +00:00
openhands
c9fe1ab178 fix: tests/setup/stack.ts: contract addresses have no env var override path (#391)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 22:34:44 +00:00
openhands
e8c6070846 fix: kraiken-lib missing from ARCHITECTURE.md directory map (#342) 2026-02-28 11:20:50 +00:00
openhands
cf4e401d03 fix: address review feedback on LocalSwapWidget and CheatsView
- LocalSwapWidget: move useWallet() to top-level <script setup> (was
  incorrectly called inside async buyKrk() event handler)
- LocalSwapWidget + CheatsView: fix misleading toast — all transactions
  are fully confirmed at that point, so say 'Swap complete' not 'Swap
  submitted'
- LocalSwapWidget: add $KRK sigil to warning/hint text for consistency
  with GetKrkView
- LocalSwapWidget: add comment on amountOutMinimum: 0n explaining it is
  intentional for a no-MEV local anvil environment
- CheatsView: apply same useWallet() fix (pre-existing anti-pattern)
- docs/ENVIRONMENT.md: document VITE_ENABLE_LOCAL_SWAP and related
  VITE_ variables in a new webapp env-var table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 10:32:04 +00:00
openhands
b66a8afcaa fix: \VueQueryPlugin\ possibly dead dependency (#195)
Clarify that @tanstack/vue-query is a required peer dependency of
@wagmi/vue, not a dead import. Add a comment in main.ts explaining the
rationale, and document the dependency in ARCHITECTURE.md and
landing/AGENTS.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 21:13:02 +00:00
openhands
878d1337df fix: Clean up dead code and stale domain references across landing + web-app (#189)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 13:04:02 +00:00
openhands
5bd4cf5144 fix: Housekeeping: remove tracked logs/review.log + fix stale CI URL in docs (#187)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 11:30:37 +00:00
openhands
58c3e62f3d fix: refactor AGENTS.md into progressive-disclosure structure (#184)
- Root AGENTS.md: 350+ lines → 68 lines (map, not encyclopedia)
- New docs/dev-environment.md (67 lines): Docker, dev.sh, ports, pitfalls
- New docs/ci-pipeline.md (73 lines): Woodpecker setup, monitoring, debugging
- New docs/testing.md (41 lines): Foundry, E2E, version validation
- New docs/codeberg-api.md (32 lines): .netrc auth, API usage
- Updated stale model refs in .claude-code-supervisor.yml files
- Sub-component AGENTS.md files unchanged
- Context docs (PRODUCT-TRUTH, ARCHITECTURE, UX-DECISIONS) unchanged
2026-02-23 09:46:35 +00:00
openhands
0fb1ed4bf8 fix: address review — migration comment, link ring buffer constants (#170) 2026-02-22 18:56:36 +00:00
openhands
533c5755b5 fix: remove staking references from landing page
Landing page sells the token, not staking. Staking is password-protected
for insiders — not advertised to casual visitors.

- 'Stake in 30 Seconds' → 'Get $KRK in 30 Seconds' (Mixed)
- 'Stake & Grow' → 'Get $KRK' (Offensive)
- Remove 'staker sentiment' from HomeView copy
- Add staking visibility rule to UX-DECISIONS.md
2026-02-22 16:49:02 +00:00
johba
396f2b5f90 docs: layered information architecture (#140) (#163) 2026-02-20 09:01:11 +01:00
openhands
de3c8eef94 docs: consolidate and update all documentation for launch readiness
- Rewrite root README.md with proper project overview, tech stack, and repo structure
- Remove duplicate CLAUDE.md files (root, onchain, ponder) — AGENTS.md is the standard
- Update HARBERG.md to reflect Stage 1 completion and Stage 2 evolution
- Delete stale onchain/testing_todos.md (all high-priority items completed)
- Update VERSION_VALIDATION.md for VERSION=2
- Trim root AGENTS.md: replace Docker duplication with docs/docker.md reference
- Trim onchain/AGENTS.md (129→71 lines): reference TECHNICAL_APPENDIX for formulas
- Trim web-app/AGENTS.md (278→55 lines): remove internal API docs, keep architecture
- Rewrite onchain/README.md: add contract table, deployment addresses, analysis links
- Trim services/ponder/README.md: remove stale subgraph comparison
- Add otterscan to docs/docker.md service topology
- Update TECHNICAL_APPENDIX.md references

Net: -388 lines across documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:22:34 +00:00
openhands
85350caf52 feat: OptimizerV3 with direct 2D staking-to-LP parameter mapping
Core protocol changes for launch readiness:

- OptimizerV3: binary bear/bull mapping from (staking%, avgTax) — avoids
  exploitable AW 30-90 kill zone. Bear: AS=30%, AW=100, CI=0, DD=0.3e18.
  Bull: AS=100%, AW=20, CI=0, DD=1e18. UUPS upgradeable with __gap[48].
- Directional VWAP: only records prices on ETH inflow (buys), preventing
  sell-side dilution of price memory
- Floor formula: unified max(scarcity, mirror, clamp) — VWAP mirror uses
  distance from adjusted VWAP as floor distance, no branching
- PriceOracle (M-1 fix): correct fallback TWAP divisor (60000s, not 300s)
- Access control (M-2 fix): deployer-only guard on one-time setters
- Recenter rate limit (M-3 fix): 60-second cooldown for open recenters
- Safe fallback params: recenter() optimizer-failure defaults changed from
  exploitable CI=50%/AW=50 to safe bear-mode CI=0/AW=100
- Recentered event for monitoring and indexing
- VERSION bump to 2, kraiken-lib COMPATIBLE_CONTRACT_VERSIONS updated

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:21:18 +00:00
johba
e5e1308e72 refactor: consolidate CI and local dev orchestration (#108)
## Summary
- Extract shared bootstrap functions into `scripts/bootstrap-common.sh` (eliminates ~120 lines of duplicated forge/cast commands from e2e.yml)
- Create reusable `scripts/wait-for-service.sh` for health checks (replaces 60-line inline wait-for-stack)
- Merge dev and CI entrypoints into unified scripts branching on `CI` env var (delete `docker/ci-entrypoints/`)
- Replace 4 per-service CI Dockerfiles with parameterized `docker/Dockerfile.service-ci`
- Add `sync-tax-rates.mjs` to CI image builder stage
- Fix: CI now grants txnBot recenter access (was missing)
- Fix: txnBot funding parameterized (CI=10eth, local=1eth)
- Delete 5 obsolete migration docs and 4 DinD integration files

Net: -1540 lines removed

Closes #107

## Test plan
- [ ] E2E pipeline passes (bootstrap sources shared script, services use old images with commands override)
- [ ] build-ci-images pipeline builds all 4 services with unified Dockerfile
- [ ] Local dev stack boots via `./scripts/dev.sh start`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/108
2026-02-03 12:07:28 +01:00
johba
5d71753086 migrate/podman-to-docker (#92)
podman to docker

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/92
2025-11-08 14:08:46 +01:00
johba
371a8557b7 improve web-app config 2025-10-11 10:55:49 +00:00
johba
4f7cebda56 start stack from container (#40)
resolves #36

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/40
2025-10-02 17:11:22 +02:00
johba
3ab2d9454a health checks (#39)
resolves #35

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/39
2025-10-02 14:37:59 +02:00
johba
18d63e14d7 podman wip 2025-09-24 12:12:54 +00:00