59 Commits

Author SHA1 Message Date
Csaba Kiraly
45e2dead2d
chronosim: trace instead of info
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-06-02 22:17:51 +02:00
Csaba Kiraly
d496a47394
changing async logic for nodes (multi) response
The previous version was based on the assumption that
that the future of waitMessage is triggered in the
event loop before the next message arrives. This seems
to be true with UDP, where a full cycle of the loop
handles only one datagram, but not true with other
transports, such as the in-memory emulation. This
led to the following behavior:
- 1st response arrives, reqId removed, waitMessage called
- 2nd ... last messages arrive, can't find reqId, so dropped
- waitMessage competes, re-adding reqId, but too late

The new version solves this by collecting SPRs explicitly

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-06-02 22:17:04 +02:00
Csaba Kiraly
50dd3cd7b3
encoding: introducing the "nop" cipher
remove encryption for faster large scale tests.
Do not use for anything else!

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-06-02 22:06:39 +02:00
Csaba Kiraly
8f7d3424a1
encoding: introducing type cipher=aes128
Introducing the cipher type to ease changing cipher.
No functional change

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-06-02 19:03:57 +02:00
Csaba Kiraly
c048362b8e
dht: waitMessage: expose timeout as parameter, keeping default
defults to ResponseTimeout as before

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-17 08:08:12 +02:00
Csaba Kiraly
e934dd7b96
add random loss
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-13 11:37:10 +02:00
Csaba Kiraly
527db66a02
chronosim: add timewarp
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 10:05:42 +02:00
Csaba Kiraly
d8b0421af5
chronosim: use const to configure
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 10:05:21 +02:00
Csaba Kiraly
eb74441394
add logscope
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 10:04:21 +02:00
Csaba Kiraly
f58f8cbade
introducing ChronoSim
ChronoSim, the simulation/emulation wrapper
around nim-chronos.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 09:31:55 +02:00
Csaba Kiraly
349eb01ed4
add stub for egress queuing
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 09:16:31 +02:00
Csaba Kiraly
dcb6c244c8
generalize p2p delay
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 09:16:31 +02:00
Csaba Kiraly
ba0d671e51
add 50ms simulated network latency
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-11 01:23:43 +02:00
Csaba Kiraly
23733c13c8
remove some debug output 2023-05-11 01:23:06 +02:00
Csaba Kiraly
3e0c2839b5
add recvFrom to fake DatagramTransport
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 22:12:56 +02:00
Csaba Kiraly
cd1303f6c0
rename callback
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 22:12:30 +02:00
Csaba Kiraly
5e0cdd1452
remove some echo lines
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 22:12:09 +02:00
Csaba Kiraly
8b24458066
fixup: move sendRequest forward
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 21:38:57 +02:00
Csaba Kiraly
349127f657
add on/off for network emulator
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 21:33:23 +02:00
Csaba Kiraly
eb08cbfc07
introduce waitResponse wrapper
initialize wait for response before sending request.
This is needed in cases where the response arrives before
moving to the next instruction, such as a directly connected
test.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 21:31:18 +02:00
Csaba Kiraly
70c2d28b89
use 127.0.0.1 for these tests
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 16:13:42 +02:00
Csaba Kiraly
fd317a55cb
add simple send functionality
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 16:12:33 +02:00
Csaba Kiraly
6109cbae80
index by port
0.0.0.0 vs. 127.0.0.1 creates various issues
As a start, we can index by port only

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 16:11:22 +02:00
Csaba Kiraly
20ff87b42f
simplify code changes
no need to name it different, we can override DatagramTransport

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 16:10:23 +02:00
Csaba Kiraly
dcdef89401
make it compile with gcsafe
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 14:00:40 +02:00
Csaba Kiraly
2eef69f3e7
try to add global registry of endpoints
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 13:47:49 +02:00
Csaba Kiraly
e8b019b591
store TransportAddress
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 13:46:42 +02:00
Csaba Kiraly
b1957f4b60
Fake DatagramTransport: first compile
Override Chronos DatagramTransport with a fake one

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 11:53:17 +02:00
Csaba Kiraly
7956898882
change revalidateLoop to use [RevalidateMax/2, RevalidateMax]
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 11:50:52 +02:00
Csaba Kiraly
4b49586f1e
improve tracing of message exchange
run e.g. as
```
nim c -r -d:debug -d:chronicles_enabled=on -d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[nocolors,stdout] tests/dht/test_providers.nim >err
```

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2023-05-10 10:19:37 +02:00
Csaba Kiraly
591b270dc3
log routing table size periodically 2023-05-10 00:46:45 +02:00
Dmitriy Ryajov
4375b92298
use datastore has (#56) 2022-12-02 16:47:16 -06:00
Dmitriy Ryajov
e4e7a3e11f
track nim-libp2p's unstable branch and nim-bearssl's master branch (#51)
* 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

* fix ambiguous identifier

* nim 1.4 is deprecated

Co-authored-by: Michael Bradley, Jr <michaelsbradleyjr@gmail.com>
2022-11-02 10:21:05 -06:00
Dmitriy Ryajov
d6d255b4b5
Cleanups (#55)
* limit query to batchSize

* allow initializing node from ip and port

* misc cleanups
2022-10-31 22:41:33 -06:00
Dmitriy Ryajov
08928e57d8
Remove local providers (#53)
* refactor to use batch deletes

* add ability to remove local providers
2022-10-03 15:14:47 -06:00
Dmitriy Ryajov
4b9fa0356e
Adding maintenance routines to cleanup expired and orphaned records (#52)
* add maintenance routines and split out cache

* start provider manager

* export provider manager

* add maintenance tests

* start is now async
2022-10-01 10:05:03 -06:00
Dmitriy Ryajov
69ae7c2012
Persist providers (#49)
* initial providers manager implementation

* misc license update

* spelling

* rename provider tests

* add provider tests

* reexport provider manager

* only update provider record if it changed

* small bug in getProvByKey

* pass providers to both constructors

* fix records retrieval

* disable cache during tests

* avoid redefining data

* adding back tests with cache

* use `.errorOption`

* proper err msg unpacking
2022-09-29 17:49:55 -06:00
Dmitriy Ryajov
9dfa86767d Revert "track nim-libp2p's unstable branch and nim-bearssl's master branch"
This reverts commit c480fb573242ab13fab57446aeece90eaabbe104.
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
7c259731a4
add formating for SignedPeerRecord
needs to move to libp2
2022-09-13 12:01:36 -06: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
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
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