mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 23:25:22 +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. |
||
---|---|---|
.. | ||
cli | ||
emit | ||
opcode | ||
stackitem | ||
testdata | ||
context.go | ||
contract_checks.go | ||
contract_checks_test.go | ||
debug_test.go | ||
exception.go | ||
interop.go | ||
json_test.go | ||
opcodebench_test.go | ||
ref_counter.go | ||
ref_counter_test.go | ||
slot.go | ||
slot_test.go | ||
stack.go | ||
stack_test.go | ||
state.go | ||
state_test.go | ||
vm.go | ||
vm_test.go |