Commit Graph

916 Commits

Author SHA1 Message Date
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
Jacek Sieka 02c8a1276b
avoid use of shallow (#636)
this probably has some tiny overhead but it shouldn't practically matter
2023-09-20 09:24:24 +02:00
jangko ac680ed79b
Add closeWait to EthereumNode 2023-09-08 21:45:41 +07:00
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 d766fc435e
remove stddefects import (#618) 2023-06-11 12:14:10 +00:00
Etan Kissling 99d980c3f6
use correct exception in `parseCmdArg` (#614)
`parseCmdArg` is expected to raise `ValueError` but for `enr.Record`,
`Node`, `PrivateKey`, and `NatConfig`, we raise `ConfigurationError`.
Change to `ValueError` instead.
2023-06-06 22:28:14 +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
jangko 6053c252e7
Remove appveyor and travis scripts 2023-04-20 08:33:16 +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