Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Libp2p] - Refactor VID Delayed Requester To Use Message Passing #3688

Merged
merged 25 commits into from
Sep 27, 2024

Conversation

lukeiannucci
Copy link
Contributor

@lukeiannucci lukeiannucci commented Sep 20, 2024

Closes #3617 and #3599

This PR:

Implements the HotShotEvent Request / Response framework for VID shares. We recently did this to retrieve QCs and now we are making it a standard. In the Request and Response task we now emit/receive new HotShotEvents, those being:

VidRequestSend: This is when a node sends a request to the DA committee to retrieve a VID share for a specified view.
VidRequestRecv: This event is for members of the DA committee, they will receive the request and respond with the VID share for the view.
VidResponseSend: This event emits the VID share to the network task so we can send it back to the requesting node.
VidResponseRecv: The requesting node will wait in a background task for this response and then validate the VID share.

Previously we used a separate channel to request / receive VID shares. We also cleanup the old logic in this PR.

Another thing we do is remove the loop where we iterate over all DA committee members for a given view VidShareRecv events to verify . We now add the sender public key and use that so no need to check every member.

This PR does not:

Key places to review:

I do most of the refactoring in request.rs and response.rs. I am also not using the other channel anymore and relying on the main network task to send these messages now.

Also on HS Event VidShareRecv make sure the logic looks correct where I remove the loop

How to test this PR:

The combined_network tests will test this new logic

Ok(serialized) => serialized,
Err(e) => {
tracing::error!("Failed to serialize outgoing message: this should never happen. Error: {e}");
match receiver.recv_direct().await {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@lukeiannucci lukeiannucci changed the title Li/req res vid [Libp2p] - Refactor VID Delayed Requester To Use Message Passing Sep 24, 2024
@lukeiannucci lukeiannucci marked this pull request as ready for review September 25, 2024 14:10
@lukeiannucci lukeiannucci marked this pull request as draft September 25, 2024 18:32
@lukeiannucci lukeiannucci marked this pull request as ready for review September 26, 2024 00:13
crates/task-impls/src/request.rs Outdated Show resolved Hide resolved
crates/task-impls/src/request.rs Outdated Show resolved Hide resolved
crates/task-impls/src/response.rs Show resolved Hide resolved
.await;
}
}
SequencingMessage::General(_) => {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this also include responses for proposal? Or is that handled by a different message type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have those GeneralConsensusMessage. Im not sure how easy it would be to refactor them into here. I need to think a little more on this

Copy link
Contributor Author

@lukeiannucci lukeiannucci Sep 26, 2024

Choose a reason for hiding this comment

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

If we want to move them we can probably make a separate issue

crates/hotshot/src/tasks/mod.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants