Commit Graph

55 Commits

Author SHA1 Message Date
Kim De Mey 8088fe72d7
Update discv5 to use non deprecated ENR calls and simplify code (#710)
And due to avoiding an extra PublicKey.fromRaw call we get a
little performance boost also.
2024-06-27 16:18:21 +02:00
Kim De Mey d7577f59d7
Rework of ENR decoding code (#709)
- Rework to have exception raise only at rlp decoding and use
result types from then onwards
- Adjust the current API to have result versions and deprecated
the ones which had var Record + bool
- Add PublickKey to the Record object, as this allows us to skip
fromRaw calls whenever access is needed to the public key
- Add a TypedRecord.fromRecord which cannot fail and deprecate
the old one
- Some other minor clean-up & re-ordering
2024-06-27 15:15:23 +02:00
Kim De Mey 26212c881b
Use results.Opt instead of option in discv5, utp and nat (#705)
+ some other minor cleanups
2024-06-18 18:09:27 +02:00
Jacek Sieka bb5cb6a4d0
rlp: refresh code (#683)
A first step in cleaning up RLP, which has lots of interesting issues -
the next step would be to clean up the exception handling as well
(Resultify?)

* remove `RlpNode` (unused)
* single-pass parsing for most functionality via RlpItem
* stricter conformance to spec
  * remove float support
  * warn about signed integers
  * raise on invalid RLP earlier
* avoid several pointless allocations, in particular in `listLen`,
`listElem` etc
* include spec docs
2024-05-26 09:58:24 +02:00
Kim De Mey 21f3014f54
Remove usage of stew/shim/net (#670)
* Remove usage of stew/shim/net and replace with std/net where needed

* Remove chronosStrictException compile flag
2024-01-24 09:09:11 +01:00
tersec ca4898e24a
switch NAT module from ValidIpAddress to IpAddress (#647)
* switch NAT module from ValidIpAddress to IpAddress

* fix dcli build

* switch discv5 from ValidIpAddress to IpAddress

* fix fuzzers build

* mostly finish nim-eth to IpAddress transition
2023-11-10 09:28:21 +03:00
Kim De Mey d2ba753792
Add rlpx metrics and avoid immediate peer reconnections (#585)
* Add metrics related to devp2p peer connections

* Avoid reconnecting to peers that just failed connection

- Add SeenTable to avoid reconnecting to peers immediately after
a failed connect. Depending on the failure, the amount of time is
different. This is similar to what is done in nimbus-eth2.
- Attempt to rework rlpxConnect at the same time, in order to
make sure that errors are properly handled. The current structure
is far from ideal, but it is hopefully a small step in the right
direction. To many oddities in there right now to really rework
rlpxConnect properply.

* Fix rlpx thunk fuzzer
2023-03-16 16:45:12 +01:00
Justin Traglia e7d3de6ebf
Fix some typos (#557) 2022-11-16 17:44:00 +01:00
jangko ae616935c3
move eth1 specific code to where it belongs 2022-10-11 14:52:25 +07:00
Kim De Mey bd8d9c65a3
Seperate discv5 protocol message encoding from packet encoding (#539)
And some additional clean-ups
2022-10-10 12:13:20 +02:00
Jacek Sieka 591360284b
remove Whisper (#537)
replaced by https://rfc.vac.dev/ / https://github.com/status-im/nwaku
2022-09-21 11:58:22 +02:00
tersec 92b14b43eb
--styleCheck:error (#520)
* --styleCheck:error

* testcase -> testCase

* more testcase -> testCase

* remove unused imports

* MessageKind enum name consistency in tests

* rest of fuzz_decode_message

* rlpEncodeEIP155 -> rlpEncodeEip155
2022-07-21 08:58:17 +00:00
oskarth 44cb2256fd
Delete Whisper remains (moved to nim-waku) (#386)
Types, protocols, tests, hardcoded nodes, references.

Now part of nim-waku:
- https://github.com/status-im/nim-waku/pull/663
- https://github.com/status-im/nim-waku/pull/678
2022-06-20 19:10:50 +03:00
Jacek Sieka 1b516682bd
bearssl: use split api (#510) 2022-06-17 22:45:37 +02:00
Kim De Mey e62fdfe6f1
Add bind ip and bind port for eth1 rlpx and discovery protocols (#485)
Includes some small refactor on usage of result and Nim style
according to style guide.
2022-03-15 18:08:15 +01: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 df6020832b
Build fuzzing tests in CI and fix current fuzzing tests (#396)
* Build fuzzing tests in CI and fix current fuzzing tests

* Build fuzzing tests separately (fix Windows CI)
2021-09-07 16:00:01 +02:00
Kim De Mey a339944bcf
Some discv5 cleanup / refactor (#326)
* Use Address in HandshakeKey

* Refactor + comments + dcli use queryRandom

* Rename types.nim to messages.nim
2021-02-02 22:47:21 +01:00
kdeme bfbad64d83 Add update of ENR on newly discovered address 2021-02-01 20:30:55 +02:00
kdeme 44637cdd8e
Remove support for discovery v5.0 2020-11-13 12:33:07 +01:00
kdeme ce5f6e4c1f Add two fuzzing targets for discovery v5.1 2020-10-16 21:20:47 +03:00
Kim De Mey 38bf21b4f7
Update fuzzing readme.md 2020-07-21 10:58:14 +02:00
kdeme f0638eb3f1
Add rlp_decode fuzz test + some corpus generate code 2020-07-20 17:09:15 +02:00
kdeme 4e4836a0fe
Add discv5 fuzzing test targets 2020-07-20 14:17:44 +02:00
Kim De Mey 28a8d52308
Fix enr deserialization crash + more tests + fuzz test (#274)
* Fix enr deserialization crash + more tests + fuzz test

* CI: Install depsOnly
2020-07-11 01:28:53 +02:00
Kim De Mey 2c5eeded6d
Small fuzzing readme correction [skip ci] 2020-07-09 11:01:35 +02:00
Jacek Sieka 484fbcab1b
use bearssl rng throughout (#265)
* use bearssl rng throughout

* seeder can fail

* imports and exports

* modules, sigh

* one more try

* move var

* even fewer thread vars

* remove out-of-date genrated files
2020-07-07 10:56:26 +02:00
kdeme 4d0a7a46ba Update fuzzing tests now that the helpers have moved to ntu 2020-06-12 18:58:05 +03:00
Jacek Sieka fd6caa0fdc
Rlp experimental (#227)
* rlp: remove experimental features

* avoid range library

* trie: avoid reference-unsafe bitrange type
2020-04-20 20:14:39 +02:00
Jacek Sieka 0b110f3287
Secp more refactor (#211)
* simplify some modules

* mark several modules with raises
* fix clearing of keys in auth.nim
* fix keyfile case dropping off
* fix keyfile stream storage
* uuid should be output in lowercase

* enode: simplify API
2020-04-06 18:24:15 +02:00
Jacek Sieka ac5bbe4d3d
keys: get rid of deprecated calls (#213) 2020-04-04 18:44:01 +02:00
kdeme 4976bd9fb9 Replace getCurrentException and getCurrentExceptionMsg 2019-12-02 23:35:34 +02:00
kdeme 17f90920e0 Add unittest for rlpx thunk payload tests 2019-10-23 09:35:33 +09:00
kdeme 72d6c46950
Add the rlpx fuzzing thunk test 2019-10-16 11:56:24 +02:00
kdeme 757ac1ab86
Remove standalone define and add specific afl/libFuzzer define 2019-10-11 15:25:11 +02:00
kdeme 4b154e56c7
Fix aflLoop for non afl-clang-fast 2019-10-09 21:23:22 +02:00
kdeme f1604ca929
Add readme file 2019-10-08 16:57:31 +02:00
kdeme 19930cc94d
Add aflInit and aflLoop + add comments 2019-10-08 16:23:57 +02:00
kdeme eb4aee0260 Use less verbose / operator instead of DirSep 2019-10-02 14:45:29 +03:00
kdeme 2a0793ce60 Can use ospaths apparently 2019-10-02 14:45:29 +03:00
kdeme 94dee80aeb Add whisper encode decode test and rename rlp test 2019-10-02 14:45:29 +03:00
kdeme 0874f41a53 Fix quotes 2019-10-02 14:45:29 +03:00
kdeme 2b8921690c default init when init template is not used 2019-10-02 14:45:29 +03:00
kdeme 035b7eda24 Adress review feedback 2019-10-02 14:45:29 +03:00
kdeme 91862ce65b split functionality and script 2019-10-02 14:45:29 +03:00
kdeme 1148f773d1 rename to fuzztest & change standalone define 2019-10-02 14:45:29 +03:00
kdeme e101902aa5 Add basic fuzzing build tasks config.nims file 2019-10-02 14:45:29 +03:00
kdeme a3a33170db Modify basic script to allow launching afl or libFuzzer fuzzing 2019-10-02 14:45:29 +03:00
kdeme d337435aa1 Add simple rlp fuzz test 2019-10-02 14:45:29 +03:00
kdeme c0a067178b No need for macro, templates are fine 2019-10-02 14:45:29 +03:00