Page MenuHomePhabricator

[Cashtab] Embed token ID into airdrop OP_RETURN outputs
ClosedPublic

Authored by emack on May 5 2022, 14:18.

Details

Summary

As per T2437, adding the token ID that the airdrop is based on into the airdrop OP_RETURN output.

This diff goes as far as adding the token ID into OP_RETURN outputs in sendXec() and then parsing accordingly before inserting it into the parsedTx object in parseTxData(). Whoever is working on the subsequent conditional rendering based on this can just call the parsedTx.airdropTokenId param if parasedTx.airdropFlag is true.

Unit tests added to reflect this new OP_RETURN structure.

However given the additional stack space used for the token ID, the max char limit for the actual messages need to be reduced from 160 to 145 characters. For further discussion on whether this reduction is material enough to reconsider this diff.

Test Plan

Ensure the following tx types generate outputs as outlined below and are rendered appropriately on the Tx History screen:

  • airdrop with no message**

https://explorer.be.cash/tx/161c5d962eea54c1d3a280190eb50c5728d19bd1336844f4627b469d3bde95fa

6a (OP_RETURN)
04
64726f70 (drop)
40
31633663396336346437306232383562656665373333663137356430663338343533383537363837366264323830623130353837646638313237396433663565 (the eToken Id)
04
00746162 (_tab)

  • airdrop with message**

https://explorer.be.cash/tx/ff253d06a1f3cce088d541dc28d06cf08cebc0288c2ae21e8985df08109b45d8

6a (OP_RETURN)
04
64726f70 (drop)
40
31633663396336346437306232383562656665373333663137356430663338343533383537363837366264323830623130353837646638313237396433663565
04
00746162 (_tab)
06
62616e616e61 (banana)

  • non-airdrop 1-to-1 send xec with no message**

https://explorer.be.cash/tx/d67343d4cfc5bd15c29eac81491bc617b61d6b72a4349dee9a5e2c8e369817e4

no OP_RETURN outputs

  • non-airdrop 1-to-1 send xec with message**

https://explorer.be.cash/tx/890b47756cd93a15336b8c738f418230c4ad5757cd187315a3bc371d3cc312dd

6a (OP_RETURN)
04
00746162 (_tab)
03
666f6f (foo)

  • non-airdrop 1-to-many send xec with no message**

https://explorer.be.cash/tx/c09b42d3b0236e33f7a28e4d7f182c48a0590a8bd9317737272487c63a216ba0

no OP_RETURN outputs

  • non-airdrop 1-to-many send xec with message**

https://explorer.be.cash/tx/d31ac4367e3da8695dcd8568d86226a0136b08dd6666c475e48c7190516b08fa

6a (OP_RETURN)
04
00746162 (_tab)
06
6170706c6573 (apples)

  • non-airdrop 1-to-1 send xec with encrypted message**

https://explorer.be.cash/tx/8b660c49465c9afd325b2202bc14773c2f128cf5b5753dc7219d83e316255bbd

6a (OP_RETURN)
04
65746162 (etab)
4c
81
04ef24910931e59d7259cdf98266c8174ea2c7f02c883ed1730d66f290b86353faac94fe60f89084d8b6ad102db81fd2b2806f179a7f149891d81fbf92a61ef3978b57833b11dd464c70bfed48db4f2171ae8e215c3ba08b5ad8baf7f8f122f045d63ab5b506a400df5ea33f80b36d7233888072b91b9d6845e2467caa16531bd4 (encrypted message)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
airdropTokenId
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18945
Build 37658: Build Diffcashtab-tests
Build 37657: arc lint + arc unit

Event Timeline

emack requested review of this revision.May 5 2022, 14:18
emack edited the test plan for this revision. (Show Details)

Looks good.

We can address the char length when we sort out the proper fees for OP_RETURN txs. May need to commandeer D11062 to get that in.

This revision is now accepted and ready to land.May 5 2022, 19:23