From ea08bd6e813b687f2331ad7f63068633e568e9db Mon Sep 17 00:00:00 2001 From: Zack <132591805+ZackO2o@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:16:14 +0800 Subject: [PATCH] decode: size --lookup-chain's window cap from the cap in force, not the stale mtp_max_t With the default --suffix-draft 3 the suffix block above already raises --spec by 2 (4 -> 6) and writes mtp_max_t = 4. The --lookup-chain block then computed min(mtp_max_t + K, 8) = min(4 + K, 8), so with --spec 4: K=1 -> max(6, 5) = 6 (unchanged: the flag does nothing) K=2 -> max(6, 6) = 6 (unchanged: the flag does nothing) K=3 -> max(6, 7) = 7 Measured on 0.1.40 by reading the cap back from /metrics engine.spec after a restart per row; K=1 and K=2 were indistinguishable from not passing the flag. Size from the cap actually in force instead, so K adds up to K of headroom while the kVerifyMaxT = 8 ceiling and the mtp_max_t bound on the MTP's own drafts are preserved. Behavior is unchanged when --suffix-draft is 0 or when the cap is already at 8. --- src/program/generate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index ba00f94d..0b5e3c40 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -2568,10 +2568,13 @@ int main(int argc, char** argv) { o.mtp_max_t = o.spec; o.spec = std::min(o.spec + 2, 8); // kVerifyMaxT } - // --lookup-chain (opt-in): the MTP keeps its windows; a lookup chained after its drafts may lengthen one by up to K + // --lookup-chain (opt-in): the MTP keeps its windows; a lookup chained after its drafts may lengthen one by up to K. + // Sized from the cap actually in force: the suffix block above may already have raised --spec to --spec+2, so sizing + // from mtp_max_t left K=1 and K=2 with a window identical to not passing the flag at all. if (o.lookup_chain > 0 && o.spec >= 2) { if (o.mtp_max_t == 0) o.mtp_max_t = o.spec; - o.spec = std::max(o.spec, std::min(o.mtp_max_t + o.lookup_chain, 8)); // kVerifyMaxT + const int chain_base = o.spec; + o.spec = std::max(chain_base, std::min(std::max(chain_base, o.mtp_max_t) + o.lookup_chain, 8)); // kVerifyMaxT } strata::core::layer_set_shared_early(!o.shared_late); if (!o.native_preset.empty()) {