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

DRepDistr: Iterate over the DRep delegations in UMap #4273

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

aniketd
Copy link
Contributor

@aniketd aniketd commented Apr 17, 2024

Description

Resolves #4233

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

@aniketd aniketd changed the title DRepDistr: iterate over the DRep delegations in UMap. DRepDistr: Iterate over the DRep delegations in UMap Apr 17, 2024
@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 91660d1 to a87f7ff Compare April 17, 2024 14:54
Copy link
Contributor Author

@aniketd aniketd left a comment

Choose a reason for hiding this comment

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

Self-aware TODOs

@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from a87f7ff to 8e755cf Compare April 18, 2024 10:09
@aniketd aniketd requested a review from teodanciu April 18, 2024 10:09
@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 8e755cf to f6fdfbc Compare April 18, 2024 10:24
Copy link
Collaborator

@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.

Unfortunately your solution will not work.

We need to figure out a different one.

@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch 2 times, most recently from 912afa2 to 813612c Compare April 23, 2024 12:17
@aniketd aniketd requested a review from lehins April 23, 2024 12:18
@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 813612c to 710a603 Compare April 23, 2024 12:21
Copy link
Collaborator

@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! Tests could use a little improvement, but nothing that would prevent this PR from being merged

@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 710a603 to 8e64943 Compare April 24, 2024 13:48
@aniketd aniketd requested a review from lehins April 24, 2024 13:50
@aniketd aniketd enabled auto-merge (squash) April 24, 2024 13:51
Copy link
Collaborator

@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.

Some conflicts resolved and one minor change is still needed, but otherwise it is good to go

@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 8e64943 to b8835dc Compare April 25, 2024 12:25
@lehins lehins force-pushed the aniketd/rewards-in-drep-distr branch 2 times, most recently from 4f70b7d to 68b4def Compare April 25, 2024 19:33
@aniketd aniketd disabled auto-merge April 26, 2024 10:07
aniketd added 2 commits April 26, 2024 15:38
The DRepDistr was being calculated by iterating over the StakeDistr,
which meant that delegations that have only rewards and no UTxOs would
be left out. This commit changes the calculation to iterate over the
UMap in chunks instead, adding the corresponding rewards and StakeDistr
in the calculation and producing a DRepDistr for all DReps that are
either registered or one of the eternal ones, irrespective of whether
they have an associated StakeDistr.

Also add `UMap.umElemDRepDelegatedReward` to get only those rewards that
have an active DRep delegation.
Make rewards a result of proposal expiry and pool retirement as it
should be, without directly modified the NewEpochState
@aniketd aniketd force-pushed the aniketd/rewards-in-drep-distr branch from 68b4def to c580fc0 Compare April 26, 2024 10:08
@aniketd aniketd enabled auto-merge April 26, 2024 10:08
@aniketd aniketd merged commit 127efb5 into master Apr 26, 2024
118 of 130 checks passed
@aniketd aniketd deleted the aniketd/rewards-in-drep-distr branch April 26, 2024 13:14
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.

Include rewards accounts in DRep distribution calculation
3 participants