Commit Graph

955 Commits

Author SHA1 Message Date
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 4b818e8307.

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

This reverts commit f5dd26eac0.

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

This reverts commit 4754543605.
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
andri lim c57cebfd81
Fix discv4.send: use addCallback instead of .callback (#665) 2024-01-19 11:31:17 +01:00
Kim De Mey 159ae697c5
Remove last leftovers of ValidIpAddress (#664) 2024-01-19 11:15:57 +01:00
Kim De Mey 974a995b21
Add uTP over discv5 test and small uTP performance improvements (#663)
- Add a multiple sockets use test for uTP over discv5
- Use assign2 for the biggest consumer of genericAssignAux in uTP
- Avoid calling exists on the growable buffer when there is no
place in the socket window.
2024-01-18 12:07:03 +01:00
Kim De Mey d4927593a1
Add data over multiple sockets uTP test (#662) 2024-01-17 22:45:20 +01:00
Etan Kissling a6f79a6000
Adjust test names and comments for `blobGasUsed` field (#661)
`blobGasUsed` was not mentioned in `test_rlp_codec` test names, despite
being used. Further, update the idea of `genOptionalFieldsValidation`
to also check for `blobGasUsed`, and fix the check to catch unsupported
combinations of optional fields.
2024-01-16 22:02:06 +01:00
Jacek Sieka e5e695c396
better async timeout wait (#659)
* don't call timeout code if future finishes before getting cancelled
* avoid extra raises effect resulting from `read` (vs `await`)
2024-01-16 18:12:47 +01:00
Kim De Mey e52f5fac0a
Clean-up, correct and clarify utp_protocol tests (#660) 2024-01-16 18:10:26 +01:00
Kim De Mey cbcd1fd307
Fix for uTP issues with latest chronos (#655)
* Fix for uTP issues with latest chronos

* Fix for discv5 issue with latest chronos

* Increase amount of data send in uTP and uTP over discv5 tests
2024-01-12 17:35:44 +01:00
Kim De Mey a6942e3a30
Fix missing std/times import for the metrics 0.0.1 case (#656) 2024-01-12 17:35:14 +01:00
Kim De Mey 11049fb87d
Fix a bunch of compiler hints and warnings in uTP and discv5 (#652)
* Fix a bunch of compiler hints and warnings in uTP and discv5

* Leave in the cancel() for now
2024-01-12 09:49:06 +01:00
Jacek Sieka 0fc5dc03c5
support nim-metrics 0.1.0+ (#651) 2024-01-05 15:17:27 +01:00
web3-developer 5aaeb67ebe
Added additional tests to cover HexaryTrie MPT proofs. (#650)
* Added additional tests to cover HexaryTrie MPT proofs.

* Minor updates based on PR comments.
2023-12-22 23:34:12 +08:00
Kim De Mey e5c2b1784e
Replace registerCustomScalarFunction with createCustomFunction (#649)
* Replace registerCustomScalarFunction with createCustomFunction

The nice thing about `registerCustomScalarFunction` and
`registerCustomScalarFunction` was that it kept the sqlite calls
of type sqlite3_value_xxx inside kvstore_sqlite.

The big downside however is that the "custom" call is awfully
specific due to the specific function signature it demands.
It is likely that for each different use case, a new version
needs to be added.

In this PR the code gets altered to `createCustomFunction` which
allows to just create a custom function with directly xFunc
signature of sqlite. The downside of this is that you still need
to import sqlite_abi in your local code to have access to each of
the sqlite3_value_xxx and sqlite3_result_xxx calls. These could of
course also be wrapped.

* Fix custom sql func test
2023-11-21 14:39:24 +01:00
tersec ca4898e24a
switch NAT module from ValidIpAddress to IpAddress (#647)
* switch NAT module from ValidIpAddress to IpAddress

* fix dcli build

* switch discv5 from ValidIpAddress to IpAddress

* fix fuzzers build

* mostly finish nim-eth to IpAddress transition
2023-11-10 09:28:21 +03:00
Kim De Mey 700360fde2
Rename routing_table_nodes metric for discv4 routing table (#646) 2023-10-31 18:28:21 +01:00
tersec 957d8491af
fix XDeclaredButNotUsed warnings in tests/ (#645) 2023-10-29 04:06:48 +00:00
andri lim 4b00b230d0
Remove unused bootnodes and add Holesky bootnodes (#644)
* Remove unused bootnodes and add Holesky bootnodes

* Fix enode test
2023-10-25 11:07:55 +07:00
andri lim 1bae1d8426
Fix rlpHash of Transaction: remove EIP-4844 blobs before hashing (#643) 2023-10-22 14:37:49 +07:00
jangko e34a9c4e5d
Fix EthTime.now from func to proc due to sideeffects 2023-10-17 17:20:34 +07:00
jangko 2be8c183d1
Change EthTime from Time to distinct uint64
Cancun test vector demand a uint64 of block timestamp.
Therefore using std.Time will not able to pass test.
2023-10-17 16:00:57 +07:00
Jacek Sieka 34ab6bd986
rlp: avoid aliasing casts (#637)
* also get rid of unused concept
2023-09-25 11:30:47 +02:00
andri lim fe88d9e6b7
Change maxFeePerBlobGas from GasInt to UInt256 (#640)
* Change maxFeePerBlobGas from GasInt to UInt256

per latest spec:
https://eips.ethereum.org/EIPS/eip-4844#blob-transaction

* fix eip-4844 test
2023-09-24 14:33:24 +07:00
Etan Kissling f133d7ab8d
fix build for `dcli` and instructions for new path (#638)
`dcli` got moved and the guide is no longer accurate. Update the paths.
Also, relative imports were incorret inside `dcli.nim`, and error when
using Nim 2.0 compiler.
2023-09-22 10:32:43 +00:00