DMDcoin / diamond-contracts-core

DMD v4 testnet on-chain logic
Other
7 stars 9 forks source link

automatic reward restaking #43

Closed SurfingNerd closed 3 months ago

SurfingNerd commented 3 years ago

The reward payout functions seems to be very complicated, and there are a lot of voices to simplify that.

    /// @dev The reward amount to be distributed in native coins among participants (the validator and their
    /// delegators) of the specified pool (mining address) for the specified staking epoch.
    mapping(uint256 => mapping(address => uint256)) public epochPoolNativeReward;

It would simplify a lot connected to claiming the reward like

epochsToClaimRewardFrom
_epochsPoolGotRewardFor
claimReward
...

The Restaking Reward solution is so obvious, why has it not been the solution first hand ? Rumors tell that this was changed by POA Network after a first audit round ? Or has it been the case that "send rewards to target address" has been the first solution ?!

Note that automatic reward restaking should be able to bypass the hard limit of 50k staked on one node: https://github.com/DMDcoin/hbbft-posdao-contracts/issues/80

TODO: Implement testing: https://github.com/DMDcoin/honey-badger-testing/issues/95

cryptonit commented 3 years ago

prefered is restaking staked amount is increased each time u part if a reward distribution once every 12 hours if the validat u stake on top is part if active set

the max total stake of validator of 50000 dmd will be ignored at automatic reward restake it can grow above 50k

SurfingNerd commented 2 years ago

Thesis to be confirmed or refuted for implementation: For the block reward system call it is problematic to do transfers to contracts or regular accounts, because it would be a value transfer without a transaction. Currently it is a block reward call as value transfer that includes a internal change of the reward contracts state. This scenario might be a well supported standard scenario in EVM chains, while transfers, that are neigher the block reward transaction nor a regular (inner) transaction are not supported.

cryptonit commented 2 years ago

i agree a value cant leave the contract without a real transaction this means a claim into user address must be a transaction

we should keep the way it works now but utilize bigger blockgaslimits to avoid multiple claims needed