Skip to content

txnprovider/txpool: verify blob KZG proofs outside the pool lock - #25570

Merged
AskAlexSharov merged 7 commits into
mainfrom
alex/txpool_kzg_outside_lock_39
Nov 7, 2026
Merged

AskAlexSharov merged 7 commits into
mainfrom
alex/txpool_kzg_outside_lock_39

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

Bottleneck: VerifyCellProofBatch/VerifyBlobKZGProofBatch ran under p.lock, blocking p2p parsing (IdHashKnown), GetRlp, block building (best()) and OnNewBlock. Fix: verify blob sidecars in prepareTxns between the locked precheck and the locked insert, like SetCode authorizations.

Blob sidecar checks move from validateBlobTxn into prepareTxns, which runs them after the locked precheck and before the locked insert.

Copilot AI left a comment

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.

🟡 Changes recommended

Unwind admission bypasses blob-sidecar validation, allowing a mined transaction without sidecars to trigger a panic or a remote-queue transaction with an unverified sidecar to enter the pool.

1 open issue
What changed in this PR

This PR reduces transaction-pool lock contention by moving blob KZG proof verification into the preparation phase, outside the pool lock.

Changes:

  • Splits locked blob admission checks from sidecar verification.
  • Extends transaction preparation to verify blobs and preserve per-peer short-circuiting after invalid proofs.
  • Updates tests for preparation behavior, invalid-proof rejection, and locked validation.
File Description
txnprovider/​txpool/​pool.go Separates blob sidecar verification from locked admission and preserves checks during database loading.
txnprovider/​txpool/​pool_blob_kzg_shortcircuit_test.go Updates short-circuit tests and adds coverage for the validation split.

Review effort: Balanced

Comment thread txnprovider/txpool/pool.go Resolved

Copilot AI left a comment

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.

🔵 Needs a closer look

Sidecar verification now overlaps concurrent imports and block updates, but focused race-detector validation of these interleavings cannot be run in this review environment.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

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.

🟡 Changes recommended

Remote batches without a peer ID continue verifying blob proofs after the first KZG failure despite later being discarded, wasting verification work and regressing the previous short-circuit behavior.

1 open issue

Review effort: Balanced

Comment thread txnprovider/txpool/pool.go Resolved

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because an unpublished finding indicates the regression test would not detect pool-lock contention returning during sidecar verification.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

# Conflicts:
#	txnprovider/txpool/pool.go
#	txnprovider/txpool/pool_blob_kzg_shortcircuit_test.go
# Conflicts:
#	txnprovider/txpool/pool.go
#	txnprovider/txpool/pool_blob_kzg_shortcircuit_test.go

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues block approval of the change to reduce transaction-pool lock contention.

No open issues 🎉

Review effort: Balanced

@AskAlexSharov
AskAlexSharov marked this pull request as ready for review November 6, 2026 07:17
}
}

func TestBlobKZGVerifiedOutsidePoolLock(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both subtests still pass if prepareTxns verifies sidecars under p.lock, so the lock fix has no guard.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, neither subtest would catch the check moving back under p.lock. A test can only see that from inside the KZG call, so a deterministic guard needs a test hook in production code (txpool has none so far). For now it is structural: in prepareTxns the validateBlobSidecar loop runs after withLockedState returns. If you want the hook-based guard anyway, I will add it in a follow-up.

@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 4563524 Nov 7, 2026
276 checks passed
@AskAlexSharov
AskAlexSharov deleted the alex/txpool_kzg_outside_lock_39 branch November 7, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants