Skip to content

Made autobahn producer use TxMempool#3224

Open
pompon0 wants to merge 45 commits intomainfrom
gprusak-mempool4
Open

Made autobahn producer use TxMempool#3224
pompon0 wants to merge 45 commits intomainfrom
gprusak-mempool4

Conversation

@pompon0
Copy link
Copy Markdown
Contributor

@pompon0 pompon0 commented Apr 10, 2026

Also

  • disabled bunch of reactors unused in autobahn mode.
  • fixed race conditions in mempool processPeerUpdates

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 10, 2026, 6:35 PM

@pompon0 pompon0 changed the base branch from main to gprusak-mempool3 April 10, 2026 11:15
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.16%. Comparing base (1739f29) to head (f5a18e0).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3224      +/-   ##
==========================================
+ Coverage   58.98%   59.16%   +0.17%     
==========================================
  Files        2065     2064       -1     
  Lines      169272   168747     -525     
==========================================
- Hits        99850    99841       -9     
+ Misses      60658    60180     -478     
+ Partials     8764     8726      -38     
Flag Coverage Δ
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-tendermint/internal/autobahn/producer/state.go 75.00% <ø> (-7.36%) ⬇️
sei-tendermint/internal/mempool/mempool.go 69.45% <ø> (-0.24%) ⬇️
sei-tendermint/internal/mempool/tx.go 82.10% <ø> (ø)
sei-tendermint/internal/p2p/giga_router.go 64.66% <ø> (-1.30%) ⬇️
sei-tendermint/node/node.go 58.95% <ø> (-2.79%) ⬇️
sei-tendermint/node/seed.go 44.68% <ø> (-0.59%) ⬇️
sei-tendermint/node/setup.go 66.89% <ø> (-0.83%) ⬇️

... and 47 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.

@pompon0 pompon0 requested review from sei-will and wen-coding April 10, 2026 18:09
Base automatically changed from gprusak-mempool3 to main April 10, 2026 18:29
// overflow, gas limit enforcement no longer works correctly. This preserves the
// historical behavior for backward compatibility.
func (txmp *TxMempool) ReapMaxTxsBytesMaxGas(maxTxs int, maxBytes, maxGasWanted, maxGasEstimated int64) (types.Txs, int64) {
if maxTxs < 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's okay for maxTxs to be equal to 0?


// bytes limit is a hard stop
if maxBytes > -1 && totalSize+size > maxBytes {
if totalSize+size > maxBytes {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious: any reason the bytes and gas checks happen before append but numtx check happens after append?

}

txs, totalGas := s.txMempool.ReapMaxTxsBytesMaxGas(
int(s.cfg.maxTxsPerBlock()), // nolint:gosec // config values fit into int on supported platforms.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Should we just make the first arg of ReapMaxTxsBytesMaxGas uint64 so we don't need a conversion?

int(s.cfg.maxTxsPerBlock()), // nolint:gosec // config values fit into int on supported platforms.
utils.Max[int64](),
int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range.
int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we won't have different maxGasWanted and maxGasEstimated in the future?


txs, totalGas := s.txMempool.ReapMaxTxsBytesMaxGas(
int(s.cfg.maxTxsPerBlock()), // nolint:gosec // config values fit into int on supported platforms.
utils.Max[int64](),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We probably should have maxBytes as well?

Txs: txs,
// TODO: ReapMaxTxsBytesMaxGas does not handle corner cases correctly rn, which actually
// can produce negative total gas. Fixing it right away might be backward incompatible afaict,
// so we leave it as is for now.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should I be worried because I see:
TotalGas: uint64(totalGas), // nolint:gosec // guaranteed to be positive
in the next line?

_ service.Service = (*Reactor)(nil)
)

const MempoolChannel p2p.ChannelID = 0x30
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious, how was 0x30 decided?

int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range.
int64(s.cfg.MaxGasPerBlock), // nolint:gosec // config values stay within int64 range.
)
s.txMempool.RemoveTxs(txs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just an observation: I think it's okay here to acquire mutex twice, since if the tx disappeared in between RemoveTxs still work.
But maybe some day we should re-think the mutex use in mempool, it looks correct and efficient to me in the current context, but if we add more and more features then it might be harder to reason.

node.rpcEnv.Router = router
node.shutdownOps = makeCloser(closers)

if !gigaEnabled {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think it might help readability to add comment here why we disable the reactor for Autobahn.

int64(n), // nolint:gosec // autobahn block numbers fit in int64.
blockTxs,
resp.TxResults,
mempool.NopTxConstraintsFetcher,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this mean we don't set constraints for tx any more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants