-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conversation
forester/src/lib.rs
Outdated
@@ -1,17 +1,24 @@ | |||
pub type Result<T> = std::result::Result<T, ForesterError>; |
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.
nice
forester/src/slot_tracker.rs
Outdated
last_known_slot: slot, | ||
last_update_time: Instant::now(), | ||
update_interval: Duration::from_secs(30), | ||
slot_duration: Duration::from_millis(400), |
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.
would it make sense to make these values configurable?
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.
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.
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.
}; | ||
|
||
if current_slot >= target_slot { | ||
let actual_slot = rpc.get_slot().await?; |
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.
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.
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 refactored slot tracker a little bit, there is no waiting logic inside of tracker now, so I think it's outdated.
8330a1f
to
80a20a6
Compare
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.
My comments are addressed, but there is still one from @ananas-block which is not #1090 (comment)
80a20a6
to
f13cd02
Compare
Add
SlotTracker
for monitoring and synchronizing slots.