Skip to content

Conversation

@vasild
Copy link
Contributor

@vasild vasild commented Oct 6, 2022

The reconciliation protocol assumes using one role consistently. Since it is irrelevant which one is which, we can imply that the initiator of the P2P connection will assume the role of reconciliation initiator.

This protocol simplification will seep into the implementation.

The reconciliation protocol assumes using one role consistently. Since
it is irrelevant which one is which, we can imply that the initiator of
the P2P connection will assume the role of reconciliation initiator.

This protocol simplification will seep into the implementation.
@vasild
Copy link
Contributor Author

vasild commented Oct 6, 2022

Having two booleans means we have to deal with all 4 cases:

  1. initiator=false, responder=false - meaningless
  2. initiator=false, responder=true - ok
  3. initiator=true, responder=false - ok
  4. initiator=true, responder=true - not supported (cannot be supported?)

Allowing only 2. and 3. means we can have just one boolean and derive the value of the other from it.

However, since it is completely irrelevant which one is which we can just assign the roles based on who is the P2P connection initiator. bitcoin/bitcoin#23443 does that (+ trying to handle the nonsensical cases).

I think this redundancy can be a source of confusion and/or bugs.

@naumenkogs
Copy link
Contributor

The idea behind two non-implied roles was future upgradeability, which might be not based on the connection.

  • What we will have to do then if we drop 2-booleans now? Have a SENDTXRCNCLV2, probably with the same two flags again, or another implied combination, or something completely new. We will have the same debate, although it could be expanded.
  • How likely this is to happen? I don't know. I currently have no plans to seek for better reconciliation coordination, and I don't know anyone who has.

The fact that you caught a (comment) mistake in the code which was acked and near-merged is probably a good argument towards dropping this redundancy.

@sipa what do you think?

@sipa
Copy link
Member

sipa commented Oct 6, 2022

@naumenkogs I'm fine with just making the reconciliation direction fixed by the protocol. There is still a version number in sendtxrcnl, which could be used for future extensions.

@naumenkogs
Copy link
Contributor

Then I hope for the following events to occur shortly:

  1. Merge the Core PR
  2. Change this in a follow-up PR to Core, along with this BIP update merge

(unless we come to a different opinion in the meanwhile)
(also unless it takes too long and Luke rushes us to do something :))

@sipa
Copy link
Member

sipa commented Oct 6, 2022

I missed this was a PR already.

ACK 8b107a0

@naumenkogs
Copy link
Contributor

@vasild kinda unrelated to this PR. I'm not sure we have to always seek a synchronization between BIPs and master. I expect this BIP to be updated at least couple more times along the Erlay merging, and I think it's no big deal if e.g. the lag is one month.

@vasild
Copy link
Contributor Author

vasild commented Oct 6, 2022

Sounds good to use the version for future upgrades - then the sendtxrcncl can be expanded/appended with further data as needed.

Yeah, the waterfall model where design is followed by implementation rarely works. There will be iterative steps where some mods will be done to the design while the implementation is happening. We just have to keep in mind alternative implementations and not let things diverge too much for a long time, in case somebody implements stuff based on an outdated spec.

glozow added a commit to bitcoin-core/gui that referenced this pull request Oct 17, 2022
e56d1d2 test: Add functional tests for sendtxrcncl message from outbound (Gleb Naumenko)
cfcef60 test: Add functional tests for sendtxrcncl from inbound (Gleb Naumenko)
b99ee9d test: Add unit tests for reconciliation negotiation (Gleb Naumenko)
f63f1d3 p2p: clear txreconciliation state for non-wtxid peers (Gleb Naumenko)
88d326c p2p: Finish negotiating reconciliation support (Gleb Naumenko)
36cf6bf Add helper to see if a peer is registered for reconciliations (Gleb Naumenko)
4470acf p2p: Forget peer's reconciliation state on disconnect (Gleb Naumenko)
3fcf78e p2p: Announce reconciliation support (Gleb Naumenko)
24e36fa log: Add tx reconciliation log category (Gleb Naumenko)

