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

Consensus: DIP-0020: Dash opcode updates. Remaining dip0020 opcodes #3893

Merged
merged 16 commits into from
Jan 13, 2021

Conversation

tomlaigna
Copy link

As CAT/SPLIT were added, the rest of the opcodes brought out in https://github.com/dashpay/dips/blob/master/dip-0020.md had to follow.

Currently missing script tests for checkdatasig opcodes. The ones added in the reference implementation https://reviews.bitcoinabc.org/D1621 don't work out of the box, seemingly because some changes in the signature format. I will add them when I figure out how they work. Also the unit tests for other opodes have been omitted, but I will reevaluate what may be useful to include.

@tomlaigna tomlaigna force-pushed the remaining-dip0020-opcodes branch 3 times, most recently from 50a6f90 to b465f32 Compare December 28, 2020 15:54
@tomlaigna tomlaigna marked this pull request as ready for review December 28, 2020 18:14
@tomlaigna
Copy link
Author

OP_LEFT and OP_RIGHT are removed and their opcodes are now assigned to OP_NUM2BIN = 0x80 and OP_BIN2NUM = 0x81. The functionality of OP_LEFT and OP_RIGHT was replaced by OP_SPLIT.

Unit tests are again omitted like before as they pretty much check the same stuff as the script tests. But I don't have a strong opinion in here though, as long as everything is covered by tests.

Also using the same activation mechanism as before.

@UdjinM6 UdjinM6 added this to the 17 milestone Dec 29, 2020
@UdjinM6
Copy link

UdjinM6 commented Dec 29, 2020

Looks good overall 👍 I would probably extend json data with some edge cases from cpp unit tests e.g. smth like UdjinM6@3314de6#diff-ef0159635ee0fee8864cd9570a04337cabb63e9c49a9e96d7b746194ecaa427dR936-R941 etc. and move other re-enabled opcode checks to where they belong to like UdjinM6@3314de6#diff-ef0159635ee0fee8864cd9570a04337cabb63e9c49a9e96d7b746194ecaa427dL914 -> UdjinM6@3314de6#diff-ef0159635ee0fee8864cd9570a04337cabb63e9c49a9e96d7b746194ecaa427dR927 like we did for SPLIT and CAT earlier.

@tomlaigna tomlaigna force-pushed the remaining-dip0020-opcodes branch 3 times, most recently from 54d3394 to 5fb32d9 Compare January 4, 2021 09:55
@tomlaigna
Copy link
Author

It was easier for me to just add the unit tests than to try to (re)write the tests to json. I guess extra testing doesn't hurt too much?

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

It was easier for me to just add the unit tests than to try to (re)write the tests to json. I guess extra testing doesn't hurt too much?

Yeah, I was hoping to keep script tests data in one place but it looks like we can't really do this because of some test data being generated on the fly... ok, I guess having some extra won't make much difference in this case, let's keep it as is.

Well, just one tiny issue then, otherwise looks good imo 👍

src/Makefile.test.include Outdated Show resolved Hide resolved
UdjinM6
UdjinM6 previously approved these changes Jan 7, 2021
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

LGTM, utACK 👍

xdustinface
xdustinface previously approved these changes Jan 11, 2021
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

utACK 👍

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

See comments, primarily nits, formatting, comments

src/script/interpreter.cpp Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
@tomlaigna tomlaigna dismissed stale reviews from xdustinface and UdjinM6 via 53f7c09 January 11, 2021 08:44
@tomlaigna
Copy link
Author

Updated formatting, I think i got them all.

@tomlaigna tomlaigna force-pushed the remaining-dip0020-opcodes branch from 7d50781 to 4110572 Compare January 11, 2021 10:19
UdjinM6
UdjinM6 previously approved these changes Jan 11, 2021
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

xdustinface
xdustinface previously approved these changes Jan 11, 2021
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

Sorry, more formatting stuff!

src/script/interpreter.cpp Outdated Show resolved Hide resolved
src/script/interpreter.h Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/script/script.cpp Outdated Show resolved Hide resolved
src/script/script.h Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/dip0020opcodes_tests.cpp Outdated Show resolved Hide resolved
src/test/script_tests.cpp Outdated Show resolved Hide resolved
src/test/script_tests.cpp Outdated Show resolved Hide resolved
@tomlaigna tomlaigna dismissed stale reviews from xdustinface and UdjinM6 via 4982eba January 12, 2021 21:07
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

@tomthoros Looks like you change some unrelated ones also, see below.

src/script/interpreter.h Outdated Show resolved Hide resolved
src/script/interpreter.h Outdated Show resolved Hide resolved
src/test/script_tests.cpp Outdated Show resolved Hide resolved
tomlaigna and others added 3 commits January 12, 2021 23:45
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

utACK

@tomlaigna
Copy link
Author

Whoops got carried away I guess. I see there is some tool to help with formatting, clang-format-diffpy. Haven't tried, but does that format references and brackets, etc as well?

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta PastaPastaPasta merged commit 4ce3635 into dashpay:develop Jan 13, 2021
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 17, 2022
…ashpay#3893)

* DIP-0020: Dash opcode updates - enable AND, OR, XOR

* DIP-0020: Dash opcode updates - enable DIV, MOD

* DIP-0020: Dash opcode updates - enable BIN2NUM, NUM2BIN

* DIP-0020: Dash opcode updates - enable CHECKDATASIG, CHECKDATASIGVERIFY (no tests)

* DIP-0020: Dash opcode updates - fix whitespace

* DIP-0020: Dash opcode updates - add checkdatasig and datacheckdatasigverify json tests

* More AND_OR_XOR tests

* DIP-0020: Dash opcode updates - move opcodes enabled tests around. Add unit tests back

* DIP-0020: Dash opcode updates - sort BITCOIN_TESTS aplhabetically

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting

* DIP-0020: Dash opcode updates - formatting references alignment

* DIP-0020: Dash opcode updates - formatting references alignment

* Update src/script/interpreter.h

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/script/interpreter.h

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/test/script_tests.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
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.

4 participants