-
Notifications
You must be signed in to change notification settings - Fork 37.7k
p2p: Erlay support signaling #23443
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
p2p: Erlay support signaling #23443
Conversation
2fbed48
to
20c4769
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. Coverage
Updated at: 2022-05-10T14:16:22.523123. |
6c2b134
to
90cd7a9
Compare
90cd7a9
to
c866831
Compare
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.
Reviewed until 85992f3. So far only minor comments.
c866831
to
5ba375e
Compare
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.
Finished a first parse, including verifying unit test coverage of the new TxReconciliationTracker
class. LGTM
|
5ba375e
to
6a79aae
Compare
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.
left some nits
|
cdaabda
to
ea3b87a
Compare
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.
Did you think about a -disablerecon
command or something similar, to not activate Erlay until all the parts have been merged?
Providing the opportunity to opt in/out would probably make sense anyway, but it would also make the review process of its parts independent from releases - e.g. I also don't think it makes sense to have nodes running master exchange SENDRECON before Erlay has been fully merged.
Yeah I was also thinking about how it's weird to send SENDRECON messages while they don't mean anything, but couldn't come up with any good solution. I guess a flag is better if someone wants to test this stuff via functional tests (without modifying the source code), so yeah, that's probably an ultimate solution. I'll add a commit for that. |
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.
Concept ACK, thanks for splitting it up. I did a first pass, mostly comparing to the BIP330 specification, looking at test coverage, and a little bit of implementation.
utACK ea3b87a Code review, everything looks good to me outside nits raised by others. Will run the fuzzer for some cycles, and report back results. |
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.
Approach ACK, code review until 103e52d - didn't look at tests yet.
This PR introduces the logic to register newly connected peers as peers that support transaction reconciliation, and initialize the necessary data structures required to do the reconciliation later on.
I think everything is well laid out and implemented, so most of my comments are quite nitty and focus on readability etc. They're subjective, feel free to ignore.
Some general thoughts/suggestions:
- "SENDRECON" does not hint that it corresponds to transactions, would it make sense to rename this to "SENDTXRECON" so people can quickly understand what it's about without know the Erlay code?
- I understand you're renaming the two roles to "initiator" & "responder", there are still quite a few instances of "requestor", "sender", "receiver" throughout the code and in BIP300. Would suggest to replace them all in both documentation and variable names, consistent naming makes it much easier to follow.
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.
Did you think about a -disablerecon command or something similar, to not activate Erlay until all the parts have been merged?
I agree that this should be added, although to bikeshed I'd call it -erlay
and default to false.
5136f50
to
07b9357
Compare
Still going through comments, beware it's not the final shape from my side. |
Once we received a reconciliation announcement support message from a peer and it doesn't violate our protocol, we store the negotiated parameters which will be used for future reconciliations.
We optimistically pre-register a peer for txreconciliations upon sending txreconciliation support announcement. But if, at VERACK, we realize that the peer never sent WTXIDRELAY message, we should unregister the peer from txreconciliations, because txreconciliations rely on wtxids.
e91690e
to
e56d1d2
Compare
Looks like rebased for #25667. |
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.
ACK e56d1d2
The newly added test |
re-ACK e56d1d2 |
Job: https://cirrus-ci.com/task/6088863331385344 |
The reason was likely
https://cirrus-ci.com/task/6088863331385344?logs=functional_tests#L605 However, I can't see how this could possibly happen in the framework. (peer8 is a python node) |
re-ACK e56d1d2 |
Thank you all for making this happen! I will create a PR for fixups, and finish the second PR shortly. |
Post-Merge ACK e91690e |
// - we intended to exchange transactions over this connection while establishing it | ||
// and the peer indicated support for transaction relay in the VERSION message; | ||
// - we are not in -blocksonly mode. | ||
if (pfrom.m_relays_txs && !m_ignore_incoming_txs) { |
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.
Is this going to send SENDTXRCNCL
to feeler connections?
@@ -484,6 +485,7 @@ void SetupServerArgs(ArgsManager& argsman) | |||
argsman.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||
argsman.AddArg("-networkactive", "Enable all P2P network activity (default: 1). Can be changed by the setnetworkactive RPC command", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||
argsman.AddArg("-timeout=<n>", strprintf("Specify socket connection timeout in milliseconds. If an initial attempt to connect is unsuccessful after this amount of time, drop it (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); | |||
argsman.AddArg("-txreconciliation", strprintf("Enable transaction reconciliations per BIP 330 (default: %d)", DEFAULT_TXRECONCILIATION_ENABLE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION); |
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.
Probably unrelated, but it might be good to split the connection section into net and net_processing options. (This one would go into net_processing)
This is a part of the Erlay project:
This PR adds a new p2p message
sendtxrcncl
signaling for reconciliation support.Before sending that message, a node is supposed to "pre-register" the peer by generating and storing an associated reconciliation salt component.
Once the salts are exchanged within this new message, nodes "register" each other for future reconciliations by computing and storing the aggregate salt, along with the reconciliation parameters based on the connection direction.