Skip to content

Commit 9b8c613

Browse files
authored
Merge branch 'staging' into master
2 parents 0a3ea53 + fc7e1e0 commit 9b8c613

File tree

11 files changed

+49
-22
lines changed

11 files changed

+49
-22
lines changed

bittensor/core/async_subtensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,6 +4149,7 @@ async def set_subnet_identity(
41494149
github_repo=subnet_identity.github_repo,
41504150
subnet_contact=subnet_identity.subnet_contact,
41514151
subnet_url=subnet_identity.subnet_url,
4152+
logo_url=subnet_identity.logo_url,
41524153
discord=subnet_identity.discord,
41534154
description=subnet_identity.description,
41544155
additional=subnet_identity.additional,

bittensor/core/chain_data/dynamic_info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
9090
decoded["subnet_identity"]["subnet_contact"]
9191
).decode(),
9292
subnet_url=bytes(decoded["subnet_identity"]["subnet_url"]).decode(),
93+
logo_url=bytes(decoded["subnet_identity"]["logo_url"]).decode(),
9394
discord=bytes(decoded["subnet_identity"]["discord"]).decode(),
9495
description=bytes(decoded["subnet_identity"]["description"]).decode(),
9596
additional=bytes(decoded["subnet_identity"]["additional"]).decode(),

bittensor/core/chain_data/subnet_identity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class SubnetIdentity:
99
github_repo: str
1010
subnet_contact: str
1111
subnet_url: str
12+
logo_url: str
1213
discord: str
1314
description: str
1415
additional: str
@@ -21,6 +22,7 @@ def _from_dict(cls, decoded: dict) -> "SubnetIdentity":
2122
github_repo=decoded["github_repo"],
2223
subnet_contact=decoded["subnet_contact"],
2324
subnet_url=decoded["subnet_url"],
25+
logo_url=decoded["logo_url"],
2426
discord=decoded["discord"],
2527
description=decoded["description"],
2628
additional=decoded["additional"],

