From 4779749f2b3e2f2229ef813c2c485991ac18ada8 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 15 Mar 2026 14:18:10 +0000 Subject: [PATCH] fix: feat: red-team agent should read LM and optimizer Solidity source (#821) Co-Authored-By: Claude Sonnet 4.6 --- scripts/harb-evaluator/red-team.sh | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/scripts/harb-evaluator/red-team.sh b/scripts/harb-evaluator/red-team.sh index 6837afb..f04cbb7 100755 --- a/scripts/harb-evaluator/red-team.sh +++ b/scripts/harb-evaluator/red-team.sh @@ -315,6 +315,15 @@ log " lm_eth_before = $LM_ETH_BEFORE wei" # ── 6. Build agent prompt ────────────────────────────────────────────────────── +# ── 6a. Read Solidity source files (reflect the current candidate after inject) ─ +ONCHAIN_SRC="$REPO_ROOT/onchain/src" +SOL_LM=$(< "$ONCHAIN_SRC/LiquidityManager.sol") +SOL_THREE_POS=$(< "$ONCHAIN_SRC/abstracts/ThreePositionStrategy.sol") +SOL_OPTIMIZER=$(< "$ONCHAIN_SRC/Optimizer.sol") +SOL_OPTIMIZERV3=$(< "$ONCHAIN_SRC/OptimizerV3.sol") +SOL_VWAP=$(< "$ONCHAIN_SRC/VWAPTracker.sol") +SOL_PRICE_ORACLE=$(< "$ONCHAIN_SRC/abstracts/PriceOracle.sol") + # Build Previous Findings section from memory file MEMORY_SECTION="" if [[ -f "$MEMORY_FILE" && -s "$MEMORY_FILE" ]]; then @@ -433,6 +442,44 @@ feeDestination is set to LM itself, so its KRK is already excluded by outstandin --- +## Source Code (read-only reference) + +Use the source code below to reason about internal state transitions, edge cases in tick math, +exact mint/burn logic, optimizer parameter effects, and floor formula details. +Do NOT attempt to deploy or modify contracts — these are for reference only. + +### LiquidityManager.sol +\`\`\`solidity +${SOL_LM} +\`\`\` + +### ThreePositionStrategy.sol +\`\`\`solidity +${SOL_THREE_POS} +\`\`\` + +### Optimizer.sol (base) +\`\`\`solidity +${SOL_OPTIMIZER} +\`\`\` + +### OptimizerV3.sol (current candidate — reflects inject.sh output) +\`\`\`solidity +${SOL_OPTIMIZERV3} +\`\`\` + +### VWAPTracker.sol +\`\`\`solidity +${SOL_VWAP} +\`\`\` + +### PriceOracle.sol +\`\`\`solidity +${SOL_PRICE_ORACLE} +\`\`\` + +--- + ## Cast command patterns ### Check total LM ETH (run after each strategy)