platform icon indicating copy to clipboard operation
platform copied to clipboard

feat(dashmate): single node local network [WIP]

Open shumkov opened this issue 1 year ago • 1 comments

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

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

    • Added support for overriding LLMQ parameters in SDK and client configuration options.
    • Introduced gRPC client and server interfaces for retrieving blockchain proofs.
  • Enhancements

    • Updated default network settings and streamlined seed configuration for local environments.
    • Reduced minimum masternode count for local setups from 3 to 1.
    • Improved local network configuration with new quorum and genesis parameters.
    • Increased default client timeout for better reliability.
    • Enhanced quorum management with more granular task handling.
    • Reduced wait time for core peer connections to improve responsiveness.
  • Dependency Updates

    • Updated @dashevo/dashcore-lib dependency across all packages to version 0.25.0 for improved consistency.
  • Bug Fixes

    • Prevented errors when environment variables for seeds are undefined in tests and functional code.
  • Chores

    • Updated Docker image tags and environment variable handling in scripts and configuration files.
    • Commented out or removed unused DAPI_SEED environment variables in example and configuration files.
    • Adjusted local network setup scripts to use a single masternode by default.

shumkov avatar Dec 16 '24 14:12 shumkov

"""

Walkthrough

This set of changes updates the Dash Platform monorepo to support single-node local networks, introduces more granular quorum configuration, and upgrades the @dashevo/dashcore-lib dependency version from ~0.22.0 to ~0.25.0 across all affected packages and the .pnp.cjs file. It modifies Docker image versions, configuration factories, environment variables, and setup scripts to reflect the new single-node paradigm. The update also adds gRPC client/server Rust code for the DriveInternal service, introduces LLMQ parameter overrides, and comments out or removes the DAPI_SEED variable in environment files and scripts. Test files and logic are adjusted to accommodate these configuration changes.

Changes

Files/Paths Change Summary
.pnp.cjs, all package.json files referencing @dashevo/dashcore-lib (e.g., packages/bench-suite/package.json, packages/dapi/package.json, packages/dash-spv/package.json, packages/dashmate/package.json, packages/js-dapi-client/package.json, packages/js-dash-sdk/package.json, packages/platform-test-suite/package.json, packages/wallet-lib/package.json, packages/wasm-dpp/package.json) Updated dependency version of @dashevo/dashcore-lib from ~0.22.0 to ~0.25.0.
packages/dashmate/configs/defaults/getBaseConfigFactory.js, packages/dashmate/configs/defaults/getLocalConfigFactory.js, packages/dashmate/configs/getConfigFileMigrationsFactory.js Updated Docker image versions, quorum activeSigners, genesis consensus parameters, and added/modified configuration migrations.
packages/dashmate/src/commands/setup.js, packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js, scripts/setup_local_network.sh Reduced minimum node/masternode count from 3 to 1 in setup validation and scripts.
packages/dashmate/src/createDIContainer.js, packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js, packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js, packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js Refactored quorum task factories: split into single and multi quorum tasks, updated quorum activation logic and collateral calculation, and introduced a new single quorum task factory.
packages/dashmate/src/core/waitForCorePeersConnected.js Reduced peer connection retry interval from 10 seconds to 1 second.
Dockerfile Added TENDERDASH_COMMITISH environment variable in build stages for drive-abci.
packages/dapi-grpc/src/drive/client/org.dash.platform.drive.v0.rs, packages/dapi-grpc/src/drive/server/org.dash.platform.drive.v0.rs Added Rust gRPC client and server code for the DriveInternal service, including protobuf message types and service implementations.
packages/js-dapi-client/lib/DAPIClient.js, packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js, packages/js-dapi-client/lib/networkConfigs.js, packages/js-dash-sdk/src/SDK/Client/Client.ts Added support for llmqParamsOverride option, increased default timeout, changed local network config to use seeds and LLMQ overrides.
packages/js-dapi-client/test/unit/DAPIClient.spec.js Updated test to expect SimplifiedMasternodeListDAPIAddressProvider instead of ListDAPIAddressProvider.
packages/js-dash-sdk/tests/functional/sdk.js, packages/wallet-lib/tests/functional/wallet.spec.js, packages/platform-test-suite/lib/test/getDAPISeeds.js Added checks to verify DAPI_SEED is defined and a string before splitting, preventing runtime errors.
packages/platform-test-suite/.env.example, packages/js-dash-sdk/.env.example, packages/wallet-lib/.env.example Commented out DAPI_SEED environment variable declarations.
scripts/configure_dotenv.sh, scripts/configure_test_suite.sh Removed DAPI_SEED from environment variable setup and changed NETWORK value from regtest to local.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SetupScript
    participant Dashmate
    participant ConfigFactory
    participant QuorumTaskFactory

    User->>SetupScript: Run local setup
    SetupScript->>Dashmate: Start setup with nodeCount=1
    Dashmate->>ConfigFactory: Generate base and local config
    ConfigFactory->>Dashmate: Return config (single node, LLMQ overrides)
    Dashmate->>QuorumTaskFactory: Enable single core quorum
    QuorumTaskFactory->>Dashmate: Wait for quorum (single node logic)
    Dashmate->>User: Setup complete

Possibly related PRs

  • dashpay/platform#2236: Updates the same @dashevo/dashcore-lib dependency but from 0.21.3 to 0.22.0, related by dependency version upgrade across packages.

  • dashpay/platform#2206: Modifies configuration migrations in getConfigFileMigrationsFactory.js, related to consensus parameters and genesis structures, complementing migration changes in this PR.

Suggested labels

dashmate

Suggested reviewers

  • QuantumExplorer
  • pshenmic

Poem

A single node hops in the field,
No quorum crowd, just one to wield.
Configs updated, seeds now gone,
Dashcore points to GitHub’s dawn.
LLMQ params, we override,
Rusty proofs now gRPC-ified.
With scripts and settings, neat and small—
The Dashy rabbit’s ready for all! 🐇✨ """


