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

Fold the keyDeposit into the UMap #3217

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Fold the keyDeposit into the UMap #3217

merged 1 commit into from
Jan 5, 2023

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Dec 16, 2022

We change the Rewards View of the UMap so that it map to a Reward-Deposit-Pair, so the single view stores both
the reward amount (a (CompactForm Coin)) for a staking credential, and a deposit amount (a (CompactForm Coin))
for the same credential.

Because we have UMap version of deposits, we no longer need the dsDeposits field for DState. It was removed.

The purpose of this PR is to save space, as there are millions of staking credentials, Since we are using compact coins, this should take about 1 extra Word64 per credential for deposits, and 2 less Word64 per credential for rewards (which used to be Coin). So this actually uses less memory.

A few things in the tools Cardano.Ledger.State.Query will need to fixed in a follow on PR

@TimSheard TimSheard force-pushed the ts-keydeposit-intoUMap branch from 8abf077 to 6378a36 Compare December 20, 2022 22:16
@TimSheard TimSheard changed the title WIP fold the keyDeposit into the UMap Fold the keyDeposit into the UMap Dec 20, 2022
@TimSheard TimSheard force-pushed the ts-keydeposit-intoUMap branch 2 times, most recently from c916bad to c80a94a Compare December 21, 2022 15:55
Copy link
Contributor

@JaredCorduan JaredCorduan 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 to me, thank you Tim! I made a few comments, but only very minor stuff.

@TimSheard TimSheard force-pushed the ts-keydeposit-intoUMap branch 2 times, most recently from e39b82e to 625f1ae Compare January 3, 2023 19:58
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.

This looks great! Few suggestions, some more important than others, but nothing that is blocking this PR.

@TimSheard TimSheard force-pushed the ts-keydeposit-intoUMap branch from 7233960 to 6c180a7 Compare January 4, 2023 20:14
Data.UMap(UMap). It will store a Word64 instead of a Coin, and its
interface uses (CompactForm Coin) which is a newtype around a Word64.
Defined the dsUnified field of DState to be this new UMap.
Updated all uses to this new interface.
Changed UMapCompact to roll key deposits into the Unified map.
Removed dsDeposits in DState, fixed code to use new UMap version of deposit map.
Changed DState CBOR, golden encoding, added changelog entries
@lehins lehins force-pushed the ts-keydeposit-intoUMap branch from 6c180a7 to 039c042 Compare January 4, 2023 23:55
@lehins lehins merged commit 6ac1edd into master Jan 5, 2023
@iohk-bors iohk-bors bot deleted the ts-keydeposit-intoUMap branch January 5, 2023 01:48
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