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

No pipelining of blocks from the future #4310

Closed

Conversation

bartfrenk
Copy link
Contributor

@bartfrenk bartfrenk commented Jan 25, 2023

Description

Updates chain selection to first check for blocks from the future before setting the tentative header. This avoids pipelining blocks from the future.

Checklist

  • Branch
    • Commit sequence broadly makes sense
    • Commits have useful messages
    • The documentation has been properly updated
    • New tests are added if needed and existing tests are updated
    • Self-reviewed the diff
    • Useful pull request description at least containing the following information:
      • What does this PR change?
      • Why these changes were needed?
      • How does this affect downstream repositories and/or end-users?
      • Which ticket does this PR close (if any)? If it does, is it linked?
    • Reviewer requested

@bartfrenk bartfrenk force-pushed the bartfrenk/private-16/no-pipelining-of-future-blocks branch 2 times, most recently from 845fdd9 to b06b8f8 Compare January 26, 2023 09:52
@bartfrenk bartfrenk force-pushed the bartfrenk/private-16/no-pipelining-of-future-blocks branch from b06b8f8 to a81b00e Compare January 26, 2023 09:54
@bartfrenk bartfrenk marked this pull request as ready for review January 26, 2023 09:55
Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mark this PR as Draft? I didn't anticipate that I could do it. I did it.

checkInFuture :: ValidatedFragment (Header blk) (LedgerState blk)
-- > checkInFuture _ af >>= \(af', fut) ->
-- > af == af' <=> null fut
checkInFuture :: LedgerState blk -> AnchoredFragment (Header blk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining the assumptions about the given ledger state and the given fragment.

(hardForkSummary cfg (VF.validatedLedger validated))
now
(VF.validatedFragment validated)
checkInFuture = \ledgerState af -> do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since checkFragment has an error case in it, please add a comment here explaining how the assumptions made by checkInFuture guard this call to checkFragment.

-- Remove future blocks from the chain, and update the ChainDB state
-- that keeps track of those blocks, so we can take them into account
-- in the decision to make blocks available for pipelining.
candidate' <- futureCheckCandidate chainSelEnv candidate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Unless you've figure out a more thorough argument, my understanding was that we would leave the existing future check as-is, and merely add a check to only enable pipelining when the translation is available and isn't in the future. At the moment, this diff seems to me to be removing/changing the existing future check instead of leaving it as-is.

@nfrisby nfrisby marked this pull request as draft January 26, 2023 15:54
-- > checkInFuture vf >>= \(af, fut) ->
-- > validatedFragment vf == af <=> null fut
checkInFuture :: ValidatedFragment (Header blk) (LedgerState blk)
-- > checkInFuture _ af >>= \(af', fut) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could use this opportunity to add more comments to this function (especially the return type).

@nfrisby
Copy link
Contributor

nfrisby commented Jan 30, 2023

@bartfrenk This commit sketches what I think is the minimal possible change: 1bc9135

Does it look sound to you? cc @amesgen

@bartfrenk
Copy link
Contributor Author

Closing in favor of #4334.

@bartfrenk bartfrenk closed this Feb 2, 2023
@bartfrenk bartfrenk mentioned this pull request Feb 2, 2023
7 tasks
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