Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(dapi): return actual fees paid in state transition broadcast responses#2977

Draft
pauldelucia wants to merge 1 commit intov3.0-devfrom
feat/feeResult
Draft

feat(dapi): return actual fees paid in state transition broadcast responses#2977
pauldelucia wants to merge 1 commit intov3.0-devfrom
feat/feeResult

Conversation

Copy link
Member

pauldelucia commented Jan 12, 2026

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

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 bot added this to the v3.0.0 milestone Jan 12, 2026
Copy link
Contributor

github-actions bot commented Jan 12, 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

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

Reviewers

QuantumExplorer Awaiting requested review from QuantumExplorer QuantumExplorer will be requested when the pull request is marked ready for review QuantumExplorer is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.1.0

Development

Successfully merging this pull request may close these issues.

2 participants