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

Fix Brute force failure #3896

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Fix Brute force failure #3896

merged 1 commit into from
Nov 29, 2023

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Nov 29, 2023

Fixed broken test, test comparing the brute force DRepDistr computation on the first MockChainState of an epoch to the Pulsed DrepDistr on the final MockhainState of the Epoch.

This failed because we need the intermediate NES in the first state, since the LEDGERS rule changes the NES after the TICK rule runs. To do this we changed the internals of MockChainState from this

data MockChainState era = MockChainState
  { mcsNes :: !(NewEpochState era)
  , mcsLastBlock :: !SlotNo
  , mcsCount :: !Int -- Counts the blocks made
  }

to this

data MockChainState era = MockChainState
  { mcsNes :: !(NewEpochState era)
  , mcsTickNes ::  !(NewEpochState era)
  , mcsLastBlock :: !SlotNo
  , mcsCount :: !Int -- Counts the blocks made
  }

This stores the intermediate NewEpochState, after the TICK rule, but before the LEDGERS rule

Description

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

@TimSheard TimSheard requested a review from lehins November 29, 2023 13:32
…n on the first MockChainState of an epoch to the Pulsed DrepDistr on the final MochChainState of the Epoch. Failed because we need the intermediate NES in the first state, since the LEDGERS rule changes the NES after the TICK rule runs.
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.

Beautiful. Simple and elegant

@lehins lehins enabled auto-merge November 29, 2023 18:56
@lehins lehins merged commit 096b772 into master Nov 29, 2023
10 of 26 checks passed
@iohk-bors iohk-bors bot deleted the ts-fix-bruteforce branch November 29, 2023 19:18
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.

2 participants