Jacek Sieka
98a5efba4d
Various error handling and processing fixes ( #228 )
...
* remove redundant gcsafe/raises
* rework async raises to chronos 4.0 where this was not yet done
* streamline logging between http/socket/ws
* don't log error when raising exceptions (whoever handles should log)
* debug-log requests in all variants of server and client
* unify ipv4/ipv6 address resolution, with preference for ipv6
* fix server start so that it consistently raises only when no addresses
could be bound
2024-10-22 21:58:46 +02:00
Kim De Mey
ad8721e0f3
Export errors for json-rpc clients ( #218 )
...
Errors should get exported considering they are part of the
json-rpc APIs.
2024-03-15 09:05:33 +01:00
Etan Kissling
8682bb6c85
align maximum body size between Websock and HTTP transports ( #211 )
...
HTTP has a 128 MB limit, while websock uses the library default (20 MB).
Align both to 128 MB. This should be enough for an Ethereum `getPayload`
with 6 blobs, all hex encoded binary + JSON overhead.
2024-02-20 14:34:20 +01:00
andri lim
9c65df3053
Add build test with chronicles to json enabled ( #215 )
...
* Add build test with chronicles to json enabled
* Fix windows failing test
2024-02-19 13:47:40 +07:00
andri lim
514049a287
Fix ws and socket client error handling and add test to #212 ( #213 )
2024-02-19 08:53:10 +07:00
jangko
2157e8980d
Should compile if chronicles log turned on
2024-01-31 16:46:44 +07:00
jangko
0b8cec3aa8
Implement RPC batch call both in servers and clients
2024-01-31 13:13:41 +07:00
jangko
dad0255c71
Client pass meaningful error to newFut when processMessage failed
2024-01-23 12:10:33 +07:00
andri lim
26a6cb1790
Client also handle error message if id is null ( #196 )
...
* Client also handle error message if id is null
* Reduce compiler warnings in testethcalls
* Fix gcsafe error
2024-01-21 12:06:18 +07:00
jangko
08ceae27e0
Move errors module back to json_rpc folder
2024-01-08 10:37:29 +07:00
jangko
20b4c9a0fb
Let the OS choose the port for tests
2024-01-07 15:33:43 +07:00
jangko
2f6a605aa2
Reenable test hhtps
2024-01-04 11:53:15 +07:00
jangko
76dd352ace
Remove StringOfJson
2024-01-04 07:49:19 +07:00
andri lim
e0b077fea4
Upgrade rpc router internals ( #178 )
...
* Upgrade rpc router internals
* use new chronos asyncraises
* Fix style mismatch
* Fix nim v2 compilation error
* Addresing review
* Remove unnecessary custom serializer and let the library do the work
* fix error message
* Update readme.md
2024-01-03 20:06:53 +07:00
jangko
c3769f9130
Add copyright to source file
2023-12-14 08:34:13 +07:00
coffeepots
819b6fed37
Use nim-json-serialization for RPCs ( #172 )
...
* Use nim-json-serialization for RPCs
* Add distinct serializers for RPC types
* Avoid ConvFromXtoItselfNotNeeded in testing
* Remove redundent `==` template
* Rename Eth1JsonRpc to JsonRpc
* Fix generic instantiation clash
---------
Co-authored-by: jangko <jangko128@gmail.com>
2023-12-14 08:29:11 +07:00
Etan Kissling
60c4c9b5f2
improve RPC client logging ( #171 )
...
We currently only debug log successfully sent messages to RPC.
For debugging, it would be better to see the attempt and any failures.
Adjust logging to provide more information when debugging.
Also include the message name at debug level instead of just trace.
2023-08-23 14:20:19 +02:00
Zahary Karadjov
172183e702
Allow the user to specify HttpClientFlags when creating a HTTP client
2023-05-05 02:25:36 +03:00
Zahary Karadjov
07e4705b1f
The ErrorResponse exception now preserves information about the HTTP status code and reason
2023-03-01 12:40:16 +02:00
Jacek Sieka
c0ecb42613
normalise nimble, update ci, unittest2 ( #158 )
2022-12-02 13:17:27 +01:00
Jacek Sieka
b4aff8fec5
remove `news` support ( #155 )
...
`news` has several resource leaks and other security issues - replaced
by `nim-websock` which is actively maintained.
2022-11-08 14:39:29 +01:00
Etan Kissling
446b18819d
do not disable TLS verification by default ( #148 )
...
Setting `NoVerifyHost`, `NoVerifyServerName` by default leads to
hard-to-debug bugs, it should always be explicit if wanted.
Note: This is also a workaround for https://github.com/status-im/nim-chronos/issues/313
2022-09-16 21:38:56 +02:00
Jacek Sieka
7c80b75856
fix enum parsing, work around potential `nil` dereference ( #150 )
...
* fix enum parsing, work around potential `nil` dereference
When the bizarre error handling in the http client fails, it may happen
that a nil is returned (maybe due to Nim bugs) - do it manually for now
2022-09-15 22:32:16 +03:00
Etan Kissling
c8cbe08de7
align `nim-websock` support with `news`
...
To allow switching between `news` and `nim-websock` in `nimbus-eth2`,
add support for the missing CORS and JWT authorization headers to the
`nim-websock` backend. Also transition from `StringTableRef` to
`HttpTable` to properly support multiple instances of same header name.
2022-09-05 22:44:06 +07:00
jangko
0fee4be2cc
implement hook to handle CORS and JWT auth
...
- fixes #138
- fixes #126
- fixes #38
2022-07-17 23:06:08 +07:00
Zahary Karadjov
d618b555e7
Use news by default; websock has known issues
2022-06-28 18:12:51 +03:00
Zahary Karadjov
335f292a58
Fix connection leaks in the HTTP client
2022-04-10 21:48:46 +03:00
Jacek Sieka
2e3d22b9e2
enable `styleCheck:usages` ( #135 )
2022-04-08 10:25:41 +02:00
Jacek Sieka
b4bab89abd
fix invalid raises annotations ( #132 )
...
* `raises` should not be used with async
* callbacks returning futures should not raise
2022-03-21 15:19:49 +01:00
Dustin Brody
2d0a417844
no-op on nil
2022-03-04 21:07:17 +00:00
Dustin Brody
b455958d8a
request header callback
2022-03-04 19:13:29 +00:00
tersec
0540afad4c
specify Content-Type: application/json HTTP header ( #129 )
2022-02-23 08:43:08 +01:00
Zahary Karadjov
97ba55bbf6
Release the HTTP sessions
2022-02-02 19:51:04 +02:00
Zahary Karadjov
5a28176080
Fix #117
2022-01-08 21:39:29 +02:00
Zahary Karadjov
35e6d7e6ff
Restore the support for using the news package
2021-11-29 15:36:17 +02:00
Zahary Karadjov
c455198d4f
Eliminate code duplication in the HTTP/S servers
2021-11-22 20:24:11 +02:00
Zahary Karadjov
e4dba96f5c
Improve cancellation support and code style
2021-11-22 17:24:07 +02:00
Bernardo A. Rodrigues
3599a73b58
Chronos HTTP(S) Server ( #111 )
2021-11-22 15:14:30 +02:00
Zahary Karadjov
9db5407e81
Switch to Chronos HTTP client (adds support for HTTPS)
2021-11-22 15:14:27 +02:00
jangko
b2417fc071
fix both ws rpc server and client due to websock breaking changes
...
- change recv() to recvMsg()
2021-08-05 14:54:36 +07:00
jangko
318949a401
fixes ws rpc client bug: error when trying to connect to infura
...
fixes #109
previously, if using uri such as "wss://mainnet.infura.io/ws/v3/infura-id",
the client will throw error. this bug already fixed in nim-websock,
now this also fixed in json-rpc. it works when connected to infura wss.
2021-07-19 10:35:23 +07:00
jangko
809172abe4
rename ws to websock
2021-06-29 11:51:05 +07:00
jangko
b9e9be8f19
use string.fromBytes to replace cast[string](bytes)
2021-06-24 06:52:32 +07:00
jangko
69e8be66fb
add compression support for websocket rpc server-client
...
fixes #62
2021-06-24 06:52:31 +07:00
jangko
b8a8ca2623
replace news with nim-ws
...
fixes #103
2021-06-24 06:52:31 +07:00
Zahary Karadjov
7a9d118929
More proper client closing code
2021-04-07 00:40:54 +03:00
Jacek Sieka
64d40d6c1a
simplify imports ( #98 )
...
remove broken uint64 converter - upstream std/json also includes a
broken uint64 converter
2021-03-26 13:17:00 +01:00
Jacek Sieka
ac5288651c
Exception handling signatures ( #97 )
...
Minimally work around leaking `Exception` for
https://github.com/status-im/nim-chronos/pull/166
2021-03-26 11:53:03 +01:00
Jacek Sieka
4eb39203eb
fixes ( #95 )
...
* fixes
* fix https://github.com/status-im/nimbus-eth2/issues/1650
* only one of `result` and `error` allowed in response
* fix invalid `string` instances being created from byte sequences
* fix large int64 parsing on 32-bit
* fix exception inheritance
* fix some dangling results
* some cleanups
* annotate exception issues, fix cancellation
* more error handling cleanup
* add rudimentary error tests
* cleanups
* simplify init
* use nextId -> lastId to avoid =1 init
* remove obsolete tests
2021-02-15 13:45:51 +01:00
Viktor Kirilov
ecf49a0632
updated news
2020-05-08 16:13:00 +03:00