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

TICKF calculatePoolDistr #3141

Closed
wants to merge 24 commits into from

Conversation

aniketd
Copy link
Contributor

@aniketd aniketd commented Nov 11, 2022

  • Get approval about exhaustiveness of changes required
  • Revert pattern implementation and move calc from within SnapShotRaw to within SnapShots as it was earlier.
  • Update changelog
  • Squash all history and write an elaborate commit message with links to issues

References

Closes #3132

lehins and others added 8 commits July 6, 2022 13:06
It was only intended for TxBody to be causing a deserialization error
on malformed Ptr, not the TxOut in the LedgerState or TxBody in eras prior
to Babbage.
Additionally, a new golden test for the alonzo fee calculation has been
added, using the block from:
IntersectMBO/cardano-node#4228 (comment)
…-release-1-0-0

the alonzo UTxO rule to use alonzo minfee function
I renamed _pstakeMark in the previous message, just so GHC would require me to update every location in which that field was set.

I built everything in `ouroboros-network`, but not in `cardano-node` (I don't have the deps set correctly right now).

This commit undoes the rename. The long term fix (instead of simply squashing
this commit) would be to use PatternSynonyms or some such to ensure the pool
distr thunk is updated everytime the mark snapshot changes.
(One option is to instead add the thunk to each snapshot.)
Esgen and I poked and prodded the rule with pd' sharing.

We do have evidence that it saves time, but:

- I have only witnessed that on in the first few Shelley epoch transitions (209 through 211)

- It didn't make as big of a difference as I had hoped.

This commit is the result of my attempt to truly minimize the amount of
calculation in TICKF. I've got its run-time down to about 10x slower than a
TICKF that doesn't cross an epoch (for 209 through 2011), but there are
significant subtleties to consider, which the comments in this commit only
partly discuss.

***This is an exploratory Proof-Of-Concept only.***
@aniketd aniketd force-pushed the aniketd/nfrisby-share-tickf-calculatepooldistr branch from b247359 to a7dceba Compare November 14, 2022 14:57
@aniketd aniketd requested a review from nfrisby November 14, 2022 19:50
@aniketd
Copy link
Contributor Author

aniketd commented Nov 14, 2022

@nfrisby I have just merged your latest changes on to this one, which remains rebased on top of master. Would really like to have your eyes go over this.

cabal.project Outdated Show resolved Hide resolved
@aniketd aniketd force-pushed the aniketd/nfrisby-share-tickf-calculatepooldistr branch from 643fc77 to 9bf832d Compare November 16, 2022 11:13
With a pattern-synonym for SnapShot to match its new data
constructor SnapShotRaw.

So, point-wise:
1. Move PoolDistr from SnapShots (the collection) to inside each SnapShot
2. Rename the data constructor SnapShot to SnapShotRaw
3. Introduce a pattern-synonym SnapShot with all fields except PoolDistr
to match the new data constructor SnapShotRaw, to allow least change at
sites where the older SnapShot data constructor was used.
4. Now a SnapShot's PoolDistr field can be accessed (without the
pattern-synonym) using ssStakePoolDistr
5. All existing usage of de-constructing SnapShot now uses the pattern-synonym
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.

@nfrisby this commit moves the PoolDistr from the record SnapShots to inside each individual SnapShot as suggested by @TimSheard. I'd be glad to receive both your reviews on this change.

@aniketd aniketd force-pushed the aniketd/nfrisby-share-tickf-calculatepooldistr branch from dca3fc1 to 4c46928 Compare December 1, 2022 12:59
@aniketd aniketd force-pushed the aniketd/nfrisby-share-tickf-calculatepooldistr branch from 4c46928 to 587a306 Compare December 1, 2022 13:18
Remove SnapShotRaw and corresponding pattern synonym.

Particularly, revert 2319c8d.

-----------------------------------------------------------------------

Noting its commit message here for posterity:

Move PoolDistr from SnapShots to SnapShot.

With a pattern-synonym for SnapShot to match its new data
constructor SnapShotRaw.

So, point-wise:
1. Move PoolDistr from SnapShots (the collection) to inside each SnapShot
2. Rename the data constructor SnapShot to SnapShotRaw
3. Introduce a pattern-synonym SnapShot with all fields except PoolDistr
to match the new data constructor SnapShotRaw, to allow least change at
sites where the older SnapShot data constructor was used.
4. Now a SnapShot's PoolDistr field can be accessed (without the
pattern-synonym) using ssStakePoolDistr
5. All existing usage of de-constructing SnapShot now uses the pattern-synonym
@aniketd
Copy link
Contributor Author

aniketd commented Dec 6, 2022

@JaredCorduan I have updated this PR to reflect our latest discussion.

  1. Move PoolDistr back to SnapShots from SnapShot
  2. Remove SnapShotRaw and corresponding pattern synonym

This is ready for your review!

@aniketd aniketd requested review from TimSheard, teodanciu and JaredCorduan and removed request for JaredCorduan, nfrisby and TimSheard December 6, 2022 15:53
@JaredCorduan JaredCorduan mentioned this pull request Dec 13, 2022
6 tasks
@JaredCorduan
Copy link
Contributor

replaced by #3209

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.

earlier thunk for the per-stake-pool stake distribution
5 participants