OpenZeppelin / OpenZeppelin/compact-contracts
dev: `transferFrom` circuit optimization
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 29
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 25
Description
transferFrom optimization
followup: the five-field persistentHash(seed, tag, owner, spender, epoch) costs one more SHA-256 block per scalar than the two-field expandRandomness it replaces, so transferFrom goes 63207 → 70164 rows and over the k=16 boundary. k=17 doubles its proving table, and the header two hundred lines up already warns the full CFT surface exceeded the local ledger-8 block byte budget.
This PR introduces the derivation, so it is not pre-existing debt. Hashing (owner, spender, epoch) once into a 32-byte nonce and expanding that three times should hold k=16; worth measuring before this lands on the release branch rather than tracking it after.
added by claude (dev3-midnight-basic-review)
Originally posted by @0xisk in https://github.com/OpenZeppelin/compact-contracts/pull/825#discussion_r3932254542
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
Locate the transferFrom implementation and its persistentHash and expandRandomness derivation, then establish the current circuit-row measurement and k=16 boundary. Compare the proposed nonce derivation by measuring the resulting rows and confirm that the CFT surface remains within the ledger-8 block byte budget before release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, cryptography
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100