📜 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 1228cf7c35a135fcecb650f1736f0db8d63c5d28 and d362cb5626e4f1065e17cd55f536b08f77c4161c.

📒 Files selected for processing (8)
  • Dockerfile (2 hunks)
  • packages/bench-suite/package.json (1 hunks)
  • packages/dapi/package.json (1 hunks)
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js (1 hunks)
  • packages/dashmate/package.json (1 hunks)
  • packages/js-dapi-client/package.json (1 hunks)
  • packages/js-dash-sdk/package.json (1 hunks)
  • packages/platform-test-suite/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/js-dash-sdk/package.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/platform-test-suite/package.json
  • packages/js-dapi-client/package.json
  • Dockerfile
  • packages/dashmate/package.json
  • packages/dapi/package.json
  • packages/bench-suite/package.json
  • packages/dashmate/configs/getConfigFileMigrationsFactory.js
⏰ Context from checks skipped due to timeout of 90000ms (18)
  • GitHub Check: Rust packages (rs-dapi-client) / Formatting
  • GitHub Check: Rust packages (rs-dapi-client) / Linting
  • GitHub Check: Rust packages (rs-dapi-client) / Tests
  • GitHub Check: Rust packages (dash-sdk) / Formatting
  • GitHub Check: Rust packages (dapi-grpc) / Tests
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Check each feature
  • GitHub Check: Rust packages (dash-sdk) / Tests
  • GitHub Check: Rust packages (dash-sdk) / Unused dependencies
  • GitHub Check: Rust packages (dapi-grpc) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / Linting
  • GitHub Check: Rust packages (dapi-grpc) / Linting
  • GitHub Check: Rust packages (wasm-dpp) / Tests
  • GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • 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 JS packages / Build JS
✨ 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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

coderabbitai[bot] avatar Dec 16 '24 14:12 coderabbitai[bot]