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

Switch BHeader memoization to strict ByteString, but keep the field lazy #3298

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

lehins
Copy link
Collaborator

@lehins lehins commented Feb 14, 2023

Description

It is wrong to have a field used for memoizing the binary representation of the type to be strict, even if the lazy bytestring is used for memoization. It is wrong, because evaluating lazy ByteString to WHNF will force the first chunk of the ByteString, thus causing the first 1KiB of a Block to be immediately serialized upon construction of the BHeader

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu (which can be run with scripts/fourmolize.sh)
  • Cabal files are formatted (which can be done with scripts/cabal-format.sh)
  • Self-reviewed the diff

@lehins lehins requested a review from JaredCorduan February 14, 2023 20:02
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.

LGTM!

@lehins lehins force-pushed the lehins/fix-bheader-memoization branch from 3107a72 to e616338 Compare February 14, 2023 22:47
@lehins lehins enabled auto-merge February 14, 2023 22:47
@lehins lehins merged commit ad11247 into master Feb 15, 2023
@iohk-bors iohk-bors bot deleted the lehins/fix-bheader-memoization branch February 15, 2023 00:24
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.

2 participants