Skip to content
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

Sync state subscription #244

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Commits on Oct 13, 2023

  1. Add sync state change notifications in consensus process

    This update adds notifications for sync state changes in the consensus process. These changes were necessary to keep track of the block syncing progress. `ConsensusServices` was modified to include the notification root, and the `syncStateChangedRequest` and `syncStateChangedNotification` RPC calls were added to allow remote retrieval of sync state. Minor syntactical improvements were also made to adhere to best coding practices.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    cabbf26 View commit details
    Browse the repository at this point in the history
  2. "Add IBD progress reporting to notification system"

    This commit introduces the ability to report the progress of Initial Block Download (IBD) to the notification system. This feature was added to the `ProgressReporter` struct in the `progress.rs` file, where a callback function was incorporated to handle the reporting. The callback function is invoked during batch processing and completion reporting in the IBD. Furthermore, new changes were made for the `SyncStateChangedNotification`, adding a variant for header progress reporting. Consequently, this needed adjustment also in proto files for proper message handling. This improves the communication and interaction with the wallet; hence enhancing user experience by keeping them updated on the IBD progress.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    76910de View commit details
    Browse the repository at this point in the history
  3. Add sync state Blocks for block synchronization

    The extra sync state, "Blocks", has been added for the purpose of block synchronization. The changes include adding the fields `blocks` and `progress` to the `BlocksState` message in the `rpc.proto` file, as well as corresponding implementations across the codebase. This allows the synchronization state to be accurately monitored and predicted, which can help improve the performance and stability of the system. These changes are expected to improve the system's understanding of state changes during block synchronization and alter respective notifications.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    717ad0f View commit details
    Browse the repository at this point in the history
  4. Add UTXO resync notification feature

    Implemented the UTXO resync notification feature in the UTXO Index, notifying the user when the UTXO index starts resyncing. This is done by adding a new UtxoResyncState in the SyncStateChangedNotification enum and notifying the user when the resync event occurs. Dependencies were updated in Cargo.toml and the notification was integrated into the GRPC layer.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    869f2ec View commit details
    Browse the repository at this point in the history
  5. Add UtxoSync to SyncStateChangedNotification

    Implemented UtxoSync mechanism in the SyncStateChangedNotification. It is designed to provide more detailed information about sync state by additionally conveying the number of chunks and total progress in its structure. This enhances the UTXO synchronization process by allowing users to track the status of synced chunks, significantly improving process visibility and debuggability.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    5cf40d6 View commit details
    Browse the repository at this point in the history
  6. Add TrustSync state to SyncStateChangedNotification

    Added a new state called TrustSync to the SyncStateChangedNotification enum to share information about the processing of trusted blocks. The addition of TrustSync allows the program to notify about the number of trusted blocks processed in the last one second and the total number of such blocks processed till now. This is essential for improving the supervision of the synchronization process.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    5663b00 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    01019f0 View commit details
    Browse the repository at this point in the history
  8. Refactor notification_root usage in ibd/flow.rs

    This commit removes a redundant `take().unwrap()` of the `notification_root` field and the subsequent reassignment of it. Now the field is directly accessed via `as_ref().unwrap()`. This change removes unnecessary operations, and might slightly improve performance.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    4bd6210 View commit details
    Browse the repository at this point in the history
  9. "Add Synced state to SyncStateChangedNotification"

    Added a new "Synced" state to the `SyncStateChangedNotification` enum, which gives more precise control over sync state notifications. This was reflected across RPC and consensus notify modules, including additions to GRPC proto definitions and corresponding conversion functions. This change enables better tracking and handling of the sync completed state.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    8f5523d View commit details
    Browse the repository at this point in the history
  10. Refactor DAA parameters into dedicated struct

    Modified the consensus parameters to group Difficulty Adjustment Algorithm (DAA) parameters into their dedicated struct. The changes affect how these parameters are retrieved and set across the mining, testing and consensus codebase. Structured DAA parameters within their own entity enhances code readability and manageability.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    6779125 View commit details
    Browse the repository at this point in the history
  11. Refactor sync state initialisation and value capture

     remove the use of set method to assign consensus_manager in integration_tests.rs
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    7eb1abf View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    0431b0e View commit details
    Browse the repository at this point in the history
  13. Remove unused SYNC_STATE import from integration tests

    The SYNC_STATE import was removed from the integration_tests.rs file because it was unused. This was probably a leftover from some previously refactored code, and its presence might have led to confusion, hence it has been removed.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    f01fc2b View commit details
    Browse the repository at this point in the history
  14. Add SyncStateChanged to GRPC core

    Added SyncStateChanged handling in various files including kaspad.rs, message.rs and notification.rs in the GRPC core, which allows the system to notify and handle changes in the sync state.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    82bce93 View commit details
    Browse the repository at this point in the history
  15. Add SyncStateChangedNotification to RpcApiOps

    The commit includes `SyncStateChangedNotification` into `RpcApiOps` array in
    the `client.rs` file. This will allow further operations to incorporate the
    latest sync state changes effectively.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    1fe5bd8 View commit details
    Browse the repository at this point in the history
  16. Fix incorrect function call for SerdeJson encoding

    This change corrects the function call made for the SerdeJson encoding in the connection.rs file. Previously, it was mistakenly referencing the Borsh encoding function instead of the appropriate SerdeJson one.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    05adc29 View commit details
    Browse the repository at this point in the history
  17. Fix regex pattern for block headers in IBD

    A typo in the regex pattern for processing block headers during Initial Block Download(IBD) resulted in incorrect matches. This commit fixes the regex by removing the extra square brackets.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    420a046 View commit details
    Browse the repository at this point in the history
  18. "Remove unused sync_state.rs file and refactor consensus"

    The sync_state.rs file in the consensus/src directory has been removed as it is no longer needed. All references to SYNC_STATE which was previously declared in this file have been replaced with suitable alternatives. This was done to streamline the consensus and avoid unnecessary complexities.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    0af3950 View commit details
    Browse the repository at this point in the history
  19. "Refactor DAA sync condition for readability"

    Refactored the sync condition calculation in both pruning_proof/mod.rs and virtual_processor/processor.rs by moving the logic to the daa_window_params.is_nearly_synced method. This eliminates redundant code and enhances readability
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    9d7d602 View commit details
    Browse the repository at this point in the history
  20. Refactor sink handling in processor.rs

    The sink processing was streamlined to eliminate an unnecessary step. The compact header data is now directly retrieved from the headers_store using a new_sink variable. This change simplifies the codebase and may potentially enhance the performance of headers_store data retrieval.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    8787288 View commit details
    Browse the repository at this point in the history
  21. Refactor checking state sync in pruning_proof

    Improve handling of 'is_nearly_synced' state in processor.rs, adding a guard not to send 'SyncStateChangedNotification' continuously. Now 'SyncStateChangedNotification' is sent only when the state changes.
    
    The state 'is_nearly_synced' is now calculated outside of the if block to handle cases when getting 'ghostdag_data.selected_parent' might fail. 'previous_synced' flag was added to 'VirtualStateProcessor' structure to store previous state and send notification only when the state changes. This reduces redundant notifications, improving the performance.
    
    In 'pruning_proof', we now use a safe get by 'is_ok_and' method and inside use a lambda to calculate 'is_synced'. This change makes it easier to understand the code and handle the state correctly.
    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    4053ddd View commit details
    Browse the repository at this point in the history
  22. fixes after rebase

    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    c8a045e View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    80eb07e View commit details
    Browse the repository at this point in the history
  24. fix comma after rebase

    biryukovmaxim committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    1961717 View commit details
    Browse the repository at this point in the history