Conversation
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.
|
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. |
| mapping(bytes32 version => mapping(bytes32 handle => bytes32 commitHash)) commitments; | ||
| mapping(bytes32 version => bytes32[]) handlesByVersion; | ||
| mapping(bytes32 version => VersionStatus) versionStatus; | ||
| address poster; |
There was a problem hiding this comment.
rethinking now, this maybe has to be multiple instead of single, to allow multiple addressed in case we have to scale this way
i'm still thinking about it in the new TxSender DR, so will update here accordingly
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: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):
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/.