Skip to content

fix: overhaul proposal selection and prioritization logic#5023

Merged
zhangsoledad merged 8 commits intodevelopfrom
zhangsoledad/fix-txpool-proposal
Mar 12, 2026
Merged

fix: overhaul proposal selection and prioritization logic#5023
zhangsoledad merged 8 commits intodevelopfrom
zhangsoledad/fix-txpool-proposal

Conversation

@zhangsoledad
Copy link
Copy Markdown
Member

@zhangsoledad zhangsoledad commented Dec 9, 2025

What's Changed:

This PR fixes a series of logical issues in the tx-pool and block-template construction related to proposal transactions:

Prioritize proposal transactions
Proposals are now given the highest priority in the txpool.

Allow compact block recovery to use transactions from verify_queue
Compact-block reconstruction previously only searched the main pool, leading to unnecessary “missing transaction” failures when a proposal was already in verify_queue. The reconciler now checks pool_map, verify_queue, and the orphan set (when relevant).

Fix proposal selection logic in block template
The previous implementation had several severe bugs:

  • Not consider to exclude proposals whose content had already been included in previous blocks (re-proposing the same data).

Related changes

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

Check List

Tests

  • Unit test
  • Integration test

Release note

Note: Add a note under the PR title in the release note.

@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch 2 times, most recently from e61a27e to e4018fc Compare December 11, 2025 12:52
@zhangsoledad zhangsoledad marked this pull request as ready for review December 11, 2025 13:06
@zhangsoledad zhangsoledad requested a review from a team as a code owner December 11, 2025 13:06
@zhangsoledad zhangsoledad requested review from quake and removed request for a team December 11, 2025 13:06
@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch 3 times, most recently from c8e5857 to df212c2 Compare December 29, 2025 16:57
@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch 4 times, most recently from c44d17e to eadfec1 Compare January 7, 2026 09:51
@zhangsoledad zhangsoledad requested review from RetricSu, chenyukang, doitian and eval-exec and removed request for RetricSu January 7, 2026 09:56
@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch from 02a0c91 to e41f04c Compare February 11, 2026 09:42
Comment thread tx-pool/src/component/tx_selector.rs Outdated
Copy link
Copy Markdown
Collaborator

@eval-exec eval-exec left a comment

Choose a reason for hiding this comment

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

A integration test failed: https://github.com/nervosnetwork/ckb/actions/runs/22430288900/job/64950185639?pr=5023

2026-02-26 06:49:59.153 +00:00 *unnamed* ERROR panic  thread 'unnamed' panicked at 'assertion failed: matches!(res.tx_status.status, Status::Pending)': test/src/specs/tx_pool/limit.rs:126   0: ckb_logger_service::setup_panic_logger::{{closure}}
   1: std::panicking::panic_with_hook
   2: std::panicking::panic_handler::{{closure}}
   3: std::sys::backtrace::__rust_end_short_backtrace
   4: __rustc::rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::panicking::panic
   7: <ckb_test::specs::tx_pool::limit::TxPoolLimitAncestorCount as ckb_test::specs::Spec>::run
   8: ckb_test::worker::Worker::run_spec
   9: std::sys::backtrace::__rust_begin_short_backtrace
  10: core::ops::function::FnOnce::call_once{{vtable.shim}}
  11: std::sys::thread::unix::Thread::new::thread_start
  12: <unknown>
  13: <unknown>

