-
Notifications
You must be signed in to change notification settings - Fork 38.8k
txorphanage: add size accounting, use wtxids, support multiple announcers #28481
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
baddad7 to
581339f
Compare
581339f to
6101c60
Compare
$ echo "Af//////Oqf/AP8TAf8AEPr/AQAApZL6/wEA/1sB/wBbAAClkpJ4eP//S0tL/Q==" | base64 -d > orphanage_crash
$ FUZZ=txorphan ./src/test/fuzz/fuzz orphanage_crash
...
test/fuzz/txorphan.cpp:98 operator(): Assertion `orphanage.BytesFromPeer(peer_id) >= ref->GetTotalSize()' failed.
... |
|
instagibbs
left a comment
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.
initial comments, reviewed everything, also replicated the same fuzzer crash locally
src/txorphanage.h
Outdated
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.
Need to also rename arg for EraseTxNoLock to wtxid
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.
4d6b839616c65b0ca5fefdb50ce0b8b1ffad8947
txorphan.cpp fuzzer needs to change for all EraseTx() call sites because they're still using txid
src/txorphanage.cpp
Outdated
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.
leave a comment that this is belt-and-suspenders only, the condition should fail since the item should have been already erased
src/txorphanage.h
Outdated
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.
Should describe the new argument as something like "all unique parent transaction txids". I kind of wish this was generated inside AddTx but realize you're avoiding double the work...
src/txorphanage.h
Outdated
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.
| /** Get an orphan's parent_txids, or std::nullopt if the orphan is not present. */ | |
| /** Get an orphan's unique parent_txids, or std::nullopt if the orphan is not present. */ |
src/txorphanage.h
Outdated
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.
| /** Limit the orphanage to the given maximum. Returns all expired entries. */ | |
| /** Limit the orphanage to the given maximum. Returns all expired entries by wtxid. */ |
src/txorphanage.cpp
Outdated
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.
can remove this and use size of expired(_wtxids) set isntead
src/txorphanage.h
Outdated
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.
please remove this return #28031 (comment)
src/txorphanage.cpp
Outdated
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.
unused in this PR, but is exercised in tests so I'm happy for it to be used later 👍
src/test/orphanage_tests.cpp
Outdated
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.
could this get mechanically asserted as extra-belt-and-suspender
src/test/fuzz/txorphan.cpp
Outdated
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.
might as well capture the return and check it here too
|
Putting this in draft to focus review attention on the mempool stuff. |
Yugthakkar04
left a comment
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.
add this to the first line of array or a bolleyan function and then to the first line of paragraph..
Yugthakkar04
left a comment
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.
make this a transidental function and then work upon it and mechanically assert it up than.
|
Going to resolve comments + fuzz failure, and then add a |
34de484 to
22e3c06
Compare
Wtxids are better because they disambiguate between transactions with the same txid but different witnesses. The package relay logic will work with wtxids, e.g. upon receipt of an ancpkginfo containing wtxids of transactions, it will look for those transactions in the orphanage.
No effect for now, just additional tracking. Enables: - load balance orphan resolution, limit per-peer orphanage usage - limit the total size of orphans instead of just the count
Add ability to add and track multiple announcers per orphan transaction, erasing announcers but not the entire orphan.
This information is already known; returning it is essentially free. A later commit uses these wtxids to remove conflicted transactions from the orphan resolution tracker.
22e3c06 to
56eef67
Compare
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
1 similar comment
|
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
|
Closing for now. The first commit is superseded by #30000, and the rest will come after |
This PR contains changes to
TxOrphanageneeded for package relay stuff. See #27463 for project tracking and #28031 for how this code is used.Separating this PR was suggested in #28031 (comment).
Changes here:
CTransaction::GetTotalSize()of orphans stored, as well as the size per peer.OrphanTxso that we don't need to calculate them again later on.EraseForBlockwhich includes orphans that conflicted with the block. This helps us delete those orphan resolution attempts from our tracker.