feat(validator): wire WASM evaluation into submission event loop and gossipsub broadcast - #34
Conversation
… and gossipsub broadcast Integrate WasmChallengeExecutor into the validator node main event loop so that WASM challenge evaluations are actually processed and their results propagated through the P2P network. Key changes in bins/validator-node/src/main.rs: - Add an eval_broadcast_tx/rx channel in the main event loop to forward evaluation results back into the P2P network via gossipsub, ensuring WASM scores participate in consensus/weight aggregation like any other evaluation result. - Handle P2PMessage::Submission in handle_network_event: incoming submissions are deduplicated and stored as EvaluationRecord in the state manager pending_evaluations map for later processing. - Handle P2PMessage::Evaluation in handle_network_event: peer validator evaluations are recorded in state with stake-weighted metadata for consensus aggregation. - Extend process_wasm_evaluations to construct EvaluationMetrics from WASM execution results (normalized score, execution time, memory usage, error info) and broadcast a P2PMessage::Evaluation after each evaluation completes. - Update imports to include EvaluationMessage, EvaluationMetrics, and EvaluationRecord from platform_p2p_consensus. - Thread eval_broadcast_tx through to process_wasm_evaluations so results can be published without blocking the main loop.
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…nto-validator-event-loop
Summary
Integrates the WASM challenge executor into the validator node's main event loop so that incoming submissions are actually evaluated via WASM and results are broadcast to peers over gossipsub.
Changes
P2PMessage::Submissionhandler in the network event loop that deduplicates and registers incoming submissions intopending_evaluationsstateP2PMessage::Evaluationhandler to record evaluations from peer validators with stake-weighted trackingmpscchannel (eval_broadcast_tx/rx) to decouple WASM evaluation completion from gossipsub publishing, forwarding results asNetworkEvent::Messageinto the P2P layerEvaluationMetrics(primary score, execution time, memory usage, error info) from WASM execution results for both success and failure pathsEvaluationMessagevia the broadcast channel so peer validators receive the scoreValidatorEvaluationrecord and the outboundEvaluationMessageChainStateimport with the newly requiredEvaluationMessage,EvaluationMetrics, andEvaluationRecordtypes