Skip to content

Disable mempool traffic in freeze mode - #3990

Merged
masih merged 6 commits into
mainfrom
masih/freeze-no-broadcast
Aug 25, 2026
Merged

Disable mempool traffic in freeze mode#3990
masih merged 6 commits into
mainfrom
masih/freeze-no-broadcast

Conversation

@masih

@masih masih commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Freeze mode prevents the node from executing future blocks, so transactions accepted through RPC or P2P cannot be committed. Continuing to validate, retain, and gossip them wastes application and network resources and leaves stale transactions in the mempool.

Keep the internal mempool required by block execution, but do not expose it to RPC or start the mempool reactor when freeze mode is enabled.

Freeze mode prevents the node from executing future blocks, so transactions
accepted through RPC or P2P cannot be committed. Continuing to validate, retain,
and gossip them wastes application and network resources and leaves stale
transactions in the mempool.

Keep the internal mempool required by block execution, but do not expose it to
RPC or start the mempool reactor when freeze mode is enabled.
@masih
masih marked this pull request as ready for review August 24, 2026 14:34
@masih masih added the backport release/v6.6 Backport to release v6.6 label Aug 24, 2026
@masih
masih requested a review from codchen August 24, 2026 14:34
@cursor

cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes full-node freeze behavior, RPC write rejection, and P2P channel advertisement; operators running historical archive nodes must understand the new constraints and error responses.

Overview
Freeze mode is tightened so only full nodes can set freeze-height; validator and seed startup now fails if freeze is configured.

When freeze is active, the node stays up for queries but stops accepting mutating RPC: all broadcast_tx_* paths and broadcast_evidence return ErrReadOnly via a new Environment.ReadOnly flag. The internal mempool remains for execution plumbing, but the mempool P2P reactor is not started, and NodeInfo omits the mempool channel so peers are not invited to gossip txs.

Operator-facing text in app.toml, seid start help, and the changelog is updated to describe read-only freeze (query RPC + mempool-backed reads, no tx/evidence submission or mempool gossip).

Reviewed by Cursor Bugbot for commit 0cd4a12. Bugbot is set up for automated code reviews on this repo. Configure here.

@masih
masih requested a review from sei-will August 24, 2026 14:35
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 25, 2026, 12:11 PM

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.27%. Comparing base (d8e2500) to head (0cd4a12).

Files with missing lines Patch % Lines
sei-tendermint/node/node.go 77.77% 1 Missing and 1 partial ⚠️
sei-tendermint/node/public.go 81.81% 1 Missing and 1 partial ⚠️
sei-tendermint/internal/rpc/core/env.go 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3990      +/-   ##
==========================================
- Coverage   59.34%   58.27%   -1.08%     
==========================================
  Files        2278     2179      -99     
  Lines      196008   184466   -11542     
==========================================
- Hits       116326   107492    -8834     
+ Misses      68927    67158    -1769     
+ Partials    10755     9816     -939     
Flag Coverage Δ
sei-chain-pr 54.90% <91.07%> (?)
sei-db 69.80% <ø> (-0.22%) ⬇️
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-cosmos/server/config/config.go 97.80% <ø> (ø)
sei-cosmos/server/config/toml.go 57.14% <ø> (ø)
sei-cosmos/server/start.go 36.16% <100.00%> (+0.23%) ⬆️
sei-tendermint/internal/rpc/core/evidence.go 84.61% <100.00%> (+2.79%) ⬆️
sei-tendermint/internal/rpc/core/mempool.go 41.00% <100.00%> (+1.82%) ⬆️
sei-tendermint/node/setup.go 58.38% <100.00%> (+0.28%) ⬆️
sei-tendermint/internal/rpc/core/env.go 71.87% <75.00%> (+0.06%) ⬆️
sei-tendermint/node/node.go 66.59% <77.77%> (+0.63%) ⬆️
sei-tendermint/node/public.go 75.71% <81.81%> (+3.58%) ⬆️

... and 100 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 07bdb2f. Configure here.

Comment thread sei-tendermint/node/node.go
seidroid[bot]
seidroid Bot previously requested changes Aug 24, 2026

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping the mempool reactor in freeze mode leaves the node advertising MempoolChannel in its NodeInfo, so peer tx gossip lands on a channel the connection does not know and tears the P2P connection down; separately, dropping the RPC mempool makes eth_getTransactionCount(..., "pending") silently return 0. Both need addressing before merge.

Findings: 2 blocking | 1 non-blocking | 2 posted inline

Blockers

  • None at the file/PR level.
  • 2 blocking issue(s) flagged inline on specific lines.

Non-blocking

  • [suggestion] sei_content / txpool_content (evmrpc/txpool.go → UnconfirmedTxs) now returns the error mempool is not available on a frozen node instead of an empty pending set. Returning an empty result would keep read-only RPC consumers working; if erroring is intended, the message could name freeze mode so operators can tell it apart from a misconfigured node.

Comment thread sei-tendermint/node/node.go
Comment thread sei-tendermint/node/node.go Outdated
@masih

masih commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The automated review did not complete; see the failing AI Review check for details.

@masih

masih commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both previously reported blockers are fixed: MempoolChannel is no longer advertised when frozen (so peers won't gossip txs onto an unopened channel), and rpcEnv.Mempool stays populated so pending-nonce reads keep working while only the four broadcast endpoints are gated. Remaining notes are non-blocking: tx admission is disabled from startup rather than from the freeze height (relevant if freeze-height is ever set on a validator), and the operator-facing docs/changelog still describe the old behavior.

Findings: 0 blocking | 3 non-blocking | 1 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] Operator-facing documentation still describes the pre-PR behavior. sei-cosmos/server/config/config.go:117-119 and the freeze-height template comment in sei-cosmos/server/config/toml.go:44-46 both say the node "stops before executing the block while continuing to serve RPC", but broadcast_tx_async|sync|commit (and therefore eth_sendRawTransaction) now fail on a freeze node. Worth updating those comments, and adding a CHANGELOG Unreleased entry — the change is operator- and peer-visible (tx submission errors; MempoolChannel disappears from NodeInfo).
  • 1 suggestion(s)/nit(s) flagged inline on specific lines.
  • 1 non-blocking pre-existing issue(s) listed below under pre-existing issues.

Pre-existing issues

  • [suggestion] Autobahn/giga nodes hit the same channel mismatch this PR fixes for freeze mode: the mempool and its reactor live entirely inside if !gigaEnabled { ... } (sei-tendermint/node/node.go:334), so channel 0x30 is never opened, yet makeNodeInfo still advertises MempoolChannel for them. Benign as long as every peer on an autobahn network is also autobahn (nobody gossips txs), but in a mixed network an inbound mempool packet would fail mconn.Run and tear the connection down. The new mempoolP2PEnabled argument is the natural place to fold this in (!gigaEnabled && freezeHeight == 0).

Comment thread sei-tendermint/node/node.go
@seidroid
seidroid Bot dismissed their stale review August 25, 2026 10:05

Superseded: latest AI review found no blocking issues.

@masih

masih commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Freeze mode is now restricted to full nodes, tx broadcast is gated at the four broadcast_tx_* entry points, the mempool reactor is skipped, and MempoolChannel is only advertised when the reactor actually opened it — the last outstanding review thread (freeze mode on validators) is addressed, docs and CHANGELOG are updated, and the gating covers every RPC path that admits transactions. One non-blocking test-coverage note.

Findings: 0 blocking | 1 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] The CHANGELOG claims Autobahn nodes also stop advertising the mempool channel, and that now falls out of mempoolP2PEnabled defaulting to false when gigaEnabled — but nothing tests it. TestFreezeModeDisablesMempoolTraffic only exercises the freeze path. Since makeNodeInfo is in-package and takes the flag explicitly, a direct unit test asserting byte(mempoolreactor.MempoolChannel) is present for mempoolP2PEnabled=true and absent for false would pin both cases cheaply (sei-tendermint/node/setup.go:630).

@masih

masih commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Freeze mode is now restricted to full nodes, RPC writes are gated at all four broadcast endpoints plus evidence submission via a single requireWritable choke point, and MempoolChannel is advertised only when the reactor that opens it actually exists. One non-blocking test-coverage gap remains.

Findings: 0 blocking | 1 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] The mempoolP2PEnabled=false path is only exercised for freeze mode. Autobahn nodes now also omit MempoolChannel (the flag is set inside the !gigaEnabled branch), and the CHANGELOG advertises that, but no test pins it. makeNodeInfo is in-package and takes the flag explicitly, so a direct unit test asserting byte(mempoolreactor.MempoolChannel) is present for true and absent for false would cover both cases cheaply (sei-tendermint/node/setup.go:630).

@masih
masih added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 50e1129 Aug 25, 2026
71 checks passed
@masih
masih deleted the masih/freeze-no-broadcast branch August 25, 2026 12:50
@seidroid

seidroid Bot commented Aug 25, 2026

Copy link
Copy Markdown

Created backport PR for release/v6.6:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-3990-to-release/v6.6
git worktree add --checkout .worktree/backport-3990-to-release/v6.6 backport-3990-to-release/v6.6
cd .worktree/backport-3990-to-release/v6.6
git reset --hard HEAD^
git cherry-pick -x 50e1129ebfc92487f59067d13daca22c26bcb4b1
git push --force-with-lease

masih added a commit that referenced this pull request Aug 25, 2026
Backport of #3990 to `release/v6.6`.

---------

Co-authored-by: Masih H. Derkani <m@derkani.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants