From 07794d5848d6242fe33496561aac8fa064ecb0a4 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Sun, 12 Apr 2026 18:23:11 -0700 Subject: [PATCH] chore: update submodule references and enhance deployment script logic - Bumped submodule references for cross-chain-pmm-lps, explorer-monorepo, gru-docs, and smom-dbis-138. - Improved logic in run-mainnet-aave-quote-push-keeper.sh to handle various conditions for quote distribution and wallet LP tranche application. - Updated check-and-fix-explorer-lag.sh to utilize a new stats URL and refined data parsing for better accuracy. Made-with: Cursor --- explorer-monorepo | 2 +- gru-docs | 2 +- .../run-mainnet-aave-quote-push-keeper.sh | 46 +++++++++++++++++-- .../maintenance/check-and-fix-explorer-lag.sh | 14 +++--- smom-dbis-138 | 2 +- 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/explorer-monorepo b/explorer-monorepo index 26b0f1bf..0c869f79 160000 --- a/explorer-monorepo +++ b/explorer-monorepo @@ -1 +1 @@ -Subproject commit 26b0f1bf48f2b018ff8161f836ee5748cb1bfb16 +Subproject commit 0c869f79306dc8a0094eca82161e9617bef329fd diff --git a/gru-docs b/gru-docs index dc1a1c36..a80e9bde 160000 --- a/gru-docs +++ b/gru-docs @@ -1 +1 @@ -Subproject commit dc1a1c369973679437de424c474540e1332e1472 +Subproject commit a80e9bde927a9a535218ebdff8b47b248e2e9471 diff --git a/scripts/deployment/run-mainnet-aave-quote-push-keeper.sh b/scripts/deployment/run-mainnet-aave-quote-push-keeper.sh index a0426435..0497e8b5 100644 --- a/scripts/deployment/run-mainnet-aave-quote-push-keeper.sh +++ b/scripts/deployment/run-mainnet-aave-quote-push-keeper.sh @@ -273,13 +273,51 @@ EOF fi fi -if [[ "$MODE" == "dry-run" && -n "$MANAGER" ]]; then +if [[ -n "$MANAGER" && "$SKIP_FLASH" != "1" && "$SKIP_RECYCLE" != "1" ]]; then export QUOTE_PUSH_TREASURY_HARVEST=1 export QUOTE_PUSH_TREASURY_GAS_HOLDBACK_TARGET_RAW="$KEEPER_GAS_SHORTFALL_QUOTE_RAW" - bash "${PROXMOX_ROOT}/scripts/deployment/run-mainnet-aave-quote-push-managed-cycle.sh" --dry-run + bash "${PROXMOX_ROOT}/scripts/deployment/run-mainnet-aave-quote-push-managed-cycle.sh" "--${MODE}" - if [[ "${KEEPER_RECYCLE_RECIPIENT,,}" == "${DEPLOYER,,}" ]]; then - echo "[plan] A live managed cycle would route recycle quote back to the deployer, after which the wallet LP helper can be attempted." + if [[ "$MODE" == "dry-run" ]]; then + if [[ "${KEEPER_RECYCLE_RECIPIENT,,}" == "${DEPLOYER,,}" ]]; then + echo "[plan] A live managed cycle would route recycle quote back to the deployer, after which the wallet LP helper can be attempted." + fi + exit 0 + fi + + echo + echo "=== Post-execution accounting ===" + bash "${PROXMOX_ROOT}/scripts/verify/report-mainnet-aave-quote-push-surplus-accounting.sh" + + deployer_eth="$(cast balance "$DEPLOYER" --ether --rpc-url "$ETHEREUM_MAINNET_RPC")" + compute_keeper_plan "$MANAGER" "$deployer_eth" "$TOKEN" "$RECEIVER" "$RECEIVER_RESERVE_RAW" "$GAS_FLOOR_ETH" "$OP_BUFFER_ETH" "$NATIVE_TOKEN_PRICE" + + if python3 - "$KEEPER_GAS_SHORTFALL_ETH" <<'PY' +import sys +sys.exit(0 if float(sys.argv[1]) > 0 else 1) +PY + then + echo "[stop] quote was distributed, but deployer ETH is still below the recycle floor; skipping wallet LP tranche" + exit 0 + fi + + if (( KEEPER_RECYCLE_DISTRIBUTION_RAW == 0 )); then + echo "[stop] no recycle allocation remains after gas holdback" + exit 0 + fi + + if [[ -z "${KEEPER_RECYCLE_RECIPIENT:-}" || "${KEEPER_RECYCLE_RECIPIENT,,}" != "${DEPLOYER,,}" ]]; then + echo "[stop] recycle recipient is not the deployer wallet, so the wallet LP helper is intentionally skipped" + exit 0 + fi + + if ! bash "${PROXMOX_ROOT}/scripts/deployment/apply-mainnet-cwusdc-usdc-peg-tranche-from-wallet.sh" --apply; then + status=$? + if [[ "$status" == "3" ]]; then + echo "[stop] recycle distribution completed, but no wallet-funded LP tranche is currently affordable" + exit 0 + fi + exit "$status" fi exit 0 fi diff --git a/scripts/maintenance/check-and-fix-explorer-lag.sh b/scripts/maintenance/check-and-fix-explorer-lag.sh index 06f09374..a77a2e55 100644 --- a/scripts/maintenance/check-and-fix-explorer-lag.sh +++ b/scripts/maintenance/check-and-fix-explorer-lag.sh @@ -17,6 +17,7 @@ source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true IP_RPC_2201="${RPC_2201:-192.168.11.221}" IP_BLOCKSCOUT="${IP_BLOCKSCOUT:-192.168.11.140}" BLOCKSCOUT_API_PORT="${BLOCKSCOUT_API_PORT:-4000}" +EXPLORER_STATS_URL="${EXPLORER_STATS_URL:-https://blockscout.defi-oracle.io/api/v2/stats}" EXPLORER_INDEXER_LAG_THRESHOLD="${EXPLORER_INDEXER_LAG_THRESHOLD:-500}" EXPLORER_TX_VISIBILITY_LAG_BLOCK_THRESHOLD="${EXPLORER_TX_VISIBILITY_LAG_BLOCK_THRESHOLD:-32}" EXPLORER_TX_VISIBILITY_SAMPLE_BLOCKS="${EXPLORER_TX_VISIBILITY_SAMPLE_BLOCKS:-128}" @@ -31,16 +32,15 @@ get_rpc_block() { get_explorer_block() { local body block - body=$(curl -sf --max-time 10 "http://${IP_BLOCKSCOUT}:${BLOCKSCOUT_API_PORT}/api/v2/stats" 2>/dev/null || true) + body=$(curl -sf --max-time 10 "${EXPLORER_STATS_URL}" 2>/dev/null || true) [ -z "$body" ] && return - block=$(echo "$body" | sed -n 's/.*"total_blocks"\s*:\s*"\([0-9]*\)".*/\1/p' | head -1) - [ -z "$block" ] && block=$(echo "$body" | sed -n 's/.*"total_blocks"\s*:\s*\([0-9]*\).*/\1/p' | head -1) + block=$(echo "$body" | jq -r '.freshness.latest_indexed_block.block_number // .latest_block // .total_blocks // empty' 2>/dev/null || true) [ -n "$block" ] && echo "$block" } get_explorer_latest_tx_block() { local body block - body=$(curl -sf --max-time 10 "http://${IP_BLOCKSCOUT}:${BLOCKSCOUT_API_PORT}/api/v2/stats" 2>/dev/null || true) + body=$(curl -sf --max-time 10 "${EXPLORER_STATS_URL}" 2>/dev/null || true) [ -z "$body" ] && return block=$(echo "$body" | jq -r '.freshness.latest_indexed_transaction.block_number // empty' 2>/dev/null || true) [ -n "$block" ] && [ "$block" != "null" ] && echo "$block" @@ -71,7 +71,7 @@ get_recent_chain_activity() { fi done - printf '%s %s %s\n' "${newest_non_empty:-}" "$non_empty_count" "$total_txs" + printf '%s|%s|%s\n' "${newest_non_empty:-none}" "$non_empty_count" "$total_txs" } rpc_block=$(get_rpc_block) @@ -92,9 +92,9 @@ else exit 0 fi -read -r newest_non_empty recent_non_empty_count recent_tx_total <<<"$(get_recent_chain_activity "$rpc_block")" +IFS='|' read -r newest_non_empty recent_non_empty_count recent_tx_total <<<"$(get_recent_chain_activity "$rpc_block")" -if [ -z "$newest_non_empty" ]; then +if [ "$newest_non_empty" = "none" ]; then echo "$(date -Iseconds) QUIET_CHAIN sample_blocks=${EXPLORER_TX_VISIBILITY_SAMPLE_BLOCKS} non_empty=0 txs=0" exit 0 fi diff --git a/smom-dbis-138 b/smom-dbis-138 index 8ec6af94..2b52cc6e 160000 --- a/smom-dbis-138 +++ b/smom-dbis-138 @@ -1 +1 @@ -Subproject commit 8ec6af94d514405b403e7c8bfba1d39f0a0456f0 +Subproject commit 2b52cc6e325889adb128543bfb68abfdf7a084bc