[FEAT] Add CommitmentRegistry contract#57
Conversation
|
Adding comparison with OZ's
I recommend keeping our version, as it's simpler, cheaper, and more secure for our specific use case. OZ solves a broader problem we don't have. |
contracts/internal/registry-chain/contracts/commitment-registry/CommitmentRegistry.sol
Outdated
Show resolved
Hide resolved
contracts/internal/registry-chain/contracts/commitment-registry/CommitmentRegistry.sol
Outdated
Show resolved
Hide resolved
UUPS-upgradeable contract for storing FHE computation commitments. Threshold Network uses these to verify ciphertext integrity before decrypting. Includes version lifecycle state machine, write-once enforcement, batch posting, and Arbitrum gas estimation script. 59 tests covering all code paths.
a319299 to
13621cc
Compare
Summary
UUPS-upgradeable contract for on-chain FHE computation commitments on Arbitrum One. Threshold Network verifies ciphertext integrity before decrypting by looking up committed hashes. Part of the effort to reduce trust between CoFHE components.
Storage:
mapping(version => mapping(handle => commitHash))+bytes32[] handlesByVersionfor enumeration. Write-once, version lifecycle enforced.Design decisions
getCommitment). Merkle can be added via UUPS upgrade if costs warrant it (~10-20x cheaper but requires an event indexing service).postCommitments— The version is an opaquebytes32from the FHE engine:keccak256(publicKey[securityZone], library_id, version, params). Explicit because:mapping(address => bool) postersinstead of singleaddress poster, allowing horizontal scaling of poster services. Managed viaaddPoster()/removePoster()(owner-only). Write-once enforcement still applies across all posters — no poster can overwrite another's commitment.handlesByVersionarray enables paginated cursor (getHandles) for migration and iteration. Roughly doubles gas per commitment vs mapping-only.Gas (measured, includes mapping + array)
Per commitment (L2 execution):
Poster management:
At 0.03 gwei effective gas price, ETH ~$2,140.
Monthly at 100K CTs/day: $9K-20K/mo depending on batch efficiency.
Test plan
See README in
contracts/internal/registry-chain/contracts/commitment-registry/.