* Add logic to do aggregated reward distribution
* Fix build and consensus
* add aggregated reward logic
* refactor payouts
* Fix batch scheduling
* test code
* revert test code
* more comments
* [staking] Move reward values from Network pkg to its own
* Refactor code for the move
* Implement logic to accurately set total supply
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Add totalPreStakingNetworkRewards to reward values
* Implement GetTotalTokens for use in other packages
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [core] Move getGenesisSpec to core pkg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [core] Update gen spec docs
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Hook in updateInitialRewardValues on node init
* Add some docs for clarification
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Fix GetCirculatingSupply & GetTotalSupply RPCs
* Updated err msg in staking reward values.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Move GetCirculatingSupply logic into internal pkg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [explorer] Update circulating supply & total supply vals
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Add Localnet rewards val & Errs
* [internal] Make GetCirculatingSupply consistent with WhatPercentStakedNow
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Fix imports
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [consensus] Make PercentageForTimeStamp return 1 for non-mainnet chains
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Fix reward dec math + Testnet testnet vals
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Make all const reward vals ONE instead of ATTO
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [internal] Correct returned value to ONE instead of Atto
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Fix dec precision
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Fix TestGetPreStakingRewardsFromBlockNumber test
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Use TotalInitialTokens instead of TotalPreStakingTokens
* Done so basis is off block 0 to account for phased mainnet release
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [internal] Fix GetCirculatingSupply
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Add 3s block time and change of block reward
* fixes
* add new blocks per epoch for testnet
* remove unused code
* fix 2s changing logic
* enable 2s at epoch 73000 at testnet
* [rosetta] Fix decimal precision on staking transactions
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add GenesisFundsOperation & PreStakingEraBlockRewardsOperation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add special case transaction ID & refactor to use
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Fix block signer mask creation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [staking] Update docs for block reward
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Rename PreStakingEraBlockRewardOperation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add pre-staking block reward txs & refactor special cases
* Add getBlockSigner info
* Rename vars named block to blk for pkg imports
* Add unit tests for block reward formatting
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Fix lint
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add new line to rosetta start msg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [go.mod] Correct go mod
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Make pre-staking block rewards calc same as AccumulateRewardsAndCountSigs
* Change committee to signers for blockSignerInfo
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Add sanity check for pre-staking block reward amount
* Correct network chain for sync status
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rosetta] Improve unpackSpecialCaseTransactionIdentifier unit test
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [reward] Implement tracking rewards for beacon & shardchain (via crosslinks)
* [reward][rpc] Track reward given out per key for validator stats, compose to expose in validator RPC
* [rpc][validator] Extend hmy blockchain validator information
* [availability] Optimize bump count
* [staking][validator][rpc] Remove validator stats rpc, fold into validator information, make existing pattern default behavior
* [slash] Reimplement SetDifference
* [reward][engine][network] Remove bad API from fall, begin setup for Per validator awards
* [header] Custom Marshal header for downstream, remove dev code
* [effective][committee] Factor out EPoS round of computation thereby unification in codebase of EPoS
* [unit-test] Fix semantically wrong validator unit tests, punt on maxBLS key wrt tx-pool test
* [reward] Use excellent singleflight package for caching lookup of subcommittees
* [apr][reward] Begin APR package itself, iterate on iterface signatures
* [reward] Handle possible error from singleflight
* [rpc][validator][reward] Adjust RPC committees, singleflight on votingPower, foldStats into Validator Information
* [apr] Stub out computation of APR
* [effective][committee] Upgrade SlotPurchase with named fields, provide marshal
* [effective] Update Tests
* [blockchain] TODO Remove the validators no longer in committee
* [validator][effective] More expressive string representation of eligibilty, ValidatorRPC explicit say if in committee now
* [rpc] Median-stake more semantic meaningful
* [validator] Iterate on semantic meaning of JSON representation
* [offchain] Make validator stats return explicit error
* [availability] Small typo
* [rpc] Quick visual hack until fix delete out kicked out validators
* [offchain] Delete validator from offchain that lost their slot
* [apr] Forgot to update interface signature
* [apr] Mul instead of Div
* [protocol][validator] Fold block reward accum per vaidator into validator-wrapper, off-chain => on-chain
* [votepower] Refactor votepower Roster, simplify aggregation of network wide rosters
* [votepower][shard] Adjust roster, optimize usage of BLSPublicKey as key, use MarshalText trick
* [shard] Granular errors
* [votepower][validator] Unify votepower data structure with off-chain usage
* [votepower][consensus][validator] Further simplify and unify votepower with off-chain, validator stats
* [votepower] Use RJs naming convention group,overall
* [votepower] Remove Println, do keep enforcing order
* [effective][reward] Expand semantics of eligibility as it was overloaded and confusing, evict old voting power computations
* [apr] Adjust json field name
* [votepower] Only aggregate on external validator
* [votepower] Mistake on aggregation, custom presentation network-wide
* [rpc][validator][availability] Remove parameter, take into account empty snapshot
* [apr] Use snapshots from two, one epochs ago. Still have question on header
* [apr] Use GetHeaderByNumber for the header needed for time stamp
* [chain] Evict > 3 epoch old voting power
* [blockchain] Leave Delete Validator snapshot as TODO
* [validator][rpc][effective] Undo changes to Protocol field, use virtual construct at RPC layer for meaning
* [project] Address PR comments
* [committee][rpc] Move +1 to computation of epos round rather than hack mutation
* [reward] Remove entire unnecessary loop, hook on AddReward. Remove unnecessary new big int
* [votepower][rpc][validator] Stick with numeric.Dec for token involved with computation, expose accumulate block-reward in RPC
* [effective][committee] Track the candidates for the EPoS auction, RPC median-stake benefits
* [node] Add hack way to get real error reason of why cannot load shardchain
* [consensus] Expand log on current issue on nil block
* [apr] Do the actual call to compute for validator's APR
* [committee] Wrap SlotOrder with validator address, manifests in median-stake RPC
* [apr] Incorrect error handle order
* [quorum] Remove incorrect compare on bls Key, (typo), remove redundant error check
* [shard] Add log if stakedSlots is 0
* [apr] More sanity check on div by zero, more lenient on error when dont have historical data yet
* [committee] Remove + 1 on seat count
* [apr] Use int64() directly
* [apr] Log when odd empty nil header
* [apr] Do not crash on empty header, figure out later
* [chain][network] Factor out block reward from internal chain to proper package
* [network] Fill out record intended for RPC
* [staking][network] NewUtilityMetricSnapshot
* [rpc] Merge squash from remote flicker-harmony/pr_rewards
Co-authored-by: flicker-harmony <52401354+flicker-harmony@users.noreply.github.com>