Skip to content

Official agent-miner image (bittensor==9.9.0) can't talk to the live chain — NetUid encoding mismatch #18

Description

@davion-knight

Summary

The published redteamsubnet61/agent-miner:3.1.8-260713 image (currently the latest tag) pins bittensor==9.9.0 via redteam_core@4.7.4's requirements.txt. That version can't correctly encode netuid for the current live subtensor chain's runtime metadata, so the miner crashes on startup, every time, for any miner:

ValueError: Invalid type for data: 61 of type <class 'int'>, type_def: Composite(TypeDefComposite { fields: [Field { name: None, ty: UntrackedSymbol { id: 42, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("u16"), docs: [] }] })

Reproduced directly via:

import bittensor as bt
st = bt.Subtensor(network="finney")
st.neurons_lite(netuid=61)  # <- raises the above

bittensor==9.9.0's neurons_lite() passes netuid as a bare int (params=[netuid]), but the live chain's runtime metadata now expects it as a Composite-wrapped NetUid type, not a raw u16. This is a client/chain version-skew bug, not a config issue — happens with a completely default .env/wallet setup.

This is very likely why the dependabot PRs attempting to bump bittensor (#111 → ~=10.2.0, #102 → ~=10.1.0, #96 → ~=10.0.1, all in RedTeamSubnet/RedTeam) were closed unmerged — see the fix section below for why a naive version bump doesn't work cleanly.

Verified fix

Confirmed working end-to-end (metagraph syncs, agent correctly self-identifies its UID, reaches full startup) by upgrading three packages together and patching four renamed API calls:

  1. bittensor==10.5.0 (latest at time of writing) — required to encode NetUid correctly for the current chain
  2. Its natural transitive deps: async-substrate-interface==2.2.1, bittensor-drand==2.0.0
  3. A scalecodec/cyscale namespace clash this produces, fixed by uninstalling both and reinstalling only cyscale fresh
  4. bittensor 10.x renamed core classes lowercase→PascalCase with identical constructor kwargs (config=, wallet=, port=), so src/miner/_base.py needs:
    • bt.wallet(bt.Wallet(
    • bt.subtensor(bt.Subtensor(
    • bt.dendrite(bt.Dendrite(
    • bt.axon(bt.Axon(

This is likely the real reason the earlier bittensor-bump PRs stalled — a plain requirements.txt version bump alone isn't sufficient; it also needs the four renamed calls in _base.py (and presumably similar renames in the validator repo) fixed, plus the scalecodec/cyscale conflict resolved.

Local patch Dockerfile (extends the published image, no source changes needed to verify):

FROM redteamsubnet61/agent-miner:3.1.8-260713

RUN pip install --no-cache-dir "bittensor==10.5.0" && \
    pip uninstall -y scalecodec cyscale && \
    pip install --no-cache-dir cyscale

RUN sed -i \
    -e 's/bt\.wallet(/bt.Wallet(/' \
    -e 's/bt\.subtensor(/bt.Subtensor(/' \
    -e 's/bt\.dendrite(/bt.Dendrite(/' \
    -e 's/bt\.axon(/bt.Axon(/' \
    /app/agent-miner/miner/_base.py

With this, the agent gets past wallet/subtensor/dendrite/metagraph/axon setup and correctly reaches Running miner on uid: <N> — full startup, no crash.

Impact

Every miner running the current official image is affected — the container will crash-loop on startup regardless of wallet/config correctness.

Request

Could the bittensor pin in redteam_core's requirements.txt (and wherever the validator repo pins it) be bumped, along with the four renamed calls in _base.py/equivalent validator code? Happy to open a PR with this if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions