Convert API gateway to old Poetry format and add service routing for new microservices
Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Deploy to Testnet / notify-deployment (push) Has been cancelled
Documentation Validation / validate-docs (push) Has been cancelled
Documentation Validation / validate-policies-strict (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Successful in 1m55s
Blockchain Synchronization Verification / sync-verification (push) Failing after 11s
CLI Tests / test-cli (push) Failing after 8s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 12s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 13s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 13s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
P2P Network Verification / p2p-verification (push) Successful in 6s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 32s
Package Tests / Python package - aitbc-core (push) Successful in 15s
Package Tests / Python package - aitbc-crypto (push) Successful in 11s
Package Tests / Python package - aitbc-sdk (push) Successful in 11s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 26s
Package Tests / JavaScript package - aitbc-token (push) Successful in 25s
Production Tests / Production Integration Tests (push) Failing after 1m15s
Smart Contract Tests / test-solidity (map[name:aitbc-contracts path:contracts]) (push) Failing after 2m5s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 31s
Smart Contract Tests / test-foundry (push) Failing after 19s
Smart Contract Tests / lint-solidity (push) Successful in 17s
Smart Contract Tests / deploy-contracts (push) Successful in 1m24s
Staking Tests / test-staking-service (push) Failing after 14s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped
Systemd Sync / sync-systemd (push) Successful in 22s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 14m13s

- Convert api-gateway pyproject.toml to old Poetry format for workspace compatibility
- Add routing configuration for AI service (port 8106)
- Add routing configuration for Monitoring service (port 8107)
- Add routing configuration for OpenClaw service (port 8108)
- Add routing configuration for Plugin service (port 8109)
- Remove duplicate middleware implementations from coordinator-api (app_logging.py, error
This commit is contained in:
aitbc
2026-04-30 16:15:05 +02:00
parent 11030a3980
commit 8602732d46
52 changed files with 12793 additions and 937 deletions

View File

@@ -17,6 +17,7 @@ from ..utils.island_credentials import (
load_island_credentials, get_rpc_endpoint, get_chain_id,
get_island_id, get_island_name
)
from ..config import get_config
# Import shared modules
from aitbc import get_logger, AITBCHTTPClient, NetworkError
@@ -41,9 +42,11 @@ def gpu():
def offer(ctx, gpu_count: int, price_per_gpu: float, duration_hours: int, specs: Optional[str], description: Optional[str]):
"""Offer GPU power for sale in the marketplace"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
chain_id = get_chain_id()
island_id = get_island_id()
@@ -104,10 +107,10 @@ def offer(ctx, gpu_count: int, price_per_gpu: float, duration_hours: int, specs:
'created_at': datetime.now().isoformat()
}
# Submit transaction to blockchain
# Submit transaction to GPU service
try:
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
result = http_client.post("/transaction", json=offer_data)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
result = http_client.post("/v1/transactions", json=offer_data)
success(f"GPU offer created successfully!")
success(f"Offer ID: {offer_id}")
success(f"Total Price: {total_price:.2f} AIT")
@@ -142,9 +145,11 @@ def offer(ctx, gpu_count: int, price_per_gpu: float, duration_hours: int, specs:
def bid(ctx, gpu_count: int, max_price: float, duration_hours: int, specs: Optional[str]):
"""Bid on GPU power in the marketplace"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
chain_id = get_chain_id()
island_id = get_island_id()
@@ -204,9 +209,9 @@ def bid(ctx, gpu_count: int, max_price: float, duration_hours: int, specs: Optio
'created_at': datetime.now().isoformat()
}
# Submit transaction to blockchain
# Submit transaction to GPU service
try:
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
result = http_client.post("/v1/transactions", json=bid_data)
success(f"GPU bid created successfully!")
success(f"Bid ID: {bid_id}")
@@ -241,12 +246,14 @@ def bid(ctx, gpu_count: int, max_price: float, duration_hours: int, specs: Optio
def list(ctx, provider: Optional[str], status: Optional[str], type: str):
"""List GPU marketplace offers and bids"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
island_id = get_island_id()
# Query blockchain for GPU marketplace transactions
# Query GPU service for GPU marketplace transactions
try:
params = {
'transaction_type': 'gpu_marketplace',
@@ -259,8 +266,8 @@ def list(ctx, provider: Optional[str], status: Optional[str], type: str):
if type != 'all':
params['action'] = type
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
transactions = http_client.get("/transactions", params=params)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
transactions = http_client.get("/v1/transactions", params=params)
if not transactions:
info("No GPU marketplace transactions found")
@@ -311,9 +318,11 @@ def list(ctx, provider: Optional[str], status: Optional[str], type: str):
def cancel(ctx, order_id: str):
"""Cancel a GPU offer or bid"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
chain_id = get_chain_id()
island_id = get_island_id()
@@ -336,11 +345,9 @@ def cancel(ctx, order_id: str):
# Determine if it's an offer or bid
if order_id.startswith('gpu_offer'):
action = 'cancel_offer'
node_id_field = 'provider_node_id'
action = 'cancel'
elif order_id.startswith('gpu_bid'):
action = 'cancel_bid'
node_id_field = 'bidder_node_id'
action = 'cancel'
else:
error("Invalid order ID format. Must start with 'gpu_offer' or 'gpu_bid'")
raise click.Abort()
@@ -357,10 +364,10 @@ def cancel(ctx, order_id: str):
'chain_id': chain_id
}
# Submit transaction to blockchain
# Submit transaction to GPU service
try:
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
result = http_client.post("/transaction", json=cancel_data)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
result = http_client.post("/v1/transactions", json=cancel_data)
success(f"Order {order_id} cancelled successfully!")
except NetworkError as e:
error(f"Network error submitting transaction: {e}")
@@ -377,9 +384,11 @@ def cancel(ctx, order_id: str):
def accept(ctx, bid_id: str):
"""Accept a GPU bid (provider only)"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
chain_id = get_chain_id()
island_id = get_island_id()
@@ -418,10 +427,10 @@ def accept(ctx, bid_id: str):
'chain_id': chain_id
}
# Submit transaction to blockchain
# Submit transaction to GPU service
try:
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
result = http_client.post("/transaction", json=accept_data)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
result = http_client.post("/v1/transactions", json=accept_data)
success(f"Bid {bid_id} accepted successfully!")
except NetworkError as e:
error(f"Network error submitting transaction: {e}")
@@ -438,12 +447,14 @@ def accept(ctx, bid_id: str):
def status(ctx, order_id: str):
"""Check the status of a GPU order"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
island_id = get_island_id()
# Query blockchain for the order
# Query GPU service for the order
try:
params = {
'transaction_type': 'gpu_marketplace',
@@ -451,8 +462,8 @@ def status(ctx, order_id: str):
'order_id': order_id
}
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
transactions = http_client.get("/transactions", params=params)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
transactions = http_client.get("/v1/transactions", params=params)
if not transactions:
error(f"Order {order_id} not found")
@@ -505,12 +516,14 @@ def status(ctx, order_id: str):
def match(ctx):
"""Match GPU bids with offers (price discovery)"""
try:
# Load CLI config
config = get_config()
# Load island credentials
credentials = load_island_credentials()
rpc_endpoint = get_rpc_endpoint()
island_id = get_island_id()
# Query blockchain for open offers and bids
# Query GPU service for open offers and bids
try:
params = {
'transaction_type': 'gpu_marketplace',
@@ -518,8 +531,8 @@ def match(ctx):
'status': 'active'
}
http_client = AITBCHTTPClient(base_url=rpc_endpoint, timeout=10)
transactions = http_client.get("/transactions", params=params)
http_client = AITBCHTTPClient(base_url=config.gpu_service_url, timeout=10)
transactions = http_client.get("/v1/transactions", params=params)
# Separate offers and bids
offers = []
@@ -569,7 +582,7 @@ def match(ctx):
}
# Submit match transaction
match_result = http_client.post("/transaction", json=match_data)
match_result = http_client.post("/v1/transactions", json=match_data)
matches.append({
"Bid ID": bid.get('bid_id')[:16] + "...",
"Offer ID": offer.get('offer_id')[:16] + "...",

View File

@@ -12,6 +12,7 @@ from ..core.marketplace import (
TransactionStatus
)
from ..utils import output, error, success
from ..config import get_config
@click.group()
@click.option("--chain-id", help="Chain ID for multichain operations (e.g., ait-mainnet, ait-devnet)")
@@ -40,8 +41,8 @@ def marketplace(ctx, chain_id: Optional[str]):
def list(ctx, chain_id, chain_name, chain_type, description, seller_id, price, currency, specs, metadata):
"""List a chain for sale in the marketplace"""
try:
config = load_multichain_config()
marketplace = GlobalChainMarketplace(config)
config = get_config()
from aitbc import AITBCHTTPClient
# Parse chain type
try:
@@ -76,16 +77,32 @@ def list(ctx, chain_id, chain_name, chain_type, description, seller_id, price, c
error("Invalid JSON metadata")
raise click.Abort()
# Create listing
listing_id = asyncio.run(marketplace.create_listing(
chain_id, chain_name, chain_type_enum, description,
seller_id, price_decimal, currency, chain_specs, metadata_dict
))
# Create listing transaction
listing_id = f"chain_listing_{datetime.now().strftime('%Y%m%d%H%M%S')}"
listing_data = {
'type': 'marketplace',
'action': 'list',
'listing_id': listing_id,
'chain_id': chain_id,
'chain_name': chain_name,
'chain_type': chain_type,
'description': description,
'seller_id': seller_id,
'price': float(price),
'currency': currency,
'specs': chain_specs,
'metadata': metadata_dict,
'status': 'active',
'created_at': datetime.now().isoformat()
}
if listing_id:
# Submit transaction to marketplace service
try:
http_client = AITBCHTTPClient(base_url=config.marketplace_service_url, timeout=10)
result = http_client.post("/v1/transactions", json=listing_data)
success(f"Chain listed successfully! Listing ID: {listing_id}")
listing_data = {
listing_info = {
"Listing ID": listing_id,
"Chain ID": chain_id,
"Chain Name": chain_name,
@@ -96,9 +113,9 @@ def list(ctx, chain_id, chain_name, chain_type, description, seller_id, price, c
"Created": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
}
output(listing_data, ctx.obj.get('output_format', 'table'))
else:
error("Failed to create listing")
output(listing_info, ctx.obj.get('output_format', 'table'))
except Exception as e:
error(f"Error submitting transaction: {e}")
raise click.Abort()
except Exception as e: