Add Invoice Commitment Hash (On-Chain Anchor)#60
Merged
Jayrodri088 merged 7 commits intoStellarState:mainfrom Mar 28, 2026
Merged
Add Invoice Commitment Hash (On-Chain Anchor)#60Jayrodri088 merged 7 commits intoStellarState:mainfrom
Jayrodri088 merged 7 commits intoStellarState:mainfrom
Conversation
- Add BytesN<32> commitment field for SHA-256 hash storage - Provides immutable on-chain anchor for off-chain invoice data - Gas/storage efficient with fixed-size 32-byte array
- Add commitment parameter to create_escrow function - Store commitment in EscrowData at creation time - Update function documentation to describe commitment usage - Commitment is immutable after creation
- Add commitment parameter to escrow_created event - Enables off-chain indexers to track invoice commitments - Supports future verification and dispute resolution
- Add test_commitment helper function for generating test hashes - Test commitment creation and storage - Test commitment immutability - Test commitment in events - Test different commitments for different invoices - Test commitment persistence through lifecycle - Update all existing tests to include commitment parameter
- Add test_commitment helper function - Update all create_escrow calls in integration tests - Verify commitment works in full escrow lifecycle scenarios
- Add test_commitment helper function - Update create_escrow calls to include commitment parameter - Ensure cross-contract integration tests pass
- Update all test snapshots to include commitment field - Snapshots reflect new EscrowData structure - All tests produce consistent, reproducible results
|
@Olowodarey 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! 🚀 |
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.
This PR implements an immutable on-chain commitment hash for invoices, providing a minimal anchor to off-chain invoice data (PDF hash, ERP ID, etc.) without requiring a full oracle implementation at MVP stage.
Changes
Core Implementation
commitmentfield toEscrowData: NewBytesN<32>field stores SHA-256 hash of off-chain invoice datacreate_escrowfunction: Now accepts acommitmentparameter that is set at creation and remains immutableescrow_createdevent: Includes the commitment hash for indexers to track and verify invoice dataTechnical Details
BytesN<32>- Fixed-size 32-byte array for SHA-256 hashes (gas/storage efficient)escrow_createdevent for off-chain indexingTest Coverage
Added comprehensive test suite covering:
Testing
Documentation
create_escrowto describe commitment parametertest_commitment()demonstrates proper usageMigration Notes
Breaking Change: Existing
create_escrowcalls must be updated to include thecommitmentparameter.Example:
Acceptance Criteria
EscrowDatafor commitment bytes (32-byte fixed size)BytesN<32>over dynamic stringsunwrap()in production contract pathscargo testpasses locallycargo fmtandcargo clippy -D warningspassFuture Enhancements
This minimal on-chain anchor enables future verification features:
closes #3
closes #4
closes #40
closes #42