Open
Conversation
Extends the periodic eviction component (renamed from `BlockEviction` to `Eviction`) to also evict headers and their receipts. **Eviction rules (symmetric for blocks and headers):** - A hash tagged in `block_tags` protects both the block and the header - A hash tagged in `header_tags` protects both the header and the block - `header_receipts` are removed automatically via `ON DELETE CASCADE`
6d688c2 to
d41f77b
Compare
Gipphe
reviewed
Mar 19, 2026
| getEvictableHeaderHashesQuery = | ||
| Rel8.run . Rel8.select $ do | ||
| header <- Rel8.each HeadersSchema.schema | ||
| hasHeaderTag <- headerHasTag header.hash |
Collaborator
There was a problem hiding this comment.
suggestion: Use Hoard.DB.Schemas.HeaderTags.hashHasTag.
Suggested change
| hasHeaderTag <- headerHasTag header.hash | |
| hasHeaderTag <- HeaderTagsSchema.hashHasTag header.hash |
Gipphe
reviewed
Mar 19, 2026
Comment on lines
+156
to
+160
| headerHasTag :: Rel8.Expr BlockHash -> Rel8.Query (Rel8.Expr Bool) | ||
| headerHasTag hash = Rel8.exists $ do | ||
| tagRow <- Rel8.each HeaderTagsSchema.schema | ||
| where_ $ tagRow.hash ==. hash | ||
| pure tagRow |
Collaborator
There was a problem hiding this comment.
suggestion: Use Hoard.DB.Schemas.HeaderTags.hashHasTag.
Suggested change
| headerHasTag :: Rel8.Expr BlockHash -> Rel8.Query (Rel8.Expr Bool) | |
| headerHasTag hash = Rel8.exists $ do | |
| tagRow <- Rel8.each HeaderTagsSchema.schema | |
| where_ $ tagRow.hash ==. hash | |
| pure tagRow |
Member
Author
There was a problem hiding this comment.
Whoops, I extracted it but forgot to use it :/
Gipphe
reviewed
Mar 19, 2026
Collaborator
There was a problem hiding this comment.
question: Should this file be migrated into test/Integration/Hoard/DB/EvictionSpec.hs?
As in: is it a relic of a HeaderEviction component that existed in the past, or is it just that it makes sense to keep as a separate spec suite?
Member
Author
There was a problem hiding this comment.
Yes, it is. I decided to join the two modules and forgot the specs.
Gipphe
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the eviction component to also evict headers periodically.
HeaderRepo.evictHeadersdeletes headers with no associated tags and returns the count;header_receiptsare removed viaON DELETE CASCADEheader_tagor if their hash appears inblock_tags(i.e. the corresponding block is tagged)BlockEvictioncomponent now calls bothevictBlocksandevictHeaders, reporting counts asevicted.blocks/evicted.headersspan attributes