465 Commits

Author SHA1 Message Date
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
Kim De Mey
70b83a4efb
Improve the discv5 initialization logs (#552)
- Unify the debug log and info log into one. Removing the
redundant information
- Log the custom ENR fields more pretty
- Make the JSON format logging more pretty for several types
2022-11-10 10:52:24 +01:00
Kim De Mey
86b37bf72e
Default compile all tests and binaries with TRACE log level (#549)
In order to avoid unused warning and more importantly to make
sure all log statements work.
2022-11-10 09:01:58 +01:00
andri lim
10870d8b15
Revert #544 "Fix related to nim devel branch" (#551)
This reverts commit:
5d13052dd93234c46074a968e96dba89cf93699d
e1bdf1741a0344c8c7187093220fc336198f415e
d238693571676b3214fcc623b4fcb0813f2abb0e
2022-11-09 18:57:04 +01:00
jangko
5d13052dd9
refactor: compile with nim-devel 2022-11-08 11:08:25 +07:00
jangko
e1bdf1741a
refactor p2pProtocol internals
Nim devel brach(1.7.1) introduce gc=orc as default mode.
Because the p2p protocol using unsafe pointer operations
for it's ProtocolInfo and using global variables scattered
around, the orc mistakenly(or maybe correctly) crash the protocol.
2022-11-08 09:41:45 +07:00
jangko
d238693571
refactor: replace shallowCopy with something else 2022-11-08 09:41:35 +07:00
Kim De Mey
64b56d866c
Add own node checks before sending ping (#548)
Seems there are two occasions possible where we try to ping the
own local node which causes an assert

- One via the bounding
- One via a received ping, which is strange in the first place but
notice in a stack trace
2022-11-07 14:25:11 +01:00
Kim De Mey
fef47331c3
Networkid common (#547)
* Move NetworkId type to common eth_types

NetworkId is after all a common type and this way it avoid an
application that requires it to also import all devp2p related
network types.

RLP related calls are moved to eth_types_rlp, this means that p2p
protocols that send NetworkId over the wire need to import this
too. Or just common in general.

* Remove # in front of multiline comment end bracket

These seem to be interpreted wrongly by the GitHub code browser.
2022-10-20 08:49:20 +02: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
Kim De Mey
ceac50c62f
Log the IP-address + Port when a discv5 send fails (#542)
This is specifically useful for when the failure is caused by an
"Operation not permitted", as then we can see for which specific
port(s) a firewall might be blocking outgoing traffic.
2022-10-10 10:33:40 +02:00
Kim De Mey
3e44299b49
Remove unused mock_peers and tserver files (#540) 2022-10-07 18:28:41 +03:00
Kim De Mey
4c821c5eae
Remove async_utils/traceAsyncErrors usage from discv5 (#541) 2022-10-07 18:20:03 +03:00
Kim De Mey
ba69c1ff29
Quickfix for a potential double future completion in rlpx (#538) 2022-10-06 13:34:35 +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
Jacek Sieka
2734ed6bda
kad: remove unnecessary randomize call (#535)
* kad: remove unnecessary randomize call

* use `rng.sample`
2022-09-19 10:47:30 +02:00
jangko
5885f638e4
discv4: fix ping pong time removal algorithm 2022-09-07 21:19:05 +07:00
jangko
58d7e98c5c
fix nim-devel compilation error in auth.nim 2022-09-07 11:49:00 +07:00
jangko
84e60c6930
fix discovery v4 ping pong handler 2022-09-07 11:48:59 +07:00
Jacek Sieka
5e4123fda8
tighter nimcrypto imports (#532) 2022-09-05 11:09:38 +02:00
Jacek Sieka
d31abca010
clean up eth_types (#531)
`eth_types` is being imported from many projects and ends up causing
long build times due to its extensive import lists - this PR starts
cleaning some of that up by moving the chain DB and RLP to their own
modules.

this PR also moves `keccakHash` to its own module and uses it in many
places.
2022-09-02 16:57:52 +02:00