fix: feat: evolution-daemon.sh — perpetual evolution loop on DO box (#748)

- Add tools/push3-evolution/evolution-daemon.sh: single-command daemon that
  runs git-pull → apply-patch → clean-tmpdirs → evolve.sh → summary →
  notify → revert-patch → loop, handling SIGINT/SIGTERM cleanly.
- Add tools/push3-evolution/evolution.conf: config file (EVAL_MODE, BASE_RPC_URL,
  POPULATION=20, GENERATIONS=30, MUTATION_RATE=1, ELITES=2, DIVERSE_SEEDS=true,
  GAS_LIMIT=500000, ANCHOR_WIDTH_UNBOUNDED=true).
- Add tools/push3-evolution/evolution.patch: overrides CALCULATE_PARAMS_GAS_LIMIT
  200k→500k in Optimizer.sol + FitnessEvaluator.t.sol, and removes
  MAX_ANCHOR_WIDTH=100 cap in LiquidityManager.sol for unbounded AW exploration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-14 17:21:51 +00:00
parent 833ae45882
commit bbf3b871b3
4 changed files with 418 additions and 0 deletions

View file

@ -0,0 +1,39 @@
diff --git a/onchain/src/LiquidityManager.sol b/onchain/src/LiquidityManager.sol
index 0daccf9..e3a9b2f 100644
--- a/onchain/src/LiquidityManager.sol
+++ b/onchain/src/LiquidityManager.sol
@@ -36,7 +36,7 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
/// @notice Maximum anchor width (in ticks) accepted from the optimizer.
/// Any optimizer-returned value above this ceiling is silently clamped down.
- uint24 internal constant MAX_ANCHOR_WIDTH = 100;
+ uint24 internal constant MAX_ANCHOR_WIDTH = type(uint24).max;
/// @notice Upper bound (inclusive) for scale-1 optimizer parameters: capitalInefficiency,
/// anchorShare, and discoveryDepth. Values above this ceiling are silently clamped.
diff --git a/onchain/src/Optimizer.sol b/onchain/src/Optimizer.sol
index 4efa74c..a29612f 100644
--- a/onchain/src/Optimizer.sol
+++ b/onchain/src/Optimizer.sol
@@ -136,7 +136,7 @@ contract Optimizer is Initializable, UUPSUpgradeable, IOptimizer {
/// staticcall to actually receive 200 000. Callers with exactly 200203 k
/// gas will see a spurious bear-defaults fallback. This is not a practical
/// concern from recenter(), which always has abundant gas.
- uint256 internal constant CALCULATE_PARAMS_GAS_LIMIT = 200_000;
+ uint256 internal constant CALCULATE_PARAMS_GAS_LIMIT = 500_000;
/**
* @notice Initialize the Optimizer.
diff --git a/onchain/test/FitnessEvaluator.t.sol b/onchain/test/FitnessEvaluator.t.sol
index 9434163..5b91eca 100644
--- a/onchain/test/FitnessEvaluator.t.sol
+++ b/onchain/test/FitnessEvaluator.t.sol
@@ -152,7 +152,7 @@ contract FitnessEvaluator is Test {
/// @dev Must match Optimizer.CALCULATE_PARAMS_GAS_LIMIT. Candidates that exceed
/// this limit would unconditionally produce bear defaults in production and
/// are disqualified (fitness = 0) rather than scored against their theoretical output.
- uint256 internal constant CALCULATE_PARAMS_GAS_LIMIT = 200_000;
+ uint256 internal constant CALCULATE_PARAMS_GAS_LIMIT = 500_000;
/// @dev Soft gas penalty: wei deducted from fitness per gas unit used by calculateParams.
/// Creates selection pressure toward leaner programs while keeping gas as a