From e230a62e11fd6863dc2f2c7fedd8747ce1116f09 Mon Sep 17 00:00:00 2001 From: johba Date: Fri, 13 Mar 2026 19:56:39 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20feat:=20LLM=20seed=20=E2=80=94=20Fee=20M?= =?UTF-8?q?aximizer=20optimizer=20(#673)=20(#696)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #673 ## Changes Done. Here's a summary of what was implemented: ## Changes **`tools/push3-evolution/seeds/llm_fee_maximizer.push3`** (new file) A Push3 optimizer seed implementing the "every trade pays us" philosophy. It reads `percentageStaked` (slot 0) and `averageTaxRate` (slot 1), then branches on two thresholds: - Staking threshold: 60% (bullish vs. neutral sentiment) - Tax threshold: 10% of 1e18 (high vs. low swap volume) Strategy matrix: | | tax < 10% | tax ≥ 10% | |---|---|---| | **staked < 60%** | AS=0.70, AW=60, DD=0.50 | AS=0.80, AW=80, DD=0.60 | | **staked ≥ 60%** | AS=0.90, AW=40, DD=0.80 | AS=0.95, AW=50, DD=0.90 | CI is always 0. Anchor share is always ≥ 0.70e18 (capital stays in fee-earning zone). High staking shifts discovery depth up; high tax widens the anchor to capture more swap volume. **`tools/push3-evolution/seeds/manifest.jsonl`** — new entry for `llm_fee_maximizer.push3` with `origin=llm`. Transpiled successfully: 48-line Solidity function body, outputs correctly bound to `ci`, `anchorShare`, `anchorWidth`, `discoveryDepth`. Co-authored-by: openhands Reviewed-on: https://codeberg.org/johba/harb/pulls/696 Reviewed-by: review_bot --- .../seeds/llm_fee_maximizer.push3 | 119 ++++++++++++++++++ tools/push3-evolution/seeds/manifest.jsonl | 1 + 2 files changed, 120 insertions(+) create mode 100644 tools/push3-evolution/seeds/llm_fee_maximizer.push3 diff --git a/tools/push3-evolution/seeds/llm_fee_maximizer.push3 b/tools/push3-evolution/seeds/llm_fee_maximizer.push3 new file mode 100644 index 0000000..b029da6 --- /dev/null +++ b/tools/push3-evolution/seeds/llm_fee_maximizer.push3 @@ -0,0 +1,119 @@ +;; Fee Maximizer optimizer — LLM seed +;; +;; Philosophy: "every trade pays us." +;; Concentrate liquidity in high-traffic price ranges by keeping anchor share +;; high and anchor width wide enough to capture price movement volatility. +;; +;; Inputs on DYADIC stack (slot 0 on top, slot 7 at bottom): +;; [0] percentageStaked (0 to 1e18, where 1e18 = 100%) +;; [1] averageTaxRate (0 to 1e18) +;; [2..7] reserved / future indicators +;; +;; Outputs (bottom-to-top push order → top = ci): +;; discoveryDepth (bottom) — DD: aggressive upside discovery +;; anchorWidth — AW: wide coverage of price movement +;; anchorShare — AS: most ETH in the fee-earning zone +;; ci (top) — always 0 (no capital inefficiency) +;; +;; Strategy matrix (staking threshold: 60%, tax threshold: 10%): +;; +;; | tax < 10% | tax >= 10% +;; ---------------+---------------------------+-------------------------- +;; staked < 60% | CI=0 AS=0.70 AW=60 DD=0.50 | CI=0 AS=0.80 AW=80 DD=0.60 +;; staked >= 60% | CI=0 AS=0.90 AW=40 DD=0.80 | CI=0 AS=0.95 AW=50 DD=0.90 +;; +;; Rationale: +;; - High staking → bullish sentiment → push discovery depth up +;; - High tax → more staking/trade activity → widen anchor to capture volume +;; - Anchor share always > 0.70 so capital stays in the fee-earning zone + +( + ;; Step 1: Bind slot 0 (top) → PERCENTAGESTAKED, slot 1 → TAXRATE. + PERCENTAGESTAKED DYADIC.DEFINE + ;; Stack: [slot7(bot), slot6, slot5, slot4, slot3, slot2, slot1(top)] + TAXRATE DYADIC.DEFINE + ;; Stack: [slot7(bot), slot6, slot5, slot4, slot3, slot2(top)] + + ;; Step 2: Discard unused inputs (slots 2-7) — 6 pops. + DYADIC.POP + DYADIC.POP + DYADIC.POP + DYADIC.POP + DYADIC.POP + DYADIC.POP + ;; Stack: [] + + ;; Step 3: Compute stakedPct = percentageStaked * 100 / 1e18 (integer 0..100) + PERCENTAGESTAKED + 100 DYADIC.* + 1000000000000000000 DYADIC./ + ;; Stack: [stakedPct] + STAKED DYADIC.DEFINE + ;; Stack: [] + + ;; Step 4: Branch on staking level — >= 60 is "bullish". + STAKED 60 DYADIC.>= + ;; bool_stack: [staking_bullish] + + EXEC.IF + + ;; TRUE branch: High staking (>= 60%) — bullish sentiment. + ;; Shift positions upward: maximum discovery depth, high anchor share. + ( + ;; Sub-branch: is tax rate high (>= 10% of 1e18)? + TAXRATE 100000000000000000 DYADIC.>= + ;; bool_stack: [tax_high] + + EXEC.IF + + ;; TRUE: High staking + High tax + ;; → Maximum fee capture: wide anchor to absorb volume, max share & discovery. + ;; CI=0, AS=0.95e18, AW=50, DD=0.90e18 + ( + 900000000000000000 + 50 + 950000000000000000 + 0 + ) + + ;; FALSE: High staking + Low tax + ;; → Bullish upside focus: tighter anchor, high share, strong discovery. + ;; CI=0, AS=0.90e18, AW=40, DD=0.80e18 + ( + 800000000000000000 + 40 + 900000000000000000 + 0 + ) + ) + + ;; FALSE branch: Low staking (<= 60%) — neutral/bearish sentiment. + ;; Still fee-aggressive: keep wide positions and moderate share. + ( + ;; Sub-branch: is tax rate high (>= 10% of 1e18)? + TAXRATE 100000000000000000 DYADIC.>= + ;; bool_stack: [tax_high] + + EXEC.IF + + ;; TRUE: Low staking + High tax + ;; → High volume with caution: widen anchor to capture swap fees. + ;; CI=0, AS=0.80e18, AW=80, DD=0.60e18 + ( + 600000000000000000 + 80 + 800000000000000000 + 0 + ) + + ;; FALSE: Low staking + Low tax + ;; → Conservative fee base: broad coverage, steady share. + ;; CI=0, AS=0.70e18, AW=60, DD=0.50e18 + ( + 500000000000000000 + 60 + 700000000000000000 + 0 + ) + ) +) diff --git a/tools/push3-evolution/seeds/manifest.jsonl b/tools/push3-evolution/seeds/manifest.jsonl index b015eb3..6f0e0e0 100644 --- a/tools/push3-evolution/seeds/manifest.jsonl +++ b/tools/push3-evolution/seeds/manifest.jsonl @@ -1,3 +1,4 @@ {"file":"optimizer_v3.push3","fitness":8259844243839650390792,"origin":"hand-written","run":null,"generation":null,"date":"2026-03-10","note":"Original seed optimizer"} {"file":"evo_run004_champion.push3","fitness":2307549972110081697617459,"origin":"evolved","run":"004","generation":3,"date":"2026-03-13","note":"First evolution champion. Fitness inflated by token value (#670). Always-bull strategy."} {"file":"llm_momentum.push3","fitness":null,"origin":"llm","run":null,"generation":null,"date":"2026-03-13","note":"Momentum Follower: smooth sentiment-tracking via direct percentageStaked multiplication. Safety net: floor always >=20%. AnchorWidth scales with tax volatility."} +{"file":"llm_fee_maximizer.push3","fitness":null,"origin":"llm","run":null,"generation":null,"date":"2026-03-13","note":"LLM seed: fee maximizer. Wide anchor + high share in all regimes. Bullish/high-tax modes push DD and AS to max. (#673)"}