core-rs-albatross icon indicating copy to clipboard operation
core-rs-albatross copied to clipboard

Output reward inherent logs as transaction logs

Open sisou opened this issue 2 years ago • 3 comments

Validator rewards are publicly represented as transactions with transaction hashes. They are represented as coinbase transactions in macro blocks, they are returned in the get_transaction_by_address RPC call and can be queried by their transaction hash with get_transaction_by_hash.

Therefore I found it to be consistent that rewards are also represented in the transaction logs of block event subscriptions.

This requires a transaction to be created from the inherent however, to compute the transaction hash under which it will be accessible.

sisou avatar Jul 06 '22 14:07 sisou

Codecov Report

Base: 64.69% // Head: 64.88% // Increases project coverage by +0.19% :tada:

Coverage data is based on head (b5ce2a0) compared to base (b48858a). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@              Coverage Diff              @@
##           albatross     #923      +/-   ##
=============================================
+ Coverage      64.69%   64.88%   +0.19%     
=============================================
  Files            373      375       +2     
  Lines          45163    46120     +957     
=============================================
+ Hits           29216    29927     +711     
- Misses         15947    16193     +246     
Flag Coverage Δ
unittests 64.88% <100.00%> (+0.19%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
block-production/src/lib.rs 99.64% <100.00%> (+0.01%) :arrow_up:
block-production/src/test_custom_block.rs 99.72% <100.00%> (+0.01%) :arrow_up:
blockchain/src/blockchain/accounts.rs 95.02% <100.00%> (+0.08%) :arrow_up:
blockchain/src/blockchain/history_sync.rs 79.44% <100.00%> (+2.11%) :arrow_up:
primitives/account/src/accounts.rs 94.26% <100.00%> (+0.69%) :arrow_up:
test-utils/src/node.rs 91.66% <0.00%> (-1.07%) :arrow_down:
consensus/src/sync/history/cluster.rs 87.75% <0.00%> (-0.68%) :arrow_down:
consensus/src/sync/history/sync_clustering.rs 88.74% <0.00%> (-0.32%) :arrow_down:
test-utils/src/blockchain.rs 91.32% <0.00%> (-0.18%) :arrow_down:
lib/src/client.rs 0.00% <0.00%> (ø)
... and 25 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jul 06 '22 15:07 codecov[bot]

Rebased branch to correctly reflect the changes since GH auto-changed the PR base to albatross

jsdanielh avatar Jul 06 '22 22:07 jsdanielh

@ii-cruz The network ID is required to create transactions and calculate their hash. Since the rewards are converted into transactions, the place where that transaction is constructed and the hash is computed requires the current network ID.

Basically here https://github.com/nimiq/core-rs-albatross/pull/923/files#diff-786bcafe3374f1aa08d803a68924ccf5092fc893053dc4444bd7fa680418e4e3R501 and here https://github.com/nimiq/core-rs-albatross/pull/923/files#diff-786bcafe3374f1aa08d803a68924ccf5092fc893053dc4444bd7fa680418e4e3R546

sisou avatar Jul 08 '22 16:07 sisou

Not a priority at the moment and needs more discussion.

paberr avatar Mar 21 '23 00:03 paberr