fix: improve genesis bootstrap RPC endpoint and logging
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 4s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 3s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
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 2m38s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Security Scanning / security-scan (push) Successful in 31s

This commit is contained in:
aitbc
2026-05-09 18:29:24 +02:00
parent 1b43859291
commit 76175c0b78
2 changed files with 9 additions and 3 deletions

View File

@@ -568,8 +568,11 @@ class PoAProposer:
"http://localhost:8006", "http://localhost:8006",
] ]
self._logger.info(f"Attempting RPC bootstrap from peers: {trusted_peers}")
for peer_url in trusted_peers: for peer_url in trusted_peers:
try: try:
self._logger.info(f"Trying to fetch allocations from {peer_url}")
async with httpx.AsyncClient(timeout=5.0) as client: async with httpx.AsyncClient(timeout=5.0) as client:
response = await client.get( response = await client.get(
f"{peer_url}/rpc/genesis_allocations", f"{peer_url}/rpc/genesis_allocations",
@@ -577,14 +580,18 @@ class PoAProposer:
) )
response.raise_for_status() response.raise_for_status()
data = response.json() data = response.json()
self._logger.info(f"RPC response from {peer_url}: {data}")
allocations = data.get("allocations", []) allocations = data.get("allocations", [])
if allocations: if allocations:
self._logger.info(f"Successfully loaded {len(allocations)} allocations from {peer_url}") self._logger.info(f"Successfully loaded {len(allocations)} allocations from {peer_url}")
return allocations return allocations
else:
self._logger.warning(f"RPC returned empty allocations from {peer_url}")
except Exception as e: except Exception as e:
self._logger.debug(f"Failed to fetch allocations from {peer_url}: {e}") self._logger.error(f"Failed to fetch allocations from {peer_url}: {e}")
continue continue
self._logger.error("RPC bootstrap failed for all peers")
return [] return []
def _create_accounts_from_allocations(self, session: Session, allocations: list) -> None: def _create_accounts_from_allocations(self, session: Session, allocations: list) -> None:

View File

@@ -257,9 +257,8 @@ class EstimateFeeRequest(BaseModel):
async def get_genesis_allocations(chain_id: str = None) -> Dict[str, Any]: async def get_genesis_allocations(chain_id: str = None) -> Dict[str, Any]:
"""Get genesis allocations from genesis block metadata for RPC bootstrap""" """Get genesis allocations from genesis block metadata for RPC bootstrap"""
chain_id = get_chain_id(chain_id) chain_id = get_chain_id(chain_id)
engine = get_chain_db(chain_id)
with session_scope(engine) as session: with session_scope(chain_id) as session:
# Get genesis block (height 0) # Get genesis block (height 0)
genesis = session.exec( genesis = session.exec(
select(Block).where(Block.chain_id == chain_id).where(Block.height == 0) select(Block).where(Block.chain_id == chain_id).where(Block.height == 0)