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

  • New Features
    • Added configurable maximum gRPC message decoding size to request settings.
    • Optimized message size limits for specific operations: balance change queries now default to 16 MB, while state transition and transaction subscription requests allow explicit override.
    • Enhanced handling of large response payloads across SDKs.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

A new optional max_decoding_message_size configuration field is added to RequestSettings structs across multiple packages (rs-dapi-client, rs-sdk, wasm-sdk) to allow controlling gRPC maximum decoding message size. The field is propagated through request merging and finalization logic, applied during channel creation, and set with custom overrides for specific request types.

Changes

Cohort / File(s) Summary
RequestSettings struct extension
packages/rs-dapi-client/src/request_settings.rs
Added max_decoding_message_size: Option<usize> field to RequestSettings and AppliedRequestSettings. Updated default() constructor, override_by() merge logic, and finalize() method to propagate the new field.
gRPC channel creation and request overrides
packages/rs-dapi-client/src/transport/grpc.rs
Modified PlatformGrpcClient and CoreGrpcClient to apply max_decoding_message_size when creating channels. Updated SETTINGS_OVERRIDES for GetRecentCompactedAddressBalanceChangesRequest (16 MB), WaitForStateTransitionResultRequest (None), and TransactionsWithProofsRequest (None).
SDK defaults
packages/rs-sdk/src/sdk.rs
Initialized max_decoding_message_size to None in DEFAULT_REQUEST_SETTINGS.
WebAssembly SDK settings conversion
packages/wasm-sdk/src/settings.rs
Extended From<RequestSettingsInput> implementation to initialize max_decoding_message_size to None when converting to RequestSettings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A field hops in, so neat and right,
Decoding sizes, configured tight,
From SDK to gRPC with care we send,
Sixteen megabytes, a generous friend!
Our channels flow with measured pace,
Configuration's gentle embrace. 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(dapi): allow setting max grpc response size' is clear, concise, and directly describes the main feature addition: enabling configuration of the maximum gRPC response size limit.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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),
         }

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