-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Consensus: DIP-0020: Dash opcode updates - OP_CAT and OP_SPLIT. #3824
Consensus: DIP-0020: Dash opcode updates - OP_CAT and OP_SPLIT. #3824
Conversation
4f26da5
to
3c38593
Compare
Opcodes themselves look good but pls note that |
@UdjinM6 Thanks for the quick reaction! If you can, please confirm my understanding that the following should be done here:
|
Correct. Also, pls rebase this PR on top of the latest |
8e9a933
to
09404de
Compare
09404de
to
543522e
Compare
…ctually preserve the DIP0020 flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few things that need to be fixed:
- pls see https://github.com/UdjinM6/dash/commits/pr3824
- do we really need a dedicated
opcodes_tests.cpp
? It looks like all the required tests can be implemented viascript_tests.cpp
+script_test_json
. Or am I missing smth? - pls see an inline question below
But in general, we are moving in the right direction I think :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, utACK 👍
EDIT: re-indexed on testnet with --assumevalid=0
with no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found one tiny issue UdjinM6@38b8127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far so good, one maybe typo?
Also, be aware of the timeline found here #3775, feature freeze on Dec. 7 is approaching quickly. Although that date may get pushed back. |
In the implementation this pr is based on, the mempool is cleared once the new opcodes are enabled. Same with replay protection. See Bitcoin-ABC/bitcoin-abc@f103591#diff-97c3a52bc5fad452d82670a7fd291800bae20c7bc35bb82686c2c0a4ea7b5b98R2610 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one maybe typo?
oh, wow 🙈 typos are fine though, I make them all the time 😄
re-utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 Just two nits, see the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-re-utACK :D
re
... the mempool is cleared once the new opcodes are enabled. ... It's missing here.
This code is in DisconnectTip
, so it's once the new opcodes are disabled because of a reorg
actually. Anyway, dropping the whole mempool sounds like a pretty bad idea imo. Even if a reorg would happen (which is quite rare in Dash btw) the block that would cause it would still activate the proposal, there is no option to not activate it. Reorging 2+ blocks is practically impossible thanks to a combination of a) Dash being the major X11 chain and b) ChainLocks. I think it's safe to avoid nuking the mempool in our case. For BCH it's different for obvious reasons (2% of the dsha256 and no 51% attack protection).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Does it really make sense to break this up into a number of PRs? because really, all of this needs to be merged for v0.17, or none of it. |
Why? I mean, ideally yes, it would be nice to have all of them activated at once but technically speaking, none of them require another one to function correctly, there is no atomicity requirement for DIP0020. |
Either way is fine by me. The main reason I only added two opcodes in this pr was that I was unsure how this will be received, so I didn't want to spend too much time adding all the opcodes. In any case I will be adding the rest of the opcodes soon. |
I'd say let's merge this one and then work on other opcodes in following PR(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why src/test/monolith_opcodes_string.cpp isn't / shouldn't be included?
src/script/interpreter.h
Outdated
@@ -95,6 +95,9 @@ enum | |||
// Signature(s) must be empty vector if a CHECK(MULTI)SIG operation failed | |||
// | |||
SCRIPT_VERIFY_NULLFAIL = (1U << 14), | |||
|
|||
// Enable the opcodes listed in DIP0020 (CAT, SPLIT, etc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe list all opcodes here, no need to open the dip to see them
@@ -34,6 +34,7 @@ typedef enum ScriptError_t | |||
SCRIPT_ERR_INVALID_STACK_OPERATION, | |||
SCRIPT_ERR_INVALID_ALTSTACK_OPERATION, | |||
SCRIPT_ERR_UNBALANCED_CONDITIONAL, | |||
SCRIPT_ERR_INVALID_SPLIT_RANGE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the comment like upstream?
bump |
@PastaPastaPasta About the src/test/monolith_opcodes_string.cpp, we agreed with @UdjinM6 that they were basically doing the same thing the script_tests.cpp are doing so kind of redundant. I think it's fine. |
I'm not sure why not you couldn't have src/test/monolith_opcodes_string.cpp... / why that wouldn't make sense. A bit of test redundancy wouldn't be the end of the world EDIT: okay, I think @UdjinM6 resolved my concerns in slack. Basically, should treat these opcodes as all other opcodes, and other opcodes are only tested in script_tests(.cpp/.json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UdjinM6 what do you think of below?
@PastaPastaPasta not a big fan of the new naming scheme personally tbh, so I'm fine either way |
I don't have a strong prefernce, but I'd like to figure out what style we want to do and follow that |
I don't think a backport PR like this is a good place to apply/enforce these rules. We could maybe start doing this in our own PRs introducing new features though... |
Sounds good, please disregard formatting changes. Imo, please change the negative boolean |
bump :D negative boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
…pay#3824) * DIP-0020: Dash opcode updates - enable OP_CAT and OP_SPLIT (renamed from OP_SUBSTR) * DIP-0020: Dash opcode updates - DEPLOYMENT_V17 activates dip0020 opcodes * Add/tweak MAX_SCRIPT_ELEMENT_SIZE tests for OP_CAT and OP_SPLIT * Check nDefaultMaxNumSize in OP_SPLIT tests * Purify DISABLED_OPCODE tests for OP_CAT and OP_SPLIT, fix DoTest to actually preserve the DIP0020 flag * Fix `warning: '&' within '|' [-Wbitwise-op-parentheses]` * Rework/simplify feature_dip0020_activation.py * DIP-0020: Remove functionally redundant tests. * Fix file permissions for feature_dip0020_activation.py * DIP-0020: fix typo * Update src/test/script_tests.cpp Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> * Update test/functional/feature_dip0020_activation.py Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> * DIP-0020: improve comments * DIP-0020: dont use negative booleans Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
This PR is intended as a partial implementation of https://github.com/dashpay/dips/blob/master/dip-0020.md
Enable and implement OP_CAT.
Rename OP_SUBSTR to OP_SPLIT and implement it.
Copied from https://reviews.bitcoinabc.org/D1097 mentioned in the document.
Idea is to receive feedback on this PR and if positive, proceed with the rest of the disabled opcodes.