fix(ICofhe): add securityZone parameter to Utils.inputFromHashAndProof#67
Open
amathxbt wants to merge 1 commit into
Open
Conversation
…rary The existing inputFromHashAndProof(hash, signature, utype) always created an EncryptedInput with securityZone=0, ignoring the actual security zone of the underlying ciphertext. Callers using security zones other than 0 (multi-zone deployments) would submit inputs with the wrong zone, causing verifyInput to fail on-chain with no clear error. Add a securityZone-aware four-argument overload that exposes the full EncryptedInput constructor. Preserve backward compatibility by keeping the original three-argument signature as a convenience wrapper that forwards securityZone=0 to the new overload.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Utils.inputFromHashAndProofincontracts/ICofhe.solalways constructs anEncryptedInputwithsecurityZone: 0, regardless of the actual security zone the ciphertext was created for. This silently breaks any caller that uses a non-zero security zone.Bug
Impact: When a ciphertext is created on security zone 1 (or any zone ≠ 0) and the caller builds its
EncryptedInputviainputFromHashAndProof, the resulting struct hassecurityZone: 0. The CoFHE task manager then validates the input against zone 0's public key rather than zone 1's, causingverifyInputto fail with a cryptographic verification error that is difficult to diagnose.All other
inputFrom*helpers (inputFromEuint8,inputFromEuint64, etc.) correctly propagatesecurityZonefrom the input struct.inputFromHashAndProofis the only outlier.Fix
Add a four-argument overload that accepts an explicit
securityZoneparameter. The original three-argument signature is kept as a backward-compatible convenience wrapper defaulting to zone 0.