-
Notifications
You must be signed in to change notification settings - Fork 631
CDEC-494: Part two of block consolidation #3491
Conversation
3c7d1ec
to
7189a4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good 👍
|
||
-- This type is a pain in the neck, but we have to live with it forever | ||
-- because this encoding is baked into the system. The best we can do is | ||
-- provide helper functions to minimise the pain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the problems with using the type a bit further (here rather than in the code). How is it baked into the system? Couldn't we have an alternative in Haskell-land that is encoded the same way in the blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further comments added.
db/src/Pos/DB/Block/Epoch.hs
Outdated
-- Consolidate from the check point until the specified 'endEpoch'. If | ||
-- the 'endEpoch' has already been consolidated, return success. | ||
-- On each loop, the check point in the 'MiscDB' is updated. | ||
consoldateLoop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be consolidateLoop
!
lift $ mapM_ deleteOldBlund sihs | ||
|
||
when (ccpEpochIndex nextCcp < endEpoch) $ | ||
loop nextCcp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat :)
7189a4f
to
813f400
Compare
Description
This is probably not documented as well as it could be. Please point out things that you think need documenting.
This PR adds new code, but does not drastically change the operation of the code, but adds a shim layer to the old block storage so that when consolidation is activated, blocks can be retrieved from either the consolidated epoch/index files (if they have been consolidated) or the blund files if they have not.
The consolidation code is really difficult to test because it needs a huge about or environment that is really difficult to set up. I do have a separate program to test consolidation and it does work, and it is possible to retrieve blunds/block/undos that have been consolidated.
Linked issue
https://iohk.myjetbrains.com/youtrack/issue/CDEC-494
Type of change
Developer checklist
Testing checklist
QA Steps
With the code in this PR:
cardano-node
could sync to mainnet from the original genesis block.Screenshots (if available)