-
Notifications
You must be signed in to change notification settings - Fork 8
[FEAT] Add on-chain signature verification for decrypt results #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
414cefe
implement contract changes to verify decryption sigs
roeezolantz 8be736b
remove decryption id from sig
roeezolantz c36bdf9
improvements
roeezolantz a27017b
PR comments fixes, tests, ci
roeezolantz b9946e7
fix ci
roeezolantz 74bbd47
fix test
roeezolantz 4694f33
fix existing tests
roeezolantz f98b26e
use tryRecover for non-reverting signature verification
roeezolantz 1611659
add onlyIfEnabled to publish functions
roeezolantz f71f207
replace require string with LengthMismatch custom error
roeezolantz 16e7aff
add safety comment and advance free memory pointer in assembly
roeezolantz fff2337
use bytes32 for ctHash in Impl and FHE overloads
roeezolantz 697cbac
add verifyDecryptResultSafe typed overloads
roeezolantz f9adee0
add tests for tryRecover, onlyIfEnabled, and edge cases
roeezolantz 8c9867c
update changelog
roeezolantz 9845669
Add `FHE.allowPublic` as alias for `FHE.allowGlobal` (#48)
architect-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| test-host-chain: | ||
| name: Host Chain Contract Tests | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: contracts/internal/host-chain | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v2 | ||
| with: | ||
| version: 9 | ||
|
|
||
| - name: Get pnpm store directory | ||
| shell: bash | ||
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup pnpm cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ${{ env.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('contracts/internal/host-chain/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Compile contracts | ||
| run: pnpm compile | ||
| env: | ||
| # Dummy keys for hardhat config (not used - tests run on Hardhat network) | ||
| KEY: "0x0000000000000000000000000000000000000000000000000000000000000001" | ||
| KEY2: "0x0000000000000000000000000000000000000000000000000000000000000002" | ||
| AGGREGATOR_KEY: "0x0000000000000000000000000000000000000000000000000000000000000003" | ||
|
|
||
| - name: Run tests | ||
| run: pnpm test | ||
| env: | ||
| KEY: "0x0000000000000000000000000000000000000000000000000000000000000001" | ||
| KEY2: "0x0000000000000000000000000000000000000000000000000000000000000002" | ||
| AGGREGATOR_KEY: "0x0000000000000000000000000000000000000000000000000000000000000003" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
contracts/internal/host-chain/contracts/tests/PubliclyAllowedTest.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| pragma solidity >=0.8.13 <0.9.0; | ||
|
|
||
| import {FHE, euint8} from "@fhenixprotocol/cofhe-contracts/FHE.sol"; | ||
|
|
||
| contract PubliclyAllowedTest { | ||
| euint8 public lastHandle; | ||
|
|
||
| function createAndAllowGlobal(uint8 value) public returns (euint8) { | ||
| euint8 encrypted = FHE.asEuint8(value); | ||
| FHE.allowGlobal(encrypted); | ||
| lastHandle = encrypted; | ||
| return encrypted; | ||
| } | ||
|
|
||
| function createWithoutGlobal(uint8 value) public returns (euint8) { | ||
| euint8 encrypted = FHE.asEuint8(value); | ||
| lastHandle = encrypted; | ||
| return encrypted; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.