486 Commits

Author SHA1 Message Date
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
Kim De Mey
f169068df6
Fix missing CancelledError on discv5 waitMessage + results imports (#704)
Fixes a missing CancelledError async raising on discv5 waitMessage
which would cause "Error set on a non-raising future".

Also moves some more results import away from stew.
2024-06-13 12:11:25 +02:00
andri lim
224048a1d5
Revert perPeerMsgIdVar type until it properly fixed (#701)
* Revert perPeerMsgIdVar type until it properly fixed

* Add reminder
2024-06-12 13:29:57 +07:00
andri lim
4cccf25af7
Reduce compiler warnings related to rlp encode int (#699) 2024-06-12 09:29:18 +07:00
Kim De Mey
3d66c5b899
Fix ImplicitDefaultValue warnings + replace some obsolete inits (#697) 2024-06-10 21:19:25 +02:00
Kim De Mey
50e71b2daa
Add async raises annotations for discv5 (#690) 2024-06-10 13:47:35 +02:00
Jacek Sieka
0e83cfda97
results: use standalone repo (#687) 2024-05-30 14:46:57 +02:00
Eugene Kabanov
4cd9e27c09
Enable chronos dualstack with new constructor. (#681)
* Add constructor which will use latest chronos feature.

* Add ability to send to IPv4 addresses via dualstack socket.

* Fix decoding IPv4 mapped addresses.

* Use `*` instead of IPv6 address `::`.

* Removing debugging log statements.

* Address review comments.

* Remove debugging statements.

* Eliminate unnecessary variables.
2024-04-24 14:38:52 +03:00
andri lim
d8209f623f
Fix improper yield usage in rlpx and refine exception handling (#679)
* Fix improper yield usage in rlpx and refine exception handling

* Handle post hello step error
2024-02-19 14:16:33 +07:00
andri lim
efe610e27f
Don't auto write p2pProtocol macro expansion to file (#678) 2024-02-16 14:13:03 +07:00
andri lim
b9c40e1380
Use asyncraises in p2p (#675)
* Use asyncraises in p2p

* Fix capture error in async proc

* Remove gcsafe from async procs
2024-02-14 15:59:13 +07: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
Kim De Mey
496bcdab74
Fix chronos related deprecated warnings in discv5 and uTP (#667)
* Fix chronos related deprecated warnings in discv5

* Fix chronos related deprecated warnings in uTP code

* Improve discv5 closeWait order of events and add noCancel
2024-01-22 17:08:08 +01:00
andri lim
b75ee36576
Refactor p2pProtocol internals (#657)
* Refactor p2pProtocol internals

* Attempt to fix rlp crash with Nim v2 (#658)

* Attempt to fix rlp crash with Nim v2
* Fix test_ecies for nim v2
* Reduce compiler warnings
* Resolve ambiquity in testutils

* Disable nim devel continue-on-error
2024-01-22 16:47:46 +07:00
Kim De Mey
2c6049b126
Fix a future .callback usage in rlpx (#666) 2024-01-19 12:29:11 +01:00
andri lim
c57cebfd81
Fix discv4.send: use addCallback instead of .callback (#665) 2024-01-19 11:31:17 +01:00
Kim De Mey
cbcd1fd307
Fix for uTP issues with latest chronos (#655)
* Fix for uTP issues with latest chronos

* Fix for discv5 issue with latest chronos

* Increase amount of data send in uTP and uTP over discv5 tests
2024-01-12 17:35:44 +01:00
Kim De Mey
11049fb87d
Fix a bunch of compiler hints and warnings in uTP and discv5 (#652)
* Fix a bunch of compiler hints and warnings in uTP and discv5

* Leave in the cancel() for now
2024-01-12 09:49:06 +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
700360fde2
Rename routing_table_nodes metric for discv4 routing table (#646) 2023-10-31 18:28:21 +01:00
andri lim
4b00b230d0
Remove unused bootnodes and add Holesky bootnodes (#644)
* Remove unused bootnodes and add Holesky bootnodes

* Fix enode test
2023-10-25 11:07:55 +07:00
Jacek Sieka
02c8a1276b
avoid use of shallow (#636)
this probably has some tiny overhead but it shouldn't practically matter
2023-09-20 09:24:24 +02:00
Kim De Mey
0d7e7448c4
Allow passing along the handshake ENR through talkresp handler (#634)
This allows for protocols build on top of discv5 to use the ENR
provided in the handshake directly, instead of having to rely
on requesting it from the discv5 routing table.
2023-08-30 17:44:05 +02:00
Etan Kissling
946ffe0a4a
arc/orc lacks shallowCopy --> use move (#630)
`shallowCopy` is not available in `--mm:arc/orc`, but our usage can be
replaced with `move`.
2023-08-15 14:48:41 +02:00
tersec
d217d309eb
revert some func back to proc; unused by nim-eth tests (#629) 2023-08-02 23:00:49 +00:00
tersec
01ae82fd70
specify exceptions of callback called by exception-free function (#628) 2023-08-01 06:05:22 +00:00
Kim De Mey
26ae539598
Use results Opt for discv5 getNode and resolve (#625) 2023-06-26 11:30:33 +02:00
jangko
6b8a7b009e
implement EIP-4844: Shard Blobs Transactions 2023-06-23 13:48:51 +07:00
Kim De Mey
c5dd5e4115
Enable tests with also json sink and fix failures (#624)
And a few minor cleanups
2023-06-22 16:13:16 +00:00
jangko
6dacb2ca5c
fixes related to stint breaking changes 2023-06-21 17:55:00 +07:00
tersec
c608426d03
add/change Deneb fields per https://github.com/ethereum/execution-apis/pull/417 (#616) 2023-06-03 18:47:55 +00:00
Kim De Mey
d57a1094b1
Remove all Defect raises to avoid unnecessary warnings (#607)
As this module dropped support for Nim versions < 1.6, all Defect
raises can be removed to avoid unnecessary warnings
2023-05-10 15:50:04 +02:00
jangko
607539d821
upgrade github actions to v3 2023-05-05 17:25:15 +07:00
jangko
917888356e
no more wild constants and rename ecdhSecret to ecdhSharedSecret 2023-04-21 16:08:57 +07:00
jangko
9bf2e1786b
remove ecdhRaw usage and replace it with ecdh+custom hash function 2023-04-20 15:45:23 +07:00
Kim De Mey
25b0da0280
Fix JSON writer for logging in devp2p code (#597) 2023-04-18 13:51:02 +02: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
Kim De Mey
d2a3727c4c
Use chronos isGlobal to verify public IPs for net/nat and discv5 (#588) 2023-02-21 09:34:26 +01:00
Kim De Mey
4d55bfc9e8
Move dcli tool to a tools folder (#584) 2023-01-27 18:40:40 +01:00
Adam Spitz
58284ffeda
Attempt to connect to many peers concurrently, not in sequence. (#575)
The old code, which did it in sequence, made it take a very long
time to accumulate peers in the peer pool, particularly because
occasionally a connection-attempt would hang for a couple of minutes
before timing out.
2023-01-04 05:56:23 -05:00
Kim De Mey
40ec601d07
Fix accidential usage of default rlp decode for DisconnectionReason (#572) 2022-12-14 10:57:23 +01:00
Lorenzo Delgado
5c46220e72
add eth topic to all the logs scope (#568) 2022-12-06 14:54:03 +01:00
Lorenzo Delgado
833818e9c7
Make discv5 protocol-id configurable at compile time
Co-authored-by: ksr <kaiserd@users.noreply.github.com>
2022-11-30 12:59:41 +01:00
Mikel Cortes
f4ef9181c7
persist discovered ENRs from the discv5 into CSV (#560)
* persist ENRs (parsed) from the discovery5 protocol

* filter fork_digest from eth2 data

* Update eth/p2p/discoveryv5/dcli.nim

Co-authored-by: Kim De Mey <kim.demey@gmail.com>

* apply reviewer's suggestions

Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-11-23 23:48:44 +01:00
Kim De Mey
9ba1eb99e3
Fix possible crashes due to RangeErrors in rlpx auth decoding (#558)
- Fix two possible RangeErrors, due to negative seq allocation
in decodeAuthMessageEIP8 and in decodeAckMessageEIP8
- Set the minimum auth message size to AuthMessageEIP8Length,
in case there are clients that no longer add padding
- Add tests for invalid length cases
2022-11-17 08:46:27 +01:00
Justin Traglia
e7d3de6ebf
Fix some typos (#557) 2022-11-16 17:44:00 +01:00
Justin Traglia
ff0b1a330a
Allow distance of 256 in lookupDistances (#556) 2022-11-15 12:36:16 +01:00
Kim De Mey
4b22fcdce4
Proc to func in enr code and style guide related clean-up (#555)
Should not have any functional changes. Clean-up related to
avoiding result usage (also implicit), and other style
guide items.
2022-11-15 10:34:56 +01:00
Kim De Mey
522db295f2
Fix RLP deserialzation for Enum with holes (#554)
RLP Enum deserialization would currently not check if "hole values"
were attempted to be converted to the enum type. Now use
checkedEnumAssign and fail with RlpTypeMismatch on invalid values.

There is at least one occurance of an enum with holes in rlpx p2p:
DisconnectionReason. For this enum the issue could occur.

Also:
- Added enum RLP tests and rlpx p2p disconnect message tests to
test the DisconnectionReason with enum hole value.
- Fixed worse custom DisconnectionReason decoding occurance
in rlpx in waitSingleMsg proc where this issue could occur.
2022-11-14 15:49:37 +01:00
Kim De Mey
9b0f054b04
Tackle some Nim warnings new since Nim 1.4 & 1.6 (#553) 2022-11-10 16:32:57 +01:00