-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backport: Merge bitcoin#22507, 21464, 23050, 24367 #6099
Conversation
9881474
to
c50dd0a
Compare
This pull request has conflicts, please rebase. |
7b66f1f
to
0c23f20
Compare
This pull request has conflicts, please rebase. |
This pull request has conflicts, please rebase. |
8f2eba9
to
c0f8c45
Compare
04076d6
to
a587c2b
Compare
This pull request has conflicts, please rebase. |
b4d9cc1
to
713a76d
Compare
713a76d
to
a06c5b8
Compare
a06c5b8
to
84deba5
Compare
empty for merge -pasta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/txmempool.h (1)
678-698
: Good clarity on parameter usage and documentation.
The updated documentation thoroughly describes howancestor_size_limit
andancestor_count_limit
are used inUpdateTransactionsFromBlock
. Consider clarifying the behavior if these limits are zero or extremely high to avoid confusion.src/validation.cpp (1)
366-368
: Enhance mempool ancestor limit controlThe addition of
ancestor_size_limit
andancestor_count_limit
parameters improves control over transaction ancestor limits during mempool updates after reorganization. These limits help prevent memory exhaustion from large transaction chains.Consider adding validation to ensure the limits don't exceed system constraints, and document the expected ranges in comments.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
contrib/guix/guix-build
(1 hunks)doc/developer-notes.md
(2 hunks)doc/release-process.md
(1 hunks)src/net.cpp
(1 hunks)src/node/miner.cpp
(1 hunks)src/qt/bitcoin.cpp
(1 hunks)src/qt/intro.cpp
(1 hunks)src/rpc/misc.cpp
(1 hunks)src/test/util_tests.cpp
(1 hunks)src/txdb.cpp
(1 hunks)src/txmempool.cpp
(5 hunks)src/txmempool.h
(2 hunks)src/validation.cpp
(1 hunks)src/wallet/rpcwallet.cpp
(3 hunks)test/functional/feature_txindex_compatibility.py
(1 hunks)test/functional/mempool_updatefromblock.py
(1 hunks)test/functional/rpc_decodescript.py
(1 hunks)test/functional/rpc_uptime.py
(1 hunks)test/functional/wallet_encryption.py
(1 hunks)test/util/test_runner.py
(1 hunks)
✅ Files skipped from review due to trivial changes (14)
- test/util/test_runner.py
- src/txdb.cpp
- src/node/miner.cpp
- src/qt/intro.cpp
- contrib/guix/guix-build
- doc/developer-notes.md
- src/net.cpp
- test/functional/wallet_encryption.py
- test/functional/rpc_decodescript.py
- test/functional/feature_txindex_compatibility.py
- src/qt/bitcoin.cpp
- src/test/util_tests.cpp
- src/rpc/misc.cpp
- src/wallet/rpcwallet.cpp
🔇 Additional comments (9)
test/functional/rpc_uptime.py (1)
26-26
: LGTM! Grammatical improvement in error message.The change from "can not" to "cannot" improves the grammatical accuracy of the error message while maintaining the same semantic meaning.
Let's verify this matches Bitcoin's implementation:
✅ Verification successful
Error message standardization is consistent within the codebase
The verification shows that the error message "Mocktime cannot be negative" is consistently used in both the RPC implementation (
src/rpc/misc.cpp
) and its corresponding test (test/functional/rpc_uptime.py
). The error message format follows the same pattern in both locations, ensuring internal consistency within the Dash codebase.While we couldn't directly verify against Bitcoin's implementation, the change aligns with good coding practices by:
- Maintaining consistency between implementation and test
- Using proper grammar ("cannot" instead of "can not")
- Preserving the same error code (-8) and error handling pattern
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the error message matches Bitcoin's implementation # Expected: The error message should be identical in both codebases # Search for this error message in Bitcoin's codebase rg -l "Mocktime cannot be negative" $(gh repo clone bitcoin/bitcoin --depth 1 2>/dev/null || echo "bitcoin")Length of output: 152
Script:
#!/bin/bash # Let's try searching in the current repository first to understand the context better rg "Mocktime cannot be negative" -A 2 -B 2Length of output: 658
Script:
#!/bin/bash # Let's check the git history to see if this was indeed backported from Bitcoin git log -n 5 --grep="cannot" --pretty=format:"%H %s" test/functional/rpc_uptime.pyLength of output: 0
src/txmempool.h (1)
840-871
: Well-defined pre-/post-conditions forUpdateForDescendants
.
The expanded docstring clearly outlines expectations forcachedDescendants
anddescendants_to_remove
. Ensure edge cases (e.g., repeated removal requests, extremely large mempools) are handled gracefully.src/txmempool.cpp (4)
127-129
: Added parameters for ancestor limits.
Passinguint64_t ancestor_size_limit, ancestor_count_limit
provides greater control. Verify that upstream calls handle invalid or zero values appropriately to avoid unexpected early removal of transactions.
166-171
: Marked transactions for later removal, avoiding iterator invalidation.
This is a good approach to prevent invalid iterator usage. Confirm that follow-up calls remove these offending transactions in all scenarios to maintain a consistent mempool state.
Line range hint
177-228
: Enhanced removal workflow for re-introduced transactions.
Usingdescendants_to_remove
ensures that transactions exceeding ancestor limits after a block disconnection are removed in a separate pass. Verify that any reorg edge cases (e.g., chain tips toggling frequently) do not leave stale entries behind.
1481-1481
: Refined log message inPrioritiseTransaction
.
The logging now precisely indicates fee adjustments. This is consistent with related debug statements and improves clarity for debugging fee deltas in the mempool.test/functional/mempool_updatefromblock.py (1)
20-20
: Fine-tune ancestor count limit for test environment.
Adding-limitancestorcount=100
helps avoid unintentional errors when building large transaction graphs. Ensure that other tests setting conflicting ancestor limits don’t interfere with expected behaviors.doc/release-process.md (1)
181-181
: Improved commit message clarity.
Replacing “add detached sigs” with “Add attestations” more accurately describes the nature of the committed files. The instructions are now more intuitive and easier to follow for contributors.src/validation.cpp (1)
368-368
: Properly propagate ancestor limits to mempool updatesThe ancestor limits are correctly passed through to
UpdateTransactionsFromBlock
, ensuring consistent application of the limits during reorganization.Let's verify that these limits are properly enforced by checking the mempool code:
✅ Verification successful
Ancestor limits are properly enforced in mempool updates
The verification confirms that the ancestor limits are correctly propagated and enforced:
UpdateTransactionsFromBlock
passes the limits toUpdateForDescendants
- Inside
UpdateForDescendants
, transactions exceeding the limits are identified and added todescendants_to_remove
- These transactions are then removed from the mempool via
removeRecursive
This ensures that after a block reorganization, any transaction in the mempool that would exceed the ancestor limits is properly removed, maintaining consistency with the ancestor limit policy.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check how UpdateTransactionsFromBlock uses the ancestor limits ast-grep --pattern 'UpdateTransactionsFromBlock($_, $_, $_)'Length of output: 228
Script:
#!/bin/bash # Let's try a different approach to find the UpdateTransactionsFromBlock implementation rg -U "UpdateTransactionsFromBlock.*\(" --type cppLength of output: 709
Script:
#!/bin/bash # Let's check the implementation in txmempool.cpp to see how the limits are used rg -A 20 "UpdateTransactionsFromBlock.*ancestor" src/txmempool.cppLength of output: 1222
Script:
#!/bin/bash # Let's search for where these ancestor limits are actually used in the update process rg -B 5 -A 15 "ancestor_size_limit|ancestor_count_limit" src/txmempool.cppLength of output: 3900
24367: missing changes in:
Also, we don't have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty for git merge -pasta
….sigs repo fafade9 doc: Adjust commit message template for the guix.sigs repo (MarcoFalke) Pull request description: Seems to be the most common template used, so adjust this here, too. ACKs for top commit: laanwj: ACK fafade9 hebasto: re-ACK fafade9 Tree-SHA512: 20477d14ecfad94f3b28b94786a4c0d98df539360d0c1deefa94766064a7d0700c849e54d6b251f922e135fcfa964ada0c724090f7f92b459ea39f7c3ca8c65d
c5b36b1 Mempool Update Cut-Through Optimization (Jeremy Rubin) c49daf9 [TESTS] Increase limitancestorcount in tournament RPC test to showcase improved algorithm (Jeremy Rubin) Pull request description: Often when we're updating mempool entries we update entries that we ultimately end up removing the updated entries shortly thereafter. This patch makes it so that we filter for such entries a bit earlier in processing, which yields a mild improvement for these cases, and is negligible overhead otherwise. There's potential for a better -- but more sophisticated -- algorithm that can be used taking advantage of epochs, but I figured it is better to do something that is simple and works first and upgrade it later as the other epoch mempool work proceeds as it makes the patches for the epoch algorithm simpler to understand, so you can consider this as preparatory work. It could either go in now if it is not controversial, or we could wait until the other patch is ready to go. ACKs for top commit: instagibbs: reACK c5b36b1 sipa: utACK c5b36b1 mzumsande: Code Review ACK c5b36b1 Tree-SHA512: 78b16864f77a637d8a68a65e23c019a9757d8b2243486728ef601d212ae482f6084cf8e69d810958c356f1803178046e4697207ba40d6d10529ca57de647fae6
…ce-versa c17f554 Fix BlockAssembler::AddToBlock, CTxMemPool::PrioritiseTransaction logging (Jon Atack) Pull request description: This is a tale of two fees, er, fee rates... indeed, one is misdescribed as a fee, and the other is incorrectly called a fee rate. From this review discussion: bitcoin#22689 (comment) (thanks to John Newbery). ACKs for top commit: laanwj: Code review ACK c17f554 Tree-SHA512: 3d9df3209a72562c5f9bbf815923d5b089d04491b8d19caa2c04158c501b47ef01e47f1c32d89adcbaf3c6357329507f65b4bb2963214c3451bbfa61ac812530
…ixups from transifex translator feedback 4874269 Replace "can not" with "cannot" in docs, user messages, and tests (Jon Atack) e670edd User-facing content fixups from transifex translator feedback (Jon Atack) Pull request description: Closes bitcoin#24366. ACKs for top commit: laanwj: Code review re-ACK 4874269 hebasto: re-ACK 4874269, only suggested change since my previous [review](bitcoin#24367 (review)). Tree-SHA512: 4dcdcb417251a413e65fab6070515e13a1267c8e0dbcf521386b842511391f24c84a0c2168fe13458c977682034466509bf2a3453719d4d94d3c568fd9f4adb4
Hello @UdjinM6 , requesting review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 7972af9
Gitlab failure https://gitlab.com/dashpay/dash/-/jobs/8793673680 looks unrelated, restarted the job |
Hello @PastaPastaPasta @knst requesting review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 7972af9
bitcoin backports