Skip to content

docs(dapi): document architecture and implementation #2539

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

Merged
merged 18 commits into from
May 8, 2025

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Apr 12, 2025

Issue being fixed or feature implemented

We need to share knoweldge about DAPI internal implementation.

What was done?

  • Described DAPI archtecture and internal behaviour

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

  • Documentation
    • Added comprehensive new documentation for DAPI, including architecture, endpoint overviews, and detailed API references for core, platform, stream, and JSON-RPC endpoints.
    • Introduced new endpoint documentation covering transaction broadcasting, blockchain status, masternode list streaming, consensus parameters, and more.
    • Removed outdated and redundant documentation files, configuration references, and OpenAPI definitions.
  • Refactor
    • Reformatted and reorganized code for improved readability without altering functionality.
  • Chores
    • Updated internal constants and arrays to reflect recent changes in supported messages and method identifiers.

Copy link
Contributor

coderabbitai bot commented Apr 12, 2025

Caution

Review failed

The head commit changed during the review from d2a530b to f187248.

Walkthrough

This set of changes primarily restructures and expands the documentation for the DAPI (Dash API) package. It introduces detailed new markdown documentation files covering DAPI's architecture, endpoint overviews, and in-depth descriptions of core, platform, stream, and JSON-RPC endpoints. Several older documentation files, including configuration guides and API references, are removed or replaced. Minor source code changes include a reduction in the size of versioned gRPC message arrays in a Rust build script, reordering of method ID constants in a Java gRPC client, and a duplicate trait implementation in a Rust service. No core logic or exported code interfaces are modified.

Changes

