[Feature] Configurable Tempo & Owner-Triggered Epochs#2638
[Feature] Configurable Tempo & Owner-Triggered Epochs#2638evgeny-s wants to merge 13 commits intodevnet-readyfrom
Conversation
| Self::blocks_until_next_epoch(netuid, Self::get_tempo(netuid), current_block) == 0 | ||
| let tempo = Self::get_tempo(netuid); | ||
| if tempo == 0 { | ||
| return false; |
There was a problem hiding this comment.
This means that if tempo is set to 0, manual trigger or max cap of MAX_TEMPO will not work. Is this by design?
There was a problem hiding this comment.
Yes, the previous implementation meant that if tempo is 0, we don't run tempo on this subnet.
We don't have this case in Mainnet, but we support it. There is still a possibility to set the tempo to 0 by the root.
So we support the same semantics.
| /// stateful scheduler (period `tempo + 1`, anchored on `LastEpochBlock`). Used by the | ||
| /// admin-freeze-window predicate and external tooling. Returns `u64::MAX` when | ||
| /// `tempo == 0` (legacy defensive short-circuit). | ||
| pub fn blocks_until_next_epoch(netuid: NetUid, tempo: u16, block_number: u64) -> u64 { |
There was a problem hiding this comment.
"Period is tempo + 1: next firing at last + tempo + 1." comment and the code below is not anymore correct.
There was a problem hiding this comment.
Updated the function name and the comment to avoid the confusion: ad7ba80
|
|
||
| let now = Self::get_current_block_as_u64(); | ||
|
|
||
| Tempo::<T>::insert(netuid, tempo); |
There was a problem hiding this comment.
Should this be a function since Tempo and LastEpochBlock are always updated together?
Description
Implementation of the specification.
Related Issue(s)
Type of Change
Breaking Change
Check the 11. Breaking changes & compatibility section.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.