Skip to content

Commit

Permalink
test(accountsdb): assert MINIMUM_SLOTS_PER_EPOCH works properly in ge…
Browse files Browse the repository at this point in the history
…tSlotsInEpoch calculation
  • Loading branch information
dnut committed Jun 28, 2024
1 parent 4abb203 commit 2b3c851
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/accountsdb/genesis_config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub const EpochSchedule = extern struct {

/// get the length of the given epoch (in slots)
pub fn getSlotsInEpoch(self: *const EpochSchedule, epoch: Epoch) Slot {
comptime std.debug.assert(std.math.isPowerOfTwo(MINIMUM_SLOTS_PER_EPOCH));
return if (epoch < self.first_normal_epoch)
@as(Slot, 1) <<| epoch +| @ctz(MINIMUM_SLOTS_PER_EPOCH)
else
Expand Down

0 comments on commit 2b3c851

Please sign in to comment.