-
Notifications
You must be signed in to change notification settings - Fork 214
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
[ADP-3031] Simplify checkpoint pruning, take 3 #3988
base: master
Are you sure you want to change the base?
Conversation
04c6b27
to
bce22c4
Compare
f13c81d
to
332bef7
Compare
it "actually prunes checkpoints" $ | ||
property prop_doesPrune | ||
it "keeps the tip of the chain" $ | ||
property prop_keepTip |
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.
if I understand well we are always going to keep
(a) genesis
(b) latest tip
(c) some checkpoints ONLY within stability epoch (I mean this range defined by security parameter that limits depth of rollbacks)
What about adding properties checking that :
(a) genesis cp is always there
(b) after pruning we can only have at most genesis (either it is in stability window or not) and checkpoints within the stability window
(c) variate stability window explicitly ((i) all possible cps are within it, (ii) stability window is proper subset of all possible checkpoints)
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.
What about adding properties checking that :
Well, these properties are properties of the specific policy
argument, not of the extendAndPrune
function. It's enough to test that extendPrune
does use the policy, and then rely on the properties of the specific policy to get a specific result. The specific properties are tested here:
I can add a test that sparseArithmetic
does keep genesis.
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.
I have added a test that sparseArithmetic
does keep genesis.
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.
Nice PR! I like when code cutting > code added :-)
I left some suggestion for additional property tests.
332bef7
to
68ea3ad
Compare
bors merge |
3988: [ADP-3031] Simplify checkpoint pruning, take 3 r=HeinrichApfelmus a=HeinrichApfelmus ### Overview In this pull request, we consolidate and simplify the creation and pruning of checkpoints. Specifically, we introduce a function `extendAndPrune` that computes a delta which * adds new checkpoints * prunes the existing checkpoints based on their block height. ### Details * The mechanism for creating checkpoints has changed. Specifically, when synchronizing the chain far away from the `tip`, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are within `epochStability` of the tip, as we expect rollbacks only then. * The `CheckpointPolicy` is tested in the existing module `Cardano.Wallet.Checkpoints.PolicySpec`. ### Comments * This task evolved out of ADP-1497. Previous attempts to implement this are * #3159 * #3369 ### Issue Number ADP-3031 Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed: |
It looks like some integration tests have become more flaky with this change. 🤔
Investigating. |
3bb2e47
to
06e21e0
Compare
The integration test |
06e21e0
to
750fe7d
Compare
750fe7d
to
6e32039
Compare
pools <- filter won'tRetire . map getApiT . snd <$> | ||
unsafeRequest @[ApiT StakePool] ctx | ||
(Link.listStakePools arbitraryStake) Empty | ||
let pool1:pool2:_ = map (view #id) pools |
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.
good catch and observation!
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.
LGTM!
bors merge |
3988: [ADP-3031] Simplify checkpoint pruning, take 3 r=HeinrichApfelmus a=HeinrichApfelmus ### Overview In this pull request, we consolidate and simplify the creation and pruning of checkpoints. Specifically, we introduce a function `extendAndPrune` that computes a delta which * adds new checkpoints * prunes the existing checkpoints based on their block height. ### Details * The mechanism for creating checkpoints has changed. Specifically, when synchronizing the chain far away from the `tip`, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are within `epochStability` of the tip, as we expect rollbacks only then. * The `CheckpointPolicy` is tested in the existing module `Cardano.Wallet.Checkpoints.PolicySpec`. ### Comments * This task evolved out of ADP-1497. Previous attempts to implement this are * #3159 * #3369 ### Issue Number ADP-3031 Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed: |
bors merge |
3988: [ADP-3031] Simplify checkpoint pruning, take 3 r=HeinrichApfelmus a=HeinrichApfelmus ### Overview In this pull request, we consolidate and simplify the creation and pruning of checkpoints. Specifically, we introduce a function `extendAndPrune` that computes a delta which * adds new checkpoints * prunes the existing checkpoints based on their block height. ### Details * The mechanism for creating checkpoints has changed. Specifically, when synchronizing the chain far away from the `tip`, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are within `epochStability` of the tip, as we expect rollbacks only then. * The `CheckpointPolicy` is tested in the existing module `Cardano.Wallet.Checkpoints.PolicySpec`. ### Comments * This task evolved out of ADP-1497. Previous attempts to implement this are * #3159 * #3369 ### Issue Number ADP-3031 Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed: |
bors merge |
3988: [ADP-3031] Simplify checkpoint pruning, take 3 r=HeinrichApfelmus a=HeinrichApfelmus ### Overview In this pull request, we consolidate and simplify the creation and pruning of checkpoints. Specifically, we introduce a function `extendAndPrune` that computes a delta which * adds new checkpoints * prunes the existing checkpoints based on their block height. ### Details * The mechanism for creating checkpoints has changed. Specifically, when synchronizing the chain far away from the `tip`, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are within `epochStability` of the tip, as we expect rollbacks only then. * The `CheckpointPolicy` is tested in the existing module `Cardano.Wallet.Checkpoints.PolicySpec`. ### Comments * This task evolved out of ADP-1497. Previous attempts to implement this are * #3159 * #3369 ### Issue Number ADP-3031 Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed: |
bors merge |
3988: [ADP-3031] Simplify checkpoint pruning, take 3 r=HeinrichApfelmus a=HeinrichApfelmus ### Overview In this pull request, we consolidate and simplify the creation and pruning of checkpoints. Specifically, we introduce a function `extendAndPrune` that computes a delta which * adds new checkpoints * prunes the existing checkpoints based on their block height. ### Details * The mechanism for creating checkpoints has changed. Specifically, when synchronizing the chain far away from the `tip`, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are within `epochStability` of the tip, as we expect rollbacks only then. * The `CheckpointPolicy` is tested in the existing module `Cardano.Wallet.Checkpoints.PolicySpec`. ### Comments * This task evolved out of ADP-1497. Previous attempts to implement this are * #3159 * #3369 ### Issue Number ADP-3031 Co-authored-by: Heinrich Apfelmus <[email protected]>
Build failed: |
Overview
In this pull request, we consolidate and simplify the creation and pruning of checkpoints.
Specifically, we introduce a function
extendAndPrune
that computes a delta whichbased on their block height.
Details
tip
, at most two checkpoints are kept: genesis and the latest synchronization point. We only keep multiple checkpoints when we are withinepochStability
of the tip, as we expect rollbacks only then.CheckpointPolicy
is tested in the existing moduleCardano.Wallet.Checkpoints.PolicySpec
.Comments
Issue Number
ADP-3031