subtensor
subtensor copied to clipboard
Incorrect placement of Rustdoc comments on storage variables
A LOT of Rustdoc comments on storage variables have incorrect positioning which means external tooling that read the node's metadata has no access to these comments.
Here's a real example straight from the codebase:
// ❌ Example of incorrect Rustdoc
#[pallet::storage] // --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity.
pub type SubnetAlphaInProvided<T: Config> =
StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha<T>>;
// ✅ Example of correct Rustdoc
#[pallet::storage]
/// --- MAP ( netuid ) --> alpha_supply_in_subnet | Returns the amount of alpha in the subnet.
pub type SubnetAlphaOut<T: Config> =
StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha<T>>;
Why it matters? Because correctly placed Rustdoc comments greatly improve the DX of working with Bittensor. Here's an example how the above storage variables look like after types generation in TypeScript:
I agree with you. I use the polkadot api, the doc is missing or wrong for some storage. will create a PR to fix it.