-
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
base: develop
Are you sure you want to change the base?
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. |
This pull request has conflicts, please rebase. |
b4d9cc1
to
713a76d
Compare
713a76d
to
a06c5b8
Compare
a06c5b8
to
84deba5
Compare
WalkthroughThe pull request introduces a series of grammatical corrections across multiple files in the Dash project codebase. The primary focus is on replacing the phrase "can not" with "cannot" in various error messages, comments, and logging statements. These changes span multiple directories, including source code files ( In addition to the grammatical updates, there are modifications in the transaction memory pool management within Overall, while most changes are textual and do not affect functionality, the updates enhance code readability and grammatical consistency throughout the project. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (23)
🚧 Files skipped from review as they are similar to previous changes (21)
⏰ Context from checks skipped due to timeout of 90000ms (8)
🔇 Additional comments (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/wallet/wallet.cpp (1)
Line range hint
1990-2000
: Implement SQLite wallet backup supportThe SQLite wallet backup functionality is currently not implemented, which could lead to data loss for SQLite wallets.
Consider implementing proper backup support for SQLite wallets similar to BDB implementation. Key requirements:
- Atomic backup operations
- Proper error handling
- Backup rotation support
- Verification of backup integrity
Example implementation structure:
bool CWallet::AutoBackupWallet(const fs::path& wallet_path, bilingual_str& error_string, std::vector<bilingual_str>& warnings) { if (m_database->Format() == DatabaseFormat::SQLITE) { // Implement SQLite-specific backup logic return BackupSQLiteWallet(wallet_path, error_string, warnings); } // Existing BDB backup logic return BackupBDBWallet(wallet_path, error_string, warnings); }
🧹 Nitpick comments (4)
src/wallet/wallet.cpp (4)
Line range hint
3751-3792
: Consider enhancing transaction fee handlingThe fee calculation and validation logic could be improved in a few ways:
- Add explicit bounds checking for fees to prevent integer overflow
- Add more detailed error messages for specific fee calculation failures
- Consider adding fee estimation fallback logic when initial calculation fails
Example improvement for fee validation:
if (nFeeRet > m_default_max_tx_fee) { + // Add specific error details + error = strprintf(_("Fee %d exceeds maximum fee %d"), nFeeRet, m_default_max_tx_fee); return false; }
Line range hint
2900-2950
: Enhance encryption key handling securityThe encryption key handling could be improved in several ways:
- Use secure memory wiping for all sensitive data
- Add configurable key derivation parameters
- Improve error messages for encryption failures
Example improvements:
bool CWallet::Unlock(const SecureString& strWalletPassphrase, bool fForMixingOnly, bool accept_no_keys) { CCrypter crypter; - CKeyingMaterial _vMasterKey; + SecureVector<unsigned char> _vMasterKey; // Add configurable parameters + const unsigned int kdfIterations = gArgs.GetArg("-kdfiterations", 25000); + if (kdfIterations < 20000) { + throw std::runtime_error("KDF iterations too low, minimum is 20000"); + }
Line range hint
4450-4500
: Improve descriptor wallet robustnessThe descriptor wallet implementation could be enhanced:
- Add more comprehensive descriptor validation
- Improve error handling for invalid descriptors
- Add migration utilities from legacy wallets
Example improvements:
bool CWallet::ValidateDescriptor(const std::string& descriptor, bilingual_str& error) { // Add comprehensive descriptor validation FlatSigningProvider keys; std::string desc_error; auto parsed = Parse(descriptor, keys, desc_error, false); if (!parsed) { error = Untranslated(strprintf("Invalid descriptor: %s", desc_error)); return false; } // Add more validation checks return true; }
Line range hint
1-100
: Consider enhancing logging and documentationThe wallet implementation would benefit from:
- More detailed logging of critical operations
- Better documentation of complex workflows
- Additional test coverage recommendations
Example logging improvements:
bool CWallet::CreateTransaction(/*...*/) { + WalletLogPrintf("Creating transaction with %d recipients\n", vecSend.size()); // ... existing code ... + WalletLogPrintf("Transaction created successfully: %s\n", tx->GetHash().ToString());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
contrib/guix/guix-build
(1 hunks)doc/developer-notes.md
(2 hunks)src/net.cpp
(1 hunks)src/qt/bitcoin.cpp
(1 hunks)src/qt/intro.cpp
(1 hunks)src/rpc/misc.cpp
(1 hunks)src/rpc/txoutproof.cpp
(1 hunks)src/test/util_tests.cpp
(1 hunks)src/txdb.cpp
(1 hunks)src/wallet/rpcwallet.cpp
(3 hunks)src/wallet/wallet.cpp
(1 hunks)test/functional/feature_txindex_compatibility.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 (1)
- src/rpc/txoutproof.cpp
🚧 Files skipped from review as they are similar to previous changes (14)
- test/util/test_runner.py
- src/rpc/misc.cpp
- contrib/guix/guix-build
- src/test/util_tests.cpp
- test/functional/rpc_uptime.py
- src/qt/intro.cpp
- test/functional/feature_txindex_compatibility.py
- src/qt/bitcoin.cpp
- src/txdb.cpp
- doc/developer-notes.md
- test/functional/rpc_decodescript.py
- test/functional/wallet_encryption.py
- src/net.cpp
- src/wallet/rpcwallet.cpp
🔇 Additional comments (1)
src/wallet/wallet.cpp (1)
3786-3786
: Improved error message for transaction change output index validationThe error message has been updated to be more descriptive when the change output index is out of range.
….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 |
bitcoin backports