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

Migrate Delegate Info to onchain Indentities implimentation. #2146

Conversation

roman-opentensor
Copy link
Contributor

@roman-opentensor roman-opentensor commented Jul 18, 2024

DO NOT MERGE until migrate-delegate-identities-onchain is in the subtensor.

This PR covers the issue #2089

This functionality still doesn't exist in the subtensor.

For reproduce it on localnet use the following instruction:

  1. Launch local chain with ./scripts/localnet.sh
  2. While it is running, bump version in this line by 1 in runtime/src/lib.rs: spec_version: XXX,
  3. Build using cargo build --release
  4. Open in the browser: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9946#/extrinsics
  5. Select Alice in the account
  6. Select sudo -> sudoUncheckedWeight in the 2nd line
  7. Select system -> setCode in line 3
  8. Toggle file upload on the right
  9. Drag and drop runtime wasm file to line 4: ./target/release/wbuild/node-subtensor-runtime/target/wasm32-unknown-unknown/release/node_subtensor_runtime.wasm
  10. Submit transaction
  11. Watch node logs for message Starting migration: set hotkey identities

After these steps code will able to revoke Delegate Indentities from localnet.
NOTE: subtensor has to be created with subtensor = bittensor.subtensor(network="ws://127.0.0.1:9945"). Port could be different.

Check this code execution after steps below.

import bittensor as bt

sub = bt.subtensor(network="ws://127.0.0.1:9945")

for ss58, identity in sub.get_delegate_identities().items():
    print(f">>> {ss58}: {identity}")

@gztensor
Copy link
Contributor

It works, here are additional steps:

For running local subtensor node

The MILLISECS_PER_BLOCK constant under fast-blocks feature needs to change from 250 to 12000 before running it first time to make block time 12 seconds (otherwise runtime upgrade will fail):

/// Fast blocks for development
#[cfg(feature = "fast-blocks")]
pub const MILLISECS_PER_BLOCK: u64 = 250;

Bittensor script for testing

import bittensor as bt

sub = bt.subtensor(network="ws://127.0.0.1:9945")

for ss58, identity in sub.get_delegate_identities().items():
    print(f">>> {ss58}: {identity}")

@roman-opentensor roman-opentensor merged commit 52f0df5 into staging Sep 17, 2024
36 checks passed
@roman-opentensor roman-opentensor deleted the feature/roman/migrate-delegate-info-to-onchain-indentities branch September 17, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants