Skip to content

feat(starfish): evict pending commit votes via quorum commit index#11392

Merged
polinikita merged 3 commits intostarfish/feat/starfish-hardeningfrom
starfish/feat/restrictions-evict-commit-votes
May 7, 2026
Merged

feat(starfish): evict pending commit votes via quorum commit index#11392
polinikita merged 3 commits intostarfish/feat/starfish-hardeningfrom
starfish/feat/restrictions-evict-commit-votes

Conversation

@polinikita
Copy link
Copy Markdown
Member

@polinikita polinikita commented Apr 30, 2026

Description of change

Bounds the in-memory pending_commit_votes tracker in DagState and tightens the proposal skip paths in Core.

Eviction (issue #11391)

  • Switch pending_commit_votes from VecDeque<CommitVote> to BTreeSet<CommitVote> so eviction uses split_off. Insertion order is preserved (the linearizer produces commits monotonically); insertion dedup is a free side benefit.
  • New field on DagState: last_known_quorum_commit_index: CommitIndex (no Arc<CommitVoteMonitor> reference). Core is the sole holder of the monitor and pushes the value via a setter.
  • evict_pending_commit_votes() drops votes with index <= last_known_quorum_commit_index - gc_depth. Gated on consensus_block_restrictions; no-op otherwise.
  • Eviction is called both from take_commit_votes (proposal path) and from flush() (mirrors the existing pending_acknowledgments pattern).
  • Core refreshes DagState::last_known_quorum_commit_index from CommitVoteMonitor::quorum_commit_index() at three places: Core::try_commit after every successful commit_observer.handle_committed_leaders (regular consensus path); Core::handle_committed_sub_dags_from_fast_sync (fast-sync path); Core::should_propose (right before we propose).

should_propose cleanup (issue #11400)

  • Centralised every skip reason behind a new SkipProposalReason enum + skip_proposal helper, so the core_skipped_proposals metric label space is disjoint and visible in one place.
  • New skip reason behind_quorum_commit_round — the consensus_block_restrictions gate (formerly inside try_new_block) moves up to should_propose.
  • The clock_round <= last_proposed_round recheck moves up too. It is silent (no metric, no debug log) since it fires on every accepted block in a round we have already proposed in — counting it would drown the genuinely interesting reasons.
  • try_new_block now reads clock_round only; all gates are upstream.

Links to any relevant issues

Fixes #11391
Fixes #11400

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • New unit test dag_state::test::test_evict_pending_commit_votes covering: quorum-driven eviction with the flag on; default-field no-op (no setter call); flag-off no-op even with a non-zero field
  • Existing 280 starfish-core lib tests still pass
  • cargo ci-clippy clean across the workspace
  • Patch-specific tests (correctness, functionality coverage)

@iota-ci iota-ci added consensus Issues related to the Core Consensus team core-protocol labels Apr 30, 2026
Base automatically changed from starfish/feat/restrictions-quorum-guard to starfish/feat/starfish-hardening April 30, 2026 09:38
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch 2 times, most recently from 5c1023d to ad1bc5f Compare April 30, 2026 12:08
@polinikita polinikita self-assigned this Apr 30, 2026
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from 31ff1a1 to 279b13a Compare April 30, 2026 12:57
@polinikita polinikita marked this pull request as ready for review April 30, 2026 13:01
@polinikita polinikita requested a review from a team as a code owner April 30, 2026 13:01
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from 279b13a to 58b3b6a Compare April 30, 2026 13:29
@polinikita polinikita force-pushed the starfish/feat/starfish-hardening branch from 7a2a964 to 47c1d00 Compare May 1, 2026 00:08
@polinikita polinikita requested review from a team as code owners May 1, 2026 00:08
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from 58b3b6a to e1bf221 Compare May 1, 2026 00:09
@polinikita polinikita requested review from VorobyevIlya and removed request for a team May 1, 2026 00:14
Comment thread crates/starfish/core/src/core.rs
Comment thread crates/starfish/core/src/core.rs Outdated
Comment thread crates/starfish/core/src/core.rs
Comment thread crates/starfish/core/src/dag_state.rs Outdated
polinikita added 3 commits May 7, 2026 13:31
Bounds the in-memory `pending_commit_votes` tracker in `DagState` by
dropping votes that the network has already certified.

- Switch `pending_commit_votes` from `VecDeque<CommitVote>` to
  `BTreeSet<CommitVote>` so eviction uses `split_off` and insertions
  dedup naturally.
- Add `Option<Arc<CommitVoteMonitor>>` on `DagState`, wired in by
  `Core::new` after construction.
- Add `evict_pending_commit_votes` that drops votes with
  `index <= quorum_commit_index - gc_depth`. Gated on
  `consensus_block_restrictions`.
- Call the eviction from both `take_commit_votes` and `flush()`,
  mirroring the existing `pending_acknowledgments` pattern.

Closes #11391
…tate writes

- Introduce `SkipProposalReason` enum + `label()` for the
  `core_skipped_proposals` metric, mirroring `FastSyncPauseSource`. The
  variant data carries the per-reason context interpolated into the
  corresponding `debug!` line, so the label space and the message
  templates live in one place.
- Extract `Core::skip_proposal` helper that emits the `debug!` line,
  bumps the metric and returns `false`. Each `should_propose` early
  return collapses from ~6 lines to 1–4.
- Merge the two adjacent `dag_state.write()` acquisitions in
  `try_commit_inner` under one guard.
- Reword the upstream-eligibility comment in `try_new_block`.
@polinikita polinikita force-pushed the starfish/feat/restrictions-evict-commit-votes branch from e1bf221 to 957641c Compare May 7, 2026 11:39
@polinikita polinikita requested review from a team as code owners May 7, 2026 11:39
@github-actions github-actions Bot added documentation Improvements or additions to documentation ci Issues related to our CI pipeline labels May 7, 2026
@polinikita polinikita force-pushed the starfish/feat/starfish-hardening branch from 47c1d00 to b0db814 Compare May 7, 2026 11:51
@polinikita polinikita requested review from VorobyevIlya and piotrm50 and removed request for a team, DaughterOfMars, alexsporn, muXxer and thibault-martinez May 7, 2026 11:51
@polinikita polinikita removed documentation Improvements or additions to documentation ci Issues related to our CI pipeline labels May 7, 2026
@polinikita polinikita merged commit efc19ec into starfish/feat/starfish-hardening May 7, 2026
3 checks passed
@polinikita polinikita deleted the starfish/feat/restrictions-evict-commit-votes branch May 7, 2026 13:07
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(core): evict pending commit votes via CommitVoteMonitor quorum index

4 participants