Page MenuHomePhabricator

[Cashtab] [Chronik] Upgrade OP_RETURN messaging size
ClosedPublic

Authored by emack on Oct 17 2022, 01:19.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC8227c71d9d5e: [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

Diff Detail

Repository
rABC Bitcoin ABC
Branch
messageLength
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20535
Build 40740: Build Diffcashtab-tests
Build 40739: arc lint + arc unit

Event Timeline

emack requested review of this revision.Oct 17 2022, 01:19

We'll be able to finalize optimization once D11062 is sorted out

This revision is now accepted and ready to land.Oct 18 2022, 22:47