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

Re enable OP_CAT #39

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

0xBEEFCAF3
Copy link

@0xBEEFCAF3 0xBEEFCAF3 commented Oct 24, 2023

Draft BIP
Basing implementation off Elements PR

Things left todo

  • Use opcode OP_SUCCESS126
  • test: get deployment info functional test
  • test: add to tx_valid.json
  • test: functional test ctv example

@0xBEEFCAF3 0xBEEFCAF3 changed the title [WIP] Re enable op cat [WIP] Re enable OP_CAT Oct 24, 2023
@0xBEEFCAF3 0xBEEFCAF3 marked this pull request as draft October 24, 2023 12:04
@ajtowns
Copy link

ajtowns commented Oct 27, 2023

Oh, I didn't see this PR. Here's what I would expect this to look like: https://github.com/ajtowns/bitcoin/commits/202310-inq25-cat

@0xBEEFCAF3
Copy link
Author

Oh, I didn't see this PR. Here's what I would expect this to look like: https://github.com/ajtowns/bitcoin/commits/202310-inq25-cat

@ajtowns thanks for the reference. I'll get the deployment changes included in this branch.

src/script/interpreter.cpp Outdated Show resolved Hide resolved
@ajtowns ajtowns added this to the 25.x milestone Nov 4, 2023
src/script/interpreter.cpp Outdated Show resolved Hide resolved
@0xBEEFCAF3 0xBEEFCAF3 changed the title [WIP] Re enable OP_CAT Re enable OP_CAT Nov 17, 2023
@0xBEEFCAF3 0xBEEFCAF3 marked this pull request as ready for review December 3, 2023 18:19
@0xBEEFCAF3
Copy link
Author

@ajtowns I'm currently working on getting functional tests for CAT. Modeling it after CTV functional tests. Are there any other major pieces missing before this PR can get merged and activated?

src/script/script.cpp Outdated Show resolved Hide resolved
@ajtowns
Copy link

ajtowns commented Dec 8, 2023

@ajtowns I'm currently working on getting functional tests for CAT. Modeling it after CTV functional tests. Are there any other major pieces missing before this PR can get merged and activated?

Would be ideal to get some unit tests as well, if possible.

Seems like the BIP should get PRed to the bips repo; if it can get assigned a number we can use that in the signet activation path.

@ajtowns
Copy link

ajtowns commented Dec 18, 2023

Lint is failing again

@0xBEEFCAF3
Copy link
Author

Lint is failing again

Thanks! Fixed

@0xBEEFCAF3
Copy link
Author

0xBEEFCAF3 commented Dec 18, 2023

Note: Bip has been added to the bips repo bitcoin/bips#1525

@0xBEEFCAF3
Copy link
Author

@ajtowns Doesn't seem like we're getting a number from Luke anytime soon. How about we use Bip390 for the activation params?

@ajtowns
Copy link

ajtowns commented Jan 17, 2024

@ajtowns Doesn't seem like we're getting a number from Luke anytime soon. How about we use Bip390 for the activation params?

Nah, picking your own bip numbers is just asking for confusion, and there's a bunch of other proposals similarly stalled. Let's just make our own numbering scheme instead; yours is BIN-2024-0001, so the code snippet will become:

    ... = SetupDeployment{
        .year = 2024, .number = 1, .revision = 0,
        .start = ..., .timeout = ...,
    };

I think I've translated your doc to markdown accurately, but if I missed something or there's other tweaks needed, make a PR on that repo?

@ajtowns
Copy link

ajtowns commented Jan 18, 2024

https://github.com/ajtowns/bitcoin/tree/202401-inq25-opcat is a rough suggestion for updating this PR fwiw

@0xBEEFCAF3 0xBEEFCAF3 force-pushed the armin/re-enable-op-cat branch 2 times, most recently from 96cbdcf to c9984ad Compare April 10, 2024 14:01
@0xBEEFCAF3 0xBEEFCAF3 requested a review from ajtowns April 10, 2024 14:49
Copy link

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

