Bump bittensor stack and drop substrate-interface#1335
Conversation
|
You already have 3 open PRs in this repo. The threshold is 3, so closing this one until a maintainer can triage your existing PRs. Please don't open any more — they'll be closed too. |
|
Great. How would I know this? @anderdc |
|
fix conflicts |
anderdc
left a comment
There was a problem hiding this comment.
Two blockers before this can merge.
1. Drop the dead SS58 regex fallback (gittensor/cli/issue_commands/helpers.py:486-512).
With substrate-interface gone, bittensor_wallet is a hard pinned dep (bittensor-wallet==4.0.1) and is imported unconditionally elsewhere — module-level at gittensor/validator/issue_competitions/contract_client.py:15 and inside the register try block at gittensor/cli/issue_commands/mutations.py:178. If bittensor_wallet.utils weren't importable, the whole CLI would already be broken at module load. The except ImportError: pass branch and the regex fallback are unreachable.
Lift from bittensor_wallet.utils import is_valid_ss58_address to module level, drop the try/except + regex fallback. The function collapses to ~10 lines.
2. Restore visibility in the register error path (gittensor/cli/issue_commands/mutations.py:218-222).
client.register_issue(...) returning None collapses three distinct failure modes — contract revert, the insufficient-balance pre-check (free_balance < 100_000_000 in _exec_contract_raw), and any exception during compose/sign/submit — into a single unconditional _print_register_revert_hints() call. The real error string only goes to bt.logging.error(...), and the extrinsic hash that the old code printed on revert is dropped entirely.
An operator hitting a non-revert failure (RPC timeout, fee shortage) sees misleading "Common revert reasons" hints with no way to inspect what actually happened on-chain. For real reverts, the extrinsic was submitted — the hash is how you'd inspect it via a block explorer.
Two ways to fix, your call which:
- Return a richer type from
_exec_contract_raw— e.g.Tuple[Optional[str], Optional[str]]for(hash, error_msg)— so the CLI can branch revert-vs-raw-error and always print the hash when one exists. - Less invasive: in
issue_register, setbt.loggingto at least INFO before theclient.register_issue(...)call so the underlyingf'{method_name} failed: {result.error_message}'line is visible to the user, and separately have_exec_contract_rawprint the extrinsic hash on failure too.
The pyright reportPrivateImportUsage global loosen is fine to keep — bittensor upstream needs __all__; we'll revert once they ship it. Per-line # pyright: ignore at ~234 access sites would be noisier than the workaround is worth.
1f513d0 to
0e44412
Compare
|

Summary
Bumps
bittensor 10.0.1 -> 10.3.1,bittensor-cli 9.17.0 -> 9.21.1,bittensor-wallet 4.0.0 -> 4.0.1, and removes the directsubstrate-interfacedependency entirely. The new bittensor stack shipsasync_substrate_interfaceand the SS58/keypair helpers we were pulling fromsubstrate-interface, so the dep is redundant.Knock-on refactors:
gittensor/cli/issue_commands/helpers.py: SS58 validation now usesbittensor_wallet.utils.is_valid_ss58_address(returns bool) instead ofsubstrateinterface.utils.ss58.ss58_decode(raises). Substrate client imports switched toasync_substrate_interface.SubstrateInterfacegittensor/cli/issue_commands/view.py:SubstrateInterfaceimport swap, no behavior changegittensor/validator/issue_competitions/contract_client.py: importsKeypairfrombittensor_walletandExtrinsicNotFoundfromasync_substrate_interface.errors; drops the dual-exception shim. Addsregister_issue(...)so the CLI can reuse the same code path as the rest of the contract operationsgittensor/cli/issue_commands/mutations.py:issues registernow drives the contract through the existingIssueCompetitionContractClientinstead of constructingContractInstancefrom a local ink! artifact. This removes the runtime requirement to havesmart-contracts/issues-v0/target/ink/issue_bounty_manager.contractbuilt locally before registering an issueTests:
tests/cli/test_cli_helpers.py: removed theTestCliRegisterLogicalFailuresclass, whose only test asserted the "Contract metadata not found" branch that no longer existstests/cli/test_cli_json_error_output.py: patch targets updated toasync_substrate_interface.SubstrateInterfaceRelated Issues
Closes #1334, #1338
Type of Change
Testing
Basic things were tested, but not the chain interaction itself. The problem is that there are no real e2e tests against a real chain and no any documented easy way to setup a local chain. Unit tests use mocks, so they won't show anything.
There are references to
up.sh, which is likely intended to setup a local chain, but it doesn't exist in the repo. So I guess it should be either tested e2e locally by whoever has thisup.sh(would be good to share it at least), or we should consider setup a necessary infra for e2e testing in this repository. The second variant would be also a good addition, as any chain-related changes are literally untested.Checklist
Note
pyright(pre-push hook) reports 234reportPrivateImportUsageerrors againstbittensor.logging,bittensor.Subtensor,bittensor.Wallet, etc. These were 0 on currenttestbranch. The newbittensor 10.3.1re-exports viafrom .submodule import X # noqa: F401without an explicit__all__, which pyright treats as private. Runtime imports still work. I've relaxedreportPrivateImportUsagein pyright config as for now, but actually the fix should relate to bittensor's side.