You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a hotkey is swapped, the children of the hotkey still see the old hotkey when they read ParentKeys storage.
Also, any inactive subnets are ignored when migrating to the new hotkey in ChildKeys, so if a subnet is inactive at the block of swap then comes back online later on, the new hotkey will have lost it's child key relationship. Not sure this is a bug with bad consequence, but stale data is left behind
To Reproduce
Neural Internet swapped their hotkey today https://taostats.io/extrinsic/4047654-0009. If you read ChildKeys and ParentKeys at blocks 4047653 and 4047654 you will see the following:
0xeaad1116568ea7eaf369b541cbfa9db7480d618c3f968b05e39e2c9ced7a0026 (old hotkey) & netuid 36 exists as a key with a child on SN 36 in ChildKeys after the swap (block 4047654).
0xeaad1116568ea7eaf369b541cbfa9db7480d618c3f968b05e39e2c9ced7a0026 (old hotkey) exists in 48 separate entries of ParentKeys after the swap (block 4047654). All 48 of it's children will no longer be paying emissions to the parent as they still have the old hotkey and will pay 0% of the old hotkeys 0% stake (as the stake was migrated in the swap).
Expected behavior
All instances of the old hotkey in ChildKeys and ParentKeys should be swapped with the new hotkey
@bdmason , the root cause is that subnet 36 doesn't exist. Is there any confusion? Are you aware of validators / miners that are still trying to operate?
@gztensor please have another read of the issue. There are 2 problems, one is that inactive subnets (eg 36) are ignored in the hotkey swap... which isn't really severe (but should probably be handled) as it just leaves stale and incorrect data on chain.
The other more severe problem is that ParentKeys isn't updated properly. There are 2 updates to ParentKeys that need to happen:
swap the hotkey where it makes up part of the storage key, the "child" here /// DMAP ( child, netuid ) --> Vec<(proportion,parent)>.
swap the hotkey where it is in the array of parents here /// DMAP ( child, netuid ) --> Vec<(proportion,parent)>.
The second update doesn't currently happen, all 48 of Neural Internet's children still see the old NeuralInternet hotkey when they read ParentKeys and try to pay their parents their share of emissions. Take a look at chain storage for ParentKeys at block 4047653 and bock 4047654. You'll see that update 1 above has been done in the swap, but not update 2.
The result is that the children will pay 0 TAO emissions to Neural Internet, as the children see the old hotkey in storage. As the stake has been migrated to the new hotkey in the swap, there's no more stake to pay emissions on.
Describe the bug
When a hotkey is swapped, the children of the hotkey still see the old hotkey when they read
ParentKeys
storage.Also, any inactive subnets are ignored when migrating to the new hotkey in
ChildKeys
, so if a subnet is inactive at the block of swap then comes back online later on, the new hotkey will have lost it's child key relationship. Not sure this is a bug with bad consequence, but stale data is left behindTo Reproduce
Neural Internet swapped their hotkey today https://taostats.io/extrinsic/4047654-0009. If you read
ChildKeys
andParentKeys
at blocks 4047653 and 4047654 you will see the following:0xeaad1116568ea7eaf369b541cbfa9db7480d618c3f968b05e39e2c9ced7a0026
(old hotkey) & netuid 36 exists as a key with a child on SN 36 inChildKeys
after the swap (block 4047654).0xeaad1116568ea7eaf369b541cbfa9db7480d618c3f968b05e39e2c9ced7a0026
(old hotkey) exists in 48 separate entries ofParentKeys
after the swap (block 4047654). All 48 of it's children will no longer be paying emissions to the parent as they still have the old hotkey and will pay 0% of the old hotkeys 0% stake (as the stake was migrated in the swap).Expected behavior
All instances of the old hotkey in
ChildKeys
andParentKeys
should be swapped with the new hotkeyScreenshots
No response
Environment
N/A I'm indexing the data
Additional context
This line causes the less severe first issue https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/swap/swap_hotkey.rs#L322 as
get_all_subnet_netuids
only returns active networks.This loop causes the more severe second issue https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/swap/swap_hotkey.rs#L333 as the
ParentKeys
storage for the children of the swapped hotkeys isn't updated.The text was updated successfully, but these errors were encountered: