2

What is the Daedalus Pool Ranking Equation? Where is it defined in open source code?

A seemingly simple question, but hard to find, where the Daedalus pool ranking equation lives. Can anyone tell me exactly where in the code this is defined? I want to trust but verify, and understand.

I've been reading thru here in the github input-output-hk/daedalus, but coming up empty handed. Specifically in ../source/renderer/app/components/staking/stake-pools. I just can't seem to find where the equation exists in the code, although there's many references, such as filtering here.

Theoretically, it is defined as cited in the cardano-ledger, README, Stake pool ranking specification. It also could be the same reference, but here as well ../tree/master/docs/pool-ranking

I just can't seem to close the gap from the theoretical to Daedalus code.

1 Answer 1

2

This data comes from stakePool.nonMyopicMemberRewards, which comes from stakePools, which comes from staking, which comes from the store. This is in the delegation center page code around line 81. So effectively this all happens at the API endpoint where the data that Daedalus uses comes from. The calculation doesn't happen in the Daedalus wallet code.

Here is the call to get the stake pools https://github.com/input-output-hk/daedalus/blob/0c4944dbd650f51d18d4f15add0001bac9f2445c/source/renderer/app/api/staking/requests/getStakePools.ts

The actual ranking appears to be here: https://github.com/input-output-hk/cardano-wallet/blob/4a3aff30f8a6f755115e8492ed0a6909f7bf8b65/lib/wallet/src/Cardano/Pool/Rank.hs#L299

This also might be helpful: https://gist.github.com/ilap/ad088d31e542f73685a3a245b3ad6c50

2
  • 1
    Thanks for the thorough answer! For future readers, after some digging, it looks like the pool score and equation is assigned in the /Rank.hs line 313: github.com/input-output-hk/cardano-wallet/blob/… . Looks like the pool scores and other data is added to a data struct in /Pools.hs
    – TheStophe
    Commented Apr 27, 2023 at 0:57
  • @TheStophe Happy to help. The code can definitely be a bit spread out. I updated my answer to include the link you found.
    – PREEB
    Commented Apr 27, 2023 at 13:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.