From 1f9127ffeb7fb06f392b7ef95749a569e7db1c64 Mon Sep 17 00:00:00 2001 From: ArtificialXai Date: Mon, 20 Apr 2026 03:42:32 -0400 Subject: [PATCH] docs(subtensor): fix stale faucet() docstring + remove dead cfg branch Closes #2591. The `faucet()` dispatchable in `pallets/subtensor/src/macros/dispatches.rs` carries a docstring that states: /// Just deployed in testnet and devnet for testing purpose This is no longer accurate. The call is gated behind `#[cfg(feature = "pow-faucet")]`, and the `pow-faucet` feature is only enabled in the `local_builder` Docker stage (`Dockerfile` L86). The public testnet and devnet runtimes are built without that feature, so the dispatchable is genuinely absent from the on-chain `Call` enum on both networks. Downstream tooling that trusts the docstring builds a working PoW pipeline only to fail at submission time with a `pallet-call-not-found` error (the issue cites a concrete instance in `ErgodicLabs/btt` where the faucet command had to be reverted after the docstring sent reviewers in the wrong direction). Replaces the docstring with an accurate description of when the call is compiled in, and explicitly notes that the public testnet/devnet images do not include it. While here, remove the `if cfg!(feature = "pow-faucet") { ... } else { Err(FaucetDisabled) }` wrapper inside the function body: the function is already `#[cfg(feature = "pow-faucet")]` at the item level, so the `cfg!` check is unconditionally true and the `Err` arm is unreachable. `FaucetDisabled` remains defined in `Error` for backward-compatible error handling (also referenced in a commented-out guard in `subnets/registration.rs`). No behavioral change: builds without `pow-faucet` are unaffected (the dispatchable does not exist in the `Call` enum); builds with the feature flag behave identically since the only reachable path was always `Self::do_faucet(...)`. The `pallet::call_index(60)` and weight attribute are preserved, so on-chain extrinsic compatibility is unchanged. --- pallets/subtensor/src/macros/dispatches.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index cc5b16ca7f..c36a677802 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -1253,9 +1253,14 @@ mod dispatches { Self::do_register_network(origin, &hotkey, 1, None) } - /// Facility extrinsic for user to get taken from faucet - /// It is only available when pow-faucet feature enabled - /// Just deployed in testnet and devnet for testing purpose + /// Facility extrinsic to acquire TAO from a proof-of-work faucet. + /// + /// Only compiled into runtimes built with `--features pow-faucet`. The + /// production testnet and devnet images are built without this feature + /// (see the `Dockerfile` — only the `local_builder` stage enables it), + /// so this dispatchable is absent from the on-chain `Call` enum on the + /// deployed public networks and is intended for local development + /// runtimes only. #[pallet::call_index(60)] #[pallet::weight((Weight::from_parts(91_000_000, 0) .saturating_add(T::DbWeight::get().reads(27)) @@ -1267,11 +1272,7 @@ mod dispatches { nonce: u64, work: Vec, ) -> DispatchResult { - if cfg!(feature = "pow-faucet") { - return Self::do_faucet(origin, block_number, nonce, work); - } - - Err(Error::::FaucetDisabled.into()) + Self::do_faucet(origin, block_number, nonce, work) } /// Remove a user's subnetwork