Claim abandon fails - 64: non-mandatory-script-verify-flag (Data push larger than necessary) #242
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#242
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?
When abandoning certain claims, they are rejected by the mempool. Not sure if this is related to the dust issue we saw in the past (https://github.com/lbryio/lbrycrd/issues/186) as the value here is higher.
decoded tx:
@tzarebczan on frequency of this:
It's hard to tell, but I ran into on spee.ch and another user did also a few weeks ago.
happens to 2 claims I tried on spee.ch (out of like 30 that I abaonded)
The transaction with the claim that the above transaction posted by tom is abandoning
I have a wallet file with the claim that has this issue if anyone needs it (sent to @kaykurokawa already)
The error code that is being flagged here is: SCRIPT_ERR_MINIMALDATA , and it is checked here
https://github.com/lbryio/lbrycrd/blob/master/src/script/interpreter.cpp#L210 by function CheckMinimalPush() . This function tries to verify that when pushing data to the stack, the method that is used is of minimal size (as there are multiple ways of pushing data on to the stack, https://en.bitcoin.it/wiki/Script). It is not consensus policy, it is network policy and is called when accepting transaction to the mempool.
The problem originates from the claim that is being abandoned that I posted above, txid: "36fd14100c158cff42d1866121d5e1d16c4760a27dfc68ed5ecac9ab31dbbfa7"
If you check the value component of the name claim on vout:0, you can check it is exactly 255 bytes long. This means that it should use OP_PUSHDATA1 (0x4c) to push the data on to the stack, however OP_PUSHDATA2 (0x4d) is used, and this will trigger the CheckMinimalPush() to return false.
It looks like the current version of Torba handles this properly as seen here: https://github.com/lbryio/torba/blob/master/torba/client/basescript.py#L54 . The above transaction is from June 9th 2018, so I think it was created using the now deprecated lbryum code base.
There is some additional tricky things here as well related to how lbrycrd pareses valid claim transactions. https://github.com/lbryio/lbrycrd/blob/master/src/nameclaim.cpp#L59 . You will notice that claim names and values of size 1 character cannot be pushed onto the stack using, OP_1NEGATE, OP_1, OP_2, ... OP_16 , since these op codes are > OP_PUSHDATA4 . Doing so results in the claim being invalid. It looks like both lbrycrd ( https://github.com/lbryio/lbrycrd/blob/master/src/script/script.h#L438 ) and torba never uses OP_1NEGATE... OP_16 to push claim names and values on to the stack so it should not create invalid claims. However, these kinds of pushes will also get caught by CheckMinimalPush() and will get rejected by network policy.
As for the simple solution, I believe it would be fairly safe to disable this network policy implemented by CheckMinimalPush(), it was originally implemented here
698c6abb25 (diff-be2905e2f5218ecdbe4e55637dac75f3)
for BIP62. BIP62 https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki however has been withdrawn and is replaced by segwit. I believe Bitcoin Core still retains this network policy, I presume just to encourage people to be more efficient in their data pushes.A bit more involved solution would just be to disable CheckMinimalPush() for claim transactions so people can abandon their claims created in lbryum and avoid potential issues with the OP_1NEGATE.. I think this method could also be fine and maybe more preferable.
Related:
https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2014-November/006878.html
https://bitcoincore.org/en/2016/01/26/segwit-benefits/
I put @kaykurokawa 's suggested fix into master. It now disables the minimal push validation on claims.