harb/tools/push3-evolution
johba 3f435f8459 fix: evolution scoring — 3 bugs made all candidates report fitness=0 (#665)
## Three bugs in evolve.sh

1. **Heredoc stdin conflict** — `py_stats()` used `<<PYEOF` heredoc which stole stdin from the pipe, so python never received score values → stats always `min=0 max=0 mean=0`

2. **Bash integer overflow** — global best comparison used `[ $MAX -gt $GLOBAL_BEST_FITNESS ]` which overflows on uint256 wei values (>9.2e18) → best always tracked as 0

3. **candidate_id mismatch** — evolve.sh looked up `gen0_c000` but batch-eval produces `candidate_000` (derived from filename) → score lookup always returned default 0

All 3 previous evolution runs (150+ candidates) reported all zeros despite batch-eval correctly scoring them at ~8.26e21 wei.

## Fix
- `py_stats`: heredoc → `python3 -c` inline
- Global best: bash `[ -gt ]` → `python3` big number comparison
- Score lookup: use `basename $CAND_FILE` instead of synthetic CID

Co-authored-by: root <root@debian-g-2vcpu-8gb-ams3-01>
Reviewed-on: https://codeberg.org/johba/harb/pulls/665
Reviewed-by: review_bot <review_bot@noreply.codeberg.org>
2026-03-13 10:02:24 +01:00
..
revm-evaluator fix: address review findings for gas-limit fitness pressure (#637) 2026-03-13 01:05:37 +00:00
test fix: feat: Push3 evolution — crossover operator (#639) 2026-03-13 05:54:48 +00:00
evolve.sh fix: evolution scoring — 3 bugs made all candidates report fitness=0 (#665) 2026-03-13 10:02:24 +01:00
fitness.sh fix: Evolution pipeline UUPS upgrade + Foundry PATH (#593) 2026-03-12 06:47:35 +00:00
mutate-cli.ts fix: Push3 evolution: selection loop orchestrator (#546) 2026-03-11 20:56:19 +00:00
mutate.ts fix: feat: Push3 evolution — crossover operator (#639) 2026-03-13 05:54:48 +00:00
package-lock.json fix: Push3 evolution: selection loop orchestrator (#546) 2026-03-11 20:56:19 +00:00
package.json fix: Push3 evolution: mutation operators for bytecode programs (#544) 2026-03-11 16:24:24 +00:00
seed-gen-cli.ts fix: address review findings for diverse seed population (#638) 2026-03-13 05:21:05 +00:00
seed-generator.ts fix: address review findings for diverse seed population (#638) 2026-03-13 05:21:05 +00:00
tsconfig.json fix: Push3 evolution: mutation operators for bytecode programs (#544) 2026-03-11 16:24:24 +00:00