Skip to content

Commit ecd8157

Browse files
committed
Remove orphaned Senate/Triumvirate dead code
The senate/Triumvirate pallet was removed from the subtensor runtime, but the Python SDK still contained orphaned code querying it. - Remove get_vote_data() from sync and async subtensor clients - Delete ProposalVoteData dataclass and its module - Remove get_vote_data from Chain API wrapper - Remove all public exports of ProposalVoteData - Remove unit tests for the dead method - Remove commented-out senate e2e tests and dead imports - Remove orphaned propose/vote test helpers Fixes #3282
1 parent 9c97f2f commit ecd8157

File tree

9 files changed

+0
-499
lines changed

9 files changed

+0
-499
lines changed

bittensor/core/async_subtensor.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
MetagraphInfo,
2626
NeuronInfo,
2727
NeuronInfoLite,
28-
ProposalVoteData,
2928
ProxyAnnouncementInfo,
3029
ProxyConstants,
3130
ProxyInfo,
@@ -4957,47 +4956,6 @@ async def get_unstake_fee(
49574956
)
49584957
return sim_swap_result.alpha_fee.set_unit(netuid=netuid)
49594958

4960-
async def get_vote_data(
4961-
self,
4962-
proposal_hash: str,
4963-
block: Optional[int] = None,
4964-
block_hash: Optional[str] = None,
4965-
reuse_block: bool = False,
4966-
) -> Optional["ProposalVoteData"]:
4967-
# TODO: is this all deprecated? Didn't subtensor senate stuff get removed?
4968-
"""
4969-
Retrieves the voting data for a specific proposal on the Bittensor blockchain. This data includes information
4970-
about how senate members have voted on the proposal.
4971-
4972-
Parameters:
4973-
proposal_hash: The hash of the proposal for which voting data is requested.
4974-
block: The blockchain block number for the query.
4975-
block_hash: The hash of the blockchain block number to query the voting data.
4976-
reuse_block: Whether to reuse the last-used blockchain block hash.
4977-
4978-
Returns:
4979-
An object containing the proposal's voting data, or `None` if not found.
4980-
4981-
This function is important for tracking and understanding the decision-making processes within the Bittensor
4982-
network, particularly how proposals are received and acted upon by the governing body.
4983-
"""
4984-
block_hash = await self.determine_block_hash(block, block_hash, reuse_block)
4985-
vote_data = cast(
4986-
Optional[dict[str, Any]],
4987-
await self.substrate.query(
4988-
module="Triumvirate",
4989-
storage_function="Voting",
4990-
params=[proposal_hash],
4991-
block_hash=block_hash,
4992-
reuse_block_hash=reuse_block,
4993-
),
4994-
)
4995-
4996-
if vote_data is None:
4997-
return None
4998-
4999-
return ProposalVoteData.from_dict(vote_data)
5000-
50014959
async def get_uid_for_hotkey_on_subnet(
50024960
self,
50034961
hotkey_ss58: str,

bittensor/core/chain_data/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from .neuron_info import NeuronInfo
2828
from .neuron_info_lite import NeuronInfoLite
2929
from .prometheus_info import PrometheusInfo
30-
from .proposal_vote_data import ProposalVoteData
3130
from .proxy import ProxyAnnouncementInfo, ProxyConstants, ProxyInfo, ProxyType
3231
from .root_claim import RootClaimType
3332
from .scheduled_coldkey_swap_info import ScheduledColdkeySwapInfo
@@ -63,7 +62,6 @@
6362
"NeuronInfoLite",
6463
"PrometheusInfo",
6564
"ProposalCallData",
66-
"ProposalVoteData",
6765
"ProxyConstants",
6866
"ProxyAnnouncementInfo",
6967
"ProxyInfo",

bittensor/core/chain_data/proposal_vote_data.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

bittensor/core/subtensor.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
MetagraphInfo,
2626
NeuronInfo,
2727
NeuronInfoLite,
28-
ProposalVoteData,
2928
ProxyAnnouncementInfo,
3029
ProxyConstants,
3130
ProxyInfo,
@@ -4045,39 +4044,6 @@ def get_unstake_fee(
40454044
)
40464045
return sim_swap_result.alpha_fee.set_unit(netuid=netuid)
40474046

4048-
def get_vote_data(
4049-
self, proposal_hash: str, block: Optional[int] = None
4050-
) -> Optional["ProposalVoteData"]:
4051-
# TODO: is this all deprecated? Didn't subtensor senate stuff get removed?
4052-
"""
4053-
Retrieves the voting data for a specific proposal on the Bittensor blockchain. This data includes information
4054-
about how senate members have voted on the proposal.
4055-
4056-
Parameters:
4057-
proposal_hash: The hash of the proposal for which voting data is requested.
4058-
block: The blockchain block number for the query. If `None`, queries the current chain head.
4059-
4060-
Returns:
4061-
An object containing the proposal's voting data, or `None` if not found.
4062-
4063-
This function is important for tracking and understanding the decision-making processes within the Bittensor
4064-
network, particularly how proposals are received and acted upon by the governing body.
4065-
"""
4066-
vote_data = cast(
4067-
Optional[dict[str, Any]],
4068-
self.substrate.query(
4069-
module="Triumvirate",
4070-
storage_function="Voting",
4071-
params=[proposal_hash],
4072-
block_hash=self.determine_block_hash(block),
4073-
),
4074-
)
4075-
4076-
if vote_data is None:
4077-
return None
4078-
4079-
return ProposalVoteData.from_dict(vote_data)
4080-
40814047
def get_uid_for_hotkey_on_subnet(
40824048
self, hotkey_ss58: str, netuid: int, block: Optional[int] = None
40834049
) -> Optional[int]:

bittensor/extras/subtensor_api/chain.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def __init__(self, subtensor: Union["_Subtensor", "_AsyncSubtensor"]):
1616
self.get_minimum_required_stake = subtensor.get_minimum_required_stake
1717
self.get_start_call_delay = subtensor.get_start_call_delay
1818
self.get_timestamp = subtensor.get_timestamp
19-
self.get_vote_data = subtensor.get_vote_data
2019
self.is_fast_blocks = subtensor.is_fast_blocks
2120
self.is_in_admin_freeze_window = subtensor.is_in_admin_freeze_window
2221
self.last_drand_round = subtensor.last_drand_round

bittensor/utils/easy_imports.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
ProxyType,
5454
PrometheusInfo,
5555
ProposalCallData,
56-
ProposalVoteData,
5756
ScheduledColdkeySwapInfo,
5857
SelectiveMetagraphIndex,
5958
StakeInfo,
@@ -167,7 +166,6 @@
167166
"NeuronInfoLite",
168167
"PrometheusInfo",
169168
"ProposalCallData",
170-
"ProposalVoteData",
171169
"ScheduledColdkeySwapInfo",
172170
"SelectiveMetagraphIndex",
173171
"StakeInfo",

0 commit comments

Comments
 (0)