OpenZeppelin / OpenZeppelin/compact-contracts
Followups: `NFT refactor -> replace pk with sk #469`
Open
Nobody has claimed this yet.
1-medium
effort: 2-S
feat:token
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 29
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 25
Description
⚪ Nitpicks
- Witness naming convention — camelCase (https://github.com/OpenZeppelin/compact-contracts/pull/469)
NonFungibleToken.compact:137— Renamewit_NonFungibleTokenSK()→wit_nonFungibleTokenSK(). If agreed, apply consistently to the rest of the refactors.
🔵 Followups
- Move `` to a utility module (https://github.com/OpenZeppelin/compact-contracts/pull/469)
NonFungibleToken.compact:145 - **Redundant canonicalization in **`` (https://github.com/OpenZeppelin/compact-contracts/pull/469)
NonFungibleToken.compact:549— `canonOwner`/`canonSpender` are canonicalized, then `isApprovedForAll(canonOwner, canonSpender)` re-canonicalizes them at L391–392. Same pattern in `_update` line 615 where `fromAddress` (already canonical, sourced from `_ownerOf`) is re-canonicalized. - Move helper to a separate module (https://github.com/OpenZeppelin/compact-contracts/pull/469)
NonFungibleToken.compact:924 - Move helper to Utils (https://github.com/OpenZeppelin/compact-contracts/pull/469)
NonFungibleToken.compact:935 - Test hasher drift risk (https://github.com/OpenZeppelin/compact-contracts/pull/469)
contracts/src/token/test/nonFungibleToken.test.ts:14— Fine for now, but if the hasher in the circuit changes, this fn must change too. Worth adding a note on the function. - **Drop redundant **
** calls in **(https://github.com/OpenZeppelin/compact-contracts/pull/469)NonFungibleToken.compact:612–617- L612:
_isTargetZero(disclose(fromAddress))→_isTargetZero(fromAddress) - L616:
_balances.lookup(disclose(canonFrom))→_balances.lookup(canonFrom) - L617:
_balances.insert(disclose(canonFrom), disclose(newBalance))→_balances.insert(canonFrom, newBalance)
Rationale:fromAddress = _ownerOf(tokenId)is a ledger read (untainted),canonFrominherits that,lookup - 1stays untainted. Cross-cutting: worth running the same audit on the merged FT / AC / Ownable refactors.
- L612:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced NonFungibleToken.compact locations and contracts/src/token/test/nonFungibleToken.test.ts, then review PR #469 for the surrounding refactor context. Resolve the listed naming, utility-module, canonicalization, disclosure, and test-maintenance followups, and audit the merged FT, AC, and Ownable refactors for the same redundant calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100