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

feat: forester: reduce get slot calls #1090

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

sergeytimoshin
Copy link
Contributor

Add SlotTracker for monitoring and synchronizing slots.

@@ -1,17 +1,24 @@
pub type Result<T> = std::result::Result<T, ForesterError>;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

last_known_slot: slot,
last_update_time: Instant::now(),
update_interval: Duration::from_secs(30),
slot_duration: Duration::from_millis(400),
Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to make these values configurable?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should check whether slot time can drift or only block time drifts.
Additionally, we could check whether we can fetch average slot time from Solana rpc at startup if not its likely a hardcoded value and we should lookup the constant.

Copy link
Contributor

@ananas-block ananas-block Aug 15, 2024

Choose a reason for hiding this comment

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

};

if current_slot >= target_slot {
let actual_slot = rpc.get_slot().await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea is wait until an expected slot with slot tracker and once reached double check with get slot?
We could also just call tracker.update() here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored slot tracker a little bit, there is no waiting logic inside of tracker now, so I think it's outdated.

forester/src/epoch_manager.rs Outdated Show resolved Hide resolved
forester/src/epoch_manager.rs Outdated Show resolved Hide resolved
forester/src/epoch_manager.rs Outdated Show resolved Hide resolved
@sergeytimoshin sergeytimoshin force-pushed the sergey/forester-reduce-get-slot-calls branch 4 times, most recently from 8330a1f to 80a20a6 Compare August 18, 2024 16:17
Copy link
Contributor

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

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

My comments are addressed, but there is still one from @ananas-block which is not #1090 (comment)

@sergeytimoshin sergeytimoshin force-pushed the sergey/forester-reduce-get-slot-calls branch from 80a20a6 to f13cd02 Compare August 19, 2024 15:56
@ananas-block ananas-block merged commit 7a3f59e into main Aug 21, 2024
15 checks passed
@ananas-block ananas-block deleted the sergey/forester-reduce-get-slot-calls branch August 21, 2024 01:46
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.

3 participants