bittensor/core/extrinsics/asyncex/registration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ async def set_subnet_identity_extrinsic(
470470
github_repo: str,
471471
subnet_contact: str,
472472
subnet_url: str,
473+
logo_url: str,
473474
discord: str,
474475
description: str,
475476
additional: str,
@@ -488,6 +489,7 @@ async def set_subnet_identity_extrinsic(
488489
github_repo (str): URL of the GitHub repository related to the subnet.
489490
subnet_contact (str): Subnet's contact information, e.g., email or contact link.
490491
subnet_url (str): The URL of the subnet's primary web portal.
492+
logo_url (str): The URL of the logo's primary web portal.
491493
discord (str): Discord server or contact for the subnet.
492494
description (str): A textual description of the subnet.
493495
additional (str): Any additional metadata or information related to the subnet.
@@ -516,6 +518,7 @@ async def set_subnet_identity_extrinsic(
516518
"github_repo": github_repo,
517519
"subnet_contact": subnet_contact,
518520
"subnet_url": subnet_url,
521+
"logo_url": logo_url,
519522
"discord": discord,
520523
"description": description,
521524
"additional": additional,

bittensor/core/extrinsics/registration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ def set_subnet_identity_extrinsic(
462462
github_repo: str,
463463
subnet_contact: str,
464464
subnet_url: str,
465+
logo_url: str,
465466
discord: str,
466467
description: str,
467468
additional: str,
@@ -480,6 +481,7 @@ def set_subnet_identity_extrinsic(
480481
github_repo (str): URL of the GitHub repository related to the subnet.
481482
subnet_contact (str): Subnet's contact information, e.g., email or contact link.
482483
subnet_url (str): The URL of the subnet's primary web portal.
484+
logo_url (str): The URL of the logo's primary web portal.
483485
discord (str): Discord server or contact for the subnet.
484486
description (str): A textual description of the subnet.
485487
additional (str): Any additional metadata or information related to the subnet.
@@ -508,6 +510,7 @@ def set_subnet_identity_extrinsic(
508510
"github_repo": github_repo,
509511
"subnet_contact": subnet_contact,
510512
"subnet_url": subnet_url,
513+
"logo_url": logo_url,
511514
"discord": discord,
512515
"description": description,
513516
"additional": additional,

bittensor/core/subtensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,6 +3386,7 @@ def set_subnet_identity(
33863386
github_repo=subnet_identity.github_repo,
33873387
subnet_contact=subnet_identity.subnet_contact,
33883388
subnet_url=subnet_identity.subnet_url,
3389+
logo_url=subnet_identity.logo_url,
33893390
discord=subnet_identity.discord,
33903391
description=subnet_identity.description,
33913392
additional=subnet_identity.additional,

tests/e2e_tests/test_set_subnet_identity_extrinsic.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,24 @@ async def test_set_subnet_identity_extrinsic_happy_pass(subtensor, alice_wallet)
1818
# Verify subnet <netuid> created successfully
1919
assert subtensor.subnet_exists(netuid), "Subnet wasn't created successfully"
2020

21-
# make sure subnet_identity is empty
21+
# Make sure subnet_identity is empty
2222
assert subtensor.subnet(netuid).subnet_identity is None, (
2323
"Subnet identity should be None before set"
2424
)
2525

26-
# prepare SubnetIdentity for subnet
26+
# Prepare SubnetIdentity for subnet
2727
subnet_identity = SubnetIdentity(
2828
subnet_name="e2e test subnet",
2929
github_repo="e2e test repo",
3030
subnet_contact="e2e test contact",
3131
subnet_url="e2e test url",
32+
logo_url="e2e test logo url",
3233
discord="e2e test discord",
3334
description="e2e test description",
3435
additional="e2e test additional",
3536
)
3637

37-
# set SubnetIdentity to subnet
38+
# Set SubnetIdentity to subnet
3839
assert (
3940
subtensor.set_subnet_identity(
4041
wallet=alice_wallet,
@@ -44,7 +45,7 @@ async def test_set_subnet_identity_extrinsic_happy_pass(subtensor, alice_wallet)
4445
is True
4546
), "Set subnet identity failed"
4647

47-
# check SubnetIdentity of the subnet
48+
# Check SubnetIdentity of the subnet
4849
assert subtensor.subnet(netuid).subnet_identity == subnet_identity
4950

5051

@@ -69,31 +70,32 @@ async def test_set_subnet_identity_extrinsic_failed(
6970
"[magenta]Testing `set_subnet_identity_extrinsic` with failed result.[/magenta]"
7071
)
7172

72-
netuid = 2
73+
netuid = subtensor.get_total_subnets() # 2
7374

7475
# Register a subnet, netuid 2
7576
assert subtensor.register_subnet(alice_wallet), "Subnet wasn't created"
7677

7778
# Verify subnet <netuid> created successfully
7879
assert subtensor.subnet_exists(netuid), "Subnet wasn't created successfully"
7980

80-
# make sure subnet_identity is empty
81+
# Make sure subnet_identity is empty
8182
assert subtensor.subnet(netuid).subnet_identity is None, (
8283
"Subnet identity should be None before set"
8384
)
8485

85-
# prepare SubnetIdentity for subnet
86+
# Prepare SubnetIdentity for subnet
8687
subnet_identity = SubnetIdentity(
8788
subnet_name="e2e test subnet",
8889
github_repo="e2e test repo",
8990
subnet_contact="e2e test contact",
9091
subnet_url="e2e test url",
92+
logo_url="e2e test logo url",
9193
discord="e2e test discord",
9294
description="e2e test description",
9395
additional="e2e test additional",
9496
)
9597

96-
# set SubnetIdentity to subnet
98+
# Set SubnetIdentity to subnet with wrong wallet
9799
assert (
98100
subtensor.set_subnet_identity(
99101
wallet=bob_wallet,

tests/unit_tests/extrinsics/asyncex/test_registration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ async def test_set_subnet_identity_extrinsic_is_success(subtensor, fake_wallet,
431431
github_repo = "mock_github_repo"
432432
subnet_contact = "mock_subnet_contact"
433433
subnet_url = "mock_subnet_url"
434+
logo_url = "mock_logo_url"
434435
discord = "mock_discord"
435436
description = "mock_description"
436437
additional = "mock_additional"
@@ -452,6 +453,7 @@ async def test_set_subnet_identity_extrinsic_is_success(subtensor, fake_wallet,
452453
github_repo=github_repo,
453454
subnet_contact=subnet_contact,
454455
subnet_url=subnet_url,
456+
logo_url=logo_url,
455457
discord=discord,
456458
description=description,
457459
additional=additional,
@@ -468,6 +470,7 @@ async def test_set_subnet_identity_extrinsic_is_success(subtensor, fake_wallet,
468470
"github_repo": github_repo,
469471
"subnet_contact": subnet_contact,
470472
"subnet_url": subnet_url,
473+
"logo_url": logo_url,
471474
"discord": discord,
472475
"description": description,
473476
"additional": additional,
@@ -493,6 +496,7 @@ async def test_set_subnet_identity_extrinsic_is_failed(subtensor, fake_wallet, m
493496
github_repo = "mock_github_repo"
494497
subnet_contact = "mock_subnet_contact"
495498
subnet_url = "mock_subnet_url"
499+
logo_url = "mock_logo_url"
496500
discord = "mock_discord"
497501
description = "mock_description"
498502
additional = "mock_additional"
@@ -515,6 +519,7 @@ async def test_set_subnet_identity_extrinsic_is_failed(subtensor, fake_wallet, m
515519
github_repo=github_repo,
516520
subnet_contact=subnet_contact,
517521
subnet_url=subnet_url,
522+
logo_url=logo_url,
518523
discord=discord,
519524
description=description,
520525
additional=additional,
@@ -533,6 +538,7 @@ async def test_set_subnet_identity_extrinsic_is_failed(subtensor, fake_wallet, m
533538
"github_repo": github_repo,
534539
"subnet_contact": subnet_contact,
535540
"subnet_url": subnet_url,
541+
"logo_url": logo_url,
536542
"discord": discord,
537543
"description": description,
538544
"additional": additional,

tests/unit_tests/extrinsics/test_registration.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def test_set_subnet_identity_extrinsic_is_success(mock_subtensor, mock_wallet, m
235235
github_repo = "mock_github_repo"
236236
subnet_contact = "mock_subnet_contact"
237237
subnet_url = "mock_subnet_url"
238+
logo_url = "mock_logo_url"
238239
discord = "mock_discord"
239240
description = "mock_description"
240241
additional = "mock_additional"
@@ -253,6 +254,7 @@ def test_set_subnet_identity_extrinsic_is_success(mock_subtensor, mock_wallet, m
253254
github_repo=github_repo,
254255
subnet_contact=subnet_contact,
255256
subnet_url=subnet_url,
257+
logo_url=logo_url,
256258
discord=discord,
257259
description=description,
258260
additional=additional,
@@ -265,13 +267,14 @@ def test_set_subnet_identity_extrinsic_is_success(mock_subtensor, mock_wallet, m
265267
call_params={
266268
"hotkey": mock_wallet.hotkey.ss58_address,
267269
"netuid": netuid,
268-
"subnet_name": "mock_subnet_name",
269-
"github_repo": "mock_github_repo",
270-
"subnet_contact": "mock_subnet_contact",
271-
"subnet_url": "mock_subnet_url",
272-
"discord": "mock_discord",
273-
"description": "mock_description",
274-
"additional": "mock_additional",
270+
"subnet_name": subnet_name,
271+
"github_repo": github_repo,
272+
"subnet_contact": subnet_contact,
273+
"subnet_url": subnet_url,
274+
"logo_url": logo_url,
275+
"discord": discord,
276+
"description": description,
277+
"additional": additional,
275278
},
276279
)
277280
mocked_sign_and_send_extrinsic.assert_called_once_with(
@@ -293,6 +296,7 @@ def test_set_subnet_identity_extrinsic_is_failed(mock_subtensor, mock_wallet, mo
293296
github_repo = "mock_github_repo"
294297
subnet_contact = "mock_subnet_contact"
295298
subnet_url = "mock_subnet_url"
299+
logo_url = "mock_logo_url"
296300
discord = "mock_discord"
297301
description = "mock_description"
298302
additional = "mock_additional"
@@ -315,6 +319,7 @@ def test_set_subnet_identity_extrinsic_is_failed(mock_subtensor, mock_wallet, mo
315319
github_repo=github_repo,
316320
subnet_contact=subnet_contact,
317321
subnet_url=subnet_url,
322+
logo_url=logo_url,
318323
discord=discord,
319324
description=description,
320325
additional=additional,
@@ -327,13 +332,14 @@ def test_set_subnet_identity_extrinsic_is_failed(mock_subtensor, mock_wallet, mo
327332
call_params={
328333
"hotkey": mock_wallet.hotkey.ss58_address,
329334
"netuid": netuid,
330-
"subnet_name": "mock_subnet_name",
331-
"github_repo": "mock_github_repo",
332-
"subnet_contact": "mock_subnet_contact",
333-
"subnet_url": "mock_subnet_url",
334-
"discord": "mock_discord",
335-
"description": "mock_description",
336-
"additional": "mock_additional",
335+
"subnet_name": subnet_name,
336+
"github_repo": github_repo,
337+
"subnet_contact": subnet_contact,
338+
"subnet_url": subnet_url,
339+
"logo_url": logo_url,
340+
"discord": discord,
341+
"description": description,
342+
"additional": additional,
337343
},
338344
)
339345
mocked_sign_and_send_extrinsic.assert_called_once_with(

tests/unit_tests/test_async_subtensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,6 +3038,7 @@ async def test_set_subnet_identity(mocker, subtensor, fake_wallet):
30383038
github_repo=fake_subnet_identity.github_repo,
30393039
subnet_contact=fake_subnet_identity.subnet_contact,
30403040
subnet_url=fake_subnet_identity.subnet_url,
3041+
logo_url=fake_subnet_identity.logo_url,
30413042
discord=fake_subnet_identity.discord,
30423043
description=fake_subnet_identity.description,
30433044
additional=fake_subnet_identity.additional,

0 commit comments

Comments
 (0)