-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Labels
red teamfeature development, etcfeature development, etc
Description
Description
We aim to fully integrate the functionality for delegates to set and adjust their take values per subnet, including the ability to increase or decrease these values. This involves updating the do_become_delegate function, modifying the existing DelegateInfo struct to include subnet-specific take values, and ensuring that delegates can dynamically adjust their take values for specific subnets.
By providing delegates with the flexibility to manage their take values on a per-subnet basis, we enable them to tailor their participation and rewards strategy according to their preferences and the unique characteristics of each subnet.
Acceptance Criteria
- The
DelegateInfostruct should be modified to include a new fieldsubnet_takesof typeVec<(Compact<u16>, Compact<u16>)>to store subnet-specific take values. - The
do_become_delegatefunction should be updated to accept a list of subnet IDs and their corresponding take values, allowing delegates to set initial take values for multiple subnets upon becoming a delegate. - A storage migration should be implemented to handle the addition of the
subnet_takesfield to theDelegateInfostruct, ensuring a smooth transition for existing delegates. - The
do_increase_takeanddo_decrease_takefunctions should be adjusted to handle subnet-specific take adjustments, ensuring that increases or decreases are performed within the constraints of the system's rules. - Proper validation should be in place to ensure that the specified subnets exist and that the new take values adhere to the system's constraints.
- The updated functionality should be thoroughly tested to verify that delegates can successfully set and adjust their take values per subnet, and that the changes are accurately reflected in the storage and overall system behavior.
Tasks
- Modify the
DelegateInfostruct inlib.rsto include thesubnet_takesfield.
#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)]
pub struct DelegateInfo<T: Config> {
// ...
subnet_takes: Vec<(Compact<u16>, Compact<u16>)>, // New field: Vec of (subnet ID, take value)
}- Implement a storage migration to handle the addition of the
subnet_takesfield to theDelegateInfostruct. - Update the
do_become_delegatefunction instaking.rsto accept a list of subnet IDs and their corresponding take values.
// Update the do_become_delegate function
pub fn do_become_delegate(
origin: T::RuntimeOrigin,
hotkey: T::AccountId,
subnet_takes: Vec<(u16, u16)>,
) -> dispatch::DispatchResult {
// ...
let mut delegate_info = DelegateInfo {
// ...
subnet_takes: subnet_takes.iter().map(|(id, take)| (Compact(*id), Compact(*take))).collect(),
};
// ...
}- Modify the
do_increase_takefunction instaking.rsto handle subnet-specific take increases. - Modify the
do_decrease_takefunction instaking.rsto handle subnet-specific take decreases.
Related Links
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
red teamfeature development, etcfeature development, etc