Skip to content

feat: bound Merkle proof depth at verification - #722

Merged
thlpkee20-wq merged 2 commits into
RevoraOrg:masterfrom
Bojest001:feat/proof-length-bound
Jul 30, 2026
Merged

feat: bound Merkle proof depth at verification#722
thlpkee20-wq merged 2 commits into
RevoraOrg:masterfrom
Bojest001:feat/proof-length-bound

Conversation

@Bojest001

Copy link
Copy Markdown
Contributor

This change adds a hard upper bound for snapshot proof length to prevent excessively deep Merkle proofs from exceeding contract memory and gas limits during verification.

What changed
Introduced a contract-level proof-depth cap via MAX_PROOF_DEPTH = 32
Added a new structured error, ProofTooDeep, for over-limit proofs
Emits a proof_reject_depth event when a proof exceeds the allowed depth
Added regression tests covering:
proofs at the exact limit being accepted
proofs one level above the limit being rejected
Why
Very deep proofs can become expensive and risky in Soroban due to memory and execution constraints. Rejecting them early keeps verification bounded and predictable while preserving a clear, structured failure mode for off-chain callers.

Notes
The bound is documented in the Merkle helper developer notes.
The change is intentionally lightweight and easy to review.

closes #571

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Bojest001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@thlpkee20-wq
thlpkee20-wq merged commit a4fc784 into RevoraOrg:master Jul 30, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add snapshot proof-length bound assertion so proofs fit under contract memory limit

2 participants