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

Implement DRep ratification with an 'always passing' threshold #3636

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

teodanciu
Copy link
Contributor

@teodanciu teodanciu commented Aug 11, 2023

Description

Closes #3612

An example of the computation:

For these Dreps:

D1 -> s1
D2 -> s2
D3 -> s3
D4 -> s4
Abstain -> sA
NoConfidence -> sN

and these votes:

D1 -> Yes
D2 -> No
D3 -> Abstain
D9 -> No  -- This is not in the drep distribution map

We need to compute this ratio in case of an action different from NoConfidence:
s1/(s1 + s2 + s3 + s4 + sA + sN - s3 -sA)
and this one for NoConfidence:
(s1 + sN)/(s1 + s2 + s3 + s4 + sA + sN - s3 -sA)

Because we don't have the ratios precomputed (as is the case for spo stake distribution), instead of folding to get the total and then subtracting the abstains, we fold the distribution and only add what's necessary, depending on the vote and on the action.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@teodanciu teodanciu force-pushed the td/ratify-dreps branch 2 times, most recently from fb159ab to 0191cff Compare August 11, 2023 10:02
@teodanciu teodanciu force-pushed the td/ratify-dreps branch 2 times, most recently from 2805243 to 5b47ee4 Compare August 11, 2023 11:08
Copy link
Contributor

@Soupstraw Soupstraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work so far, could use some re-organizing before merge 👍

@teodanciu
Copy link
Contributor Author

teodanciu commented Aug 11, 2023

An example of the computation:

For these Dreps:

D1 -> s1
D2 -> s2
D3 -> s3
D4 -> s4
Abstain -> sA
NoConfidence -> sN

and these votes:

D1 -> Yes
D2 -> No
D3 -> Abstain
D9 -> No  -- This is not in the drep distribution map

We need to compute this ratio in case of an action different from NoConfidence:
s1/(s1 + s2 + s3 + s4 + sA + sN - s3 -sA)
and this one for NoConfidence:
(s1 + sN)/(s1 + s2 + s3 + s4 + sA + sN - s3 -sA)

Because we don't have the ratios precomputed (as is the case for spo stake distribution), instead of folding to get the total and then subtracting the abstains, we fold the distribution and only add what's necessary, depending on the vote and on the action.

@teodanciu teodanciu force-pushed the td/ratify-dreps branch 2 times, most recently from 5728f20 to a32e1a1 Compare August 11, 2023 12:19
@teodanciu teodanciu force-pushed the td/ratify-dreps branch 3 times, most recently from 9f90f89 to 807ac93 Compare August 11, 2023 14:15
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you.

@teodanciu
Copy link
Contributor Author

Good Haskell lessons from your review @lehins , thank you

@teodanciu teodanciu enabled auto-merge (rebase) August 14, 2023 19:42
@teodanciu teodanciu merged commit 12161e7 into master Aug 14, 2023
9 checks passed
@iohk-bors iohk-bors bot deleted the td/ratify-dreps branch August 14, 2023 22:08
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

Successfully merging this pull request may close these issues.

Implement RATIFY logic for DReps
3 participants