-
Notifications
You must be signed in to change notification settings - Fork 53
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
[DRB] - Start the DRB calculation two epochs in advance #3911
Conversation
@@ -233,6 +233,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions> CreateTaskState | |||
network: Arc::clone(&handle.hotshot.network), | |||
quorum_membership: handle.hotshot.memberships.quorum_membership.clone().into(), | |||
da_membership: handle.hotshot.memberships.da_membership.clone().into(), | |||
drb_computations: BTreeMap::new(), |
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.
do we need a BTreeMap
here? I think we only want to run one of these calculations at a time
we can e.g. store the seeds and results in a map and trigger the start of the calculation at block_height % epoch_height = 1
or something
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.
block_height % epoch_height = 1
Assuming this is (qc_block_number + 3) % task_state.epoch_height == 0
instead?
Makes sense not to use BTreeMap
. I'm going to add a DrbTasks
struct for this, containing the previous DRB result and the in-progress DRB calculation task, since we may need both of them in each epoch. Hopefully, it's not an overkill!
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.
On second thought, BTreeMap
might be more suitable here than a HashMap
or the new struct I proposed above. We may have at most three things to store here, two DRB results and one in-progress task. I think BTreeMap
makes garbage collection easier because the three epochs may not be consecutive due to the membership.
Lmk if this doesn't make sense or there's a better design though!
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.
As discussed on Zulip, I'll update the maps in a separate PR. Issue: #3933.
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.
I think this looks good, but I left some thoughts about the BTreeMap
on zulip
Closes #3857.
This PR:
This PR does not:
Key places to review:
handlers.rs
.