Skip to content

Conversation

@lklimek
Copy link
Contributor

@lklimek lklimek commented Jan 16, 2026

Issue being fixed or feature implemented

GetRecentCompactedAddressBalanceChangesResponse can have 100 values * 2048 addresses * ~44 bytes each = ~9MB.
Right now, we have a default limit of gRPC response in rs-sdk and rs-dapi set to default 4MB.

This causes errors like:

 error=Grpc(Status { code: OutOfRange, message: "Error, decoded message length too large: found 9037453 bytes, the limit is: 4194304 bytes"

What was done?

Added mechanism to rs-dapi-client that allows setting max response size.
Set max response size for GetRecentCompactedAddressBalanceChangesResponse to 16MB to be safe.

How Has This Been Tested?

To be tested during testnet testing.

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

Release Notes

  • Performance Improvements
    • Optimized handling of large response payloads through enhanced message decoding size configuration, improving reliability for data-intensive operations.
    • Refined processing parameters for address balance queries to ensure stable performance under load.
    • Enhanced overall data transfer efficiency across multiple request types.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

This PR introduces a max_decoding_message_size configuration field across the SDK and DAPI client packages to control gRPC message decoding limits. The field is added to RequestSettings structs, propagated through request override logic, applied to gRPC channels, and used to set specific decoding limits for particular request types. Additionally, the verification limit for address balance changes is reduced from 100 to 25 to align with query handler constraints.

Changes

Cohort / File(s) Summary
RequestSettings field definition and propagation
packages/rs-dapi-client/src/request_settings.rs
Added max_decoding_message_size: Option<usize> field to RequestSettings and AppliedRequestSettings structs. Updated default() to initialize field to None, override_by() to merge the field using Some/None precedence, and finalize() to propagate it to AppliedRequestSettings.
gRPC channel creation and request overrides
packages/rs-dapi-client/src/transport/grpc.rs
Applied max_decoding_message_size from settings when creating gRPC channels. Updated SETTINGS_OVERRIDES for three request types: GetRecentCompactedAddressBalanceChangesRequest (16 MB limit), WaitForStateTransitionResultRequest (explicit None), TransactionsWithProofsRequest (explicit None).
SDK RequestSettings initialization
packages/rs-sdk/src/sdk.rs, packages/wasm-sdk/src/settings.rs
Added max_decoding_message_size field to RequestSettings with initialization to None in default settings and conversion implementations.
Address balance changes limit alignment
packages/rs-drive-abci/src/query/address_funds/recent_compacted_address_balance_changes/v0/mod.rs, packages/rs-drive-proof-verifier/src/proof.rs
Added clarifying comment in rs-drive-abci noting limit should match rs-drive-proof-verifier. Changed verification limit in rs-drive-proof-verifier from 100 to 25 for GetRecentCompactedAddressBalanceChanges handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A message size most grand appears,
Through gRPC channels, crystal clear!
Sixteen megs for balance checks so deep,
While limits trim from one hundred to twenty-five to keep,
Settings flow like carrots in the spring! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the pull request: adding functionality to allow configuration of the maximum gRPC response size in the dapi client.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added this to the v3.0.0 milestone Jan 16, 2026
@github-actions
Copy link

github-actions bot commented Jan 16, 2026

✅ gRPC Query Coverage Report

================================================================================
gRPC Query Coverage Report - NEW QUERIES ONLY
================================================================================

Total queries in proto: 53
Previously known queries: 47
New queries found: 6

================================================================================

New Query Implementation Status:
--------------------------------------------------------------------------------
✓ getAddressInfo                                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✓ getAddressesBranchState                       /home/runner/work/platform/platform/packages/rs-sdk/src/platform/address_sync/mod.rs
✓ getAddressesInfos                             /home/runner/work/platform/platform/packages/rs-sdk/src/platform/fetch_many.rs
✓ getAddressesTrunkState                        /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✓ getRecentAddressBalanceChanges                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✓ getRecentCompactedAddressBalanceChanges       /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs

================================================================================
Summary:
--------------------------------------------------------------------------------
New queries implemented: 6 (100.0%)
New queries missing: 0 (0.0%)

Total known queries: 53
  - Implemented: 50
  - Not implemented: 2
  - Excluded: 1

Not implemented queries:
  - getConsensusParams
  - getTokenPreProgrammedDistributions

@lklimek lklimek marked this pull request as ready for review January 20, 2026 12:58
@lklimek
Copy link
Contributor Author

lklimek commented Jan 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/wasm-sdk/src/settings.rs (1)

65-73: Expose maxDecodingMessageSize in WASM bindings.
Right now this field is always None because the TS interface and RequestSettingsInput don’t accept it, so JS callers can’t configure the limit.

💡 Suggested update
@@
 export interface RequestSettings {
@@
   /**
    * Whether to ban failed addresses.
    * `@default` true
    */
   banFailedAddress?: boolean;
+
+  /**
+   * Maximum gRPC response size in bytes (decoding limit).
+   */
+  maxDecodingMessageSize?: number;
 }
@@
 struct RequestSettingsInput {
     retries: Option<u32>,
     timeout_ms: Option<u64>,
     connect_timeout_ms: Option<u64>,
     ban_failed_address: Option<bool>,
+    max_decoding_message_size: Option<u64>,
 }
@@
         RequestSettings {
             retries: input.retries.map(|r| r as usize),
             timeout: input.timeout_ms.map(Duration::from_millis),
             connect_timeout: input.connect_timeout_ms.map(Duration::from_millis),
             ban_failed_address: input.ban_failed_address,
-            max_decoding_message_size: None,
+            max_decoding_message_size: input.max_decoding_message_size.map(|v| v as usize),
         }

@lklimek lklimek force-pushed the feat/sdk-max-request-size branch from cfe26dc to 5153412 Compare January 21, 2026 12:39
@lklimek lklimek merged commit a6ca062 into v3.0-dev Jan 22, 2026
52 of 55 checks passed
@lklimek lklimek deleted the feat/sdk-max-request-size branch January 22, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants