Skip to content

fix(drive-abci): update_quorum_info is_init_chain / start_from_scratch not working #2521

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

Open
wants to merge 2 commits into
base: v2.0-dev
Choose a base branch
from

Conversation

lklimek
Copy link
Contributor

@lklimek lklimek commented Mar 31, 2025

Issue being fixed or feature implemented

We need a way to rebuild cached information about Dash Core.
There is a function update_core_info() which should do the job.

It also has a parameter is_init_chain, that should rebuild everything from scratch, but it doesn't work as expected.

What was done?

  1. Renamed is_init_chain to start_from_scratch
  2. Added/fixed checks using start_from_scratch

How Has This Been Tested?

GHA + used in statesync testing

Breaking Changes

Minor semantic change of is_init_chain which should have no impact on existing code. Considering it non-breaking.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Refactor
    • Enhanced clarity and consistency in update processes by refining parameter naming and corresponding documentation.
    • These improvements do not affect overall functionality or end-user behavior.

@lklimek lklimek added this to the v2.0.0 milestone Mar 31, 2025
Copy link
Contributor

coderabbitai bot commented Mar 31, 2025

Walkthrough

The changes rename the boolean parameter in several functions from is_init_chain to start_from_scratch across different modules. This involves updating the function signatures, inline documentation, and internal condition checks to reflect the new naming while keeping the underlying logic unchanged.

Changes

File(s) Change Summary
packages/rs-drive-abci/.../update_core_info/mod.rs
packages/rs-drive-abci/.../update_core_info/v0/mod.rs
Renamed parameter is_init_chain to start_from_scratch in the update_core_info functions, updating comments and conditional checks accordingly.
packages/rs-drive-abci/.../update_masternode_list/mod.rs
packages/rs-drive-abci/.../update_masternode_list/v0/mod.rs
Renamed parameter is_init_chain to start_from_scratch in the update_masternode_list functions and adjusted conditionals to reflect the new parameter name without altering core functionality.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant UpdateMN as update_masternode_list_v0
    Note over UpdateMN: Evaluate start_from_scratch flag and core height check
    Caller->>UpdateMN: Call update_masternode_list_v0(start_from_scratch, core_block_height, ...)
    alt Condition: Not starting from scratch & height matches
        UpdateMN-->>Caller: Log debug and early return
    else Continue update
        UpdateMN->>UpdateMN: Update masternode list and quorum info
        UpdateMN-->>Caller: Return result
    end
Loading

Suggested reviewers

  • QuantumExplorer

Poem

I'm just a rabbit in this code burrow,
Hopping through lines with a joyful glow,
Renamed my steps from old to new,
"Start from scratch" now guides the crew,
In digital meadows, our code will grow!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d25e226 and 7d4296e.

📒 Files selected for processing (4)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/mod.rs (3 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs (4 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/mod.rs (2 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (7)
packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/mod.rs (1)

28-28: LGTM: Parameter renaming improves clarity

The renaming from is_init_chain to start_from_scratch provides a clearer semantic meaning of the parameter's purpose, making the code more self-documenting. This change consistently applies to the function signature, function call, and documentation.

Also applies to: 42-42, 57-57

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs (2)

26-26: LGTM: Parameter renaming with proper conditional logic update

The parameter renaming from is_init_chain to start_from_scratch is consistently applied to the documentation and function signature. The conditional logic is correctly updated to use the new parameter name.

Also applies to: 41-41, 47-48


57-57: LGTM: Consistent parameter renaming in function calls

The parameter renaming is consistently propagated to the function calls to update_masternode_list and update_quorum_info.

Also applies to: 67-67

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/mod.rs (1)

43-43: LGTM: Consistent parameter renaming

The parameter renaming from is_init_chain to start_from_scratch is consistently applied in the function signature and function call.

Also applies to: 58-58

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs (3)

39-39: LGTM: Consistent parameter renaming in function signature

The parameter renaming from is_init_chain to start_from_scratch is consistently applied in the function signature.


47-49: LGTM: Improved conditional logic with renamed parameter

The conditional logic now explicitly checks if we're not starting from scratch (!start_from_scratch) before comparing core heights. This makes the logic more clear and ensures the function behaves as expected when rebuilding from scratch.


71-71: LGTM: Consistent parameter renaming in function call

The parameter renaming is consistently propagated to the function call to update_state_masternode_list_v0.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lklimek lklimek self-assigned this May 7, 2025
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.

1 participant