-
Notifications
You must be signed in to change notification settings - Fork 736
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
use proposer index cache for block proposal #4338
Conversation
@michaelsproul PTAL, I don't know if I handle some details properly 😂 |
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.
Looks good!
I'm planning to do some benchmarking of this PR with your other optimisation next week 🔜
let (proposers, decision_root, _, fork) = | ||
compute_proposer_duties_from_head(proposer_epoch, self) | ||
.map_err(BlockProductionError::BeaconChain)?; |
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 we could simplify this a little by calling state.get_beacon_proposer_indices
on the state directly. It has already been advanced through to the slot of the proposal (above) so it should be able to serve the call.
The compute_proposer_duties_from_head
basically does the same thing except it also clones the head
again (which is slow). Using the head is also not necessarily correct if we are proposing on a non-head block (sometimes in tests we propose blocks using an old parent instead of the head).
The fork can be set to state.fork()
directly, and we also have the dependent_root
(same as the decision root) above.
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.
@michaelsproul updated! But delete some proposer cache prime check in some tests to pass CI.
Closing this for now as it doesn't seem to be a promising avenue for optimisation. We can revisit later if necessary. |
Issue Addressed
#4313
Proposed Changes
use proposer index cache for block proposal
Additional Info
NA