Skip to content

docs(contracts): write architecture decision record (ADR) for Merkle … - #246

Open
HassanKorey wants to merge 1 commit into
accensa:mainfrom
HassanKorey:docs/adr-001-merkle-structure
Open

docs(contracts): write architecture decision record (ADR) for Merkle …#246
HassanKorey wants to merge 1 commit into
accensa:mainfrom
HassanKorey:docs/adr-001-merkle-structure

Conversation

@HassanKorey

Copy link
Copy Markdown

docs(contracts): write architecture decision record (ADR) for Merkle receipt structure

Summary

This pull request introduces ADR-001-merkle-structure.md to formally document the "sorted-pair SHA-256" strategy utilized by the ReceiptAnchor and off-chain SDK for Merkle tree construction.

Without context, this specific approach can look like a non-standard deviation. The newly added ADR details:

  • Mechanics: How sorting siblings before hashing deterministicly removes the need for left/right positional metadata in the proofs.
  • Trade-offs: The massive benefits in terms of lower WASM instruction counts, smaller on-chain calldata footprint, and cheaper fees on Soroban compared to standard implementations.
  • Security Context: Explicit justification for why sorting before hashing remains completely safe against second-preimage attacks given our strict 32-byte leaf (payment_ref) constraints.

Contract Change Safety Checklist

Please verify that your changes adhere to contract stability requirements:

  • Event Shapes: Does this PR modify event topic tuples or data shapes? (Breaking change per docs/EVENTS.md)
  • Storage Layout: Does this PR change storage keys or layout? (Assessed for archival & migration risks)
  • Error Variants: Does this PR add or renumber contract error codes? (Client-visible breaking change)
  • Changelog: Has a corresponding entry been added to CHANGELOG.md?
  • Deployments: Has any impact on deployed contracts or DEPLOYMENTS.md been documented?
  • Verification: Has this change been tested locally (cargo test) and/or exercised on Soroban testnet?

Related Issues

Closes #81

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@HassanKorey 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

@mergekeeper

mergekeeper Bot commented Aug 27, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #81.
Verdict: clean

The ADR correctly documents the sorted-pair Merkle tree structure, mechanics, Mermaid diagram, trade-offs, and security context as requested in the issue.

Reviewed commit: 4e6db1306a7de86a9425c9fedd73e5ab5d8143d9.
CI and merge eligibility are checked separately.

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.

docs(contracts): write architecture decision record (ADR) for Merkle receipt structure

1 participant