fix: update CLI default RPC port from 8006 to 8005
Fixed CLI blockchain connection timeout errors by updating default RPC URL from port 8006 to port 8005 across all CLI modules. Root cause: - Port 8006 is for blockchain P2P protocol (not HTTP RPC) - Port 8005 is the HTTP RPC API port - CLI was trying to use HTTP on port 8006, causing timeouts Updated files: - cli/advanced_wallet.py: DEFAULT_RPC_URL - cli/enterprise_cli.py: DEFAULT_RPC_URL - cli/commands/blockchain.py: _get_node_endpoint() - cli/core/main.py: default_rpc_url - cli/commands/sync.py: source and import-url defaults - cli/commands/marketplace.py: rpc_url config default - cli/commands/blockchain_event_bridge.py: test mode config - cli/handlers/bridge.py: test mode config - cli/commands/deployment.py: service endpoints This fixes the training script errors where CLI commands were timing out when trying to connect to the blockchain node.
This commit is contained in:
@@ -13,7 +13,7 @@ import requests
|
|||||||
|
|
||||||
# Default paths
|
# Default paths
|
||||||
DEFAULT_KEYSTORE_DIR = Path("/var/lib/aitbc/keystore")
|
DEFAULT_KEYSTORE_DIR = Path("/var/lib/aitbc/keystore")
|
||||||
DEFAULT_RPC_URL = "http://localhost:8006"
|
DEFAULT_RPC_URL = "http://localhost:8005"
|
||||||
|
|
||||||
# Note: Legacy simple_wallet.py module has been replaced by unified CLI
|
# Note: Legacy simple_wallet.py module has been replaced by unified CLI
|
||||||
# This file should use the new nested CLI structure via subprocess calls
|
# This file should use the new nested CLI structure via subprocess calls
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import click
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
def _get_node_endpoint(ctx):
|
def _get_node_endpoint(ctx):
|
||||||
|
"""Get the blockchain node RPC endpoint from context or config."""
|
||||||
try:
|
try:
|
||||||
config = ctx.obj['config']
|
config = ctx.obj['config']
|
||||||
# Use the new blockchain_rpc_url from config
|
# Use the new blockchain_rpc_url from config
|
||||||
return config.blockchain_rpc_url
|
return config.blockchain_rpc_url
|
||||||
except:
|
except:
|
||||||
return "http://127.0.0.1:8006" # Use new blockchain RPC port
|
return "http://127.0.0.1:8005" # Use HTTP RPC port (not blockchain protocol port)
|
||||||
|
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
from utils import output, error
|
from utils import output, error
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ def config(test_mode):
|
|||||||
if test_mode:
|
if test_mode:
|
||||||
# Mock data for testing
|
# Mock data for testing
|
||||||
mock_config = {
|
mock_config = {
|
||||||
"blockchain_rpc_url": "http://localhost:8006",
|
"blockchain_rpc_url": "http://localhost:8005",
|
||||||
"gossip_backend": "redis",
|
"gossip_backend": "redis",
|
||||||
"gossip_broadcast_url": "redis://localhost:6379",
|
"gossip_broadcast_url": "redis://localhost:6379",
|
||||||
"coordinator_api_url": "http://localhost:8011",
|
"coordinator_api_url": "http://localhost:8011",
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ def status(service):
|
|||||||
output(f"📊 Deployment Status Check for {service or 'All Services'}", None)
|
output(f"📊 Deployment Status Check for {service or 'All Services'}", None)
|
||||||
|
|
||||||
checks = [
|
checks = [
|
||||||
"Coordinator API: http://localhost:8000/health",
|
"Coordinator API: http://localhost:8011/health",
|
||||||
"Blockchain Node: http://localhost:8006/status",
|
"Blockchain Node RPC: http://localhost:8005/health",
|
||||||
"Marketplace: http://localhost:8002/health",
|
"Marketplace: http://localhost:8001/health",
|
||||||
"Wallet Service: http://localhost:8003/status"
|
"Wallet Service: http://localhost:8003/status"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ def pay(ctx, booking_id: str, amount: float, from_wallet: str, to_wallet: str, t
|
|||||||
|
|
||||||
# Get wallet balance from blockchain
|
# Get wallet balance from blockchain
|
||||||
from aitbc_cli.utils.chain_id import get_chain_id
|
from aitbc_cli.utils.chain_id import get_chain_id
|
||||||
rpc_url = config.get('rpc_url', 'http://localhost:8006')
|
rpc_url = config.get('rpc_url', 'http://localhost:8005')
|
||||||
chain_id = get_chain_id(rpc_url)
|
chain_id = get_chain_id(rpc_url)
|
||||||
balance_response = httpx.Client().get(f"{rpc_url}/rpc/account/{address}?chain_id={chain_id}", timeout=5)
|
balance_response = httpx.Client().get(f"{rpc_url}/rpc/account/{address}?chain_id={chain_id}", timeout=5)
|
||||||
if balance_response.status_code != 200:
|
if balance_response.status_code != 200:
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ def sync():
|
|||||||
|
|
||||||
|
|
||||||
@sync.command()
|
@sync.command()
|
||||||
@click.option('--source', default=lambda: os.getenv('AITBC_SYNC_SOURCE_URL', 'http://127.0.0.1:8006'), help='Source RPC URL (leader)')
|
@click.option('--source', default=lambda: os.getenv('AITBC_SYNC_SOURCE_URL', 'http://127.0.0.1:8005'), help='Source RPC URL (leader)')
|
||||||
@click.option('--import-url', default='http://127.0.0.1:8006', help='Local RPC URL for import')
|
@click.option('--import-url', default='http://127.0.0.1:8005', help='Local RPC URL for import')
|
||||||
@click.option('--batch-size', type=int, default=100, help='Blocks per batch')
|
@click.option('--batch-size', type=int, default=100, help='Blocks per batch')
|
||||||
@click.option('--poll-interval', type=float, default=0.2, help='Seconds between batches')
|
@click.option('--poll-interval', type=float, default=0.2, help='Seconds between batches')
|
||||||
def bulk(source, import_url, batch_size, poll_interval):
|
def bulk(source, import_url, batch_size, poll_interval):
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ def cli(ctx, url, api_key, chain_id, output, verbose, debug):
|
|||||||
|
|
||||||
# Handle chain_id with auto-detection
|
# Handle chain_id with auto-detection
|
||||||
from aitbc_cli.utils.chain_id import get_chain_id, get_default_chain_id
|
from aitbc_cli.utils.chain_id import get_chain_id, get_default_chain_id
|
||||||
default_rpc_url = url.replace('/api', '') if url else 'http://localhost:8006'
|
default_rpc_url = url.replace('/api', '') if url else 'http://localhost:8005'
|
||||||
ctx.obj['chain_id'] = get_chain_id(default_rpc_url, override=chain_id)
|
ctx.obj['chain_id'] = get_chain_id(default_rpc_url, override=chain_id)
|
||||||
|
|
||||||
# Add commands to CLI
|
# Add commands to CLI
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from aitbc.paths import get_keystore_path
|
|||||||
|
|
||||||
# Default paths
|
# Default paths
|
||||||
DEFAULT_KEYSTORE_DIR = get_keystore_path()
|
DEFAULT_KEYSTORE_DIR = get_keystore_path()
|
||||||
DEFAULT_RPC_URL = "http://localhost:8006"
|
DEFAULT_RPC_URL = "http://localhost:8005"
|
||||||
|
|
||||||
def get_password(password_arg: str = None, password_file: str = None) -> str:
|
def get_password(password_arg: str = None, password_file: str = None) -> str:
|
||||||
"""Get password from various sources"""
|
"""Get password from various sources"""
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ def handle_bridge_config(args):
|
|||||||
|
|
||||||
if args.test_mode:
|
if args.test_mode:
|
||||||
print("⚙️ Blockchain Event Bridge Configuration (test mode):")
|
print("⚙️ Blockchain Event Bridge Configuration (test mode):")
|
||||||
print("🔗 Blockchain RPC URL: http://localhost:8006")
|
print("🔗 Blockchain RPC URL: http://localhost:8005")
|
||||||
print("💬 Gossip Backend: redis")
|
print("💬 Gossip Backend: redis")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user