[Refactor]: Rename Script methods that only work on PreTapScript scripts#22338
[Refactor]: Rename Script methods that only work on PreTapScript scripts#22338sanket1729 wants to merge 1 commit intobitcoin:masterfrom
Conversation
|
Concept ACK Since BIP 342 is implemented in Bitcoin Core, OP_CHECKSIGADD is the last executable opcode now according to my understanding.
Not sure about this part |
To elaborate, right now this is used while parsing scrpitPubkey and ScrpitSig in a Tx. It is impossible for So, the ideal solution would be to somehow pass the script context and enforce that the |
|
Concept ACK |
1 similar comment
|
Concept ACK |
|
Would it be a better idea to split the baby now and make the handling of pre-v1 and v1 scripts different here? |
src/script/script.h
Outdated
There was a problem hiding this comment.
context:
OP_NOP10 = 0xb9,
OP_CHECKSIGADD = 0xba,|
Concept ACK
The main thing to review here is then that this doesn't create any risk for non-tapscript verification. It seems that
I don't think this should even be labeled "consensus"? Or am I missing something. Code review ACK 90f6a623b394e65a34a1918ec67420c899c52bf4 |
I am still learning. Not mixing consensus code with utility code would help me. |
|
I don't think this makes sense? For tapscript, the highest valid opcode is Maybe it would be better to rename |
maflcko
left a comment
There was a problem hiding this comment.
test fails? Maybe needs rebase?
test/script_parse_tests.cpp(53): error: in "script_parse_tests/parse_script": exception std::runtime_error expected but not raised
|
@sanket1729 are you interested in following up here? |
|
@fanquake, sorry I missed this. I will follow up on this in a couple of days. |
Indeed
Agreed, this seems the cleaner way to solve this. |
|
Changed the PR description. I think there might be other places where we implicitly assume script as PreTapScript. For example, there is also a constant |
Constant: MAX_OPCODE -> MAX_OPCODE_PRE_TAPSCRIPT Functions: ParseScript -> ParseScriptPreTapScript ParseOpcode -> ParseOpCodePreTapScript HasValidOps -> HasValidOpsPreTapScript class: OpCodeParser -> PreTapScriptOpCodeParser
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened. |
- This change is not really necessary as MAX_OPCODE check is only really used while decoding transactions, but makes the code more consistent(and correct)The tests that use MAX_OPCODE are not failing because they are under P2SH context(where the OP_CHECKSIGADD is invalid anyways). The comment in the test has been updated to accurately reflect what is going on.Based on Aj's comment, I have changed the PR so that it renames the constants/functions that operate on PreTapScript Scripts.
I don't know if this is the ideal way to separate pre-tapscripts and tapscripts. If the new PR is not useful, feel free to close it.