backport: Merge bitcoin#26642, 27344, gui#726, 27465, 26207, 27468#7390
backport: Merge bitcoin#26642, 27344, gui#726, 27465, 26207, 27468#7390vijaydasmp wants to merge 5 commits into
Conversation
…related fixes 03ec5b6 clang-tidy: Exclude `performance-*` checks rather including them (Hennadii Stepanov) 2400437 clang-tidy: Add `performance-type-promotion-in-math-fn` check (Hennadii Stepanov) 7e975e6 clang-tidy: Add `performance-inefficient-vector-operation` check (Hennadii Stepanov) 516b75f clang-tidy: Add `performance-faster-string-find` check (Hennadii Stepanov) Pull request description: ACKs for top commit: martinus: ACK 03ec5b6 TheCharlatan: re-ACK [03ec5b6](bitcoin@03ec5b6) Tree-SHA512: 2dfa52f9131da88826f32583bfd534a56a998477db9804b7333c0e7ac0b6b36141009755c7163b9f95d0ecbf5c2cb63f8a69ce4b114bb83423faed21b50cec67
faf8dc4 fuzz: Remove legacy int parse fuzz tests (MarcoFalke) Pull request description: The fuzz tests checked that the result of the new function was equal to the legacy function. (Side note: The checks were incomplete, as evident by the follow-up fix in commit b5c9bb5). Given that they haven't found any issues in years (beside missing the above issue, that they couldn't catch), it seems time to remove them. They may come in handy in the rare case that someone would want to modify `LocaleIndependentAtoi()` or `Parse*Int*()`, however that seems unlikely. Also, appropriate checks can be added then. ACKs for top commit: fanquake: ACK faf8dc4 dergoegge: ACK faf8dc4 Tree-SHA512: 4ec88b9fa8ba49a923b0604016f0f471b3c9b9e0ba6c5c3dc4e20503c6994789921e7221d9ec467a2a37a73f21a70ba51ba3370ed5ad311dee989e218290b29a
|
…ams for mempool/contents 1ff5d61 doc: add mempool/contents rest verbose and mempool_sequence args (Andrew Toth) 52a31dc tests: mempool/contents verbose and mempool_sequence query params tests (Andrew Toth) a518fff rest: add verbose and mempool_sequence query params for mempool/contents (Andrew Toth) Pull request description: The verbose mempool json response can get very large. This adds an option to return the non-verbose response of just the txids. It is identical to the rpc response so the diff here is minimal. This also adds the mempool_sequence parameter for rpc consistency. Verbose defaults to true to remain backwards compatible. It uses query parameters to be compatible with the efforts in bitcoin#25752. ACKs for top commit: achow101: ACK 1ff5d61 stickies-v: re-ACK [1ff5d61](bitcoin@1ff5d61) pablomartin4btc: tested ACK 1ff5d61. Tree-SHA512: 1bf08a7ffde2e7db14dc746e421feedf17d84c4b3f1141e79e36feb6014811dfde80e1d8dbc476c15ff705de2d3c967b3081dcd80536d76b7edf888f1a92e9d1
11422cc bugfix: rest: avoid segfault for invalid URI (pablomartin4btc) Pull request description: Minimal fix to get it promptly into 25.0 release (suggested by [stickies-v](bitcoin#27253 (review)) and supported by [vasild](bitcoin#27253 (review)) ) Please check bitcoin#27253 for reviewers comments and acks regarding this PR and read the commit comment message body for more details about the fix. ACKs for top commit: achow101: ACK 11422cc stickies-v: re-ACK 11422cc Tree-SHA512: 5af6b53fb266a12b463f960910556d5e97bc88b3c2a4f437ffa343886b38749e1eb058cf7bc64d62e82e1acf6232a186bddacd8f3b4500c87bf9e550a0153386
|
✅ Review complete (commit 0e96447) |
WalkthroughThis PR adds Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant RestHandler as rest_mempool
participant MempoolToJSON
Client->>RestHandler: GET /rest/mempool/contents.json?verbose&mempool_sequence
RestHandler->>RestHandler: parse/validate query params
alt invalid or conflicting params
RestHandler-->>Client: HTTP_BAD_REQUEST
else valid params
RestHandler->>MempoolToJSON: verbose, mempool_sequence
MempoolToJSON-->>RestHandler: JSON result
RestHandler-->>Client: JSON response
end
sequenceDiagram
participant Client
participant HTTPServer as httpserver.cpp
participant evhttp_uri_parse
Client->>HTTPServer: request with invalid URI
HTTPServer->>evhttp_uri_parse: parse(uri)
evhttp_uri_parse-->>HTTPServer: nullptr
HTTPServer-->>Client: throw std::runtime_error / HTTP 400
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/rest.cpp (1)
656-679: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate boolean-parsing boilerplate for
verbose/mempool_sequence.The two query-parameter blocks (fetch → validate
"true"/"false"→ 400 on error) are structurally identical aside from the parameter name and default. Extracting a small helper (e.g.ParseBoolQueryParam(req, name, default) -> std::optional<bool-or-error>) would remove duplication and make future boolean query params easier to add.♻️ Example helper sketch
+static util::Result<bool> GetBoolQueryParam(HTTPRequest* req, const std::string& name, bool default_value) +{ + std::string raw; + try { + raw = req->GetQueryParameter(name).value_or(default_value ? "true" : "false"); + } catch (const std::runtime_error& e) { + return util::Error{Untranslated(e.what())}; + } + if (raw != "true" && raw != "false") { + return util::Error{Untranslated(strprintf("The \"%s\" query parameter must be either \"true\" or \"false\".", name))}; + } + return raw == "true"; +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/rest.cpp` around lines 656 - 679, The `verbose` and `mempool_sequence` query-parameter handling in `src/rest.cpp` duplicates the same fetch/validate/400-error flow twice. Refactor this into a small reusable helper near the request parsing logic used by `MempoolToJSON`, so both parameters are parsed through one path that accepts the parameter name and default, validates only "true"/"false", and returns the boolean value or error consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/rest.cpp`:
- Around line 656-679: The `verbose` and `mempool_sequence` query-parameter
handling in `src/rest.cpp` duplicates the same fetch/validate/400-error flow
twice. Refactor this into a small reusable helper near the request parsing logic
used by `MempoolToJSON`, so both parameters are parsed through one path that
accepts the parameter name and default, validates only "true"/"false", and
returns the boolean value or error consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 120e3388-19ce-4e35-8597-bf0c5d9aabb8
📒 Files selected for processing (31)
ci/dash/lint-tidy.shdoc/REST-interface.mddoc/developer-notes.mdsrc/.clang-tidysrc/bench/lockedpool.cppsrc/bitcoin-cli.cppsrc/bitcoin-util.cppsrc/httpserver.cppsrc/node/interfaces.cppsrc/qt/trafficgraphwidget.cppsrc/rest.cppsrc/rpc/server.cppsrc/rpc/util.cppsrc/test/allocator_tests.cppsrc/test/fuzz/string.cppsrc/test/fuzz/tx_pool.cppsrc/test/getarg_tests.cppsrc/test/httpserver_tests.cppsrc/test/policyestimator_tests.cppsrc/test/scheduler_tests.cppsrc/test/script_p2sh_tests.cppsrc/test/util/net.cppsrc/test/util_threadnames_tests.cppsrc/test/validation_block_tests.cppsrc/util/bip32.cppsrc/wallet/bdb.cppsrc/wallet/rpc/backup.cppsrc/wallet/scriptpubkeyman.cppsrc/zmq/zmqpublishnotifier.cpptest/functional/interface_rest.pytest/lint/lint-locale-dependence.py
💤 Files with no reviewable changes (1)
- test/lint/lint-locale-dependence.py
There was a problem hiding this comment.
Code Review
I verified the two parsed Codex findings against the checked-out PR. The REST docs still carry Bitcoin Core's "25.0 and up" release note even though this Dash tree is versioned as 23.1.5, so that is a real in-scope documentation issue. The GUI provenance claim does not hold: the trafficgraphwidget change is part of the listed upstream bitcoin#26642 commit, while bitcoin-core/gui#726 is a different AddressPurpose change.
💬 1 nitpick(s)
Source: reviewers: gpt-5.5 (general, dash-core-commit-history); failed lanes: opus/claude-sonnet-5 (general, dash-core-commit-history, backport-reviewer), gpt-5.5 (backport-reviewer); verifier: gpt-5.5.
| Refer to the `getrawmempool` RPC help for details. Defaults to setting | ||
| `verbose=true` and `mempool_sequence=false`. | ||
|
|
||
| *Query parameters for `verbose` and `mempool_sequence` available in 25.0 and up.* |
There was a problem hiding this comment.
💬 Nitpick: Remove Bitcoin Core release number from Dash REST docs
This note was copied from the Bitcoin Core backport and says the new verbose and mempool_sequence query parameters are available in 25.0 and up. This is Dash Core documentation, and this PR is based on a Dash tree reporting version 23.1.5 in configure.ac, so the Bitcoin Core release number is misleading for Dash users trying to determine which Dash release contains /rest/mempool/contents.json?verbose=...&mempool_sequence=.... Adapt the sentence to the Dash release that will ship this backport, or remove the version-specific sentence.
source: ['codex']
bitcoin back ports