Skip to content

feat(validator): wire WASM evaluation into submission event loop and gossipsub broadcast - #34

Merged
echobt merged 2 commits into
mainfrom
feat/wire-wasm-eval-into-validator-event-loop
Feb 17, 2026
Merged

feat(validator): wire WASM evaluation into submission event loop and gossipsub broadcast#34
echobt merged 2 commits into
mainfrom
feat/wire-wasm-eval-into-validator-event-loop

Conversation

@echobt

@echobt echobt commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

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

  • Submission handling: Add P2PMessage::Submission handler in the network event loop that deduplicates and registers incoming submissions into pending_evaluations state
  • Peer evaluation ingestion: Add P2PMessage::Evaluation handler to record evaluations from peer validators with stake-weighted tracking
  • Evaluation broadcast channel: Introduce an mpsc channel (eval_broadcast_tx/rx) to decouple WASM evaluation completion from gossipsub publishing, forwarding results as NetworkEvent::Message into the P2P layer
  • Structured evaluation metrics: Build EvaluationMetrics (primary score, execution time, memory usage, error info) from WASM execution results for both success and failure paths
  • Gossipsub publication: After recording local evaluation in state, publish an EvaluationMessage via the broadcast channel so peer validators receive the score
  • Consistent timestamps: Use a single timestamp for both the local ValidatorEvaluation record and the outbound EvaluationMessage
  • Import cleanup: Replace unused ChainState import with the newly required EvaluationMessage, EvaluationMetrics, and EvaluationRecord types

… 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.
@coderabbitai

coderabbitai Bot commented Feb 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@echobt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/wire-wasm-eval-into-validator-event-loop

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@echobt
echobt merged commit 7263a0e into main Feb 17, 2026
7 checks passed
@echobt
echobt deleted the feat/wire-wasm-eval-into-validator-event-loop branch February 17, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant