Skip to content

Commit efaa176

Browse files
committed
fix the reveal round at the exact epoch
1 parent 85d3c12 commit efaa176

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ async fn generate_commit(
5858
let tempo_plus_one = tempo + 1;
5959
let netuid_plus_one = (netuid as u64) + 1;
6060
let block_with_offset = current_block + netuid_plus_one;
61-
let current_epoch = block_with_offset / tempo_plus_one;
61+
62+
// If at an exact epoch boundary, treat this as the new epoch start.
63+
let is_epoch_boundary = (block_with_offset % tempo_plus_one) == 0;
64+
let base_epoch = block_with_offset / tempo_plus_one;
65+
let current_epoch = if is_epoch_boundary {
66+
base_epoch + 1
67+
} else {
68+
base_epoch
69+
};
6270

6371
// Compute the reveal epoch
6472
let reveal_epoch = current_epoch + subnet_reveal_period_epochs;

0 commit comments

Comments
 (0)