fix: replace datetime.UTC with timezone.utc for Python 3.12+ compatibility
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 22s
Blockchain Synchronization Verification / sync-verification (push) Successful in 3s
CLI Tests / test-cli (push) Failing after 13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 3s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 2s
Deploy to Testnet / deploy-testnet (push) Successful in 1m34s
Documentation Validation / validate-docs (push) Failing after 10s
Documentation Validation / validate-policies-strict (push) Successful in 3s
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
Integration Tests / test-service-integration (push) Successful in 2m42s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 3s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 33s
Package Tests / Python package - aitbc-core (push) Successful in 17s
Package Tests / Python package - aitbc-crypto (push) Successful in 11s
Security Scanning / security-scan (push) Has been cancelled
Package Tests / Python package - aitbc-sdk (push) Successful in 13s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 9s
Package Tests / JavaScript package - aitbc-token (push) Successful in 17s
Staking Tests / test-staking-service (push) Failing after 6s
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

This commit is contained in:
aitbc
2026-05-09 12:03:26 +02:00
parent 14449b0758
commit d26e6d3772
152 changed files with 848 additions and 848 deletions

View File

@@ -5,7 +5,7 @@ import json
import os
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC
from datetime import datetime, timezone
from ..utils import output, error, success, warning
from ..config import get_config
@@ -40,7 +40,7 @@ def register(ctx, name: str, api_key: str, secret_key: Optional[str], sandbox: b
"secret_key": secret_key or "NOT_SET",
"sandbox": sandbox,
"description": description or f"{name} exchange integration",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"status": "active",
"trading_pairs": [],
"last_sync": None
@@ -107,7 +107,7 @@ def create_pair(ctx, base_asset: str, quote_asset: str, exchange: str, min_order
"price_precision": price_precision,
"quantity_precision": quantity_precision,
"status": "active",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"trading_enabled": False
}
@@ -166,7 +166,7 @@ def start_trading(ctx, pair: str, price: Optional[float], base_liquidity: float,
# Update pair to enable trading
target_pair["trading_enabled"] = True
target_pair["started_at"] = datetime.now(datetime.UTC).isoformat()
target_pair["started_at"] = datetime.now(timezone.utc).isoformat()
target_pair["initial_price"] = price or 0.00001 # Default price for AITBC
target_pair["base_liquidity"] = base_liquidity
target_pair["quote_liquidity"] = quote_liquidity
@@ -289,7 +289,7 @@ def add_liquidity(ctx, pair: str, amount: float, side: str, exchange: Optional[s
if side == 'sell' or side == 'both':
target_pair["base_liquidity"] = target_pair.get("base_liquidity", 0) + amount
target_pair["liquidity_updated_at"] = datetime.now(datetime.UTC).isoformat()
target_pair["liquidity_updated_at"] = datetime.now(timezone.utc).isoformat()
# Save exchanges
with open(exchanges_file, 'w') as f:

View File

@@ -7,7 +7,7 @@ import shutil
import yaml
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from ..utils import output, error, success
import getpass
@@ -223,7 +223,7 @@ def create(ctx, name: str, wallet_type: str, no_encrypt: bool):
"address": address,
"public_key": public_key,
"private_key": private_key,
"created_at": datetime.now(datetime.UTC).isoformat() + "Z",
"created_at": datetime.now(timezone.utc).isoformat() + "Z",
"balance": 0,
"transactions": [],
}
@@ -392,7 +392,7 @@ def backup(ctx, name: str, destination: Optional[str]):
{
"wallet": name,
"backup_path": destination,
"timestamp": datetime.now(datetime.UTC).isoformat() + "Z",
"timestamp": datetime.now(timezone.utc).isoformat() + "Z",
}
)
@@ -421,7 +421,7 @@ def restore(ctx, backup_path: str, name: str, force: bool):
# Update wallet name if needed
wallet_data["wallet_id"] = name
wallet_data["restored_at"] = datetime.now(datetime.UTC).isoformat() + "Z"
wallet_data["restored_at"] = datetime.now(timezone.utc).isoformat() + "Z"
# Save restored wallet (preserve encryption state)
# If wallet was encrypted, we save it as-is (still encrypted with original password)
@@ -520,7 +520,7 @@ def balance(ctx):
"address": address,
"public_key": public_key,
"private_key": private_key,
"created_at": datetime.now(datetime.UTC).isoformat() + "Z",
"created_at": datetime.now(timezone.utc).isoformat() + "Z",
"balance": 0.0,
"transactions": [],
}

View File

@@ -7,7 +7,7 @@ import click
import json
import requests
import subprocess
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, Any, List, Optional
@click.group()
@@ -27,7 +27,7 @@ def health(test_mode):
"service": "blockchain-event-bridge",
"version": "0.1.0",
"uptime_seconds": 86400,
"timestamp": datetime.now(datetime.UTC).isoformat()
"timestamp": datetime.now(timezone.utc).isoformat()
}
click.echo("🏥 Blockchain Event Bridge Health:")

View File

@@ -9,7 +9,7 @@ import json
import os
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC
from datetime import datetime, timezone
@click.group()
@@ -42,7 +42,7 @@ def register(ctx, name: str, api_key: str, secret_key: Optional[str], sandbox: b
"secret_key": secret_key or "NOT_SET",
"sandbox": sandbox,
"description": description or f"{name} exchange integration",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"status": "active",
"trading_pairs": [],
"last_sync": None
@@ -109,7 +109,7 @@ def create_pair(ctx, base_asset: str, quote_asset: str, exchange: str, min_order
"price_precision": price_precision,
"quantity_precision": quantity_precision,
"status": "active",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"trading_enabled": False
}
@@ -168,7 +168,7 @@ def start_trading(ctx, pair: str, price: Optional[float], base_liquidity: float,
# Update pair to enable trading
target_pair["trading_enabled"] = True
target_pair["started_at"] = datetime.now(datetime.UTC).isoformat()
target_pair["started_at"] = datetime.now(timezone.utc).isoformat()
target_pair["initial_price"] = price or 0.00001 # Default price for AITBC
target_pair["base_liquidity"] = base_liquidity
target_pair["quote_liquidity"] = quote_liquidity
@@ -291,7 +291,7 @@ def add_liquidity(ctx, pair: str, amount: float, side: str, exchange: Optional[s
if side == 'sell' or side == 'both':
target_pair["base_liquidity"] = target_pair.get("base_liquidity", 0) + amount
target_pair["liquidity_updated_at"] = datetime.now(datetime.UTC).isoformat()
target_pair["liquidity_updated_at"] = datetime.now(timezone.utc).isoformat()
# Save exchanges
with open(exchanges_file, 'w') as f:

View File

@@ -5,7 +5,7 @@ import json
import hashlib
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC
from datetime import datetime, timezone
from utils import output, error, success, warning
@@ -50,7 +50,7 @@ def verify_genesis(ctx, chain: str, genesis_hash: Optional[str], force: bool):
"hash_match": genesis_hash is None or calculated_hash == genesis_hash,
"genesis_timestamp": chain_genesis.get("timestamp"),
"genesis_accounts": len(chain_genesis.get("accounts", [])),
"verification_timestamp": datetime.now(datetime.UTC).isoformat()
"verification_timestamp": datetime.now(timezone.utc).isoformat()
}
if not verification_result["hash_match"] and not force:
@@ -108,7 +108,7 @@ def genesis_hash(ctx, chain: str):
"genesis_hash": calculated_hash,
"genesis_timestamp": chain_genesis.get("timestamp"),
"genesis_size": len(genesis_string),
"calculated_at": datetime.now(datetime.UTC).isoformat(),
"calculated_at": datetime.now(timezone.utc).isoformat(),
"genesis_summary": {
"accounts": len(chain_genesis.get("accounts", [])),
"authorities": len(chain_genesis.get("authorities", [])),
@@ -131,7 +131,7 @@ def verify_signature(ctx, signer: str, message: Optional[str], chain: Optional[s
"""Verify digital signature for genesis or transactions"""
if not message:
message = f"Genesis verification for {chain or 'all chains'} at {datetime.now(datetime.UTC).isoformat()}"
message = f"Genesis verification for {chain or 'all chains'} at {datetime.now(timezone.utc).isoformat()}"
# Create signature (simplified for demo)
signature_data = f"{signer}:{message}:{chain or 'global'}"
@@ -143,7 +143,7 @@ def verify_signature(ctx, signer: str, message: Optional[str], chain: Optional[s
"message": message,
"chain": chain,
"signature": signature,
"verification_timestamp": datetime.now(datetime.UTC).isoformat(),
"verification_timestamp": datetime.now(timezone.utc).isoformat(),
"signature_valid": True # In real implementation, this would verify against actual signature
}
@@ -202,7 +202,7 @@ def network_verify_genesis(ctx, all_chains: bool, chain: Optional[str], network_
network_results = {
"verification_type": "network_wide" if network_wide else "selective",
"chains_verified": chains_to_verify,
"verification_timestamp": datetime.now(datetime.UTC).isoformat(),
"verification_timestamp": datetime.now(timezone.utc).isoformat(),
"chain_results": {},
"overall_consensus": True,
"total_chains": len(chains_to_verify)
@@ -280,7 +280,7 @@ def protect(ctx, chain: str, protection_level: str, backup: bool):
# Create backup if requested
if backup:
backup_file = Path.home() / ".aitbc" / f"genesis_backup_{chain}_{datetime.now(datetime.UTC).strftime('%Y%m%d_%H%M%S')}.json"
backup_file = Path.home() / ".aitbc" / f"genesis_backup_{chain}_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}.json"
with open(backup_file, 'w') as f:
json.dump(genesis_data, f, indent=2)
success(f"Genesis backup created: {backup_file}")
@@ -291,7 +291,7 @@ def protect(ctx, chain: str, protection_level: str, backup: bool):
protection_config = {
"chain": chain,
"protection_level": protection_level,
"applied_at": datetime.now(datetime.UTC).isoformat(),
"applied_at": datetime.now(timezone.utc).isoformat(),
"protection mechanisms": []
}

View File

@@ -6,7 +6,7 @@ Commands for managing global infrastructure deployment and multi-region optimiza
import click
import json
import requests
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, Any, List, Optional
@click.group()
@@ -35,7 +35,7 @@ def deploy_region(region_id, name, location, endpoint, capacity, compliance_leve
"current_load": 0,
"latency_ms": 0,
"compliance_level": compliance_level,
"deployed_at": datetime.now(datetime.UTC).isoformat()
"deployed_at": datetime.now(timezone.utc).isoformat()
}
if test_mode:
@@ -295,7 +295,7 @@ def deploy_service(service_name, target_regions, strategy, configuration, test_m
"configuration": config_data,
"deployment_strategy": strategy,
"health_checks": ["/health", "/api/health"],
"created_at": datetime.now(datetime.UTC).isoformat()
"created_at": datetime.now(timezone.utc).isoformat()
}
if test_mode:

View File

@@ -6,7 +6,7 @@ import uuid
import httpx
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from utils import output, error, success, warning
from aitbc_cli.config import get_config, CLIConfig
@@ -63,7 +63,7 @@ def create(ctx, exchange: str, pair: str, spread: float, depth: float, max_order
"orders_placed": 0,
"orders_filled": 0
},
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"last_updated": None,
"description": description or f"Market making bot for {pair} on {exchange}",
"current_orders": [],
@@ -151,7 +151,7 @@ def config(ctx, bot_id: str, spread: Optional[float], depth: Optional[float], ma
return
# Update timestamp
bot["last_updated"] = datetime.now(datetime.UTC).isoformat()
bot["last_updated"] = datetime.now(timezone.utc).isoformat()
# Save bots
with open(bots_file, 'w') as f:
@@ -194,8 +194,8 @@ def start(ctx, bot_id: str, dry_run: bool):
# Update bot status
bot["status"] = "running" if not dry_run else "simulation"
bot["started_at"] = datetime.now(datetime.UTC).isoformat()
bot["last_updated"] = datetime.now(datetime.UTC).isoformat()
bot["started_at"] = datetime.now(timezone.utc).isoformat()
bot["last_updated"] = datetime.now(timezone.utc).isoformat()
bot["dry_run"] = dry_run
# Initialize performance tracking for this run
@@ -251,8 +251,8 @@ def stop(ctx, bot_id: str):
# Update bot status
bot["status"] = "stopped"
bot["stopped_at"] = datetime.now(datetime.UTC).isoformat()
bot["last_updated"] = datetime.now(datetime.UTC).isoformat()
bot["stopped_at"] = datetime.now(timezone.utc).isoformat()
bot["last_updated"] = datetime.now(timezone.utc).isoformat()
# Cancel all current orders (simulation)
bot["current_orders"] = []
@@ -325,7 +325,7 @@ def performance(ctx, bot_id: Optional[str], exchange: Optional[str], pair: Optio
bot_performance["current_run"] = current_run
if "started_at" in current_run:
start_time = datetime.fromisoformat(current_run["started_at"].replace('Z', '+00:00'))
runtime = datetime.now(datetime.UTC) - start_time
runtime = datetime.now(timezone.utc) - start_time
bot_performance["run_time_hours"] = runtime.total_seconds() / 3600
performance_data[current_bot_id] = bot_performance
@@ -337,7 +337,7 @@ def performance(ctx, bot_id: Optional[str], exchange: Optional[str], pair: Optio
output({
"performance_data": performance_data,
"total_bots": len(performance_data),
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
})
@@ -404,7 +404,7 @@ def status(ctx, bot_id: str):
uptime_hours = None
if bot["status"] in ["running", "simulation"] and "started_at" in bot:
start_time = datetime.fromisoformat(bot["started_at"].replace('Z', '+00:00'))
uptime = datetime.now(datetime.UTC) - start_time
uptime = datetime.now(timezone.utc) - start_time
uptime_hours = uptime.total_seconds() / 3600
output({

View File

@@ -6,7 +6,7 @@ import hashlib
import uuid
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from utils import output, error, success, warning
@@ -42,7 +42,7 @@ def create(ctx, threshold: int, owners: str, name: Optional[str], description: O
"threshold": threshold,
"owners": owner_list,
"status": "active",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"description": description or f"Multi-signature wallet with {threshold}/{len(owner_list)} threshold",
"transactions": [],
"proposals": [],
@@ -112,7 +112,7 @@ def propose(ctx, wallet_id: str, recipient: str, amount: float, description: Opt
"amount": amount,
"description": description or f"Send {amount} to {recipient}",
"status": "pending",
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"signatures": [],
"threshold": wallet["threshold"],
"owners": wallet["owners"]
@@ -190,7 +190,7 @@ def sign(ctx, proposal_id: str, signer: str, private_key: Optional[str]):
signature_obj = {
"signer": signer,
"signature": signature,
"timestamp": datetime.now(datetime.UTC).isoformat()
"timestamp": datetime.now(timezone.utc).isoformat()
}
target_proposal["signatures"].append(signature_obj)
@@ -198,7 +198,7 @@ def sign(ctx, proposal_id: str, signer: str, private_key: Optional[str]):
# Check if threshold reached
if len(target_proposal["signatures"]) >= target_proposal["threshold"]:
target_proposal["status"] = "approved"
target_proposal["approved_at"] = datetime.now(datetime.UTC).isoformat()
target_proposal["approved_at"] = datetime.now(timezone.utc).isoformat()
# Add to transactions
transaction = {
@@ -411,9 +411,9 @@ def challenge(ctx, proposal_id: str):
challenge_data = {
"challenge_id": f"challenge_{str(uuid.uuid4())[:8]}",
"proposal_id": proposal_id,
"challenge": hashlib.sha256(f"{proposal_id}:{datetime.now(datetime.UTC).isoformat()}".encode()).hexdigest(),
"created_at": datetime.now(datetime.UTC).isoformat(),
"expires_at": (datetime.now(datetime.UTC) + timedelta(hours=1)).isoformat()
"challenge": hashlib.sha256(f"{proposal_id}:{datetime.now(timezone.utc).isoformat()}".encode()).hexdigest(),
"created_at": datetime.now(timezone.utc).isoformat(),
"expires_at": (datetime.now(timezone.utc) + timedelta(hours=1)).isoformat()
}
# Store challenge (in a real implementation, this would be more secure)

View File

@@ -4,7 +4,7 @@ import click
import json
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from utils import output, error, success, warning
@@ -41,7 +41,7 @@ def set_price(ctx, pair: str, price: float, source: str, confidence: float, desc
"source": source,
"confidence": confidence,
"description": description or f"Price set by {source}",
"timestamp": datetime.now(datetime.UTC).isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
"volume": 0.0,
"spread": 0.0
}
@@ -155,7 +155,7 @@ def price_history(ctx, pair: Optional[str], days: int, limit: int, source: Optio
# Filter data
history_data = {}
cutoff_time = datetime.now(datetime.UTC) - timedelta(days=days)
cutoff_time = datetime.now(timezone.utc) - timedelta(days=days)
for pair_name, pair_data in oracle_data.items():
if pair and pair_name != pair:
@@ -193,7 +193,7 @@ def price_history(ctx, pair: Optional[str], days: int, limit: int, source: Optio
"limit": limit,
"source": source or "all"
},
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
})
@@ -259,7 +259,7 @@ def price_feed(ctx, pairs: Optional[str], interval: int, sources: Optional[str])
"interval": interval,
"sources": source_list or "all"
},
"generated_at": datetime.now(datetime.UTC).isoformat(),
"generated_at": datetime.now(timezone.utc).isoformat(),
"total_pairs": len(feed_data)
})
@@ -282,7 +282,7 @@ def analyze(ctx, pair: Optional[str], hours: int):
with open(oracle_file, 'r') as f:
oracle_data = json.load(f)
cutoff_time = datetime.now(datetime.UTC) - timedelta(hours=hours)
cutoff_time = datetime.now(timezone.utc) - timedelta(hours=hours)
analysis_results = {}
for pair_name, pair_data in oracle_data.items():
@@ -334,7 +334,7 @@ def analyze(ctx, pair: Optional[str], hours: int):
"pair": pair or "all",
"time_window_hours": hours
},
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
})
@@ -459,7 +459,7 @@ def store(ctx, wallet: str, file: str, pin: bool):
"size": len(data),
"pinned": pin,
"wallet": wallet,
"timestamp": datetime.now(datetime.UTC).isoformat()
"timestamp": datetime.now(timezone.utc).isoformat()
}
with open(listings_file, 'w') as f:
@@ -501,7 +501,7 @@ def announce(ctx, wallet: str, cid: str, price: float, description: Optional[str
listings_data[cid]["price"] = price
listings_data[cid]["description"] = description or ""
listings_data[cid]["announced"] = True
listings_data[cid]["announced_at"] = datetime.now(datetime.UTC).isoformat()
listings_data[cid]["announced_at"] = datetime.now(timezone.utc).isoformat()
listings_data[cid]["wallet"] = wallet
with open(listings_file, 'w') as f:

View File

@@ -6,7 +6,7 @@ Commands for browsing, purchasing, and managing plugins from the marketplace
import click
import json
import requests
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, Any, List, Optional
@click.group()
@@ -312,7 +312,7 @@ def purchase(plugin_id, test_mode):
"price": plugin.get('price', 0.0),
"currency": plugin.get('pricing', {}).get('currency', 'USD'),
"payment_method": "credit_card",
"purchased_at": datetime.now(datetime.UTC).isoformat()
"purchased_at": datetime.now(timezone.utc).isoformat()
}
response = requests.post(

View File

@@ -6,7 +6,7 @@ Commands for managing plugin registration, versioning, and discovery
import click
import json
import requests
from datetime import datetime, UTC
from datetime import datetime, timezone
from pathlib import Path
from typing import Dict, Any, List, Optional
@@ -46,8 +46,8 @@ def register(plugin_id, name, version, description, author, category, tags, repo
"homepage": homepage,
"license": license,
"status": "active",
"created_at": datetime.now(datetime.UTC).isoformat(),
"updated_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"updated_at": datetime.now(timezone.utc).isoformat(),
"downloads": 0,
"rating": 0.0,
"reviews_count": 0
@@ -55,7 +55,7 @@ def register(plugin_id, name, version, description, author, category, tags, repo
if test_mode:
# Mock registration for testing
plugin_data["registration_id"] = f"reg_{int(datetime.now(datetime.UTC).timestamp())}"
plugin_data["registration_id"] = f"reg_{int(datetime.now(timezone.utc).timestamp())}"
plugin_data["status"] = "registered"
click.echo(f"✅ Plugin registered successfully (test mode)")
click.echo(f"📋 Plugin ID: {plugin_data['plugin_id']}")
@@ -304,7 +304,7 @@ def update_version(plugin_id, version, changelog, test_mode):
update_data = {
"version": version,
"changelog": changelog,
"updated_at": datetime.now(datetime.UTC).isoformat()
"updated_at": datetime.now(timezone.utc).isoformat()
}
if test_mode:

View File

@@ -7,7 +7,7 @@ import click
import json
import requests
import subprocess
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, Any, List, Optional
@click.group()
@@ -82,7 +82,7 @@ def deploy(environment, version, region, dry_run, force):
click.echo(f"🌍 Environment: {environment}")
click.echo(f"📦 Version: {version}")
click.echo(f"🗺️ Region: {region}")
click.echo(f"📅 Deployed at: {datetime.now(datetime.UTC).isoformat()}")
click.echo(f"📅 Deployed at: {datetime.now(timezone.utc).isoformat()}")
if not dry_run:
click.echo("🔗 Service URLs:")
@@ -131,7 +131,7 @@ def rollback(environment, backup_id, dry_run):
if rollback_result['success']:
click.echo("✅ Rollback completed successfully!")
click.echo(f"📦 New Version: {backup_info['version']}")
click.echo(f"📅 Rolled back at: {datetime.now(datetime.UTC).isoformat()}")
click.echo(f"📅 Rolled back at: {datetime.now(timezone.utc).isoformat()}")
else:
click.echo(f"❌ Rollback failed: {rollback_result['error']}")
else:
@@ -361,10 +361,10 @@ def run_pre_deployment_checks(environment, dry_run):
def create_backup(environment):
"""Create backup of current deployment"""
backup_id = f"backup_{environment}_{int(datetime.now(datetime.UTC).timestamp())}"
backup_id = f"backup_{environment}_{int(datetime.now(timezone.utc).timestamp())}"
return {
"backup_id": backup_id,
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"status": "completed"
}
@@ -406,7 +406,7 @@ def rollback_deployment(environment, backup_id):
return {
"status": "completed",
"backup_id": backup_id,
"rolled_back_at": datetime.now(datetime.UTC).isoformat()
"rolled_back_at": datetime.now(timezone.utc).isoformat()
}
def get_current_deployment_info(environment):
@@ -492,7 +492,7 @@ def restart_services(environment, services):
return {
"success": True,
"restarted_services": services,
"restarted_at": datetime.now(datetime.UTC).isoformat()
"restarted_at": datetime.now(timezone.utc).isoformat()
}
def run_production_tests(environment, test_type, timeout):

View File

@@ -4,7 +4,7 @@ import click
import json
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from utils import output, error, success, warning
@@ -38,8 +38,8 @@ def set_limit(ctx, wallet: str, max_daily: Optional[float], max_weekly: Optional
# Create or update wallet limits
wallet_limits = limits.get(wallet, {
"wallet": wallet,
"created_at": datetime.now(datetime.UTC).isoformat(),
"updated_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"updated_at": datetime.now(timezone.utc).isoformat(),
"status": "active"
})
@@ -59,14 +59,14 @@ def set_limit(ctx, wallet: str, max_daily: Optional[float], max_weekly: Optional
if blacklist:
wallet_limits["blacklist"] = [addr.strip() for addr in blacklist.split(',')]
wallet_limits["updated_at"] = datetime.now(datetime.UTC).isoformat()
wallet_limits["updated_at"] = datetime.now(timezone.utc).isoformat()
# Initialize usage tracking
if "usage" not in wallet_limits:
wallet_limits["usage"] = {
"daily": {"amount": 0.0, "count": 0, "reset_at": datetime.now(datetime.UTC).isoformat()},
"weekly": {"amount": 0.0, "count": 0, "reset_at": datetime.now(datetime.UTC).isoformat()},
"monthly": {"amount": 0.0, "count": 0, "reset_at": datetime.now(datetime.UTC).isoformat()}
"daily": {"amount": 0.0, "count": 0, "reset_at": datetime.now(timezone.utc).isoformat()},
"weekly": {"amount": 0.0, "count": 0, "reset_at": datetime.now(timezone.utc).isoformat()},
"monthly": {"amount": 0.0, "count": 0, "reset_at": datetime.now(timezone.utc).isoformat()}
}
# Save limits
@@ -100,10 +100,10 @@ def time_lock(ctx, wallet: str, amount: float, duration: int, recipient: str, de
"""Create a time-locked transfer"""
# Generate lock ID
lock_id = f"lock_{str(int(datetime.now(datetime.UTC).timestamp()))[-8:]}"
lock_id = f"lock_{str(int(datetime.now(timezone.utc).timestamp()))[-8:]}"
# Calculate release time
release_time = datetime.now(datetime.UTC) + timedelta(days=duration)
release_time = datetime.now(timezone.utc) + timedelta(days=duration)
# Create time lock
time_lock = {
@@ -112,7 +112,7 @@ def time_lock(ctx, wallet: str, amount: float, duration: int, recipient: str, de
"recipient": recipient,
"amount": amount,
"duration_days": duration,
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"release_time": release_time.isoformat(),
"status": "locked",
"description": description or f"Time-locked transfer of {amount} to {recipient}",
@@ -159,11 +159,11 @@ def vesting_schedule(ctx, wallet: str, total_amount: float, duration: int, cliff
"""Create a vesting schedule for token release"""
# Generate schedule ID
schedule_id = f"vest_{str(int(datetime.now(datetime.UTC).timestamp()))[-8:]}"
schedule_id = f"vest_{str(int(datetime.now(timezone.utc).timestamp()))[-8:]}"
# Calculate vesting schedule
start_time = datetime.now(datetime.UTC) + timedelta(days=cliff_period)
end_time = datetime.now(datetime.UTC) + timedelta(days=duration)
start_time = datetime.now(timezone.utc) + timedelta(days=cliff_period)
end_time = datetime.now(timezone.utc) + timedelta(days=duration)
# Create release events
releases = []
@@ -188,7 +188,7 @@ def vesting_schedule(ctx, wallet: str, total_amount: float, duration: int, cliff
"duration_days": duration,
"cliff_period_days": cliff_period,
"release_interval_days": release_interval,
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"start_time": start_time.isoformat(),
"end_time": end_time.isoformat(),
"status": "active",
@@ -239,7 +239,7 @@ def audit_trail(ctx, wallet: Optional[str], status: Optional[str]):
"time_locks": {},
"vesting_schedules": {},
"transfers": {},
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
}
# Load transfer limits
@@ -318,7 +318,7 @@ def status(ctx, wallet: Optional[str]):
"wallet_limits": {},
"active_time_locks": {},
"active_vesting_schedules": {},
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
}
# Load and filter limits
@@ -410,7 +410,7 @@ def release_time_lock(ctx, lock_id: str):
# Check if lock can be released
release_time = datetime.fromisoformat(lock_data["release_time"])
current_time = datetime.now(datetime.UTC)
current_time = datetime.now(timezone.utc)
if current_time < release_time:
error(f"Time lock cannot be released until {release_time.isoformat()}")
@@ -454,7 +454,7 @@ def release_vesting(ctx, schedule_id: str):
return
schedule = vesting_schedules[schedule_id]
current_time = datetime.now(datetime.UTC)
current_time = datetime.now(timezone.utc)
# Find available releases
available_releases = []

View File

@@ -8,7 +8,7 @@ import shutil
import yaml
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime, UTC, timedelta
from datetime import datetime, timezone, timedelta
from utils import output, error, success, encrypt_value, decrypt_value
import getpass
@@ -407,7 +407,7 @@ def backup(ctx, name: str, destination: Optional[str]):
{
"wallet": name,
"backup_path": destination,
"timestamp": datetime.now(datetime.UTC).isoformat() + "Z",
"timestamp": datetime.now(timezone.utc).isoformat() + "Z",
}
)
@@ -447,7 +447,7 @@ def restore(ctx, backup_path: str, name: str, force: bool):
# Update wallet name if needed
wallet_data["wallet_id"] = name
wallet_data["restored_at"] = datetime.now(datetime.UTC).isoformat() + "Z"
wallet_data["restored_at"] = datetime.now(timezone.utc).isoformat() + "Z"
# Save restored wallet (preserve encryption state)
# If wallet was encrypted, we save it as-is (still encrypted with original password)
@@ -559,7 +559,7 @@ def balance(ctx):
"address": address,
"public_key": public_key,
"private_key": private_key,
"created_at": datetime.now(datetime.UTC).isoformat() + "Z",
"created_at": datetime.now(timezone.utc).isoformat() + "Z",
"balance": 0.0,
"transactions": [],
}
@@ -1090,7 +1090,7 @@ def rewards(ctx):
"address": address,
"public_key": public_key,
"private_key": private_key,
"created_at": datetime.now(datetime.UTC).isoformat() + "Z",
"created_at": datetime.now(timezone.utc).isoformat() + "Z",
"balance": 0.0,
"transactions": [],
}
@@ -2112,7 +2112,7 @@ def multisig_create(ctx, threshold: int, signers: tuple, wallet_name: Optional[s
"threshold": threshold,
"signers": list(signers),
"wallet_name": wallet_name or f"multisig_{int(datetime.now().timestamp())}",
"created_at": datetime.now(datetime.UTC).isoformat()
"created_at": datetime.now(timezone.utc).isoformat()
}
if chain_id:
@@ -2173,7 +2173,7 @@ def set_limit(ctx, amount: float, period: str, wallet_name: Optional[str]):
limit_data = {
"amount": amount,
"period": period,
"set_at": datetime.now(datetime.UTC).isoformat()
"set_at": datetime.now(timezone.utc).isoformat()
}
try:
@@ -2234,8 +2234,8 @@ def time_lock(ctx, amount: float, duration: int, recipient: str, wallet_name: Op
"duration_hours": duration,
"recipient": recipient,
"wallet_name": wallet_name or "default",
"created_at": datetime.now(datetime.UTC).isoformat(),
"unlock_time": (datetime.now(datetime.UTC) + timedelta(hours=duration)).isoformat()
"created_at": datetime.now(timezone.utc).isoformat(),
"unlock_time": (datetime.now(timezone.utc) + timedelta(hours=duration)).isoformat()
}
try:
@@ -2355,7 +2355,7 @@ def audit_trail(ctx, wallet_name: Optional[str], days: int):
audit_data = {
"wallet_name": wallet_name or "all",
"audit_period_days": days,
"generated_at": datetime.now(datetime.UTC).isoformat()
"generated_at": datetime.now(timezone.utc).isoformat()
}
try:
@@ -2380,7 +2380,7 @@ def audit_trail(ctx, wallet_name: Optional[str], days: int):
audit_file.parent.mkdir(parents=True, exist_ok=True)
# Generate sample audit data
cutoff_date = datetime.now(datetime.UTC) - timedelta(days=days)
cutoff_date = datetime.now(timezone.utc) - timedelta(days=days)
audit_data["transactions"] = []
audit_data["signatures"] = []

View File

@@ -8,7 +8,7 @@ import httpx
import json
import sys
import time
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Optional
# Configuration
@@ -108,7 +108,7 @@ class AITBCMiner:
"status": "ONLINE",
"inflight": 0,
"metadata": {
"last_seen": datetime.now(datetime.UTC).isoformat(),
"last_seen": datetime.now(timezone.utc).isoformat(),
"gpu_utilization": 75,
"gpu_memory_used": 8000,
"gpu_temperature": 65

View File

@@ -7,7 +7,7 @@ import json
import hashlib
import secrets
from pathlib import Path
from datetime import datetime, UTC
from datetime import datetime, timezone
from typing import Dict, List, Optional, Tuple
from eth_utils import keccak
@@ -34,7 +34,7 @@ class SecureAuditLogger:
"genesis_hash": None,
"last_hash": None,
"entry_count": 0,
"created_at": datetime.now(datetime.UTC).isoformat(),
"created_at": datetime.now(timezone.utc).isoformat(),
"version": "1.0"
}
with open(self.integrity_file, "w") as f:
@@ -54,7 +54,7 @@ class SecureAuditLogger:
integrity_data["last_hash"] = entry_hash
integrity_data["entry_count"] += 1
integrity_data["last_updated"] = datetime.now(datetime.UTC).isoformat()
integrity_data["last_updated"] = datetime.now(timezone.utc).isoformat()
with open(self.integrity_file, "w") as f:
json.dump(integrity_data, f, indent=2)
@@ -99,7 +99,7 @@ class SecureAuditLogger:
# Create audit entry
entry = {
"timestamp": datetime.now(datetime.UTC).isoformat(),
"timestamp": datetime.now(timezone.utc).isoformat(),
"action": action,
"user": user or "unknown",
"details": details or {},
@@ -239,7 +239,7 @@ class SecureAuditLogger:
# Create report
report = {
"audit_report": {
"generated_at": datetime.now(datetime.UTC).isoformat(),
"generated_at": datetime.now(timezone.utc).isoformat(),
"integrity": {
"is_valid": is_valid,
"issues": issues