40 Commits

Author SHA1 Message Date
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
Etan Kissling
171c747584
avoid failing uninitialized Future (#212)
In #195, a regression got introduced where an uninitialized `requestFut`
gets `fail()`-ed if the message's `id` cannot be found in pending list.
Revert back to return an `err()` instead, as before.
2024-02-17 09:02:20 +01:00
jangko
0b8cec3aa8
Implement RPC batch call both in servers and clients 2024-01-31 13:13:41 +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
andri lim
8d79d52841
Improve both client and server resilience against fields and elements with null value (#195)
* Improve resilience against null fields

* Fix client processMessage when handling error

* Improve both client and server resilience against fields and elements with null value
2024-01-17 14:10:05 +07:00
jangko
ab3dd0009b
RPC server handle null return value correctly 2024-01-11 13:57:18 +07:00
jangko
08ceae27e0
Move errors module back to json_rpc folder 2024-01-08 10:37:29 +07:00
jangko
09d1281a62
Add onProcessMessage hook to client 2024-01-07 16:12:23 +07:00
jangko
31b741720b
Add test for createRpcSigsFromNim and createSingleRpcSig 2024-01-04 20:36:43 +07:00
jangko
834de413d9
Rename jrpc_sys module back to jsonmarshal 2024-01-04 11:40:22 +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
Jacek Sieka
33360528d2
fix improper yield usage (#175)
`yield` does not work with chronos futures
2023-12-13 09:21:50 +07:00
tersec
32200345f8
use JsonNode.isNil rather than == nil to work around Nim issues (#167) 2023-07-12 17:34:34 +00:00
jangko
38950a786d
reduce compiler warnings 2023-02-22 12:00:35 +07: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
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
b455958d8a
request header callback 2022-03-04 19:13:29 +00: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
Ștefan Talpalaru
b0e82cb70a enable cross-compilation 2021-02-03 21:36:08 +02:00
Zahary Karadjov
244254632b
Improved handling of invalid responses; Handle seq[byte] results such as eth_getCode 2020-06-19 20:42:49 +03:00
Zahary Karadjov
5c0d096111
Support Nim 1.2 2020-03-24 16:50:34 +02:00
Zahary Karadjov
f53e0b960b
Fix all tests 2020-03-17 22:05:42 +02:00
Yuriy Glukhov
d4fbed75c7
Better error handling 2019-11-22 15:14:16 +02:00
Ștefan Talpalaru
de05184c74 replace {.gcsafe.} block with more proc pragmas 2019-07-19 13:48:26 +03:00
Ștefan Talpalaru
8168fcea25 fix some problems raised by Nim 0.20.2 2019-07-19 13:48:26 +03:00
Yuriy Glukhov
d031ab3eb4 Fixed error reporting for unexpected response id 2019-06-26 13:40:44 +03:00
Zahary Karadjov
48699c50ca Make the new methods gcsafe to solve build issues in Nimbus 2019-06-24 19:49:31 +03:00
Yuriy Glukhov
b583dfb029 Use closeWait 2019-06-17 19:56:19 +03:00
Yuriy Glukhov
f19d66b35c Websocket client support and some fixes 2019-06-12 20:53:15 +03:00
Mamy Ratsimbazafy
53ed44dfa5
Rebrand asyncdispatch2 to chronos (#50) 2019-02-06 18:27:58 +01:00
cheatfate
0942b0387d Add RpcHttpServer.
Add RpcHttpClient.
2018-07-14 10:51:54 +03:00
coffeepots
1ca1847600 Make client usable with different transports 2018-07-12 18:36:40 +01:00
coffeepots
8d3473e75b Renamed newStreamClient to newSocketClient, added a check for nil transport 2018-07-12 14:06:35 +01:00
coffeepots
cf44cc552d Remove DSL, add router and simplify server 2018-07-06 17:47:43 +01:00
coffeepots
0c98f79d9c Rename to json_rpc 2018-06-26 19:08:11 +01:00