Python SDK CLI rejects fractional RTC amount and fee before sending
維護者通常 10 天內回覆
@Limm-web 已經在處理了。
開始於 2026年10月4日。
評估
研究方向
Start in sdk/python/rustchain_sdk/cli.py at the wallet send arguments (lines 125–163); compare their parsing with the amount and fee contract in sdk/python/rustchain_sdk/client.py (lines 397–425) and the fractional RTC example in sdk/python/README.md (lines 43–49). Run the provided repro.py against the pinned source to confirm the parser failures and working control. Done when fractional amounts and fees reach the transfer operation without losing monetary precision; pull request #8575 is already open.
由索引模型根據 Issue 內容生成。
描述
Reproduced functional CLI bug
Pinned source: c3da95d5e6163d7fe06b9d12a7735976392f2318. CLI integer arguments; SDK RTC amount/fee contract; documented 10.5 RTC example.
The CLI says it sends RTC, and passes amount/fee directly to a client that accepts fractional RTC. However both Click parameters are int. wallet send dummy-from dummy-to 0.5 --seed dummy exits 2 with Error: Invalid value for 'AMOUNT': '0.5' is not a valid integer. An integer amount with --fee 0.01 likewise exits 2. The recording send callback is never reached. Control amount 1/fee 1 reaches it and exits 0.
Expected: valid fractional RTC amounts/fees parse and reach the transfer operation. Actual: parser rejects them before any signing or API request. Amount and fee are one shared parser-contract issue, not two bug claims. Suggested fix: align CLI numeric parsing and unit documentation with the existing SDK's RTC contract without losing monetary precision.
Environment and exact runnable reproduction
3.14.8
Darwin arm64
click 8.1.8
httpx 0.28.1
Source file SHA-256: d09685c5d0a3829c1db77b69775d01ea83fc50164cbbe0a97f6dd0dd2f5cc616; Git blob 6856b3b091c9b68a5aadf4f6ddfa67b9016469f2.
Save the script below as repro.py, obtain the SDK source at the pinned commit and install its declared dependencies in an isolated virtualenv, then run python repro.py /path/to/Rustchain/sdk/python. The script imports the actual source CLI and controls only callbacks/transport/wallet seams. Connection, bind and DNS operations are audit-blocked. All seed/address values are dummy fixtures.
import sys, socket, json, hashlib
from pathlib import Path
root = Path(sys.argv[1])
sys.path.insert(0, str(root))
def blocked(*args, **kwargs):
raise AssertionError('NETWORK BLOCKED')
def audit(event, args):
if event in ('socket.connect', 'socket.bind', 'socket.getaddrinfo', 'socket.gethostbyname', 'socket.gethostbyaddr', 'socket.sendto'):
blocked()
sys.addaudithook(audit)
socket.create_connection = blocked
socket.getaddrinfo = blocked
from click.testing import CliRunner
from rustchain_sdk import cli
trace = []
async def send(*args): trace.append(['send', list(args)])
async def node(*args): trace.append(['node', list(args)])
async def epoch(*args): trace.append(['epoch', list(args)])
cli._wallet_send, cli._node_status, cli._epoch_info = send, node, epoch
class Wallet:
address = 'dummy-address'
public_key_hex = 'dummy-public-key'
@staticmethod
def from_seed_phrase(words):
trace.append(['wallet', words]); return Wallet()
def sign(self, data):
trace.append(['sign', data.decode()]); return b'dummy-signature'
class Client:
def __init__(self, **kwargs): trace.append(['client', kwargs])
async def __aenter__(self): return self
async def __aexit__(self, *args): pass
async def get_attestation_status(self, key):
trace.append(['status', key]); return {'status': 'fixture-status'}
async def attest_challenge(self, key):
trace.append(['challenge', key]); return {'challenge': 'fixture-challenge'}
async def attest_submit(self, *args):
trace.append(['submit', list(args)]); return {'accepted': True}
cli.RustChainWallet, cli.RustChainClient = Wallet, Client
cases = [
['wallet','send','dummy-from','dummy-to','0.5','--seed','dummy'],
['wallet','send','dummy-from','dummy-to','1','--fee','0.01','--seed','dummy'],
['wallet','send','dummy-from','dummy-to','1','--fee','1','--seed','dummy'],
['node','status'], ['epoch','info'], ['node'], ['epoch'],
['attest','dummy-address','--seed','dummy','--node','https://invalid.test'],
['attest','dummy-address','--seed','dummy','--node','https://invalid.test','--json'],
]
results=[]
for args in cases:
trace.clear()
result = CliRunner().invoke(cli.main, args)
record={'argv':args,'exit_code':result.exit_code,'stdout':result.stdout,'output':result.output,'trace':list(trace),'exception':repr(result.exception) if result.exception else None}
results.append(record)
assert [r['exit_code'] for r in results] == [2,2,0,2,2,0,0,0,0]
assert not results[0]['trace'] and not results[1]['trace']
assert not results[3]['trace'] and not results[4]['trace']
assert results[5]['trace'][0][0] == 'node' and results[6]['trace'][0][0] == 'epoch'
assert [t[0] for t in results[7]['trace']] == ['wallet','client','status','challenge','sign','submit']
assert [t[0] for t in results[8]['trace']] == ['wallet','client','status']
print(json.dumps({'commit':'c3da95d5e6163d7fe06b9d12a7735976392f2318','cli_sha256':hashlib.sha256((root/'rustchain_sdk/cli.py').read_bytes()).hexdigest(),'network':'socket creation, connection, DNS blocked before SDK import','results':results},indent=2))
The runner exits 0 when it observes the described current failures and working controls; its printed per-case exit codes/recorded operations are the evidence. This is a reproduction, not a passing regression test or a fix. No production calls or funds movement.
Duplicate checks searched both source/bounty repos, all states: fractional CLI (11 results, no exact parser report identified), quoted unexpected-extra-argument (0), attest/as_json (0), _attest/json (0); broader CLI-attestation-JSON 188 results screened, no exact symptom in returned bodies. Existing #5678 signed-payload work does not change cli.py. First-reporter/eligibility remains maintainer decision.
AI assistance disclosure: source investigation, local reproduction and report preparation used AI assistance.
- 主要語言
- Python
- 星號
- 850
- 分支
- 589
- 平均合併
- 11 天 7 小時
- 30 天內合併 PR
- 29
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Scottcjn/Rustchain 的其他 Issue
-
utxo_ledger (reference): failed apply_transaction leaks already-created outputs (supply inflation)未關閉
難度 2/5 1-3 小時 新手友好度 79/100
維護者通常 10 天內回覆
-
SDK CLI prints 0 RTC for canonical /wallet/balance responses可能已有人在做 @ArtyormSatori 於 37 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
Scottcjn/Rustchain#8580 · 4 則留言 ·
維護者通常 10 天內回覆
-
難度 4/5 3-5 天 新手友好度 38/100
維護者通常 10 天內回覆
-
[SECURITY] Non-finite and garbage weights pass the sybil-guard money chain — enrollment_weight has no isfinite guard and epoch_weight_to_units raises on NaN/inf可能已有人在做 @thinhnx128 於 28 天前認領。 未關閉bug
難度 4/5 3-5 天 新手友好度 48/100
Scottcjn/Rustchain#8619 · 2 則留言 ·
維護者通常 10 天內回覆
-
[Antiquity] Celeron M (Banias/Dothan, 2004) has no brand rule — real vintage silicon falls to x86 default 1.0x while its Pentium M twin earns 1.9x可能已有人在做 @Limm-web 於 60 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 25/100
Scottcjn/Rustchain#8578 · 5 則留言 ·
維護者通常 10 天內回覆
查看 Scottcjn/Rustchain 的全部 Issue
相似的 Issue
-
resource-submission validation-passed
難度 1/5 1 小時以內 新手友好度 68/100
hesreallyhim/awesome-claude-code#3875 · 1 則留言 ·
-
bug
難度 2/5 1-3 小時 新手友好度 77/100
bvis/aegis-hass#725 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stamp未關閉
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.x可能已有人在做 @NimaVaziri 今天認領。 未關閉Pytorch
難度 2/5 1-3 小時 新手友好度 78/100
NVIDIA/TensorRT-LLM#23406 ·
維護者通常 1 天內回覆