It would be good to squash these commits so that each commit just has "this is the way we decided to do things" rather than "we tried it this way, then decided to undo that and do it a different way instead" (eg, 81e31f7 introduces opcat_tests.cpp then 81edc01 removes it)

I guess one option would be to merge this for 25.x now so we can get it activated, and do the squash when rebasing to 27.x?

MAX_PUSH_ERROR,
self.nodes[0].sendrawtransaction,
taproot_op_cat_stack_limit_spend.serialize().hex(),
)
Copy link

Choose a reason for hiding this comment

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

Would probably be good to check 520 bytes works and 521 bytes doesn't, rather than just checking 1024 bytes?

Something like "12345678" DUP DUP CAT DUP CAT DUP CAT DUP CAT DUP CAT CAT for 520 bytes and an additional 1 CAT for 521 bytes?

(These cases are already checked in test/script_tests.cpp though)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah im considering removing that testcase

@halseth
Copy link

halseth commented Apr 19, 2024

It would be good to squash these commits so that each commit just has "this is the way we decided to do things" rather than "we tried it this way, then decided to undo that and do it a different way instead" (eg, 81e31f7 introduces opcat_tests.cpp then 81edc01 removes it)

I guess one option would be to merge this for 25.x now so we can get it activated, and do the squash when rebasing to 27.x?

Strongly agree on squasing before merge.

@0xBEEFCAF3 0xBEEFCAF3 force-pushed the armin/re-enable-op-cat branch 5 times, most recently from efa0219 to 734f342 Compare April 22, 2024 14:25
Copy link

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

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

Some commit contents/ordering comments. Would probably be better to order as:

  • Re-enable OP_CAT
  • Add OP_CAT script_tests unittests
  • op_cat deployment
  • functional tests for OP_CAT
  • clean up discourage flags in validation.cpp

(ie, add the feature without activating; add the tests for the feature; activate it; add the functional tests to check it's activated; cleanup)

Otherwise, lgtm.

@@ -1009,9 +1009,12 @@ bool MemPoolAccept::PolicyScriptChecks(const ATMPArgs& args, Workspace& ws)

const bool ctv_active = DeploymentActiveAfter(m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman, Consensus::DEPLOYMENT_CHECKTEMPLATEVERIFY);
const bool apo_active = DeploymentActiveAfter(m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman, Consensus::DEPLOYMENT_ANYPREVOUT);
const bool opcat_active = DeploymentActiveAfter(m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman, Consensus::DEPLOYMENT_OP_CAT);
Copy link

Choose a reason for hiding this comment

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

This should be part of the "op_cat deployment" commit

src/script/interpreter.cpp Show resolved Hide resolved
test/functional/test_framework/script.py Show resolved Hide resolved
@0xBEEFCAF3
Copy link
Author

@ajtowns
re-order done
Ended up also squashing "clean up discourage flags " into the deployment commit

@ajtowns
Copy link

ajtowns commented Apr 24, 2024

LGTM, ACK c7f053c . Anyone want to find some last minute bugs and make me look like a clown?

@weikengchen
Copy link

One very small concern is whether we REALLY need SCRIPT_VERIFY_DISCOURAGE_OP_CAT, or whether DISCOURAGE is needed.

This is because flags is uint_32. If SCRIPT_VERIFY_OP_CAT takes the spot 26 and SCRIPT_VERIFY_DISCOURAGE_OP_CAT takes the spot 27, then we only have 28, 29, 30, 31 left.

Or, are we planning to make flags uint64_t when we used up all the spots?

(This concern should not be a stopper of this PR)

@weikengchen
Copy link

Actually the question above has been discussed in the club.
https://bitcoincore.reviews/bitcoin-inquisition-39

^ please ignore that concern, it was for transition.

@0xBEEFCAF3
Copy link
Author

Updated 3257a41 to fix this comment #39 (comment)

Copy link

@kallewoof kallewoof left a comment

Choose a reason for hiding this comment

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

LGTM

@ajtowns
Copy link

ajtowns commented Apr 26, 2024

reACK e51aa64

@ajtowns ajtowns merged commit 873573e into bitcoin-inquisition:25.x Apr 26, 2024
1 check passed
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