OpenZeppelin / OpenZeppelin/compact-contracts
10b. Integrate `Keccak` primitive — replace `persistentHash` message hashing
@andrew-fleming is already working on this.
Since Sep 7, 2026.
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 29
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 25
Description
🧐 Motivation
The signatures the stateless presets verify are produced by EVM HSMs over a Keccak-256 digest. The contracts currently hash the signed payload with persistentHash, so the on-chain message never matches what the signer actually signed. Verification can only be correct once the message hash is Keccak.
📝 Details
Split out of #475, which combined the ECDSA and Keccak work. The signature-verification half is tracked in #826.
Scope:
- Switch the signed-message hash from
persistentHashto thekeccak256primitive inEcdsaSignerManagerand the stateless presets. - Align the message encoding and domain separation with what the EVM signing infrastructure produces, so an HSM signature validates without re-encoding on the client.
- Measure real per-circuit cost (
@circuitInfok / rows) ofkeccak256on the RC toolchain. Keccak sits on every gated circuit, so its row cost is load-bearing for the block budget.
Blocked on Midnight Foundation primitive delivery (Keccak GA). Blocks mainnet deployment of ShieldedMultiSigV2 and ShieldedMultiSigToken, and the corresponding audit scope.
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.
Assessment
This issue has not been assessed yet.