fix: remove cast to-dec that broke cumulativeVolume check in call_recenter
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 <noreply@anthropic.com>
This commit is contained in:
parent
38bc0f7057
commit
85503f9c5c
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue