Commit Graph

791 Commits

Author SHA1 Message Date
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
Jacek Sieka 22df101fcf
keyfile: reduce imports (#633) 2023-08-21 11:11:52 +02:00
Etan Kissling 894ec07d9f
fix `{.raises.}` annotation to `writeValue` (#631)
`writeValue` doesn't raise `SerializationError`, so the `{.push.}`
is not optimal. Move `{.raises.}` to each `proc`, same as other modules.
2023-08-19 19:03:10 +02:00
jangko 074edff1b4
EIP-4788: Add parentBeaconBlockRoot field to BlockHeader 2023-08-18 17:52:55 +07: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
andri lim 2ed8e991b5
add mixin env to sqlite3 generic procs (#627) 2023-08-03 22:00:47 +07: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
jangko 521db96a65
rename data gas to blob gas 2023-07-28 10:19:00 +07:00
Jacek Sieka 15a09fab73
sqlite3: better error message (#622)
* sqlite3: better error message

* fix dispose
2023-07-06 06:53:29 +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
Kim De Mey d74dc40bee
Style fixes and comment improvements on uTP code (#623) 2023-06-22 11:31:30 +00:00
jangko 6dacb2ca5c
fixes related to stint breaking changes 2023-06-21 17:55:00 +07:00
Kim De Mey c3860244b1
Fix potentential uTP socket leak for socket in SynSent state (#620)
Socket leak could because ST_DATA (and ST_FIN) packets for sockets
not in connected stated were only dropped after appling acks.
2023-06-21 12:44:52 +02:00
Kim De Mey cea23299be
Avoid double socket destroy on timed-out uTP SYN-ACK (#619) 2023-06-15 12:26:22 +02: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
Jacek Sieka 55b9da0bea
fix cancellation syntax (#615)
* fix cancellation syntax

* simplify
2023-06-02 14:33:06 +02:00
andri lim 91b2b9d2ed
rlp codec support optional fields (#613)
Instead of patching BlockHeader or BlockBody codec
each time it get additional optional fields,
this PR make the rlp codec automatically handle
optional fields. Thus rlp codec overloading of
EthBlock, BlockHeader, and BlockBody can be removed.
2023-05-30 16:02:02 +03:00
jangko 67bbd88616
Replace exception with assertion in rlp.append of BlockHeader
Using exception in rlp.append turn out creates more problem than it solve.
`blockHash` operation is literally everywhere in nimbus-eth1, nimbus-eth2, and fluffy-code.
The compiler begins to complain about unlisted exception.
Rlp bytes coming from network and test vectors already verified by the decoder.
So, any invalid optional fields of blockheader that come into rlp.append means
programming error. Assertion will be more apropiate in this situation and less problematic.
2023-05-25 15:27:37 +07:00
jangko 7ff6de2367
fix rlp.readRecordType of BlockBody and friends
including:
- fix rlp.append of BlockHeader
- add tests for rlp.readRecordType of BlockBody
- add tests for rlp.append of BlockHeader
- add tests for EthBlock roundtrip
2023-05-23 14:37:47 +07:00
jangko e639dc1e14
fix missing withdrawals field in EthBlock 2023-05-22 16:11:30 +07:00
Ivan Folgueira Bande 285da12bf3
nat.nim: breaking dependency with 'confutils' (#609)
* nat.nim: breaking dependency with 'confutils'

The main purpose of this change is to break the dependency with
`confutils`.
2023-05-16 13:43:31 +02:00
Jacek Sieka 6e5ee490c2
avoid ptr_arith (#608) 2023-05-11 07:39:21 +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
tersec 7564b21ade
support only Nim 1.6+ (#606) 2023-05-09 20:19:44 +00:00
jangko 607539d821
upgrade github actions to v3 2023-05-05 17:25:15 +07:00
Adam Spitz 4b818e8307
In the incomplete-db node-existence check, don't use contains. (#603)
* In the incomplete-db node-existence check, don't use contains.

(Using contains led to a problem with CaptureDB.)

* In the incomplete-db check, just checking len > 0 isn't right.

* Oh, I needed the AssertionDefect thing too.

* Need this when compiling under older versions of Nim.

* Sometimes we want missing nodes to be errors, sometimes not.
2023-04-28 12:04:33 -04:00
Adam Spitz f5dd26eac0
Some changes to make hexary.nim better able to handle incomplete DBs (#602)
* Added maybeGet, for working with incomplete DBs.

* Made trie.del throw an exception if it encounters a missing node.
2023-04-21 07:59:15 -04: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
Jordan Hrycaj 9a1d35f803
Fix block body encoding (#598)
why:
  List wrapper was missing in `append()` mixin.
2023-04-19 13:26:41 +01: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 ea3c164a00
uTP clarification on SYN-ACK seqnr and some cleanup (#596)
- Clarify why on SYN-ACK seqNr gets -1
- Cleanup comments
- Style fixes
- Reuse WriteResult
2023-04-04 17:11:36 +02:00
Adam Spitz 4754543605
Added maybeGet, for working with incomplete DBs. (#595) 2023-04-03 13:01:25 -04:00
Adam Spitz 9e89f0dccc
Made rlp.readRecordType(BlockBody, false) include withdrawals. (#594) 2023-03-17 10:41:38 -04: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 29b14749fa
Improve uTP decoded packet logs + style and comment clean-up (#593)
* Improve uTP decoded packet logs + style and comment clean-up

* Don't test for the exact error strings in uTP decode + clean-up
2023-03-14 16:17:39 +00:00
Jacek Sieka 72c9858927
kvstore: remove unnecessary EH (#592) 2023-02-22 09:03:13 +00:00
Jacek Sieka ca1c205441
fix missing gcsafe (#591) 2023-02-22 08:11:32 +00:00
Jacek Sieka ade6d19691
Defect fixes in kvstore (#589)
* Defect fixes in kvstore

* compile fixes
2023-02-21 18:54:30 +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 20d2d318f0
Fixed a bug that I just introduced in the BlockBody RLP code. (#583)
The nimbus-eth1 tests seem to think that this is the right thing to do.
2023-01-21 14:41:30 +01:00
Adam Spitz 5b189ce5e2
EIP-4895: added withdrawals to BlockBody. (#581) 2023-01-20 12:18:39 +01:00
Adam Spitz 71b148a5b0
Propagating the del-returns-a-bool change through the trie DB code. (#578)
See here:
8f0ae55353
2023-01-17 16:39:28 -05:00
tersec 68f4c53828
withdrawals amount in uint64 gwei: https://github.com/ethereum/execution-apis/pull/354 (#577) 2023-01-14 14:39:23 +00:00
zah 0807378e7f
Migrate some functions from nimbus-eth1 in order to make them available in nimbus-eth2 (#576) 2023-01-10 18:56:27 +02: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
Jacek Sieka 8f0ae55353
kvstore: return bool from del, add clear (#574)
This allows making decisions based on whether an element was present
during the `del`
2023-01-03 16:38:27 +01:00
Kim De Mey 40ec601d07
Fix accidential usage of default rlp decode for DisconnectionReason (#572) 2022-12-14 10:57:23 +01:00
Etan Kissling 2b5f2a27e3
fix `excessDataGas` type (`GasInt` --> `UInt256`) (#571)
Used incorrect type in original PR. Fixing.
2022-12-14 00:25:27 +01:00
Etan Kissling c9fcab8052
extend `BlockHeader` for EIP-4844 (#570)
Extends `BlockHeader` with `excessDataGas` according to EIP-4844
(used by Nimbus-CL in empty block prod fallback).
2022-12-13 20:53:05 +01:00
Lorenzo Delgado 5c46220e72
add eth topic to all the logs scope (#568) 2022-12-06 14:54:03 +01:00
tersec 571b98d7f7
avoid invalid codegen/UB by avoiding case object discriminant assignment (#566) 2022-12-01 13:55:42 +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
KonradStaniec 22d0ac81e1
Fix defect when writing over send buffer (#564)
* Fix defect when writing over send buffer
2022-11-30 09:34:08 +01:00
Jacek Sieka 8f4ef19fc9
sqlite: support read-only kvstores (#563)
in a read-only database, we cannot create the table but we can still
reason about elements in it - they simply don't exist
2022-11-28 21:15:53 +01:00
Etan Kissling 6499ee2bc5
extend `BlockHeader` for Capella (#562)
Adds `Withdrawal` type according to EIP-4895, and extends `BlockHeader`
accordingly. Also adds RLP encoding support for `Withdrawal` to enable
building `BlockHeader` (used by Nimbus-CL in empty block prod fallback).
2022-11-25 11:07:51 +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:
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 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 8115885b6e
allow EhereumNode network state override 2022-10-14 17:16:25 +07: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
KonradStaniec 059d319c16
Safer mpt proof verification (#536)
* Safer mpt proof verification
2022-09-14 19:02:05 +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
andri lim 2186d67163
fix openssl problem in ci (#533)
* tighter nimcrypto imports

* install openssl on macos for Nim devel

* add getTotalDifficulty base method to AbtractChainDB

Co-authored-by: Jacek Sieka <jacek@status.im>
2022-09-05 17:00:05 +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
jangko 4f0155e626
add some peer convenience funcs to PeerPool and EthNode 2022-08-23 15:29:34 +07:00
jangko 9f1d5ef1a0 improve method not implemented message of AbstractChainDB
previous message only shows method not implemented,
but the method name is missing. now the message including method name
2022-08-22 18:09:13 +07:00
Zahary Karadjov 3a0afa4aa2 Add sqlite3.isInsideTransaction 2022-08-22 18:09:13 +07:00
Zahary Karadjov 4c70293883
Add a helper for calculating the EIP1559 base fee 2022-08-18 23:36:45 +03:00
Zahary Karadjov 3e7da14667
Constants shared between nimbus-eth1 and nimbus-eth2 2022-08-18 19:27:46 +03:00
KonradStaniec 2556b090ea
Add user data to utp (#525) 2022-08-12 15:09:59 +02:00
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 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
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
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
KonradStaniec 779d767b02
Add more tests stressing conccurent reading and writing on utp socket (#474)
* Add more tests stressing concurrent reading and writing

* Fix bug when remote window dropped below packet size
2022-02-10 08:05:44 +01:00
Kim De Mey 05ef9a8e00
More --styleCheck fixes for discoveryv5 and eth/common (#473) 2022-02-03 15:51:08 +01:00
Kim De Mey 41edd4a3f2
Add DiscoveryConfig to tune routing table ip limits and bitPerHops (#471) 2022-02-02 15:29:45 +01:00
jangko cf95b688e6
EIP-4399 preparation
From EIP-4399 spec:

Renaming

The mixHash field SHOULD further be renamed to random.

...
2022-02-01 13:41:50 +07:00
Jacek Sieka ce4acc168c
kvstore: simplified stmt exec iterator (#467) 2022-01-28 15:23:41 +02:00
KonradStaniec 5791afccc3
Implement fast resend logic for selective acks (#468)
* Implement fast resend logic for selective acks
2022-01-27 11:07:40 +01:00