2026-02-26 06:49:59.160 +00:00 *unnamed* DEBUG ckb_test::node  Successfully killed ckb process (TxPoolLimitAncestorCount_node0

@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch 4 times, most recently from 097a136 to 5cebae7 Compare March 9, 2026 09:57
zhangsoledad and others added 4 commits March 9, 2026 18:13
<!--
Thank you for contributing to nervosnetwork/ckb!

If you haven't already, please read
[CONTRIBUTING](https://github.com/nervosnetwork/ckb/blob/develop/CONTRIBUTING.md)
document.

If you're unsure about anything, just ask; somebody should be along to
answer within a day or two.

**Important**: We use Squash Merge to merge PRs, so the PR title will
become the commit message.
Please ensure your PR title follows the [Conventional Commit
Messages](https://www.conventionalcommits.org/) format.

The most important prefixes you should use:

- `fix:`: represents bug fixes, and results in a SemVer patch bump.
- `feat:`: represents a new feature, and results in a SemVer minor bump.
- `<prefix>!:` (e.g. `feat!:`): represents a breaking change (indicated
by the !) and results in a SemVer major bump.

Other conventional prefixes are also acceptable (e.g., `docs:`,
`refactor:`, `test:`, `chore:`, etc.).
-->

Issue Number: close #xxx <!-- REMOVE this line if no issue to close -->

Problem Summary:

Proposal: [xxx](url) <!-- REMOVE this line if not applicable -->

What's Changed:

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

Tests <!-- At least one of them must be included. -->

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

Side effects

- Performance regression
- Breaking backward compatibility
@zhangsoledad zhangsoledad force-pushed the zhangsoledad/fix-txpool-proposal branch from 5cebae7 to 4741475 Compare March 9, 2026 10:13
@zhangsoledad zhangsoledad added this pull request to the merge queue Mar 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Mar 10, 2026
@zhangsoledad zhangsoledad added this pull request to the merge queue Mar 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Mar 11, 2026
@zhangsoledad zhangsoledad added this pull request to the merge queue Mar 12, 2026
Merged via the queue into develop with commit bfa240c Mar 12, 2026
67 of 68 checks passed
@nervos-bot nervos-bot Bot mentioned this pull request Mar 12, 2026
eval-exec pushed a commit to eval-exec/ckb that referenced this pull request Apr 28, 2026
## 🤖 New release

* `ckb-constant`: 1.1.0 -> 1.1.1
* `ckb-types`: 1.1.0 -> 1.1.1
* `ckb-resource`: 1.1.0 -> 1.1.1
* `ckb-app-config`: 1.2.0 -> 1.2.1
* `ckb-network`: 1.2.0 -> 1.2.1
* `ckb-tx-pool`: 1.2.0 -> 1.2.1
* `ckb-shared`: 1.1.0 -> 1.1.1
* `ckb-chain`: 1.2.0 -> 1.2.1
* `ckb-rich-indexer`: 1.1.0 -> 1.1.1
* `ckb-rpc`: 1.2.1 -> 1.2.2

<details><summary><i><b>Changelog</b></i></summary><p>

## `ckb-constant`

<blockquote>

##
[1.1.1](nervosnetwork/ckb@ckb-constant-v1.1.0...ckb-constant-v1.1.1)
- 2026-04-24

### Changed

- update assume valid target (by @doitian)

### Contributors

- @doitian
</blockquote>

## `ckb-types`

<blockquote>

##
[1.1.1](nervosnetwork/ckb@ckb-types-v1.1.0...ckb-types-v1.1.1)
- 2026-04-24

### Fixed

- overhaul proposal selection and prioritization logic (nervosnetwork#5023) (by
@zhangsoledad)

### Contributors

- @zhangsoledad
</blockquote>

## `ckb-resource`

<blockquote>

##
[1.1.1](nervosnetwork/ckb@ckb-resource-v1.1.0...ckb-resource-v1.1.1)
- 2026-04-24

### Changed

- update testnet bootnodes (nervosnetwork#5176) (by @jiangxianliang007)
- sort WalkDir entries in resource bundling (nervosnetwork#5156) (by @eval-exec)

### Contributors

- @jiangxianliang007
- @eval-exec
</blockquote>

## `ckb-app-config`

<blockquote>

##
[1.2.1](nervosnetwork/ckb@ckb-app-config-v1.2.0...ckb-app-config-v1.2.1)
- 2026-04-24

### Fixed

- overhaul proposal selection and prioritization logic (nervosnetwork#5023) (by
@zhangsoledad)

### Contributors

- @zhangsoledad
</blockquote>

## `ckb-network`

<blockquote>

##
[1.2.1](nervosnetwork/ckb@ckb-network-v1.2.0...ckb-network-v1.2.1)
- 2026-04-24

### Changed

- upgrade deps (nervosnetwork#5132) (by @driftluo)

### Contributors

- @driftluo
</blockquote>

## `ckb-tx-pool`

<blockquote>

##
[1.2.1](nervosnetwork/ckb@ckb-tx-pool-v1.2.0...ckb-tx-pool-v1.2.1)
- 2026-04-24

### Fixed

- overhaul proposal selection and prioritization logic (nervosnetwork#5023) (by
@zhangsoledad)

### Contributors

- @zhangsoledad
</blockquote>

## `ckb-shared`

<blockquote>

##
[1.1.1](nervosnetwork/ckb@ckb-shared-v1.1.0...ckb-shared-v1.1.1)
- 2026-04-24

### Fixed

- ensure temporary directories are cleaned up after tests (nervosnetwork#5163) (by
@jetjinser)

### Contributors

- @jetjinser
</blockquote>

## `ckb-chain`

<blockquote>

##
[1.2.1](nervosnetwork/ckb@ckb-chain-v1.2.0...ckb-chain-v1.2.1)
- 2026-04-24

### Fixed

- overhaul proposal selection and prioritization logic (nervosnetwork#5023) (by
@zhangsoledad)

### Contributors

- @zhangsoledad
</blockquote>

## `ckb-rich-indexer`

<blockquote>

##
[1.1.1](nervosnetwork/ckb@ckb-rich-indexer-v1.1.0...ckb-rich-indexer-v1.1.1)
- 2026-04-24

### Fixed

- preserve leading zero bytes and handle all-0xFF overflow in
rich-indexer prefix search upper bound (nervosnetwork#5166) (by @Copilot)

### Contributors

- @Copilot
</blockquote>

## `ckb-rpc`

<blockquote>

##
[1.2.2](nervosnetwork/ckb@ckb-rpc-v1.2.1...ckb-rpc-v1.2.2)
- 2026-04-24

### Changed

- *(rpc)* correct PRC typo in docs and comments (nervosnetwork#5130) (by @eval-exec)

### Fixed

- ensure temporary directories are cleaned up after tests (nervosnetwork#5163) (by
@jetjinser)
- generate GitHub-compatible RPC doc anchors (nervosnetwork#5136) (by @eval-exec)
- overhaul proposal selection and prioritization logic (nervosnetwork#5023) (by
@zhangsoledad)

### Contributors

- @jetjinser
- @eval-exec
- @zhangsoledad
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: nervos-bot[bot] <46313439+nervos-bot[bot]@users.noreply.github.com>
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