Conversation
karim-en
commented
Jan 6, 2026
olga24912
approved these changes
Jan 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This Does
Adds security validation for Orchard (shielded) withdrawals in the Zcash bridge. Users can now withdraw to Unified Addresses with proper enforcement that bundles go to the right recipient with the right amount.
The Problem
The
orchard_txbranch added basic Orchard transaction support, but had TODOs around validation:This meant a malicious user could potentially redirect shielded funds or manipulate amounts.
The Solution
1. OVK-Based Output Recovery
Implemented
orchard_policy.rsmodule that uses a hardcoded Bridge OVK to recover and validate Orchard outputs:Trade-off: The OVK is public (contract code is public), so anyone can recover these outputs. This is acceptable for the bridge use case - we're enforcing policy, not providing privacy.
2. ZIP-244 Sighash Binding
The Orchard bundle is now included in the
TransactionDataused for transparent signature generation. This means:3. Orchard-Only Withdrawals
Added support for withdrawals with zero transparent outputs (all funds → shielded pool):
4. Unified Address Validation
Enforces that Unified Addresses must come with Orchard bundles:
Test Coverage
Added 5 comprehensive tests covering:
Note: Tests cache generated Orchard bundles because proof generation takes ~80-90s. First run is slow, subsequent runs are fast (~16s total).
Breaking Changes
Event Encoding
Changed
SignedBtcTransactionevent from hex to base64 to stay under NEAR's 16KB log limit:Overhead reduced from 2x (hex) to 1.33x (base64). Relayer will need to update the parser.