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

Update to Rao [Do not merge] #2570

Closed
wants to merge 92 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
e46ed1b
init
ibraheem-opentensor Jan 8, 2025
3051eb9
Adds btcli + other improvements
ibraheem-opentensor Jan 8, 2025
fdf83d3
fix unit test
roman-opentensor Jan 8, 2025
074e542
fix integration tests
roman-opentensor Jan 8, 2025
1a9f9e3
updated `register_subnet`
roman-opentensor Jan 8, 2025
57c421c
add default network for subtensor
roman-opentensor Jan 8, 2025
f8d1698
add RAO_ENTRYPOINT into settings.py
roman-opentensor Jan 8, 2025
56caa1e
improve metagraph.py
roman-opentensor Jan 8, 2025
7ce2b7d
metagraph e2e
ibraheem-opentensor Jan 9, 2025
edf4b8e
ruff
roman-opentensor Jan 9, 2025
d33bed3
add deprecation for roo_set_weights
roman-opentensor Jan 9, 2025
3f35d55
update default network to `test`
roman-opentensor Jan 9, 2025
7b8b7ea
fix tests
roman-opentensor Jan 9, 2025
0efd28d
Adds more units
ibraheem-opentensor Jan 9, 2025
1b1dfad
Bumps version and changelog
ibraheem-opentensor Jan 9, 2025
c3074a1
Fix var
ibraheem-opentensor Jan 9, 2025
e4b209f
Bumps version and updates units var
ibraheem-opentensor Jan 9, 2025
dd3032a
Bumps version and changelog
ibraheem-opentensor Jan 9, 2025
f27b0f3
Bumps bittensor + version, changelog
ibraheem-opentensor Jan 9, 2025
332c2e3
Updates changelog
ibraheem-opentensor Jan 9, 2025
e988f5c
Bumps version and changelog
ibraheem-opentensor Jan 9, 2025
34ef750
Bumps version and updates changelog
ibraheem-opentensor Jan 11, 2025
3825dd5
Init changes for sdk for rao
ibraheem-opentensor Jan 14, 2025
423cfe8
Finished porting
ibraheem-opentensor Jan 14, 2025
fb34f07
fix test + ruff
roman-opentensor Jan 14, 2025
01ddfc7
Updates error message
ibraheem-opentensor Jan 14, 2025
72a0f2b
Merge pull request #2576 from opentensor/update-rao-sdk
ibraheem-opentensor Jan 14, 2025
f34c620
Bumps version and changelog
ibraheem-opentensor Jan 14, 2025
670e2a4
Updates stake_for_ck and versions
ibraheem-opentensor Jan 15, 2025
71bd6ca
Updates fetching subnet calls
ibraheem-opentensor Jan 15, 2025
3db18f3
use alpha shares for get stake on netuid
camfairchild Jan 15, 2025
bcce1cb
async functionality
Jan 15, 2025
4a4ee8c
Adds corresponding methods to sync subtensor
ibraheem-opentensor Jan 16, 2025
e6f9ec6
Remove deprecated async Substrate interface utility
roman-opentensor Jan 16, 2025
0b27a0a
fix tests
roman-opentensor Jan 16, 2025
1d67db6
should work
camfairchild Jan 16, 2025
5deb4be
Updates methods, dynamic_info, nonce
ibraheem-opentensor Jan 16, 2025
f831dae
skip e2e tests
roman-opentensor Jan 16, 2025
8f0a272
update deps
roman-opentensor Jan 16, 2025
4c26f86
fix typing
roman-opentensor Jan 16, 2025
79e4d60
add temporarily metagraph to async subtensor
roman-opentensor Jan 16, 2025
8f1341f
Bumps version for async substrate interface
ibraheem-opentensor Jan 17, 2025
bbb4a68
Bumps dependency
ibraheem-opentensor Jan 18, 2025
4a8a546
Updates DynamicInfo methods for conversions
ibraheem-opentensor Jan 21, 2025
a1712e4
Adds burned_register to AsyncSubtensor
ibraheem-opentensor Jan 21, 2025
a749d83
add new chain data classes
roman-opentensor Jan 22, 2025
cd2ee1a
update import
roman-opentensor Jan 22, 2025
7d4080a
update TYPE_REGISTRY
roman-opentensor Jan 22, 2025
e855bff
update custom_rpc_type_registry and ChainDataType
roman-opentensor Jan 22, 2025
093371e
add new sync methods
roman-opentensor Jan 22, 2025
ed4352c
add new async methods
roman-opentensor Jan 22, 2025
82f9edb
Update bittensor/core/chain_data/utils.py
roman-opentensor Jan 22, 2025
c0cd372
Bumps version and changelogh
ibraheem-opentensor Jan 22, 2025
1444ceb
fix type annotation
roman-opentensor Jan 22, 2025
11e2c69
fix type annotation
roman-opentensor Jan 22, 2025
acd464e
change the name of module
roman-opentensor Jan 22, 2025
897587a
improve `bittensor.core.chain_data.metagraph_info.MetagraphInfo.fix_d…
roman-opentensor Jan 22, 2025
2559b13
improve `bittensor.core.chain_data.metagraph_info.MetagraphInfo.fix_d…
roman-opentensor Jan 22, 2025
170867f
improve `bittensor.core.chain_data.metagraph_info.MetagraphInfo.list_…
roman-opentensor Jan 22, 2025
d6882fd
ruff
roman-opentensor Jan 22, 2025
10a5d20
Added __all__ for imports, correctly handle block in asyncsubtensor
thewhaleking Jan 22, 2025
c150eeb
add test for fixed float and comment
camfairchild Jan 22, 2025
b55795a
Merge branch 'rao' into feat/rao-alpha-shares
camfairchild Jan 22, 2025
7f7d5ac
Updates tests
ibraheem-opentensor Jan 22, 2025
d145389
Sets unit to stake balance
ibraheem-opentensor Jan 22, 2025
b76efac
Merge pull request #2581 from opentensor/feat/rao-alpha-shares
ibraheem-opentensor Jan 22, 2025
56f37de
Ports updated get_stake_for_coldkey_and_hotkey to async
ibraheem-opentensor Jan 22, 2025
15fea36
add `pow_registration_allowed` field to MetagraphInfo
roman-opentensor Jan 23, 2025
39e232a
Adds move_stake, transfer_stake, swap_stake to sync and async subtensor
ibraheem-opentensor Jan 23, 2025
1275e4c
Updates move_stake
ibraheem-opentensor Jan 23, 2025
4106622
improve `bittensor.core.chain_data.metagraph_info.MetagraphInfo.fix_d…
roman-opentensor Jan 25, 2025
7824f9b
improve `bittensor.core.chain_data.metagraph_info.MetagraphInfo.fix_d…
roman-opentensor Jan 25, 2025
b40fb7e
fix None logic
roman-opentensor Jan 27, 2025
5af312c
improve balance logic
roman-opentensor Jan 28, 2025
e87d186
add TODO
roman-opentensor Jan 28, 2025
41c3bc6
re-write MetagraphInfo.fix_decoded_values + update fields annotations
roman-opentensor Jan 28, 2025
46fb394
Merge branch 'rao' into feat/roman/rao/add-metagraph
roman-opentensor Jan 28, 2025
4a2c7b2
update helper `_tbwu`
roman-opentensor Jan 28, 2025
f24d5de
Merge remote-tracking branch 'origin/feat/roman/rao/add-metagraph' in…
roman-opentensor Jan 28, 2025
98eb7c2
add cast for mypy passing
roman-opentensor Jan 28, 2025
3309699
fix test
roman-opentensor Jan 28, 2025
0710c7d
Simplified typing.
thewhaleking Jan 28, 2025
25f9c31
rename methods
roman-opentensor Jan 28, 2025
855c84b
Merge pull request #2595 from opentensor/feat/roman/rao/add-metagraph
roman-opentensor Jan 28, 2025
6ae555b
Bumps version and changelog
ibraheem-opentensor Jan 28, 2025
05863b2
Updates rao branch
ibraheem-opentensor Feb 4, 2025
111c674
Updates ordering of type registry
ibraheem-opentensor Feb 4, 2025
68019fe
Bumps torch for testing
ibraheem-opentensor Feb 4, 2025
e56885c
Pin torch
ibraheem-opentensor Feb 4, 2025
ea5e5c4
Updates torch to 2.2.0
ibraheem-opentensor Feb 4, 2025
c40654d
Updates requirements (again) for torch
ibraheem-opentensor Feb 4, 2025
7fbe216
Updates artifacts version
ibraheem-opentensor Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
metagraph e2e
  • Loading branch information
ibraheem-opentensor committed Jan 9, 2025
commit 7ce2b7deecb1a1dc815bbb9c4f71cf1536f3b836
46 changes: 23 additions & 23 deletions tests/e2e_tests/test_metagraph.py
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ def test_metagraph(local_chain):
AssertionError: If any of the checks or verifications fail
"""
logging.console.info("Testing test_metagraph_command")
netuid = 1
netuid = 2

# Register Alice, Bob, and Dave
alice_keypair, alice_wallet = setup_wallet("//Alice")
@@ -60,15 +60,15 @@ def test_metagraph(local_chain):

# Verify subnet was created successfully
assert local_chain.query(
"SubtensorModule", "NetworksAdded", [1]
"SubtensorModule", "NetworksAdded", [2]
).serialize(), "Subnet wasn't created successfully"

# Initialize metagraph
subtensor = Subtensor(network="ws://localhost:9945")
metagraph = subtensor.metagraph(netuid=1)
metagraph = subtensor.metagraph(netuid=2)

# Assert metagraph is empty
assert len(metagraph.uids) == 0, "Metagraph is not empty"
assert len(metagraph.uids) == 1, "Metagraph is not empty"

# Register Bob to the subnet
assert subtensor.burned_register(
@@ -79,14 +79,14 @@ def test_metagraph(local_chain):
metagraph.sync(subtensor=subtensor)

# Assert metagraph has Bob neuron
assert len(metagraph.uids) == 1, "Metagraph doesn't have exactly 1 neuron"
assert len(metagraph.uids) == 2, "Metagraph doesn't have exactly 2 neurons"
assert (
metagraph.hotkeys[0] == bob_keypair.ss58_address
metagraph.hotkeys[1] == bob_keypair.ss58_address
), "Bob's hotkey doesn't match in metagraph"
assert len(metagraph.coldkeys) == 1, "Metagraph doesn't have exactly 1 coldkey"
assert metagraph.n.max() == 1, "Metagraph's max n is not 1"
assert metagraph.n.min() == 1, "Metagraph's min n is not 1"
assert len(metagraph.addresses) == 1, "Metagraph doesn't have exactly 1 address"
assert len(metagraph.coldkeys) == 2, "Metagraph doesn't have exactly 2 coldkeys"
assert metagraph.n.max() == 2, "Metagraph's max n is not 2"
assert metagraph.n.min() == 2, "Metagraph's min n is not 2"
assert len(metagraph.addresses) == 2, "Metagraph doesn't have exactly 2 addresses"

# Fetch UID of Bob
uid = subtensor.get_uid_for_hotkey_on_subnet(
@@ -104,7 +104,7 @@ def test_metagraph(local_chain):
), "Neuron info of Bob doesn't match b/w metagraph & subtensor"

# Create pre_dave metagraph for future verifications
metagraph_pre_dave = subtensor.metagraph(netuid=1)
metagraph_pre_dave = subtensor.metagraph(netuid=2)

# Register Dave as a neuron
assert subtensor.burned_register(
@@ -115,32 +115,32 @@ def test_metagraph(local_chain):

# Assert metagraph now includes Dave's neuron
assert (
len(metagraph.uids) == 2
), "Metagraph doesn't have exactly 2 neurons post Dave"
len(metagraph.uids) == 3
), "Metagraph doesn't have exactly 3 neurons post Dave"
assert (
metagraph.hotkeys[1] == dave_keypair.ss58_address
metagraph.hotkeys[2] == dave_keypair.ss58_address
), "Neuron's hotkey in metagraph doesn't match"
assert (
len(metagraph.coldkeys) == 2
), "Metagraph doesn't have exactly 2 coldkeys post Dave"
assert metagraph.n.max() == 2, "Metagraph's max n is not 2 post Dave"
assert metagraph.n.min() == 2, "Metagraph's min n is not 2 post Dave"
assert len(metagraph.addresses) == 2, "Metagraph doesn't have 2 addresses post Dave"
len(metagraph.coldkeys) == 3
), "Metagraph doesn't have exactly 3 coldkeys post Dave"
assert metagraph.n.max() == 3, "Metagraph's max n is not 3 post Dave"
assert metagraph.n.min() == 3, "Metagraph's min n is not 3 post Dave"
assert len(metagraph.addresses) == 3, "Metagraph doesn't have 3 addresses post Dave"

# Test staking with low balance
assert not add_stake(
local_chain, dave_wallet, Balance.from_tao(10_000)
local_chain, dave_wallet, Balance.from_tao(10_000), netuid=netuid
), "Low balance stake should fail"

# Add stake by Bob
assert add_stake(
local_chain, bob_wallet, Balance.from_tao(10_000)
local_chain, bob_wallet, Balance.from_tao(10_000), netuid=netuid
), "Failed to add stake for Bob"

# Assert stake is added after updating metagraph
metagraph.sync(subtensor=subtensor)
assert metagraph.neurons[0].stake == Balance.from_tao(
10_000
assert metagraph.neurons[1].stake > Balance.from_tao(
0
), "Bob's stake not updated in metagraph"

# Test the save() and load() mechanism
4 changes: 2 additions & 2 deletions tests/e2e_tests/utils/chain_interactions.py
Original file line number Diff line number Diff line change
@@ -71,15 +71,15 @@ def sudo_set_hyperparameter_values(


def add_stake(
substrate: "SubstrateInterface", wallet: "Wallet", amount: "Balance"
substrate: "SubstrateInterface", wallet: "Wallet", amount: "Balance", netuid: int
) -> bool:
"""
Adds stake to a hotkey using SubtensorModule. Mimics command of adding stake
"""
stake_call = substrate.compose_call(
call_module="SubtensorModule",
call_function="add_stake",
call_params={"hotkey": wallet.hotkey.ss58_address, "amount_staked": amount.rao},
call_params={"hotkey": wallet.hotkey.ss58_address, "amount_staked": amount.rao, "netuid": netuid},
)
extrinsic = substrate.create_signed_extrinsic(
call=stake_call, keypair=wallet.coldkey
Loading
Oops, something went wrong.