Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pos_getClaimableRewards return value for each stake #5386

Closed
przemerr opened this issue Sep 29, 2023 · 1 comment · Fixed by #5395
Closed

Make pos_getClaimableRewards return value for each stake #5386

przemerr opened this issue Sep 29, 2023 · 1 comment · Fixed by #5395

Comments

@przemerr
Copy link

Description

Make pos_getClaimableRewards return rewards amount for each staked validator.

Motivation

With the current implementation, pos_getClaimableRewards returns an aggregated value of claimable rewards without considering the contribution of each stake towards the rewards. It's understandable that the rewards are guaranteed by the protocol, and users can trust that the number is correct. However, there are many instances where having a clear distribution of the rewards would be beneficial:

  • when a validator starts missing many blocks, the staker receives less than they should,
  • when a validator gets PoMed or banned, the staker receives no rewards,
  • when a validator at some point has too low self-vote to accommodate for the vote weight, the staker receives lower rewards than usual,
  • when a validator starts increasing its commission.

All of these instances will be hard to notice if a staker votes for many validators.

The change is primarily aimed at improving the wallet experience and may benefit future third-party tools.

If you decide to implement it, please inform the Lisk Service/Desktop team so they can incorporate it into the desktop wallet.

@shuse2 shuse2 removed their assignment Oct 12, 2023
@sridharmeganathan sridharmeganathan transferred this issue from LiskArchive/lisk-sdk Oct 13, 2023
@ManuGowda
Copy link
Contributor

ManuGowda commented Oct 16, 2023

http://devnet-service.liskdev.net:9901/api/v3/transactions/dryrun

Dry run the claim rewards on modal open and filter the events by module: pos and name: rewardsAssigned to show the rewards breakdown.

{
    "data": {
        "result": 1,
        "status": "valid",
        "events": [
            {
                "data": {
                    "address": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "module": "fee",
                    "tokenID": "0400000000000000",
                    "amount": "127000",
                    "result": 0
                },
                "index": 0,
                "module": "token",
                "name": "lock",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "f5f1c9d012408e9452b5a9a22320b761075b9ef6d5fbaae2cd2451422d9d13ec"
            },
            {
                "data": {
                    "address": "lsk5xkyhd2gsx33hksc52jyjtr4bwgs7zfx3v9bod",
                    "module": "pos",
                    "tokenID": "0400000000000000",
                    "amount": "225495187",
                    "result": 0
                },
                "index": 1,
                "module": "token",
                "name": "unlock",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lsk5xkyhd2gsx33hksc52jyjtr4bwgs7zfx3v9bod"
                ],
                "height": 332087,
                "id": "d23108a6bed3148236fbad8cbad01ee148525e4f45e73b73d570e04b9825d3eb"
            },
            {
                "data": {
                    "senderAddress": "lsk5xkyhd2gsx33hksc52jyjtr4bwgs7zfx3v9bod",
                    "recipientAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "tokenID": "0400000000000000",
                    "amount": "225495187",
                    "result": 0
                },
                "index": 2,
                "module": "token",
                "name": "transfer",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lsk5xkyhd2gsx33hksc52jyjtr4bwgs7zfx3v9bod",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "1459e6a3bb1cb3b320aa952ee729cab2007c63ec63e741607a57e755a3bea1fa"
            },
            {
                "data": {
                    "stakerAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "validatorAddress": "lsk5xkyhd2gsx33hksc52jyjtr4bwgs7zfx3v9bod",
                    "tokenID": "0400000000000000",
                    "amount": "225495187"
                },
                "index": 3,
                "module": "pos",
                "name": "rewardsAssigned",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "e083d4d87e6ecbe67ffc0cf78996f02455ab50a74c37801c833bd47169238315"
            },
            {
                "data": {
                    "address": "lskruwgk9vrrduhw65o3zz9ddqbadtbv7o85pzapb",
                    "module": "pos",
                    "tokenID": "0400000000000000",
                    "amount": "70902439",
                    "result": 0
                },
                "index": 4,
                "module": "token",
                "name": "unlock",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskruwgk9vrrduhw65o3zz9ddqbadtbv7o85pzapb"
                ],
                "height": 332087,
                "id": "e3524ffe907f71b7b3bda15b945911a7ff528d8d8dccea70ab0062f8dbea2e94"
            },
            {
                "data": {
                    "senderAddress": "lskruwgk9vrrduhw65o3zz9ddqbadtbv7o85pzapb",
                    "recipientAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "tokenID": "0400000000000000",
                    "amount": "70902439",
                    "result": 0
                },
                "index": 5,
                "module": "token",
                "name": "transfer",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskruwgk9vrrduhw65o3zz9ddqbadtbv7o85pzapb",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "47eb61d3e8668efdc9a7420c7409d1ab12b9210c9af08c3601be776b0d8c431e"
            },
            {
                "data": {
                    "stakerAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "validatorAddress": "lskruwgk9vrrduhw65o3zz9ddqbadtbv7o85pzapb",
                    "tokenID": "0400000000000000",
                    "amount": "70902439"
                },
                "index": 6,
                "module": "pos",
                "name": "rewardsAssigned",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "0ab326c5480ad6b0a54e5e2bbdd7b1c36b225acdf27022e9133eefcc84a04155"
            },
            {
                "data": {
                    "address": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "module": "fee",
                    "tokenID": "0400000000000000",
                    "amount": "127000",
                    "result": 0
                },
                "index": 7,
                "module": "token",
                "name": "unlock",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "2d98216b258c27d554b405084d5fc05b6f487ac08df176cbf0c33f72b6da1579"
            },
            {
                "data": {
                    "senderAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "recipientAddress": "lsk47awwg7pmd6zysdbaxajapuhdkr6g432ofkftx",
                    "tokenID": "0400000000000000",
                    "amount": "66000",
                    "result": 0
                },
                "index": 8,
                "module": "token",
                "name": "transfer",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "lsk47awwg7pmd6zysdbaxajapuhdkr6g432ofkftx"
                ],
                "height": 332087,
                "id": "21556e1db603993991307fcec1fe911c3ff6e059a88ffa1ede0b0ca87c760e29"
            },
            {
                "data": {
                    "address": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "tokenID": "0400000000000000",
                    "amount": "61000",
                    "result": 0
                },
                "index": 9,
                "module": "token",
                "name": "burn",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp"
                ],
                "height": 332087,
                "id": "792aef3d365f751192d4766938b3e76d2b23aedce8495416fd6ac569c0603fab"
            },
            {
                "data": {
                    "senderAddress": "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "generatorAddress": "lsk47awwg7pmd6zysdbaxajapuhdkr6g432ofkftx",
                    "burntAmount": "61000",
                    "generatorAmount": "66000"
                },
                "index": 10,
                "module": "fee",
                "name": "generatorFeeProcessed",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607",
                    "lskbgyrx3v76jxowgkgthu9yaf3dr29wqxbtxz8yp",
                    "lsk47awwg7pmd6zysdbaxajapuhdkr6g432ofkftx"
                ],
                "height": 332087,
                "id": "672c49586b389c3f7ed8bc6cdb0fab7a6290900dcfdf37077208e8e9c1f29998"
            },
            {
                "data": {
                    "success": true
                },
                "index": 11,
                "module": "pos",
                "name": "commandExecutionResult",
                "topics": [
                    "a00e6c2764c95b74bdea6a85f0d1dcad24b2722a4691521fd15f449cfceb6607"
                ],
                "height": 332087,
                "id": "e53483b240e865744814b5bc0b431b3c45913e29d94bab768c20b33ceb8c1200"
            }
        ]
    },
    "meta": {}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants