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

active_slot_coeff ignored in performance calculation. #1188

Closed
1 task done
KtorZ opened this issue Dec 16, 2019 · 0 comments
Closed
1 task done

active_slot_coeff ignored in performance calculation. #1188

KtorZ opened this issue Dec 16, 2019 · 0 comments
Assignees

Comments

@KtorZ
Copy link
Member

KtorZ commented Dec 16, 2019

Context

Information -
Version N/A
Platform All
Installation N/A

From Genesis Praos:

[...]
to be independently selected as a leader for a particular slot sl_j with probability p_i depending only on its relative stake. (In this static-stake analysis, relative stake is simply determined by the genesis block B0.)

The exact relationship between p_i and the relative stake α_i is determined by a parameter f of the protocol which we refer to as the active slots coefficient.

Specifically, p_i = φ_f(α_i) = 1 − ( 1 − f) α_i
[...]

From this, we understand that the probability of being elected is not only proportional to the stake, but also depends on this genesis parameter active slots coefficient (referred to as consensus_genesis_praos_active_slot_coeff in Jörmungandr configuration). This parameter has to be taken into consideration for the performance calculation not to be completely off.

Steps to Reproduce

  1. Query listStakePools API endpoint

Expected behavior

  1. Pools that perform very well (like IOHK ones) have a performance close to 1.

Actual behavior

  1. Their performance is 1/10th of that

Resolution


QA

TOP 10 Pools on Nightly
[
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "IOHK2" },
        "id": "05663389504cd649fdd6cfc406c31872c32399ae6721642245f76946e55bb1fe"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "FRGL" },
        "id": "1171304154a20bd28cae430c7e9c915e5bdc1eec69893dc69d7267be7197ae21"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "IOHK3" },
        "id": "26c1deb80f2e041fe5a6d67d3f4c4b27dde24ea532a11633ec0d6cfc14a880f7"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "RELY" },
        "id": "27793e62100b6fefbbc4ea54af4bfb24454eb7c5e04b5e3ebe191ba0db8efd55"
    },
    {
        "apparent_performance": 1,
        "id": "3f096d23d43efaa13ec6d903304e23a2ef552cc460d39cdb1cafa233bc5394ef"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "HEL" },
        "id": "46221fb809db63e408ce1751196705a88af6e27ccac1acb92b8b705dfbfceb6a"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "COOL" },
        "id": "7062afd7fd83c372fc65438c302f3db23bd3404edc043e4806ec3ba6a486be3b"
    },
    {
        "apparent_performance": 1,
        "id": "8819ca23c3ac6865d6578350de0bcb072e797519410b923d18f56b61370d93ff"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "JBREW" },
        "id": "8ca014edc250a888645dacf3e7803d9bf217148d2534e80ee99257479a074aa2"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "247" },
        "id": "9d16d5dfb84296c54868050e0e9f3130632d9a3fe2aa4febd65cb5235a84557e"
    }
]
All pools performances seen on nightly
0
0.11336765496849342
0.17989919600079335
0.20586241451124396
0.3139972298831227
0.3583264647256367
0.5
0.5451975737056386
0.7106819593189653
0.7227635377048117
0.8973330307767313
0.9052103033417835
0.9480349364235434
0.9507090156555771
0.9583850034019517
0.9816576385996468
1
@KtorZ KtorZ self-assigned this Dec 16, 2019
iohk-bors bot added a commit that referenced this issue Dec 16, 2019
1189: Account for "active slot coefficient" in apparent performance calculation r=Anviking a=KtorZ

# Issue Number

<!-- Put here a reference to the issue this PR relates to and which requirements it tackles -->

#1188 

# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- commit 84c49e4
    Move 'BlockchainParameters' from Primitive.Model -> Primitive.Types
    
    1. No reasons it's define in the Model rather than the types (although we should really break this gigantic .Types into smaller pieces)
    2. Without this, finding a good home for 'ActiveSlotCoefficient' would have been awkward

- commit 3eb5896
    add 'ActiveSlotCoefficient' to blockchain parameters

- commit 7c7dd0a
    Add extra unit test to pools perf illustrating the influence of f
    Currently fails, as expected:
    ```
    1) Cardano.Pool.Metrics.calculatePerformances, golden test cases, 100% stake, coeff=0.1, producing 1/10 blocks => p=1.0
         expected: Just 1.0
          but got: Just 0.1
    ```

- commit cb780de
    take 'active slot coefficient' into account in the apparent performance calculation


# Comments

<!-- Additional comments or screenshots to attach if any -->

<details><summary>TOP 10 Pools on Nightly</summary>

```json
[
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "IOHK2" },
        "id": "05663389504cd649fdd6cfc406c31872c32399ae6721642245f76946e55bb1fe"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "FRGL" },
        "id": "1171304154a20bd28cae430c7e9c915e5bdc1eec69893dc69d7267be7197ae21"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "IOHK3" },
        "id": "26c1deb80f2e041fe5a6d67d3f4c4b27dde24ea532a11633ec0d6cfc14a880f7"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "RELY" },
        "id": "27793e62100b6fefbbc4ea54af4bfb24454eb7c5e04b5e3ebe191ba0db8efd55"
    },
    {
        "apparent_performance": 1,
        "id": "3f096d23d43efaa13ec6d903304e23a2ef552cc460d39cdb1cafa233bc5394ef"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "HEL" },
        "id": "46221fb809db63e408ce1751196705a88af6e27ccac1acb92b8b705dfbfceb6a"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "COOL" },
        "id": "7062afd7fd83c372fc65438c302f3db23bd3404edc043e4806ec3ba6a486be3b"
    },
    {
        "apparent_performance": 1,
        "id": "8819ca23c3ac6865d6578350de0bcb072e797519410b923d18f56b61370d93ff"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "JBREW" },
        "id": "8ca014edc250a888645dacf3e7803d9bf217148d2534e80ee99257479a074aa2"
    },
    {
        "apparent_performance": 1,
        "metadata": { "ticker": "247" },
        "id": "9d16d5dfb84296c54868050e0e9f3130632d9a3fe2aa4febd65cb5235a84557e"
    }
]
```
</details>

<details><summary>All pools performances seen on nightly</summary>

```
0
0.11336765496849342
0.17989919600079335
0.20586241451124396
0.3139972298831227
0.3583264647256367
0.5
0.5451975737056386
0.7106819593189653
0.7227635377048117
0.8973330307767313
0.9052103033417835
0.9480349364235434
0.9507090156555771
0.9583850034019517
0.9816576385996468
1
```
</details>

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: KtorZ <[email protected]>
@KtorZ KtorZ closed this as completed Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant