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.
This commit is contained in:
Zack authored and Niko1221 committed 2026-10-14 07:07:36 +02:00
1 parent 77ddc2ff14
commit ea08bd6e81
1 file changed
+5 -2
+5 -2
View File
@@ -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()) {