928 Commits

Author SHA1 Message Date
Jordan Hrycaj
9511502273
Removed obsolete chunked rlpx message protocol extension (#719) 2024-08-13 15:10:47 +00:00
Jacek Sieka
56f72c7a66
Revert speedups (#718)
* Revert "hash compatibility fix (#717)"

This reverts commit 047de2b788b485cca83c6d77f9a2e5f1e56ab656.

* Revert "port eth2_digest speedups to eth_hash (#716)"

This reverts commit 864d54467e09c08d62b508149e9184001a813363.
2024-08-09 07:20:35 +02:00
Jacek Sieka
047de2b788
hash compatibility fix (#717) 2024-08-09 06:23:56 +02:00
Jacek Sieka
864d54467e
port eth2_digest speedups to eth_hash (#716)
* port eth2_digest speedups to eth_hash

* faster comparison
* `hash` integration
* lower-case printing
2024-08-08 05:44:15 +00:00
andri lim
ebfe63b9b6
Convert GasInt to uint64 (#713) 2024-07-06 20:24:14 +07:00
Etan Kissling
d8fda55c79
define Electra types and RLP encoding (#711)
Add types for EIP-6110, EIP-7002 and EIP-7251 validator operations.
2024-07-03 13:22:18 +02:00
Etan Kissling
b90483e9d2
avoid warnings when processing GasInt for RLP (#712)
RLP does not support signed integer values, so we have to convert
`GasInt` to `uint64` when decoding / encoding via RLP.
2024-07-03 13:21:45 +02:00
Miran
b80c227f52
simplify .nimble file (#708) 2024-07-01 18:06:10 +02:00
Kim De Mey
8088fe72d7
Update discv5 to use non deprecated ENR calls and simplify code (#710)
And due to avoiding an extra PublicKey.fromRaw call we get a
little performance boost also.
2024-06-27 16:18:21 +02:00
Kim De Mey
d7577f59d7
Rework of ENR decoding code (#709)
- Rework to have exception raise only at rlp decoding and use
result types from then onwards
- Adjust the current API to have result versions and deprecated
the ones which had var Record + bool
- Add PublickKey to the Record object, as this allows us to skip
fromRaw calls whenever access is needed to the public key
- Add a TypedRecord.fromRecord which cannot fail and deprecate
the old one
- Some other minor clean-up & re-ordering
2024-06-27 15:15:23 +02:00
Kim De Mey
7f20d79945
Overhaul of ENR implementation - part I (#707)
- Rework adding and updating of fields by having an insert call
that gets used everywhere. Avoiding also duplicate keys. One
side-effect of this is that ENR sequence number will always get
updated on an update call, even if nothing changes.
- Deprecate initRecord as it is only used in tests and is flawed
- Assert when predefined keys go into the extra custom pairs.
Any of the predefined keys are only to be passed now via specific
parameters to make sure that the correct types are stored in ENR.
- Clearify the Opt.none behaviour for Record.update
- When setting ipv6, allow for tcp/udp port fields to be used
default
- General clean-up
- Rework/clean-up completely the ENR tests.
2024-06-24 14:57:39 +02:00
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
7c952cf40e
Revert GasInt back to int64 (#703)
Turn out it requires more planning to switch GasInt to uint64
2024-06-13 12:11:16 +02:00
Kim De Mey
207244c2db
Add more missing async raises in uTP (#702) 2024-06-12 18:01:23 +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
andri lim
9b6497ed8a
GasInt, BlockNumber, fields name closer to the spec (#696) 2024-06-12 00:13:11 +07:00
Kim De Mey
c3f9160fd2
Add async raises annotations for uTP code (#692)
* Add async raises annotations for uTP code

* Avoid compiler error + further clean-up
2024-06-11 13:56:37 +02: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
c9b545b6c4
No sink (#695)
https://github.com/nim-lang/Nim/issues/23354
2024-06-10 10:12:32 +02:00
Jacek Sieka
5599435901
ethblock: txs -> transactions (#694)
Using the same name as BlockBody to make them easily interchangeable -
* add a few inits
2024-06-08 19:25:25 +02:00
Jacek Sieka
b9b522f7ac
keccak doesn't need init (#693) 2024-06-07 22:30:32 +02:00
Jacek Sieka
c02e050db8
avoid burnMem for keccakHash (#691)
We don't need to clear keccak context after hashing ethereum data since
it is already public - similar to
https://github.com/status-im/nimbus-eth2/pull/222.

Because we overwrite the result fully, we also don't need to zero first.
2024-06-07 16:27:38 +02:00
Jacek Sieka
d935c0de47
rlp: avoid or make faster seq copies (#689) 2024-06-06 20:27:43 +02:00
Jacek Sieka
68bd675b75
faster hash for Address (#688) 2024-06-05 22:46:23 +02:00
Jacek Sieka
0e83cfda97
results: use standalone repo (#687) 2024-05-30 14:46:57 +02:00
Jacek Sieka
50b3d0193c
Revert missing hexary trie node work (#686)
* Revert "In the incomplete-db node-existence check, don't use contains. (#603)"

This reverts commit 4b818e830710f857e5cc8001af4d084570d2204a.

* Revert "Some changes to make hexary.nim better able to handle incomplete DBs (#602)"

This reverts commit f5dd26eac05a00134ebf1af537e16235702c343b.

* Revert "Added maybeGet, for working with incomplete DBs. (#595)"

This reverts commit 4754543605770469410d4546f142c2d8db97f943.
2024-05-28 10:05:57 +02:00
Jacek Sieka
258798873c
eth_types: remove unused ref types (#685)
remove unused ref types
2024-05-28 08:42:13 +02:00
Jacek Sieka
bb5cb6a4d0
rlp: refresh code (#683)
A first step in cleaning up RLP, which has lots of interesting issues -
the next step would be to clean up the exception handling as well
(Resultify?)

* remove `RlpNode` (unused)
* single-pass parsing for most functionality via RlpItem
* stricter conformance to spec
  * remove float support
  * warn about signed integers
  * raise on invalid RLP earlier
* avoid several pointless allocations, in particular in `listLen`,
`listElem` etc
* include spec docs
2024-05-26 09:58:24 +02:00
Jacek Sieka
0addffcc6c
binary tries: remove (#684)
not used anywhere
2024-05-26 09:57:59 +02:00
Etan Kissling
c482b4c5b6
Introduce wrapper type for EIP-4844 transactions (#682)
EIP-4844 blob sidecars are a concept that only exists in the mempool.
After inclusion of a transaction into an execution block, only the
versioned hash within the transaction remains. To improve type safety,
replace the `Transaction.networkPayload` member with a wrapper type
`PooledTransaction` that is used in contexts where blob sidecars exist.
2024-05-13 11:19:00 +03: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
Etan Kissling
d66a29db7c
avoid XDeclaredButNotUsed in kvstore_sqlite3 with empty tuple (#680)
Suppresses an annoying hint that gets triggered when `params is tuple`
but it's an empty tuple without fields.

```
Hint: 'i' is declared but not used [XDeclaredButNotUsed]
```
2024-02-28 22:03:04 +00: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
tersec
ce834e1287
test Nim 2.0 in CI and use non-EOL macOS version (#677) 2024-02-14 05:07:55 +00:00
tersec
16de7e7f5d
test refc in CI in Nim 2.0 and later (#676) 2024-02-14 03:35:28 +00:00
andri lim
bb1ab544fc
Reduce compiler warnings in rlp (#674) 2024-02-13 19:34:27 +07:00
Kim De Mey
8ab060b19f
Move Ethereum specific RLP encoding tests under tests/common (#673)
This is more according to the structure of the code itself.
And also, currently some of these tests live under tests/rlp but
some under tests/common. Could use some further re-organisation
within the different tests, but this move is a first step.
2024-02-09 17:30:24 +01:00
Kim De Mey
2ad07a6010
Fix two bugs in Receipts RLP encoding/decoding (#672)
1. Fix Assertion error when receipt is not a List nor has a single
byte value. Receiving such garbage data would cause a crash.
2. Fix decoding of Receipt list by adding the missing Blob
encapsulation

Also added tests for these scenarios.
2024-02-05 23:22:15 +01:00
jangko
4433efe484
Upgrade github actions to v4 2024-01-27 17:03:46 +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
19965bab95
Fix chronos related deprecated warnings in uTP code part II (#669)
This also makes the uTP SendCallBack not returning a Future any
more as it is not used in sendData anyhow. And in case of uTP
over discv5, discv5 send call is already not async.

This gives quite a noticable throughput benchmark improvement over
with uTP over UDP, and a slightly noticable with uTP over discv5
2024-01-23 18:41:38 +01:00
Jacek Sieka
b89d712339
normalise nimble, ci (#567)
* normalise nimble, ci

* drop obsolete dep download

* add threads
2024-01-23 16:48:29 +00: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