Add domain to secretToScalar - #818
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. WalkthroughThe change adds domain separation to ElGamal scalar and encryption-key derivation. Account-ID derivation remains an untagged, globally consistent hash delegated through ChangesDomain-separated key derivation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| * across modules can. Modules wanting a per-deployment, unlinkable identity | ||
| * should not use this circuit. | ||
| * | ||
| * @dev NOT FOR PRIVATE DERIVATION. This returns an identifier, not a secret, |
There was a problem hiding this comment.
2. Untagged computeAccountId is a deviation from the audit recommendation
❔ question: H-01 asked for tags on both derivations; this keeps the id untagged and guards the shared domain with a doc rule a future module can miss. Global identity needs one shared derivation, untagged is not required: tagging it (e.g. OZ:accountId:v1) keeps cross-module identity, satisfies the recommendation fully, and it's still alpha. Deliberate, or worth tagging now?
added by claude (dev3-midnight-basic-review)
There was a problem hiding this comment.
Deliberate. A global id tag is a convention and not a security issue when we include a tag in secretToScalar. Changing the convention deserves its own discussion
| * module-level hash-to-scalar note for why `degradeToTransient` is required. | ||
| * | ||
| * @dev Domain separation here is load-bearing, not cosmetic. This output is | ||
| * the private key protecting every ciphertext held under an account. Public |
There was a problem hiding this comment.
3. Tag position now differs across the library
🔵 followup: this mandates tag-first, while ShieldedAccessControl.compact:744 hashes [value, pad(32, "ShieldedAccessControl:nullifier")] tag-last.
Write the rule down once (Utils or a crypto-conventions note) so a module copying SAC's shape for a private derivation does not recreate H-01.
added by claude (dev3-midnight-basic-review)
There was a problem hiding this comment.
Out of scope, let's keep the PR focused on addressing the fix. The rule for this implementation is already documented
Fixes #792
Summary by CodeRabbit
Security Enhancements
Documentation
Tests