Commit Graph

128 Commits

Author SHA1 Message Date
Dmitriy Ryajov 9dfa86767d Revert "track nim-libp2p's unstable branch and nim-bearssl's master branch"
This reverts commit c480fb5732.
2022-09-23 15:59:31 -06:00
Michael Bradley, Jr c480fb5732 track nim-libp2p's unstable branch and nim-bearssl's master branch
refactor accordingly: mainly switching from `import bearssl` to
`import bearssl/rand`, `BrHmacDrbgContext` to `HmacDrbgContext`, and related
changes
2022-09-19 20:05:34 -05:00
Dmitriy Ryajov 39c0ffc970
Merge pull request #46 from status-im/chronicles-format
add formating for SignedPeerRecord
2022-09-13 14:26:02 -04:00
Dmitriy Ryajov 7c259731a4
add formating for SignedPeerRecord
needs to move to libp2
2022-09-13 12:01:36 -06:00
Dmitriy Ryajov 94b75f141c
Merge pull request #44 from status-im/providers-lru
Providers lru
2022-09-12 23:34:02 -04:00
Dmitriy Ryajov f5afe784c5
prevent npe when table is 0 2022-09-12 21:08:55 -06:00
Dmitriy Ryajov f84bc647ce
don't touch the cache when checking for id 2022-09-12 21:08:26 -06:00
Dmitriy Ryajov 23e20a2f1c
bad merge 2022-09-12 18:41:44 -06:00
Dmitriy Ryajov fca255b2f7
use `pure` enums 2022-09-12 18:06:48 -06:00
Dmitriy Ryajov c646b9c2b9
providers LRU - avoid unchecked growth 2022-09-12 18:06:46 -06:00
Dmitriy Ryajov e801660b44
Merge pull request #38 from status-im/fixes-for-integration
Fixes for dagger integration
2022-09-12 19:44:28 -04:00
Dmitriy Ryajov 3be2c8445c
suppress logging noise 2022-09-12 17:13:34 -06:00
Dmitriy Ryajov 1cbe8c12a6
suppress logging noise 2022-09-12 17:13:34 -06:00
Dmitriy Ryajov 2d93fa9e69
fix `updateRecord`
- support incrementing seqNo
- support updating with new record
2022-09-12 17:13:34 -06:00
Tanguy d90f0a03b9
Fixes for json logs 2022-09-12 17:13:33 -06:00
Tanguy bde7a26f9d
Fixes for integration 2022-09-12 17:13:33 -06:00
Dmitriy Ryajov e8177aa7eb
Merge pull request #39 from yyoncho/main
Add setup files
2022-09-12 14:29:47 -04:00
Ivan Yonchovski 36a49cdac4 Add setup files 2022-07-12 15:45:53 +03:00
Tanguy f824c0a3cd
Remove nim-eth dependency (#37) 2022-04-08 12:13:14 +02:00
Michael Bradley, Jr faf5cad9d4 protobuf encoding for all message types 2022-04-07 14:47:35 -05:00
Eric Mastro 4c65f4bd94 chore: remove nim-eth/keys in favour of over to libp2p/crypto
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.
2022-04-07 14:11:48 -05:00
Csaba Kiraly 74b73bfda0
Merge pull request #25 from status-im/add-findnode-by-id
Add back traditional findnode by target ID
2022-03-25 10:50:16 +01:00
Csaba Kiraly 667a8b91a4 test lookup with traditional findNode as well 2022-03-22 15:46:19 +01:00
Csaba Kiraly 01488104e5 add "traditional" targetID based findNode message
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.
2022-03-22 15:18:44 +01:00
Csaba Kiraly 6408cf4e3f
Merge pull request #26 from status-im/fix-bootstrap
Fix bootstrap in tests
2022-03-22 15:10:12 +01:00
Csaba Kiraly 4362c83a56 log improvements 2022-03-22 11:53:55 +01:00
Csaba Kiraly 50df73da1b fixup: tests: expose startup delay parameter 2022-03-22 11:53:55 +01:00
Csaba Kiraly d14222e8d1 tests: add back test after bootnode dies
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-03-22 11:53:55 +01:00
Csaba Kiraly 0431587765 test_providers: add optional delay during bootstrap
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-03-22 11:53:55 +01:00
Csaba Kiraly 7bef1e105f fix bootstrap: add node after successful handshake
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>
2022-03-22 11:53:55 +01:00
Csaba Kiraly 4d7e773c42 fix tests: make bootstrap nodes async 2022-03-22 11:53:55 +01:00
Eric Mastro d785aa4642 update codecov path to be informational 2022-03-22 11:00:26 +11:00
Csaba Kiraly 9a01791e11 feat: Swap ENR to libp2p SignedPeerRecords
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.
2022-03-22 11:00:26 +11:00
Eric Mastro b843c8823c feat: merge add/get providers with discv5
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.
2022-03-17 14:56:54 +11:00
Eric Mastro cbcaf926a1 feat: Swap PeerRecord for SignedPeerReocrd (PR comments)
- Add example addresses in tests
- Change bootnode private key in tests
- bump libp2p to get access to SignedPeerRecord.encode
2022-03-10 17:00:33 +11:00
Eric Mastro 35026762b4 feat: Swap PeerRecords with SignedPeerRecords
Providers now add/get SignedPeerRecords to/from the DHT.

Changed the PeerId calculation to use the public key of the discovery node.
2022-03-09 15:03:16 +11:00
Eric Mastro 4a2a6878b4 Remove nim development compiler version from CI 2022-03-08 13:55:53 +11:00
Eric Mastro 422511b961 chore: Add codecov yml settings
Specify `informational: true` to prevent CI failure with a reduction in code coverage. We are not at a point yet to need this.
2022-03-08 13:55:53 +11:00
Csaba Kiraly b65e0aa7ef comment out test instead of using skip()
after calling skip(), the test was still
executed and failed. Better to disable the
whole test.
2022-03-07 15:11:31 +11:00
Csaba Kiraly e8a8c28848
Merge pull request #16 from status-im/build/add-ci-action-2
Add CI Actions
2022-03-06 16:07:47 +01:00
Eric Mastro 0d0da71b65
build: Add CI Actions
Add CI workflow to run tests.

Add code coverage workflow that publishes results to CodeCov.

Add CI and coverage badges to README.

Bump asynctest to allow for `setupAll` and `teardownAll`.

Add local coverage nimble task.

Combine tests in to a testAll file.
2022-03-04 18:04:50 +11:00
Eric Mastro 55a43b2d89 chore: bump asynctest, use all/each test harness nouns
Using `setupAll`/`setupEach` and `teardownAll`/`teardownEach` for test harnesses.
2022-02-25 14:06:43 +11:00
Eric Mastro acd03ff831 feat: reorg project to add nimble build system
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.
2022-02-25 09:10:43 +11:00
Eric Mastro 617a98bd01 Initial commit with nimble initialised repo
# Conflicts:
#	README.md
2022-02-25 09:10:43 +11:00
Csaba Kiraly f530a24a25 moving all RLP enoding from messages to messages_encoding 2022-02-24 12:39:17 +01:00
Csaba Kiraly aca6febd34 fixup: fix trace message 2022-02-24 12:36:29 +01:00
Csaba Kiraly 7dd0ff1bb6 fixup: fix trace messages 2022-02-23 22:12:32 +01:00
Csaba Kiraly db4ccc8bee just reordering 2022-02-23 22:12:32 +01:00
Csaba Kiraly 6dcdaf6173 moving encode and decode to the same level 2022-02-23 22:12:32 +01:00
Csaba Kiraly 043f195e19 separating message structures and encoding 2022-02-23 22:12:32 +01:00