From 3a17404529d5175bcb858b092b65c0a91f05c13b Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 21:46:00 +0000 Subject: [PATCH] fix: skip CI bootstrap recenter when VWAP already seeded by deploy script DeployLocal.sol now calls recenter() twice during the VWAP bootstrap sequence (issue #567 fix). The second recenter leaves ANCHOR positions at the post-seed-buy tick, so the CI bootstrap's subsequent call_recenter() failed with "amplitude not reached" (currentTick == anchorCenterTick, amplitude = 0 < 400). Fix: before calling recenter(), check cumulativeVolume(). If it is already > 0, the deploy script has placed positions and bootstrapped VWAP -- skip the redundant recenter rather than failing. Co-Authored-By: Claude Sonnet 4.6 --- scripts/bootstrap-common.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/bootstrap-common.sh b/scripts/bootstrap-common.sh index 3e42594..cd8b52b 100755 --- a/scripts/bootstrap-common.sh +++ b/scripts/bootstrap-common.sh @@ -113,6 +113,18 @@ call_recenter() { recenter_pk="$TXNBOT_PRIVATE_KEY" recenter_addr="$TXNBOT_ADDRESS" fi + + # If the deploy script already bootstrapped VWAP (cumulativeVolume > 0), positions + # are in place at the post-seed-buy tick. Calling recenter() now would fail with + # "amplitude not reached" because currentTick == anchorCenterTick. Skip it. + local cumvol + cumvol="$(cast call --rpc-url "$ANVIL_RPC" \ + "$LIQUIDITY_MANAGER" "cumulativeVolume()(uint256)" 2>/dev/null || echo "0")" + if [[ "$cumvol" != "0" && -n "$cumvol" ]]; then + bootstrap_log "VWAP already bootstrapped by deploy script (cumulativeVolume=$cumvol) -- skipping initial recenter" + return 0 + fi + bootstrap_log "Calling recenter() via $recenter_addr" cast send --rpc-url "$ANVIL_RPC" --private-key "$recenter_pk" \ "$LIQUIDITY_MANAGER" "recenter()" >>"$LOG_FILE" 2>&1