-
Notifications
You must be signed in to change notification settings - Fork 292
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
blockchain/stake: Introduce v2 module. #1803
Merged
Merged
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
jrick
reviewed
Jul 26, 2019
jrick
approved these changes
Jul 26, 2019
This serves as the final release of version 1 of the blockchain/stake module. All future releases will be moving to version 2 of the module. Consequently, it bumps the required module version as follows: - github.com/decred/dcrd/blockchain/stake@v1.2.0 It also removes the blockchain/stake override in the root module and updates it so building the software will still produce binaries based on the v1 module until the v2 module is fully released.
This removes the TxSSGenStakeOutputInfo since it is no longer used.
This removes the TxSSRtxStakeOutputInfo since it is no longer used.
This removes SetTxTree since it is no longer used.
This introduces a new interface named StakeParams and updates the functions that currently take a pointer to a chaincfg.Params struct to accept the interface instead. This removes the tight coupling between the two packages at the API boundary and allows callers to easily provide custom values if desired. It also updates the tests to make use of the interface by adding and using a mock stake params struct the implements the new interface. The new struct is defined in terms of a chaincfg.Params for now for convenience, but the interface design means it is possible to define them independently in the future as needed.
This udpates the blockchain/stake module to use v2 of the dcrutil module and v2 of the chaincfg module since dcrutil/v2 requires it. It also updates the tests accordingly. The updated direct dependencies are as follows: - github.com/decred/dcrd/chaincfg/v2@v2.1.0 - github.com/decred/dcrd/dcrutil/v2@v2.0.0
This udpates the blockchain/stake module to use v2 of the txscript module. The updated direct dependencies are as follows: - github.com/decred/dcrd/txscript/v2@v2.0.0
This udpates the blockchain/stake module to use v2 of the database module. The updated direct dependencies are as follows: - github.com/decred/dcrd/database/v2@v2.0.0
This modifies the AddrFromSStxPkScrCommitment function to accept a dcrutil.AddressParams interface instead of a concrete chaincfg.Params to remove the tight coupling between the two packages at the API boundary and allow callers to easily provide custom values if desired. # Please enter the commit message for your changes. Lines starting
davecgh
force-pushed
the
stake_introduce_v2
branch
from
July 28, 2019 19:47
604d021
to
051fa9f
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.
In order to make use of
chaincfg/v2
,dcrutil/v2
, anddatabase/v2
, a new major version of theblockchain/stake
module is required becauseblockchain/stake/v1
accepts and returns types fromchaincfg/v1
,dcrutil/v1
, anddatabase/v1
in its API.Since a new major version is required, this also takes the opportunity to address a few other items that require a new major version as follows:
*chaincfg.Params
in its API funcs which tightly couples it to the specific version ofchaincfg
. This forces major version bumps of theblockchain/stake
module when the major version ofchaincfg
is bumped even if nothing in itblockchain/stake
actually relies on the changes.DisableLog
is deprecated.TxSSGenStakeOutputInfo
is part of the public API, but is no longer used.TxSSRtxStakeOutputInfo
is part of the public API, but is no longer used.SetTxTree
is part of the public API, but is neither used nor needed.Consequently, this introduces
blockchain/stake/v2
which addresses the aforementioned items. A series of individual commits is provided to make the review process easier. Each commit message more thoroughly describes its purpose, but primarily they consist of the following:blockchain/stake
moduleblockchain/stake
override so building the software will still produce binaries based on thev1
module until thev2
module is fully releaseddoc.go
formatting consistent.Hash256PRNG
.DisableLog
.TxSSGenStakeOutputInfo
.TxSSRtxStakeOutputInfo
.SetTxTree
.StakeParams
interface that is limited specifically to the stake-related parameters needed and update all APIs that previously accepted*chaincfg.Params
for that purpose to use the new interface instead.chaincfg
changesdcrutil/v2@v2.0.0
chaincfg/v2@v2.1.0
txscript/v2@v2.0.0
database/v2@v2.0.0
*chaincfg.Params
to accept thedcrutil.AddressParams
interface instead.v2
Finally, it should also be noted that this only introduces the new module and does not update anything to make use of it yet, so building the software will still produce binaries based on the
v1
module.