Skip to content

Conversation

@Timi16
Copy link
Contributor

@Timi16 Timi16 commented Jan 10, 2026

When a memo string starts with 0x (like an Ethereum address), the current code attempts to decode it as hexadecimal. For valid hex strings like Ethereum addresses, the decode succeeds but produces data that causes transaction failures during scanning.

Changes

  • Modified interpret_memo_string in zingolib/src/wallet/utils.rs to only use hex-decoded data if it's a valid memo size (≤512 bytes)
  • Added comprehensive unit tests covering:
    • Plain text memos
    • Valid hex strings
    • Ethereum addresses (valid hex but should be treated as text)
    • Invalid hex strings
    • Oversized memos

Testing

Added unit tests in zingolib/src/wallet/utils.rs:

  • test_interpret_memo_string_plain_text
  • test_interpret_memo_string_valid_hex
  • test_interpret_memo_string_ethereum_address
  • test_interpret_memo_string_invalid_hex
  • test_interpret_memo_string_too_long

- Modified interpret_memo_string to only decode hex if result is valid memo size (≤512 bytes)
- Added unit tests for plain text, valid hex, Ethereum addresses, invalid hex, and oversized memos
- Fixes zingolabs#2075 where Ethereum addresses in memos caused transaction failures
@dorianvp dorianvp linked an issue Jan 10, 2026 that may be closed by this pull request
Copy link
Contributor

@Oscar-Pepper Oscar-Pepper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Timi16 thanks for looking into this. I will post in the issue #2075 to get more info as i'm struggling to understand under which conditions this bug occurs, i cant reproduce it myself. Please see this issue for more context. The changes you have made are to the parsing of an Arbitrary memo - starting with 0xFF byte as stated in zip302 - which are used internally by zingo and are not displayed to the user or intended to be human-readable. Therefore, this code needs to remain unchanged. I assume the issue we are trying to solve is when the ethereum address is inputted by the user as text. In this case, the first byte will be <= 0xF4 resulting is a memo of Text variant where the remaining 511 bytes will be parsed to a string. This string should be able to contain any valid UTF-8 and its not clear to me why any text memo starting with "0x" will be treated differently. my tests support this, here is an example:

    txid: cfd5f064237370c7d60131bdbe86a4950d206d995c06991f415a2f6bfbdd485f
    datetime: 2026-01-14 06:31:03 UTC
    status: confirmed
    blockheight: 3204220
    kind: send-to-self
    value: 0
    fee: 10000
    zec price: not available
    orchard notes:
        {
            value: 100000
            spend status: unspent
            output index: 0
            memo: 0xtest
        }

@Timi16 Timi16 force-pushed the fix/memo-0x-prefix-issue-2075 branch from 5f9b9af to 066414b Compare January 14, 2026 08:57
@Timi16 Timi16 requested a review from Oscar-Pepper January 14, 2026 11:03
Copy link
Contributor

@Oscar-Pepper Oscar-Pepper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work. thanks for your contribution!

@Oscar-Pepper
Copy link
Contributor

hi @Timi16 I have pushed a commit instead of requesting changes. I hope this is ok, otherwise I can PR into your branch if you prefer. please review my commit and if all ok we can merge.

@Timi16
Copy link
Contributor Author

Timi16 commented Jan 15, 2026

hi @Timi16 I have pushed a commit instead of requesting changes. I hope this is ok, otherwise I can PR into your branch if you prefer. please review my commit and if all ok we can merge.

Yes you can all is Okay thank you

@Timi16
Copy link
Contributor Author

Timi16 commented Jan 15, 2026

great work. thanks for your contribution!

I Thank the Zingolib team for there support

@Oscar-Pepper Oscar-Pepper merged commit 2d1d655 into zingolabs:dev Jan 15, 2026
17 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.

adding a 0x.. string to memo in send results in tx failure

2 participants