Page MenuHomePhabricator

[Cashtab] Deprecate legacy alias bytecount function
ClosedPublic

Authored by bytesofman on Jan 2 2024, 17:47.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC715b8a4b93aa: [Cashtab] Deprecate legacy alias bytecount function
Summary

Deprecate alias bytecount function for one in proper place with proper tests

The main goal here is to deprecate the legacy generateOpReturnScript function, still used here

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

remove unrelated unit test change, better function comments

bytesofman published this revision for review.Jan 2 2024, 17:49
Fabien requested changes to this revision.Jan 2 2024, 20:35
Fabien added a subscriber: Fabien.
Fabien added inline comments.
cashtab/src/opreturn/index.js
167 ↗(On Diff #43820)

Why is this function in the opreturn index ? It's related to alias, not op_return

This revision now requires changes to proceed.Jan 2 2024, 20:35
bytesofman marked an inline comment as done.
bytesofman added inline comments.
cashtab/src/opreturn/index.js
167 ↗(On Diff #43820)

A bit of a judgment call, imo could go either way. I leaned this way as

  1. This function is related to getAliasTargetOutput, which is in this file. I modeled this function on that function. Both functions should get the alias buffer in the same way, so it is useful to have them grouped. We are getting part of an OP_RETURN and then getting the bytecount of that part.
  1. The old function in aliasUtils is actually calling a to-be-deprecated much weirder way of getting the bytecount function from utils/cashMethods.js. So, while the unit tests are the same as the old ones (although I added a few more cases), the logic is new + related to an existing opreturn function
  1. The unit test structure is much better here and it was easier to add new unit tests. Ultimately all the Cashtab unit tests should be refactored to follow the vectors approach of the newer function groups (opreturn and transactions). So, this was an opportunity and chip away at some of that work gradually, in line with deprecating the old function.

OK let's see how it goes in the end and split apart later if needed

This revision is now accepted and ready to land.Jan 3 2024, 09:01
This revision was automatically updated to reflect the committed changes.
bytesofman marked an inline comment as done.