Skip to content

test(hive): phase-3 clear-sign op device tests + wire-symbol fix#198

Merged
BitHighlander merged 2 commits into
reconcile/upstream-syncfrom
feat/hive-clearsign-ops-phase3
Jul 21, 2026
Merged

test(hive): phase-3 clear-sign op device tests + wire-symbol fix#198
BitHighlander merged 2 commits into
reconcile/upstream-syncfrom
feat/hive-clearsign-ops-phase3

Conversation

@BitHighlander

Copy link
Copy Markdown
Contributor

Folds the phase-3 hive test work into reconcile/upstream-sync, which is the branch .gitmodules declares for firmware pinning. Two commits:

  • 38acf57 — device tests for the 11 phase-3 clear-sign ops
  • e98228f_asset / _asset_raw emit the wire symbols hived actually uses (STEEM / SBD, not HIVE / HBD)

The second is the important one. hived's 2020 rebrand renamed the tokens but not their serialization, so these tests built assets the chain never produces — matching a firmware parser that expected the same wrong bytes. Both sides agreed, every test passed, and every resulting signature was rejected on-chain as "missing required active authority".

_asset_raw maps too: its callers target the precision and negative-amount checks, and leaving the display spelling there would trip the symbol check first — passing while testing nothing.

Pairs with BitHighlander/keepkey-firmware#316, which stops accepting the display spellings. Firmware pins this branch, so the two must land together.

🤖 Generated with Claude Code

BitHighlander and others added 2 commits July 19, 2026 17:36
Covers the 11 ops added to the firmware clear-sign table: transfer_to_vesting,
withdraw_vesting, limit_order_create/cancel, convert, comment_options,
transfer_to/from_savings, claim_reward_balance, delegate_vesting_shares,
account_update2.

Transactions are built by this file's own Graphene serializer (the _op_*
helpers), never from firmware-emitted bytes, so a parser bug and a serializer
bug cannot cancel out.

Beyond happy-path sign-and-recover, the negative cases pin the invariants that
actually protect the user:

  - asset symbol AND precision are pinned per op: a swapped symbol hides a
    ~2000x value difference behind an identical-looking number, and a wrong
    precision moves the decimal point relative to what the chain applies
  - negative int64 amounts are refused (they would render as enormous
    positive values)
  - comment_options only binds immediately after a comment with a matching
    author and permlink; detached it could redirect the payout of a post
    published earlier that the user is not reviewing on screen
  - account_update2 refuses any authority field
  - beneficiaries must be strictly ascending, unique, and sum to <= 100%
  - zero amounts are refused where meaningless and accepted where meaningful
    (withdraw_vesting 0 stops a power-down, delegate 0 removes a delegation)
  - truncated op bodies are refused rather than partially parsed

Two fixes to existing tests:

  - Three assertions matched rejection strings that the firmware has since
    grouped by cause ("malformed op count", "weight out of range",
    "mixed active+posting auths"). The text is diagnostic, not contractual —
    the protection is that the device refuses — so the assertions follow the
    grouping.
  - rejects_excluded_and_unknown_ops used op type 3 as its "unknown op",
    mislabelled in a comment as comment_options. Op 3 is transfer_to_vesting
    and is now clear-signed, so it no longer reached the unknown-op path.
    Switched to 49 (recurrent_transfer), which is deliberately out of the
    table.

38/38 pass against an emulator built from keepkey-firmware
feat/hive-clearsign-ops-phase3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
hived encodes HIVE as "STEEM" and HBD as "SBD" — the 2020 rebrand renamed
the tokens but not their serialization. These tests wrote the display
spelling, matching a firmware parser that expected the same wrong bytes, so
they passed while every resulting signature was rejected on-chain as
"missing required active authority".

_asset_raw maps too: its callers target the precision and negative-amount
checks, and leaving the display spelling there would trip the symbol check
first — passing while testing nothing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BitHighlander
BitHighlander merged commit a37a96a into reconcile/upstream-sync Jul 21, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant