-
Notifications
You must be signed in to change notification settings - Fork 17
feat: optimize sync #119
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
Merged
Merged
feat: optimize sync #119
Conversation
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
977b402 to
f957ba0
Compare
c877c6c to
e450e8e
Compare
bhflm
reviewed
Dec 1, 2025
bhflm
previously approved these changes
Dec 1, 2025
bhflm
approved these changes
Dec 1, 2025
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.
This pull request introduces several significant improvements to the processing and validation of Merkle trees and event handling, focusing on performance, reliability, and maintainability. The most important changes include the introduction of a larger batch size for commitment processing, improved concurrency control for write queue processing, enhanced error handling with retry logic, and optimizations for event mapping and batching. Additionally, configuration and type updates have been made to support these changes.
Merkletree Processing and Validation Improvements:
CommitmentProcessingGroupSize.XXXXLarge(10,000) option to allow for larger batch processing, improving performance for large-scale updates (src/models/merkletree-types.ts,src/merkletree/txid-merkletree.ts,src/merkletree/utxo-merkletree.ts) [1] [2] [3].processingWriteQueueLock) instead of a boolean flag, ensuring safe, sequential processing and preventing race conditions (src/merkletree/merkletree.ts) [1] [2] [3].insertLeavesand related methods, enabling faster bulk imports or trusted syncs when desired (src/merkletree/merkletree.ts,src/railgun-engine.ts) [1] [2] [3] [4] [5] [6] [7] [8].Event Handling and Batching Enhancements:
V2Eventsto use synchronous mapping and batch event passing, reducing unnecessary async operations and improving efficiency (src/contracts/railgun-smart-wallet/V2/V2-events.ts) [1] [2] [3] [4].TXIDMerkletreeto ensure that leaves for the same tree are grouped and queued together, reducing the number of write operations (src/merkletree/txid-merkletree.ts) [1] [2] [3].Error Handling and Retry Logic:
updateTreesFromWriteQueueto implement retry logic with a delay, improving robustness against transient failures during batch processing (src/merkletree/merkletree.ts).Configuration and Type Updates:
package.jsonto specify the Yarn version for package management, ensuring consistent dependency resolution (package.json).src/merkletree/merkletree.ts).These changes collectively improve the scalability, reliability, and maintainability of Merkle tree operations and event processing in the codebase.