Fix sync error: use block_data['height'] instead of undefined height variable
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 10s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 4s
Python Tests / test-python (push) Successful in 29s
Security Scanning / security-scan (push) Has been cancelled

This commit is contained in:
aitbc
2026-04-22 13:41:06 +02:00
parent f36fd45d28
commit 941fff1b9d
3 changed files with 75 additions and 1 deletions

30
aitbc/constants.py Normal file
View File

@@ -0,0 +1,30 @@
"""
AITBC Common Constants
Centralized constants for AITBC system paths and configuration
"""
from pathlib import Path
# AITBC System Paths
DATA_DIR = Path("/var/lib/aitbc")
CONFIG_DIR = Path("/etc/aitbc")
LOG_DIR = Path("/var/log/aitbc")
REPO_DIR = Path("/opt/aitbc")
# Common subdirectories
KEYSTORE_DIR = DATA_DIR / "keystore"
BLOCKCHAIN_DATA_DIR = DATA_DIR / "data" / "ait-mainnet"
MARKETPLACE_DATA_DIR = DATA_DIR / "data" / "marketplace"
# Configuration files
ENV_FILE = CONFIG_DIR / ".env"
NODE_ENV_FILE = CONFIG_DIR / "node.env"
# Default ports
BLOCKCHAIN_RPC_PORT = 8006
BLOCKCHAIN_P2P_PORT = 7070
AGENT_COORDINATOR_PORT = 9001
MARKETPLACE_PORT = 8081
# Package version
PACKAGE_VERSION = "0.3.0"

44
aitbc/exceptions.py Normal file
View File

@@ -0,0 +1,44 @@
"""
AITBC Exception Hierarchy
Base exception classes for AITBC applications
"""
class AITBCError(Exception):
"""Base exception for all AITBC errors"""
pass
class ConfigurationError(AITBCError):
"""Raised when configuration is invalid or missing"""
pass
class NetworkError(AITBCError):
"""Raised when network operations fail"""
pass
class AuthenticationError(AITBCError):
"""Raised when authentication fails"""
pass
class EncryptionError(AITBCError):
"""Raised when encryption or decryption fails"""
pass
class DatabaseError(AITBCError):
"""Raised when database operations fail"""
pass
class ValidationError(AITBCError):
"""Raised when input validation fails"""
pass
class BridgeError(AITBCError):
"""Base exception for bridge errors"""
pass

View File

@@ -380,7 +380,7 @@ class ChainSync:
if computed_root != expected_root:
logger.warning(
f"[SYNC] State root mismatch at height {height}: "
f"[SYNC] State root mismatch at height {block_data['height']}: "
f"expected {expected_root.hex()}, computed {computed_root.hex()}"
)
# For now, log warning but accept block (to be enforced in Phase 1.3)