From 85503f9c5c3a35a0e58763c7da986bf9929acc47 Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 13 Mar 2026 01:48:58 +0000 Subject: [PATCH] fix: remove cast to-dec that broke cumulativeVolume check in call_recenter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cast call with a typed '(uint256)' selector returns output like '140734553600000 [1.407e14]' — the numeric value followed by a bracketed scientific-notation annotation. The cast to-dec added in the previous review-fix commit failed on this annotated string and fell back to echo "0", making call_recenter() always skip the VWAP-already- bootstrapped guard and attempt the real recenter() call, which then reverted with "amplitude not reached". Fix: drop the cast to-dec normalisation. A plain != "0" string check is sufficient because cast returns "0" (no annotation) for the zero case and any non-zero annotated string is also != "0". Co-Authored-By: Claude Sonnet 4.6 --- scripts/bootstrap-common.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap-common.sh b/scripts/bootstrap-common.sh index 16b396f..a67df08 100755 --- a/scripts/bootstrap-common.sh +++ b/scripts/bootstrap-common.sh @@ -130,9 +130,12 @@ call_recenter() { local cumvol cumvol="$(cast call --rpc-url "$ANVIL_RPC" \ "$LIQUIDITY_MANAGER" "cumulativeVolume()(uint256)" 2>/dev/null || echo "0")" - # Normalise to decimal: cast returns decimal for typed calls but cast to-dec handles - # both decimal and hex (0x...) inputs, guarding against future cast output changes. - cumvol="$(cast to-dec "$cumvol" 2>/dev/null || echo "0")" + # cast call with a typed (uint256) selector returns a plain decimal string for + # non-zero values (e.g. "140734553600000") and "0" for zero. A simple != "0" + # check is sufficient; note that the output may include a scientific-notation + # annotation (e.g. "140734553600000 [1.407e14]") which is also != "0", so we + # do NOT attempt to parse it further with cast to-dec (which would fail on the + # annotation and incorrectly fall back to "0"). if [[ "$cumvol" != "0" && -n "$cumvol" ]]; then bootstrap_log "VWAP already bootstrapped by deploy script (cumulativeVolume=$cumvol) -- skipping initial recenter" return 0