Pull request description:

  This is a part of the Erlay project:
  - [parent PR](bitcoin/bitcoin#21515)
  - [associated BIP-330](bitcoin/bips#1376).

  -------

  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.

ACKs for top commit:
  dergoegge:
    re-ACK e56d1d2
  sipa:
    re-ACK e56d1d2. No differences with a rebase of previously reviewed e91690e67dad180c7fb9bed0409a9c4567d3e5df.
  mzumsande:
    re-ACK e56d1d2
  vasild:
    ACK e56d1d2

Tree-SHA512: 0db953b7347364e2496ebca3bfe6a27ac336307eec698242523a18336fcfc7a1ab87e3b09ce8b2bdf800ebbb1c9d33736ffdb8f5672f93735318789aa4a45f39
@naumenkogs
Copy link
Contributor

ACK 8b107a0

@maflcko
Copy link
Member

maflcko commented Oct 21, 2022

@luke-jr @kallewoof

@luke-jr luke-jr merged commit 15c8203 into bitcoin:master Oct 28, 2022
fanquake added a commit to bitcoin-core/gui that referenced this pull request Nov 30, 2022
46339d2 test, refactor: Reorder sendtxrcncl tests for better readability (Gleb Naumenko)
14263c1 p2p, refactor: Extend logs for unexpected sendtxrcncl (Gleb Naumenko)
87493e1 p2p, test, refactor: Minor code improvements (Gleb Naumenko)
00c5dec p2p: Clarify sendtxrcncl policies (Gleb Naumenko)
ac6ee5b test: Expand unit and functional tests for txreconciliation (Gleb Naumenko)
bc84e24 p2p, refactor: Switch to enum class for ReconciliationRegisterResult (Gleb Naumenko)
a60f729 p2p: Drop roles from sendtxrcncl (Gleb Naumenko)
6772cbf tests: stabilize sendtxrcncl test (Gleb Naumenko)

Pull request description:

  Non-trivial changes include:
  - Getting rid of roles in `sendtxrcncl` message (summarized in the [BIP PR](bitcoin/bips#1376));
  - Disconnect the peer if it send `sendtxrcncl` although we are in `blocksonly` and notified the peer with `fRelay=0`;
  - Don't send `sendtxrcncl` to feeler connections.

ACKs for top commit:
  vasild:
    ACK 46339d2
  ariard:
    ACK 46339d2
  mzumsande:
    Code Review ACK 46339d2

Tree-SHA512: b5cc6934b4670c12b7dbb3189e739ef747ee542ec56678bf4e4355bfb481b746d32363c173635685b71969b3fe4bd52b1c8ebd3ea3b35c82044bba69220f6417
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 1, 2022
46339d2 test, refactor: Reorder sendtxrcncl tests for better readability (Gleb Naumenko)
14263c1 p2p, refactor: Extend logs for unexpected sendtxrcncl (Gleb Naumenko)
87493e1 p2p, test, refactor: Minor code improvements (Gleb Naumenko)
00c5dec p2p: Clarify sendtxrcncl policies (Gleb Naumenko)
ac6ee5b test: Expand unit and functional tests for txreconciliation (Gleb Naumenko)
bc84e24 p2p, refactor: Switch to enum class for ReconciliationRegisterResult (Gleb Naumenko)
a60f729 p2p: Drop roles from sendtxrcncl (Gleb Naumenko)
6772cbf tests: stabilize sendtxrcncl test (Gleb Naumenko)

Pull request description:

  Non-trivial changes include:
  - Getting rid of roles in `sendtxrcncl` message (summarized in the [BIP PR](bitcoin/bips#1376));
  - Disconnect the peer if it send `sendtxrcncl` although we are in `blocksonly` and notified the peer with `fRelay=0`;
  - Don't send `sendtxrcncl` to feeler connections.

ACKs for top commit:
  vasild:
    ACK 46339d2
  ariard:
    ACK 46339d2
  mzumsande:
    Code Review ACK 46339d2

Tree-SHA512: b5cc6934b4670c12b7dbb3189e739ef747ee542ec56678bf4e4355bfb481b746d32363c173635685b71969b3fe4bd52b1c8ebd3ea3b35c82044bba69220f6417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants