Skip to content

Comments

Handle validated messages#168

Merged
jking-aus merged 16 commits intosigp:unstablefrom
dknopik:handle-validated-messages
Mar 12, 2025
Merged

Handle validated messages#168
jking-aus merged 16 commits intosigp:unstablefrom
dknopik:handle-validated-messages

Conversation

@dknopik
Copy link
Member

@dknopik dknopik commented Mar 4, 2025

This PR implements passing the validated messages to the QBFT manager or signature collector.

@dknopik dknopik marked this pull request as draft March 4, 2025 13:33
@dknopik dknopik force-pushed the handle-validated-messages branch from 02b0b4d to c9a32e3 Compare March 4, 2025 15:18
@dknopik dknopik requested a review from jking-aus March 4, 2025 15:20
@dknopik dknopik added ready-for-review This PR is ready to be reviewed network QBFT labels Mar 4, 2025
@dknopik dknopik marked this pull request as ready for review March 4, 2025 15:21
Comment on lines 83 to 84
qbft_manager: Option<Arc<QbftManager>>,
signature_collector: Option<Arc<SignatureCollectorManager>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create a new crate message_receiver and pass it to the network. Then we'd move the validation and message routing there. It'd make the network less aware of specifics, especially now that it handles only bytes, and hopefully help with the clippy::too_many_arguments - it's probably a sign it's doing too much.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, sounds good!

this new crate could also then handle filtering of relevant messages - which, as i have realized just now, is not implemented for the signature collector I think.

Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving the validation to the receiver? Then, we could have only a channel reporting Reject/Ignore to the Network. For Acceptance, we'd forward the message to the manager, and the Network would receive the result from the Sender.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd reduce copying and moving messages around through channels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, will do

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diegomrsantos can you please take a look if I implemented it as you meant?

@dknopik dknopik removed the ready-for-review This PR is ready to be reviewed label Mar 4, 2025
@dknopik dknopik marked this pull request as draft March 4, 2025 16:04
@dknopik dknopik marked this pull request as ready for review March 5, 2025 09:50
@dknopik dknopik force-pushed the handle-validated-messages branch from e21f90d to 69d4e27 Compare March 6, 2025 11:21
Copy link
Member

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - just fix merge conf

@dknopik
Copy link
Member Author

dknopik commented Mar 11, 2025

@jking-aus thanks - before you merge this, lets wait for diego's feedback

diegomrsantos
diegomrsantos previously approved these changes Mar 11, 2025
Copy link
Member

@diegomrsantos diegomrsantos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for that. Only two minor comments.

const RECEIVER_NAME: &str = "message_receiver";

/// A message receiver that passes messages to responsible managers.
pub struct ManagerMessageReceiver<V: ValidatorService + 'static> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should manager be at the end?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I put it in front is that it is a receiver, that forwards messages to the managers, not a receiver that is a manager.

But I am also not happy with the name. I just wanted to avoid MessageReceiverImpl at all costs. :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe NetworkMessageReceiver or SSVMessageReceiver?

match SignedSSVMessage::from_ssz_bytes(&message_data) {
Ok(deserialized_message) => {
trace!(msg = ?deserialized_message, "SignedSSVMessage deserialized");
self.do_validate(&deserialized_message)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this fn as it's doing nothing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, as noted there will be merge conflicts anyway. So you can remove it then.

@jking-aus jking-aus dismissed their stale review March 12, 2025 02:39

resolved

@jking-aus jking-aus merged commit dca6eb5 into sigp:unstable Mar 12, 2025
10 checks passed
@dknopik dknopik deleted the handle-validated-messages branch June 20, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants