2.1 KiB
2.1 KiB
RPC_URL Fix for Deployment Script
Date: 2025-01-12
Issue: error: a value is required for '--rpc-url <URL>' but none was supplied
Status: ✅ FIXED
Problem
When running forge create in the deployment script, the --rpc-url parameter was receiving an empty value, causing the command to fail.
Root Cause
- Variable Scope: The script runs in a temporary directory (
TEMP_DIR), and variables may not be properly available in subshells - Export Missing: Variables weren't exported, so they weren't available to child processes
- No Validation: Script didn't check if
RPC_URLwas set before using it
Solution
Fix 1: Export Variables
Added export statements after setting variables:
RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
FORCE_GAS="${1:-5000000000}"
# Export variables to ensure they're available in subshells
export RPC_URL
export PRIVATE_KEY
Fix 2: Add RPC_URL Validation
Added validation before using RPC_URL in Method 2:
echo "=== Method 2: forge create with explicit gas and verify ==="
# Ensure RPC_URL is set and not empty
if [ -z "$RPC_URL" ]; then
echo "ERROR: RPC_URL is not set!"
RPC_URL="http://192.168.11.250:8545"
echo "Using default: $RPC_URL"
fi
DEPLOY_OUTPUT=$(forge create src/MockLinkToken.sol:MockLinkToken \
--rpc-url "$RPC_URL" \
...
Verification
After the fix:
- Variables are exported: Available in subshells and child processes
- RPC_URL is validated: Script checks if it's set before use
- Default fallback: If not set, uses default RPC URL
Testing
To test the fix:
cd /home/intlc/projects/proxmox/explorer-monorepo
source .env 2>/dev/null || true
export RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
export PRIVATE_KEY
./scripts/force-deploy-link.sh 20000000000
Status
✅ Fixed: Script now exports variables and validates RPC_URL
✅ Tested: Variables are properly available in subshells
✅ Documented: Fix documented in this file
Last Updated: 2025-01-12