Gate transfer decode to exact Balances calls - #604
Conversation
anderdc
left a comment
There was a problem hiding this comment.
tests/test_decode_transfer.py:124 — transfer_all is call index 4 on Subtensor, not 7; index 7 doesn't exist in the Balances pallet (verified against live finney metadata: 0/2/3/4/5/6/8/9/10). test_raw_path_rejects_transfer_all_index passes for any unmapped index, so it pins nothing — use call_idx=4. allways/chain_providers/subtensor.py:26-28 — the raw path never decoded transfer_all either, since 4 was never in _TRANSFER_CALLS; drop that claim from the comment and the PR body so nobody later "restores" 7. The structured-path gate itself is correct and verified against real mainnet extrinsics on the pinned async-substrate-interface 2.2.1. Worth stating the true severity too: transfer_all/transfer_stake decoded with amount 0 and both call sites require amount >= expected, so no payment could ever have been falsely approved — this is hardening, not a live hole.
|
All three points addressed in the latest push: rejection test now pins the real index 4 (with a comment naming it so the pin is legible), the index-7/keep_alive claim is dropped from the module comment, test docstring, and PR body, and the body now states the honest severity — hardening against false negatives + lookalike calls, not a falsely-approving hole. Thanks for checking against live finney metadata. |
decode_transferaccepted any call withtransferin its name — no pallet check. Both decode paths are now gated to exactBalances.{transfer_allow_death, transfer_keep_alive}; addsdecode_stake_transferforSubtensorModule.transfer_stake(needed by the upcoming chain watcher).Severity: hardening, not a live hole —
transfer_all/transfer_stakedecoded withamount=0, and both call sites requireamount >= expected, so no payment could ever have been falsely approved. The real prior defect was false negatives (e.g. a genuinetransfer_allpayment could never verify) plus a lookalike-call surface the exact-name gate now closes. The raw path's7: transfer_allentry never matched anything —transfer_allis call index 4 on Subtensor — so it is dropped rather than fixed, and the rejection test pins index 4.Before → after (structured path, same fixtures as the new tests):
Independent fix: the decode is only called from
fetch_matching_tx/find_recent_outgoingin the same file, andcall_moduleis present in the installed scalecodec serialization. Full suite: 814 passed.