-
Notifications
You must be signed in to change notification settings - Fork 214
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
Implement new Stake Pool Ranking formulas #3190
Conversation
92adb49
to
83bd65c
Compare
bors try |
tryBuild failed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
|
||
-- | Non-Myopic Pool Member Rewards | ||
-- according to Eq.(3) of Section 5.6.4 in SL-D1. | ||
nonMyopicMemberReward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this one need review as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, no need to worry about that one. Will be phased out anyway, and was taken from / tested in the (now stale) PR #2781
returns = map (\i -> currentROS rewardParams i user) $ Map.elems pools | ||
|
||
w = dt*dt / (25 + dt*dt) :: Rational | ||
dt = fromIntegral $ fromEnum now - fromEnum timeOfDelegation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't remember why we didn't put an Integral instance on EpochNo. Enum is a bit yucky.
Could this be written shorter like this?
dt = fromIntegral $ fromEnum $ now - timeOfDelegation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to, but EpochNo
is a newtype
on Word31
, i.e. an unsigned integer. When testing unrelated stuff on checkpointing, I came to the conclusion that I should avoid the combination of unsigned integers and substraction like the plague. I'm using fromEnum
because it gives a signed Int
here, and then I feel more confident to subtract.
3e9131e
to
8e8596a
Compare
Makes construction of `Percentage` much more convenient.
Co-authored-by: Rodney Lorrimar <[email protected]>
8e8596a
to
992d3af
Compare
bors merge |
Build succeeded: |
Issue number
ADP-1510, ADP-1491
Overview
In this pull request, we implement the new formulas for ranking stake pools. These comprise two numerical quantities and one notification message:
currentROS
= The return of stake (annualized) expected when delegating to the pool right now.saturationROS
= The return of stake (annualized) expected when delegating to the pool if the pool were saturated and had1/k
of the total stake delegated to it, which is the ideal outcome for this pool in the future.While this pull request implements the formulas, it does not yet apply them to actual blockchain data, or expose them via the REST API; this is subject to future pull requests closely related to PR #2781.
However, this pull request also includes code for estimate the pool performance from past pool production data, so that these formulas can also be used in light-mode (Epic ADP-1422). This code was mostly copied from the existing implementation in the cardano-ledger repository.
Details
currentROS
andsaturationROS
has been done manually, as there are no tests that are sufficiently independent of the definition.Comments