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

638-Allow next leadership-schedule at 4k/f #639

Conversation

AndrewWestberg
Copy link
Contributor

Changelog

- description: |
    Allow next leadership-schedule at 4k/f
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Fixes 638

How to trust this PR

It's a 1 number change from 3->4. It's trustworthy.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • Self-reviewed the diff

-- Why? Because the stake distribution is stable at this point.
-- k is the security parameter
-- f is the active slot coefficient
let stabilityWindowR :: Rational
stabilityWindowR = fromIntegral (3 * sgSecurityParam sGen) / Ledger.unboundRational (sgActiveSlotsCoeff sGen)
stabilityWindowR = fromIntegral (4 * sgSecurityParam sGen) / Ledger.unboundRational (sgActiveSlotsCoeff sGen)
Copy link
Contributor

@carbolymer carbolymer Sep 16, 2024

Choose a reason for hiding this comment

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

This will break in Babbage, which is still used for example in cardano-testnet. You need to check which era you're in, using sbe. For example

let leaderScheduleWindowConst = caseShelleyToBabbageOrConwayEraOnwards (const 3) (const 4) sbe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@carbolymer
Copy link
Contributor

Reference for 4k/f value in leadership selection in Conway: https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary#epoch-structure

@AndrewWestberg AndrewWestberg force-pushed the amw/638-fix-leadership-schedule-query branch from 7aa8b65 to 57a6ab8 Compare September 16, 2024 20:17
@carbolymer
Copy link
Contributor

@AndrewWestberg can you reformat your changes with:

./scripts/devshell/prettify cardano-api/internal/Cardano/Api/LedgerState.hs

@AndrewWestberg AndrewWestberg force-pushed the amw/638-fix-leadership-schedule-query branch from 57a6ab8 to 88dfc1a Compare September 18, 2024 12:37
@AndrewWestberg
Copy link
Contributor Author

@AndrewWestberg can you reformat your changes with:

./scripts/devshell/prettify cardano-api/internal/Cardano/Api/LedgerState.hs

This is completed.

@Jimbo4350
Copy link
Contributor

Reference for 4k/f value in leadership selection in Conway: https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary#epoch-structure

@AndrewWestberg can you include a comment pointing to this and any other background regarding the 4k/f value.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM - just one comment that needs to be addressed

@AndrewWestberg AndrewWestberg force-pushed the amw/638-fix-leadership-schedule-query branch from 88dfc1a to 7bdd33d Compare September 18, 2024 12:46
@AndrewWestberg
Copy link
Contributor Author

Reference for 4k/f value in leadership selection in Conway: https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/Glossary#epoch-structure

@AndrewWestberg can you include a comment pointing to this and any other background regarding the 4k/f value.

This is resolved.

@carbolymer carbolymer added this pull request to the merge queue Sep 20, 2024
Merged via the queue into IntersectMBO:main with commit 7792eb9 Sep 20, 2024
25 checks passed
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.

3 participants