Skip to content

Commit

Permalink
fix(pallets/subspace): try to fix build with errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aripiprazole committed May 2, 2024
1 parent f5efeaa commit 9edd525
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions pallets/subspace/src/module.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use super::*;

use frame_support::{
pallet_prelude::{Decode, DispatchResult, Encode},
IterableStorageDoubleMap,
};
use frame_support::pallet_prelude::{Decode, DispatchResult, Encode};
use sp_arithmetic::per_things::Percent;
use sp_std::collections::btree_map::BTreeMap;

Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/src/step.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;
use crate::math::*;
use frame_support::storage::{with_storage_layer, IterableStorageDoubleMap};
use frame_support::storage::with_storage_layer;
use sp_arithmetic::per_things::Percent;
use sp_std::vec;
use substrate_fixed::types::{I110F18, I32F32, I64F64};
Expand Down
8 changes: 4 additions & 4 deletions pallets/subspace/src/step/yuma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ impl<T: Config> Pallet<T> {
let mut weights_sparse: Vec<Vec<(u16, I32F32)>> = vec![vec![]; n + 1];

for (uid, weights) in Weights::<T>::iter_prefix(netuid) {
if *uid >= n as u16 {
if uid >= n as u16 {
continue;
}

weights_sparse[uid] = weights
weights_sparse[uid as usize] = weights
.iter()
.filter(|(uid_j, _)| *uid_j < n as u16)
.map(|(uid_j, weight_ij)| (*uid_j, I32F32::from_num(*weight_ij)))
Expand All @@ -678,11 +678,11 @@ impl<T: Config> Pallet<T> {
let mut bonds_sparse: Vec<Vec<(u16, I32F32)>> = vec![vec![]; n + 1];

for (uid, bonds) in Weights::<T>::iter_prefix(netuid) {
if *uid >= n as u16 {
if uid >= n as u16 {
continue;
}

bonds_sparse[uid] = bonds
bonds_sparse[uid as usize] = bonds
.iter()
.map(|(uid_j, bonds_ij)| (*uid_j, I32F32::from_num(*bonds_ij)))
.collect();
Expand Down

0 comments on commit 9edd525

Please sign in to comment.