36 Commits

Author SHA1 Message Date
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
834de413d9
Rename jrpc_sys module back to jsonmarshal 2024-01-04 11:40:22 +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
jangko
a8731e91bc
Support decoding nil ref object 2023-12-12 09:55:21 +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
5fa7071d5b
use object fromJson after creating ref object instance
otherwise, Option fields don't work as expected
2022-09-21 14:43:41 +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
Jacek Sieka
2e3d22b9e2
enable styleCheck:usages (#135) 2022-04-08 10:25:41 +02:00
jangko
51fadf850c
Fix #124 2022-02-14 12:16:31 +07: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
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
Hanno Cornelius
dc3a2d33fc
Added marshalling support for uint32 (#88)
* Added marshalling support for uint32

* Update json_rpc/jsonmarshal.nim

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
2020-11-16 15:45:53 +01:00
Mamy Ratsimbazafy
99455437ba
Fix silent uint64 negative conversion https://github.com/status-im/nim-beacon-chain/issues/1671 https://github.com/status-im/nim-beacon-chain/pull/1819 (#85) 2020-10-07 12:09:36 +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
Viktor Kirilov
8c1a8ef8d9 serialization for tuples - just like for objects 2020-06-11 14:56:57 +03:00
Zahary Karadjov
4d1d2577e9
Trivial changes required for the beacon node integration 2020-03-17 00:17:10 +02:00
Ștefan Talpalaru
92a7b78f4a
Nim HEAD support 2019-04-26 00:17:04 +02:00
Ștefan Talpalaru
cbbdc34399 fix breakage with Nim HEAD 2019-01-04 15:57:52 +02:00
Yuriy Glukhov
839cc3ae33 Fixed compilation error with newer nim 2018-12-20 12:58:42 +02:00
coffeepots
798e86112c Cover optional cases within objects 2018-11-26 18:03:56 +00:00
coffeepots
51ed6f3000 Remove expectType for Option[T], use fromJson on subtype for validation 2018-11-23 16:10:35 +00:00
coffeepots
e942357de6 Fix iterating through return type 2018-11-23 16:05:46 +00:00
coffeepots
5e7f2d6a61
Merge pull request #42 from jangko/rpc_macro
add optional arg support to rpc macro
2018-11-19 10:58:38 +00:00
andri lim
a1fe7d57b4 allow optional parameters in the middle of parameters list 2018-11-16 20:07:39 +07:00
Zahary Karadjov
26953344c3 Turn some potentially dangerous templates into functions
Be careful when creating templates. If the input parameters are
referenced within the body multiple times, this may lead to multiple
evaluations of functions with side-effects.
2018-11-12 23:51:24 +02:00
andri lim
ee3ba6d5ad add optional arg support to rpc macro 2018-11-12 17:47:03 +07:00
coffeepots
40e2c83023 Added allowNull to expectType 2018-08-29 14:16:03 +03:00
coffeepots
e7f66a0b4d Support Option[T] types, added expectType, expect error to use [] in msgs 2018-08-29 14:16:03 +03:00
coffeepots
f6ad1fd1c7 Update to SomeInteger 2018-08-16 13:07:21 +03:00
coffeepots
13a9a1f58b Add ref int and ref int64 2018-08-16 13:07:21 +03:00
andri lim
be5107041b add comments to recently added codes 2018-07-17 10:39:22 +07:00
andri lim
4aedb214b6 fixes #18, rpc macro now can accept multiple variables of one type 2018-07-17 10:06:29 +07:00
coffeepots
0c98f79d9c Rename to json_rpc 2018-06-26 19:08:11 +01:00