Skip to content

Commit 52165c5

Browse files
committed
Fix P2P message forwarding for Custom challenge messages
Previously, ChallengeMessageType::Custom messages (used by p2p_bridge for proposal voting) were not forwarded to challenge containers because they fell through to the catch-all branch returning None. This caused proposal timeouts because validators never received votes from other validators - the P2P messages were broadcast but never delivered to the term-challenge containers. Now Custom messages are properly parsed as ChallengeP2PMessage and forwarded to the container's /p2p/message endpoint.
1 parent c754a94 commit 52165c5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bins/validator-node/src/main.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,6 +3230,22 @@ async fn handle_message(
32303230
None
32313231
}
32323232
}
3233+
platform_core::ChallengeMessageType::Custom(ref custom_type) => {
3234+
// For p2p_bridge messages, forward the raw payload as ChallengeP2PMessage
3235+
if let Ok(p2p_msg) = serde_json::from_slice::<
3236+
platform_challenge_sdk::ChallengeP2PMessage,
3237+
>(&msg_payload)
3238+
{
3239+
debug!(
3240+
"Forwarding Custom({}) message to challenge container",
3241+
custom_type
3242+
);
3243+
Some(p2p_msg)
3244+
} else {
3245+
warn!("Failed to parse Custom({}) payload as ChallengeP2PMessage", custom_type);
3246+
None
3247+
}
3248+
}
32333249
_ => {
32343250
debug!(
32353251
"Unhandled challenge message type: {:?}",

0 commit comments

Comments
 (0)