Apply tx & dispatch extensions conditionally#2812
Conversation
🚨🚨🚨 HOTFIX DETECTED 🚨🚨🚨It looks like you are trying to merge a hotfix PR into If you are trying to merge a hotfix PR, please complete the following essential steps:
If you do not complete these steps, your hotfix may be inadvertently removed in the future when branches are promoted to |
🛡️ AI Review — Skeptic (security review)VERDICT: SAFE LOW scrutiny: established contributor with repo write permission, substantial prior subtensor history, no Gittensor allowlist match; Reviewed the runtime/pallet guard changes statically. The new FindingsNo findings. ConclusionNo malicious behavior or security vulnerability found in the changed dispatch/transaction extension filtering. The direct-to- 🔍 AI Review — Auditor (domain review)VERDICT: 👍 Gittensor UNKNOWN: no allowlist hit; author has repo write permission and substantial prior subtensor history, so calibrated as an established contributor. PR body is substantive and matches the implementation. The direct Overlap check: #2745 and #2723 only overlap through common subtensor files and are not duplicate implementations of this fee/dispatch-extension change. Auto-fix status: no files modified. I attempted the required Finney spec-version query, but this sandbox could not resolve FindingsNo findings. ConclusionThe applicability predicates match the existing guard behavior, coldkey-swap remains unconditional, and the PR adds focused coverage for conditional weights. No blocking domain issue found in static review. |
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👍 |
Summary
This PR reduces the overall fee charged by the subtensor transaction extension by making most dispatch-extension weights conditional on the call they actually validate.
Previously, every transaction paid the benchmarked weight for each subtensor dispatch extension, even when the call could not be affected by that extension. This meant unrelated calls, such as staking calls, could pay for delegate-take, serving-endpoint, EVM-key-association, rate-limit, and weights checks.
The change introduces a shared
applicable_callhelper that downcasts runtime calls to subtensor calls and filters them through each guard'sapplies_topredicate. The same filter is used by:DispatchExtension::weightDispatchExtension::pre_dispatchSubtensorTransactionExtension::checkCheckColdkeySwapremains unconditional because coldkey swap state can block any signed runtime call.Changes
CheckDelegateTakeweight only forincrease_takeanddecrease_take.CheckWeightsweight only for weight commit, reveal, set, batch, and timelocked weight calls.CheckRateLimitsweight only for rate-limited weight calls andregister_network.CheckServingEndpointsweight only for axon and prometheus serving calls.CheckEvmKeyAssociationweight only forassociate_evm_key.CheckColdkeySwapcharged for all calls, since it can reject any signed call during a swap.