Commit graph

1154 commits

Author SHA1 Message Date
openhands
d3ff2cd0bf fix: Bear defaults duplicated across Optimizer and LiquidityManager (#646)
Extract bear-mode default values (0, 3e17, 100, 3e17) into file-level
constants in IOptimizer.sol so both Optimizer._bearDefaults() and
LiquidityManager.recenter()'s catch block reference a single source of
truth instead of independent hardcoded literals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 18:22:43 +00:00
johba
2778d6d5ba Merge pull request 'fix: formula scripts broken on evolution box (#1006, #1007, #1008)' (#1009) from fix/formula-scripts into master 2026-03-19 19:06:40 +01:00
johba
b348c4872c Merge pull request 'fix: OptimizerInputCapture test harness is structurally broken (#652)' (#1005) from fix/issue-652 into master 2026-03-19 18:55:13 +01:00
openhands
357659d5c4 ci: retrigger after infra failure (#652) 2026-03-19 17:22:43 +00:00
openhands
5a7363b718 fix: move @return NatSpec from _buildInputs to getLiquidityParams
The @return annotations were orphaned after _buildInputs() was inserted
between the NatSpec block and getLiquidityParams(). Move them to directly
precede getLiquidityParams() where they belong.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 17:08:26 +00:00
openhands
fdf9338a86 fix: formula scripts broken on evolution box (#1006, #1007, #1008)
- red-team.sh: pipe prompt via stdin to avoid E2BIG (#1007)
- inject.sh: use tsx instead of ts-node for Node >= 22 ESM (#1008)
- evaluate.sh: add submodule init + forge build before kraiken-lib (#1006)
2026-03-19 14:09:38 +00:00
openhands
bb150671ea fix: OptimizerInputCapture test harness is structurally broken (#652)
The pure override in OptimizerInputCapture could not write to storage,
and getLiquidityParams calls calculateParams via staticcall which
prevents both storage writes and event emissions.

Fix: extract the input-building normalization from getLiquidityParams
into _buildInputs() (internal view, behavior-preserving refactor).
The test harness now exposes _buildInputs() via getComputedInputs(),
allowing tests to assert actual normalized slot values.

Updated tests for pricePosition, timeSinceRecenter, volatility,
momentum, and utilizationRate to assert non-zero captured values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 13:57:25 +00:00
johba
411c567cd6 Merge pull request 'fix: manifest.jsonl schema is undocumented — no canonical field list exists anywhere (#718)' (#1002) from fix/issue-718 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1002
2026-03-19 13:46:41 +01: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
johba
c824489c23 Merge pull request 'fix: Formula: run-evolution (optimizer pipeline) (#975)' (#1001) from fix/issue-975 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/1001
2026-03-19 12:46:00 +01:00
openhands
708a00a2f4 fix: Formula: run-evolution (optimizer pipeline) (#975)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 11:25:01 +00:00
johba
166c9c14d1 Merge pull request 'fix: Formula: run-red-team (adversarial attack + discovery) (#976)' (#998) from fix/issue-976 into master 2026-03-19 12:14:41 +01:00
openhands
152f6e0a40 fix: Formula: run-red-team (adversarial attack + discovery) (#976)
Address review feedback:
- Remove candidate input (Push3 transpilation not wired; documented in
  notes.candidate_injection as planned follow-up)
- Mark run-attack-suite step as status="planned" with run_attack_suite_gap note
- Update execution.invocation to only pass env vars red-team.sh actually reads
- Fix export-vectors args to include --eth-extracted and --eth-before flags
- Clarify export-vectors only runs when floor_broken (BROKE=true)
- Document tmp/red-team-snapshots.jsonl (AttackRunner replay side output)
- Add comment that {attack_type} in products.attack_vectors.path is
  runtime-computed by promote-attacks.sh, not a formula input
- Fix schema comment notation (§ → ##)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 12:04:56 +01:00
openhands
3564c4ad25 fix: Formula: run-red-team (adversarial attack + discovery) (#976)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 12:04:56 +01:00
johba
5c4ceaf78d fix: No negative-mantissa guard in OptimizerV3Push3 (#650) (#966)
Fixes #650

## Changes
Add require(inputs[k].mantissa >= 0, 'negative mantissa') for all 8 input slots inside the existing validation loop in OptimizerV3Push3.sol, matching the guard pattern in Optimizer.sol lines 372-374. Added 3 tests covering slots 0, 1, and 5 to confirm revert on negative mantissa.

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/966
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-19 11:30:18 +01:00
johba
bab3a6751d Merge pull request 'fix: Formula: run-holdout (PR quality gate) (#977)' (#996) from fix/issue-977 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/996
2026-03-19 10:58:31 +01:00
openhands
d278954b44 fix: Formula: run-holdout (PR quality gate) (#977)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 10:58:15 +01:00
johba
14722fab55 Merge pull request 'fix: Formula: run-user-test (persona UX evaluation) (#978)' (#995) from fix/issue-978 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/995
2026-03-19 10:58:03 +01:00
openhands
27f841927e fix: Formula: run-user-test (persona UX evaluation) (#978)
Add formulas/run-user-test.toml — a sense-only process definition for
persona-based UX evaluation. Defines 5 personas across 2 funnels
(passive-holder: tyler/alex/sarah; staker: priya/marcus), full stack
lifecycle (start → run → collect → stop → deliver), and the three
standard evidence delivery products (evidence JSON committed to main,
screenshots referenced in evidence, summary as issue comment).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 09:10:14 +00:00
johba
adc20733ce Merge pull request 'fix: Evidence directory structure for process results (#973)' (#994) from fix/issue-973 into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/994
2026-03-19 09:55:27 +01:00
openhands
7dbee803fb fix: Evidence directory structure for process results (#973)
Add evidence/ with subdirs for evolution, red-team, holdout, and user-test.
Each subdir has a .gitkeep and README.md documents the JSON schema for all four
process types so formulas and the planner have a canonical contract to read/write.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 08:28:04 +00:00
johba
bbf1d8f6e6 Merge pull request 'fix: Red-team attack vector promotion: tmp/ → git via PR (#974)' (#993) from fix/issue-974 into master 2026-03-19 09:15:08 +01:00
openhands
5fa08f1a53 fix: address promote-attacks review feedback (#974)
- cleanup_worktree: add `git branch -D $BRANCH` to prevent stale local
  branch refs accumulating on push failure (bug fix)
- .netrc parser: replace fragile line-count awk with field-iteration
  approach that handles both multi-line and single-line .netrc formats
- ETH formatting: pass values as argv to python3 instead of interpolating
  into the code string, removing the injection surface
- mktemp -u: generate path without pre-creating directory; git worktree
  add creates it, avoiding the "already exists" error on some git versions
- mkdir -p guard before cp to attacks destination directory
- sed portability: `s/-\+/-/g` → `s/--*/-/g` (POSIX-compliant)
- red-team.sh: capture PIPESTATUS[0] from promote-attacks pipe and emit
  a distinct warning log line when promotion fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 07:48:24 +00:00
openhands
c84b0c27f5 ci: retrigger after infra failure (#974) 2026-03-19 07:14:24 +00:00
openhands
12940f1201 fix: Red-team attack vector promotion: tmp/ → git via PR (#974)
Add scripts/harb-evaluator/promote-attacks.sh which:
- Reads tmp/red-team-attacks.jsonl after a successful red-team run
- Deduplicates by op-type fingerprint against all existing attack files
- Classifies attack type (staking, il-crystallization, fee-drain-oscillation,
  floor-ratchet, lp-manipulation, floor-attack) from the op sequence
- Creates an isolated git worktree branch from origin/master
- Commits the attack file to onchain/script/backtesting/attacks/<type>-<candidate>.jsonl
- Opens a Codeberg PR with attack type, ETH extracted, and optimizer profile

Integrate into red-team.sh: when the floor breaks (ETH extracted) and an
attack export exists, promote-attacks.sh is called automatically (non-fatal).
Gracefully no-ops when CODEBERG_TOKEN / ~/.netrc are absent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 06:50:34 +00:00
johba
e105d91818 Merge pull request 'ci: exclude formulas/ and evidence/ from build and e2e pipelines' (#992) from chore/ci-exclude-formulas-evidence into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/992
2026-03-19 07:34:48 +01:00
openhands
d0131b06c2 ci: exclude formulas/ and evidence/ from build and e2e pipelines
These directories contain TOML process definitions and JSON evidence
files — no code changes that need testing. Also excludes docs/ and
*.md from the main CI pipeline (e2e already excluded these).

Prepares for formula and evidence PRs landing without triggering
unnecessary CI runs.
2026-03-19 07:34:38 +01:00
johba
052ad7ac1c fix: bundled dust cleanup — push3-evolution/evolve.sh (#210) (#987)
## Summary

Bundled dust cleanup for `push3-evolution/evolve.sh` subsystem:

- **#716**: Fix null-fitness crash in generation JSONL parsing — `int(d.get('fitness', 0))` → `int(d.get('fitness') or 0)` (avoids `TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'` when fitness is JSON `null`)
- **#944**: Add `processExecIf_fix` to `ZERO_RATED_FLAGS` so inflated scores from that flag are zero-rated during pool admission/eviction
- **#945**: `fitness_flags` is comma-separated in practice — update `manifest.schema.json` description from 'Space-separated' to 'Comma-separated' and use `flags.split(',')` in `effective_fitness` instead of substring match
- Fix pre-existing SC2086: quote `$i` in `printf` argument (ShellCheck)

## Test plan
- [ ] ShellCheck passes on `tools/push3-evolution/evolve.sh`
- [ ] CI passes

🤖 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/987
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-19 07:33:23 +01:00
johba
e37a93e0e2 Merge pull request 'fix: BootstrapVWAPPhase2.s.sol hardcodes .secret file dependency (#769)' (#988) from fix/issue-769 into master 2026-03-19 02:03:37 +01:00
openhands
16af093e99 ci: retrigger after infra failure (#769) 2026-03-19 00:36:37 +00:00
openhands
db6abda17e fix: address review feedback for #769
- Apply PRIVATE_KEY env-var fallback to UpgradeOptimizer.sol (missed in first pass)
- Add comment on zero-sentinel silent-fallback behaviour in all four scripts
- Remove spurious view modifier from BaseDeploy.run() (violated by vm.readFile)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 00:26:04 +00:00
openhands
9632693b8a fix: BootstrapVWAPPhase2.s.sol hardcodes .secret file dependency (#769)
Check PRIVATE_KEY env var first in BootstrapVWAPPhase2.s.sol, DeployBase.sol,
and BaseDeploy.sol; fall back to .secret seed-phrase file when unset.
This allows CI/CD environments to inject keys via environment variables
while preserving the existing local .secret workflow unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 00:03:59 +00:00
johba
331fe65384 Merge pull request 'fix: No CI step validates npm run build or npm run transpile for the push3-transpiler (#860)' (#984) from fix/issue-860 into master 2026-03-19 00:34:25 +01:00
openhands
283fbcaf6b fix: No CI step validates npm run build or npm run transpile for the push3-transpiler (#860) 2026-03-18 23:06:49 +00:00
johba
bc2afefcbe Merge pull request 'fix: No events on fee destination state changes (#958)' (#982) from fix/issue-958 into master 2026-03-18 23:33:57 +01:00
openhands
f33d5e932d fix: address review feedback for #958
- Document new LiquidityManager events in kraiken-lib/src/version.ts per
  AGENTS.md pre-PR checklist item 6 (Kraiken VERSION unchanged; no ponder
  subscriber impact)
- Add vm.expectEmit assertions to testSetFeeDestinationLocked_Reverts for
  the setup call that now emits FeeDestinationSet + FeeDestinationLocked

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 22:06:13 +00:00
openhands
d08388240d ci: retrigger after infra failure (#958) 2026-03-18 21:36:25 +00:00
openhands
e3c699b7eb fix: No events on fee destination state changes (#958)
Add FeeDestinationSet and FeeDestinationLocked events to LiquidityManager,
emitted on every setFeeDestination() call and lock engagement respectively.
Update tests to assert both events are emitted in all code paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 21:25:12 +00:00
johba
240d3ae1ac Merge pull request 'fix: No upper-bound validation for ci/anchorShare/discoveryDepth outputs (#960)' (#980) from fix/issue-960 into master 2026-03-18 22:06:20 +01:00
openhands
8fbac32717 fix: No upper-bound validation for ci/anchorShare/discoveryDepth outputs (#960)
Add assertUint256Max1e18 validator in index.ts and apply it to the ci,
anchorShare, and discoveryDepth output literals. Programs emitting values
> 1e18 for these fields now fail with a clear transpiler-level error instead
of silently violating LiquidityManager invariants at runtime.

Add tests 12-14 in test_transpiler_clamping.sh covering the over-range
rejection for each of the three fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 20:48:25 +00:00
johba
0e10d091a6 Merge pull request 'fix: evolution.patch has no apply-validation step in CI or evolve.sh (#866)' (#962) from fix/issue-866 into master 2026-03-18 21:33:54 +01:00
openhands
5a6df66541 fix: replace sleep+continue with exit 1 on stale patch to comply with AGENTS.md (#866)
AGENTS.md principle #1/#3 forbids fixed delays. When evolution.patch fails
the pre-flight --check, exit 1 lets the process supervisor handle restart
timing instead of a hardcoded sleep 300 busy-spin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 20:07:21 +00:00
johba
7842d787cd Merge pull request 'fix: evaluate.sh detects docker compose vs docker-compose binary; red-team-sweep.sh does not (#964)' (#971) from fix/issue-964 into master 2026-03-18 20:56:40 +01:00
openhands
33123cfd1d fix: evaluate.sh detects docker compose vs docker-compose binary; red-team-sweep.sh does not (#964)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:57:36 +00:00
openhands
0fa80de0b9 ci: retrigger after infra failure (#866) 2026-03-18 18:49:23 +00:00
openhands
acda1f72bb fix: add sleep before continue in stale-patch error path to avoid busy loop (#866)
When git apply --check fails, the daemon now sleeps 300s before retrying,
preventing a tight busy loop that would hammer the git remote indefinitely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:49:23 +00:00
openhands
9f5aaccd63 ci: retrigger after infra failure (#866) 2026-03-18 18:49:23 +00:00
openhands
57b83b6fe9 fix: evolution.patch has no apply-validation step in CI or evolve.sh (#866)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:49:23 +00:00
johba
da672070a6 Merge pull request 'fix: Optimizer.sol base class only guards slots 0 and 1 (#968)' (#969) from fix/issue-968 into master 2026-03-18 19:44:55 +01:00
openhands
28ce5ec8cd fix: Optimizer.sol base class only guards slots 0 and 1 (#968)
Replace the two per-slot require checks with a loop over all 8 input slots
so future subclasses using slots 2-7 are protected from silent uint256 wrap.
Add testCalculateParamsRevertsOnNegativeMantissaSlots2to7 to verify the guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:24:18 +00:00