Claim name returned is strange #119
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
Epic
good first issue
hacktoberfest
hard fork
help wanted
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
soft fork
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
work in progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbrycrd#119
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Via Lex:
working on unit tests for the claim name script and using real live blockchain data and am confused about
lbrycrd
output:looking at the hex:
b5
is correct forOP_CLAIM_NAME
, then it's04
which is correct for length of upcoming string, consuming the next 4 bytes (8 in hex) gives uscats
:Agreed with the following:
b5
isOP_CLAIM_NAME
04
is 4 bytes or63617473
63617473
is "cats"4c
isOP_PUSHDATA1
dc
is 220 bytes or the claimI don't process the ASM, but the raw data from lbrycrd for the chainquery app because there is different behavior for ASMs that make it unreliable as a source in this manner. Below is a screenshot of all claims by the name "cats". All the ASMs have this problem.
Taking a look at the code an interesting situation appears.
270307a290/src/core_write.cpp (L90)
So if the group of bytes is 4 or less then lbrycrd treats it as a littleendian uint16 for the ASM which translates to...drum roll...
1937006947
. Other wise it takes the hexstr which is what everyone expects to be the output.To top it off this is also expected in the bitcoin codebase as well below:
https://github.com/bitcoin/bitcoin/blob/master/src/core_write.cpp#L95
I also created an issue for the bitcoin repository to see what the functional use case of this is, in case anyone is ever interested in what the developers have to say:
https://github.com/bitcoin/bitcoin/issues/13085
We can delete this if statement:
270307a290/src/core_write.cpp (L90)
Since for our use case it is better to treat data of any size as a hex string
Are any new unit tests necessary for this, except those already in existence: https://github.com/lbryio/lbrycrd/blob/master/src/test/script_tests.cpp#L1067 ?
@kaykurokawa I'm not saying I strongly disagree here, since it's just a string representation, but I also think it can be easily (and consistently) handled upstream since it's the same data.
This prints out
1937006947, 73746163, 63617473
, which is what you'd expect.@kaykurokawa What is the status of this issue? I
@mirgee provided https://github.com/lbryio/lbrycrd/pull/172 for a fix if someone wants to use it.
But to err on the safe side, it shall not be merged in case some applications might expect the decode function to behave as it does in Bitcoin.
A proper solution should detect to see if data to print is part of a claim transaction, and always treat that data as hex if that is the case.
No one is depending on this feature so this is not urgent.
fixed via cherry-pick