fix(drive-abci): update_quorum_info is_init_chain / start_from_scratch not working
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?
- Renamed
is_init_chaintostart_from_scratch - 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:
- [x] 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
- [x] 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.
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.rspackages/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.rspackages/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
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 d25e226da5b460a01ecb8389551a4a06f426fa50 and 7d4296eed52e4316f445cbc62cf16b731def32a0.
📒 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 clarityThe renaming from
is_init_chaintostart_from_scratchprovides 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 updateThe parameter renaming from
is_init_chaintostart_from_scratchis 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 callsThe parameter renaming is consistently propagated to the function calls to
update_masternode_listandupdate_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 renamingThe parameter renaming from
is_init_chaintostart_from_scratchis 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 signatureThe parameter renaming from
is_init_chaintostart_from_scratchis consistently applied in the function signature.
47-49: LGTM: Improved conditional logic with renamed parameterThe 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 callThe 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.
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.