Skip to content

Commit d261f67

Browse files
authored
Merge pull request #1108 from opentensor/spiigot/fix-commit-onexact-epoch
Spiigot/fix commit on exact epoch
2 parents 80150de + 3988e11 commit d261f67

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pallets/subtensor/src/subnets/weights.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ impl<T: Config> Pallet<T> {
262262

263263
// 5. Retrieve or initialize the VecDeque of commits for the hotkey.
264264
let cur_block = Self::get_current_block_as_u64();
265-
let cur_epoch = Self::get_epoch_index(netuid, cur_block);
265+
let cur_epoch = match Self::should_run_epoch(netuid, commit_block) {
266+
true => Self::get_epoch_index(netuid, cur_block).saturating_add(1),
267+
false => Self::get_epoch_index(netuid, cur_block),
268+
};
269+
266270
CRV3WeightCommits::<T>::try_mutate(netuid, cur_epoch, |commits| -> DispatchResult {
267271
// 6. Verify that the number of unrevealed commits is within the allowed limit.
268272

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
220220
// `spec_version`, and `authoring_version` are the same between Wasm and native.
221221
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
222222
// the compatible custom types.
223-
spec_version: 217,
223+
spec_version: 218,
224224
impl_version: 1,
225225
apis: RUNTIME_API_VERSIONS,
226226
transaction_version: 1,

0 commit comments

Comments
 (0)