Reject empty merkle proof cache in on-chain generateProof

An empty cache passes the existing mod-32 length check and silently
produces a witness with no path elements, yielding a proof no validator
will accept. Catch the case explicitly so the failure surfaces at the
callsite rather than after a wasted publish round-trip.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
stubbsta 2026-07-09 14:05:10 +02:00
parent 95d0a8bdd8
commit 1b149fed08
No known key found for this signature in database

View File

@ -492,6 +492,9 @@ method generateProof*(
debug "Generating RLN proof"
?(await g.ensureFreshMerkleProofPath())
if g.merkleProofCache.len == 0:
return err("merkle proof cache is empty")
if (g.merkleProofCache.len mod 32) != 0:
return err("Invalid merkle proof cache length")