Skip to content

Commit 29a1d05

Browse files
committed
docs(protocol): finalize TikZ figures and fix line-breaking of inline code
- tex/figures.tex: final spacing pass on the settlement-window state machine and the recovery sequence diagram (node separation, lifeline length, label widths). All 10 figures verified: no overfull or underfull boxes, no missing glyphs, widest picture 14.4 cm against a 15 cm budget. - build-pdf.py: inline monospace spans now carry zero-width break opportunities after separators, so long formulas such as min(W_settle - P_prove,max - margin) can wrap instead of running past the text block. Overfull boxes in the paper drop from 26 (worst 57 pt) to 12 (worst 20 pt, about 4 percent of the measure). - Regenerated tex/main.tex and slot-chain-spec.pdf (69 pages); the drift check passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4FAzXMZFjdfqBPY3wSYJ7
1 parent ef443e9 commit 29a1d05

4 files changed

Lines changed: 222 additions & 214 deletions

File tree

packages/protocol/docs/preconfirmation-v2/build-pdf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ def esc(s: str) -> str:
110110
return "".join(SPECIALS.get(c, c) for c in s)
111111

112112

113+
def code_inline(s: str) -> str:
114+
"""行内等宽片段:在分隔符后插入零宽断点,避免长公式撑破版心。"""
115+
e = esc(s)
116+
for tok in (r"\_", ",", "/", "(", "+", "-"):
117+
e = e.replace(tok, tok + r"\allowbreak{}")
118+
return "\\texttt{%s}" % e
119+
120+
113121
def sec_ref(m):
114122
"""§5.6 / §12 → 可点击交叉引用。"""
115123
num = m.group(1)
@@ -146,10 +154,10 @@ def stash_note(m):
146154
text = re.sub(r"附录 ([A-E])(?![\w-])",
147155
lambda m: "\\hyperref[app:%s]{附录~%s}" % (m.group(1), m.group(1)), text)
148156
# 还原
149-
text = re.sub(r"\x02([^\x02]*)\x02", lambda m: "\\texttt{%s}" % esc(m.group(1)), text)
157+
text = re.sub(r"\x02([^\x02]*)\x02", lambda m: code_inline(m.group(1)), text)
150158
text = re.sub(r"\x01(\d+)\x01", lambda m: notes[int(m.group(1))], text)
151159
text = re.sub(r"\x00(\d+)\x00",
152-
lambda m: "\\texttt{%s}" % esc(spans[int(m.group(1))]), text)
160+
lambda m: code_inline(spans[int(m.group(1))]), text)
153161
text = text.replace("**", "") # 注记外置后可能留下的孤立粗体标记
154162
return text
155163

807 Bytes
Binary file not shown.

packages/protocol/docs/preconfirmation-v2/tex/figures.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
\begin{tikzpicture}
181181
\node[scnode, text width=46mm] (IDLE)
182182
{无开启窗口\\当前窗口最终头 $= F$};
183-
\node[scnode, scfill, text width=46mm, below=22mm of IDLE] (OPEN)
183+
\node[scnode, scfill, text width=46mm, below=27mm of IDLE] (OPEN)
184184
{窗口开启\\best $=$ 当前最重候选\\(provisional,可被取代)};
185185
\node[scnode, scfillb, text width=46mm, below=14mm of OPEN] (CLOSE)
186186
{收盘:唯一一次原子提交\\把 best 的终局元组\\写为新 canonical\\
@@ -311,7 +311,7 @@
311311
\node[scnote, text width=22mm, anchor=north] at (\pP,0) {P2P 网络};
312312

313313
% 生命线
314-
\foreach \x in {\pL,\pO,\pB,\pP}{\draw[sclife] (\x,-1.05) -- (\x,-9.5);}
314+
\foreach \x in {\pL,\pO,\pB,\pP}{\draw[sclife] (\x,-1.05) -- (\x,-10.1);}
315315

316316
% Note over 落地者..P2P
317317
\node[scnote, text width=104mm] at (5.3,-1.7)
@@ -324,26 +324,26 @@
324324

325325
% (2) L1 自消息(虚线)
326326
\draw[scdarr] (\pO,-4.1) -- ++(0.85,0) -- ++(0,-0.55) -- (\pO,-4.65);
327-
\node[sclab, text width=40mm, anchor=west] at (\pO+1.05,-4.38)
327+
\node[sclab, text width=44mm, anchor=west] at (\pO+1.05,-4.38)
328328
{(2) 结算窗口收盘 $\Rightarrow$\\尾巴 window-final,最终头 $=F$};
329329

330330
% (3) 构建者自消息
331-
\draw[scarr] (\pB,-5.7) -- ++(0.85,0) -- ++(0,-0.55) -- (\pB,-6.25);
332-
\node[sclab, text width=36mm, anchor=west] at (\pB+1.05,-5.98)
331+
\draw[scarr] (\pB,-5.75) -- ++(0.85,0) -- ++(0,-0.55) -- (\pB,-6.30);
332+
\node[sclab, text width=36mm, anchor=west] at (\pB+1.05,-6.02)
333333
{(3) 等 $F$ 的落地交易达\\$F_{\mathrm{l1}}$ 深度(分钟级)};
334334

335335
% (4)
336-
\draw[scarr] (\pB,-7.2) -- (\pP,-7.2);
337-
\node[sclab, text width=46mm, anchor=south] at (8.9,-7.12)
336+
\draw[scarr] (\pB,-7.6) -- (\pP,-7.6);
337+
\node[sclab, text width=46mm, anchor=south] at (8.9,-7.52)
338338
{(4) 以 $F$ 为父签档 (ii) 恢复块\\\texttt{final\_ref} 见证父已 final)};
339339

340340
% Note over 构建者..P2P
341-
\node[scnote, text width=56mm] at (8.9,-8.25)
341+
\node[scnote, text width=56mm] at (8.9,-8.6)
342342
{一跳接回墙钟;此后按档 (i) 正常出块,与停摆时长无关};
343343

344344
% (5)
345-
\draw[scarr] (\pL,-9.3) -- (\pO,-9.3);
346-
\node[sclab, text width=48mm, anchor=south] at (1.8,-9.22)
345+
\draw[scarr] (\pL,-9.9) -- (\pO,-9.9);
346+
\node[sclab, text width=54mm, anchor=south] at (1.8,-9.82)
347347
{(5) 恢复批次照常证明、落地、开新窗口};
348348
\end{tikzpicture}
349349
\caption{数小时乃至数天停摆后的恢复时序:先把停摆前的最优尾巴落地并收盘为最终头 $F$,再由任一回归构建者以 $F$ 为父出一个档 (ii) 恢复块,一跳把排序接回墙钟,恢复过程不含独立子协议。}

0 commit comments

Comments
 (0)