Skip to content

Conversation

@pauldelucia
Copy link
Member

Issue being fixed or feature implemented

It would be nice if clients (like dash-evo-tool) could know the actual fees paid for state transitions without having to fetch identity balances before and after. Something similar to how Ethereum returns gasUsed in transaction receipts. Previously, WaitForStateTransitionResultResponse only returned proof or error without the fee breakdown, even though the fee information was calculated internally in StateTransitionExecutionResult::SuccessfulExecution.

What was done?

  • Proto: Added FeeResult message with processing_fee, storage_fee, and removed_from_system fields. Added optional fee_result field to WaitForStateTransitionResultResponseV0.

  • Drive: Encode fee result into ExecTxResult.data during state transition execution (20 bytes: 8 + 8 + 4 for processing_fee, storage_fee, removed_bytes). Included for both successful executions and paid consensus errors.

  • DAPI: Decode fee data from Tenderdash transaction results (both websocket events and existing tx queries). Populate fee_result field in gRPC responses for success and paid error cases.

  • SDK: Added FeeResult struct and StateTransitionBroadcastResult<T> wrapper. Added new trait methods broadcast_and_wait_with_fee() and wait_for_response_with_fee() that return fee information alongside the proof result. Existing methods unchanged for backwards compatibility.

How Has This Been Tested?

  • Unit tests added for fee encoding in Drive (test_encode_fee_result, test_encode_fee_result_zero_values, test_encode_fee_result_max_values)
  • Unit tests added for fee decoding in DAPI (test_decode_fee_result_valid, test_decode_fee_result_zero_values, test_decode_fee_result_too_short, test_decode_fee_result_empty, test_decode_fee_result_extra_bytes)
  • Unit tests added for SDK FeeResult conversion (test_fee_result_from_grpc, test_fee_result_total_no_overflow)
  • All tests pass with cargo test

Breaking Changes

None - existing broadcast_and_wait() and wait_for_response() methods remain unchanged. New methods are additive.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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 12, 2026
@github-actions
Copy link

✅ 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

@QuantumExplorer QuantumExplorer modified the milestones: v3.0.0, v3.1.0 Jan 13, 2026
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