fix(staking): include netuid in ChildKeyTakeSet event#2655
Open
RUNECTZ33 wants to merge 1 commit into
Open
Conversation
`ChildkeyTake` is stored as a `StorageDoubleMap<_, hotkey, _, netuid, u16>` and the `set_childkey_take` dispatch accepts `netuid` as an argument (`do_set_childkey_take(coldkey, hotkey, netuid, take)` in `pallets/subtensor/src/staking/set_children.rs`). The emitted event, however, carried only `(hotkey, take)` — leaving off-chain consumers (block explorers, validator monitors, takes-rate trackers) unable to correlate a take change to its subnet without re-deriving from the extrinsic args. Change the event signature to `ChildKeyTakeSet(T::AccountId, NetUid, u16)` and pass the dispatch's `netuid` through at the single emission site. Mirrors PR opentensor#2614 (\"Add netuid to TransactionFeePaidWithAlpha event\") which made the same observability fix on a different event. Adds `test_set_childkey_take_event_includes_netuid` in `pallets/subtensor/src/tests/children.rs` — the event had no prior coverage. Bumps `spec_version` 406 → 407.
evgeny-s
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ChildkeyTakeis aStorageDoubleMap<_, hotkey, _, netuid, u16>— per-(hotkey, netuid). Theset_childkey_takedispatch accepts anetuidparameter:and the storage write at
set_children.rs:764uses that netuid:But the emitted event at
set_children.rs:774carries only(hotkey, take):Off-chain consumers (block explorers, validator monitors, takes-rate trackers) watching
ChildKeyTakeSethave no way to correlate a take change to its subnet without re-deriving from the extrinsic args — fragile across runtime upgrades and not available to event-only subscribers.The dispatch already has
netuidin scope, so threading it through is mechanical.Fix
Change the event signature to
ChildKeyTakeSet(T::AccountId, NetUid, u16)and passnetuidat the single emission site indo_set_childkey_take.Shape mirrors #2614 ("Add netuid to TransactionFeePaidWithAlpha event") which made the same observability fix on a different event.
Bumps
spec_version406 → 407.Tests
Adds
test_set_childkey_take_event_includes_netuidinpallets/subtensor/src/tests/children.rs. The event had no prior coverage (grepon the test tree returned no hits forChildKeyTakeSet).Type of Change
Breaking Change
The event signature is extended by one positional argument. Consumers that decode events by position (Polkadot.js Apps, indexer libraries, off-chain workers) will need to update their parsers — same compatibility surface as #2614. No on-chain storage change; no migration required.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyRelated
BatchWeightItemFailedevent netuid). Each is independent in scope.