WIP: util: Add and use AssertUnreachable

bitcoin/bitcoin: PR #36087

1 major finding

Findings

Link

[major] · Unresolved util dependency breaks consensus-only links

AssertUnreachable() in the interpreter breaks consensus-only links; recorded native head/base whole-archive links and a focused dependency check reproduce the regression, while the full RISC-V and tidy CI jobs were not run.

Location: src/script/interpreter.cpp:1506 (head).

Details and suggested fix

script/interpreter.cpp is compiled into bitcoin_consensus, but AssertUnreachable() calls internal_abort_helper, whose definition is in bitcoin_util. The SignatureHashSchnorr instantiations retain this reference even in the recorded optimized build. ci/test/link-riscv.sh whole-archive links only consensus, crypto and secp256k1, so it cannot resolve the helper. The dependency checker also forbids consensus-to-util imports. Ordinary executables that already link util hide this problem.

Keep the two interpreter assertions as assert(false) and exempt script/interpreter.cpp from assert_falsy. Reverting the assertions alone would fail the new linter, which currently covers this file.


Coverage details