You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #1335, gitt issues register no longer goes through ContractInstance.exec(...). It now routes through the new IssueCompetitionContractClient.register_issue(...) method, which calls _exec_contract_raw('register_issue', ...) → _encode_args('register_issue', ...).
That new path is broken before any extrinsic is submitted.
metadata.json declares register_issue with two str arguments:
github_url
repository_full_name
But IssueCompetitionContractClient._encode_args() only handles u32, u64, u128, AccountId, and array32. Anything else hits the fallback:
raiseValueError(f'Unsupported type: {type_def} for arg {arg_name}')
So every register_issue call fails while encoding github_url, before compose_call is ever invoked.
gittensor/validator/issue_competitions/metadata.json — register_issue declares github_url and repository_full_name as str.
Steps to Reproduce
No live chain required — the failure happens entirely inside local argument encoding.
Against current test at fc503f9:
fromgittensor.validator.issue_competitions.contract_clientimport (
IssueCompetitionContractClient,
)
# Bypass __init__ so we don't need a Subtensor connection.client=IssueCompetitionContractClient.__new__(IssueCompetitionContractClient)
client._encode_args(
"register_issue",
{
"github_url": "https://github.com/owner/repo/issues/1",
"repository_full_name": "owner/repo",
"issue_number": 1,
"target_bounty": 10_000_000_000,
},
)
Observed:
ValueError: Unsupported type: str for arg github_url
The full CLI path reaches the same encoder via:
gitt issues register
→ mutations.issue_register()
→ IssueCompetitionContractClient.register_issue(...)
→ _exec_contract_raw(method_name="register_issue", ...)
→ _encode_args("register_issue", ...) # raises here
Expected Behavior
gitt issues register should encode the register_issue arguments and submit the contract call. Specifically, _encode_args should SCALE-encode str as compact-length-prefixed UTF-8 bytes (the SCALE encoding of Vec<u8>).
Actual Behavior
register_issue fails during local argument encoding, before any on-chain submission. The CLI can only surface a pre-submission error similar to:
register_issue error: Unsupported type: str for arg github_url
Impact
#1335 was intended to remove the local .contract artifact requirement for issue registration ("removes the runtime requirement to have smart-contracts/issues-v0/target/ink/issue_bounty_manager.contract built locally before registering an issue"). The replacement path achieves that goal but cannot register any issue, because register_issue always carries string arguments.
This breaks the owner-only gitt issues register workflow on current test.
#1335's own description notes that "Basic things were tested, but not the chain interaction itself" — this is the gap that comment was flagging.
Suggested Fix
Add SCALE string encoding to _encode_args() for type_def == "str":
UTF-8-encode the value.
Prepend the SCALE compact length of the byte string.
Append the bytes.
The compact-length helper should cover at least modes 0 (n < 64), 1 (64 ≤ n < 16384), and 2 (16384 ≤ n < 2³⁰) so that longer repo names / URLs don't fail at the >64-byte boundary.
A regression test should cover register_issue specifically, e.g.:
Construct the client via __new__ (no chain dependency).
Call _encode_args("register_issue", {...}) with both a short URL and a URL long enough to push the encoded length past 64 bytes.
Assert it does not raise.
Assert the encoded bytes begin with the correct SCALE compact-length prefix followed by the UTF-8 bytes, in order, for github_url then repository_full_name, then u32issue_number (4 bytes LE), then u128target_bounty (16 bytes LE).
Negative case: a non-str value for github_url raises a clear error.
Prior Art / Not a Duplicate
#987 / #988 (and the parallel #993) proposed removing the str fallback as dead code, with bodies explicitly stating:
"str appears only in register_issue (never routed here)… register_issue is never called through _exec_contract_raw → _encode_args — it is called from the CLI (mutations.py) via a different execution path."
That premise was true at the time, and those PRs were closed without merging.
#1335 inverted that premise: register_issue is now routed through _exec_contract_raw() → _encode_args(), making the previously unreachable str path reachable in production — and now broken, because the str branch was never implemented.
Description
After #1335,
gitt issues registerno longer goes throughContractInstance.exec(...). It now routes through the newIssueCompetitionContractClient.register_issue(...)method, which calls_exec_contract_raw('register_issue', ...)→_encode_args('register_issue', ...).That new path is broken before any extrinsic is submitted.
metadata.jsondeclaresregister_issuewith twostrarguments:github_urlrepository_full_nameBut
IssueCompetitionContractClient._encode_args()only handlesu32,u64,u128,AccountId, andarray32. Anything else hits the fallback:So every
register_issuecall fails while encodinggithub_url, beforecompose_callis ever invoked.Affected Code
gittensor/cli/issue_commands/mutations.py—issue_register()now callsclient.register_issue(...)(introduced in Bump bittensor stack and drop substrate-interface #1335).gittensor/validator/issue_competitions/contract_client.pyregister_issue()→_exec_contract_raw(method_name='register_issue', ...)_exec_contract_raw()→_encode_args(...)_encode_args()has nostrbranch.gittensor/validator/issue_competitions/metadata.json—register_issuedeclaresgithub_urlandrepository_full_nameasstr.Steps to Reproduce
No live chain required — the failure happens entirely inside local argument encoding.
Against current
testatfc503f9:Observed:
The full CLI path reaches the same encoder via:
Expected Behavior
gitt issues registershould encode theregister_issuearguments and submit the contract call. Specifically,_encode_argsshould SCALE-encodestras compact-length-prefixed UTF-8 bytes (the SCALE encoding ofVec<u8>).Actual Behavior
register_issuefails during local argument encoding, before any on-chain submission. The CLI can only surface a pre-submission error similar to:Impact
#1335 was intended to remove the local
.contractartifact requirement for issue registration ("removes the runtime requirement to havesmart-contracts/issues-v0/target/ink/issue_bounty_manager.contractbuilt locally before registering an issue"). The replacement path achieves that goal but cannot register any issue, becauseregister_issuealways carries string arguments.This breaks the owner-only
gitt issues registerworkflow on currenttest.#1335's own description notes that "Basic things were tested, but not the chain interaction itself" — this is the gap that comment was flagging.
Suggested Fix
Add SCALE string encoding to
_encode_args()fortype_def == "str":The compact-length helper should cover at least modes 0 (
n < 64), 1 (64 ≤ n < 16384), and 2 (16384 ≤ n < 2³⁰) so that longer repo names / URLs don't fail at the >64-byte boundary.A regression test should cover
register_issuespecifically, e.g.:__new__(no chain dependency)._encode_args("register_issue", {...})with both a short URL and a URL long enough to push the encoded length past 64 bytes.github_urlthenrepository_full_name, thenu32issue_number(4 bytes LE), thenu128target_bounty(16 bytes LE).strvalue forgithub_urlraises a clear error.Prior Art / Not a Duplicate
#987 / #988 (and the parallel #993) proposed removing the
strfallback as dead code, with bodies explicitly stating:That premise was true at the time, and those PRs were closed without merging.
#1335 inverted that premise:
register_issueis now routed through_exec_contract_raw()→_encode_args(), making the previously unreachablestrpath reachable in production — and now broken, because thestrbranch was never implemented.