File(s) Change Summary
packages/dapi/doc/architecture.md, packages/dapi/doc/index.md, packages/dapi/doc/endpoints/index.md, packages/dapi/doc/endpoints/core/*.md, packages/dapi/doc/endpoints/platform/*.md, packages/dapi/doc/endpoints/streams/*.md, packages/dapi/doc/endpoints/json-rpc/*.md Added comprehensive new documentation files describing DAPI architecture, endpoint overviews, and detailed API endpoint behavior for core, platform, stream, and JSON-RPC interfaces.
packages/dapi/README.md Simplified the README by removing detailed instructions and usage examples, leaving a concise overview and documentation links.
packages/dapi/doc/CONFIGURATION.md, packages/dapi/doc/README.md, packages/dapi/doc/REFERENCE.md, packages/dapi/doc/swaggerDef.js, packages/dapi/doc/dependencies_configs/dash.conf Removed legacy documentation and configuration files, including configuration guides, API references, and OpenAPI definitions.
packages/dapi/doc/endpoints/core/broadcastTransaction.md, packages/dapi/doc/endpoints/core/getBestBlockHeight.md, packages/dapi/doc/endpoints/core/getBlockchainStatus.md, packages/dapi/doc/endpoints/core/getTransaction.md, packages/dapi/doc/endpoints/core/subscribeToMasternodeList.md Added new documentation for individual core endpoints, detailing parameters, responses, internal logic, and error handling.
packages/dapi/doc/endpoints/platform/broadcastStateTransition.md, packages/dapi/doc/endpoints/platform/getConsensusParams.md, packages/dapi/doc/endpoints/platform/getStatus.md, packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md Added new documentation for platform endpoints, including request/response formats, implementation notes, and code flows.
packages/dapi/doc/endpoints/streams/subscribeToBlockHeadersWithChainLocks.md, packages/dapi/doc/endpoints/streams/subscribeToTransactionsWithProofs.md Added new documentation for stream endpoints, describing streaming mechanisms, data formats, and lifecycle management.
packages/dapi/doc/endpoints/json-rpc/getBestBlockHash.md, packages/dapi/doc/endpoints/json-rpc/getBlockHash.md Added new documentation for JSON-RPC endpoints, including request/response formats and internal implementation details.
packages/dapi-grpc/build.rs Reduced the size of the VERSIONED_REQUESTS and VERSIONED_RESPONSES arrays by one element each.
packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java Adjusted and reordered method ID constants for platform gRPC methods; updated integer assignments for new and existing methods.
packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs Reformatted function signatures and reorganized import statements; no logic changes.
packages/rs-drive-abci/src/query/service.rs Added a duplicate implementation of the DriveInternal trait for QueryService with identical method logic.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DAPI gRPC/JSON-RPC Server
    participant Dash Core Node
    participant Drive
    participant Tenderdash

    %% Example: Core endpoint (getBestBlockHeight)
    Client->>DAPI gRPC/JSON-RPC Server: Request getBestBlockHeight
    alt Cache valid
        DAPI gRPC/JSON-RPC Server-->>Client: Return cached block height
    else Cache invalid
        DAPI gRPC/JSON-RPC Server->>Dash Core Node: getBlockCount RPC
        Dash Core Node-->>DAPI gRPC/JSON-RPC Server: Block height
        DAPI gRPC/JSON-RPC Server-->>Client: Return block height
    end

    %% Example: Platform endpoint (broadcastStateTransition)
    Client->>DAPI gRPC Server: broadcastStateTransition(stateTransition)
    DAPI gRPC Server->>Tenderdash: broadcast_tx(stateTransition)
    alt Success
        DAPI gRPC Server-->>Client: Success (empty response)
    else Error
        Tenderdash-->>DAPI gRPC Server: Error details
        DAPI gRPC Server-->>Client: Error mapped to gRPC code
    end

    %% Example: Stream endpoint (subscribeToTransactionsWithProofs)
    Client->>DAPI gRPC Server: subscribeToTransactionsWithProofs(bloomFilter)
    DAPI gRPC Server->>Dash Core Node: Subscribe to ZMQ events
    Dash Core Node-->>DAPI gRPC Server: New block/transaction events
    DAPI gRPC Server-->>Client: Stream matching transactions/proofs
Loading

Possibly related PRs

  • dashpay/platform#2544: Modifies the same versioned request/response arrays in configure_platform, but by adding message types—effectively the inverse of this PR's removals.
  • dashpay/platform#2431: Adds new platform RPC methods and updates method ID constants, directly relating to the method ID adjustments in the Java gRPC client and the versioned message arrays.

Poem

In the warren of docs, a rabbit hops,
Tidying up the files, old guides it stops.
New trails are mapped, with endpoints so clear,
From platform to core, all details appear.
With arrays trimmed and constants realigned,
This bunny leaves no carrot behind.
🥕✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai 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 added 4 commits April 12, 2025 21:26
# Conflicts:
#	packages/dapi-grpc/Cargo.toml
#	packages/dapi-grpc/clients/drive/v0/nodejs/drive_pbjs.js
#	packages/dapi-grpc/clients/platform/v0/python/platform_pb2.py
#	packages/dapi-grpc/protos/platform/v0/platform.proto
#	packages/rs-drive-abci/src/query/proofs/v0/mod.rs
#	packages/rs-drive-abci/src/query/service.rs
@shumkov shumkov marked this pull request as ready for review April 18, 2025 13:19
@shumkov shumkov added this to the v2.0.0 milestone Apr 18, 2025
# Conflicts:
#	packages/dapi-grpc/build.rs
@shumkov shumkov changed the title docs: dapi documentation docs(dapi): documentation Apr 18, 2025
@shumkov shumkov changed the title docs(dapi): documentation docs(dapi): document architecture and implementation Apr 18, 2025
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: 4

🔭 Outside diff range comments (1)
packages/dapi-grpc/build.rs (1)

76-124: 💡 Verification agent

🧩 Analysis chain

Verify VERSIONED_REQUESTS and VERSIONED_RESPONSES alignment with proto definitions.
Ensure the updated VERSIONED_REQUESTS (lines 76–117) and VERSIONED_RESPONSES (lines 124–164) arrays accurately reflect the message types in protos/platform/v0/platform.proto and the method IDs in PlatformGrpc.java.

Run this script from the repository root to confirm all entries exist in the proto file:


🏁 Script executed:

#!/bin/bash
# Check Versioned Request/Response messages exist in proto definitions
code_file="packages/dapi-grpc/build.rs"
proto_file="protos/platform/v0/platform.proto"
missing=0
for prefix in "Request" "Response"; do
  # Extract message names
  msgs=$(grep -oE "\"[A-Za-z0-9]+${prefix}\"" "$code_file" | tr -d '"' | sort | uniq)
  for msg in $msgs; do
    if ! grep -R "message $msg\\b" "$proto_file"; then
      echo "Missing ${prefix} message in proto: $msg"
      missing=1
    fi
  done
done
exit $missing

Length of output: 29394


🏁 Script executed:

#!/bin/bash
# Locate all .proto files to identify the correct path for platform.proto
find . -type f -name "*.proto"

Length of output: 240


🏁 Script executed:

#!/bin/bash
# Verify VERSIONED_REQUESTS and VERSIONED_RESPONSES against the correct proto path
code_file="packages/dapi-grpc/build.rs"
proto_file="packages/dapi-grpc/protos/platform/v0/platform.proto"
missing=0

for prefix in "Request" "Response"; do
  msgs=$(grep -oE "\"[A-Za-z0-9]+${prefix}\"" "$code_file" | tr -d '"' | sort | uniq)
  for msg in $msgs; do
    if ! grep -qE "message ${msg}\b" "$proto_file"; then
      echo "Missing ${prefix} message in proto: ${msg}"
      missing=1
    fi
  done
done

exit $missing

Length of output: 13787


Mismatch Detected in VERSIONED_REQUESTS/RESPONSES
The following entries in packages/dapi-grpc/build.rs are not defined in
packages/dapi-grpc/protos/platform/v0/platform.proto:

• VERSIONED_REQUESTS:
– GetIdentitiesByPublicKeyHashesRequest
– GetIdentitiesRequest

• VERSIONED_RESPONSES:
– GetIdentitiesByPublicKeyHashesResponse
– GetIdentitiesResponse

Please either remove/rename these entries in the VERSIONED_* arrays or add matching message definitions in platform.proto (and update PlatformGrpc.java method IDs).

🧹 Nitpick comments (19)
packages/dapi/README.md (1)

16-16: Fix typo in documentation link text.
The word “documentaion” is misspelled. Change it to “documentation”.

packages/dapi/doc/endpoints/core/subscribeToMasternodeList.md (1)

53-53: Specify language for fenced code block.
The code block starting at line 53 has no language identifier, which triggers markdownlint’s MD040. Add a language label (e.g., ```text) to satisfy the linter.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

53-53: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/index.md (1)

1-74: Well-structured main documentation page!

This comprehensive overview of DAPI provides excellent context and navigation. The hierarchical structure with clear sections for architecture, endpoints by category, and client libraries creates a logical flow for readers.

One minor suggestion:

Consider adding a comma before "so" in line 11 to improve readability:

-DAPI supports both layer 1 (Core blockchain) and layer 2 (Dash Platform) functionality so all developers can interact with Dash via a single interface.
+DAPI supports both layer 1 (Core blockchain) and layer 2 (Dash Platform) functionality, so all developers can interact with Dash via a single interface.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~11-~11: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...nd layer 2 (Dash Platform) functionality so all developers can interact with Dash v...

(COMMA_COMPOUND_SENTENCE_2)

packages/dapi/doc/endpoints/index.md (1)

47-66: Consider explaining why these endpoints are served by Drive ABCI directly

The documentation lists numerous platform endpoints that are "served by Drive ABCI directly" without explaining the significance of this distinction to developers.

Consider adding a brief explanation of what Drive ABCI is and how this implementation detail might affect developers (if at all). For example, are there any performance implications or usage differences compared to regular DAPI endpoints?

packages/dapi/doc/endpoints/json-rpc/getBlockHash.md (1)

73-82: Add language specifier to code block

The code flow diagram is missing a language specifier in the fenced code block.

Add a language specifier to the fenced code block by changing:

-```
+```text
 Client Request 
   → JSON-RPC Server 
     → getBlockHash Handler 
       → Validate Height Parameter
         → If Invalid: Return Error Response
       → Call Core RPC getBlockHash with height
         → If Successful: Return Block Hash
         → If Error: Map to JSON-RPC Error Response
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

73-73: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/core/broadcastTransaction.md (1)

48-60: Suggest adding a language specifier to the code block.

The internal code flow diagram uses fenced code blocks without a language.
Consider changing:

``` 
Client Request 
...
``` 

to:

- ```
+ ```text
Client Request 
...

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/core/getBestBlockHeight.md (1)</summary><blockquote>

`45-54`: **Suggest specifying code block language.**

The code flow diagram lacks a fence language; add `text` or `none` for clarity:
```diff
- ```
+ ```text
Client Request
...

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/core/getBlockchainStatus.md (1)</summary><blockquote>

`56-68`: **Suggest adding a language to the code flow block.**

Replace:
Client Request 
...
with:
```diff
- ```
+ ```text
Client Request 
...

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/core/getTransaction.md (2)</summary><blockquote>

`1-17`: **Suggest refining InstantLock description.**

Replace:
  • isInstantLocked: Whether transaction is instant locked
with:
  • isInstantLocked: Whether the transaction has been locked by InstantSend
This clarifies the security mechanism and fixes the adverb/adjective usage.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[misspelling] ~15-~15: The word “instant” is an adjective and doesn’t fit in this context. Did you mean the adverb “instantly”?
Context: ...sInstantLocked`: Whether transaction is instant locked - `isChainLocked`: Whether trans...

(ADJECTIVE_ADVERB)

</details>

</details>

---

`53-68`: **Suggest adding a language specifier to the code flow block.**

Use:
```diff
- ```
+ ```text
Client Request 
...
to improve readability.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

55-55: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

</details>

</details>

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/platform/broadcastStateTransition.md (1)</summary><blockquote>

`51-65`: **Suggest specifying code block language for the flow diagram.**

Update:
```diff
- ```
+ ```text
Client Request 
...
to ensure proper rendering.

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/streams/subscribeToBlockHeadersWithChainLocks.md (1)</summary><blockquote>

`8-9`: **Clarify parameter requirements for historical vs. streaming modes.**

The doc currently says both `fromBlockHash` and `fromBlockHeight` are optional, but it’s not clear when at least one must be provided. Consider specifying that:
- For historical mode (`count > 0`), exactly one of `fromBlockHash` or `fromBlockHeight` is required.
- For real-time streaming (`count = 0`), both can be omitted.

</blockquote></details>
<details>
<summary>packages/dapi/doc/endpoints/platform/getStatus.md (1)</summary><blockquote>

`43-44`: **Link the handler implementation file for easier navigation.**

Consider turning the plain filename into a relative markdown link so readers can jump directly to the code:

```diff
- The `getStatus` endpoint is implemented in the `getStatusHandlerFactory.js` file.
+ The `getStatus` endpoint is implemented in [getStatusHandlerFactory.js](../handlers/getStatusHandlerFactory.js).
packages/dapi/doc/endpoints/platform/getConsensusParams.md (2)

10-18: Consider grouping response parameters by category

To improve readability, split the response list into subheadings (e.g., Block Parameters, Evidence Parameters, Validator Parameters) matching the logical grouping in the architecture overview.


32-33: Link internal implementation file

You may link getConsensusParamsFactory.js to its source path to help users navigate directly to the implementation (e.g., [getConsensusParamsFactory.js](../path/to/getConsensusParamsFactory.js)).

packages/dapi/doc/architecture.md (2)

49-54: Remove trailing punctuation from headings and fix list indentation

Multiple headings end with colons (Responsibilities:, Connections:, Startup Sequence:, Endpoints Served:, Dependencies:). Please remove trailing colons (e.g., change #### Responsibilities: to #### Responsibilities). Also adjust nested list indentation from 3 spaces to 2 spaces per level to satisfy markdownlint MD007.

Also applies to: 55-60, 61-69, 70-84, 89-96, 105-109, 111-115, 116-124, 126-131, 133-135

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

49-49: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


13-41: Specify language for architecture diagram code block

The ASCII diagram block should specify a language (e.g., text) for the fenced code block:

- ```
+ ```text

This addresses MD040.

packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md (1)

64-80: Specify language for code flow block

The code flow block should indicate a language (e.g., text):

- ```
+ ```text

This satisfies MD040 for fenced code blocks.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

64-64: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/streams/subscribeToTransactionsWithProofs.md (1)

85-109: Specify language for code flow block

Add a language identifier (e.g., text) to the fenced code block starting at line 85:

- ```
+ ```text

This satisfies MD040.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

85-85: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between db1fcb8 and 4cb360e.

📒 Files selected for processing (26)
  • packages/dapi-grpc/build.rs (2 hunks)
  • packages/dapi-grpc/clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java (1 hunks)
  • packages/dapi/README.md (1 hunks)
  • packages/dapi/doc/CONFIGURATION.md (0 hunks)
  • packages/dapi/doc/README.md (0 hunks)
  • packages/dapi/doc/REFERENCE.md (0 hunks)
  • packages/dapi/doc/architecture.md (1 hunks)
  • packages/dapi/doc/dependencies_configs/dash.conf (0 hunks)
  • packages/dapi/doc/endpoints/core/broadcastTransaction.md (1 hunks)
  • packages/dapi/doc/endpoints/core/getBestBlockHeight.md (1 hunks)
  • packages/dapi/doc/endpoints/core/getBlockchainStatus.md (1 hunks)
  • packages/dapi/doc/endpoints/core/getTransaction.md (1 hunks)
  • packages/dapi/doc/endpoints/core/subscribeToMasternodeList.md (1 hunks)
  • packages/dapi/doc/endpoints/index.md (1 hunks)
  • packages/dapi/doc/endpoints/json-rpc/getBestBlockHash.md (1 hunks)
  • packages/dapi/doc/endpoints/json-rpc/getBlockHash.md (1 hunks)
  • packages/dapi/doc/endpoints/platform/broadcastStateTransition.md (1 hunks)
  • packages/dapi/doc/endpoints/platform/getConsensusParams.md (1 hunks)
  • packages/dapi/doc/endpoints/platform/getStatus.md (1 hunks)
  • packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md (1 hunks)
  • packages/dapi/doc/endpoints/streams/subscribeToBlockHeadersWithChainLocks.md (1 hunks)
  • packages/dapi/doc/endpoints/streams/subscribeToTransactionsWithProofs.md (1 hunks)
  • packages/dapi/doc/index.md (1 hunks)
  • packages/dapi/doc/swaggerDef.js (0 hunks)
  • packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (4 hunks)
  • packages/rs-drive-abci/src/query/service.rs (2 hunks)
💤 Files with no reviewable changes (5)
  • packages/dapi/doc/README.md
  • packages/dapi/doc/CONFIGURATION.md
  • packages/dapi/doc/swaggerDef.js
  • packages/dapi/doc/dependencies_configs/dash.conf
  • packages/dapi/doc/REFERENCE.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
packages/dapi/doc/endpoints/json-rpc/getBlockHash.md

73-73: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/streams/subscribeToTransactionsWithProofs.md

85-85: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md

64-64: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/streams/subscribeToBlockHeadersWithChainLocks.md

66-66: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/architecture.md

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


49-49: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


55-55: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


61-61: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


70-70: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


73-73: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


74-74: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


75-75: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


76-76: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


79-79: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


80-80: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


81-81: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


82-82: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


83-83: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


86-86: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


87-87: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


89-89: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


105-105: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


111-111: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


116-116: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


126-126: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


129-129: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


130-130: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


131-131: Unordered list indentation
Expected: 2; Actual: 3

(MD007, ul-indent)


133-133: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

packages/dapi/doc/endpoints/core/getTransaction.md

55-55: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/dapi/doc/endpoints/core/subscribeToMasternodeList.md

53-53: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🪛 LanguageTool
packages/dapi/doc/endpoints/index.md

[style] ~3-~3: Consider using a synonym to be more concise.
Context: # DAPI Endpoints Overview DAPI offers a variety of endpoints through two main interfaces: ...

(A_VARIETY_OF)

packages/dapi/doc/index.md

[uncategorized] ~11-~11: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...nd layer 2 (Dash Platform) functionality so all developers can interact with Dash v...

(COMMA_COMPOUND_SENTENCE_2)

packages/dapi/doc/endpoints/platform/broadcastStateTransition.md

[grammar] ~36-~36: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...c validation error messages 3. Error Handling - Handles various error scenarios with specialize...

(REPEATED_VERBS)

packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md

[grammar] ~47-~47: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...tion without trusting DAPI 3. Result Processing - Processes both successful and unsuccessful state ...

(REPEATED_VERBS)


[grammar] ~52-~52: You’ve repeated a verb. Did you mean to only write one of them?
Context: ... detailed error information 4. Error Handling - Handles timeout errors with `DeadlineExceededGr...

(REPEATED_VERBS)


[grammar] ~86-~86: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...nitor transaction status: 1. Initial Check - Checks if the transaction is already confirmed...

(REPEATED_VERBS)

packages/dapi/doc/endpoints/core/getTransaction.md

[misspelling] ~15-~15: The word “instant” is an adjective and doesn’t fit in this context. Did you mean the adverb “instantly”?
Context: ...sInstantLocked: Whether transaction is instant locked - isChainLocked`: Whether trans...

(ADJECTIVE_ADVERB)

packages/dapi/doc/endpoints/core/subscribeToMasternodeList.md

[grammar] ~46-~46: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...tSync for maintaining state 5. Error Handling - Handles disconnections from Core - Provides ...

(REPEATED_VERBS)

🔇 Additional comments (35)
packages/dapi/doc/endpoints/json-rpc/getBestBlockHash.md (1)

1-85: Endpoint documentation is clear and comprehensive.
The getBestBlockHash JSON‑RPC endpoint is well‑documented with request/response examples, implementation details, and code flow. No issues found.

packages/dapi/doc/endpoints/index.md (1)

1-110: Great endpoint organization and comprehensive categorization!

This document effectively categorizes DAPI endpoints into logical groups with clear explanations of each interface type. The inclusion of direct access examples alongside client library recommendations provides valuable guidance for developers.

The explanation of gRPC as the recommended interface and JSON-RPC as legacy helps guide developers toward the preferred implementation path.

🧰 Tools
🪛 LanguageTool

[style] ~3-~3: Consider using a synonym to be more concise.
Context: # DAPI Endpoints Overview DAPI offers a variety of endpoints through two main interfaces: ...

(A_VARIETY_OF)

packages/dapi/doc/endpoints/json-rpc/getBlockHash.md (1)

1-108: Thorough and well-structured endpoint documentation!

This documentation provides excellent coverage of both the client-facing API and internal implementation details. The inclusion of example code, schema validation, and error handling considerations makes this particularly useful for both users and maintainers.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

73-73: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs (2)

1-1: Clean import organization

The imports have been well organized, with token configuration accessors and localization imports grouped together.

Also applies to: 28-31


56-109: Improved function signature formatting

The function parameter lists have been reformatted from multi-line to a more compact single-line style, which improves code readability while maintaining the same functionality.

Also applies to: 117-149

packages/dapi/doc/endpoints/core/broadcastTransaction.md (5)

1-12: Approve: Core broadcastTransaction API documentation is clear and accurate.

The introduction and parameter descriptions concisely explain the purpose and usage of the endpoint.


13-19: Approve: Example usage demonstrates client-side invocation.

The JavaScript snippet correctly shows how to call broadcastTransaction and log the result.


20-29: Approve: Implementation Details section is thorough.

Step-by-step breakdown of validation and RPC interaction aligns with handler behavior.


30-42: Approve: Error handling details are comprehensive.

Common Core RPC error codes are mapped appropriately to gRPC errors with helpful descriptions.


61-83: Approve: Common Error Scenarios mapping is clear.

Each RPC error case is documented with the correct gRPC mapping and rationale.

packages/dapi/doc/endpoints/core/getBestBlockHeight.md (4)

1-11: Approve: getBestBlockHeight header and parameter docs.

The overview, absence of request parameters, and response field are clearly documented.


12-17: Approve: Example usage is correct.

Demonstrates asynchronous call and logging of the block height.


20-28: Approve: Caching and handler flow explained well.

Implementation Details describe cache invalidation and RPC fallback clearly.


29-38: Approve: Dependencies are correctly listed.

Dash Core RPC and ZMQ dependencies are noted for full context.

packages/dapi/doc/endpoints/core/getBlockchainStatus.md (4)

1-20: Approve: Overview and client API section.

The request/response parameters capture all fields in getBlockchainStatus.


21-25: Approve: Example usage snippet.

Correctly illustrates invocation and logging of key response fields.


29-49: Approve: Implementation Details are comprehensive.

Data collection, parallel RPC calls, cache strategy, status determination, and dependencies are well documented.


70-82: Approve: Response Construction section.

Aggregates multiple data sources into a cohesive snapshot; descriptions are clear.

packages/dapi/doc/endpoints/core/getTransaction.md (6)

19-23: Approve: Example usage is clear.

Demonstrates how to pass a transaction ID and access the returned height.


25-34: Approve: Input validation step is well described.

Specifies hex-string requirements and error handling for invalid formats.


35-43: Approve: RPC interaction and response transformation.

Details on getrawtransaction usage and mapping to gRPC response are accurate.


44-48: Approve: Error handling mapping.

Covers -5 not-found scenario and general RPC errors appropriately.


49-52: Approve: Dependencies listed correctly.

Mentions Core RPC and optional InsightAPI fallback.


71-82: Approve: Transaction Lock Status details are informative.

The distinction between InstantLock and ChainLock is well captured.

packages/dapi/doc/endpoints/platform/broadcastStateTransition.md (7)

1-12: Approve: Broadcast State Transition client API section.

Endpoint purpose, request, and response definitions are clear.


13-18: Approve: Example usage snippet.

Illustrates how to submit a state transition and handle the response.


20-29: Approve: State Transition Processing steps.

Covers base64 conversion and RPC invocation clearly.


31-35: Approve: Validation flow explanation.

Describes both broadcast_tx and optional check_tx calls accurately.


36-45: Approve: Detailed error handling scenarios.

Common Tenderdash error cases are mapped to gRPC codes appropriately.

🧰 Tools
🪛 LanguageTool

[grammar] ~36-~36: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...c validation error messages 3. Error Handling - Handles various error scenarios with specialize...

(REPEATED_VERBS)


46-49: Approve: Dependencies are correctly noted.

Mention of Tenderdash RPC and Drive is complete.


67-89: Approve: Common Error Scenarios documentation.

Each failure mode (mempool, validation, capacity, timeout) is clearly described with correct gRPC mappings.

packages/dapi/doc/endpoints/platform/getConsensusParams.md (1)

1-28: Documentation is comprehensive

The getConsensusParams.md file provides a clear API description, parameter details, examples, and implementation notes.

packages/dapi/doc/architecture.md (1)

97-100: Approve code block usage

The bash code block for the startup script is correctly formatted.

packages/dapi/doc/endpoints/platform/waitForStateTransitionResult.md (1)

1-32: Documentation is clear

The waitForStateTransitionResult.md document comprehensively covers request parameters, response structure, internal implementation details, and usage example.

packages/dapi/doc/endpoints/streams/subscribeToTransactionsWithProofs.md (1)

1-42: Documentation looks solid

The endpoint doc clearly defines request params, response types, example usage, internal implementation, and response types.

Comment on lines +66 to +84
```
Client Request
→ gRPC Server
→ subscribeToBlockHeadersWithChainLocksHandler
→ Validate Parameters
→ If Historical Data Requested (count > 0):
→ Create Historical Headers Iterator
→ Stream Headers Until Count Reached
→ If Streaming Requested (count = 0 or all historical sent):
→ Subscribe to ZMQ Events
→ On New Block:
→ Format Block Header
→ Send to Client
→ On New ChainLock:
→ Format ChainLock
→ Send to Client
→ On Client Disconnect:
→ Clean Up Subscriptions
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add a language identifier to the code block for syntax highlighting.

The block outlining the code flow starts with triple backticks but no language. To improve readability and linting, specify a language (e.g., text or mermaid) or simply bash/plaintext if it’s a diagram:

- ```
+ ```text
Client Request 
  → gRPC Server 
    → subscribeToBlockHeadersWithChainLocksHandler 
      → Validate Parameters
      …
      → On Client Disconnect:
        → Clean Up Subscriptions
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

66-66: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

Comment on lines +77 to +93
```
Client Request
→ gRPC Server
→ getStatusHandler
→ Check Cache
→ If Valid: Return Cached Status
→ If Invalid:
→ Parallel Requests (Promise.allSettled):
→ Drive Status
→ Tenderdash Status
→ Tenderdash Network Info
→ Process All Results
→ Handle Any Failed Requests
→ Calculate Derived Fields
→ Cache Response
→ Return Complete Status
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Specify a language for the code‐flow block.

The “Code Flow” diagram uses a fenced block without a language. Adding text (or another appropriate identifier) will satisfy lint rules and improve readability:

- ```
+ ```text
Client Request 
  → gRPC Server 
    → getStatusHandler 
      → Check Cache
      …
      → Return Complete Status

@shumkov shumkov self-assigned this Apr 18, 2025
@shumkov shumkov moved this to In review / testing in Platform team Apr 18, 2025
Copy link
Member

@QuantumExplorer QuantumExplorer left a comment

Choose a reason for hiding this comment

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

Thephez says I can merge this one in.

@QuantumExplorer QuantumExplorer merged commit cd062be into v2.0-dev May 8, 2025
20 checks passed
@QuantumExplorer QuantumExplorer deleted the docs/dapi branch May 8, 2025 22:18
@github-project-automation github-project-automation bot moved this from In review / testing to Done in Platform team May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants