Name the reason ASM output is refused for data after OP_RETURN too - #6
Merged
Merged
Conversation
The reason was found from parsed ops, where the data after a top-level OP_RETURN is one opaque op, so a non-minimal push or an unnamed opcode there was reported as 'its ASM reads back as a different script'. The script is now walked byte by byte, the way ASM reads it: a push is non-minimal when its opcode is not the shortest for its length (ASM records only the data).
Owner
Author
|
Reviewed and checked with bsv 9.11.2:
So only the message changed, as described. The accept/refuse decision is identical. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while checking 0.1.2 from the registry. The refusal is correct, but its message was not:
Cause
exactAsmfound the reason from parsed ops. There the data after a top-levelOP_RETURNis one opaque op, so a non-minimal push or an unnamed opcode inside it fell through to the generic message. The old check also compared each push with scriptmin's minimal push. That treats01 05as non-minimal, although ASM writes it as05and reads it back exactly.Change
asmObstacles(buf)walks the bytes the way ASM reads them and reports:OP_PUSHDATA1for under 76 bytes, or an emptyOP_PUSHDATA*);The message comes from those. Only the message changes: whether a script is refused is still decided by reading its ASM back.
6a4c03aabbcc516a4c00516a05aabb516a0105OP_1 OP_RETURN 05Tests
not minimally encodedreason for76756a4c03aabbcc.516a4c00is refused with that reason.npm test: 28/28.