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

blockchain: Introduce v2 module. #1823

Closed
wants to merge 0 commits into from

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Aug 8, 2019

This requires #1820.

NOTE: This PR currently has a replacement for the blockchain module that will need to be updated prior to merging this PR once said module is merged and tagged.


In order to make use of chaincfg/v2, dcrutil/v2, blockchain/stake/v2, database/v2 and txscript/v2, a new major version of blockchain module is required because blockchain/v1 accepts and returns types from all of them in its API.

Since a new major version is required, this also takes the opportunity handle a couple of other items that require a major version bump:

  • Remove the functions, types, return values, and parameters that were previously deprecated
  • Accept a SubsidyCache to use from the caller instead of creating a local one the caller must later query

Consequently, this introduces blockchain/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:

  • Freeze version 1 of the blockchain module use
  • Remove the root module blockchain replace so building the software will still produce binaries based on the v1 module until the v2 module is fully released
  • Use a local constant for the old txscript.CheckForDuplicateHashes optimization toggle
  • Remove the following deprecated items:
    • DisableLog from both blockchain and indexers packages
    • BlockOneCoinbasePaysTokens
    • IsCoinBase
    • IsCoinBaseTx
    • BuildMerkleTreeStore
    • BuildMsgTxMerkleTreeStore
    • SubsidyCache
    • NewSubsidyCache
    • CalcBlockWorkSubsidy
    • CalcStakeVoteSubsidy
    • CalcBlockTaxSubsidy
    • CoinbasePaysTax
    • CalculateAddedSubsidy
    • BestPrevHash
    • TotalSubsidy
    • FetchSubsidyCache
    • HashToBig
    • CompactToBig
    • BigToCompact
    • CalcWork
    • CheckProofOfWork
  • Update to use the following deps:
    • blockchain/stake/v2@v2.0.1
    • chaincfg/v2@v2.2.0
    • database/v2@v2.0.0
    • dcrutil/v2@v2.0.0
    • txscript/v2@v2.0.0
  • Bump the module version to v2
  • Update docs for the new module version

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.


The following table provides a mapping of the removed items to their equivalents to aid consumers in upgrading:

Removed Item New Alternative
DisableLog UseLogger(slog.Disabled)
BlockOneCoinbasePaysTokens no alternative, internal only
IsCoinBase standalone.IsCoinBaseTx
IsCoinBaseTx standalone.IsCoinBaseTx
BuildMerkleTreeStore standalone.CalcTxTreeMerkleRoot
BuildMsgTxMerkleTreeStore standalone.CalcTxTreeMerkleRoot
SubsidyCache standalone.SubsidyCache
NewSubsidyCache standalone.NewSubsidyCache
CalcBlockWorkSubsidy standalone.SubsidyCache.CalcWorkSubsidy
CalcStakeVoteSubsidy standalone.SubsidyCache.CalcStakeVoteSubsidy
CalcBlockTaxSubsidy standalone.SubsidyCache.CalcTreasurySubsidy
CoinbasePaysTax no alternative, internal only
CalculateAddedSubsidy no alternative, internal only
BestPrevHash BestSnapshot.PrevHash
TotalSubsidy BestSnapshot.TotalSubsidy
FetchSubsidyCache standalone.NewSubsidyCache passed to chain via Config
HashToBig standalone.HashToBig
CompactToBig standalone.CompactToBig
BigToCompact standalone.BigToCompact
CalcWork standalone.CalcWork
CheckProofOfWork standalone.CheckProofOfWork

@davecgh davecgh added this to the 1.5.0 milestone Aug 8, 2019
@davecgh davecgh closed this Aug 8, 2019
@davecgh davecgh deleted the blockchain_introduce_v2 branch August 8, 2019 22:50
@davecgh
Copy link
Member Author

davecgh commented Aug 8, 2019

This shows as closed, however, it was merged.

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.

2 participants