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

chore(dashmate): update Core to version 22 #2107

Merged
merged 20 commits into from
Nov 22, 2024

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Sep 4, 2024

Issue being fixed or feature implemented

Update Platform to Core 22

What was done?

  • Updated Core to v22.0.0-rc.1
  • Added config migration
  • Fixed status command
  • Fixed the local network setup

How Has This Been Tested?

None

Breaking Changes

None

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

  • New Features

    • Introduced a new migration function for version 1.6.0 to update Docker image configurations.
    • Added a "Create wallet" task and a task for generating collateral funds for masternodes.
    • Updated activation tasks for DIP3 and V21 fork with new parameters.
  • Improvements

    • Simplified platform activation status reporting.
    • Enhanced error handling for Docker status checks.
  • Bug Fixes

    • Updated Docker image version to dashpay/dashd:22.0.0-rc.1.

@shumkov shumkov added this to the v1.3.0 milestone Sep 4, 2024
@shumkov shumkov self-assigned this Sep 5, 2024
@shumkov shumkov added the dashmate Dashmate related label Sep 5, 2024
@QuantumExplorer
Copy link
Member

Do not merge this!

@shumkov
Copy link
Member Author

shumkov commented Sep 16, 2024

@QuantumExplorer what about now?

@QuantumExplorer
Copy link
Member

Let's make this for 1.4 only please.

@bezibalazs bezibalazs modified the milestones: v1.3.0, v1.4.0 Sep 17, 2024
@shumkov shumkov changed the base branch from v1.3-dev to v1.4-dev September 20, 2024 16:18
@QuantumExplorer
Copy link
Member

We can't really merge this into production.

@QuantumExplorer QuantumExplorer modified the milestones: v1.4.0, v1.5.0 Sep 26, 2024
@shumkov
Copy link
Member Author

shumkov commented Sep 27, 2024

dashpay/dash#6247

@shumkov shumkov changed the base branch from v1.4-dev to v1.5-dev October 29, 2024 05:37
@shumkov shumkov changed the title chore(dashmate): update Core to 21.2 nightly chore(dashmate): update Core to 22 nightly Oct 29, 2024
shumkov

This comment was marked as resolved.

Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

Walkthrough

The changes in this pull request involve modifications across several files, primarily focusing on updating migration functions, altering task sequences, and refining error handling. A new migration function for version 1.6.0 is added to update Docker images, while the task factory for configuring core tasks sees the removal and addition of several tasks to streamline the process. Additionally, the reporting of platform activation status is simplified, and error handling is improved in the relevant functions. Overall, these changes enhance the configuration and operational flow of the application.

Changes

File Path Change Summary
packages/dashmate/configs/getConfigFileMigrationsFactory.js - Introduced migration function for version 1.6.0 to update Docker image.
packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js - Removed task for activating DIP3.
- Added tasks for "Create wallet" and generating funds for masternodes.
- Updated DIP3 activation height to 901 and V21 fork activation height to 1001.
packages/dashmate/src/status/scopes/platform.js - Modified getPlatformScopeFactory to report activation height instead of time difference.
- Refined error handling in getDriveInfo for ContainerIsNotPresentError.
packages/dashmate/configs/defaults/getBaseConfigFactory.js - Updated Docker image version from dashpay/dashd:21 to dashpay/dashd:22.0.0-rc.1.

Possibly related PRs

Suggested reviewers

  • QuantumExplorer
  • pshenmic

🐰 In the meadow, changes bloom,
New tasks and migrations make room.
Docker images, fresh and bright,
Configs updated, all feels right.
With clearer paths and errors tamed,
Our code's a garden, well-named! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 58bfec2 and e165edc.

📒 Files selected for processing (1)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 resolve resolve all the CodeRabbit review comments.
  • @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.

@shumkov shumkov changed the base branch from v1.5-dev to v1.6-dev November 1, 2024 01:53
@shumkov shumkov changed the title chore(dashmate): update Core to 22 nightly chore(dashmate): update Core to 22 nightly [WIP] Nov 1, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (3)
packages/dashmate/configs/defaults/getTestnetConfigFactory.js (1)

