Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NO MERGE] tapscript: enable OP_CAT #2095

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

halseth
Copy link
Collaborator

@halseth halseth commented Jan 5, 2024

[SHOULD NOT BE MERGED]

Enabling OP_CAT as specified in BIP-CAT

Note this does currently lack any form of activation or flags for disabling it, hence many existing tests will fail.

Should not be merged before BIP is accepted and activation is decided on.

Comment on lines 338 to 339
case OP_CAT:
return true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Does removing this case still throw some error when CAT (0x7e) is being used in a segwitv0 or legacy context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if opcode is being executed without a taproot context, it will fall back to old behavior: 9541657#diff-27954f8a5853761d7c36b3084d7eb53d7c9a6788eac76b4b20dc573f723a8296R1954

txscript/opcode.go Outdated Show resolved Hide resolved
@@ -335,8 +335,6 @@ func (vm *Engine) isBranchExecuting() bool {
// conditional).
func isOpcodeDisabled(opcode byte) bool {
switch opcode {
case OP_CAT:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the discussion in Inquistion, this check must still be triggered for legacy script, since the opcode won't be executed if inside a conditional.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 30ed9ec

@coveralls
Copy link

coveralls commented Feb 26, 2024

Pull Request Test Coverage Report for Build 8535288446

Details

  • 62 of 69 (89.86%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 56.908%

Changes Missing Coverage Covered Lines Changed/Added Lines %
txscript/opcode.go 26 28 92.86%
txscript/script.go 21 26 80.77%
Totals Coverage Status
Change from base Build 8532284036: 0.04%
Covered Lines: 29473
Relevant Lines: 51791

💛 - Coveralls

@halseth
Copy link
Collaborator Author

halseth commented Feb 27, 2024

Updated in line with reference implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants