-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore(kms-connector): grpc poll immediatly if request already sent #1155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(kms-connector): grpc poll immediatly if request already sent #1155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements an optimization to immediately poll for gRPC responses when a request has already been sent to the KMS, rather than attempting to resend it. This is achieved by tracking request state through a new already_sent boolean field.
Key Changes:
- Added
already_sentfield to track whether a request has been sent to the KMS - Modified request sending logic to skip resending when
already_sentis true - Updated database schema and queries to persist the
already_sentstate
Reviewed Changes
Copilot reviewed 9 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| kms_response.rs | Updated to pass already_sent=true when marking events as pending after processing responses |
| gw_event.rs | Added already_sent field to GatewayEvent struct and updated all related functions to handle this field |
| kms_worker.rs | Changed event parameter to mutable to allow updating already_sent state during processing |
| processor.rs | Updated trait and implementation signatures to accept mutable event references |
| kms_client.rs | Implemented logic to conditionally send requests based on already_sent flag and updated error message |
| simple.rs, parallel.rs | Updated test fixtures to include already_sent: false in expected results |
| 20251027122128_add_already_sent.sql | Migration adding already_sent column to all request tables |
| 20250826111757_keygen_crs.sql | Added error handling for enum type creation to prevent migration failures |
Files not reviewed (7)
- kms-connector/.sqlx/query-0c7e1f45677401d5bf8d0dce8849637a4b533c4371b1620f9259529a1bfebc27.json: Language not supported
- kms-connector/.sqlx/query-12d768492b153b53cf4cb6c9f3e66c1940b5f4f6306113ff9648f690f1379240.json: Language not supported
- kms-connector/.sqlx/query-2c1c41025c09656ec4aa9a6e8ee58b52cadbc7039cf07d158f70dfc46b5e06eb.json: Language not supported
- kms-connector/.sqlx/query-976df9ddb90a8496ff6392dce98caffef797e8177193bf4711fafa1aab746040.json: Language not supported
- kms-connector/.sqlx/query-9e6abfc0df77b3587972fc590ee888338d1e9a3d4f2bdb506d8588319adad879.json: Language not supported
- kms-connector/.sqlx/query-ae80f83b6a6f16cd77a8e1a8a177ca8631cf6a17fc91e6f6784d160ceedfcb98.json: Language not supported
- kms-connector/.sqlx/query-f9e4703b71b26e3c08ecb4960d8c9ff833085240442de258975cde391de302a2.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "UPDATE public_decryption_requests SET under_process = FALSE, already_sent = $1 \ | ||
| WHERE decryption_id = $2", |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SQL update statement now sets already_sent alongside under_process = FALSE. This logic seems counterintuitive: when marking an event as pending (not under process), we're setting already_sent which could be either true or false. If already_sent = true, it suggests the request was sent but is now being marked as pending again, potentially for retry. Consider adding a comment explaining this behavior, as the relationship between 'pending' and 'already_sent' is not immediately clear.
171071f to
0a97cad
Compare
|
Replaced by #1241 |
Closes https://github.com/zama-ai/fhevm-internal/issues/534