Skip to content

Commit df408bf

Browse files
committed
Fix overflow in assert in test
1 parent 440736d commit df408bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/signature.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ mod test_templates {
230230
num_active_epochs: usize,
231231
) {
232232
// The epoch must be in the activation interval
233+
// Note that we need to do the second check as u64, as otherwise we get
234+
// overflows when we have the full 2^32 lifetime as activation time
233235
assert!(
234236
activation_epoch as u32 <= epoch
235-
&& epoch < (activation_epoch + num_active_epochs) as u32,
237+
&& (epoch as u64) < (activation_epoch + num_active_epochs) as u64,
236238
"Did not even try signing, epoch {:?} outside of activation interval {:?},{:?}",
237239
epoch,
238240
activation_epoch,

0 commit comments

Comments
 (0)