-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: Implement a zero copy requests queue #5
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
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 pull request implements a zero-copy requests queue system to enhance performance and efficiency. The key change replaces the dynamic HashMap-based QueueAccount with a fixed-size Queue structure using zero-copy serialization for improved performance and memory efficiency.
Key changes include:
- Complete refactoring of queue data structure from dynamic
HashMapto fixed-size array with bitmap tracking - Enhanced VRF cryptographic security with proper domain separation and HKDF nonce generation
- Improved error handling with expanded error variants for better debugging
Reviewed Changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| api/src/state/queue.rs | Complete rewrite implementing zero-copy Queue with fixed-size arrays and bitmap tracking |
| vrf/src/vrf.rs | Enhanced VRF security with HKDF nonce generation and proper domain separation |
| program/src/request_randomness.rs | Updated to use new Queue structure and added cost transfer mechanism |
| program/src/provide_randomness.rs | Refactored for new Queue API and added fee collection |
| program/src/initialize_oracle_queue.rs | Enhanced with chunked initialization support for large queues |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces significant changes to enhance the functionality, efficiency, and maintainability of the codebase. Key updates include improvements to queue management, serialization/deserialization, and error handling, along with dependency updates and new utility functions.
Queue Management Enhancements:
HashMap-basedQueueAccountwith a fixed-sizeQueuestructure, adding constraints for maximum items, arguments, and accounts. Introduced helper methods for item addition, removal, iteration, and lookup.process_delegate_oracle_queueto ensure security.Serialization and Deserialization Improvements:
Error Handling Enhancements:
EphemeralVrfErrorenum with detailed error variants, such asQueueFull,InvalidQueueIndex, andOracleNotAuthorized, to improve error reporting.Dependency Updates:
curve25519-dalekto disable default features and incrementedsteelto version4.0.2. Addedbase64as a new dependency. [1] [2] [3]New Utility Functions:
is_empty_or_zeroedfunction to check if an account is empty or zeroed, improving account initialization checks.initialize_oracle_queueto return a vector of instructions for chunked initialization, accommodating large queue sizes.