-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WIP] LLMQs Implementation #2311
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
bf36161 to
1008a2c
Compare
PastaPastaPasta
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.
Wow, that was a lot. I'm sorry... Lot's of formatting fixes. A few (maybe) actual code change requests
src/crypto/bls_ies.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.
\n
src/batchedlogger.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.
\n
src/rpc/rpcquorums.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.
same line or brackets
src/rpc/rpcquorums.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.
same line or brackets
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.
\n
src/util.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.
brace on newline for namespaces
src/bench/bls.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.
alphabetize
758801f to
6cad9eb
Compare
|
Just force-pushed my current version. This version is now based on the current develop branch (v13). A lot has changed in the code, especially the way I propagate and validate signature shares between LLMQ members. In the previous version, I was directly pushing sigshare batches to intra-quorum connected nodes, without checking if these already have these shares. I did this because the classical INV system would already send around messages of at least 32 bytes size, so I assumed directly sending the shares itself would actually reduce the overhead of the INV system. Turned out it still produces too much overhead and chatter between nodes, especially as we now have switched to BLS12-381 with 96 byte signatures. With this switch, even the classical INV system would probably be better performing then what I did initially (direct push). Instead of switching to the INV system, I implemented a specialized inventory system for signature shares. It should perform MUCH better and with much less overhead then the general purpose INV system. Instead of announcing INV items to the other nodes, LLMQ members will now send Members will now regularly (every 100ms) check which shares were announced by other members and which shares are missing locally and request these from other members. They will also check what other nodes requested and send them these shares. All the communication is leveraging the Also, in the old version I extensively used the Instead, I'm leveraging (single-threaded) batched verification as much as possible now. Incoming shares are put into a pending batch and then processed every 100ms. Verification is then done in sub-batches to avoid DoS attacks (an attacker sending 100 valid shares and one last invalid one). I first try to batch together from all nodes and if that succeeds, all shares are accepted. If it fails, I revert to per-node batching to figure out which node sent the invalid shares. I'll document all this in-code when I find time, as reviewing it will otherwise not be fun. Another change is how I determine to which nodes to announce shares to. Previously, I only sent shares to members which were determined by the intra-quorum connections selection algorithm. This however had the disadvantage that it only announced shares to outgoing connections and did not take incoming connection from other members into account. As there is no easy way to determine which incoming connection is from a LLMQ member, I implemented something like "if someone ever sends me a share belonging to my quorum, he must be interested in my shares as well, so I announce him all the shares I got from now on". It doesn't necessarily mean it's really a member of the same LLMQ, but its 99% likely. |
|
Also updated the example dash.conf to work with the changes we did in develop |
a2b26cf to
f3a9760
Compare
When many nodes have to be interconnected, waiting for the handshake dramatically slows down the tests. This allows to disable waiting for the handshake.
Useful when many sigs need to be deserialized and at the same time the hash of these is never used.
https://github.com/andremaravilha/cxxtimer Commit: 7d208ebba79e85da8efae5a4b8996846a68bee0f
- Distributed Key Generation (DKG) - Mining of final quorum commitments
These are quite important and waiting for 2 minutes when the first peer did not send it is not acceptable.
IsMasternodeOrDisconnectRequested will internally lock cs_vNodes so we must ensure correct lock ordering.
|
Closing this PR as the code has been merged through smaller PRs. |
This is my current state of the LLMQ implementation. It's for review only and not meant for merging for now. It also contains #2296. There are also still a few things to do, also in regard to compatibility to the actual DIPs. Some things are not implemented yet and for other things it turned out that the DIPs need to be modified.
If you want to experiment with it, there is the
./qa/rpc-tests/quorums.pyscript available which will locally start up a few MNs and leave them running until you kill that script. It will generate the necessary blocks to fund the MNs and activate DIP3. After all MNs have been started, sporks are put in place so that you can start testing LLMQs. At this point, no LLMQs have been created yet.Regtest has a single LLMQ type configured, which creates a LLMQ of size 10 every 24 blocks. Give the DKG enough time (a second per block) when you generate blocks by yourself.
After a LLMQ has been activated/mined, send some TXs around to see LLMQ signing happen.
Connect to the MN network with either RPC or (as I do) a dash-qt instance with this configuration: