OpenZeppelin / OpenZeppelin/compact-contracts

10b. Integrate `Keccak` primitive — replace `persistentHash` message hashing

Open
#827 0 comments 0 reactions 1 assignee View on GitHub

@andrew-fleming is already working on this.

Since Sep 7, 2026.

0-high effort: 3-M feat:crypto
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 persistentHash to the keccak256 primitive in EcdsaSignerManager and 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 (@circuitInfo k / rows) of keccak256 on 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

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.