Skip to content

refactor: add test and checked APIs for slot calculator #51

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

Merged
merged 8 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint: clippy
  • Loading branch information
prestwich committed Jul 3, 2025
commit 661b84d80b0e122e4964eb195229bf85cf5bc438
4 changes: 2 additions & 2 deletions src/perms/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Builders {

/// Get the builder permissioned at a specific timestamp.
pub fn builder_at_timestamp(&self, timestamp: u64) -> &Builder {
self.builder_at(self.index(timestamp) as usize)
self.builder_at(self.index(timestamp))
}

/// Get the index of the builder that is allowed to sign a block for a
Expand All @@ -156,7 +156,7 @@ impl Builders {

/// Get the builder that is allowed to sign a block at the current timestamp.
pub fn current_builder(&self) -> &Builder {
self.builder_at(self.index_now() as usize)
self.builder_at(self.index_now())
}

/// Check the query bounds for the current timestamp.
Expand Down
2 changes: 2 additions & 0 deletions src/utils/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ use crate::utils::from_env::FromEnv;
///
/// As such, we can define the `slot_start(n)` as
/// - `slot_start(n) = n * slot_duration + start_timestamp`
///
/// and `slot_end(n)` as
/// - `slot_end(n) = (n + 1) * slot_duration + start_timestamp`
///
/// The slot `n` contains the range of timestamps:
/// - `slot_window(n) = slot_start(n)..slot_end(n)`
///
Expand Down