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

txscript: Standardness vs consensus cleanup. #2666

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jun 13, 2021

This further separates and cleans up the consensus vs standard demarcation in txscript in preparation for ultimately removing all code related to standardness from txscript. See each commit message for details regarding each change.

The following is an overview of the changes:

  • Moves the following funcs from standard.go to script.go since they are used in consensus code:
    • ContainsStakeOpCodes
    • GenerateSSGenBlockRef
    • GenerateSSGenVotes
  • Separates test code related to parsing scripts using the human-readable short form used throughout the tests into a separate file
  • Removes the following unused funcs:
    • IsPubKeyHashScript
    • IsStakeChangeScript
    • PushedData
  • Converts tests for IsPayToScriptHash and Engine.isAnyKindOfScriptHash to use explicit tests instead of using the script
    class tests which are only intended for use by standardness code

@davecgh davecgh added this to the 1.7.0 milestone Jun 13, 2021
txscript/standard.go Show resolved Hide resolved
@davecgh davecgh force-pushed the txscript_standardness_vs_consensus_cleanup branch from 58bf6fc to dd75410 Compare June 15, 2021 05:12
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 davecgh force-pushed the txscript_standardness_vs_consensus_cleanup branch from dd75410 to f98e374 Compare June 15, 2021 18:01
@davecgh davecgh merged commit f98e374 into decred:master Jun 15, 2021
@davecgh davecgh deleted the txscript_standardness_vs_consensus_cleanup branch June 15, 2021 18:07
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

4 participants