Voluntary deregistration
Description
This PR introduces the entire voluntary-deregistration feature set for subnets. We now track subnets that wish to be pruned via a dedicated SubnetDeregistrationPriorityQueue, before using the old immunity/price pruning flow. Subnet owners (or root) can call schedule_deregistration_priority, which creates a timed entry using a configurable DeregistrationPriorityScheduleDelay. Once the (~5 day) delay elapses, the scheduler enqueues the subnet for deregistration, firing SubnetDeregistrationPriorityQueueAdded event, and from this point get_network_to_prune will prefer these queued subnets over price-based candidates—even during immunity.
A new helper module encapsulates the lifecycle: scheduling, enqueueing, canceling, clearing, and forcing entries—while the public extrinsics (schedule_deregistration_priority, cancel_deregistration_priority_schedules, enqueue_subnet_deregistration, clear_deregistration_priority) simply perform origin checks and delegate. Dissolution automatically removes any queue/schedule remnants so newly registered subnets never inherit stale priority. Root can adjust the delay via the new sudo_set_deregistration_priority_schedule_delay and all runtimes/mocks/benchmarks now provide and exercise this constant.
Events were implemented (SubnetDeregistrationPriorityScheduleAdded/Removed, …QueueAdded/Removed, DeregistrationPriorityScheduleDelaySet) to reflect the queue-centric design, and there is a new cradle-to-grave test (schedule_priority_full_lifecycle_to_dissolution) that schedules a subnet for deregistration, simulates the scheduler firing, confirms pruning behavior and dissolves the subnet while asserting each event fires at the right time.
Checklist
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have run
./scripts/fix_rust.shto ensure my code is formatted and linted correctly - [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
Looks good. Need to fix CI
I fixed most stuff, but I'm still working on it
This is being shelved, lets reopen it if we want it again and not clutter the queue until now