Skip to content

chore: avoid stored renotify permits in verify queue#5249

Open
chenyukang wants to merge 1 commit into
nervosnetwork:developfrom
chenyukang:security/verify-queue-renotify
Open

chore: avoid stored renotify permits in verify queue#5249
chenyukang wants to merge 1 commit into
nervosnetwork:developfrom
chenyukang:security/verify-queue-renotify

Conversation

@chenyukang

Copy link
Copy Markdown
Collaborator

Problem Summary:

Fix VerifyQueue::re_notify() to wake only currently waiting workers without storing a notification permit.

Previously, re_notify() used notify_one(). When the OnlySmallCycleTx worker found that the queue still contained only large-cycle transactions, notify_one() could store a permit if no other worker was waiting. The same worker could then consume that permit and repeatedly wake itself.

This PR switches re_notify() to notify_waiters(), which preserves the intended handoff behavior while avoiding stored self-wakeup permits.

Related changes

  • PR to update owner/repo:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression
  • Breaking backward compatibility

@chenyukang chenyukang requested a review from a team as a code owner June 18, 2026 02:30
@chenyukang chenyukang requested review from Copilot and zhangsoledad and removed request for a team June 18, 2026 02:30
@chenyukang chenyukang force-pushed the security/verify-queue-renotify branch from 353a9b3 to fa4bcce Compare June 18, 2026 02:31
@chenyukang chenyukang changed the title tx-pool: avoid stored renotify permits chore: avoid stored renotify permits in verify queue Jun 18, 2026

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.

Pull request overview

This PR addresses a tx-pool worker wakeup issue by changing VerifyQueue::re_notify() to avoid accumulating tokio::sync::Notify permits that can cause self-wakeup loops, and adds a regression test for that behavior. It also includes an unrelated light-client genesis-proof guard and CI workflow “chunk result” validation.

Changes:

  • Switch VerifyQueue::re_notify() from notify_one() to notify_waiters() to wake only currently-waiting workers.
  • Add an async test to ensure re_notify() does not store a permit when no tasks are waiting.
  • Update light-client proof generation to handle last_block.is_genesis() and update CI integration-test workflows to fail if chunked tests don’t succeed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
util/light-client-protocol-server/src/lib.rs Avoids underflow / invalid parent MMR access when replying proofs for genesis blocks.
tx-pool/src/component/verify_queue.rs Changes re_notify() to use notify_waiters() to avoid stored permits/self-wakeup.
tx-pool/src/component/tests/chunk.rs Adds a regression test covering the “no stored permit” behavior for re_notify().
.github/workflows/ci_integration_tests_windows.yaml Ensures the summary job fails when the chunked test job doesn’t succeed.
.github/workflows/ci_integration_tests_ubuntu.yaml Ensures the summary job fails when the chunked test job doesn’t succeed.
.github/workflows/ci_integration_tests_macos.yaml Ensures the summary job fails when the chunked test job doesn’t succeed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +188 to +193
queue.re_notify();
assert!(
tokio::time::timeout(std::time::Duration::from_millis(10), queue_rx.notified())
.await
.is_err()
);
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.

2 participants