Repository navigation
Conversation
The verifier sheds load with 503 and Retry-After: 1 before it reads the request, so the same proof can be sent again. Retry up to three times, waiting for Retry-After (1s when missing, capped at 5s).
🦋 Changeset detectedLatest commit: 8900e58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 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.
When the zk verifier is at its in-flight limit it answers
/verifyBatchwith 503,Retry-After: 1and "Server busy, retry shortly" (the load-shed path in zee-k-verifier'sapi/mod.rs). That response is sent before the request is read, so nothing was verified or stored and the same proof can simply be sent again.zkVerifyBatchtreats it like any other HTTP error, though, so one busy response fails the wholeencryptInputswithZK_VERIFY_FAILEDand the proof that was just generated, which is the slow part of an encrypt, is thrown away. The app then has to start over from packing.zkVerifyBatchnow sends the same body again on a 503, up to three times, waiting for theRetry-Afterseconds between attempts. If the header is missing it waits one second, and a long value is capped at five seconds so an encrypt can't hang on it. If the verifier is still busy after the last retry the error is the sameZK_VERIFY_FAILEDas before. Other statuses are not retried, and no option or export was added.zkVerifyBatchBusy.test.tscovers a busy-then-success response (same body sent twice), the missing and cappedRetry-Afterdelays, giving up after three retries, and a 400 that still fails on the first call. The first three fail on master. The sdk node project passes (611 tests); the four files that need@cofhe/test-setupbuilt were skipped, same as on master. Prettier is clean andtsc --noEmitshows only the existing@cofhe/test-setupimport errors.Note
Low Risk
Scoped HTTP retry logic for 503 only on the verifier call; bounded delays and unchanged error paths for real verification failures.
Overview
encryptInputsno longer fails the whole encrypt on a single verifier 503 (busy).zkVerifyBatchnow re-POSTs the same proof to/verifyBatchup to three times, sleeping perRetry-After(defaults to 1s, capped at 5s) before each retry.If the verifier is still busy after those attempts, behavior is unchanged:
ZK_VERIFY_FAILED. Non-503 errors (e.g. 400) are not retried. A patch changeset documents the fix for@cofhe/sdk.zkVerifyBatchBusy.test.tsadds coverage for busy-then-success, delay defaults/caps, exhaustion after three retries, and no retry on other statuses.Reviewed by Cursor Bugbot for commit bba9d03. Bugbot is set up for automated code reviews on this repo. Configure here.