Skip to content

Commit e557c59

Browse files
author
Roman
committed
Merge branch 'staging' into feat/roman/selective_metagraph_back
2 parents 6eca45f + 6950464 commit e557c59

File tree

20 files changed

+403
-56
lines changed

20 files changed

+403
-56
lines changed

.github/PULL_REQUEST_TEMPLATE/bug_fix.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ Examples:
5656
- Fixed an issue where multiple cursors did not work in a file with a single line.
5757
- Increased the performance of searching and replacing across a whole project.
5858
59-
-->
59+
-->
60+
61+
62+
### Branch Acknowledgement
63+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/PULL_REQUEST_TEMPLATE/feature_change.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,8 @@ Examples:
5151
- Fixed an issue where multiple cursors did not work in a file with a single line.
5252
- Increased the performance of searching and replacing across a whole project.
5353
54-
-->
54+
-->
55+
56+
57+
### Branch Acknowledgement
58+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/PULL_REQUEST_TEMPLATE/performance_improvement.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ Examples:
5252
- Fixed an issue where multiple cursors did not work in a file with a single line.
5353
- Increased the performance of searching and replacing across a whole project.
5454
55-
-->
55+
-->
56+
57+
58+
### Branch Acknowledgement
59+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ please switch to **Preview** for links to render properly.
55

66
Please choose the right template for your pull request:
77

8-
- 🐛 Are you fixing a bug? [Bug fix](?template=bug_fix.md)
9-
- 📈 Are you improving performance? [Performance improvement](?template=performance_improvement.md)
10-
- 💻 Are you changing functionality? [Feature change](?template=feature_change.md)
8+
- 🐛 Are you fixing a bug? [Bug fix](?expand=1&template=bug_fix.md)
9+
- 📈 Are you improving performance? [Performance improvement](?expand=1&template=performance_improvement.md)
10+
- 💻 Are you changing functionality? [Feature change](?expand=1&template=feature_change.md)

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,31 @@ jobs:
128128
fi
129129
done
130130
131+
# run non-fast-blocks only on Saturday and by cron schedule
132+
check-if-saturday:
133+
if: github.event_name == 'schedule'
134+
runs-on: ubuntu-latest
135+
outputs:
136+
is-saturday: ${{ steps.check.outputs.is-saturday }}
137+
steps:
138+
- id: check
139+
run: |
140+
day=$(date -u +%u)
141+
echo "Today is weekday $day"
142+
if [ "$day" -ne 6 ]; then
143+
echo "⏭️ Skipping: not Saturday"
144+
echo "is-saturday=false" >> "$GITHUB_OUTPUT"
145+
exit 0
146+
fi
147+
echo "is-saturday=true"
148+
echo "is-saturday=true" >> "$GITHUB_OUTPUT"
149+
131150
132151
cron-run-non-fast-blocks-e2e-test:
133-
if: github.event_name == 'schedule'
152+
if: github.event_name == 'schedule' && needs.check-if-saturday.outputs.is-saturday == 'true'
134153
name: "NFB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
135154
needs:
155+
- check-if-saturday
136156
- find-tests
137157
- pull-docker-image
138158
runs-on: ubuntu-latest
@@ -148,14 +168,6 @@ jobs:
148168
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
149169

