diff --git a/scripts/harb-evaluator/red-team.sh b/scripts/harb-evaluator/red-team.sh index bcff85c..651aa29 100755 --- a/scripts/harb-evaluator/red-team.sh +++ b/scripts/harb-evaluator/red-team.sh @@ -109,13 +109,13 @@ log " Recenter: $RECENTER_ADDR (account 2)" # Get Uniswap V3 Pool address POOL=$("$CAST" call "$V3_FACTORY" "getPool(address,address,uint24)(address)" \ - "$WETH" "$KRK" "$POOL_FEE" --rpc-url "$RPC_URL") + "$WETH" "$KRK" "$POOL_FEE" --rpc-url "$RPC_URL" | sed 's/\[.*//;s/[[:space:]]//g') log " Pool: $POOL" # ── 3a. Grant recenterAccess FIRST (while original feeDestination is still set) ── FEE_DEST=$("$CAST" call "$LM" "feeDestination()(address)" --rpc-url "$RPC_URL") \ || die "Failed to read feeDestination() from LM" -FEE_DEST=$(echo "$FEE_DEST" | tr -d '[:space:]') +FEE_DEST=$(echo "$FEE_DEST" | sed 's/\[.*//;s/[[:space:]]//g') log "Granting recenterAccess to account 2 ($RECENTER_ADDR) via feeDestination ($FEE_DEST) ..." "$CAST" rpc --rpc-url "$RPC_URL" anvil_impersonateAccount "$FEE_DEST" \ || die "anvil_impersonateAccount $FEE_DEST failed" @@ -133,13 +133,13 @@ log " recenterAccess granted" # NOTE: This is fragile — storage layout changes break this. Consider making # feeDestination mutable or using Foundry's vm.store with slot lookup. log "Setting feeDestination to LM ($LM) ..." -SLOT7=$("$CAST" storage "$LM" 7 --rpc-url "$RPC_URL" | tr -d '[:space:]') +SLOT7=$("$CAST" storage "$LM" 7 --rpc-url "$RPC_URL" | sed 's/\[.*//;s/[[:space:]]//g') UPPER=${SLOT7:0:26} LM_LOWER=$(echo "$LM" | tr '[:upper:]' '[:lower:]' | sed 's/0x//') NEW_SLOT7="${UPPER}${LM_LOWER}" "$CAST" rpc --rpc-url "$RPC_URL" anvil_setStorageAt "$LM" "0x7" "$NEW_SLOT7" \ || die "anvil_setStorageAt for feeDestination failed" -VERIFY=$("$CAST" call "$LM" "feeDestination()(address)" --rpc-url "$RPC_URL" | tr -d '[:space:]') +VERIFY=$("$CAST" call "$LM" "feeDestination()(address)" --rpc-url "$RPC_URL" | sed 's/\[.*//;s/[[:space:]]//g') log " feeDestination set to: $VERIFY" [[ "${VERIFY,,}" == "${LM,,}" ]] || die "feeDestination verification failed: expected $LM, got $VERIFY"