Commit Graph

41 Commits

Author SHA1 Message Date
andri lim 10870d8b15
Revert #544 "Fix related to nim devel branch" (#551)
This reverts commit:
5d13052dd9
e1bdf1741a
d238693571
2022-11-09 18:57:04 +01:00
jangko 5d13052dd9
refactor: compile with nim-devel 2022-11-08 11:08:25 +07:00
jangko d238693571
refactor: replace shallowCopy with something else 2022-11-08 09:41:35 +07:00
Jacek Sieka 1b516682bd
bearssl: use split api (#510) 2022-06-17 22:45:37 +02:00
Kim De Mey 2c236f6495
Style fixes according to --styleCheck:usages (#452)
Currently only setting `--styleCheck:hint` as there are some
dependency fixes required and the compiler seems to trip over the
findnode MessageKind, findnode Message field and the findNode
proc. Also over protocol.Protocol usage.
2021-12-20 13:14:50 +01:00
Kim De Mey e606d8c79e
Export discovery routing table and its buckets nodes (#430) 2021-11-22 18:53:52 +01:00
Kim De Mey 22757db83b
Fix logDistance for BE arch and remove toBytes for NodeId (#427)
toBytes for NodeId wasn't selected by compiler byt if it does
get selected, it will fail on the test cases due to the
countdown that is done in logDistance.
Set to toBytesBE properly now and do countup, that should make
it correct also for BE architecture.

Removed toBytes to avoid confusion and avoid this one being
selected ever. The only place toBytes for NodeId was used is in
sessions.nim makeKey func and there also the stint one
(thus native endianness) was selected in Nim 1.2.x.
Native endianness is fine there as it is only an internal
representation.
2021-11-17 22:55:19 +01:00
Kim De Mey 5125a438db
Make the custom distances call somewhat more accessible (#404)
And make the naming more consistent
2021-10-07 16:03:12 +02:00
Kim De Mey bea1f1c6a1
Clean-up routing table object constructions (#395) 2021-09-07 11:56:16 +02:00
KonradStaniec bfadcfbfaf
Make Routing table distance function configurable (#392) 2021-09-02 14:00:36 +02:00
Kim De Mey dd02d1be23
Remove unused lastUpdated from buckets (#382) 2021-07-29 21:58:10 +02:00
Kim De Mey 79911ed5d8
Log distance to uint16 and add public neighbours calls (#371)
* Use uint16 instead of uint32 for discv5 log distance

* Make neighboursAtDistances and neighbours calls available
2021-07-13 10:05:46 +02:00
kdeme 00a45a7b91
Remove inline pragmas 2021-05-11 09:59:58 +02:00
kdeme e10ef19f81
Move push raises to top and add/update license info where needed 2021-04-28 16:20:05 +02:00
Kim De Mey 762415319c
Add build_dcli target and add it to CI (#344)
* Add build_dcli target and add it to CI

* Fix local imports for dcli

* And use local imports for all other files too

* Use local imports in tests and rlpx protocols
2021-04-06 13:33:24 +02:00
kdeme 68c9b7b3ad
Fix lookup to sort and query closest nodes 2020-12-15 13:24:57 +01:00
Kim De Mey b4c1391be9
Discv5 ip limits for routing table (#308)
* Add ip limits to routing table and routing table buckets

* Fix order of ip limit check and duplicate check for replacement

* Fix ip limit for node with updated ip in ENR

* Fix bug where address wouldn't update on ENR update

and update some comments

* Reuse some add/remove code in routing table

* Fix seen bug on ENR update in routing table

* Rework addNode to make sure to do address check always

and adjust some logs.

* More documentation on the ip limits in routing table [skip ci]
2020-11-26 18:20:15 +01:00
kdeme ce2cd2323c Support findnode with multiple distances in discv5.1 2020-10-16 21:20:47 +03:00
kdeme 84fd39a8f8
Update enrs in buckets and replacement caches and fix empty ENR list in AuthResponse 2020-07-17 11:14:08 +02:00
Kim De Mey 7febbec673
Use brHmacDrbgGenerate for all random operations in discovery (#272) 2020-07-13 14:34:53 +02:00
Kim De Mey 0888667ac0
Comments and cleanup (#276)
* Fix dcli + add more comments

* Fix pong enr sequence number + varia cleanup

* Send randomData in case no handshake was done yet. Fix #277
2020-07-12 17:25:18 +02:00
Kim De Mey 9a467225fb
Add routing table metrics + tweaks + fixes (#261)
- routing table metrics + option in dcli
- only forward "seen" nodes on a findNode request
- setJustSeen & replace on ping AND findnode
- self lookup only at start
- revalidate 10x more
- use bitsPerHop (b) of 5
- small fix in resolve
- small fix in bucket split
2020-06-30 13:35:15 +02:00
kdeme e28f3f987c
routing table: resolve some TODOs 2020-06-24 12:29:59 +02:00
kdeme ba19465892
Functional replacement cache 2020-06-23 16:11:58 +02:00
kdeme ceb4a20463 Fix depth calculation for bucket splitting 2020-06-23 09:35:12 +02:00
kdeme 2d7b3440f2 make bitsPerHop configurable + add routing table tests 2020-06-23 09:35:12 +02:00
kdeme 6c85a48b4c Fix bucket ordering and add comments on this 2020-06-23 09:35:12 +02:00
kdeme 7e35b329b4 Add limit to the replacement cache 2020-06-23 09:35:12 +02:00
Kim De Mey 225a9ad41c
Add predicate filter option for randomNodes (#251)
* Add predicate filter option for randomNodes

* Further ValidIpAddress fixes

* Add gcsafe/noSideEffect and add test case
2020-06-11 21:24:52 +02:00
Kim De Mey a110f091af
Discv5 eh2 (#240)
* Discv5: More error handling improvements

- More results usage and raises pragma annotations
- Remove ENode related code and adjust Node object
- Misc.

* Add sendMessage and catch RlpError when decoding WhoAreYou

* Make the receive proc exception free

Except for `Exception` hah...

* Address review comments

* And another bunch of results and raises annotations

* Send Nodes Message also on 0 nodes and remove usage of broken require
2020-05-28 10:19:36 +02:00
kdeme 887cbba563
discv5: Address review comments 2020-05-01 22:34:26 +02:00
kdeme 74df90e16d
discv5: further prepping for results error handling 2020-04-30 00:11:03 +02:00
kdeme 59ba3704d6 Add resolve proc + test 2020-04-21 21:27:32 +02:00
kdeme d3c9ccea67 Fix FindNode to return nodes with specific distance + tests 2020-04-21 21:27:32 +02:00
Kim De Mey 99c68d40f7
Fix idAtDistance (#219) 2020-04-14 11:08:08 +02:00
kdeme 00c2bac465 Fix logDist and add test 2020-03-24 16:45:15 +02:00
kdeme 86bceaa5d8
Add TODO comments from review 2020-03-01 11:50:26 +01:00
kdeme f81a87f31b Add lookupLoop and other fixes
- add lookupLoop
- protocol close / closeWait
- randomize randomNodes
- Use lookupRequestLimit
- Remove invalid check in neighbours proc
- Add lookup test
2020-02-29 14:00:58 +01:00
kdeme 5daaf73d2e Clean up logging and some exception handling 2020-02-17 22:38:56 +02:00
Yuriy Glukhov 129710d3e4 Liveness checks 2020-01-08 17:22:43 +02:00
Yuriy Glukhov eda6c2906c Discv5 WIP 2020-01-08 17:22:43 +02:00