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

multi: Convert to use new stdscript package. #2808

Merged
merged 50 commits into from
Nov 18, 2021

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Nov 15, 2021

This requires ~#2803, #2805, #2807, and #2810.

NOTE: The various go.mod files in the affected modules will need to be updated to use the latest txscript module once the aforementioned prerequisite PRs have landed to avoid issues for external consumers, however, this is otherwise ready for review.


This converts all packages in the repository to make use of the new stdscript package for type determination, address extraction, and required signatures extraction instead of the txscript methods. It also removes the aforementioned txscript methods once they are no longer used.

Since this involves modifications to a large number of packages in the repository, this PR is split into a series of individual commits such that everything builds and passes all tests (except some temporary unused code linter warnings) each step of the way. In order to achieve that goal, each commit updates a single package to use the new package. Finally, all of the unused methods and any associated tests, benchmarks, and examples are then removed one by one.

See each individual commit for more details about each individual change, but the following is a high level overview:

  • Converts the following packages to use the new stdaddr package:
    • internal/mining
    • internal/mempool
    • blockchain/chaingen
    • blockchain/indexers
    • blockchain
    • txscript/sign
    • internal/rpcserver
  • Makes minor modifications for consistency and other cleanup while converting
  • Removes the following exported funcs, types, and constants:
    • txscript.ExtractAtomicSwapDataPushes
    • txscript.GenerateProvablyPruneableOut
    • txscript.MultiSigScript
    • txscript.MultisigRedeemScript
    • txscript.CalcMultiSigStats
    • txscript.IsMultisigScript
    • txscript.IsMultisigSigScript
    • txscript.ExtractPkScriptAltSigType
    • txscript.GetScriptClass
    • txscript.GetStakeOutSubclass
    • txscript.ExtractPkScriptAddrs
    • txscript.MaxDataCarrierSize
    • txscript.ScriptClass
    • txscript.ErrNotMultisigScript
    • txscript.ErrTooManyRequiredSigs
    • txscript.ErrTooMuchNullData

@davecgh davecgh added this to the 1.7.0 milestone Nov 15, 2021
@davecgh davecgh force-pushed the multi_use_stdscript branch 3 times, most recently from 893a3fc to 2c458ce Compare November 16, 2021 04:25
Copy link
Member

@matheusd matheusd left a comment

Choose a reason for hiding this comment

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

Commits tested fine other then the deadcode lint errors.

@davecgh davecgh force-pushed the multi_use_stdscript branch 2 times, most recently from 9df804d to 57b2d76 Compare November 17, 2021 00:38
This converts the internal mining package to use the stdscript package
instead of txscript when working with standard scripts.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This converts the internal mempool package to use the stdscript package
instead of txscript for working with standard scripts.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This converts the chaingen package to use the stdscript package
instead of txscript.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This converts the blockchain package to use the stdscript package
instead of txscript.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This converts the blockchain/indexers package to use the stdscript
package instead of txscript.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This removes the flag for specifying whether or not the treasury is
enabled from the methods that no longer require it.
This converts the txscript/sign package to use the stdscript package
instead of txscript.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This removes the flag for specifying whether or not the treasury is
enabled from the methods that no longer require it.
This converts the internal/rpcserver package to use the stdscript
package instead of txscript.

This is part of a series of commits to convert all packages in the
repository to make use of the new stdscript package.
This removes ExtractAtomicSwapDataPushes and its related
AtomicSwapDataPushes struct along with all of its tests and benchmarks
since it is deprecated and is now available via stdscript.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes GenerateProvablyPruneableOut and its associated tests since
it is no longer used by anything in the repository and is now available
via stdscript.ProvablyPruneableScriptV0.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes MultiSigScript and its associated tests since it is no
longer used by anything in the repository and is now available via
stdscript.MultiSigScript.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes MultisigRedeemScriptFromScriptSig and its associated
benchmark since it is no longer used by anything in the repository and
is now available via stdscript.MultiSigRedeemScriptFromScriptSigV0.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes CalcMultiSigStats and its associated tests and benchmark
since it is no longer used by anything in the repository and is now
available via stdscript.ExtractMultiSigScriptDetailsV0.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes IsMultisigScript and its associated benchmarks since it is
no longer used by anything in the repository and is now available via
stdscript.IsMultiSigScript.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes IsMultisigSigScript and its associated benchmarks since it
is no longer used by anything in the repository and is now available via
stdscript.IsMultiSigSigScript.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ExtractPkScriptAltSigType and its associated benchmark
since it is no longer used by anything in the repository and is now
available via stdscript.ExtractPubKeyAltDetailsV0 or
stdscript.ExtractPubKeyHashAltDetailsV0 although it typically is no
longer needed since stdscript has more fine-grained script types.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes GetScriptClass and its associated tests and benchmarks
since it is no longer used by anything in the repository and is now
available via stdscript.DetermineScriptType.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes pubKeyHashToAddrs since it is no longer used by anything in
the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isTreasuryAddScript since it is no longer used by anything
in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractMultisigScriptDetails since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeChangeScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyHashScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeRevocationScript along with its benchmark since it
is no longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeGenScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStakeSubmissionScript along with its benchmark since it
is no longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractStakeScriptHash since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractStakePubKeyHash since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isNullDataScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyHash since it is no longer used by anything in
the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyAltScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyAltDetails since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyScript along with its benchmark since it is no
longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKey since it is no longer used by anything in the
package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractUncompressedPubKey since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractCompressedPubKey since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isPubKeyHashAltScript along with its benchmark since it is
no longer used by anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes extractPubKeyHashAltDetails since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes isStandardAltSignatureType since it is no longer used by
anything in the package.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes MaxDataCarrierSize since it is no longer used by anything
in the repository and is now available via
stdscript.MaxDataCarrierSizeV0.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ScriptClass and its associated tests since it is no longer
used by anything in the repository and is now available via
stdscript.ScriptType.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ErrNotMultisigScript and its associated stringer test since
it is no longer used by anything in the repository.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ErrTooManyRequiredSigs and its associated stringer test
since it is no longer used by anything in the repository.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
This removes ErrTooMuchNullData and its associated stringer test since
it is no longer used by anything in the repository.

This is part of a series of commits to remove all code related to
standard scripts from txscript.
@davecgh
Copy link
Member Author

davecgh commented Nov 18, 2021

I've updated the various go.mod files in the affected modules to use the latest database, blockchain/stake, and txscript modules to avoid issues for external consumers now that the prerequisite PRs have landed.

@davecgh davecgh merged commit 67d1e95 into decred:master Nov 18, 2021
@davecgh davecgh deleted the multi_use_stdscript branch November 18, 2021 19:12
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