OpenZeppelin / OpenZeppelin/compact-contracts

crypto: document domain-tag position and arity rule

Open Beginner friendly
#854 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2-low effort: 2-S enhancement feat:crypto follow-up
Dominant language
TypeScript
Stars
55
Forks
29
Avg merge
5d 7h
Merged PRs (30d)
25

Description

Domain-separation tags sit in three different slots across the library, and no note states which is the rule:

  • tag-first: ElGamal.secretToScalar, ForwarderPrivate._calculateParentCommitment
  • tag-last: ShieldedAccessControl.computeRoleCommitment / computeNullifier / computeAccountId, ZOwnablePK._computeOwnerCommitment, every Utils.expandRandomness caller
  • tag-second: ConfidentialFungibleToken._credit

Latent, not exploitable today. A tag-last derivation of the same arity has the shape of expandRandomness(seed, tag), so its tag can be supplied through the seed slot — secretToScalar moved to tag-first for exactly this reason (H-01, #818), and a module copying the ShieldedAccessControl shape for a private derivation would not know that.

Add one note, in Utils or a crypto/ conventions block, fixing the position library-wide (tag-first, matching ElGamal) plus the arity guidance. Existing call sites can migrate in their own PRs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the Utils area and any crypto conventions block, then compare the listed call sites such as ElGamal.secretToScalar and Utils.expandRandomness callers. Add one note stating the tag-first convention and the arity guidance, without migrating existing call sites; done means the rule and its rationale are documented clearly.

Written by the indexing model from the issue text.

Assessment

Domain
cryptography, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.