Repository navigation
Conversation
…idOperationInputs
🦋 Changeset detectedLatest commit: 6bf86ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
This branch has not been deployed
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
Follow-up to #481, on the same
createTaskpath.MockTaskManager.createTaskonly checked extra (plaintext) inputs for trivial encrypt and cast. Any other operation given extra inputs got through validation and then reverted later, in the mock's own evaluation, with the mock-onlyInvalidThreeInputOperation/InvalidTwoInputOperation. The real TaskManager rejects it up front withInvalidOperationInputs(<op>)(validateExtraInputs, cofhe-contracts v1.0.2TaskManager.sol:649-663, called at:719-721only whenextraInputs.length > 0).Impact
Low and narrow:
FHE.solonly passes extra inputs to trivial encrypt and cast, so this is reached only by calling the TaskManager'screateTaskdirectly. In that case a test written against the mock saw an error selector that does not exist on chain, e.g.addwith one extra input: mockInvalidThreeInputOperation("add"), TaskManagerInvalidOperationInputs("add").Fix
Adds
validateExtraInputstoMockTaskManager, with the same shape as the TaskManager's: trivial encrypt → the existingvalidateTrivialEncryptInputs, cast →UnsupportedTypefor an unknown target type (unchanged from #481), anything else →InvalidOperationInputs(<op>). Like the TaskManager, it runs only when there are extra inputs. Calls without extra inputs, and every callFHE.solmakes, behave as before.Test plan
packages/foundry-plugin/test/MockExtraInputs.t.sol:addandnotwith an extra input revert withInvalidOperationInputs; cast with a target type andaddwithout extra inputs still workInvalidOperationInputsbranch makes only the two revert tests fail (InvalidThreeInputOperation("add") != InvalidOperationInputs("add"),InvalidTwoInputOperation("not") != InvalidOperationInputs("not")); the other 2 tests here and the 9 in fix(mock-contracts): reject the types the TaskManager rejects #481'sMockUnsupportedType.t.solstill pass; restored → passforge testinpackages/foundry-plugin(132 passed) andpackages/mock-contracts(8 passed), Foundry 1.7.1 as in CIprettier --checkon the changeset@cofhe/mock-contracts: patch)Competitor check
Searched
extraInputs,InvalidOperationInputs,validateExtraInputs,extra inputs,createTask mockin PRs and issues: only the merged #403 and #481 touch this path; no open PR or issue covers it. Open #463 changescreateRandomTask, notcreateTask.Note
Low Risk
Narrow mock validation parity fix on a path FHE.sol does not use; normal mock tests and cast/trivialEncrypt behavior stay the same.
Overview
Aligns
MockTaskManager.createTaskwith the on-chain TaskManager when callers pass plaintext extra inputs for operations that should not accept them.The mock now runs a new
validateExtraInputsstep (only whenextraInputs.length > 0): trivialEncrypt and cast keep their existing checks; every other op (add, not, etc.) reverts immediately withInvalidOperationInputs(<op>). Before this change, those calls slipped past validation and failed later in mock evaluation with mock-onlyInvalidTwoInputOperation/InvalidThreeInputOperation, which do not exist on chain.Adds
MockExtraInputs.t.solto lock in the revert selector and confirm cast and normal calls without extra inputs are unchanged. Patch changeset for@cofhe/mock-contracts.Reviewed by Cursor Bugbot for commit 6bf86ab. Bugbot is set up for automated code reviews on this repo. Configure here.