Commit Graph

868 Commits

Author SHA1 Message Date
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 5b4e9db0d3
Narrow Defect to expect AssertionDefect in rlp tests (#587) 2023-02-20 20:52:49 +01:00
Kim De Mey a8bd504f95
Add liblz4 for i386 CI (rocksdb dep) (#586) 2023-02-20 16:27:41 +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 27814d5b61
Added a supportsClear bool to testKvStore. (#579)
Obviously this is getting ugly, but for now I just want to get
something committed so that I can get back to the more urgent work.
2023-01-20 09:21:51 +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 cc52ef35e4
add more tests to verify network state replacement 2022-10-15 08:49:11 +07: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