3Dpass / 3DP

The Implementation of The Ledger of Things Node. Layer 1 decentralized blockchain platform for the tokenization of objects. Proof of Scan protocol. Useful smart-contracts and dApps.
https://3dpass.org/
GNU General Public License v3.0
23 stars 17 forks source link

Mining pools can avoid the mining reward coin lock #70

Closed TacogentP3D closed 9 months ago

TacogentP3D commented 10 months ago

When mining rewards are given out to a pool, each entry in pool's PowStat is given some amount of coins through https://github.com/3Dpass/3DP/blob/110c140a97ac8e726889ff21127adad8f907d0f6/pallets/rewards/src/lib.rs#L409-L414 do_reward_per_account gives up 1 coin unlocked and rest are locked, so if the pool has multiple powstat entries, it will generate up to that number of unlocked coins for each block, allowing you to get all block rewards unlocked instantly. I think that the best fix is instead of giving 1 unlocked coin through each do_reward_per_account call, specifically in https://github.com/3Dpass/3DP/blob/110c140a97ac8e726889ff21127adad8f907d0f6/runtime/src/lib.rs#L457 give a set percentage of the total amount, for example 0.5%, which would sum up to about 1 unlocked coin per block with current rewards. Since validators are also receiving rewards through do_reward_per_account, it should probably have an additional parameter, specifying whether the coins should be locked at all, to keep the current behavior of validators receiving everything unlocked.