27-29: Consider environment-specific image versioning

Given the concerns about production readiness in the PR comments, consider implementing environment-specific image versioning. This would allow for different versions in development/testing vs. production environments.

Example approach:

docker: {
  image: process.env.DASH_CORE_IMAGE || 'dashpay/dashd:22.0.0-devpr6375.dde1edf3',
},
packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (2)

Line range hint 126-138: Rename variable 'dip3ActivationHeight' for clarity

The variable dip3ActivationHeight is used to activate both v19 and v20 forks at height 901. To improve code readability and reflect its broader purpose, consider renaming it to activationHeight or v19v20ActivationHeight.

Apply this diff to rename the variable:

- const dip3ActivationHeight = 901;
+ const activationHeight = 901;
  const blocksToGenerateInOneStep = 10;

  let blocksGenerated = 0;
  let {
    result: currentBlockHeight,
  } = await ctx.coreService.getRpcClient().getBlockCount();

  do {
    ({
      result: currentBlockHeight,
    } = await ctx.coreService.getRpcClient().getBlockCount());

    await generateBlocks(
      ctx.coreService,
      blocksToGenerateInOneStep,
      NETWORK_LOCAL,
      // eslint-disable-next-line no-loop-func
      (blocks) => {
        blocksGenerated += blocks;

        observer.next(`${blocksGenerated} blocks generated`);
      },
    );
- } while (dip3ActivationHeight > currentBlockHeight);
+ } while (activationHeight > currentBlockHeight);

Line range hint 312-338: Ensure consistent variable naming for activation heights

In the 'Activating v21 fork' task, the variable dip3ActivationHeight is set to 1001. For consistency and clarity, rename it to activationHeight or specify it as v21ActivationHeight.

Apply this diff to update the variable name:

- const dip3ActivationHeight = 1001;
+ const activationHeight = 1001;
  const blocksToGenerateInOneStep = 10;

  let {
    result: currentBlockHeight,
  } = await ctx.coreService.getRpcClient().getBlockCount();

  do {
    ({
      result: currentBlockHeight,
    } = await ctx.coreService.getRpcClient().getBlockCount());

    await generateBlocks(
      ctx.coreService,
      blocksToGenerateInOneStep,
      NETWORK_LOCAL,
      // eslint-disable-next-line no-loop-func
      (blocks) => {
        blocksGenerated += blocks;

        observer.next(`${blocksGenerated} blocks generated`);
      },
    );
- } while (dip3ActivationHeight > currentBlockHeight);
+ } while (activationHeight > currentBlockHeight);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between feacde2 and 978929a.

