It's 419 methods in a single type. The type is bloated. Because of this it's hard to debug and navigate the code. A lot of these methods used just to access storage. Take, for example Pallet::get_active here is its code:
pub fn set_active_for_uid(netuid: u16, uid: u16, active: bool) {
let mut updated_active_vec = Self::get_active(netuid);
let Some(updated_active) = updated_active_vec.get_mut(uid as usize) else {
return;
};
*updated_active = active;
Active::<T>::insert(netuid, updated_active_vec);
}
This method can be safely removed and it's no shorter than just using the storage directly.
Describe the solution you'd like
The best way to clear everything up would be providing a script, which could analyze the usage of Pallet's methods within the codebase. rustdoc and rust-analyzer could be leveraged for this.
The getters/setters for storage, should be replaced with storage API.
Is your feature request related to a problem? Please describe.
Here is the list of methods of
Pallet
type:It's 419 methods in a single type. The type is bloated. Because of this it's hard to debug and navigate the code. A lot of these methods used just to access storage. Take, for example
Pallet::get_active
here is its code:And there is only one place where it's used:
This method can be safely removed and it's no shorter than just using the storage directly.
Describe the solution you'd like
Pallet
's methods within the codebase.rustdoc
andrust-analyzer
could be leveraged for this.Pallet
type doesn't need.Describe alternatives you've considered
No response
Additional context
No response