Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set miner/ validator cut percentage #960

Closed

Conversation

mz-Datura
Copy link

@mz-Datura mz-Datura commented Nov 12, 2024

Description

This PR implements subnet-specific cut distribution for RAO emissions.

Changes:

Localizes owner cut per subnet (netuid specific)
Implements RAO emission distribution between:
Miner cut
Validator cut
Burn cut
Ensures all cuts sum to 100% (u16::MAX) per subnet

Validation:

Added test cases to verify cut calculations
Ensures proper distribution across all subnets
Maintains total cut sum constraint (100%)
Technical Details:
Each subnet maintains independent cut values
Burn cut automatically adjusts to maintain 100% total
All arithmetic operations use safe math to prevent overflow

Testing:

Test cases verify:
Initial cut distribution
Cut modifications maintain 100% total
Subnet-specific cut independence
Proper error handling for invalid values

Related Issue(s)

  • Closes #[issue number]

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run cargo fmt and cargo clippy to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Please include any relevant screenshots or GIFs that demonstrate the changes made.

Additional Notes

Please provide any additional information or context that may be helpful for reviewers.

@mz-Datura mz-Datura changed the title Mz/feat/miner validator cut set miner/ validator cut percentage Nov 12, 2024
@surcyf123
Copy link

open this into devnet-ready @mz-Datura

@mz-Datura mz-Datura changed the base branch from main to devnet-ready November 12, 2024 18:16
pallets/subtensor/src/lib.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/lib.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/lib.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/lib.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/macros/config.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/macros/events.rs Outdated Show resolved Hide resolved
pallets/subtensor/src/utils/misc.rs Outdated Show resolved Hide resolved
runtime/src/lib.rs Outdated Show resolved Hide resolved
runtime/src/lib.rs Outdated Show resolved Hide resolved
@cuteolaf
Copy link
Contributor

cuteolaf commented Nov 12, 2024

What are the new storage items for?
Did you open this PR based on a discussion or some kind of approval from the OTF team?
The logic doesn't make much sense.

@cuteolaf
Copy link
Contributor

Could you add the required fields?
e.g. description, type of change, etc.

@mz-Datura
Copy link
Author

Could you add the required fields? e.g. description, type of change, etc.

name is correct, please don't change item name. thanks

@mz-Datura mz-Datura marked this pull request as ready for review November 13, 2024 23:22
@mz-Datura mz-Datura requested a review from unconst as a code owner November 13, 2024 23:22
@sam0x17 sam0x17 closed this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants