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

Fix delegate info methods to return correct values #2567

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Riccardo-RG
Copy link

@Riccardo-RG Riccardo-RG commented Jan 3, 2025

Fixes #2564

Fix the issue with bt_decode.DelegateInfo.decode_vec in bittensor/core/chain_data/delegate_info.py to handle the decoding of vec_u8 correctly.

  • Add a new method from_vec_u8 to decode vec_u8 and return a DelegateInfo object.
  • Update the list_from_vec_u8 method to correctly decode vec_u8 and return a list of DelegateInfo objects.
  • Ensure that total_daily_return and return_per_1000 are correctly decoded and returned.

Update bittensor/core/chain_data/delegate_info_lite.py to handle type conversions and ensure correct data types.

  • Add a new method from_raw_data to create a DelegateInfoLite instance from raw data with proper type conversions.
  • Ensure that registrations and validator_permits are lists of integers.
  • Ensure that take is rounded to 6 decimal places and nominators, return_per_1000, and total_daily_return are integers.

For more details, open the Copilot Workspace session.

Fixes opentensor#2564

Fix the issue with `bt_decode.DelegateInfo.decode_vec` in `bittensor/core/chain_data/delegate_info.py` to handle the decoding of `vec_u8` correctly.

* Add a new method `from_vec_u8` to decode `vec_u8` and return a `DelegateInfo` object.
* Update the `list_from_vec_u8` method to correctly decode `vec_u8` and return a list of `DelegateInfo` objects.
* Ensure that `total_daily_return` and `return_per_1000` are correctly decoded and returned.

Update `bittensor/core/chain_data/delegate_info_lite.py` to handle type conversions and ensure correct data types.

* Add a new method `from_raw_data` to create a `DelegateInfoLite` instance from raw data with proper type conversions.
* Ensure that `registrations` and `validator_permits` are lists of integers.
* Ensure that `take` is rounded to 6 decimal places and `nominators`, `return_per_1000`, and `total_daily_return` are integers.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/opentensor/bittensor/issues/2564?shareId=XXXX-XXXX-XXXX-XXXX).
@thewhaleking
Copy link
Contributor

You've got some failing tests. Please fix those and I'll have a review.

@Riccardo-RG
Copy link
Author

Sorry i hope to get more familiar with the project in the next day and to offer a valid contribution

You've got some failing tests. Please fix those and I'll have a review.

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.

Cannot get correct information for Bittensor validator
2 participants