Commit graph

955 commits

Author SHA1 Message Date
johba
bf1a735481 Merge pull request 'fix: feat: red-team memory should track candidate + abstract learnings (#820)' (#830) from fix/issue-820 into master 2026-03-15 17:17:33 +01:00
openhands
7950608179 fix: address review findings for red-team memory tracking (#820)
- make_pattern: replace text.find('stake')/find('unstake') with
  re.search(r'\bstake\b')/re.search(r'\bunstake\b') so 'stake' is never
  found as a substring of 'unstake' (bug #1)
- make_pattern: track first-occurrence position of each op and sort by
  position before building the sequence string, preserving actual
  execution order instead of a hardcoded canonical order (bug #2)
- insight capture: track insight_pri on the current dict; only overwrite
  stored insight when new match has strictly higher priority (lower index),
  preventing a late 'because...' clause from silently replacing an earlier
  'Key Insight:' capture (warning #3)
- run_num: compute max(run)+1 from JSON entries instead of wc -l so run
  numbers stay monotonically increasing after memory trim (info #4)
- red-team-sweep.sh: also set adaptive flag when any r37-r40 register has
  a variable-form assignment (r40 = uint256(someVar)), catching candidates
  where only one branch uses constants (warning #5)
- red-team-sweep.sh: remove unnecessary 'import sys as _sys' in except
  block; sys is already in scope (nit #6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:54:01 +00:00
openhands
e7c60edeb6 fix: feat: red-team memory should track candidate + abstract learnings (#820)
- Add CANDIDATE_NAME and OPTIMIZER_PROFILE env vars to red-team.sh
  (defaults to "unknown" for standalone runs)
- Update extract_memory Python: new fields candidate, optimizer_profile,
  pattern (abstract op sequence via make_pattern()), and improved insight
  extraction that also captures WHY explanations (because/since/due to)
- Update MEMORY_SECTION Python: entries now grouped by candidate;
  universal patterns (DECREASED across multiple candidates) surfaced first
- Update prompt: add "Current Attack Target" table with candidate/profile,
  optimizer parameter explanations (CI/AW/AS/DD behavioral impact),
  Rule 9 requiring pattern+insight per strategy, updated report format
  with Pattern/Insight fields and universal-pattern conclusion field
- Update red-team-sweep.sh: after inject, parse OptimizerV3Push3.sol for
  r40/r39/r38/r37 constants to build OPTIMIZER_PROFILE string; pass
  CANDIDATE_NAME and OPTIMIZER_PROFILE as env vars to red-team.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:23:43 +00:00
johba
7a09c16966 Merge pull request 'fix: txnBot AGENTS.md ENVIRONMENT enum is stale (#784)' (#815) from fix/issue-784 into master 2026-03-15 16:06:03 +01:00
johba
963c0d316a Merge pull request 'fix: feat: red-team agent should read LM and optimizer Solidity source (#821)' (#828) from fix/issue-821 into master 2026-03-15 15:57:21 +01:00
openhands
4779749f2b fix: feat: red-team agent should read LM and optimizer Solidity source (#821)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 14:18:10 +00:00
openhands
afae00ed9f fix: txnBot AGENTS.md ENVIRONMENT enum is stale (#784) 2026-03-15 14:11:58 +00:00
openhands
0f3399a73c fix: txnBot AGENTS.md ENVIRONMENT enum is stale (#784) 2026-03-15 14:11:45 +00:00
johba
504977941e Merge pull request 'fix: fix: red-team prompt missing evm_increaseTime for TWAP-enforced recenter (#823)' (#824) from fix/issue-823 into master 2026-03-15 12:36:49 +01:00
openhands
ff53625c9c fix: fix: red-team prompt missing evm_increaseTime for TWAP-enforced recenter (#823) 2026-03-15 10:47:47 +00:00
openhands
7d0473ade7 fix: fix: red-team prompt missing evm_increaseTime for TWAP-enforced recenter (#823)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 10:47:36 +00:00
johba
d6e5990802 Merge pull request 'fix: ThreePositionStrategy class comment still advertises 1-100% anchor width (#786)' (#813) from fix/issue-786 into master 2026-03-15 10:36:02 +01:00
johba
ff86b3691d chore: extract shared inject.sh, add red-team-sweep.sh (#806)
## What
- `tools/push3-transpiler/inject.sh` — shared transpile+inject logic used by both batch-eval and red-team-sweep
- `batch-eval.sh` — replaced inline 60-line Python block with `inject.sh` call
- `scripts/harb-evaluator/red-team-sweep.sh` — red-teams each kindergarten seed using existing `red-team.sh`, with random smoke test gate

## Why
Sweep script kept breaking because I rewrote the injection logic instead of reusing batch-eval's proven Python. Now there's one copy.

## Testing
- inject.sh tested manually on DO box with optimizer_v3 seed
- Smoke test picks random seed, injects + compiles before starting sweep

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/806
Reviewed-by: review_bot <review_bot@noreply.codeberg.org>
2026-03-15 10:24:03 +01: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
6dd246cb55 fix: ThreePositionStrategy class comment still advertises 1-100% anchor width (#786) 2026-03-15 08:20:22 +00:00
openhands
f5fdd329c4 fix: ThreePositionStrategy class comment still advertises 1-100% anchor width (#786)
Remove the misleading "(1-100% width)" range claim from the ANCHOR NatSpec.
Anchor width enforcement lives in LiquidityManager, not this abstract, so
the comment is replaced with a note pointing to where enforcement actually occurs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 08:20:13 +00:00
johba
5bb4c72897 Merge pull request 'fix: evo_run007_champion.push3 note has same CI/DD inversion (#790)' (#812) from fix/issue-790 into master 2026-03-15 09:15:00 +01:00
openhands
5891e9ca6b fix: evo_run007_champion.push3 note has same CI/DD inversion (#790)
Corrected run 7 note in manifest.jsonl: CI and DD values were inverted
(CI=20%, DD=0 → CI=0%, DD=20%) to match stack-pop semantics of the
push sequence 200000000000000000 153 200000000000000000 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 08:00:04 +00:00
johba
6b07ec0e33 Merge pull request 'fix: evo_run007_champion.push3 always returns fixed params regardless of staking (#791)' (#808) from fix/issue-791 into master 2026-03-15 08:51:13 +01:00
openhands
05f41fe10a fix: evo_run007_champion.push3 always returns fixed params regardless of staking (#791) 2026-03-15 07:30:53 +00:00
openhands
d8a109baf8 fix: evo_run007_champion.push3 always returns fixed params regardless of staking (#791)
Replace the broken EXEC.IF branches where TRUE was ( ) and FALSE was
0 DYADIC.POP, causing the trailing push sequence to execute
unconditionally. Now EXEC.IF correctly branches on STAKED > 88%:
  - TRUE  (staked > 88%): bear defaults ( 0 0 0 0 ) — CI=0, AW=0, AS=0, DD=0
  - FALSE (staked ≤ 88%): ( 200000000000000000 153 200000000000000000 0 )
                            — CI=0, AW=153, AS=20%, DD=20%

Also correct the manifest.jsonl run 7 note which had CI and DD inverted
(CI=20%/DD=0 → CI=0/DD=20%).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 07:30:45 +00:00
johba
8a1bfa9b69 Merge pull request 'fix: red-team.sh and export-attacks.py use Base Sepolia addresses labeled as mainnet (#794)' (#805) from fix/issue-794 into master 2026-03-15 08:17:23 +01:00
openhands
7618309db5 fix: red-team.sh and export-attacks.py use Base Sepolia addresses labeled as mainnet (#794)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 06:48:16 +00:00
johba
4f24d6201f Merge pull request 'fix: Old-format CIDs are warned but still silently dropped from the pool (#801)' (#804) from fix/issue-801 into master 2026-03-15 07:37:06 +01:00
openhands
70ef0eb1bc fix: Old-format CIDs are warned but still silently dropped from the pool (#801)
- Change WARNING to explicitly state "legacy CID format ... migration not supported, skipping"
- Expand comment near the startswith('candidate_') guard to document the CID format
  contract and explain why re-admission is intentionally out of scope (no surviving
  generation_N.jsonl files from runs 1-6 exist in the repo)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 06:17:12 +00:00
johba
a983c5cb16 Merge pull request 'fix: No-op varCounter assignment before false branch in processExecIf (#655)' (#803) from fix/issue-655 into master 2026-03-15 06:47:02 +01:00
openhands
73485c66ea fix: No-op varCounter assignment before false branch in processExecIf (#655) 2026-03-15 05:27:14 +00:00
openhands
38c476f71e fix: No-op varCounter assignment before false branch in processExecIf (#655) 2026-03-15 05:27:09 +00:00
johba
b4720e6f5c Merge pull request 'fix: evolve.sh does not write note field — schema drift between hand-written and evolved entries (#719)' (#802) from fix/issue-719 into master 2026-03-15 06:17:27 +01:00
openhands
4a47e8e2d1 fix: evolve.sh does not write \note\ field — schema drift between hand-written and evolved entries (#719)
- Pass seed basename into the admission Python block as argv[7]
- Add \`note\` field to every new evolved entry: "Evolved from <seed> (run<N> gen<G>)"
- Add migration comment noting entries admitted before this fix may have note: null

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 04:57:58 +00:00
johba
5b8c1cc485 Merge pull request 'fix: CID format change silently drops historical generation JSONL on re-admission (#757)' (#800) from fix/issue-757 into master 2026-03-15 05:47:02 +01:00
openhands
6694b2daa8 fix: CID format change silently drops historical generation JSONL on re-admission (#757)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 04:27:38 +00:00
johba
a9431c87ee Merge pull request 'fix: manifest.jsonl schema has no canonical machine-readable definition (#720)' (#799) from fix/issue-720 into master 2026-03-15 05:17:28 +01:00
openhands
2aad9e98f1 fix: manifest.jsonl schema has no canonical machine-readable definition (#720)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 03:57:31 +00:00
johba
bacc104bc9 Merge pull request 'fix: llm-origin entries in manifest have null fitness and no evaluation path (#724)' (#798) from fix/issue-724 into master 2026-03-15 04:49:41 +01:00
openhands
c508efa31f fix: address review findings for evaluate-seeds.sh (#724)
- Replace unquoted heredoc (shell-injection path) with a temp file: the
  shell loop now appends tab-separated filename/score lines to a temp
  file, which is passed as a plain path argument to the Python manifest-
  rewrite block.  Python reads only file contents, never executes shell-
  expanded strings.
- Add early abort on fitness.sh exit code 2 (infra error: Anvil down,
  missing tool).  Iterating past an infra failure produces no useful
  results; aborting immediately surfaces the real problem.
- Remove unused `os` import from the manifest-rewrite Python block.
- Fix inaccurate comment in evolve.sh --diverse-seeds sampling: the pool
  sampler does a flat random shuffle with no fitness weighting; null-
  fitness seeds are not "treated as 0" — they are sampled with equal
  probability to any other seed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 03:29:47 +00:00
openhands
cb6e6708b6 fix: \llm\-origin entries in manifest have null fitness and no evaluation path (#724)
- Add evaluate-seeds.sh: standalone script that reads manifest.jsonl,
  finds every entry with fitness: null, runs fitness.sh against each
  seed file, and atomically writes results back to manifest.jsonl.
  Supports --dry-run to preview without evaluating.
- Add comment to --diverse-seeds sampling in evolve.sh documenting that
  null-fitness seeds are included with effective_fitness=0 and that
  evaluate-seeds.sh should be run to score them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 03:08:29 +00:00
johba
93b16f3b1f Merge pull request 'fix: No generic flag dispatch: only token_value_inflation is ever zero-rated (#723)' (#797) from fix/issue-723 into master 2026-03-15 03:56:26 +01:00
openhands
4d47ef6f4b ci: retrigger after infra failure 2026-03-15 02:40:45 +00:00
openhands
79af57451d fix: No generic flag dispatch: only token_value_inflation is ever zero-rated (#723) 2026-03-15 02:37:02 +00:00
openhands
273615cfed fix: No generic flag dispatch: only \token_value_inflation\ is ever zero-rated (#723)
Define ZERO_RATED_FLAGS set near effective_fitness and check each flag
with any(...in flags...) instead of a single hard-coded substring test.
token_value_inflation behaviour is preserved; new flags can be added to
the set without touching the dispatch logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 02:36:57 +00:00
johba
5dfa824161 Merge pull request 'fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780)' (#793) from fix/issue-780 into master 2026-03-15 03:27:55 +01:00
openhands
cef4c3038b fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780)
Address review feedback:
- Add comment on FEE_DEST explaining why it differs from DeployBaseMainnet.sol:
  on a Base mainnet fork, 0xf6a3...D9011 has contract code which triggers
  feeDestinationLocked=true; keccak-derived address is a guaranteed EOA
- Expand bytecodes.txt EOF guard with a pipeline-mismatch warning log
- Fix STATE.md entry to use imperative verb form per project convention

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 02:13:04 +00:00
openhands
b3007e8f11 fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780) 2026-03-15 01:51:08 +00:00
openhands
ef3f6945f2 fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780)
- Replace Base Sepolia addresses with Base mainnet:
  - V3_FACTORY: 0x33128a8fC17869897dcE68Ed026d694621f6FDfD
  - SWAP_ROUTER: 0x2626664c2603336E57B271c5C0b26F421741e481
  - NPM_ADDR: 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
- Fix FEE_DEST to keccak-derived EOA (0x8A9145E1...9383) to avoid
  feeDestination lock triggered by contract code at the old address
- Add vm.warp(block.timestamp + 600) alongside vm.roll in bootstrap
  retry loop so _isPriceStable() TWAP check accumulates 300s+ history
- Guard vm.readLine(bytecodesFile) with empty-string break to prevent
  vm.parseBytes("") revert on trailing EOF line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 01:50:54 +00:00
johba
c1746a05fe Merge pull request 'fix: feat: add evolution run 8 champion to seed pool (#781)' (#789) from fix/issue-781 into master 2026-03-15 02:45:27 +01:00
openhands
7930770570 fix: feat: add evolution run 8 champion to seed pool (#781)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 01:31:06 +00:00
openhands
2fbf1c30f1 fix: feat: add evolution run 8 champion to seed pool (#781) 2026-03-15 01:07:15 +00:00
openhands
56aedfae49 fix: feat: add evolution run 8 champion to seed pool (#781)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 01:07:12 +00:00
johba
03bc45371a Merge pull request 'fix: fix: increase CALCULATE_PARAMS_GAS_LIMIT from 200k to 500k (#782)' (#787) from fix/issue-782 into master 2026-03-15 02:04:48 +01:00