HomePhabricator

[Cashtab] [Chronik] Upgrade OP_RETURN messaging size

Description

[Cashtab] [Chronik] Upgrade OP_RETURN messaging size

Summary:
Revising OP_RETURN message lengths since we are now broadcasting XEC txs via chronik. The sizes below factors in a little bit of leeway for weird symbols that take up additional bytes in messages.

Unencrypted messages
206 chars was tested to be the right size for unencrypted OP_RETURN messages, up from the existing 145 char limit.

Encrypted messages
In terms of encrypted messages, based on the ecies-lite library code, if the compressEpk param is supplied as true, then the compressed version of the recipient's public key is encoded into the message as the ecies ephemeral public key, freeing up more stack space for the message content itself.
I've tested this up to an encrypted messaging size of 125 chars, up from the existing 96 char limit.

Airdrop tx messages
Airdrop multi-send adds additional encoding (token ID + airdrop encoding) into the message, which needs to be subtracted from the unencrypted limit from above (206 chars). Therefore this input limit is now dynamically adjusted to 170 chars if cashtab detects it is routed from the airdrop component.

Further optimization
Further optimizations are possible, but given we do have to deal with a combination of one to many sends and airdrop encoded transactions in the mix I think this diff is a decent ROI for the time being.

Test Plan:

  • send 206 char unencrypted message, validate placeholder text and input char limit, and ensure successful broadcast
  • send 206 char unencrypted oneToMany message, validate placeholder text and input char limit, and ensure successful broadcast
  • send 125 char encrypted message, validate placeholder text and input char limit, and ensure successful broadcast
  • execute airdrop calculation, click on 'Copy to send screen' and ensure message limit and placeholder text now reflects 170 chars.
  • send 170 char unencrypted airdrop tx message and ensure successful broadcast

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D12263

Details

Provenance
emackAuthored on Oct 17 2022, 01:16
emackPushed on Nov 2 2022, 01:11
Reviewer
Restricted Project
Differential Revision
D12263: [Cashtab] [Chronik] Upgrade OP_RETURN messaging size
Parents
rABC4d1a9e043ce4: [Cashtab] [BCH deprecation] Pt 2/2 - Deprecate BCH.SLP.TokenType1.
Branches
Unknown
Tags
Unknown