Closes: #2.
Libp2p supports multiple cryptographic curves, however we have currently only implented support for secp256k1.
This needs to be run with the compiler flag `libp2p_pki_schemes` set to `secp256k1`. If running the tests, this can be run like so: `nimble test —libp2p_pki_schemes=secp256k1` to put secp as the first supported crypto scheme.
This patch adds a findNode message sending the actual
target ID as in traditional Kademlia lookup. This in
contrast to the actual findNode message that send information
about the distance only, leading to more secure but slower lookups.
Having both primitives allows us to select which to use per use case.
Current naming is findNode for the distance based message and
findNodeFast for the message added in this patch.
Previous version was very conservative about adding nodes to the
routing table, requiring a full request/response message exchange
initiated by us.
Here we also add the node as 'seen' if the whoareyou/handshake
exchange was successful.
This significantly speeds up bootstreap from 0
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Swap all instances of Record with SignedPeerRecord.
Allow for `SignedPeerRecord`s to be updated by updating the first multiaddress in the `PeerRecord`. This also increments the `seqNo` in the `PeerRecord` only if the address was actually updated.
Merge the add/get providers messages with the discovery v5 messages inside of the discovery v5 code. Discovery v5 uses RLP encoding, while the add/get providers uses protobufs, as per the libp2p spec. The merge of these two uses RLP on the outer wrapper of the message, and a protobuf-encoded blob on the “inside” for the add/get providers messages only. Eventually this needs to change so that we use protobufs only.
There is still some code in the libp2pdht/dht directory, which is being read from the discovery v5 directory. Eventually these two should merge as well.
Project has been updated to use nimble as a build system. All required dependencies have been added.
All nim-eth mirrored files were added to a private folder in the libp2pdht module. A libp2pdht/discv5 module was added to alias the nim-eth modules (which will change over time).
Test have been updated to use status-im/asynctest. This PR uses a branch of asynctest that supports async suite before/after. This seemed like the only the tests would work without throwing gcsafe errors.
All tests working.