Add blockchain event bridge service with smart contract event integration
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s
Integration Tests / test-service-integration (push) Failing after 15s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 12s
Security Scanning / security-scan (push) Successful in 41s
Systemd Sync / sync-systemd (push) Successful in 7s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s
Integration Tests / test-service-integration (push) Failing after 15s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 12s
Security Scanning / security-scan (push) Successful in 41s
Systemd Sync / sync-systemd (push) Successful in 7s
- Phase 1: Core bridge service with gossip broker subscription - Phase 2: Smart contract event integration via eth_getLogs RPC endpoint - Add contract event subscriber for AgentStaking, PerformanceVerifier, Marketplace, Bounty, CrossChainBridge - Add contract event handlers in agent_daemon.py and marketplace.py - Add systemd service file for blockchain-event-bridge - Update blockchain node router.py with eth_getLogs endpoint - Add configuration for contract addresses - Add tests for contract subscriber and handlers (27 tests passing)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Condition-based polling for batch operations."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConditionPoller:
|
||||
"""Polls for specific conditions that should trigger OpenClaw actions."""
|
||||
|
||||
def __init__(self, settings: Any) -> None:
|
||||
self.settings = settings
|
||||
self._running = False
|
||||
|
||||
async def run(self) -> None:
|
||||
"""Run the condition poller."""
|
||||
if not self.settings.enable_polling:
|
||||
logger.info("Condition polling disabled")
|
||||
return
|
||||
|
||||
self._running = True
|
||||
logger.info("Starting condition poller...")
|
||||
|
||||
while self._running:
|
||||
try:
|
||||
await self._check_conditions()
|
||||
await asyncio.sleep(self.settings.polling_interval_seconds)
|
||||
except asyncio.CancelledError:
|
||||
logger.info("Condition poller cancelled")
|
||||
break
|
||||
except Exception as e:
|
||||
logger.error(f"Error in condition poller: {e}", exc_info=True)
|
||||
await asyncio.sleep(5)
|
||||
|
||||
async def _check_conditions(self) -> None:
|
||||
"""Check for conditions that should trigger actions."""
|
||||
# Placeholder for Phase 3 implementation
|
||||
# Examples:
|
||||
# - Agent performance thresholds (SLA violations)
|
||||
# - Marketplace capacity planning
|
||||
# - Governance proposal voting deadlines
|
||||
# - Cross-chain bridge status
|
||||
pass
|
||||
|
||||
async def stop(self) -> None:
|
||||
"""Stop the condition poller."""
|
||||
self._running = False
|
||||
logger.info("Condition poller stopped")
|
||||
Reference in New Issue
Block a user