Proof of concept mechanical port of ircnet/ircd to Rust as part of a bit about C being insecure for network services
2.6 kB
name: leveva-linelen-2048-graphemes description: "leveva supports 2048-grapheme (not 512-byte) non-tag lines, advertised as LINELEN=2048; where the cap lives + the framer ceiling formula (P11 slice 121)" metadata: node_type: memory type: project originSessionId: 5cc0cd61-d1bb-40b1-8777-3238c363db78#
Maintainer directive (2026-06-12): leveva MUST support IRC lines whose non-tag portion
can be up to 2048 graphemes (UAX #29 clusters, not bytes — a 2048-char multi-byte line of
accented Latin / CJK / emoji is fully supported), and advertise LINELEN=2048 in ISUPPORT.
P11 slice 121 implemented it. Key facts (so you don't re-derive or break them):
- The cap is a count of grapheme clusters, measured with
unicode-segmentation. Constantleveva::message::LINELEN = 2048. Enforcement point =Message::to_wire(output): it truncates the assembled non-tag body at the start of grapheme indexLINELEN(body.grapheme_indices(true).nth(LINELEN)...), never splitting a cluster. The old 510-byte (MAX_CONTENT_LEN) cut is gone fromto_wire. MAX_MESSAGE_LEN(512) /MAX_CONTENT_LEN(510) still exist but now mean "the RFC floor / the chunker budget" —command::ison,command::monitor, ands2s::burststill pack toMAX_CONTENT_LEN, deliberately staying RFC-sized so a linked peer never sees an over-512 line (no S2S protocol drift). Don't "modernize" those to LINELEN.- Framer ceiling:
session::MAX_INBOUND_LINE = MAX_TAG_DATA_LEN + MAX_BODY_BYTESwhereMAX_BODY_BYTES = LINELEN * 64(= 139263, was 8703 = 8191+512). 64 bytes/grapheme is the DoS backstop allowance (covers ZWJ emoji families ≈25 B, flags 8 B); a line past this still gets417 ERR_INPUTTOOLONG+ resync (the slice-118 recvQ guard, just moved). If you change LINELEN, this andgolden_recvq's blob size (must exceed 139263) move with it. - Divergence:
LINELENis advertised as2048; the internal limit is 2048 graphemes. Since grapheme count ≤ byte count, a client respectingLINELEN=2048bytes is always within budget — a safe lower bound. leveva-native, no oracle differential (C oracle truncates at 512 B, advertises no LINELEN).
Tested by message/isupport/session units + leveva/tests/linelen_proptest.rs (headline:
to_wire body == full body truncated to LINELEN graphemes). Recording discipline:
[[leveva-slice-recording]]. Related: [[leveva-utf8-only-parse-boundary]] (the other client-frame
message-boundary hardening), [[leveva-s2s-port-based-routing]].