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

Lido pushBeacon with _beaconValidators amount for proper reward calculation #128

Closed
ongrid opened this issue Nov 11, 2020 · 0 comments · Fixed by #153
Closed

Lido pushBeacon with _beaconValidators amount for proper reward calculation #128

ongrid opened this issue Nov 11, 2020 · 0 comments · Fixed by #153
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ongrid
Copy link
Contributor

ongrid commented Nov 11, 2020

To implement the new reward algorithm proposed in LIP-3, existing reportEther2 method needs to be re-implemented:

  • The new interface: function pushBeacon(uint128 _beaconValidators, uint256 _beaconBalance) external... now receives the number of validators in beacon validator set
  • Implement getInProcessBalance() method that eturns the total base balance (multiple of 32) of validators in transient state. The value nominated in wei (1e-18 Ether)
  • New reward calculation, that treats validators that are in a transient state to be accounted
  • The reward distribution will happen only in case of positive reward since previous report (rewardBase calculation principles to be changed). RewardBase will be calculated dynamically and not stored. Instead of this, Lido stores previously pushed beaconBalance - lastBeaconBalance.
  • Lido contract becomes epoch-awareness, epochs are checked only in Oracle contract
  • Remove all deprecated code
  • Cosmetic: More clear naming for pushBeacon to avoid confusions with oracles reports
  • Cosmetic: Eth2 and remote renamed to beacon to unify within codebase.
  • Cosmetic: _getTotalControlledEther() will be renamed to getTotalPooledEth()
  • Cosmetic: all introduced entities should have docstrings

Tests:

  • Check transit states when validator becomes visible on beacon (illustrated in spec)
  • Slashing/loss leads to decreasing stETH supply
  • Appearing new validator from the in-fly state doesn't change beaconBalance (illustrated in spec)
  • The reward after loss/slashing would be possible even the balance didn't recover to initial

Solves functional: #110, #4 and cosmetic: #87, #71

@ongrid ongrid added the enhancement New feature or request label Nov 11, 2020
@ongrid ongrid added this to the RC2 milestone Nov 11, 2020
@ongrid ongrid self-assigned this Nov 11, 2020
ongrid added a commit that referenced this issue Nov 12, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71

Related: #110
ongrid added a commit that referenced this issue Nov 14, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
ongrid added a commit that referenced this issue Nov 14, 2020
* Add PushableMock contract
* Add pushBeacon unittests
Related:  #110, #4
ongrid added a commit that referenced this issue Nov 16, 2020
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  #110, #4
ongrid added a commit that referenced this issue Nov 17, 2020
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  #110, #4
lxzrv pushed a commit that referenced this issue Nov 17, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
lxzrv pushed a commit that referenced this issue Nov 17, 2020
* Add PushableMock contract
* Add pushBeacon unittests
Related:  #110, #4
lxzrv pushed a commit that referenced this issue Nov 17, 2020
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  #110, #4
lxzrv pushed a commit that referenced this issue Nov 17, 2020
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  #110, #4
ongrid added a commit that referenced this issue Nov 17, 2020
ongrid added a commit that referenced this issue Nov 17, 2020
ongrid added a commit that referenced this issue Nov 18, 2020
ongrid added a commit that referenced this issue Nov 22, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
ongrid added a commit that referenced this issue Nov 22, 2020
* Add PushableMock contract
* Add pushBeacon unittests

Related:  #110, #4
ongrid added a commit that referenced this issue Nov 22, 2020
ongrid added a commit that referenced this issue Nov 22, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
ongrid added a commit that referenced this issue Nov 22, 2020
* Add PushableMock contract
* Add pushBeacon unittests
Related:  #110, #4
ongrid added a commit that referenced this issue Nov 22, 2020
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  #110, #4
ongrid added a commit that referenced this issue Nov 22, 2020
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  #110, #4
ongrid added a commit that referenced this issue Nov 22, 2020
skozin pushed a commit that referenced this issue Nov 22, 2020
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
skozin pushed a commit that referenced this issue Nov 22, 2020
* Add PushableMock contract
* Add pushBeacon unittests
Related:  #110, #4
skozin pushed a commit that referenced this issue Nov 22, 2020
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  #110, #4
skozin pushed a commit that referenced this issue Nov 22, 2020
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  #110, #4
skozin pushed a commit that referenced this issue Nov 22, 2020
krogla pushed a commit that referenced this issue Jan 26, 2021
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() #71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance #71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: #110
krogla pushed a commit that referenced this issue Jan 26, 2021
* Add PushableMock contract
* Add pushBeacon unittests
Related:  #110, #4
krogla pushed a commit that referenced this issue Jan 26, 2021
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  #110, #4
krogla pushed a commit that referenced this issue Jan 26, 2021
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  #110, #4
krogla pushed a commit that referenced this issue Jan 26, 2021
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
* New pushBeacon func now gets amount of validators visible on beacon
* _getTransientBalance() - calculations based on number of validators
* Amount of validators visible on beacon now come from the oracle.
* Increment number of deposited validators (not sum balance) on deposit.
* Reimplement getTotelControlledEther to getTotalPooledEther() lidofinance#71
* RewardBase calculator and store removed from Lido scope
* The rewards calculated in runtime in pushBeacon, no state modification
* Remove epoch-awareness from Lido (Oracle still epoch-aware)
* Rename remoteEther2 to beaconBalance lidofinance#71
* Rename totalControlledEther to totalPooledEther
* Rename getEther2Stat getBeaconStat

Related: lidofinance#110
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
* Add PushableMock contract
* Add pushBeacon unittests
Related:  lidofinance#110, #4
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
* Improve PushableMock contract
* Extend pushBeacon unittests
Related:  lidofinance#110, #4
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
Extend pushBeacon unittests to cover different cases/combinations
of depositedValidators/beaconValidators/beaconBalances

Related:  lidofinance#110, #4
dechjo pushed a commit to dechjo/lido-dao that referenced this issue Jan 26, 2021
tamtamchik pushed a commit that referenced this issue Sep 30, 2024
….0.0

chore(deps): bump setuptools from 69.5.1 to 70.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant