AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 64 Bitcoin

Merge ElementsProject/elements#1604: [master] sigcache: harden range proof cache keys and add -norangeproofcache option

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge ElementsProject/elements#1604: [master] sigcache: harden range proof cache keys and add -norangeproofcache option

53167b1f452f9cdf96b1ec4af7fed613ba772c95 init: add -norangeproofcache startup option to disable range proof cache (Byron Hambly)
5e5f8e613329a493d062f6cb0c74235d8ddc6114 sigcache: add proof cache key collision-resistance tests (Byron Hambly)
b0a275281ee5bfd789b832027fe6d5532273eb74 sigcache: harden proof cache keys with length-prefixed hashing (Byron Hambly)

Pull request description:

target is **master** branch, cherry-picked commits from #1600

Switch the range-proof and surjection-proof cache hashers from raw
CSHA256 concatenation to CHashWriter . This length-prefixes
every field, so distinct argument tuples with byte-identical raw
concatenations no longer collide to the same cache key.

Both caches retain per-process salted midstates with distinct domain
separators ('r' / 's').

Also adds a -norangeproofcache startup option to
disable the range proof cache without recompiling.

ACKs for top commit:
tomt1664:
ACK 53167b1f452f9cdf96b1ec4af7fed613ba772c95 tested locally

Tree-SHA512: 35412700e9773437b67b5ef350e752201856afab5e04e850ee6f9abe2aa4dc5127f5e9c13278c66236193f3279f34ec437f603ade6ba63e8149abd6f364c0246
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a cache-key collision bug in Elements' range-proof and surjection-proof validation caches. Previously, the cache key was built by simply concatenating raw bytes, so two different sets of inputs could accidentally produce the same key. If that happened, a node might skip verification and accept a proof it had never actually checked. The patch switches to length-prefixed hashing so distinct inputs always get distinct keys, adds the missing vTags data to the surjection-proof key, and adds a startup option to disable the range-proof cache. It also adds unit tests to prevent regressions.

Recommended action

Review and merge promptly; the change is defensive and low-risk. Run the new sigcache_tests to confirm collision-resistance and domain-separation properties hold on the target platform. Consider whether the surjection-proof vTags addition warrants a broader audit of other cached validation paths.

Security signals we found

01

Cache key collision resistance hardened by length-prefixing all fields

02

Surjection-proof cache key now includes vTags, fixing a missing-input vulnerability

03

New runtime option to disable range-proof cache without recompilation

04

Added regression tests for field-boundary collisions and domain separation

Risk score

Why this scored 64/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 12/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.