Correctly parse inscriptions when using minimal opcodes#1769
Correctly parse inscriptions when using minimal opcodes#1769arik-so wants to merge 9 commits intoordinals:masterfrom
Conversation
|
@arik-so, could you provide a short description of the logic used in your changes? |
|
Certainly! In the code, or as a comment on the PR? The point is basically that the documentation suggests using OP_1, OP_2, etc. for the various content property tags. However, the way it's currently being handled, OP_1 would not actually be recognized, because it would match the The set of numeric opcodes ranges from 1-16 (it just so happens that |
|
Thank you for the detailed, clear explanation. I don't think code comments are necessary. However, I do have a couple other questions: what's the logic for using |
|
To answer your first question, the reason I had to make it a Regarding your other question, I don't think |
e205018 to
1081aa5
Compare
|
Couldn't this be solved by using |
|
That would fix the script construction, but not its parsing. As I pointed out in my previous comment, the construction should not be modified until the parsing fix propagates to most It's a followup PR that I hope to make in a couple weeks or so, if/when this one gets merged. |
|
Why won't |
|
Sorry, |
|
Ping! Relaxing this parsing in |
|
Any chance CI might be permitted to run on this PR? |
@arik-so if you could update this PR we'll run CI. We'd like to integrate this for completing the cursed inscriptions handling. |
afa3a5f to
af6508a
Compare
veryordinally
left a comment
There was a problem hiding this comment.
The code to recognize and parse the inscriptions with minimal opcodes looks good to me.
We would need to make these inscriptions cursed, however, as otherwise existing inscription numbers will change. So we need a new type of curse, and then need to percolate a cursed status up from where we handle the minimal opcodes.
A full test would entail comparing an index generated with this PR with a previous index and verifying that all positive inscription numbers remain unchanged (index can be exported with index export into an easily comparable format).
Let me know if you feel like this is something you'd be up to doing, or if I should add it to my backlog.
|
Probably not until this upcoming weekend. If you have pointers towards similar unit tests though, they'd be greatly appreciated! Thanks! |
This would be a test on the full mainnet chain so outside our unit test and integration test framework. I also won't get to this before the weekend, happy to collaborate on this then. |
|
@veryordinally I added cursing to the inscription, but no external curse verification yet. |
42326b3 to
a477f1d
Compare
a477f1d to
5abaf55
Compare
veryordinally
left a comment
There was a problem hiding this comment.
Looks good - will format and resolve conflicts, then verify inscription number correctness.
|
@arik-so Sorry this took me a while to get to. Reviewed the cursed changes, looks good so far. I fixed the formatting so our CI is happy, but noticed your two tests are failing. Could you look into that? |
|
@arik-so Looked like the tests weren't updated for the cursed logic - please check if my changes make sense. Will now run inscription number validation, which will take a day or so. |
|
You are right, they weren't. I didn't make the cursing boolean setting public in the constructor, so the tests for verifying the newly created inscriptions had mismatched internal values for the structs, and time got away from me so I never got around to fixing that. Taking a look at your changes now, thanks! |
|
Your tests look great. I am personally still not super happy about the |
|
See also #1403 |
|
Sorry, been very busy. Will look into the performance penalty issue. |
# Conflicts: # src/inscription.rs
|
Hey @veryordinally, I have modified the pattern matching to only match on the positive push num operators. I suspect having to run op_code.to_u8() on every single op code may have been a contributing factor to the slowdown. |
|
We merged this: #2497 |
see #2 see ordinals/ord#1403 (Use minimal data-pushes) see ordinals/ord#2505 (Make docs more precise) see ordinals/ord#1769 (Correctly parse inscriptions when using minimal opcodes)
Currently, minimal opcodes like OP_1 and OP_2 don't get recognized because all opcode operations that aren't OP_ENDIF result in an invalid inscription error, necessitating that all numeric opcodes be pushed as slices instead. However, that is in violation of BIP 62 motivation §3.