Skip to content

strongly typed clist#3249

Open
pompon0 wants to merge 61 commits intomainfrom
gprusak-mempool6
Open

strongly typed clist#3249
pompon0 wants to merge 61 commits intomainfrom
gprusak-mempool6

Conversation

@pompon0
Copy link
Copy Markdown
Contributor

@pompon0 pompon0 commented Apr 15, 2026

Made clist generic. Also

  • removed unused maxLength
  • made blocking methods of clist respect ctx
  • simplified CheckTx by removing the callback

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 16, 2026, 2:39 PM

@pompon0 pompon0 requested review from sei-will and wen-coding April 15, 2026 08:13
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.28%. Comparing base (9795d18) to head (d3878df).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/rpc/core/mempool.go 68.75% 13 Missing and 2 partials ⚠️
sei-tendermint/internal/mempool/mempool.go 57.89% 7 Missing and 1 partial ⚠️
sei-tendermint/internal/evidence/reactor.go 85.71% 1 Missing and 1 partial ⚠️
sei-tendermint/internal/libs/clist/clist.go 97.82% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3249      +/-   ##
==========================================
+ Coverage   59.26%   59.28%   +0.01%     
==========================================
  Files        2070     2072       +2     
  Lines      169788   169844      +56     
==========================================
+ Hits       100631   100695      +64     
+ Misses      60358    60350       -8     
  Partials     8799     8799              
Flag Coverage Δ
sei-chain-pr 70.29% <81.81%> (?)
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/evidence/pool.go 69.27% <100.00%> (ø)
sei-tendermint/internal/mempool/reactor/reactor.go 84.21% <100.00%> (+3.09%) ⬆️
sei-tendermint/internal/mempool/testonly.go 100.00% <100.00%> (ø)
sei-tendermint/internal/mempool/tx.go 82.29% <ø> (ø)
sei-tendermint/internal/libs/clist/clist.go 88.81% <97.82%> (+7.43%) ⬆️
sei-tendermint/internal/evidence/reactor.go 75.24% <85.71%> (-0.21%) ⬇️
sei-tendermint/internal/mempool/mempool.go 72.63% <57.89%> (-0.19%) ⬇️
sei-tendermint/internal/rpc/core/mempool.go 66.66% <68.75%> (-1.20%) ⬇️

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

next, err := r.evpool.WaitEvidenceFront(ctx)
if err != nil {
panic(fmt.Errorf("failed to convert evidence: %w", err))
return
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 return error some day?

ev := next.Value()
evProto, err := types.EvidenceToProto(ev)
if err != nil {
panic(fmt.Errorf("failed to convert evidence: %w", err))
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: add a comment what this panic will do? (I guess it will close our Gossip to this peer?)


// MaxLength is the max allowed number of elements a linked list is
// allowed to contain.
// If more elements are pushed to the list it will panic.
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 you move this comment as well?

func (e *CElement) detachNext() {
func (e *CElement[T]) Value() T {
e.mtx.RLock()
value := e.value
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.

value in e never changes right? Do we need this lock?

// Deprecated and should be removed in 0.37
func (env *Environment) BroadcastTxAsync(ctx context.Context, req *coretypes.RequestBroadcastTx) (*coretypes.ResultBroadcastTx, error) {
go func() { _ = env.Mempool.CheckTx(ctx, req.Tx, nil, mempool.TxInfo{}) }()
go func() { _, _ = env.Mempool.CheckTx(ctx, req.Tx, mempool.TxInfo{}) }()
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.

This ctx is the request context right? Will it be cancelled once the request is done? Then we run CheckTX in a canclled context?

peerMempoolID := r.ids.GetForPeer(peerID)
// TODO: this function does not call any external code, so panics should not be expected.
defer func() {
if e := recover(); e != nil {
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.

Do we not need this recover() 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.

3 participants