1 suggestion
Optional improvements
[suggestion] · CastToBool's direct fuzz call lacks a result check
The existing script_interpreter fuzz call discards CastToBool's result, so it cannot detect an incorrect boolean answer even though the optimized implementation currently preserves the original rule.
Location: src/script/interpreter.cpp:50 (head).
Details and suggested fix
The added script_tests.json vectors exercise selected word boundaries, but they do not provide an oracle for the arbitrary vectors supplied to the direct fuzz call. In src/test/fuzz/script_interpreter.cpp, keep the generated vector, compute a reference using the original byte-by-byte rule, and assert that CastToBool agrees. The reference should return false when every byte is zero or when the first nonzero byte is a final 0x80, and true otherwise. This adds semantic checking for each generated input without changing production code.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Unresolved disagreements
The earlier proposal did not resolve whether the performance benefit justified touching subtle consensus-critical code. Darosior characterized the improvement as imperceptible and objected on that basis; the proposal was subsequently closed 'due to controversy.' A later comment supplied the Raspberry Pi measurement and proposed a follow-up, but the inspected record contains no resolution of the risk-versus-benefit disagreement.
The historical tradeoff was not simply whether word scanning was faster: it was whether the practical worst-case benefit warranted changing consensus-sensitive interpretation. This explains the significance of both end-to-end measurements and semantic boundary coverage without determining the judgment of the current change.