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

[SDK] Get rid of py-substrate-interface (DO NOT MERGE) #2565

Conversation

roman-opentensor
Copy link
Contributor

@roman-opentensor roman-opentensor commented Jan 3, 2025

Context:

The ultimate goal is to focus on async development and no longer depend on the outdated py-substrate-interface library.

At the same time, at least temporarily, we need to maintain backward compatibility with the current implementation of Bittensor SDK. After merging this PR, we will not have to support 2 versions of the code. It will be enough to implement new functions in the asynchronous version and use a wrapper for a sync calls.

Advantages:

  • Only asynchronous code needs to be supported
  • Easy to understand codebase for community developers
  • Possibility of simple deprecation marking for sync method/function calls (without affecting the async ones)
  • Support for backward compatibility

AC:

  • Implement coroutine executor
  • Match list of methods of Subtensor and AsyncSubtensor classes
  • Keep backwards compatibility for sync codebase
  • Use wrapper calls for Subtensor and sync extrinsics
  • Add bittensor.core.chain_data.WeightCommitInfo class for CRv3 data
  • Separate the Sabtenso and AsyncSabtensor modules into logical blocks and place the methods in alphabetical order (for the convenience of developers using SDK)
  • Implement an async Metagraph with the ability to use it in synchronous code
  • Update return object for following methods (make backwards compatible with sync methods):
    • query_constant
    • query_map
    • query_map_subtensor
    • query_module;
    • query_runtime_api
    • query_subtensor
    • state_call
  • Add test to compare sync and async Subtensor methods
  • Add/Fix/edit/update existed tests:
    • Unit tests
    • Integration tests
    • e2e tests
  • Test the functionality on a testnet with a full cycle of operations

Related links:

NOTE: This description could be updated

@thewhaleking thewhaleking marked this pull request as ready for review January 8, 2025 18:37
@thewhaleking thewhaleking requested a review from a team January 8, 2025 18:37
@roman-opentensor roman-opentensor changed the title [SDK] Get rid of py-substrate-interface (WIP) [SDK] Get rid of py-substrate-interface (DO NOT MERGE) Jan 8, 2025
Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment that I'm not so sure about. Other than that, LGTM.

bittensor/utils/substrate_interface.py Outdated Show resolved Hide resolved
@thewhaleking thewhaleking merged commit af6396d into feat/thewhaleking/new-sync-substrate Jan 8, 2025
2 of 5 checks passed
@thewhaleking thewhaleking deleted the feat/roman/async-to-sync-via-wrapper branch January 8, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants