This is a full implementation of Erlay. Its purpose is to check the integrity and correctness of the implementation against changes/additions that may originate from the review process and/or rebases on top of newer functionality.
This is not to be merged. Functionality will be spread across multiple smaller PRs to ease the review process.
DrahtBot
commented at 5:18 pm on June 12, 2024:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See the guideline for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#32189 (refactor: Txid type safety (parent PR) by marcofleon)
#30116 (p2p: Fill reconciliation sets (Erlay) attempt 2 by sr-gi)
#29415 (Broadcast own transactions only via short-lived Tor or I2P connections by vasild)
#28463 (p2p: Increase inbound capacity for block-relay only connections by mzumsande)
#27826 (validation: log which peer sent us a header by Sjors)
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.
LLM Linter (✨ experimental)
Possible typos and grammar issues:
In src/node/txreconciliation.cpp comment:
“Allows to infer capacity of a reconciliation sketch based on it’s char[] representation”
should be
“its char[] representation”
In test/functional/p2p_reqtxrcncl.py comment:
“Each peer is reconcile every 1-nth”
should be
“Each peer is reconciled every 1-nth”
In test/functional/p2p_reqtxrcncl.py log message:
“REQTXRCNCL sent to an peer 1 (outbound)”
should be
“REQTXRCNCL sent to a peer 1 (outbound)”
In test/functional/p2p_reqtxrcncl.py comment:
“No transaction were created, so we expect the set size to be 0”
should be
“No transactions were created, so we expect the set size to be 0”
sr-gi marked this as a draft
on Jun 12, 2024
sr-gi force-pushed
on Jun 12, 2024
DrahtBot added the label
CI failed
on Jun 13, 2024
DrahtBot
commented at 4:17 am on June 13, 2024:
contributor
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
sr-gi force-pushed
on Apr 14, 2025
sr-gi force-pushed
on Apr 15, 2025
sr-gi force-pushed
on Apr 15, 2025
sr-gi force-pushed
on Apr 15, 2025
sr-gi force-pushed
on Apr 16, 2025
sr-gi force-pushed
on Apr 16, 2025
DrahtBot removed the label
CI failed
on Apr 16, 2025
sr-gi force-pushed
on Apr 18, 2025
refactor: remove legacy comments
These comments became irrelevant in one of the previous code changes.
They simply don't make sense anymore.
ed04f72b7b
p2p: Functions to add/remove wtxids to tx reconciliation sets
They will be used later on.
fb7d7bf3f7
p2p: Make short id collision detectable when adding wtxids to tx reconciliation sets9582b586cf
p2p: Add PeerManager method to count the amount of inbound/outbounds fanout peers5785294ebc
p2p: Cache inbound reconciling peers count
It helps to avoid recomputing every time we consider
a transaction for fanout/reconciliation.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
e72d48dd2c
p2p: Add method to decided whether to fanout or reconcile a transactions
Fanout or reconciliation is decided on a transaction basis, based on the following criteria:
If the peer is inbound, we fanout to a pre-defined subset of peers (which is rotated periodically).
If the peer is outbound, we will reconcile the transaction if we received it via reconciliation, or
defer the decision to relay time otherwise. At relay time, we will fanout to outbounds until a threshold is met
(selecting peers in the order their timers go off) and reconcile with the rest.
With this approach we try to fanout when we estimate to be early in the propagation of the transaction,
and reconcile otherwise. Notice these heuristics don't apply to inbound peers, since they would be easily
exploitable. For inbounds we just aim for a target subset picked at random.
ceeec346bc
p2p: Add transactions to reconciliation sets
Transactions eligible for reconciliation are added to the reconciliation sets. For the remaining txs, low-fanout is used.
Co-authored-by: Gleb Naumenko <naumenko.gs@gmail.com>
3b6c4cfb91
p2p: Add consider_fanout to RelayTransaction
This can be squashed into the previous commit, it is split for now to ease review
When scheduling the relay of a transaction (RelayTransaction) we should consider
whether it is worth fanning it out, or only reconciling it. This depends, partially,
on how the transaction was received.
For non-Erlay peers, we always consider_fanout (in fact, we only fanout).
For Erlay peers, if the peer is inbounds, we always consider fanout, and deffer the
decision of to whom to relay time. If the peer is outbound, we consider fanout if the
transaction was received via fanout, and only reconcile if it was received via reconciliation
(who to fanout to is also deferred to relay time).
Until the Erlay P2P flow is merged, consider_fanout is always true.
92d101b67b
p2p: Add helper to compute reconciliation tx short ids and a cache of short ids to wtxidsb515c72604
p2p: Deal with shortid collisions for reconciliation sets
If a transaction to be added to a peer's recon set has a shot id collisions (a previously
added wtxid maps to the same short id), both transaction should be fanout, given
our peer may have added the opposite transaction to our recon set, and these two
transaction won't be reconciled.
fce87d1c90
p2p: Add peers to reconciliation queue on negotiation
When we're finalizing negotiation, we should add the peers
for which we will initiate reconciliations to the queue.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
3642c07e1a
p2p: Track reconciliation requests schedule
We initiate reconciliation by looking at the queue periodically
with equal intervals between peers to achieve efficiency.
This will be later used to see whether it's time to initiate.
219b1a1cd8
p2p: Initiate reconciliation round
When the time comes for the peer, we send a
reconciliation request with the parameters which
will help the peer to construct a (hopefully) sufficient
reconciliation sketch for us. We will then use that
sketch to find missing transactions.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
sr-gi force-pushed
on Apr 18, 2025
sr-gi force-pushed
on Apr 21, 2025
sr-gi force-pushed
on Apr 21, 2025
sr-gi force-pushed
on Apr 21, 2025
DrahtBot removed the label
CI failed
on Apr 21, 2025
Respond to a reconciliation request
When the time comes, we should send a sketch of our
local reconciliation set to the reconciliation initiator.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
22f074214a
p2p: Add a function to identify local/remote missing txs
When the sketches from both sides are combined successfully,
the diff is produced. Then this diff can (together with the local txs)
be used to identified which transactions are missing locally and remotely.
5475d7feee
Use txid/uint256 in CompareInvMempoolOrder
This will help to reuse the code later on in the function
to announce transactions.
541a56a4d2
p2p: Handle reconciliation sketch and successful decoding
If after decoding a reconciliation sketch it turned out
to be insufficient to find set difference, request extension.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
d5a961b520
Be ready to receive sketch extension
Store the initial sketches so that we are able to process
extension sketch while avoiding transmitting the same data.
Co-authored-by: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
8793d7c6ba
p2p: Prepare for sketch extension request
To be ready to respond to a sketch extension request
from our peer, we should store a snapshot of our state
and capacity of the initial sketch, so that we compute
extension of the same size and over the exact same
transactions.
Transactions arriving during this reconciliation will
be instead stored in the regular set.
Co-authored-by: Gleb Naumenko <naumenko.gs@gmail.com>
f60c09411c
p2p: Keep track of announcements during txrcncl extensione4294d45df
p2p: Handle reconciliation extension request
If peer failed to reconcile based on our initial response sketch,
they will ask us for a sketch extension. Store this request to respond later.
e55497fb52
p2p: Respond to sketch extension request
Sending an extension may allow the peer to reconcile
transactions, because now the full sketch has twice
as much capacity.
a4c2e75445
Handle sketch extension
If a peer sent us an extension sketch, we should
reconstruct a full sketch from it with the snapshot
we stored initially, and attempt to decode the difference.
p2p: Handle sketch extension
If a peer sent us an extension sketch, we should
reconstruct a full sketch from it with the snapshot
we stored initially, and attempt to decode the difference.
0a442a3924
p2p: Add a finalize incoming reconciliation function
This currently unused function is supposed to be used once
a reconciliation round is done. It cleans the state corresponding
to the passed reconciliation.
616fa3dac2
Handle reconciliation finalization message
Once a peer tells us reconciliation is done, we should behave as follows:
- if it was successful, just respond them with the transactions they asked
by short ID.
- if it was a full failure, respond with all local transactions from the reconciliation
set snapshot
- if it was a partial failure (only low or high part was failed after a bisection),
respond with all transactions which were asked for by short id,
and announce local txs which belong to the failed chunk.
463a661866
p2p, test: Add tx reconciliation functional tests
We may still need to add more tests, specially around extensions (if we keep them)
Co-authored-by: Gleb Naumenko <naumenko.gs@gmail.com>
236dd9b8bb
sr-gi force-pushed
on Apr 22, 2025
DrahtBot added the label
CI failed
on Apr 22, 2025
REMOVE-ME: Some small changes to try to debug CI failureb71131e1af
DrahtBot removed the label
CI failed
on Apr 24, 2025
DrahtBot
commented at 11:09 pm on April 29, 2025:
contributor
🐙 This pull request conflicts with the target branch and needs rebase.
DrahtBot added the label
Needs rebase
on Apr 29, 2025
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2025-05-31 03:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me