Skip to content

perf(contract): optimize privacy flag storage with SHA256 hashing#172

Open
EmmyKay0026 wants to merge 13 commits intoPulsefy:mainfrom
EmmyKay0026:testemmanuel
Open

perf(contract): optimize privacy flag storage with SHA256 hashing#172
EmmyKay0026 wants to merge 13 commits intoPulsefy:mainfrom
EmmyKay0026:testemmanuel

Conversation

@EmmyKay0026
Copy link
Copy Markdown

@EmmyKay0026 EmmyKay0026 commented Mar 24, 2026

Closes #163


Hi @Cedarich, this PR is for issue #163 and optimizes the privacy flag storage in the Soroban contract by switching from a handle-based tuple key to a deterministic hashing algorithm (SHA256). This change aligns the privacy module with the contract's overall cryptographic commitment patterns while moving towards more compact storage keys.

`

Method CPU Instructions Memory (Bytes) Key Size (Approx)
Baseline (Tuple) 8,191 734 ~60 bytes
SHA256 (Optimized) 26,987 2,953 32 bytes
`

The increase in CPU instructions is a calculated trade-off to achieve smaller, deterministic storage keys which reduce long-term ledger fees.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

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

@Cedarich
Copy link
Copy Markdown
Contributor

Resolve conflicts

@Cedarich
Copy link
Copy Markdown
Contributor

Fix failing contract workflow

@Cedarich
Copy link
Copy Markdown
Contributor

Please remove the following non-essential changes before merging:

  • .turbo/cache/ files should not be committed.
  • Revert the deletion of package-lock.json files in the root and sub-directories.
  • Branch Integrity: Ensure that the merge does not accidentally delete directories like app/frontend or app/backend, which appeared to be missing in this branch's diff.

@EmmyKay0026

@EmmyKay0026
Copy link
Copy Markdown
Author

Alright on it@Cedarich

@Cedarich
Copy link
Copy Markdown
Contributor

Fix conflict

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.

Gas-Efficient Hashing for Privacy Flags

2 participants