Page MenuHomePhabricator

[Cashtab] Pt1 - Fee calc update for token genesis txs
AbandonedPublic

Authored by emack on May 19 2023, 02:43.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

This diff addresses the edge case in token creation txs where the tx fee is less than the minimum due to the calcFee() call in generateTokenTxInput not passing the opReturn byte count. It arises if you lower the defaultFee in Ticker.js down to 1.11 (D13904).

The token genesis OP_RETURN script doesn't get generated until generateTokenTxOutput however the tx fee is calculated earlier in generateTokenTxInput.

Therefore setting the token genesis OP_RETURN byte count as a constant based on a genesis tx using max length in all fields.
e.g. 68 char token name, 12 char token ticker, 9 decimals, 10b supply, 68 char doc url, 5mb token icon, will generate the following 360 char hex / 180 byte OP_RETURN script:

6a04534c500001010747454e455349530c646464646464646464646464436d6178746f6b656e6e616d65656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565654368747470733a2f2f7777772e6c6f6e6775726c2e636f6d2f617364666173646661736466646464646464646464646464646464646464646464646464646464646464644c0001094c00088ac7230489e80000

Test Plan
  • change defaultFee in Ticker.js to 1.11
  • npm start
  • create a token with max field inputs and ensure successful creation with no min fee errors

Diff Detail

Repository
rABC Bitcoin ABC
Branch
feeFix
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23746
Build 47102: Build Diffcashtab-tests
Build 47101: arc lint + arc unit

Event Timeline

emack requested review of this revision.May 19 2023, 02:43
emack retitled this revision from [Cashtab] Fee calc update for token genesis txs to [Cashtab] Pt1 - Fee calc update for token genesis txs.May 19 2023, 05:07

This works but I worry that we are just making things worse if we fix it in this way.

What we want to do is calculate the fee appropriately using the actual inputs and outputs of the transaction. This is what will allow us to minimize fees across Cashtab with the minimal technical debt.

So, while this kind of stop gap measure is attractive and lets us reduce the fees right now, I think it's not worth complicating the app in this way for something we will need to fix later.

This revision now requires changes to proceed.May 23 2023, 18:39
emack planned changes to this revision.May 25 2023, 03:41