Skip to content

feat(starfish): GC-based eviction in BlockManager#11402

Draft
polinikita wants to merge 1 commit intostarfish/feat/starfish-hardeningfrom
starfish/feat/block-manager-gc-eviction
Draft

feat(starfish): GC-based eviction in BlockManager#11402
polinikita wants to merge 1 commit intostarfish/feat/starfish-hardeningfrom
starfish/feat/block-manager-gc-eviction

Conversation

@polinikita
Copy link
Copy Markdown
Member

@polinikita polinikita commented Apr 30, 2026

Description of change

Bounds BlockManager's in-memory state by dropping refs the network's GC floor has already passed. An ancestor at or below DagState::gc_round_for_last_commit() cannot influence any not-yet-sequenced block, so retaining it as "missing" or chasing it via HeaderSynchronizer serves no purpose.

  • Adds BlockSuspender::evict_below_round(round_floor). Drops headers_to_fetch entries below the floor; treats every missing_ancestors key below the floor as resolved and reuses the existing recursively_unsuspend_dependents cascade. Returns headers that became fully resolved.
  • Adds BlockManager::maybe_evict_below_gc_floor, called at the top of both try_accept_blocks and try_accept_block_headers. Gated on consensus_block_restrictions and on the floor having advanced since the last call (last_gc_floor_applied field).
  • Filters sub-floor ancestors in find_missing_ancestors so newly arrived headers are not suspended on refs that will never matter.
  • Drops incoming headers whose own round is at or below the floor in filter_out_already_processed_and_sort.
  • Retains suspended_transactions entries above the floor, addressing the existing unbounded-growth TODO at block_manager/mod.rs:45.
  • Five new block_manager_gc_* metrics to make sweep activity visible on Grafana.

The legacy path is preserved verbatim when the flag is off: Option<Round> gates make the round filters true no-ops, and maybe_evict_below_gc_floor short-circuits to a vec![] return before touching DagState.

Links to any relevant issues

Fixes #11401

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes
  • 4 new unit tests in block_suspender.rs: single-dep eviction, mixed (one above/below floor), cascade chain, fetch-list pruning
  • 4 new integration tests in block_manager/mod.rs: header with only old missing ancestors accepted directly, suspended-tx eviction below floor, sweep idempotent when floor unchanged, no-op when flag off
  • All 288 existing starfish-core lib tests still pass

@iota-ci iota-ci added consensus Issues related to the Core Consensus team core-protocol labels Apr 30, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed consensus Issues related to the Core Consensus team core-protocol labels Apr 30, 2026
@polinikita polinikita changed the base branch from develop to starfish/feat/starfish-hardening April 30, 2026 17:24
@polinikita polinikita changed the base branch from starfish/feat/starfish-hardening to starfish/feat/restrictions-evict-commit-votes April 30, 2026 17:25
@polinikita polinikita force-pushed the starfish/feat/block-manager-gc-eviction branch from d976b6d to 33f6a7f Compare April 30, 2026 19:03
@iota-ci iota-ci added consensus Issues related to the Core Consensus team core-protocol labels Apr 30, 2026
@polinikita polinikita self-assigned this Apr 30, 2026
@polinikita polinikita removed documentation Improvements or additions to documentation core-protocol labels Apr 30, 2026
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from 58b3b6a to e1bf221 Compare May 1, 2026 00:09
@polinikita polinikita force-pushed the starfish/feat/block-manager-gc-eviction branch from 33f6a7f to f7bb141 Compare May 1, 2026 00:09
@polinikita polinikita force-pushed the starfish/feat/block-manager-gc-eviction branch 2 times, most recently from 6dc25fa to 788adb9 Compare May 1, 2026 21:08
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from e1bf221 to 957641c Compare May 7, 2026 11:39
Base automatically changed from starfish/feat/restrictions-evict-commit-votes to starfish/feat/starfish-hardening May 7, 2026 13:07
…nded-tx state

Bounds BlockManager's in-memory bookkeeping by dropping refs the network's
GC floor has already passed. An ancestor at or below
`DagState::gc_round_for_last_commit()` cannot influence any not-yet-sequenced
block, so retaining it as 'missing' or chasing it via HeaderSynchronizer
serves no purpose.

- Add `BlockSuspender::evict_below_round(round_floor)`: drops
  `headers_to_fetch` entries below the floor, then treats every
  `missing_ancestors` key below the floor as resolved and reuses
  `recursively_unsuspend_dependents` to cascade. Returns headers that
  became fully resolved.
- Add `BlockManager::maybe_evict_below_gc_floor` called at the top of
  both `try_accept_blocks` and `try_accept_block_headers`, gated on
  `consensus_block_restrictions` and on the floor having advanced since
  the last call (`last_gc_floor_applied` field).
- In `find_missing_ancestors`, skip ancestors at or below the floor.
- In `filter_out_already_processed_and_sort`, drop incoming headers whose
  own round is at or below the floor.
- Also retain `suspended_transactions` entries above the floor, addressing
  the existing unbounded-growth TODO. Same floor as headers — a block at
  or below `gc_round_for_last_commit` cannot be sequenced, so its txs
  cannot reach DagState.
- Five new metrics under the `block_manager_gc_*` prefix to make sweep
  activity visible on Grafana.

Without the hardening flag, behavior is unchanged: `Option<Round>`-typed
gates make the round filters true no-ops in legacy mode.

Closes #11401
@polinikita polinikita force-pushed the starfish/feat/block-manager-gc-eviction branch from 788adb9 to adc0f21 Compare May 7, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consensus Issues related to the Core Consensus team core-protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

starfish(block_manager): GC-based eviction of stale missing-ancestor and suspended-tx state

2 participants