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

primitives: Add subsidy calcs. #2920

Merged
merged 2 commits into from
Apr 25, 2022
Merged

Commits on Apr 25, 2022

  1. primitives: Add subsidy calcs.

    This implements a subsidy cache with funcs to calculate subsidies for
    proof-of-work, votes, and the treasury and includes a full suite of
    tests.
    
    It consists of ports of the related code in blockchain/standalone with
    the following modifications:
    
    - Removes the subsidy split parameters from SubsidyParams since the
      chaincfg implementations are deprecated
      - Uses hard-coded constants for the PoW, PoS, and treasury splits both
        prior to and after the activation of DCP0010
    - Removes the version 1 methods and renames the version 2 variants to
      take their place:
      - CalcWorkSubsidyV2 -> CalcWorkSubsidy
      - CalcStakeVoteSubsidyV2 -> CalcStakeVoteSubsidy
    - Consolidates the tests specific to the decentralized treasury agenda
      into their counterparts
    - Includes additional maintainer notes with the expected way to update
      the code without needing a major module bump should it ever be
      necessary
    davecgh committed Apr 25, 2022
    Configuration menu
    Copy the full SHA
    3257fe1 View commit details
    Browse the repository at this point in the history
  2. primitives: Add subsidy calc benchmarks.

    CalcSubsidyCacheSparse   26023311   45.99 ns/op   0 B/op   0 allocs/op
    CalcWorkSubsidy          21051818   52.12 ns/op   0 B/op   0 allocs/op
    CalcStakeVoteSubsidy     22216708   53.44 ns/op   0 B/op   0 allocs/op
    CalcTreasurySubsidy      22610749   49.78 ns/op   0 B/op   0 allocs/op
    davecgh committed Apr 25, 2022
    Configuration menu
    Copy the full SHA
    7124399 View commit details
    Browse the repository at this point in the history