Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 3: [PATCH 03/17] feat(policy): preserve cluster accounting and repair dynamic dust

doc/roots-v31-port-review.md

Before: doc/roots-v31-port-review.md · After: doc/roots-v31-port-review.md

File metadata
index 2796361ade6b2488e3e8b82ace51eba606ff45dc..ed0e6801d8e20769989961c3e1f2eb053db943ff 100644

Download original patch · Release notes

Diff rows 1–111 of 111. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

doc/roots-v31-port-review.md CHANGED
@@ -108,11 +108,11 @@ contract with remaining Roots behavior. Existing source gaps remain explicit.
108
108
 
109
109
  | Contract | Disposition / theme | Upstream comparison, adaptation and acceptance gate |
110
110
  | --- | --- | --- |
111
- | policy-parsing | adapted / L7 | `node::ApplyArgsManOptions` now consumes cluster limits; L7 carries scoped grammar; graph/mining options are labelled parsing-only until L8/L9 enforcement lands. Preserve L2's complete-token/range/diagnostic decisions, quarter-vbyte rounding and CLI/config precedence. Port parser unit/startup tests and L5 fuzz boundaries; complete read/write precedence in L12. |
111
+ | policy-parsing | adapted / L7,L8 | `node::ApplyArgsManOptions` consumes cluster limits and scoped grammar; L8 consumes graph controls and repairs dynamic-dust publication. Mining controls remain parsing-only until L9. Preserve L2's complete-token/range/diagnostic decisions, quarter-vbyte rounding and CLI/config precedence. Parser unit/startup and L5 fuzz boundaries are carried; integrated read/write precedence remains L12. |
112
112
  | effective-policy | adapted / L12 | `getmempoolinfo` has cluster-era size/fee information but no Roots `policy` object. Read authoritative initialized v31 state plus synchronized dynamic dust; retain L3's schema, units and enforcement gates. Port `rpc_effective_policy.py`, help and admission parity assertions. L4 supplied no snapshot refactor to carry. |
113
113
  | policy-standardness | adapted / L7 | Core `IsStandardTx` takes carrier budget, bare-multisig flag and dust rate. Core permits bare multisig by default and lacks Roots configurable script/witness, strict sigop, CAT21/token and ephemeral modes. Preserve Roots limits/defaults/reasons solely in local gates. Run transaction/sigop/TRUC cases and valid-block fixtures; do not change script consensus. |
114
114
  | policy-carrier | adapted / L7,L8 | Core defaults to a 100,000-vbyte OP_RETURN budget, not Roots' aggregate 83-byte budget, and lacks recognized input/witness carriers and cost weighting. L7 adapts detection/budgets; L8 adapts extra policy weight to `TxGraph` fee/weight accounting. Retain Roots `multi-op-return` rejection despite source help conflict. Port `mempool_datacarrier.py`, extra-weight boundaries, tapscript and L5 dust-cost interactions. |
115
- | policy-dust | adapted / L7,L8 | Core retains `GetDustThreshold` and a 3,000 sat/kvB floor, but has a fixed initialized rate and no `dustdynamic` publication. L7 preserves fixed dust/ephemeral checks. L8 repairs scheduler lifetime and retains estimator/floor behavior and synchronized snapshots; adapt mempool-position estimation to clusters. Run `mempool_dust.py` and changing-publication unit cases. Estimator-unavailable and extreme-multiplier gaps are not passes. |
115
+ | policy-dust | adapted / L7,L8 | L7 preserves fixed dust/ephemeral checks. L8.2 adds node-owned scheduling after final successful load, synchronized snapshots and initialized estimator/native cluster-position selection. Missing estimates return the configured floor; scaling saturates safely. This repairs the documented source lifecycle/fallback/extreme gaps. Focused runtime tests and whole-L8 gates are recorded separately in the L8 evidence. |
116
116
  | policy-subdust | adapted / L8 | No upstream deficit penalty. Preserve worked contract units, saturation, exemptions and modified-fee accounting without changing actual fee rewards. Adapt policy weight/modified fees consistently through cluster admission, replacement and mining. Port sub-dust tests and L5 arithmetic fuzz/valid-block cases. |
117
117
  | policy-replacement | adapted / L8 | Core has unconditional full RBF and cluster feerate-diagram replacement, with enforced TRUC; Roots Never/OptIn/TRUC mode controls are absent. Default full RBF alone is not equivalence. Preserve configured modes, v3 opt-in behavior, fee/resource gates and truthful `fullrbf`; adapt to current replacement algorithms without restoring ancestor indexes. Run RBF/TRUC/package/sibling and policy-block tests. |
118
118
  | policy-coinage | adapted / L7 | Relay coin-block age and maturity controls are absent. Reuse available coin heights; add local gates and bounded age arithmetic, never alter consensus coinbase maturity. Preserve disabled defaults and add/retain enabled, boundary and valid-block acceptance cases; the historical dedicated-relay coverage gap is addressed by candidate enabled/disabled, boundary, tip-reorg and valid-block tests. |
@@ -355,3 +355,98 @@ Prior-release mempool compatibility remains skipped because release fixtures are
355
355
  unavailable. External script-assets and other previously recorded optional
356
356
  matrix dependencies are not represented as passes. Final L7 acceptance and the
357
357
  later full candidate integration matrix remain separate review gates.
358
+
359
+ ## L8.1 native graph accounting and replacement
360
+
361
+ Carrier cost, sub-dust penalty, configured RBF/TRUC modes and script reuse now
362
+ have consumers; their L7 parsing-only warnings are removed. Dynamic dust remains
363
+ L8.2 and mining size/priority controls remain L9. `getmempoolinfo.fullrbf` reports
364
+ the initialized RBF mode here, while the additive effective-policy schema is L12.
365
+
366
+ Entries retain actual fees/weight separately from carrier-adjusted policy weight
367
+ and admission-time deficits. A changeset inserts the final fee and weight into
368
+ `TxGraph`; resident deltas update that same graph fee. Native chunk diagrams,
369
+ replacement, ancestor/descendant RPC summaries and trimming therefore share the
370
+ same accounting. Graph tests cover abort/commit, fee updates, block removal and
371
+ reorg dependency discovery. Native chunk mining already reads this accounting;
372
+ L9 owns priority/residual selection and its remaining combinations. Coinbase
373
+ rewards continue to use actual fees. Valid-block fixtures cover carrier cost,
374
+ sub-dust rejection, TRUC rejection and script reuse.
375
+
376
+ Numerical adaptation is deliberate: fee-rate evaluation saturates before an
377
+ unrepresentable quotient, and graph admission reserves absolute modified fees
378
+ and adjusted weights across the main graph and pending additions. The budgets
379
+ are `INT64_MAX` and `INT32_MAX`, respectively; pending removals are conservatively
380
+ reserved until commit. Extreme proposals can therefore be rejected even when
381
+ the final graph alone would fit. Failed resident fee changes are atomic and
382
+ reported as RPC errors. This avoids wrapping policy deficits or native diagram
383
+ sums and does not introduce an ancestor-index compatibility layer.
384
+
385
+ Replacement preserves Never/OptIn/Always and Reject/Accept/Enforce selection,
386
+ including OptIn replacement of non-signaling v3. Native v31 cluster resource and
387
+ feerate-diagram rules remain the economic replacement test. Non-TRUC parents
388
+ retain Roots' individual relay floor; inherited CPFP/ephemeral expectations are
389
+ updated to that source contract, with zero-floor coverage retained separately.
390
+ TRUC Reject and script reuse checks still apply during reorg admission, matching
391
+ the source legacy-bypass set. The RBF contradiction warning is emitted once at
392
+ startup validation rather than once per options reconstruction.
393
+
394
+ Reuse tracking uses full scripts and sets of all creator/spender claims instead
395
+ of a single hash-keyed pointer. It rejects twin outputs, input/output reuse,
396
+ ancestor conflicts and repeated staged claims, and considers independent
397
+ mempool script conflicts under native replacement rules. Staged package reuse
398
+ was an untested source gap; rejecting it closes the same local rule over native
399
+ staging. Tests cover allow/conflict, fee-based policy replacement, block removal,
400
+ reorg behavior and removal of one of multiple tracked claims. This remains a
401
+ local script rule without ownership or privacy inference.
402
+
403
+ Provenance: `1b73fe3d21`, `ec9db369f5` supply graph-policy behavior;
404
+ `aa27c9117a`, `48f3b3bbe8`, `a6f35e915c` supply corrected RBF modes/reporting;
405
+ `fc0dc945d0` and `10d772eb7f` supply sub-dust, carrier and interaction evidence.
406
+ Scoped parsing from `87c950de92` is consumed without widening its grammar.
407
+ Source attribution remains Jaromil and devjoinedthechat with retained
408
+ Core/Knots lineage. Dynamic publication commits remain L8.2-owned.
409
+
410
+ ## L8.2 dynamic dust lifecycle repair
411
+
412
+ The source constructor asserted the presence of an unwired scheduler and
413
+ registered callbacks capturing a mempool that chainstate retries could destroy.
414
+ The authorized repair registers one node-owned task after the final successful
415
+ load, updates immediately and at the source 15-minute cadence, and stops/joins
416
+ the scheduler before destroying the final mempool or estimator. Interrupted or
417
+ failed load attempts register no dust tasks. Live dust getters and standardness
418
+ snapshots synchronize publication with admission, ephemeral checks and wallets.
419
+ Resident sub-dust deficits remain immutable; actual fees and rewards are unchanged.
420
+
421
+ Target mode uses the initialized long horizon with source success threshold 0.8.
422
+ Mempool mode traverses native chunk/topological order to the decimal-kvB policy
423
+ vsize position and takes the boundary entry's actual fee rate. It retains no
424
+ ancestor-score compatibility index. Missing/zero estimates use the configured
425
+ floor. Thousandths multiplier evaluation quantizes to sat/kvB, rounds down and
426
+ saturates at INT64_MAX without overflowing intermediate products. Default off
427
+ and parser grammar/units are unchanged. This repairs source lifecycle, fallback
428
+ and arithmetic gaps rather than claiming that dormant source modes worked.
429
+
430
+ Restart coverage exposed another source gap: the persisted fee delta included
431
+ the admission dust deficit, causing reload to subtract it twice. DumpMempool now
432
+ serializes copied operator deltas only; reload computes one new admission deficit
433
+ at its live rate. The regression preserves a nonzero operator delta across
434
+ restart and observes unchanged accounting at the configured floor.
435
+
436
+ The default full build also exposed the accepted L7 script-size policy global
437
+ being defined in bitcoin_node while the standalone wallet links bitcoin_common.
438
+ Its definition now lives with common standardness; declaration, default, runtime
439
+ assignment and consensus behavior are unchanged.
440
+
441
+ Current evidence is retained under `.gestalt/l8-policy`: full native units/CTest,
442
+ the default headless functional suite, a separate Clang ASan/UBSan daemon and
443
+ focused unit run, arithmetic/graph fuzz campaigns and exact binary/source/log
444
+ hashes. Dynamic runtime coverage includes all modes, extreme grammar values,
445
+ absent and warmed real estimators, periodic updates, floor fallback, immutable
446
+ deficits, production reindex retry, restart, shutdown and concurrent publication.
447
+ Source synchronization/fallback contracts remain the provenance reference;
448
+ Jaromil's `784b2af17a`, `f74cc0433b` and `73c97862e2` supply the synchronized
449
+ publication, changing-rate test and standardness-snapshot source history.
450
+ L8.1's conservative representable-case graph restrictions remain explicit in
451
+ [sub-dust semantics](feature-contracts/subdust.md). L9 mining combinations and
452
+ L12 integrated runtime configuration remain their respective owners.