5 suggestions
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · Push-heavy scripts gain allocation costs missing from the small-push benchmark
Repeated non-empty data pushes lose parser-buffer reuse and gain shared-owner allocations, but VerifyPushDropSmall exercises only numeric and empty pushes, leaving this performance trade-off unmeasured.
Location: src/script/interpreter.cpp:500 (head).
Details and suggested fix
MakeStackElem allocates the shared owner and vector object separately from any byte buffer. For a repeated non-empty push/OP_DROP sequence, head needs a fresh parse buffer and shared owner each cycle. Base copied the bytes into the stack while retaining the parse buffer for reuse, so the allocation count rises from roughly one per push after warm-up to two. Empty pushes, numeric results and witness arguments also gain an owner allocation. Sharing saves copies for duplication and P2SH stack snapshots, so this does not establish an overall slowdown. Add a repeated 33-byte push/OP_DROP workload and report before/after timings alongside VerifyPushDropSmall, VerifyNestedIfScript, and the P2WPKH/P2SH-P2WPKH benchmarks to evaluate the trade-off.
[suggestion] · Boolean result elements are allocated even when an evaluation never uses them
Native Taproot key-path verification constructs unused boolean result elements in two EvalScript calls, adding six allocations before the direct Schnorr check.
Location: src/script/interpreter.cpp:432 (head).
Details and suggested fix
Both result handles are constructed before any script inspection. Two make_shared calls plus the true value's one-byte buffer require three allocations and frees per evaluation, whereas base used static vectors. VerifyScript evaluates an empty scriptSig and OP_1 <32-byte program> before Taproot witness dispatch. OP_1 makes its own numeric element, and key-path verification then calls the Schnorr checker directly, so neither preliminary evaluation uses these handles. Initialize each immutable, execution-local handle only when its boolean value is first pushed. This retains intra-execution sharing without cross-thread reference-count contention. Script-execution-cache hits bypass this work, and the timing benefit of lazy initialization is unmeasured.
[suggestion] · Oversized P2WSH stacks allocate an owner for every empty argument before rejection
Each empty argument in an oversized P2WSH witness now requires a transient shared-owner allocation before rejection, while base needed no per-item allocation.
Location: src/script/interpreter.cpp:1876 (head).
Details and suggested fix
ExecuteWitnessScript applies its initial count check only to TAPSCRIPT. A P2WSH program committing to an empty script can therefore supply millions of empty arguments within block weight. The byte-size check accepts them all, conversion creates one shared object per argument, and the wrapper rejects with SCRIPT_ERR_CLEANSTACK only after EvalScript returns. Default policy rejects more than 100 P2WSH arguments before script verification, so remote mainnet reachability requires an invalid block with valid proof of work; a test chain allowing nonstandard relay also reaches this path. The work is linear and the owners are freed on return; allocator-dependent memory and timing costs are unmeasured. Reuse one immutable empty element for empty witness arguments to avoid those owner allocations while preserving bytes, stack counts and ownership-backed lifetimes. Do not simply copy the 1000-item Tapscript precheck into v0: its stack-size check runs after the first opcode, which can consume arguments, so an earlier check changes the reported error.
[suggestion] · Benchmark comments mistake a workload budget for a tapscript limit
The new benchmarks use a 10,000-byte budget under TAPSCRIPT, but their comments incorrectly describe that chosen budget as a consensus ceiling.
Location: src/bench/verify_script.cpp:155 (head).
Details and suggested fix
Both new benchmarks pass SigVersion::TAPSCRIPT, but EvalScript applies MAX_SCRIPT_SIZE and MAX_OPS_PER_SCRIPT only to BASE and WITNESS_V0. Longer tapscript leaves can repeat the same operations subject to weight limits, so these workloads and their repetition counts are not upper bounds. Describe 10,000 bytes as a chosen benchmark budget matching the legacy/segwit-v0 script-size limit, and explain that TAPSCRIPT permits the repetition count without the 201-opcode restriction. Correct the same 10,000-byte-limit premise in the PR description. The workloads themselves need no code change.
[suggestion] · Aliasing test captures an error output it never reads
The new aliasing test collects ScriptError values without asserting or displaying them, leaving the error-output plumbing unused.
Location: src/test/script_tests.cpp:1053 (head).
Details and suggested fix
EvalOn passes &err on every invocation, but the test only checks its boolean result, stack bytes and ownership properties. Remove err, make EvalOn captureless, and omit the trailing nullptr, &err arguments; both optional parameters already default to nullptr.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Saved element handles incur redundant reference-count updates (earlier report)