Skip to content

Conversation

@GabrielePicco
Copy link
Contributor

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:

  • Replaced dynamic HashMap-based QueueAccount with a fixed-size Queue structure, adding constraints for maximum items, arguments, and accounts. Introduced helper methods for item addition, removal, iteration, and lookup.
  • Added validation for queue index bounds in process_delegate_oracle_queue to ensure security.

Serialization and Deserialization Improvements:

  • Use bytemuck for Queue serialization/deserialization

Error Handling Enhancements:

  • Expanded EphemeralVrfError enum with detailed error variants, such as QueueFull, InvalidQueueIndex, and OracleNotAuthorized, to improve error reporting.

Dependency Updates:

  • Updated curve25519-dalek to disable default features and incremented steel to version 4.0.2. Added base64 as a new dependency. [1] [2] [3]

New Utility Functions:

  • Added is_empty_or_zeroed function to check if an account is empty or zeroed, improving account initialization checks.
  • Enhanced initialize_oracle_queue to return a vector of instructions for chunked initialization, accommodating large queue sizes.

@GabrielePicco GabrielePicco requested a review from Copilot July 18, 2025 12:30
Copy link
Contributor

Copilot AI left a 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 HashMap to 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

GabrielePicco and others added 3 commits July 18, 2025 14:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@GabrielePicco GabrielePicco merged commit 3b9a947 into main Jul 18, 2025
3 checks passed
@GabrielePicco GabrielePicco deleted the feat/zero-copy-queue branch July 18, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants