Constant MAX_JSON_LENGTH_RECURSION_LIMIT

Source
pub const MAX_JSON_LENGTH_RECURSION_LIMIT: usize = 32;
Expand description

NOTE: The NEAR runtime limits the Wasm operand stack height to 16,384 entries (max_stack_height genesis parameter). Each recursive call to MaxJsonLength::max_json_length_at consumes stack entries for params, locals, operand depth, and gas metering overhead — the exact amount depends on the monomorphized Args type. Since different trait implementations produce different frame sizes, we use a conservative limit that stays well within budget across all reasonable type nesting. See the NEAR specification on contract preparation for details: https://nomicon.io/RuntimeSpec/Preparation