fix: address review findings for gas-limit fitness pressure (#637)
- Optimizer.sol: move CALCULATE_PARAMS_GAS_LIMIT constant to top of contract (after error declaration) to avoid mid-contract placement. Expand natspec with EIP-150 63/64 note: callers need ~203 175 gas to deliver the full 200 000 budget to the inner staticcall. - Optimizer.sol: add ret.length < 128 guard before abi.decode in getLiquidityParams(). Malformed return data (truncated / wrong ABI) from an evolved program now falls back to _bearDefaults() instead of propagating an unhandled revert. The 128-byte minimum is the ABI encoding of (uint256, uint256, uint24, uint256) — four 32-byte slots. - Optimizer.sol: add cross-reference comment to _bearDefaults() noting that its values must stay in sync with LiquidityManager.recenter()'s catch block to prevent silent divergence. - FitnessEvaluator.t.sol: add CALCULATE_PARAMS_GAS_LIMIT mirror constant (must match Optimizer.sol). Disqualify candidates whose measured gas exceeds the production cap with fitness=0 and error="gas_over_limit" — prevents the pipeline from selecting programs that are functionally dead on-chain (would always produce bear defaults in production). - batch-eval.sh: update output format comment to document the gas_used field and over-gas-limit error object added by this feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c9c0ce5e95
commit
5d369cfab6
3 changed files with 46 additions and 9 deletions
|
|
@ -16,7 +16,9 @@
|
|||
#
|
||||
# Output (stdout):
|
||||
# One JSON object per candidate:
|
||||
# {"candidate_id":"gen0_c000","fitness":123456789}
|
||||
# {"candidate_id":"gen0_c000","fitness":123456789,"gas_used":15432}
|
||||
# Over-gas-limit candidates emit fitness:0 with "error":"gas_over_limit".
|
||||
# Downstream parsers use the "fitness" key; extra fields are ignored.
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 Success.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue