Repository navigation
fix(sdk): fail fast on chainId mismatch between decrypt builders and ACP - #409
Merged
alexshchur merged 3 commits intoOct 28, 2026
Merged
alexshchur merged 3 commits into
alexshchur merged 3 commits into
Conversation
🦋 Changeset detectedLatest commit: d940e8c 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 |
Lesnak1
force-pushed
the
fix/decrypt-builders-chainid-mismatch
branch
from
October 14, 2026 13:04
08b2e33 to
705d060
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 705d060. Configure here.
Lesnak1
force-pushed
the
fix/decrypt-builders-chainid-mismatch
branch
from
October 14, 2026 13:21
705d060 to
e2f6128
Compare
Add ChainIdMismatch error code to CofheErrorCode and reject decrypt execution when builder chainId is explicitly set and differs from the ACP's signed chainId (acp._signedDomain.chainId). - In decryptForView and decryptForTx, throw CofheError with CofheErrorCode.ChainIdMismatch naming both chain IDs when they differ. - Fall back to ACP signed chainId when builder chainId is unset and hydrate this.chainId. - Add regression unit tests in packages/sdk/core/test/decryptBuilders.test.ts asserting fast failure on mismatch and successful dispatch on matching/unset chain IDs. - Include a patch changeset for @cofhe/sdk.
alexshchur
force-pushed
the
fix/decrypt-builders-chainid-mismatch
branch
from
October 28, 2026 12:25
d1a994e to
d940e8c
Compare
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.

Add ChainIdMismatch error code to CofheErrorCode and reject decrypt execution when builder chainId is explicitly set and differs from the ACP's signed chainId (acp._signedDomain.chainId).
Note
Low Risk
Targeted validation on the decrypt execution path; wrong-chain requests fail earlier instead of hitting the threshold network.
Overview
decryptForViewanddecryptForTxnow validate that an explicitly set builderchainIdmatchesacp._signedDomain.chainIdright after ACP validation, before any threshold-network call. On mismatch they throwCofheErrorwith the newCofheErrorCode.ChainIdMismatch, including both IDs in the message and context. When the builderchainIdis unset, behavior is unchanged: it is filled from the ACP’s signed domain and execution continues.The enum gains
ChainIdMismatch(consumers with exhaustive handling overCofheErrorCodeneed a new branch). Regression tests cover mismatch (notnDecryptV2/tnSealOutputV2dispatch), matching IDs, and unset builderchainId. A patch changeset documents the@cofhe/sdkfix.Reviewed by Cursor Bugbot for commit d940e8c. Bugbot is set up for automated code reviews on this repo. Configure here.