-
Notifications
You must be signed in to change notification settings - Fork 285
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
txscript: Standardness vs consensus cleanup. #2666
Merged
davecgh
merged 9 commits into
decred:master
from
davecgh:txscript_standardness_vs_consensus_cleanup
Jun 15, 2021
Merged
txscript: Standardness vs consensus cleanup. #2666
davecgh
merged 9 commits into
decred:master
from
davecgh:txscript_standardness_vs_consensus_cleanup
Jun 15, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dnldd
approved these changes
Jun 14, 2021
rstaudt2
approved these changes
Jun 14, 2021
JoeGruffins
approved these changes
Jun 15, 2021
davecgh
force-pushed
the
txscript_standardness_vs_consensus_cleanup
branch
from
June 15, 2021 05:12
58bf6fc
to
dd75410
Compare
This moves the ContainsStakeOpCodes method to script.go since it is used in consensus code and therefore should not be in standard.go which is only intended for standardness code.
This moves the GenerateSSGenBlockRef method to script.go since it is used in consensus code and therefore should not be in standard.go which is only intended for standardness code. It also moves the associated test to script_test.go to match and does some other misc cleanup such as improving the comments and tests for consistency.
This moves the GenerateSSGenVotes method to script.go since it is used in consensus code and therefore should not be in standard.go which is only intended for standardness code. It also moves the associated test to script_test.go to match and does some other misc cleanup such as improving the comments and tests for consistency.
This separates the test code related to parsing scripts using the human-readable short form used throughout the tests into a separate file so it can more easily be copied into other packages where it might be useful for the tests as well. Allowing it to be copied is preferred to making it part of the public API of some package since it is an ad-hoc format and it is not possible to access test-specific code across package boundaries without making it part of the actual public API.
This removes IsPubKeyHashScript from txscript since it is no longer used as it was only used by the new treasury code from stake which should have been using its internal consensus funcs as is now the case.
This removes IsStakeChangeScriptScript from txscript since it is no longer used as it was only used by the new treasury code from stake which should have been using its internal consensus funcs as is now the case.
This removes PushedData along with its associated test and benchmark from txscript since it is no longer used by anything and hasn't been for quite some time due to the introduction of the zero allocation script tokenizer which allows it to be done by callers more efficiently.
This adds explicit test cases for the consensus-specific IsPayToScriptHash func instead of using the script class tests which are only intended for use by standardness code.
This adds explicit test cases for the consensus-specific isAnyKindOfScriptHash method of the engine instead of using the script class tests which are only intended for use by standardness code
davecgh
force-pushed
the
txscript_standardness_vs_consensus_cleanup
branch
from
June 15, 2021 18:01
dd75410
to
f98e374
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This further separates and cleans up the consensus vs standard demarcation in
txscript
in preparation for ultimately removing all code related to standardness fromtxscript
. See each commit message for details regarding each change.The following is an overview of the changes:
standard.go
toscript.go
since they are used in consensus code:ContainsStakeOpCodes
GenerateSSGenBlockRef
GenerateSSGenVotes
IsPubKeyHashScript
IsStakeChangeScript
PushedData
IsPayToScriptHash
andEngine.isAnyKindOfScriptHash
to use explicit tests instead of using the scriptclass tests which are only intended for use by standardness code