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

DRep expiry update after a contiguous set of epochs with no proposals to vote on #3729

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

aniketd
Copy link
Contributor

@aniketd aniketd commented Sep 14, 2023

Description

Closes #3723

  1. Add vsNumDormantEpochs field to VState.
    1. This field counts the number of contiguous epochs in which the number of active governance proposals that can be voted on remained zero. It will be incremented in every EPOCH if the number of active governance actions that can be voted on continues to remain zero. It will be reset when a new governance proposal is submitted successfully
  2. Prevent DRep expiry when no proposals to vote on.
    1. In EPOCH, we make sure to update the dormant-epochs counter every time we see that the previous epoch didn't have any governance proposals to vote on.
    2. When there is a new governance proposal in a transaction AND the dormant-epochs counter is greater than zero, we
      1. Update the expiry for all DReps by adding the counter
      2. Reset the dormant-epochs counter
    3. We update Api.State.Query.queryDRepState to report the effective DRep expiry information.
    4. Add snapshotsGovStateL to ConwayEraGov
    5. Move asks out of loop in GO
  3. Add ConwayFeatures test for preventing DRep expiry

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

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 job!

@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch from 008bf4e to 25de335 Compare September 14, 2023 16:22
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.

Very nice!!! 👍

eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Gov.hs Outdated Show resolved Hide resolved
eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Gov.hs Outdated Show resolved Hide resolved
@lehins
Copy link
Contributor

lehins commented Sep 14, 2023

@aniketd Needs golden test adjustment, since we added a new field and some other test failures. Not sure what they are about

@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch from 25de335 to 86ffe22 Compare September 15, 2023 10:28
This field counts the number of contiguous epochs in which the number
of active governance proposals that can be voted on, remained zero. It
will be incremented in every EPOCH if the number of active governance
actions that can be voted on, remains zero. It will be reset when a new
governance proposal is submitted successfully.
@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch from 481001f to 9b0a83d Compare September 18, 2023 11:28
In EPOCH, we make sure to update the dormant-epochs counter every time
we see that the previous epoch didn't have any governance proposals to
vote on.

When there is a new governance proposal in a transaction AND the
dormant-epochs counter is greater than zero, we
1. Update the expiry for all DReps by adding the counter
2. Reset the dormant-epochs counter

We update Api.State.Query.queryDRepState to report the effective DRep
expiry information.

Add snapshotsGovStateL to ConwayEraGov

Move asks out of loop in GOV

Update changelogs and bump packages
@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch from 9b0a83d to 9fb1af8 Compare September 18, 2023 11:50
@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch 2 times, most recently from b182e83 to d4a6691 Compare September 19, 2023 14:08
@aniketd aniketd force-pushed the aniketd/no-proposals-drep-expiry-bump branch from d4a6691 to 1b845d1 Compare September 19, 2023 14:09
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.

Beautiful! 🙂

@lehins lehins merged commit 9cdcc08 into master Sep 19, 2023
12 checks passed
@iohk-bors iohk-bors bot deleted the aniketd/no-proposals-drep-expiry-bump branch September 19, 2023 16:19
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.

Avoid DRep expiration when there are no governance proposals
4 participants