fix(hive): emit the wire symbols hived uses, not the display ones#376
Merged
Conversation
hived encodes HIVE as "STEEM" and HBD as "SBD" — the 2020 rebrand renamed the tokens but not their serialization. We emitted the display spelling, so the device signed bytes hived re-serializes differently; its signature check recovers a key from those bytes, finds it in no authority, and reports "missing required active authority". Every asset-bearing op was affected. This serializer and the firmware parser were byte-exact mirrors of each other, so both were wrong together and every test passed. Added two golden vectors from hived's own condenser_api.get_transaction_hex — the only source that could have caught it. Requires the matching firmware fix (BitHighlander/keepkey-firmware#316). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
hived encodes HIVE as
STEEMand HBD asSBD. The 2020 rebrand renamed the tokens but not their on-chain serialization.asset()wrote the display spelling, so the device signed bytes hived never reproduces. hived re-serializes the operation to check the signature, recovers a key from different bytes, finds it in no authority, and reports:Found in live testing on a
limit_order_create; the message points at keys and the keys were fine.Scope: every asset-bearing op here —
transfer_to_vesting,convert,comment_options,transfer_to_savings,transfer_from_savings,claim_reward_balance,limit_order_create. Notvote/comment/custom_json(no assets), not the VESTS-only ops (VESTSis spelled the same), and nothive_transfer(firmware builds those bytes from typed fields, never through this serializer) — which is why voting and transfers worked.The fix
One line in
asset(): writeWIRE_SYMBOL[symbol] ?? symbol. Input parsing, precision rules and the symbol whitelist still speak in display symbols, so callers and error messages are unchanged.Why the tests didn't catch it
They were byte-exact mirrors of the firmware parser, which expected the same wrong bytes. Two independent implementations of the same misunderstanding is not verification.
Added two golden vectors from hived's own
condenser_api.get_transaction_hex(limit_order_createandclaim_reward_balance, covering all three symbols), compared against the full serializer output. They drop hived's trailingsignatures-count byte, since the digest preimage stops after the extensions varint.57/57 pass.
Ships with
BitHighlander/keepkey-firmware#316 — the parser has to accept
STEEM/SBDand map back toHIVE/HBDfor the OLED. Merging this alone makes the device reject every asset-bearing op.🤖 Generated with Claude Code