-
Notifications
You must be signed in to change notification settings - Fork 48
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
Calculate VID dispersal locally #2841
Conversation
I'm thinking about splitting
A new Does that sound like a good idea? |
Yes this sounds like a good idea to avoid duplicate validation, and to avoid waiting for VID calculation to vote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me, just one spot we might want to simplify.
We still need to omit sending VID over the backup network when using the combined network. But that's can be a seperate PR
crates/task-impls/src/vid.rs
Outdated
Some(broadcast_event( | ||
Arc::new(HotShotEvent::VidDisperseRecv( | ||
vid_share.to_proposal(&self.private_key)?, | ||
)), | ||
&event_stream, | ||
)) | ||
}) | ||
.collect(); | ||
|
||
if vid_disperse_tasks.iter().all(Option::is_some) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we wrap the mapped function in Option here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea here was: to_proposal
can return None
when signing the proposal failed. When it happens the closure returns None
, if it succeeds it returns Some(_)
. Then we check if all the proposals have been successfully signed and only if it's true we store all the VID dispersal shares.
So the logic is: if only one signing fails, we don't store the VID shares.
I'm not sure if this logic is correct but it seemed correct to me.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed the ?
operator. I think it's fine, but would prefer if all
was filter. I think if any fail to sign just the ones that weren't signed would be excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Changed.
Closes #2731
This PR:
Splits
DAProposalRecv
intoDAProposalRecv
andDAProposalValidated
.DA task handles
DAProposalRecv
by validating DA proposal and emittingDAProposalValidated
if correct.DA task handles
DAProposalValidated
by creating, signing and sending the vote.VID task handles
DAProposalValidated
by calculating VID dispersal and emittingVidDisperseRecv
for each VID share.The newly calculated VID dispersal is stored locally.
Modifies VID disperse validity check: VID is valid if signed by the leader or by the node itself meaning this is a locally generated VID.
This PR does not:
Key places to review:
crates/task-impls/src/consensus.rs
crates/task-impls/src/da.rs
crates/task-impls/src/vid.rs
How to test this PR:
The change was tested by applying this patch:
and checking if the tests still pass. The patch disables sending the VID dispersal by the leader so that the DA members can only use the locally generated VID dispersal.
Additionally tests in:
crates/testing/tests/da_task.rs and
crates/testing/tests/vid_task.rs
has been modified to test the modified approach.