Skip to content

consensus/istanbul: bound backlog and ROUND CHANGE retention - #1053

Open
da1suk8 wants to merge 2 commits into
kaiachain:devfrom
da1suk8:fix/bound-istanbul-retention
Open

consensus/istanbul: bound backlog and ROUND CHANGE retention#1053
da1suk8 wants to merge 2 commits into
kaiachain:devfrom
da1suk8:fix/bound-istanbul-retention

Conversation

@da1suk8

@da1suk8 da1suk8 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Adds retention limits to the Istanbul future-message backlog and to
roundChangeSet, so that memory used for retained messages stays bounded
regardless of traffic.

  • Bound backlog retention per sender (128 messages / 16 MiB) and globally
    (1024 messages / 128 MiB).
  • Retain only backlog messages within the current sequence + 8, and release both
    the accounting and queue storage once a sender's messages are processed or
    discarded.
  • Retain ROUND CHANGE messages only for the current round through current round
    • 128, with at most requiredMessageCount distinct senders per round bucket.
  • Log retention rejections at Trace, since they are expected under load.

Byte accounting is used alongside message counts because a PREPREPARE carries an
entire block, so a count-only limit does not bound memory.

The quorum and wire protocol are unchanged.

Types of changes

  • 🐛 Bug fix
  • ✨ Non-hardfork changes (node upgrade not required)
  • 💥 Hardfork / consensus-breaking changes
  • 🧪 Test improvements
  • 🧰 CI / build tool
  • ♻️ Chore / Refactor / Non-functional changes

Checklist

  • 📖 I have read the CONTRIBUTING GUIDELINES doc
  • 📝 I have signed in the PR comment I have read the CLA Document and I hereby sign the CLA in first time contribute after having read CLA
  • 🟢 Lint and unit tests pass locally with my changes ($ make test)

Related issues

Complements #1029, which bounds Istanbul message ingress concurrency rather than
retained message memory.

Further comments

Distant ROUND CHANGE entries are rejected rather than evicting retained round
buckets, so that the near-round buckets needed for catch-up are kept. This
intentionally trades catch-up beyond the round window for bounded memory.

Nodes that are behind the backlog sequence window recover through block
synchronization.

Limit retained future messages per sender and globally by count and payload size.

Reject distant future sequences and release backlog accounting when messages leave.
Retain only a bounded future-round window and a quorum of distinct senders per round.

Reject rounds that cannot be represented by the bucket key.
@da1suk8 da1suk8 self-assigned this Aug 27, 2026
@da1suk8
da1suk8 marked this pull request as ready for review August 27, 2026 05:08
@da1suk8 da1suk8 added the do not merge Do not merge just yet label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Do not merge just yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant