fix: deployments-local.json committed to repo (#589)

- Add onchain/deployments-local.json to .gitignore so it is no longer tracked
- Remove the stale committed file from git
- Update fitness.sh to read LM address from forge broadcast JSON
  (DeployLocal.sol's run-latest.json) instead of the potentially stale
  deployments-local.json, matching the approach deploy-optimizer.sh already uses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-20 09:48:00 +00:00
parent 4c27351b27
commit 79a2e2ee5e
3 changed files with 21 additions and 19 deletions

3
.gitignore vendored
View file

@ -39,3 +39,6 @@ logs/
# Holdout scenarios (cloned at runtime by evaluate.sh)
.holdout-scenarios/
# Local deployment addresses (generated per-run by bootstrap scripts)
onchain/deployments-local.json

View file

@ -1,8 +0,0 @@
{
"contracts": {
"Kraiken": "0xff196f1e3a895404d073b8611252cf97388773a7",
"Stake": "0xc36e784e1dff616bdae4eac7b310f0934faf04a4",
"LiquidityManager": "0x33d10f2449ffede92b43d4fba562f132ba6a766a",
"OptimizerProxy": "0x1cf34658e7df9a46ad61486d007a8d62aec9891e"
}
}

View file

@ -178,22 +178,29 @@ fi
log "Optimizer deployed and upgraded"
# =============================================================================
# Step 4 — Read deployment addresses
# Step 4 — Read deployment addresses from broadcast JSON
#
# DeployLocal.sol writes deterministic addresses to deployments-local.json when
# run against a fresh Anvil + standard mnemonic.
# deploy-optimizer.sh runs DeployLocal.sol which writes a broadcast JSON file.
# We read contract addresses from there rather than relying on a potentially
# stale committed deployments-local.json.
# =============================================================================
DEPLOYMENTS="$ONCHAIN_DIR/deployments-local.json"
[ -f "$DEPLOYMENTS" ] || fail2 "deployments-local.json not found — did DeployLocal.sol run?"
CHAIN_ID="$(cast chain-id --rpc-url "$RPC_URL")"
BROADCAST_JSON="$ONCHAIN_DIR/broadcast/DeployLocal.sol/$CHAIN_ID/run-latest.json"
[ -f "$BROADCAST_JSON" ] || fail2 "Broadcast JSON not found at $BROADCAST_JSON — did DeployLocal.sol run?"
LM_ADDR=$(python3 -c "
import json
d = json.load(open('$DEPLOYMENTS'))
print(d['contracts']['LiquidityManager'])
" 2>/dev/null) || fail2 "Failed to read LiquidityManager from deployments-local.json"
LM_ADDR="$(python3 - "$BROADCAST_JSON" <<'PYEOF'
import json, sys
with open(sys.argv[1]) as f:
data = json.load(f)
for tx in data.get('transactions', []):
if (tx.get('contractName') or '').lower() == 'liquiditymanager':
print(tx.get('contractAddress', ''))
break
PYEOF
)" || fail2 "Failed to read LiquidityManager from broadcast JSON"
[ -n "$LM_ADDR" ] || fail2 "LiquidityManager address is empty in deployments-local.json"
[ -n "$LM_ADDR" ] || fail2 "LiquidityManager address not found in broadcast JSON"
log "LiquidityManager: $LM_ADDR"
# =============================================================================