Commit Graph

748 Commits

Author SHA1 Message Date
KonradStaniec 883825aad7
Make discv5 timeouts configurable (#523) 2022-08-05 15:19:16 +02:00
KonradStaniec a5ea6a9a90
Add connection limits to utp (#522) 2022-08-04 15:55:39 +02:00
tersec 4e9a62e765
update to supported macOS GitHub CI image (#521) 2022-07-22 15:19:53 +00: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
KonradStaniec cbb233d8a9
Increase tests speed to avoid hangs (#511) 2022-07-11 08:24:03 +02:00
Kim De Mey 9d7e4b031a
Clean-up of several compiler warnings (#519) 2022-07-09 10:55:15 +02:00
Kim De Mey 7cc3c59ff1
Clean-up bootnodes.nim (#518)
- Remove Waku/Whisper Status bootstrap nodes as this is no longer
part of nim-eth
- Update bootstrap nodes according to latest data in go-ethereum
2022-07-08 20:32:41 +02:00
Kim De Mey c67e48be1d
Change info log to debug in uTP router connect (#517)
These uTP logs are common and should be under debug,
else they spam on application level.
Probably accidentally changed in https://github.com/status-im/nim-eth/pull/508
2022-07-04 12:13:46 +02:00
Jordan Hrycaj 2c08626ed8
Sepolia bootnodes added (#516) 2022-07-01 16:42:43 +01:00
tersec 6e813353eb
make some safe cstring conversions explicit (#515) 2022-06-28 13:03:02 +02:00
Miran 5c0893bfb6
move -d:nimRawSetjmp to nim.cfg (#513)
* move -d:nimRawSetjmp to nim.cfg

Refs https://github.com/status-im/nimbus-build-system/issues/44
2022-06-21 16:25:42 +02: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
Jordan Hrycaj 8761ea3222
Fix stability issues (#512)
* Fix stability issues

why:
  Handling malformed messages typically raises `RangeError` exceptions
  when de-serialising RLP, or decoding message data. This is an
  (incomplete) attempt to weed out some out it driven by real live
  tests.

remark:
  Employing the new `snap` protocol there might be different views on what
  the messages really contain (currently specs are more a hint.)

* Update RLP exception handling

* Undo effect-less patch

why:
  problem occurred somewhere above the try/catch handler

* Using `checkedEnumAssign()` for RLP enum
2022-06-16 16:23:07 +01:00
KonradStaniec dacf827a86
Add custom scalar functions to sqlite (#509) 2022-06-02 14:14:15 +02:00
KonradStaniec dffaa78cbe
Install cancel callback on whole connection future (#508) 2022-05-30 10:28:10 +02:00
Jordan Hrycaj 00ed6ad312
Dedicated RLP reader for `DisconnectionReason` (#507)
* Provide dedicated `DisconnectionReason` enum type RLP reader

why:
  Without this reader, the program communicating via RLPX will crash when
  receiving out of bound reason codes disconnect message.

  Out of bound value assignments to an enum causes a `RangeError`defect
  and consequently the program to terminate. This `RangeError` is avoided
  here and a `MalformedRlpError` catchable error raised.

* Using default exception type in bespoke `read(DisconnectionReason)`

why:
  This should not differ from the default enum parser. The particular
  message is different and more targeted, here.

  Note: The default RLP parser was not used because `
  `array[1,DisconnectionReason]` is currently not properly handled and
  should give a siliar error message as a `DisconnectionReason` error.

* De-clutter, custom read() was not needed

Co-authored-by: jordan <jordan@curd.mjh-it.com>
2022-05-26 10:23:40 +01:00
Jacek Sieka 3263816d10
remove bzz protocol (#506)
Swarm has moved to libp2p
2022-05-07 13:50:43 +02:00
Kim De Mey 4463a28fd6
Add discv5 max packet size limit (#505) 2022-05-02 16:49:19 +02:00
Kim De Mey ea3bb0836d
Update discv5 implementation explainer comment (#504)
And some line char limit adjustments.
2022-04-22 16:46:47 +02:00
Kim De Mey 01684a2130
Adjust uTP log levels to be more user focused (#502)
Also cleanup several whitespace and line char limits
2022-04-12 21:11:01 +02:00
Kim De Mey 6d4b1f4fe1
Handle the decodeAuthMessage error case separatly and log to trace (#498)
* Handle the decodeAuthMessage error case separatly and log to trace

Garbage data on the TCP port (e.g. from port scanners) would
cause lots of error log messages, so log this to trace and get rid
of a (little) bit of exception usage in the process.

* Remove usage of result var in rlpxAccept and rlpxConnect

* Discv4: Add ENRRequest & ENRResponse msgs to avoid fails on these

Fix #499
These messages are not implemented yet however, but just ignored.
2022-04-04 22:31:09 +02:00
Jacek Sieka 41b8588ade
move rocksdb to nimbus-eth1 (#460)
sqlite ftw!
2022-04-04 13:46:57 +02:00
KonradStaniec eb785207ae
Make packet size configurable (#497)
* Make packet size configurable
2022-04-04 13:44:32 +02:00
Ștefan Talpalaru ea03e66485
nat: getPublicRoutePrefSrcOrExternalIP() (#496)
* nat: getPublicRoutePrefSrcOrExternalIP()

And some refactoring to minimise code duplication.
2022-03-31 16:07:28 +02:00
Ștefan Talpalaru 5a78e2fe23
disc: updateExternalIp() (#495)
* disc: updateExternalIp()

New public proc that can be used to inform the discovery subsystem about
a changed external IP (as reported by UPnP/NAT-PMP in some other module).
2022-03-30 12:52:45 +02:00
KonradStaniec c28597fee5
Change closing proc (#492) 2022-03-28 12:35:08 +02:00
Jordan Hrycaj 4c7cdcaaf2
Merge pull request #484 from status-im/jordan/nethermind-sync
Jordan/nethermind sync
2022-03-28 09:34:51 +01:00
Jordan Hrycaj 03924d672c
Merge pull request #494 from status-im/mitigate-rlp-annoyances
Mitigating RLP annoyances
2022-03-25 15:37:26 +00:00
Jordan Hrycaj f214dd8db3
Update eth/p2p/rlpx.nim
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-03-25 09:11:47 +00:00
Jordan Hrycaj 2e41d2892e
Update eth/p2p/rlpx.nim
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-03-25 09:11:39 +00:00
Jordan Hrycaj 96d07cdea6
Update eth/p2p/rlpx.nim
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-03-25 09:11:23 +00:00
Jordan Hrycaj 499e542263
Update eth/p2p/rlpx.nim
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-03-25 09:11:15 +00:00
Jordan Hrycaj 1d8a9cf01c
Update eth/p2p/rlpx.nim
Co-authored-by: Kim De Mey <kim.demey@gmail.com>
2022-03-25 09:11:05 +00:00
KonradStaniec f79b79f826
Fix defect in uTP buffer (#493) 2022-03-24 15:56:00 +01:00
Jordan Hrycaj 944d7a4069 Mitigating RLP annoyances
why:
  Rlp errors throw exceptions which cause the dispatcher loop to
  terminate the current session immediately.

details:
  The DisconnectionReasonList message requires a single entry list.
  Observed and now accepted deviations are:

  Geth: single byte number

  bor(a Geth fork): blobbed single entry list containing a number
2022-03-24 14:49:15 +00:00
Jordan Hrycaj 4bc020384f Rebase & make chunked RLPx messages optional by a compiler flag
why:
  This is a legacy feature and its usage should peter out over time.

details:
  Use -d:chunked_rlpx_enabled for enabling chunked RLPx message handling.
2022-03-22 17:44:29 +00:00
Jordan Hrycaj 2ff455f26d Support obsolete chunked RLPx wire protocol
why:
  For some reason, Nethermind insists on sending chunked messages to
  the syncing peer. Unfortunately, for the test networks the Nethermind
  modes are the importent ones as they speak eth/65 as well while others
  like Geth only support eth/66 which is not implemented here, yet.
2022-03-22 16:25:05 +00:00
Jordan Hrycaj 0feefab9ce Prevent from NULL-message SEGFAULTs
why:
  There were cases with NULL entries in the message sequence (as indexed
  by msgId.)
2022-03-22 16:25:05 +00:00
KonradStaniec e794c149f5
Fix compilation error (#490) 2022-03-18 15:53:51 +01:00
KonradStaniec 0e20fd6565
Utp improvements (#489)
* Move connection finalization to separate function

* Do not process data unless in correct state
2022-03-18 08:13:17 +01:00
KonradStaniec f16f175412
Add metrics to utp router (#488)
* Add metrics to utp router
2022-03-17 10:53:46 +01:00
Ștefan Talpalaru 7b448ed406
net/nat.nim: "raises" annotations (#487) 2022-03-16 15:21:56 +01: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
KonradStaniec dff9040cc1
Fix bug when reading till eof (#483) 2022-03-03 22:38:13 +01:00
jangko 6c4d04562d
add bootnodes test 2022-02-27 11:53:11 +07:00
jangko 622e6489d8
EIP-4399 changes: random -> prevRandao 2022-02-27 11:40:15 +07:00
jangko 63add129b8
replace two bootnodes
see https://github.com/ethereum/go-ethereum/pull/24432/files
and https://github.com/status-im/nimbus-eth1/issues/978
2022-02-27 10:17:56 +07:00
KonradStaniec 8ef6b13b1b
Add event loop to socket (#475)
- add eventLoop to control all incoming events
- change semantic of write to asynchronously block only when send buffer is full, and not when bytes do not fit into send window
- change handling of receive buffer, to start dropping packets if the reorder buffer and receive buffer are full. Old behaviour was to async block unless there is space which could lead to resource exhaustion attacks
2022-02-24 18:22:44 +01:00
Zahary Karadjov f947827c70
Debug logs providing info for the initial discoveryv5 configuration 2022-02-18 17:42:37 +02:00