feat(thorchain): allow any denom in ThorchainMsgSend with validation#237
Open
BitHighlander wants to merge 4 commits into
Open
feat(thorchain): allow any denom in ThorchainMsgSend with validation#237BitHighlander wants to merge 4 commits into
BitHighlander wants to merge 4 commits into
Conversation
Previously the send path hardcoded "rune" as the coin denom in both the JSON signing payload and the on-device confirmation screen. This blocked signing of any other native THORChain L1 asset. Changes: - deps/device-protocol: add optional string denom = 11 to ThorchainMsgSend - messages-thorchain.options: add ThorchainMsgSend.denom max_size:69 - thorchain.h/c: add denom param to thorchain_signTxUpdateMsgSend; default to "rune" when absent (backward compat); split JSON write to avoid fixed 64-byte buffer overflow on long denoms - fsm_msg_thorchain.h: display actual denom in confirmation, pass through to signing, update final confirm text to "THORChain transaction" - thorchain.cpp: update existing call, add DefaultDenom/TCY/Rujira tests
- Add thorchain_isValidDenom() rejecting chars that need JSON escaping; valid set is [a-z0-9./\-], empty string rejected (caller uses "rune") - Use tendermint_sha256UpdateEscaped for the denom write in MsgSend as defense-in-depth (validation is the primary guard) - Register thorchain.cpp in CMakeLists.txt — it was never compiled, so all prior expected values were unvalidated placeholder text - Replace wrong address/signature expected values with vectors derived from the actual trezor-crypto library (standalone C verification tool) - Add ThorchainSignTxDefaultDenom: empty denom → same sig as explicit "rune" - Add ThorchainDenomValidation: unit-tests thorchain_isValidDenom directly - Add ThorchainSignTxInvalidDenom: quote-injection attempt returns false
…screens High: amount_str[32] could not hold amount + long denom suffix, causing bn_format_uint64 to silently return 0 and show a blank confirmation while the full denom was still signed. Fixed by passing NULL suffix so amount_str holds only the numeric part, then showing denom on its own "Asset" screen. Low: untrusted denom was formatted and shown before thorchain_isValidDenom ran in the signing layer. Moved explicit isValidDenom check to the top of the send path so invalid strings are rejected before any UI is touched.
deps/device-protocol → 8ef74da (feat(ripple): memo + THORChain routing) deps/python-keepkey → bf870e6 (7.14.2: XRP memo + EVM depositWithExpiry + msg-signing)
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.
Summary
Three-commit series enabling TCY, RUJIRA, and other native THORChain assets:
denomfield toThorchainMsgSendproto. Defaults to rune when absent for backwards compat. Bumpsdeps/device-protocol.[A-Z0-9.-/]to prevent display spoofing.Test plan