feat(dapi): return actual fees paid in state transition broadcast responses#2977
feat(dapi): return actual fees paid in state transition broadcast responses#2977pauldelucia wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. Comment |
✅ gRPC Query Coverage Report |
|
Closing during housekeeping. The original author is no longer with the project, this never came out of draft, and there's no human review on record. The underlying idea — surfacing actual fees paid back to the client in the broadcast response, the way Ethereum returns
Anyone picking this up later: the |
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
gasUsedin transaction receipts. Previously,WaitForStateTransitionResultResponseonly returned proof or error without the fee breakdown, even though the fee information was calculated internally inStateTransitionExecutionResult::SuccessfulExecution.What was done?
Proto: Added
FeeResultmessage withprocessing_fee,storage_fee, andremoved_from_systemfields. Added optionalfee_resultfield toWaitForStateTransitionResultResponseV0.Drive: Encode fee result into
ExecTxResult.dataduring 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_resultfield in gRPC responses for success and paid error cases.SDK: Added
FeeResultstruct andStateTransitionBroadcastResult<T>wrapper. Added new trait methodsbroadcast_and_wait_with_fee()andwait_for_response_with_fee()that return fee information alongside the proof result. Existing methods unchanged for backwards compatibility.How Has This Been Tested?
test_encode_fee_result,test_encode_fee_result_zero_values,test_encode_fee_result_max_values)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)test_fee_result_from_grpc,test_fee_result_total_no_overflow)cargo testBreaking Changes
None - existing
broadcast_and_wait()andwait_for_response()methods remain unchanged. New methods are additive.Checklist:
For repository code-owners and collaborators only