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

Fix compute budget overflow on SlotHistory reading #25

Merged
merged 8 commits into from
Mar 6, 2024

Conversation

ebatsell
Copy link
Collaborator

@ebatsell ebatsell commented Mar 6, 2024

No description provided.

pub fn confirmed_blocks_in_epoch(
start_slot: u64,
end_slot: u64,
slot_history: SlotHistory,
Copy link
Collaborator

Choose a reason for hiding this comment

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

pass by ref

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had this as Box<SlotHistory> but clippy complained, and it somehow works without copying the var.
Can't be &SlotHistory because the function takes ownership at the into_boxed_slice line
Screenshot 2024-03-06 at 4 46 40 PM

cluster_history_account.set_blocks(epoch - 1, num_blocks)?;
// recreates SlotHistory with same heap memory chunk
Box::new(SlotHistory {
bits: bitvec_inner.into(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be for the new epoch? weird bitvec_inner generated by start_slot, end_slot here from previous epoch then we use it below fo the current epoch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SlotHistory contains last 1,048,576 slots so it will always contain all slots from last epoch and this epoch. Recreating it here to avoid copying + ownership issues. Can add a comment about how it contains both epochs of slots

Copy link
Collaborator

@buffalu buffalu left a comment

Choose a reason for hiding this comment

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

few qs

@ebatsell ebatsell merged commit eb131bb into master Mar 6, 2024
6 checks passed
@ebatsell ebatsell deleted the evan/keeper-fixes branch March 6, 2024 23:19
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.

2 participants