150170
steps:
151-
- name: Check if today is Saturday
152-
run: |
153-
day=$(date -u +%u)
154-
echo "Today is weekday $day"
155-
if [ "$day" -ne 6 ]; then
156-
echo "⏭️ Skipping: not Saturday"
157-
exit 78
158-
fi
159171
- name: Check-out repository
160172
uses: actions/checkout@v4
161173

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 9.7.0 /2025-05-29
4+
5+
## What's Changed
6+
* Add `get_subnet_info` by @basfroman in https://github.com/opentensor/bittensor/pull/2894
7+
* Fix bug in `get_next_epoch_start_block` by @basfroman in https://github.com/opentensor/bittensor/pull/2899
8+
* e2e workflow: improve skipping logic (no error when skip the job) by @basfroman in https://github.com/opentensor/bittensor/pull/2898
9+
* Replace `transfer_allow_death` with `transfer_keep_alive` by @basfroman in https://github.com/opentensor/bittensor/pull/2900
10+
* Fix broken pull request template links (#2867) by @AgSpades in https://github.com/opentensor/bittensor/pull/2883
11+
* update pr templates with branch ack by @thewhaleking in https://github.com/opentensor/bittensor/pull/2903
12+
13+
## New Contributors
14+
* @AgSpades made their first contribution in https://github.com/opentensor/bittensor/pull/2883
15+
16+
**Full Changelog**: https://github.com/opentensor/bittensor/compare/v9.6.1...v9.7.0
17+
318
## 9.6.1 /2025-05-22
419

520
## What's Changed

bittensor/core/async_subtensor.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,47 @@ async def get_block_hash(self, block: Optional[int] = None) -> str:
974974
else:
975975
return await self.substrate.get_chain_head()
976976

977+
async def get_parents(
978+
self,
979+
hotkey: str,
980+
netuid: int,
981+
block: Optional[int] = None,
982+
block_hash: Optional[str] = None,
983+
reuse_block: bool = False,
984+
) -> list[tuple[float, str]]:
985+
"""
986+
This method retrieves the parent of a given hotkey and netuid. It queries the SubtensorModule's ParentKeys
987+
storage function to get the children and formats them before returning as a tuple.
988+
989+
Arguments:
990+
hotkey: The child hotkey SS58.
991+
netuid: The netuid value.
992+
block: The block number for which the children are to be retrieved.
993+
block_hash: The hash of the block to retrieve the subnet unique identifiers from.
994+
reuse_block: Whether to reuse the last-used block hash.
995+
996+
Returns:
997+
A list of formatted parents [(proportion, parent)]
998+
"""
999+
block_hash = await self.determine_block_hash(block, block_hash, reuse_block)
1000+
parents = await self.substrate.query(
1001+
module="SubtensorModule",
1002+
storage_function="ParentKeys",
1003+
params=[hotkey, netuid],
1004+
block_hash=block_hash,
1005+
reuse_block_hash=reuse_block,
1006+
)
1007+
if parents:
1008+
formatted_parents = []
1009+
for proportion, parent in parents.value:
1010+
# Convert U64 to int
1011+
formatted_child = decode_account_id(parent[0])
1012+
normalized_proportion = u64_normalized_float(proportion)
1013+
formatted_parents.append((normalized_proportion, formatted_child))
1014+
return formatted_parents
1015+
1016+
return []
1017+
9771018
async def get_children(
9781019
self,
9791020
hotkey: str,
@@ -2358,7 +2399,7 @@ async def get_transfer_fee(
23582399

23592400
call = await self.substrate.compose_call(
23602401
call_module="Balances",
2361-
call_function="transfer_allow_death",
2402+
call_function="transfer_keep_alive",
23622403
call_params={"dest": dest, "value": value.rao},
23632404
)
23642405

bittensor/core/extrinsics/asyncex/transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def _do_transfer(
4545
"""
4646
call = await subtensor.substrate.compose_call(
4747
call_module="Balances",
48-
call_function="transfer_allow_death",
48+
call_function="transfer_keep_alive",
4949
call_params={"dest": destination, "value": amount.rao},
5050
)
5151

bittensor/core/extrinsics/transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _do_transfer(
4444
"""
4545
call = subtensor.substrate.compose_call(
4646
call_module="Balances",
47-
call_function="transfer_allow_death",
47+
call_function="transfer_keep_alive",
4848
call_params={"dest": destination, "value": amount.rao},
4949
)
5050

bittensor/core/subtensor.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,38 @@ def get_hyperparameter(
752752

753753
return getattr(result, "value", result)
754754

755+
def get_parents(
756+
self, hotkey: str, netuid: int, block: Optional[int] = None
757+
) -> list[tuple[float, str]]:
758+
"""
759+
This method retrieves the parent of a given hotkey and netuid. It queries the SubtensorModule's ParentKeys
760+
storage function to get the children and formats them before returning as a tuple.
761+
762+
Arguments:
763+
hotkey: The child hotkey SS58.
764+
netuid: The netuid.
765+
block: The block number for which the children are to be retrieved.
766+
767+
Returns:
768+
A list of formatted parents [(proportion, parent)]
769+
"""
770+
parents = self.substrate.query(
771+
module="SubtensorModule",
772+
storage_function="ParentKeys",
773+
params=[hotkey, netuid],
774+
block_hash=self.determine_block_hash(block),
775+
)
776+
if parents:
777+
formatted_parents = []
778+
for proportion, parent in parents.value:
779+
# Convert U64 to int
780+
formatted_child = decode_account_id(parent[0])
781+
normalized_proportion = u64_normalized_float(proportion)
782+
formatted_parents.append((normalized_proportion, formatted_child))
783+
return formatted_parents
784+
785+
return []
786+
755787
def get_children(
756788
self, hotkey: str, netuid: int, block: Optional[int] = None
757789
) -> tuple[bool, list[tuple[float, str]], str]:
@@ -1871,7 +1903,7 @@ def get_transfer_fee(self, wallet: "Wallet", dest: str, value: Balance) -> Balan
18711903
value = check_and_convert_to_balance(value)
18721904
call = self.substrate.compose_call(
18731905
call_module="Balances",
1874-
call_function="transfer_allow_death",
1906+
call_function="transfer_keep_alive",
18751907
call_params={"dest": dest, "value": value.rao},
18761908
)
18771909

0 commit comments

Comments
 (0)