Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
89
docs/RPC_URL_FIX.md
Normal file
89
docs/RPC_URL_FIX.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# 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
|
||||
|
||||
1. **Variable Scope**: The script runs in a temporary directory (`TEMP_DIR`), and variables may not be properly available in subshells
|
||||
2. **Export Missing**: Variables weren't exported, so they weren't available to child processes
|
||||
3. **No Validation**: Script didn't check if `RPC_URL` was set before using it
|
||||
|
||||
---
|
||||
|
||||
## Solution
|
||||
|
||||
### Fix 1: Export Variables
|
||||
|
||||
Added export statements after setting variables:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
1. **Variables are exported**: Available in subshells and child processes
|
||||
2. **RPC_URL is validated**: Script checks if it's set before use
|
||||
3. **Default fallback**: If not set, uses default RPC URL
|
||||
|
||||
---
|
||||
|
||||
## Testing
|
||||
|
||||
To test the fix:
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user