fix(sdk): validate permit expiration and validity in decrypt builder pipelines - #323
fix(sdk): validate permit expiration and validity in decrypt builder pipelines#323Lesnak1 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 03c148a 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 |
|
Someone is attempting to deploy a commit to the Fhenix Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi, @alexshchur 🙂 This PR adds client-side permit expiration validation to the decrypt builder pipeline ( Changes summary:
All existing test suites pass cleanly. Would appreciate a review whenever time permits — happy to adjust anything based on feedback! |
|
Hi team, I noticed the Permit to ACP migration has landed on master, which structurally conflicts with this PR's validation logic. I'm happy to rewrite the expiration/validity checks against the new ACP / ACPUtils API if that would still be valuable - or I can close this if the team has already addressed it internally as part of the migration. Let me know how you'd like me to proceed. Thanks! |
Resolves #272
Summary
decryptForTxanddecryptForViewbuilder pipelines previously returned stored active or hash-fetched permits directly fromgetResolvedPermit()without checkingPermitUtils.isValid(permit). When an active or selected permit expired, decrypt executions proceeded with the expired permit payload and triggered opaque on-chain reverts (PermissionInvalid_Expired/0xed0764a1) or Threshold NetworkPERMIT_EXPIREDfailures, failing to surface a fast, clean error on the client.Changes
packages/sdk/core/decrypt/decryptForTxBuilder.ts: AddedPermitUtils.isValid(permit)assertions for custom, hash-resolved, and active permits ingetResolvedPermit(). ThrowsCofheErrorCode.PermitExpiredwhen the permit is expired or invalid.packages/sdk/core/decrypt/decryptForViewBuilder.ts: AddedPermitUtils.isValid(permit)assertions for custom, hash-resolved, and active permits ingetResolvedPermit(). ThrowsCofheErrorCode.PermitExpiredwhen the permit is expired or invalid..changeset/validate-permit-expiration-in-decrypt.md.Verification
CofheErrorCode.PermitExpired).