mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
e34fa2e915
We can have very deep reference types and attempt to JSONize them can easily lead to OOM (even though there are no recursive references inside). Therefore we have to limit them. While regular ToJSON() is buffer size limited to MaxSize, ToJSONWithTypes is not and limiting it to MaxSize output will require substantial rewriting effort while not really providing fair result, MaxSize is more about stack item size while its JSON representation can be much bigger because of various overheads. Initial thought was to limit it by element count based on MaxIteratorResultItems, but the problem here is that we don't always have this limit in contexts using ToJSONWithTypes (like notification event marshaling). Thus we need some generic limit which would be fine for all users. We at the same time have maxJSONDepth used when deserializing from JSON, so it can be used for marshaling as well, it's not often that we have deeper structures in real results. Inspired by neo-project/neo#2521. |
||
---|---|---|
.. | ||
compiler | ||
config | ||
consensus | ||
core | ||
crypto | ||
encoding | ||
interop | ||
io | ||
network | ||
rpc | ||
services | ||
smartcontract | ||
util | ||
vm | ||
wallet |