Auto CK root validators on subnet registration. #2503
Auto CK root validators on subnet registration. #2503shamil-gadelshin wants to merge 5 commits intodevnet-readyfrom
Conversation
2113e28 to
8b25e71
Compare
evgeny-s
left a comment
There was a problem hiding this comment.
The implementation looks good, but the fact that we add subnet hotkey to all the root validators as a child without them knowing this not good, I think.
I think we might consider more options.
- We do it on subnet registration, but for a short period of time (N days)
- We require validator hotkey owners to confirm it during this period, otherwise it will be reverted back.
Another option for to providing the emission flow to the subnet, maybe it can be dedicated from the protocol, instead of using validators stake.
TDB
| // Cannot set children on root network itself. | ||
| ensure!( | ||
| !netuid.is_root(), | ||
| Error::<T>::RegistrationNotPermittedOnRootSubnet |
There was a problem hiding this comment.
need a different error type.
There was a problem hiding this comment.
Seems close enough. Also, I don't expect errors here at all because it's called only during subnet registration with concrete netuid. What do you suggest instead?
|
|
||
| // Get the subnet owner hotkey. | ||
| let subnet_owner_hotkey = | ||
| SubnetOwnerHotkey::<T>::try_get(netuid).map_err(|_| Error::<T>::SubnetNotExists)?; |
There was a problem hiding this comment.
need a different error type.
There was a problem hiding this comment.
Do we have a better one? It seems appropriate. We don't have subnet owner hotkey only when it doesn't exist. What do you suggest?
Summary
do_set_root_validators_for_subnetfunction that automatically establishes parent-child relationships between all root network validators and a subnet owner's hotkey, enabling the subnet owner to inherit stake from rootvalidators and meet the
StakeThresholdrequired to callset_weightsdo_register_networkso relationships are scheduled automatically at subnet creation timedo_schedule_childrenflow (withPendingChildKeyscooldown)New tests
test_root_children_enable_subnet_owner_set_weights— verifies the function directly: subnet owner cannot set weights before, then can after root validator children are activatedtest_register_network_schedules_root_validators— verifies end-to-end from register_network: pending children are automatically scheduled during subnet registration, activate after cooldown, and the subnet owner can then set weightsvia inherited stake