Skip to content

Add hash plus proof input encryption support#262

Open
architect-dev wants to merge 12 commits into
masterfrom
feat/hash-plus-proof
Open

Add hash plus proof input encryption support#262
architect-dev wants to merge 12 commits into
masterfrom
feat/hash-plus-proof

Conversation

@architect-dev
Copy link
Copy Markdown
Collaborator

@architect-dev architect-dev commented May 26, 2026

Add support for "hash plus proof" input encryption for CTA compliance.

cofhe-contracts corresponding PR which adds bytes32 aliases for each encrypted input hash: FhenixProtocol/cofhe-contracts#69

  • Add .asHashPlusProof() encrypt inputs builder method.
  • Update .execute() return type based on if .asHashPlusProof() chained.
  • If hpp transform encrypted input structs into [hashA, ..., hashN, proof] format.
  • Add branded externalE* and proof types, create map types.
  • Add type tests.
  • Add internal core builder tests.
  • Upgrade cofhe-contracts version.
  • Add hash plus proof enc input function to SimpleTest.sol contract for testing.
  • Add integration-matrix test.
  • Foundry hash plus proof
  • Update encrypt inputs documentation.

Note

Medium Risk
Changes how encrypted inputs are shaped for on-chain submission; mixing HPP vs InE* or ABI mismatches will revert, though coverage is broad across SDK, Foundry, and integration tests.

Overview
Adds hash plus proof (HPP) as an optional encryption output path for CTA-style contracts that take externalE* + bytes proof instead of InE* structs.

On @cofhe/sdk, EncryptInputsBuilder gains .asHashPlusProof(), which flips a type parameter so .execute() returns HashPlusProofResult<T>: per-input 0x hashes (from ctHash) plus one concatenated proof blob. New branded External*Hash / ExternalHashProof types and tuple mappers are exported; compile-time and unit tests lock in the shape.

Foundry CofheClient mirrors this with createInE*_asHashPlusProof for bool/uint8–128/address; plugin and SimpleTest tests store via FHE.asE*(hash, proof).

Test harness: SimpleTest.setValueHashPlusProof, autogenerated simpleTestAbi, redeployed fixture addresses, and HPP flows in Hardhat 3, Hardhat plugin, and integration-matrix tests. Docs cover SDK, contract writes, and Foundry APIs.

Reviewed by Cursor Bugbot for commit 56a4e85. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cofhesdk-docs-gh-action Error Error May 29, 2026 1:37pm
cofhesdk-react Ready Ready Preview, Comment May 29, 2026 1:37pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cofhesdk-docs Ignored Ignored May 29, 2026 1:37pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

🦋 Changeset detected

Latest commit: 56a4e85

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@cofhe/sdk Patch
@cofhe/abi Patch
@cofhe/hardhat-3-plugin Patch
@cofhe/hardhat-plugin Patch
@cofhe/mock-contracts Patch
@cofhe/react Patch
@cofhe/site Patch
@cofhe/example-react Patch
@cofhe/foundry-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 602fa42. Configure here.

Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts Outdated
Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts
Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts
Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts Outdated
Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts Outdated
Comment thread packages/sdk/core/encrypt/encryptInputsBuilder.ts
@architect-dev
Copy link
Copy Markdown
Collaborator Author

Tests will fail until new cofhe-contracts version deployed with externalE* aliases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants