-
Notifications
You must be signed in to change notification settings - Fork 43
feat(dashmate): single node local network [WIP] #2392
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
base: v2.0-dev
Are you sure you want to change the base?
Conversation
""" WalkthroughThis set of changes updates the Dash Platform monorepo to support single-node local networks, introduces more granular quorum configuration, and upgrades the Changes
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
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (7)
⏰ Context from checks skipped due to timeout of 90000ms (18)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🧹 Nitpick comments (10)
.pnp.cjs (1)
2761-2764
: Document the reason for using a specific commit.Since this is a WIP PR for a "single node local network" feature, please document:
- Why this specific commit is required
- Whether this is temporary for testing
- The plan to move back to a stable version before final release
Consider adding a comment in the dependency declaration:
["@dashevo/dashcore-lib", [ ["https://github.com/dashpay/dashcore-lib.git#commit=a61df6ae212647a31b3d58fd78bdf544abc5743a", { + // TODO: Using specific commit for single node network feature testing + // Plan to move back to stable version before final release "packageLocation": "./.yarn/cache/@dashevo-dashcore-lib-https-ae0d28c593-be3f570988.zip/node_modules/@dashevo/dashcore-lib/",scripts/setup_local_network.sh (1)
Line range hint
12-15
: Document the implications of single-node setupThe setup command should include a comment or warning about:
- Limitations of single-node setup
- Intended use cases (e.g., development only)
- Any features that may not work with single node
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js (1)
4-7
: Improve JSDoc documentation.The current documentation is incomplete. Add more details about the function's purpose, parameters, and return value.
/** + * Factory function that creates a task to enable single core quorum + * * @param {generateBlocks} generateBlocks - Function to generate new blocks + * @param {Function} generateBlocks.generateBlocks - Generates specified number of blocks + * @param {Object} generateBlocks.service - Core service to generate blocks on + * @param {number} generateBlocks.count - Number of blocks to generate + * @param {string} generateBlocks.network - Network identifier + * * @return {enableSingleCoreQuorumTask} */packages/js-dapi-client/package.json (1)
31-31
: Fix typo in branch name: "quourm" → "quorum"The branch name contains a typo:
feat/add-quourm-111
should befeat/add-quorum-111
.packages/dashmate/package.json (1)
59-59
: Consider using a stable version instead of a feature branchUsing a Git branch as a dependency source can lead to instability and reproducibility issues:
- The branch content may change unexpectedly
- The branch might be deleted after merging
- There's a typo in the branch name ("quourm" instead of "quorum")
Consider one of these approaches:
- Wait for the feature to be merged and released, then use the stable version
- Use a specific commit hash instead of a branch name
- Fork the repository and use your own stable branch until the feature is released
- "@dashevo/dashcore-lib": "github:dashpay/dashcore-lib#feat/add-quourm-111", + "@dashevo/dashcore-lib": "github:dashpay/dashcore-lib#<commit-hash>",packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js (1)
30-38
: Enhance comments to explain quorum size implicationsWhile the code correctly handles dynamic quorum sizes, the comments could be more descriptive about:
- Why 3 is used as the maximum value
- The implications of having fewer than 3 nodes
- How the quorum behavior might differ with different node counts
Consider expanding the comments:
- // Those are default values for the quorum size 3 with all nodes - // behaving correctly with "llmq_test" quorum + // Maximum quorum size is capped at 3 nodes for "llmq_test" quorum type. + // When fewer nodes are available, the quorum size adjusts automatically: + // - With 3+ nodes: Uses 3 nodes (optimal case) + // - With 2 nodes: Limited functionality quorum + // - With 1 node: Minimal quorum for testingpackages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (1)
152-175
: Review quorum configuration parameters.The quorum configuration has potential issues:
activeSigners
is hardcoded to 2 for all quorum types, which might be insufficient for larger networks- No validation exists to ensure
activeSigners
doesn't exceed the actual node count- Different
llmqType
values (106, 100, 104) are used without documentation explaining their significanceConsider:
- Making
activeSigners
configurable or proportional to node count- Adding validation to ensure
activeSigners
≤ node count- Adding comments explaining the significance of each
llmqType
packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (2)
120-121
: Document the magic number in collateral calculation.The addition of 100 to the collateral amount needs explanation:
- const amount = HPMN_COLLATERAL_AMOUNT * (configGroup.length - 1) + 100; + // Calculate collateral: (nodes - seed node) * HPMN_COLLATERAL_AMOUNT + 100 (for transaction fees) + const TRANSACTION_FEE_BUFFER = 100; + const amount = HPMN_COLLATERAL_AMOUNT * (configGroup.length - 1) + TRANSACTION_FEE_BUFFER;
324-327
: Consider making activation heights configurable.Hardcoded activation heights (901 and 1001) could make testing different scenarios difficult.
Consider:
- Making these values configurable through environment variables or configuration
- Adding comments explaining the significance of these specific heights
- Adding validation to ensure proper sequencing (v19/v20 before v21)
Also applies to: 131-131
packages/dashmate/src/config/configJsonSchema.js (1)
113-113
: Document the new LLMQ type.The addition of LLMQ type
111
looks good and maintains backward compatibility. However, please add documentation to explain:
- The purpose and characteristics of this new LLMQ type
- When it should be used (specifically in single node setups)
- Any specific requirements or limitations
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
.yarn/cache/@dashevo-dashcore-lib-https-ae0d28c593-be3f570988.zip
is excluded by!**/.yarn/**
,!**/*.zip
.yarn/cache/@dashevo-dashcore-lib-npm-0.22.0-9a6dd273b9-ac9e268f6e.zip
is excluded by!**/.yarn/**
,!**/*.zip
.yarn/cache/fsevents-patch-19706e7e35-10.zip
is excluded by!**/.yarn/**
,!**/*.zip
Cargo.lock
is excluded by!**/*.lock
packages/dashmate/templates/core/dash.conf.dot
is excluded by!**/*.dot
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (25)
.pnp.cjs
(10 hunks)packages/bench-suite/package.json
(1 hunks)packages/dapi/package.json
(1 hunks)packages/dash-spv/package.json
(1 hunks)packages/dashmate/configs/defaults/getBaseConfigFactory.js
(2 hunks)packages/dashmate/configs/defaults/getLocalConfigFactory.js
(1 hunks)packages/dashmate/package.json
(1 hunks)packages/dashmate/src/commands/setup.js
(1 hunks)packages/dashmate/src/config/configJsonSchema.js
(1 hunks)packages/dashmate/src/constants.js
(1 hunks)packages/dashmate/src/createDIContainer.js
(2 hunks)packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js
(9 hunks)packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js
(2 hunks)packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
(1 hunks)packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
(2 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)packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json
(1 hunks)packages/rs-drive-abci/Cargo.toml
(1 hunks)packages/rs-sdk/Cargo.toml
(1 hunks)packages/simple-signer/Cargo.toml
(1 hunks)packages/wallet-lib/package.json
(1 hunks)packages/wasm-dpp/package.json
(1 hunks)scripts/setup_local_network.sh
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/rs-sdk/Cargo.toml
🧰 Additional context used
📓 Learnings (1)
packages/rs-drive-abci/Cargo.toml (1)
Learnt from: shumkov
PR: dashpay/platform#2375
File: packages/rs-drive-abci/Cargo.toml:61-63
Timestamp: 2024-12-05T09:29:38.918Z
Learning: In the `drive-abci` package, avoid adding unused dependencies like `hashbrown` to `Cargo.toml`. The team relies on CI to detect dependency version issues.
🔇 Additional comments (22)
.pnp.cjs (1)
2559-2559
: Verify security implications of using a specific git commit.
Switching from a published npm version (0.22.0) to a specific git commit requires careful consideration:
- Security: The commit needs to be verified for security vulnerabilities
- Stability: Moving from a stable version to a specific commit might introduce instability
- Maintenance: Git commits are harder to track for updates compared to semantic versions
Also applies to: 2597-2597, 2642-2642, 2734-2734, 2761-2764, 2947-2947, 3042-3042, 3122-3122, 8487-8487, 8566-8566
✅ Verification successful
Using specific git commit is appropriate for this WIP feature
The commit a61df6ae212647a31b3d58fd78bdf544abc5743a
is:
- From the official
dashpay/dashcore-lib
repository - Made by a core contributor (Ivan Shumkov)
- Specifically adds "single node quorum" feature
- Directly related to the PR's "single node local network" objective
- A recent commit (Dec 18, 2024)
The changes are minimal and focused:
- Adds
LLMQ_SINGLE_NODE
type for testing - Implements single-node quorum parameters
- Updates related configurations
Using this specific commit is justified as it provides the exact functionality needed for the WIP feature.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the git commit and its origin
# Verify the commit exists in the official repository
gh api repos/dashpay/dashcore-lib/commits/a61df6ae212647a31b3d58fd78bdf544abc5743a
# Check if this commit is part of any release tag
gh api repos/dashpay/dashcore-lib/tags --jq '.[] | select(.commit.sha == "a61df6ae212647a31b3d58fd78bdf544abc5743a")'
Length of output: 6402
packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json (1)
8-14
:
Schema structure appears incomplete and lacks validation constraints
The current schema structure seems overly simplified:
- Both
post
andcomment
objects have identical structure - Missing validation constraints that were present in the previous version
- No documentation about the purpose of these properties
This could lead to data integrity issues. Consider:
- Adding proper validation constraints
- Including property descriptions
- Differentiating between post and comment requirements if they serve different purposes
Also applies to: 16-23
packages/simple-signer/Cargo.toml (1)
11-11
: Consider using tagged releases instead of commit hashes
While using a specific commit hash (f14bd9048cbc1767541f25b28db5c9ad1236d0da
) provides exact version control, it can make dependency management more difficult:
- Tagged releases are easier to track and update
- Commit hashes are harder to verify for stability
- May indicate temporary fix that should be properly released
Consider waiting for a stable tagged release of dashcore-rpc
before merging.
scripts/setup_local_network.sh (1)
6-6
: Verify minimum requirements for network functionality
Reducing MASTERNODES_COUNT
to 1 could impact:
- Quorum-based operations
- Network consensus mechanisms
- Testing scenarios that require multiple nodes
Please ensure:
- All network features work with a single masternode
- Test coverage includes single-node scenarios
- Documentation is updated to reflect this change
✅ Verification successful
Based on the search results, I can see that:
- The
MASTERNODES_COUNT
is only used in the local network setup script and passed as--node-count
parameter to dashmate setup command - The dashmate setup command has a minimum requirement check that ensures node count is not less than 1
- There are no explicit quorum or consensus requirements found that would be impacted by single node setup
- The codebase shows consensus-related code but it's mostly about data validation and error handling, not network consensus
Let me generate the final response:
Single node setup is valid for local development
The change to MASTERNODES_COUNT=1
is safe as:
- The dashmate setup command enforces minimum of 1 node
- No explicit quorum requirements found in the codebase
- Local network setup is intended for development purposes
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Look for potential impacts of single node setup
rg -g '!*.{log,lock}' "MASTERNODES_COUNT|node-count"
# Check for quorum-related configurations
rg -g '!*.{log,lock}' "quorum.*minimum|minimum.*quorum"
Length of output: 694
Script:
#!/bin/bash
# Check for quorum or consensus related code
rg -g '!*.{log,lock}' -B2 -A2 'quorum|consensus'
# Look for test files that might be affected
fd "test|spec" --type f --exec rg -l "node.*count|masternode"
# Check documentation for node requirements
fd "README|docs" --type f --exec rg -l "node.*requirement|minimum.*node"
Length of output: 67242
packages/dash-spv/package.json (1)
17-17
: Verify stability of the feature branch dependency.
Using a feature branch (feat/add-quourm-111
) as a dependency version could lead to instability:
- The branch might be deleted or rebased
- Changes in the branch could break compatibility
- Difficult to track exact version for security audits
Consider:
- Waiting for a stable release
- Using a specific commit hash
- Documenting the temporary nature of this dependency
packages/bench-suite/package.json (1)
11-11
: Ensure benchmark compatibility with feature branch.
The benchmark suite needs to maintain accuracy across different versions. Please verify:
- The feature branch doesn't introduce performance characteristics that could skew benchmarks
- All benchmark scenarios are still valid with the new quorum implementation
packages/dashmate/configs/defaults/getLocalConfigFactory.js (1)
Line range hint 69-91
: Verify if identical quorum configurations are intentional
All three quorums (validatorSet, chainLock, instantLock) are configured with identical settings:
- llmqType: 111
- dkgInterval: 24
- activeSigners: 2
- rotation: false
While this might be intentional for local testing, different quorum types typically have different requirements.
✅ Verification successful
Let me gather more information about the quorum configurations in the codebase.
Let me search for one more piece of information about local/test configurations.
Identical quorum configurations are intentional for local testing environment
The identical quorum configurations (llmqType: 111) in the local environment are intentional, as evidenced by:
- This is part of
getLocalConfigFactory.js
which provides a "template for local configs" - Other environments use different quorum types:
- Base config uses different types (4, 2, 5) for validatorSet, chainLock, and instantLock
- Testnet config uses different types (6, 1, 5) respectively
- Local config is simplified with identical values to facilitate local development and testing
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other quorum configurations in the codebase for comparison
rg --type js --type json -A 10 "quorum.*llmqType" | grep -v "111"
Length of output: 8465
Script:
#!/bin/bash
# Search for default quorum configurations in the codebase
rg --type js --type json "llmqType.*111" -B 2 -A 2
# Search for any documentation about quorum types
fd -e md -e txt | xargs rg -i "quorum.*type|llmq.*type"
Length of output: 4809
Script:
#!/bin/bash
# Search for documentation or comments about local/test configurations
rg -B 3 -A 3 "local.*config|test.*config" packages/dashmate/configs/defaults/
# Check if there are different quorum configurations for different environments
rg -B 3 -A 3 "llmqType" packages/dashmate/configs/defaults/
Length of output: 6976
packages/platform-test-suite/package.json (1)
27-27
: Consider dependency management strategy
Using a feature branch (feat/add-quourm-111
) instead of a version for @dashevo/dashcore-lib
has implications:
- ✅ Allows testing the new quorum type features
⚠️ May break if the branch is deleted or rebased⚠️ Makes builds non-reproducible
Since this is a test suite in a WIP PR, this is acceptable but should be updated to a proper version before final release.
packages/wasm-dpp/package.json (1)
46-46
: Track dependency on feature branch
The dependency on a feature branch feat/add-quourm-111
introduces potential instability. Since this is a WASM package, ensure thorough testing before merging.
Run the following script to check test coverage for dashcore-lib usage:
Consider creating a feature flag or version constraint to manage the transition to the new quorum functionality.
✅ Verification successful
Let me gather more specific information about the test coverage for the WASM package.
The previous search showed several test files in wasm-dpp, but let's verify the specific test coverage and quorum-related usage to make a more informed decision about the dependency change.
Based on the results, I can now generate the final response:
Dependency change appears safe with existing test coverage
The wasm-dpp package has comprehensive test coverage for dashcore-lib usage, particularly in critical areas:
- State transition validation
- Asset lock proofs
- Identity creation and updates
- Key signatures and ECDSA operations
While the dependency points to a feature branch for quorum functionality, the current codebase shows no direct quorum-related usage in wasm-dpp, suggesting this update is likely preparatory and won't impact existing functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for dashcore-lib imports and their test coverage
echo "Searching for dashcore-lib imports..."
rg -l "require.*dashcore-lib|import.*dashcore-lib"
echo "\nChecking corresponding test files..."
rg -l "require.*dashcore-lib|import.*dashcore-lib" | sed 's/\.js$/.spec.js/' | xargs -I{} test -f {} && echo "Found: {}" || echo "Missing test: {}"
Length of output: 11917
Script:
#!/bin/bash
# Check test files in wasm-dpp package that might be affected by dashcore-lib
echo "Checking test files in wasm-dpp:"
rg -l "dashcore-lib" packages/wasm-dpp/test/
# Check if there are any direct usages of quorum-related functionality
echo -e "\nChecking quorum-related usage:"
rg -i "quorum" packages/wasm-dpp/
Length of output: 1422
packages/dapi/package.json (1)
38-38
: Ensure DAPI compatibility with new quorum features
The DAPI package is critical for network interaction. The transition to the quorum feature branch requires careful testing.
Run the following script to verify test coverage for quorum-related functionality:
Consider documenting any API changes that might result from the new quorum functionality in the PR description.
packages/wallet-lib/package.json (1)
49-49
: Verify browser compatibility with new quorum features
The wallet library is user-facing and requires browser compatibility. The new quorum functionality needs thorough browser testing.
Run the following script to check browser-specific test coverage:
Consider adding browser-specific test cases for the new quorum functionality in the karma test suite.
✅ Verification successful
Browser compatibility is maintained through proper build configuration
The wallet library has a robust browser compatibility setup:
- Webpack configuration properly polyfills all necessary Node.js modules for browser environments
- Dedicated browser test infrastructure is in place with Karma
- No direct quorum-related code exists in the wallet-lib source, indicating that quorum functionality is properly abstracted through dashcore-lib
- Browser-specific tests are run as part of the CI pipeline through
test:browsers
andtest:browsers:functional
scripts
The update to dashcore-lib's quorum feature branch is safe as the wallet-lib maintains proper browser compatibility through its build system and test infrastructure.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check browser-specific tests for quorum functionality
echo "Searching for browser-specific quorum tests..."
rg -i "quorum" "tests/functional" "karma"
echo "\nVerifying browser build configuration..."
rg -i "dashcore-lib" "webpack.config.js"
Length of output: 435
Script:
#!/bin/bash
# Let's first find the correct paths for browser-related tests and configs
echo "Finding browser-related test files..."
fd -t f -e js -e json karma
fd -t f webpack.config
echo "\nSearching for browser tests in the entire repo..."
fd -t f -e spec.js -e test.js
echo "\nChecking package.json for browser-related scripts..."
cat packages/wallet-lib/package.json | jq '.scripts'
Length of output: 28189
Script:
#!/bin/bash
# Let's check the browser test configuration and quorum-related code
echo "Checking karma config for browser tests..."
cat packages/wallet-lib/karma/karma.conf.js
echo "\nChecking for quorum-related code in wallet-lib..."
rg -i "quorum" packages/wallet-lib/src/
echo "\nChecking webpack configuration for browser builds..."
cat packages/wallet-lib/webpack.config.js
Length of output: 2083
packages/js-dapi-client/package.json (1)
31-31
: Consider using a specific commit hash instead of a branch reference
Using a branch reference (#feat/add-quourm-111
) in package.json can lead to inconsistent builds if the branch is updated. Consider using a specific commit hash for better reproducibility.
packages/rs-drive-abci/Cargo.toml (1)
31-31
: LGTM! Good practice using a specific commit hash
The change from using a tag to a specific commit hash (rev = "f14bd9048cbc1767541f25b28db5c9ad1236d0da"
) for the dashcore-rpc dependency is a good practice for ensuring reproducible builds.
packages/js-dash-sdk/package.json (2)
44-44
: Same issues as in js-dapi-client package
This file has the same issues as discussed in the js-dapi-client package:
- Typo in branch name ("quourm")
- Using a branch reference instead of a commit hash
Line range hint 2-2
: Verify version consistency across packages
The version 4.8.0-dev.1
differs from the 1.8.0-dev.1
version used in other packages. Please verify if this difference is intentional.
✅ Verification successful
Version inconsistency detected across packages
The version check reveals that most packages use 1.8.0-dev.1
, but there are a few exceptions:
dash
: 4.8.0-dev.1@dashevo/dash-spv
: 2.8.0-dev.1
These version differences appear to be intentional since they follow a consistent versioning pattern and are part of different major version lines (4.x.x, 2.x.x vs 1.x.x).
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check versions across all package.json files
echo "Checking package versions:"
fd -e json -x jq -r '. | select(.version != null) | .name + ": " + .version' {}
Length of output: 67099
packages/dashmate/src/commands/setup.js (1)
63-64
: LGTM: Node count validation updated for single node support
The validation change correctly implements the minimum node count requirement for single node network support.
packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js (2)
13-18
: LGTM: Function renamed to better reflect its purpose
The renaming from enableCoreQuorumsTaskFactory
to enableMultiCoreQuorumsTaskFactory
better describes the function's role in handling multiple core quorums.
32-36
: Verify quorum functionality with reduced node count
The dynamic calculation of quorum parameters needs verification to ensure proper functionality with fewer than 3 nodes.
✅ Verification successful
Let me gather more context about the quorum functionality by checking for related configuration and test files.
Based on the gathered information, I can now provide a final response:
Dynamic quorum size calculation is properly implemented
The code correctly handles scenarios with fewer than 3 nodes:
- Uses
Math.min()
to dynamically adjust quorum parameters based on available nodes - Implements
llmq_test
type quorum which is designed for test configurations - No hard requirements or error conditions found for minimum node count
- All quorum parameters (members, commitments, connections, contributions) scale proportionally
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any hardcoded assumptions about quorum size
rg -A 3 "expectedMembers.*3" --type js
rg -A 3 "quorum.*size.*3" --type js
# Look for related test cases
fd -e js -e ts -E node_modules |
xargs rg -l "test.*quorum.*node"
Length of output: 1358
Script:
#!/bin/bash
# Search for quorum-related configuration and implementation
rg -A 5 "llmq_test" --type js
rg -A 5 "quorum.*config" --type js
# Look for any minimum node requirements or validations
rg -A 3 "minimum.*node" --type js
rg -A 3 "min.*node" --type js
# Check for any error handling related to insufficient nodes
rg -B 2 -A 3 "insufficient.*node" --type js
rg -B 2 -A 3 "not enough.*node" --type js
Length of output: 6958
packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (1)
56-57
: Verify the implications of reducing minimum node count.
The change from requiring 3 nodes to allowing single-node setups represents a significant architectural shift. While this enables simpler local development environments, it could impact:
- Network security and consensus mechanisms
- ChainLock functionality
- InstantSend capabilities
packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (1)
304-312
: LGTM: Clean conditional quorum enabling.
The logic for enabling quorums based on node count is well-structured:
- Single quorum for single node setups
- Multi quorums for larger networks
packages/dashmate/src/createDIContainer.js (2)
81-82
: LGTM: Clean separation of quorum handling concerns.
The split into separate task factories for multi-core and single-core quorum handling aligns well with the single node local network feature objective.
304-305
: Verify task registration dependencies.
The task registrations look good, but we should verify that all dependencies required by these tasks are properly registered in the container.
✅ Verification successful
Let me analyze the dependencies further by checking the imports and constants used in these files.
Based on the analysis of the imports and container registrations, I can now provide the final response:
Dependencies for task registrations are properly configured
All required dependencies for both tasks are correctly registered in the container:
- The tasks themselves are registered as singletons using
asFunction
- Both tasks only require the
generateBlocks
function as a direct dependency, which is injected through their factory functions - All imported utilities (
wait
,waitForQuorumPhase
, etc.) are standard utility functions that don't require container registration - The constants used (
LLMQ_TYPE_TEST_PLATFORM
,LLMQ_TYPE_1
,NETWORK_LOCAL
) are imported from a constants file - The
Listr
dependency is a third-party package imported directly
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any missing dependencies in the task factory implementations
# Search for dependencies in the task factory implementations
echo "Checking enableMultiCoreQuorumsTaskFactory dependencies..."
ast-grep --pattern 'function enableMultiCoreQuorumsTaskFactory($_) {
$$$
}'
echo "Checking enableSingleCoreQuorumTaskFactory dependencies..."
ast-grep --pattern 'function enableSingleCoreQuorumTaskFactory($_) {
$$$
}'
Length of output: 36948
Script:
#!/bin/bash
# Check imports and constants for both task factories
echo "Checking imports for enableMultiCoreQuorumsTaskFactory..."
rg -p "^import|^const" packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js
echo -e "\nChecking imports for enableSingleCoreQuorumTaskFactory..."
rg -p "^import|^const" packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
echo -e "\nChecking container registrations for dependencies..."
rg "as[A-Za-z]+\((.*)\)\.singleton\(\)" packages/dashmate/src/createDIContainer.js
Length of output: 6518
packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json
Outdated
Show resolved
Hide resolved
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
Outdated
Show resolved
Hide resolved
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
Outdated
Show resolved
Hide resolved
@@ -53,7 +53,7 @@ export default function getBaseConfigFactory() { | |||
port: 3001, | |||
}, | |||
docker: { | |||
image: 'dashpay/dashd:22', | |||
image: 'dashpay/dashd:22.1.0-devpr6437.f0e7eb57', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review usage of development Docker image.
Using a development PR version (22.1.0-devpr6437.f0e7eb57
) of the Core image in base configuration could introduce instability.
Consider:
- Using a stable release version
- If dev features are required, document the specific features needed from this PR
@@ -310,7 +310,7 @@ | |||
tenderdash: { | |||
mode: 'full', | |||
docker: { | |||
image: 'dashpay/tenderdash:1', | |||
image: 'dashpay/tenderdash:feat-support-quorum-111', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using feature branch Docker image in production.
Using a feature branch (feat-support-quorum-111
) for the Tenderdash image is not recommended for production environments as it:
- May contain unstable code
- Could be rebased or deleted
- Makes deployments non-reproducible
Consider using a stable, tagged release version instead.
# Conflicts: # packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js # packages/dashmate/templates/core/dash.conf.dot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js (1)
Line range hint
187-274
: Optimize the polling mechanism for quorum enablementThe current implementation uses a fixed 300ms wait time and potentially unnecessary block generations.
Consider implementing an exponential backoff strategy:
- while (!testPlatformQuorumEnabled) { - await wait(300); + const maxAttempts = 10; + let attempt = 0; + while (!testPlatformQuorumEnabled && attempt < maxAttempts) { + await wait(Math.min(300 * Math.pow(2, attempt), 5000)); + attempt++; await generateBlocks( ctx.seedCoreService, 1, NETWORK_LOCAL, );
🧹 Nitpick comments (3)
packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js (1)
Line range hint
41-186
: Consider enhancing error handling in phase transitionsThe DKG session phases are well-structured, but error handling could be improved to handle phase transition failures more gracefully.
Consider wrapping each phase with try-catch and implementing retry logic:
{ title: 'Waiting for phase 1 (init)', task: async (ctx) => { + const maxRetries = 3; + let retryCount = 0; + while (retryCount < maxRetries) { + try { const { result: quorumHash } = await ctx.seedRpcClient.getBestBlockHash(); ctx.quorumHash = quorumHash; // ... existing phase logic ... + break; + } catch (error) { + retryCount++; + if (retryCount === maxRetries) throw error; + await wait(1000 * retryCount); // Exponential backoff + } + } }, },packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (2)
120-121
: Fix typo in commentThere's a typo in the comment: "evnodes" should be "nodes".
- // Generate for evnodes (- a seed node) + some cash for fees + // Generate for nodes (- a seed node) + some cash for fees
295-298
: Consider making activation parameters configurableThe comments provide good context, but the activation height and block generation parameters could be made configurable for different environments.
Consider extracting these values to configuration:
+const FORK_ACTIVATION_HEIGHT = 1001; +const BLOCKS_TO_GENERATE_PER_STEP = 10; - const activationHeight = 1001; - const blocksToGenerateInOneStep = 10; + const activationHeight = FORK_ACTIVATION_HEIGHT; + const blocksToGenerateInOneStep = BLOCKS_TO_GENERATE_PER_STEP;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ 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/getBaseConfigFactory.js
(2 hunks)packages/dashmate/src/config/configJsonSchema.js
(1 hunks)packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js
(8 hunks)packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js
(2 hunks)packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/dashmate/configs/defaults/getBaseConfigFactory.js
- packages/dashmate/src/config/configJsonSchema.js
- packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
🔇 Additional comments (4)
packages/dashmate/src/listr/tasks/setup/local/enableMultiCoreQuorumsTaskFactory.js (2)
13-13
: LGTM: Function renaming improves clarity
The renaming from enableCoreQuorumsTaskFactory
to enableMultiCoreQuorumsTaskFactory
better reflects its purpose of handling multiple quorums.
Also applies to: 18-18
30-38
: Verify the quorum size calculations
The dynamic calculation of quorum parameters using Math.min()
is a good approach, but we should verify that these values align with the network's requirements.
✅ Verification successful
Based on the search results, I can see that the quorum size of 3 used in the code is consistent with the test configuration in the codebase. Specifically, in packages/rs-drive-abci/src/config.rs
, there are multiple test configurations that use a quorum size of 3, which matches the values being set in enableMultiCoreQuorumsTaskFactory.js
.
Let me verify one more aspect by checking if there are any specific test quorum configurations:
Based on the search results, I can see that the quorum size of 3 used in the code is specifically for the "llmq_test" quorum type, which is a test configuration. This is confirmed by:
- The comment in the code explicitly states: "Those are default values for the quorum size 3 with all nodes behaving correctly with 'llmq_test' quorum"
- The constant
LLMQ_TYPE_TEST
is defined inpackages/dashmate/src/constants.js
- The test quorum configuration is used in various test files with a size of 3
Let me verify one final aspect about test quorum configurations:
Based on the comprehensive analysis of the codebase, I can now provide a final response:
Quorum size calculations are correctly implemented
The values used in the code align with the test quorum requirements:
- The size of 3 is specifically used for "llmq_test" quorum type
- The
Math.min()
approach ensures the quorum parameters never exceed the available masternode services - The proportions between members, commitments, and connections are maintained correctly
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any hardcoded quorum size requirements in the codebase
# Search for quorum size related constants or configurations
rg -A 3 "quorum.*size|QUORUM.*SIZE"
# Search for any validation of quorum members count
ast-grep --pattern 'if ($members $_) {
$$$
}'
Length of output: 35406
Script:
#!/bin/bash
# Search for test quorum configurations
rg -A 3 "llmq_test|test.*quorum"
Length of output: 60744
Script:
#!/bin/bash
# Search for test quorum configuration files
rg -A 3 "llmq_test.*config|test.*quorum.*config"
Length of output: 50
packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js (2)
19-20
: LGTM: Parameter changes support new quorum functionality
The addition of enableSingleCoreQuorumTask
alongside enableMultiCoreQuorumsTask
provides better granularity for quorum management.
Also applies to: 34-35
275-283
: LGTM: Clean separation of single and multi quorum scenarios
The conditional execution based on node count provides a clear separation between single and multi quorum scenarios. The conditions are mutually exclusive and handle both cases appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
packages/dashmate/src/core/waitForCorePeersConnected.js (1)
Line range hint
1-21
: Add error handling for RPC callsThe RPC call to
getPeerInfo
could fail, but there's no error handling. This could lead to unhandled exceptions.export default async function waitForCorePeersConnected(rpcClient) { let hasPeers = false; do { - const { result: peers } = await rpcClient.getPeerInfo(); + try { + const { result: peers } = await rpcClient.getPeerInfo(); + hasPeers = peers && peers.length > 0; + } catch (error) { + console.error('Failed to get peer info:', error.message); + // Wait before retry to avoid hammering the node + await wait(1000); + continue; + } - hasPeers = peers && peers.length > 0; if (!hasPeers) { await wait(1000); } } while (!hasPeers); }
🧹 Nitpick comments (2)
packages/dashmate/src/core/waitForCorePeersConnected.js (2)
19-19
: Consider environment-specific wait timesWhile reducing the wait time to 1 second makes sense for local network setup, consider making this configurable based on the environment to avoid potential issues if this code is reused in other contexts.
+const PEER_CHECK_INTERVAL_MS = process.env.PEER_CHECK_INTERVAL_MS || 1000; + export default async function waitForCorePeersConnected(rpcClient) { let hasPeers = false; do { const { result: peers } = await rpcClient.getPeerInfo(); hasPeers = peers && peers.length > 0; if (!hasPeers) { - await wait(1000); + await wait(PEER_CHECK_INTERVAL_MS); } } while (!hasPeers); }
Line range hint
3-8
: Enhance JSDoc documentationThe current documentation could be more detailed to better explain the function's behavior and parameters.
/** * Wait Core to connect to peers + * + * @description Polls the Core node until at least one peer is connected. + * Implements a retry mechanism with a 1-second delay between attempts. * - * @typedef {waitForCorePeersConnected} * @param {RpcClient} rpcClient - The RPC client instance for communicating with the Core node + * @throws {Error} If the RPC call fails * @return {Promise<void>} Resolves when at least one peer is connected */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/dashmate/src/core/waitForCorePeersConnected.js
(1 hunks)
🔇 Additional comments (1)
packages/dashmate/src/core/waitForCorePeersConnected.js (1)
Line range hint 1-21
: Verify the impact on local network setup time
Since this is part of the single node local network feature, we should verify that the reduced wait time actually improves the local network setup experience without causing issues.
✅ Verification successful
Reduced wait time in peer connection check is safe to implement
The function is used in node startup tasks (both single and group nodes) where it ensures nodes have peers before proceeding. The 1-second polling interval is appropriate because:
- It's used as a startup prerequisite check, not in a performance-critical path
- It's called only once during node initialization in
startNodeTaskFactory
andstartGroupNodesTaskFactory
- The function exits as soon as peers are detected, so the polling duration is self-limiting
- No test files are directly dependent on the timing, suggesting it's not a critical timing-sensitive operation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other files that might be affected by the reduced wait time
# Look for test files or setup scripts that use this function
echo "Searching for references to waitForCorePeersConnected..."
rg -l "waitForCorePeersConnected"
echo "Searching for related test files..."
fd -g "*test*.js" -g "*spec*.js" | rg -l "waitForCorePeersConnected"
Length of output: 624
Script:
#!/bin/bash
# Let's examine how this function is used in the identified files
echo "Checking createDIContainer.js..."
rg -A 5 -B 5 "waitForCorePeersConnected" packages/dashmate/src/createDIContainer.js
echo -e "\nChecking startNodeTaskFactory.js..."
rg -A 5 -B 5 "waitForCorePeersConnected" packages/dashmate/src/listr/tasks/startNodeTaskFactory.js
echo -e "\nChecking startGroupNodesTaskFactory.js..."
rg -A 5 -B 5 "waitForCorePeersConnected" packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js
# Let's also check if there are any test files with a different pattern
echo -e "\nChecking for test files with different patterns..."
fd "test" | grep -i "test" | rg -l "waitForCorePeersConnected"
Length of output: 3437
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/tests-test-suite.yml (1)
61-61
: Reconsider always showing Docker logsCommenting out the failure condition means Docker logs will be shown for every run, not just failures. This could:
- Make it harder to identify actual issues in the logs
- Increase log storage usage
- Add noise to successful workflow runs
Consider these alternatives:
- Keep the failure condition but add manual trigger via workflow_dispatch
- Add a new input parameter to control log visibility
- Use GitHub Actions debug logging (
::debug::
) for non-failure casesExample implementation with an input parameter:
on: workflow_call: inputs: + show_logs: + type: boolean + description: Always show Docker logs + default: false name: type: string ... - name: Show Docker logs - #if: ${{ failure() }} + if: ${{ failure() || inputs.show_logs }} uses: jwalton/gh-docker-logs@v2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/tests-test-suite.yml
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Rust packages (dpp) / Formatting
- GitHub Check: Rust packages (dpns-contract) / Unused dependencies
- GitHub Check: Rust packages (dpns-contract) / Linting
- GitHub Check: Rust packages (dpns-contract) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Tests
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Rust packages (dash-sdk) / Formatting
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (dashpay-contract) / Unused dependencies
- GitHub Check: Rust packages (dapi-grpc) / Check each feature
- GitHub Check: Rust packages (dapi-grpc) / Tests
- GitHub Check: Rust packages (dapi-grpc) / Linting
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
# Conflicts: # Cargo.lock # packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json # packages/rs-drive-abci/Cargo.toml # packages/rs-sdk/Cargo.toml # packages/simple-signer/Cargo.toml # packages/wasm-dpp/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js (2)
18-19
: Add error handling for core service lookup.
This code may fail if no service namedlocal_seed
is found. Please validate the service exists and provide a meaningful error if not.- const seedCoreService = ctx.coreServices - .filter((coreService) => coreService.getConfig().getName() === 'local_seed')[0]; + const seedCoreService = ctx.coreServices + .find((coreService) => coreService.getConfig().getName() === 'local_seed'); + + if (!seedCoreService) { + throw new Error('Local seed core service not found'); + }
24-34
: Add a time-out mechanism to avoid potential infinite looping.
Without a time-out or maximum attempts, the loop might become infinite if the quorum never forms. Consider adding a bounded retry mechanism or throwing an error after a certain number of attempts.- do { - ({ result: { [LLMQ_TYPE_TEST]: llmq1 } } = await seedRpcClient.quorum('list')); - - await generateBlocks( - seedCoreService, - 2, - NETWORK_LOCAL, - ); - - await wait(300); - } while (llmq1.length === 0); + const MAX_ATTEMPTS = 30; + const POLLING_INTERVAL = 300; + for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) { + ({ result: { [LLMQ_TYPE_TEST]: llmq1 } } = await seedRpcClient.quorum('list')); + + if (llmq1.length > 0) { + break; + } + + await generateBlocks(seedCoreService, 2, NETWORK_LOCAL); + await wait(POLLING_INTERVAL); + } + if (llmq1.length === 0) { + throw new Error('Timeout waiting for quorum to be established'); + }
🧹 Nitpick comments (4)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (1)
1084-1084
: Consider using undefined assignment instead of delete.The
delete
operator can impact performance as flagged by static analysis. While functionally correct, setting the property toundefined
instead might be more efficient.- delete options.core.miner.mediantime; + options.core.miner.mediantime = undefined;🧰 Tools
🪛 Biome (1.9.4)
[error] 1084-1084: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
Dockerfile (2)
422-423
: Set TENDERDASH_COMMITISH Environment Variable
A new environment variableTENDERDASH_COMMITISH
is being exported with the commit hashd67ea304a4cd1364a3e1a1c27602ecc704d32cea
. Please ensure that this value is correct and that it aligns with your intended configuration for the build process. Additionally, consider whether this configuration might be centralized (for example, via a build argument) to avoid repetition in multiple RUN commands.
484-486
: Duplicate Environment Variable Setting
TheTENDERDASH_COMMITISH
variable is set again later in the build process. Confirm that this duplication is intentional and that both invocations are necessary in their respective contexts. If the same value is required in multiple stages, you might consider refactoring the Dockerfile to define it once (for example, by using an ARG or global ENV) to improve maintainability.packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (1)
148-164
: Avoid performance overhead of thedelete
operator.The code uses
delete validatorParams.voting_power_threshold;
. While it functionally removes the property, static analysis tools hint that using thedelete
operator can impact performance. For a small object, this might be negligible. However, as an optional measure, consider assigningundefined
if you simply wish to neutralize the property. If you truly need it removed, keep in mind the associated performance trade-offs.- delete validatorParams.voting_power_threshold; + validatorParams.voting_power_threshold = undefined;🧰 Tools
🪛 Biome (1.9.4)
[error] 160-160: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
.yarn/cache/@dashevo-dashcore-lib-npm-0.24.0-36203f35cd-90e723b770.zip
is excluded by!**/.yarn/**
,!**/*.zip
packages/dashmate/templates/core/dash.conf.dot
is excluded by!**/*.dot
packages/dashmate/templates/platform/drive/tenderdash/config.toml.dot
is excluded by!**/*.dot
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (16)
.pnp.cjs
(10 hunks)Dockerfile
(2 hunks)packages/bench-suite/package.json
(1 hunks)packages/dapi/package.json
(1 hunks)packages/dash-spv/package.json
(1 hunks)packages/dashmate/configs/defaults/getBaseConfigFactory.js
(3 hunks)packages/dashmate/configs/defaults/getLocalConfigFactory.js
(1 hunks)packages/dashmate/configs/getConfigFileMigrationsFactory.js
(2 hunks)packages/dashmate/package.json
(1 hunks)packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
(1 hunks)packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
(2 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)packages/wallet-lib/package.json
(1 hunks)packages/wasm-dpp/package.json
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- packages/dashmate/configs/defaults/getLocalConfigFactory.js
- packages/js-dash-sdk/package.json
- packages/bench-suite/package.json
- packages/wallet-lib/package.json
- packages/platform-test-suite/package.json
- packages/dashmate/package.json
- .pnp.cjs
- packages/js-dapi-client/package.json
- packages/dapi/package.json
- packages/dashmate/configs/defaults/getBaseConfigFactory.js
- packages/dash-spv/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
packages/dashmate/configs/getConfigFileMigrationsFactory.js
[error] 1084-1084: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
[error] 160-160: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / 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 JS packages / Build JS
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
🔇 Additional comments (4)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (2)
1064-1065
: LGTM: Enhanced debug logging exclusions.The addition of 'libevent' and 'leveldb' to the debug log exclusion list will help reduce noise in debug logs, improving readability by filtering out low-level library messages.
1081-1090
:✅ Verification successful
New migration function for version 2.0.0 added.
This migration function mirrors the logic of the 2.0.0-dev.1 migration function, ensuring the same configuration updates are applied for the official 2.0.0 release. It appropriately removes the deprecated
mediantime
property and updates Docker images to version 2.
🏁 Script executed:
#!/bin/bash # Check if there are any other places in the codebase that might still be using the removed core.miner.mediantime rg "core\.miner\.mediantime" --type jsLength of output: 370
Migration function for 2.0.0 verified
- The new migration function mirrors the logic of the 2.0.0-dev.1 migration.
- It correctly removes the deprecated
mediantime
property and updates the Docker images to'dashpay/drive:2-dev'
and'dashpay/dapi:2-dev'
.- A search for
core.miner.mediantime
confirms the deletion occurs only within this migration function.🧰 Tools
🪛 Biome (1.9.4)
[error] 1084-1084: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
packages/wasm-dpp/package.json (1)
46-46
: Updated Dependency Version for @dashevo/dashcore-lib
The dependency version has been updated from"~0.22.0"
to"~0.24.0"
. Please verify that the new version is fully compatible with the rest of the codebase and that any breaking changes or new features in version 0.24.0 have been addressed in integration tests.packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (1)
56-57
: Allowing a single node minimum looks good.Changing the minimum required node count from 3 to 1 is consistent with the move to support single-node local networks.
…QuorumTaskFactory.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js (1)
27-38
: 🛠️ Refactor suggestionImprove quorum polling implementation to prevent potential infinite loops.
The current implementation has several issues:
- No timeout mechanism could lead to infinite polling
- Hard-coded wait time might not be optimal
- No error handling for RPC calls
Consider implementing this improved version:
- let llmq1 = []; - do { - ({ result: { [LLMQ_TYPE_TEST]: llmq1 } } = await seedRpcClient.quorum('list')); - - await generateBlocks( - seedCoreService, - 2, - NETWORK_LOCAL, - ); - - await wait(300); - } while (llmq1.length === 0); + const MAX_ATTEMPTS = 30; + const POLLING_INTERVAL = 300; + + for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) { + try { + const { result } = await seedRpcClient.quorum('list'); + const llmq1 = result[LLMQ_TYPE_TEST] || []; + + if (llmq1.length > 0) { + return; + } + + await generateBlocks( + seedCoreService, + 2, + NETWORK_LOCAL, + ); + + await wait(POLLING_INTERVAL); + } catch (error) { + throw new Error(`Failed to check quorum status: ${error.message}`); + } + } + + throw new Error('Timeout waiting for quorum to be established');
🧹 Nitpick comments (3)
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js (3)
4-7
: Improve JSDoc documentation for better code maintainability.The current JSDoc doesn't fully specify the expected shape and behavior of the
generateBlocks
function or what the return type should be.Consider enhancing the JSDoc:
/** - * @param {generateBlocks} generateBlocks + * @param {function} generateBlocks - Function to generate new blocks + * @param {Object} generateBlocks.coreService - The core service to use for block generation + * @param {number} generateBlocks.count - Number of blocks to generate + * @param {string} generateBlocks.network - Network identifier * @return {enableSingleCoreQuorumTask} */
29-29
: Consider simplifying the destructuring assignment.The current destructuring with computed property names works but can be harder to read and debug.
- ({ result: { [LLMQ_TYPE_TEST]: llmq1 } } = await seedRpcClient.quorum('list')); + const response = await seedRpcClient.quorum('list'); + llmq1 = response.result[LLMQ_TYPE_TEST] || [];
10-12
: Improve return type documentation in JSDoc.The current JSDoc type definition for the inner function is missing information about the return type.
/** - * @typedef {enableSingleCoreQuorumTask} + * @typedef {Function} enableSingleCoreQuorumTask * @return {Listr} */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: Rust crates security audit
🔇 Additional comments (1)
packages/dashmate/src/listr/tasks/setup/local/enableSingleCoreQuorumTaskFactory.js (1)
18-23
: LGTM! Error handling for core service lookup is properly implemented.The code correctly uses
find()
instead of filtering and accessing by index, and includes appropriate error handling when the local seed core service is not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (1)
1087-1087
: Consider documenting the reason for excluding these log categories.Adding 'libevent' and 'leveldb' to the debug log exclusions will help reduce log noise, but it would be beneficial to add a comment explaining why these specific categories are being excluded.
- options.core.log.debug.exclude.push('libevent', 'leveldb'); + // Exclude high-volume low-value logs from libevent and leveldb to improve log readability + options.core.log.debug.exclude.push('libevent', 'leveldb');packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (1)
160-160
: Consider using property assignment instead of delete operator.Using the
delete
operator can impact performance. Consider setting the property toundefined
instead.- delete validatorParams.threshold; + validatorParams.threshold = undefined;🧰 Tools
🪛 Biome (1.9.4)
[error] 160-160: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/dashmate/configs/defaults/getLocalConfigFactory.js
(1 hunks)packages/dashmate/configs/getConfigFileMigrationsFactory.js
(1 hunks)packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/dashmate/configs/defaults/getLocalConfigFactory.js
🧰 Additional context used
🪛 Biome (1.9.4)
packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js
[error] 160-160: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Rust packages (wasm-dpp) / Tests
- GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (4)
packages/dashmate/configs/getConfigFileMigrationsFactory.js (2)
1079-1088
: Good implementation of the single node local network configuration.The new migration for version 2.0.0 properly configures the necessary parameters for running a local network with a single node by setting quorum requirements to minimum values. Setting
activeSigners
to 1 for validator set, chain lock, and instant lock allows the single node to function as a quorum. Setting the validator threshold to 100 ensures consensus can be reached with just one node.
1074-1075
: Consistent version update.The version updates for Docker images align with the migration to version 2.0.0.
packages/dashmate/src/listr/tasks/setup/setupLocalPresetTaskFactory.js (2)
56-57
: Successfully reduced minimum node requirement to 1.This change enables the single node local network configuration by removing the previous requirement of at least 3 nodes. This matches the PR objective and works well with the corresponding migration changes.
148-163
: Good implementation of dynamic quorum configuration based on node count.The code now intelligently configures quorum parameters based on the number of nodes:
- For single-node setups, it relies on the default configuration (which will use the values set in the 2.0.0 migration)
- For multi-node setups, it configures more appropriate values for a distributed network
This approach provides flexibility while maintaining backward compatibility with existing multi-node configurations.
🧰 Tools
🪛 Biome (1.9.4)
[error] 160-160: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
There was a problem hiding this 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
🧹 Nitpick comments (11)
packages/platform-test-suite/.mocharc.yml (1)
5-5
: Switching from parallel to sequential test executionChanging from parallel to sequential testing will increase the test execution time but may improve stability when interacting with a single node local network. However, this trade-off should be documented to explain why parallel execution was disabled.
Consider adding a code comment above this line explaining the rationale for running tests sequentially instead of in parallel.
scripts/configure_dotenv.sh (2)
57-58
: Network changed from regtest to localSimilar to the previous change, the network setting has been changed from "regtest" to "local" for the wallet library environment as well.
Consider adding a comment in the script explaining why "local" network is used instead of "regtest" and how this relates to the single node local network feature.
42-46
: Clean up commented-out codeThere are several commented-out
cat
commands (lines 42, 46, 56, 59) that appear to be remnants of an older implementation. These should be cleaned up to improve code readability.-#cat << 'EOF' >> ${SDK_ENV_FILE_PATH} echo "FAUCET_ADDRESS=${FAUCET_ADDRESS} FAUCET_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} NETWORK=local" >>"${SDK_ENV_FILE_PATH}" -#EOF ... -#cat << 'EOF' >> ${SDK_ENV_FILE_PATH} echo "FAUCET_PRIVATE_KEY=${FAUCET_PRIVATE_KEY} NETWORK=local" >>"${WALLET_LIB_ENV_FILE_PATH}" -#EOFAlso applies to: 56-59
packages/dapi-grpc/src/drive/server/org.dash.platform.drive.v0.rs (5)
1-4
: Consider excluding generated code from version control.These lines indicate that the file is generated by
prost-build
. Typically, auto-generated files are excluded from version control to reduce merge conflicts and accidental manual edits.
7-10
: Add a doc comment to clarifystate_transition
.While the other fields have descriptive comments,
state_transition
lacks an explanation. Briefly describing how the client/server should interpret this byte vector adds clarity and maintainability.
114-131
: Ensure robust error handling for service readiness check.The code properly checks if the underlying service is ready before handling requests. Consider logging or handling repeated readiness failures (e.g., circuit breaker or retry). This helps with better observability and resiliency under heavy load or transient outages.
146-151
: Evaluate adding additional documentation or examples forget_proofs
.The trait
DriveInternal
includes a singleget_proofs
method. Examples or doc comments explaining typical usage or expected request/response structures would help integrators.
224-264
: Return more descriptive error responses for unimplemented routes.Currently, unimplemented routes return a gRPC
Unimplemented
status. Consider including a small explanatory message (e.g., “Endpoint not supported”) to help clients troubleshoot.packages/dapi-grpc/src/drive/client/org.dash.platform.drive.v0.rs (3)
1-4
: Confirm that committing generated code is intentional.Like the server file, these lines indicate auto-generation by
prost-build
. Evaluate whether to store these sources in version control or regenerate them during builds.
7-10
: Consider adding usage context forstate_transition
.Adding inline docs or usage notes clarifies how the byte vector is structured and processed, which can reduce confusion for new contributors.
114-131
: Strengthen resilience inget_proofs
.While the current approach is correct, consider logging the error returned in
Service was not ready: ...
for better diagnostics, or implementing retries if transient failures are expected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
.yarn/cache/@dashevo-dashcore-lib-https-d3ed613dd5-ef656e8e9c.zip
is excluded by!**/.yarn/**
,!**/*.zip
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (20)
.pnp.cjs
(10 hunks)packages/bench-suite/package.json
(1 hunks)packages/dapi-grpc/src/drive/client/org.dash.platform.drive.v0.rs
(1 hunks)packages/dapi-grpc/src/drive/server/org.dash.platform.drive.v0.rs
(1 hunks)packages/dapi/package.json
(1 hunks)packages/dash-spv/package.json
(1 hunks)packages/dashmate/package.json
(1 hunks)packages/js-dapi-client/lib/DAPIClient.js
(1 hunks)packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js
(4 hunks)packages/js-dapi-client/lib/networkConfigs.js
(1 hunks)packages/js-dapi-client/package.json
(1 hunks)packages/js-dash-sdk/package.json
(1 hunks)packages/js-dash-sdk/src/SDK/Client/Client.ts
(1 hunks)packages/platform-test-suite/.env.example
(1 hunks)packages/platform-test-suite/.mocharc.yml
(1 hunks)packages/platform-test-suite/lib/test/getDAPISeeds.js
(1 hunks)packages/platform-test-suite/package.json
(1 hunks)packages/wallet-lib/package.json
(1 hunks)packages/wasm-dpp/package.json
(1 hunks)scripts/configure_dotenv.sh
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/platform-test-suite/.env.example
🚧 Files skipped from review as they are similar to previous changes (10)
- packages/dapi/package.json
- packages/wasm-dpp/package.json
- packages/dash-spv/package.json
- packages/dashmate/package.json
- packages/js-dash-sdk/package.json
- packages/bench-suite/package.json
- packages/platform-test-suite/package.json
- .pnp.cjs
- packages/wallet-lib/package.json
- packages/js-dapi-client/package.json
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/dapi-grpc/src/drive/server/org.dash.platform.drive.v0.rs (2)
packages/dapi-grpc/src/drive/client/org.dash.platform.drive.v0.rs (8)
connect
(41-48)new
(57-60)with_origin
(61-64)send_compressed
(88-91)accept_compressed
(94-97)max_decoding_message_size
(102-105)max_encoding_message_size
(110-113)get_proofs
(114-131)packages/dapi-grpc/src/drive/client/org.dash.platform.dapi.v0.rs (7)
connect
(5104-5111)new
(5120-5123)with_origin
(5124-5127)send_compressed
(5151-5154)accept_compressed
(5157-5160)max_decoding_message_size
(5165-5168)max_encoding_message_size
(5173-5176)
packages/dapi-grpc/src/drive/client/org.dash.platform.drive.v0.rs (1)
packages/dapi-grpc/src/drive/server/org.dash.platform.drive.v0.rs (16)
connect
(41-48)new
(57-60)new
(161-163)with_origin
(61-64)with_interceptor
(65-82)with_interceptor
(173-178)send_compressed
(88-91)send_compressed
(187-190)accept_compressed
(94-97)accept_compressed
(181-184)max_decoding_message_size
(102-105)max_decoding_message_size
(195-198)max_encoding_message_size
(110-113)max_encoding_message_size
(203-206)get_proofs
(114-131)get_proofs
(147-150)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Rust packages (dash-sdk) / Check each feature
- GitHub Check: Rust packages (rs-dapi-client) / Unused dependencies
- GitHub Check: Rust packages (dapi-grpc) / Formatting
- GitHub Check: Rust packages (wasm-dpp) / Linting
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build JS packages / Build JS
🔇 Additional comments (9)
scripts/configure_dotenv.sh (1)
43-45
: DAPI_SEED removed and network changed from regtest to localThe removal of
DAPI_SEED
aligns with the changes ingetDAPISeeds.js
, and the network change from "regtest" to "local" supports the single node local network feature. However, these changes should be documented to explain their impact.Could these changes break backward compatibility for users who rely on the
DAPI_SEED
environment variable or the "regtest" network setting?packages/js-dapi-client/lib/DAPIClient.js (1)
121-121
: Well-documented addition of the LLMQ parameters override optionThe addition of the
llmqParamsOverride
property to the DAPIClientOptions typedef is properly documented following the existing code style. This parameter will allow for custom LLMQ configuration, particularly useful for local and testing environments.packages/js-dash-sdk/src/SDK/Client/Client.ts (1)
96-96
: Properly propagated LLMQ parameter override to the Client optionsThe
llmqParamsOverride
option is correctly added to the list of options that get passed through to the DAPIClient. This ensures consistent configuration across the Client and DAPIClient instances.packages/js-dapi-client/lib/SimplifiedMasternodeListProvider/SimplifiedMasternodeListProvider.js (4)
13-13
: Good documentation of the new parameterThe JSDoc comment is properly updated to include the new
llmqParamsOverride
option.
32-32
: Safely handling potential undefined llmqParamsOverrideGood defensive programming approach by providing a default empty object when the option is not provided.
113-113
: Consistent usage of the LLMQ parameters overrideThe code correctly passes the LLMQ parameters override to the SimplifiedMNListDiff constructor, maintaining consistency across the codebase.
143-146
: Properly updated SimplifiedMNList initialization with LLMQ parametersThe initialization of a new SimplifiedMNList when receiving a full diff now correctly includes the LLMQ parameters override. This ensures consistent LLMQ configuration throughout the entire lifecycle of the provider.
packages/js-dapi-client/lib/networkConfigs.js (2)
52-52
: Updated local DAPI address with specific port and certificate informationThe local DAPI address now includes port (2443) and certificate type (self-signed) information, providing more detailed configuration for local development.
54-67
:❓ Verification inconclusive
Configuration for single-node LLMQ parameters aligns with PR purpose
The LLMQ parameters are configured for a single-node setup with size and threshold both set to 1 for all LLMQ types (106, 100, 104). This configuration directly supports the PR's purpose of enabling a single-node local network.
🏁 Script executed:
#!/bin/bash # Verify what these LLMQ types (106, 100, 104) correspond to in the codebase # Search for these LLMQ type constants in the repository rg -n "106.*LLMQ|LLMQ.*106" || echo "No direct reference to LLMQ type 106 found" rg -n "100.*LLMQ|LLMQ.*100" || echo "No direct reference to LLMQ type 100 found" rg -n "104.*LLMQ|LLMQ.*104" || echo "No direct reference to LLMQ type 104 found" # Search in dashcore-lib dependency for these constants npm list @dashevo/dashcore-lib || echo "dashcore-lib not found in direct dependencies"Length of output: 781
LLMQ Override Configuration Looks Aligned, but Please Verify the Use of Type 104
The configuration for LLMQ types 106 and 100 is clearly intended for the single-node setup (referenced as
LLMQ_TYPE_TEST_PLATFORM
andLLMQ_TYPE_TEST
respectively). However, our recent search did not find any direct reference for LLMQ type 104 in the repository or within the@dashevo/dashcore-lib
dependency. Please verify if:
- The override for type 104 is intentional.
- Type 104 is meant to be used as a placeholder or for future purposes in the local network configuration.
Once confirmed, you may consider adding a comment in the codebase to clarify its usage for future maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/js-dash-sdk/.env.example
(1 hunks)packages/wallet-lib/.env.example
(1 hunks)scripts/configure_test_suite.sh
(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/js-dash-sdk/.env.example
- packages/wallet-lib/.env.example
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/configure_test_suite.sh
[warning] 53-53: Did you forget to close this double quoted string?
(SC1078)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- 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
- GitHub Check: Rust crates security audit
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Enhancements
Dependency Updates
@dashevo/dashcore-lib
dependency across all packages to version 0.25.0 for improved consistency.Bug Fixes
Chores
DAPI_SEED
environment variables in example and configuration files.