Skip to content

Conversation

@jordanschalm
Copy link
Member

@jordanschalm jordanschalm commented Nov 26, 2025

This PR refactors the PendingBlockBuffer used by compliance engines to store disconnected blocks.

  • Consolidates Proposal types using generics (similar to Block)
  • Consolidates PendingBlockBuffer using generics, so we have one type-safe implementation
  • Changes the backend of PendingBlockBuffer to use LevelledForest instead of bespoke backend
    • We remove the DropForParentID method, because LevelledForest has no parallel of this (it's a very minor memory optimization, and has the potential to drop unprocessed blocks in a concurrent environment)
  • Adds a ActiveViewRangeSize to the PendingBlockBuffer, which puts an upper limit on what views we will accept when adding blocks.
    • The compliance engine does already have a similar mechanism (SkipNewProposalsThreshold), however including it at the PendingBlockBuffer layer as well is inexpensive and provides a more isolated guarantee that the memory usage is bounded, so I was inclined to include it here as well.

See #8170 for detail.

NOTE: Some of these changes (primarily the test suite) were done with AI (Cursor CLI - Composer 1). I marked commits which were substantially authored by AI with an ai: prefix (just so you are aware -- I have reviewed them 😃).

this should allow removing some type overhead in the BlockBuffer types
@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@jordanschalm jordanschalm marked this pull request as ready for review November 28, 2025 21:40
@jordanschalm jordanschalm requested a review from a team as a code owner November 28, 2025 21:40
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