Commit Graph

151 Commits

Author SHA1 Message Date
andri lim 514049a287
Fix ws and socket client error handling and add test to #212 (#213) 2024-02-19 08:53:10 +07:00
andri lim 165e54133d
Add framework to support more optional types (#206)
* Add framework to support more optional types

This PR add a framework to rpc server by using more templates than macros to handle optional types.
Now rpc server recognize both `std/options` and `results.Opt` as optional type for the parameters.
If needed user can add more optional types by overloading `rpc_isOptional` template.
Now aliases to optional types also works.

* Don't expose types used internally by the wrapper
2024-02-02 14:14:37 +07:00
jangko 0b8cec3aa8
Implement RPC batch call both in servers and clients 2024-01-31 13:13:41 +07:00
jangko c5c40af304
HttpAuthHook use async raises 2024-01-27 18:00:02 +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 66208055bc
Both http server and client now can handle chunked transfer 2024-01-12 17:05:55 +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 20b4c9a0fb
Let the OS choose the port for tests 2024-01-07 15:33:43 +07:00
jangko 31b741720b
Add test for createRpcSigsFromNim and createSingleRpcSig 2024-01-04 20:36:43 +07:00
jangko 2f6a605aa2
Reenable test hhtps 2024-01-04 11:53:15 +07:00
jangko 834de413d9
Rename jrpc_sys module back to jsonmarshal 2024-01-04 11:40:22 +07:00
kdeme f59e387da2
Add example test case that currently fails the Option parsing 2024-01-04 11:01:49 +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
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
jangko 38950a786d
reduce compiler warnings 2023-02-22 12:00:35 +07: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
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
jangko 0fee4be2cc
implement hook to handle CORS and JWT auth
- fixes #138
- fixes #126
- fixes #38
2022-07-17 23:06:08 +07:00
Miran f65218dd35
move `-d:nimRawSetjmp` to config.nims (#137)
* move `-d:nimRawSetjmp` to config.nims

Refs https://github.com/status-im/nimbus-build-system/issues/44

* not vcc

* use .cfg not .nims
2022-06-28 19:50:51 +07:00
Jacek Sieka 2e3d22b9e2
enable `styleCheck:usages` (#135) 2022-04-08 10:25:41 +02:00
jangko ad0c3fb6e0
fix missing req id in router exception handler
when an rpc method in server throw `InvalidRequest` using custom error code,
the router need to mention the request id too.

otherwise the client will throw error with confusing message.
2022-02-28 09:39:49 +07:00
jangko 51fadf850c
Fix #124 2022-02-14 12:16:31 +07: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 7ff4559cc0 Allow dynamic RPC method names in the 'rpc' macro 2021-11-24 15:57:46 +02:00
Zahary Karadjov e4dba96f5c
Improve cancellation support and code style 2021-11-22 17:24:07 +02:00
Zahary Karadjov 7ab1b31614
Fix code breakage after the rebase 2021-11-22 17:05:26 +02:00
Bernardo A. Rodrigues 3599a73b58
Chronos HTTP(S) Server (#111) 2021-11-22 15:14:30 +02:00
KonradStaniec eda5e8554f
add support for websocket in proxy (#112) 2021-07-30 11:24:09 +02:00
KonradStaniec 147ef3f562
[FEATURE] Add http json rpc proxy (#105) 2021-06-29 18:13:31 +03:00
jangko 69e8be66fb
add compression support for websocket rpc server-client
fixes #62
2021-06-24 06:52:31 +07:00
jangko ccb19734e6
add test cases for rpc websocket client-server 2021-06-24 06:52:31 +07:00
jangko a79f10f10f
adapt testserverclient for upcoming websocket test 2021-06-23 16:09:44 +07: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
Joe Clapis 831471f6d4
Added the ability to handle omitted params fields in incoming requests, and a unit test for it (#94) 2021-02-07 20:27:34 +01:00
jangko 18dceaa29f
change tormund/news to status-im/news 2020-09-21 12:08:17 +07:00
Zahary Karadjov f53e0b960b
Fix all tests 2020-03-17 22:05:42 +02:00
Ștefan Talpalaru 72a99cc977
replace getCurrentExceptionMsg() and delete some unused imports 2019-12-02 12:26:09 +01:00
Yuriy Glukhov d4fbed75c7
Better error handling 2019-11-22 15:14:16 +02: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
Ștefan Talpalaru 493583b7f4
cosmetic change 2019-05-10 22:08:30 +02:00
Ștefan Talpalaru 159f9b816e
assert() -> doAssert() 2019-03-13 22:42:07 +01:00
andri lim b4a3273152 fix test 2019-01-12 16:17:19 +02:00
coffeepots e1fad2e3ba Fix test using wrong rpc path 2018-11-26 18:33:47 +00:00