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

[VID] Vid Vote Logic in Consensus Task #2107

Merged
merged 23 commits into from
Dec 1, 2023
Merged

Conversation

dailinsubjam
Copy link
Contributor

@dailinsubjam dailinsubjam commented Nov 22, 2023

Closes issue: #2067

This PR:

  • Update vote logic by updating vote_if_able() so that replicas don’t vote until they’ve seen a VIDShare(event VIDDisperseRecv in implementation).
  • Get rid of VIDVote, VIDCert, VIDVoteSend/Recv, VIDCertSend/Recv, VIDCertificate, VIDVoteCollection.
  • Update test_vid_task.

This PR does not:

  • Deliver different shares to different storage nodes, for this issue VIDDisperseRecv contains ALL shares.

Key places to review:

  • task-impls/src/consensus.rs: added vid_shares to save received vid shares for each view, added one more condition in vote_if_albe(), dealt with HotShotEvent::VidDisperseRecv.

How to test this PR:

just async_std test_vid_task
just async_std test_success

Comments requested:

  • Currently both consensus task and vid task will deal with HotShotEvent::VidDisperseRecv, and there is a high overlapping of codes in validating the received shares. We have to keep the one in consensus task to determine when can vote, but do we still want to keep the one in vid task?

@dailinsubjam dailinsubjam marked this pull request as draft November 22, 2023 22:10
@dailinsubjam dailinsubjam self-assigned this Nov 22, 2023
@dailinsubjam dailinsubjam linked an issue Nov 22, 2023 that may be closed by this pull request
@dailinsubjam dailinsubjam marked this pull request as ready for review November 30, 2023 01:57
Copy link
Member

@elliedavidson elliedavidson left a comment

Choose a reason for hiding this comment

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

Could we update the consensus_task unit tests to also test for receiving VID shares? I don't think they test that now, and after this change we'll want them to test that.

Really great work overall! Thank you turning this PR around so fast!

crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/network.rs Show resolved Hide resolved
.direct_message(stream_id, HotShotEvent::VidVoteRecv(vote))
.await;
};
}
HotShotEvent::VidDisperseRecv(disperse, sender) => {
Copy link
Member

Choose a reason for hiding this comment

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

Now that we have this event handler in the consensus task, we can remove it entirely from the vid task.

Copy link
Contributor Author

@dailinsubjam dailinsubjam Nov 30, 2023

Choose a reason for hiding this comment

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

The only thing remained is this comment at the end of original VidDisperseRecv handler:

// Record the block we have promised to make available.
// TODO https://github.com/EspressoSystems/HotShot/issues/1692
// consensus.saved_payloads.insert(proposal.data.block_payload);

Do we still want to keep #1692 as a comment in the new handler for VidDisperseRecv? cc @ggutoski

Copy link
Contributor

Choose a reason for hiding this comment

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

I say yes but will defer to others.

crates/testing/src/overall_safety_task.rs Outdated Show resolved Hide resolved
crates/web_server/api.toml Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
crates/task-impls/src/consensus.rs Outdated Show resolved Hide resolved
Copy link
Member

@shenkeyao shenkeyao left a comment

Choose a reason for hiding this comment

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

Looks good! Just a question about the endpoint.

crates/web_server/api.toml Show resolved Hide resolved
@dailinsubjam
Copy link
Contributor Author

Could we update the consensus_task unit tests to also test for receiving VID shares? I don't think they test that now, and after this change we'll want them to test that.

@elliedavidson Good point! I know test_success also test this, but consensus_task doesn't. I took a look and found that test input & output are also relevant to the event TransactionsSequenced and BlockReady, I have to take some time to see how to sequence them and how they change the view number. How about we create an issue for this? We can also discuss this in the next meeting.

@dailinsubjam dailinsubjam changed the title Sishan/vid vote logic [VID] Vid Vote Logic in Consensus Task Dec 1, 2023
@elliedavidson
Copy link
Member

Could we update the consensus_task unit tests to also test for receiving VID shares? I don't think they test that now, and after this change we'll want them to test that.

@elliedavidson Good point! I know test_success also test this, but consensus_task doesn't. I took a look and found that test input & output are also relevant to the event TransactionsSequenced and BlockReady, I have to take some time to see how to sequence them and how they change the view number. How about we create an issue for this? We can also discuss this in the next meeting.

Yes, sounds good! This can be done in a separate issue. Let's get this merged first.

elliedavidson
elliedavidson previously approved these changes Dec 1, 2023
@elliedavidson
Copy link
Member

Let's try updating the view timeout for the half_f failures timeout like we did for the merge yesterday.

@dailinsubjam
Copy link
Contributor Author

Could we update the consensus_task unit tests to also test for receiving VID shares? I don't think they test that now, and after this change we'll want them to test that.

Created the issue here: #2148

@dailinsubjam dailinsubjam merged commit af41730 into develop Dec 1, 2023
9 checks passed
@dailinsubjam dailinsubjam deleted the sishan/vid_vote_logic branch December 1, 2023 19:20
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.

Vote logic for VID cert
4 participants