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

refactor: reorder PohRecorder methods #4941

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

jstarry
Copy link

@jstarry jstarry commented Feb 12, 2025

Problem

PohRecorder methods and constructors are in a weird order and make it hard to navigate the code

Summary of Changes

  • Move constructors to the top
  • Move up key methods like fn reset, fn record, and fn tick
  • Move helper private methods below public methods for linear code reading

Fixes #

@jstarry jstarry requested a review from bw-solana February 12, 2025 05:49
@jstarry jstarry force-pushed the refactor/poh-reorder-fns branch from d295e3d to 7f8b4ab Compare February 12, 2025 12:59
bw-solana
bw-solana previously approved these changes Feb 12, 2025
Copy link

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

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

LGTM, but left a couple more code shuffling suggestions

@@ -810,6 +999,31 @@ impl PohRecorder {
Ok(())
}

fn reset_poh(&mut self, reset_bank: Arc<Bank>, reset_start_bank: bool) {

Choose a reason for hiding this comment

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

I'm wondering if reset_poh, should be up near clear_bank

Similarly, set_bank and flush_cache could go up near these friends.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah good call, moved those too

bw-solana
bw-solana previously approved these changes Feb 12, 2025
Copy link

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

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

LGTM

@jstarry jstarry merged commit 3ca9f04 into anza-xyz:master Feb 13, 2025
47 checks passed
@jstarry jstarry deleted the refactor/poh-reorder-fns branch February 13, 2025 04:14
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