⛔ Files ignored due to path filters (1)
  • packages/dashmate/templates/core/dash.conf.dot is excluded by !**/*.dot
📒 Files selected for processing (5)
  • packages/dashmate/configs/defaults/getLocalConfigFactory.js (1 hunks)
  • packages/dashmate/configs/defaults/getTestnetConfigFactory.js (1 hunks)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js (2 hunks)
  • packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (3 hunks)
  • packages/dashmate/src/status/scopes/platform.js (1 hunks)
🔇 Additional comments (10)
packages/dashmate/configs/defaults/getLocalConfigFactory.js (2)

Line range hint 1-143: Verify configuration compatibility with Core v22

The configuration structure looks correct, but we should ensure all options are compatible with Core v22, especially around platform and drive settings.

Let's check for any v22-specific configuration changes:

#!/bin/bash
# Description: Look for Core v22 specific configuration requirements
# Expected: Find documentation or migration files related to v22 config changes

# Search for v22 related configuration changes in docs
fd -t f "README|CHANGELOG|UPGRADE" -X grep -l "v22"

# Look for migration scripts handling v22 changes
fd -t f "migration" -X grep -l "22\.0\.0"

Consider adding version-specific configuration validation to prevent misconfigurations when switching between Core versions.


27-29: ⚠️ Potential issue

Review Docker image version choice

The specified Docker image dashpay/dashd:22.0.0-devpr6375.dde1edf3 appears to be from a development PR build rather than an official release. This raises several concerns:

  1. Development PR builds may be unstable or contain unfinished features
  2. The image might be temporary and could be removed after PR completion
  3. This aligns with the WIP status but requires caution for production use

Let's verify the image availability and details:

Consider the following recommendations:

  1. For production environments, use stable release tags instead of PR-specific builds
  2. Document the temporary nature of this image in comments
  3. Add a TODO to update to an official v22 release once available

Would you like me to propose a safer version configuration approach?

✅ Verification successful

Development PR Docker image used consistently across non-production networks

The Docker image dashpay/dashd:22.0.0-devpr6375.dde1edf3 is consistently used across local, testnet, and devnet configurations, which is appropriate for a work-in-progress v22 upgrade:

  • The image is referenced in migration logic specifically for non-production networks
  • It's properly excluded from mainnet configurations
  • The README acknowledges v22 as a major version upgrade requiring data reset

This implementation aligns with the PR's WIP status for testing v22 nightlies on development environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Docker image existence and get additional details
# Expected: Image should exist in Docker Hub and match PR context

# Check if the image exists in Docker Hub
curl -s "https://hub.docker.com/v2/repositories/dashpay/dashd/tags/?name=22.0.0-devpr6375.dde1edf3"

# Search for any references to this specific version in the codebase
rg "22\.0\.0-devpr6375\.dde1edf3"

Length of output: 608


Script:

#!/bin/bash
# Let's check the README and migration files for context about v22 upgrade
cat packages/dashmate/README.md | grep -A 5 -B 5 "v22\|22\.0"

# Check migration logic for this version
cat packages/dashmate/configs/getConfigFileMigrationsFactory.js | grep -A 10 -B 10 "22\.0\.0-devpr6375"

# Look for any stable v22 references
rg "dashpay/dashd:22\.0\.[0-9]+" --no-filename

Length of output: 1461

packages/dashmate/configs/defaults/getTestnetConfigFactory.js (2)

Line range hint 1-150: Verify configuration compatibility with Core v22

The configuration structure needs verification against Core v22 requirements, especially around platform and tenderdash settings.

Let's check for any v22-specific configuration changes:

#!/bin/bash
# Description: Look for other v22-related configuration changes
# Expected: Find any migration scripts or documentation about v22 requirements

# Search for version-related changes in config and migration files
rg -t js "v22|version 22|22\.0\.0" ./packages/dashmate/

27-29: ⚠️ Potential issue

Version mismatch with PR objectives needs clarification

The docker image version dashpay/dashd:22.0.0-devpr6375.dde1edf3 doesn't match the version mentioned in the PR objectives (v22.0.0-nightly.2024.10.29). This discrepancy needs to be addressed.

Let's verify if this version exists and is the intended one:

packages/dashmate/src/status/scopes/platform.js (3)

Line range hint 242-307: LGTM: Well-structured error handling in getDriveInfo.

The error handling is well-designed with:

  • Specific handling for container absence
  • Proper error propagation
  • Granular try-catch blocks for different operations

Line range hint 19-57: Add version compatibility checks for Core v22.

Given this is a WIP update to Core v22 and there are concerns about production deployment, consider adding explicit version compatibility checks in getCoreInfo.

Let's verify Core v22 RPC interface compatibility:

#!/bin/bash
# Description: Check for potential breaking changes in Core v22 RPC interface
# Expected: No incompatible changes in the RPC methods used

# Search for RPC method definitions and changes
rg -A 5 "mnsync.*status|getBlockchainInfo"

# Search for version-specific handling
rg -A 5 "v22|version.*check"

Consider adding:

  1. Version detection logic
  2. Fallback handling for different Core versions
  3. Clear error messages for version mismatches

315-315: LGTM: Improved platform activation status reporting.

The change from time-based to height-based reporting is a good improvement as it:

  • Provides more precise activation information
  • Removes complexity around time calculations
  • Uses consistent blockchain terminology

Let's verify the activation height reporting matches Core v22's configuration:

✅ Verification successful

Based on the search results, I can see that the platform activation height is consistently used in test files and the implementation. The test files show that the getBlockchainInfo RPC call returns the MN_RR softfork height in the format:

{
  "result": {
    "softforks": {
      "mn_rr": { "active": true, "height": 1337 }
    }
  }
}

Let me verify the actual implementation to ensure the height is correctly retrieved:


Platform activation height reporting is correctly implemented

The code correctly retrieves the MN_RR softfork height from Core's getBlockchainInfo RPC call and uses it in the platform activation status message. The implementation:

  1. Makes the RPC call to get blockchain info
  2. Destructures the response to get mn_rr softfork data
  3. Uses the height value in the status message
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify platform activation height consistency with Core v22
# Expected: The activation height should match Core v22's configuration

# Search for MN_RR activation height in Core v22 configuration
rg -A 2 "mn_rr.*height" 

Length of output: 56612


Script:

#!/bin/bash
# Search for the code that retrieves the MN_RR height from getBlockchainInfo
ast-grep --pattern 'const { result: { softforks: { mn_rr: mnRR } } } = $$$'

Length of output: 429

packages/dashmate/configs/getConfigFileMigrationsFactory.js (2)

7-7: LGTM!

The addition of NETWORK_DEVNET to the imports is consistent with its usage in the migration logic.


1033-1036: Verify the Docker image tag and its availability.

The migration sets a specific development PR build of the Docker image. Please ensure:

  1. The image tag 22.0.0-devpr6375.dde1edf3 is correct and available in the Docker registry
  2. This development build is stable enough for the target networks (local, testnet, devnet)
✅ Verification successful

Docker image dashpay/dashd:22.0.0-devpr6375.dde1edf3 is available and actively maintained

The Docker image exists in the registry and shows healthy indicators:

  • Recently pushed (Oct 31, 2024) and actively pulled (last pull: Nov 6, 2024)
  • Available for multiple architectures (amd64, arm64)
  • All image variants have "active" status
  • Published by the official Dash deployment account (evodeployng)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Docker image exists and check its details
# Test: The image should exist in the Docker registry
curl -s "https://hub.docker.com/v2/repositories/dashpay/dashd/tags/22.0.0-devpr6375.dde1edf3"

Length of output: 1846

packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (1)

95-113: 'Create wallet' task is correctly implemented

The wallet creation parameters align with the expected API, and the implementation is accurate.

@shumkov shumkov changed the title chore(dashmate): update Core to 22 nightly [WIP] chore(dashmate): update Core to 22 Nov 22, 2024
@shumkov shumkov changed the base branch from v1.6-dev-ugly to v1.6-dev November 22, 2024 10:25
@shumkov shumkov changed the title chore(dashmate): update Core to 22 chore(dashmate): update Core to version 22 Nov 22, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 978929a and 58bfec2.

📒 Files selected for processing (3)
  • packages/dashmate/configs/defaults/getBaseConfigFactory.js (1 hunks)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js (2 hunks)
  • packages/dashmate/src/status/scopes/platform.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js
  • packages/dashmate/src/status/scopes/platform.js
🔇 Additional comments (1)
packages/dashmate/configs/defaults/getBaseConfigFactory.js (1)

56-56: Verify compatibility and perform thorough testing

Given that:

  1. This is a major version upgrade
  2. No testing has been performed according to PR description
  3. The change affects the base configuration

Please ensure:

  1. Comprehensive testing of Core v22.0.0-rc.1 compatibility with the Platform
  2. Verification of all dependent services and configurations

Let's verify the image availability and check for any related configuration files that might need updates:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashmate Dashmate related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants