Commit graph

1184 commits

Author SHA1 Message Date
openhands
42b4bf4149 fix: Shift field silently ignored — dyadic rational inputs effectively unsupported (#606)
Add require(shift == 0) guards to Optimizer.calculateParams and
OptimizerV3.calculateParams so non-zero shifts revert instead of being
silently discarded.  OptimizerV3Push3 already had this guard.

Update IOptimizer.sol NatSpec to document that shift is reserved for
future use and must be 0 in all current implementations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 11:42:50 +00:00
johba
26957dae88 Merge pull request 'fix: deployments-local.json committed to repo (#589)' (#1049) from fix/issue-589 into master 2026-03-20 12:26:04 +01:00
openhands
cee79eedb3 fix: web-app config.ts fails when deployments-local.json is absent
Use brace expansion in import.meta.glob pattern so Vite treats it as a
dynamic glob (returns {} when no files match) instead of compiling it
to a static import that errors when the gitignored file is absent in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 10:45:13 +00:00
openhands
282ac72c14 fix: handle missing deployments-local.json in CI/production
Use import.meta.glob with eager loading instead of a static import so
config.ts degrades gracefully when the file is absent (gitignored).

Fixes the node-quality CI failure introduced when the file was removed
from the repo in this PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 10:34:41 +00:00
openhands
de8cf65d06 fix: push3-evolution tsconfig rootDir too narrow for cross-project imports
Widen rootDir from "." to ".." and include push3-transpiler sources so
tsc can resolve the ../push3-transpiler/src imports that mutate.ts and
test files use.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 09:54:33 +00:00
openhands
79a2e2ee5e fix: deployments-local.json committed to repo (#589)
- Add onchain/deployments-local.json to .gitignore so it is no longer tracked
- Remove the stale committed file from git
- Update fitness.sh to read LM address from forge broadcast JSON
  (DeployLocal.sol's run-latest.json) instead of the potentially stale
  deployments-local.json, matching the approach deploy-optimizer.sh already uses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 09:48:00 +00:00
johba
4c27351b27 Merge pull request 'fix: No --fork-url in deploy-optimizer.sh local Anvil start (#588)' (#1045) from fix/issue-588 into master 2026-03-20 10:05:48 +01:00
openhands
f361be30d2 fix: No --fork-url in deploy-optimizer.sh local Anvil start (#588)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:47:28 +00:00
johba
a0effe39d6 Merge pull request 'fix: No CI pipeline coverage for push3-evolution or push3-transpiler tests (#563)' (#1043) from fix/issue-563 into master 2026-03-20 09:36:02 +01:00
openhands
1f96e62fc8 fix: No CI pipeline coverage for push3-evolution or push3-transpiler tests (#563)
Add evolution-tests step to Woodpecker CI pipeline. The transpiler-tests
step already existed; the new step runs push3-evolution's vitest suite
and triggers on changes to either tools/push3-evolution or
tools/push3-transpiler (since evolution imports the transpiler's parser).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 07:57:46 +00:00
johba
0cb2e7ba07 fix: EXEC.IF branch reconciliation still injects synthetic zeros (#618) (#1033)
Fixes #618

## Changes
Add stack depth validation in processExecIf() so asymmetric EXEC.IF branches (where one branch pushes more values than the other) throw an explicit error instead of silently padding with '0'. Error messages identify both branch depths for DYADIC and BOOLEAN stacks. Removed dead-code '0'/'false' fallbacks in buildAssignments and reconstruction. Updated existing unbalanced-branch tests to expect errors; added regression tests for error message content and BOOLEAN mismatch. All existing seed files (optimizer_v3.push3, optimizer_seed.push3) continue to transpile.

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/1033
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-20 08:42:34 +01:00
johba
30abee68b8 Merge pull request 'fix: No tests for transpiler stack-depth validation (#619)' (#1032) from fix/issue-619 into master 2026-03-20 04:59:52 +01:00
openhands
793d875b4a fix: No tests for transpiler stack-depth validation (#619)
Add TypeScript unit test suite for the Push3 transpiler using Node's
built-in test runner (node:test) with tsx. 47 tests across 12 suites
covering parser, stack underflow/overflow, EXEC.IF balanced/unbalanced/
nested branching, arithmetic, boolean ops, name binding, and integration.

Update CI to run `npm test` (which now includes unit tests + existing
bash tests) and scope transpiler-tests step to only trigger on changes
to tools/push3-transpiler/**.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 03:29:45 +00:00
johba
df3389bdeb Merge pull request 'fix: getLiquidityParams: int256 overflow on large VWAP values (#622)' (#1030) from fix/issue-622 into master 2026-03-20 04:15:39 +01:00
openhands
e28e69c98a fix: guard int128 overflow in ThreePositionStrategy mirror tick (#622)
Move overflow guard to the actual vulnerable site:
ThreePositionStrategy._computeFloorTickWithSignal() line 262 where
vwapX96 >> 32 is cast to int128 for _tickAtPriceRatio. Values
exceeding int128.max now skip mirror tick (fallback to scarcity/clamp)
instead of reverting.

Remove incorrect require from Optimizer._buildInputs() which guarded
a non-existent int256 cast path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 02:46:30 +00:00
openhands
7007e593da fix: getLiquidityParams: int256 overflow on large VWAP values (#622)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 02:05:25 +00:00
johba
5deb1eab0c Merge pull request 'fix: _scrapePositions: unguarded safeTransfer to address(0) when feeDestination unset (#624)' (#1029) from fix/issue-624 into master 2026-03-20 02:53:02 +01:00
openhands
170cc839e6 fix: _scrapePositions: unguarded safeTransfer to address(0) when feeDestination unset (#624)
Add address(0) guard to fee transfer condition in _scrapePositions so
that when feeDestination is uninitialized, fees accrue as deployable
liquidity instead of reverting on safeTransfer to the zero address.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 01:05:05 +00:00
johba
84fae1a410 Merge pull request 'fix: mint_lp and burn_lp not soft-failing in attack execution (#630)' (#1028) from fix/issue-630 into master 2026-03-20 01:46:00 +01:00
openhands
37905a29b2 fix: mint_lp and burn_lp not soft-failing in attack execution (#630)
Wrap mint_lp and burn_lp ops in _executeOp with try/catch to match
the soft-fail pattern used by buy, sell, stake, and unstake. Replace
burn_lp's require() with a soft return for out-of-range index validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:23:58 +00:00
johba
0446facb62 Merge pull request 'fix: No recovery path if VWAP bootstrap fails mid-sequence (#644)' (#1026) from fix/issue-644 into master 2026-03-20 01:03:57 +01:00
openhands
20f5ac68cd fix: add polling timeouts and safe fallback in recovery script (#644)
- Add max-iterations guard (60 polls × 5s = 5 min) to both cooldown
  polling loops with explicit error on timeout
- Use LAST_RECENTER (already validated) as fallback instead of "0" for
  post-seed-buy lastRecenterTime read, preventing silent cooldown skip
  on transient RPC failure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:45:31 +00:00
johba
9c787a6778 Merge pull request 'fix: OptimizerV3.sol mutation has no CI guard (#631)' (#1027) from fix/issue-631 into master 2026-03-20 00:15:28 +01:00
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
af2f7e6115 fix: OptimizerV3.sol mutation has no CI guard (#631)
batch-eval.sh mutates OptimizerV3.sol by injecting Push3 candidates but
never restores it on exit. Add a backup/restore trap so the file is
always returned to its committed state, and add a CI step that fails
loudly if OptimizerV3.sol is left dirty after any pipeline step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:36:49 +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
johba
9cfffa5cea Merge pull request 'fix: fix: inject.sh uses ts-node which is broken on Node >= 22 ESM (#1008)' (#1015) from fix/issue-1008 into master 2026-03-19 23:06:14 +01:00
openhands
90070480d5 fix: replace ts-node with tsx in deploy-optimizer.sh (#1008)
Missed reference — deploy-optimizer.sh still called npx ts-node,
which would fail now that ts-node is removed from devDependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:44:29 +00:00
openhands
4a24217030 fix: inject.sh uses ts-node which is broken on Node >= 22 ESM (#1008)
Replace ts-node with tsx across all push3-transpiler scripts:
- inject.sh: npx ts-node → npx tsx
- test_inject_extraction.sh: node --loader ts-node/esm → npx tsx
- test_transpiler_clamping.sh: node --loader ts-node/esm → npx tsx
- package.json: ts-node devDep → tsx, transpile script updated
- tsconfig.json: removed ts-node config block
- src/index.ts: updated usage comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:44:29 +00:00
johba
83db5c3298 Merge pull request 'fix: Bear defaults duplicated across Optimizer and LiquidityManager (#646)' (#1016) from fix/issue-646 into master 2026-03-19 19:45:23 +01:00
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