Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

Establish how much more was allocated to each worker for term 32 #5145

Closed ignazio-bovo closed 3 months ago

ignazio-bovo commented 4 months ago

I have erroneously set the reward per block to a too high number. The previous DWG board item solves the unnecessary DWG debt that should be zero. Now I need to figure out how much each worker has been paid since the erroneous start of the term. This can be achieved, for instance, by inspecting the subscan tool with the reward account for each worker (which can be view on the DWG entity on the chain). From there I will figure out:

DWG workers and councilors will be clearly notify of all of this.

ignazio-bovo commented 4 months ago

Reward paid can be extracted from the QN with the following (7012830 is the term 32 starting block)

query dwgWorkerRewards {
    rewardPaidEvents(
        where: {
            inBlock_gte: 7012830
            group: { id_eq: "distributionWorkingGroup" }
            inBlock_lte: 7314596
        }
    ) {
        inBlock
        createdAt
        amount
        worker {
            membership {
                handle
            }
        }
    }
}
ignazio-bovo commented 4 months ago

Amount column (see appendix) can then be aggregated by member handle and compared with the actual plan. The amount is in HAPI format

Member Amount paid Amount established surplus/deficit
spoonbender 1,726,819,253,861,310.00 155,714,200,000,000.00 1,571,105,053,861,310.00
p0k 31,425,732,513,341.00 155,714,200,000,000.00 -124,288,467,486,659.00
mr_bovo 72,450.00 986,666,700,000,000.00 -986,666,699,927,550.00
klaudiusz 48,176,437,230,180.00 244,761,800,000,000.00 -196,585,362,769,820.00
0x2bc 484,180,330,533,350.00 155,714,200,000,000.00 328,466,130,533,350.00
sieemma 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00
Deathix 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00

The procedure to rebalance DWG salaries is the following:

ignazio-bovo commented 4 months ago

Future direction

A few observations, we have now joyutils which allows you to set block reward given the usd amount at each term. I would however prefer to pay directly the amounts say 5 days or so before term ends, so that the amount paid to each worker are exact For amount computation and plan + report I will set up a notion worksheet so that I can simply paste the amounts with no errors

ignazio-bovo commented 4 months ago

Appendix

  1. For transparency the data from the query node looks like. (Amount column is in HAPI)
inBlock createdAt amount workermembershiphandle
7013160 2024-04-11T08:52:30.000Z 5336170572600 spoonbender
7013160 2024-04-11T08:52:30.000Z 5336170572600 p0k
7013160 2024-04-11T08:52:30.000Z 14490 mr_bovo
7013160 2024-04-11T08:52:30.000Z 5336170572600 klaudiusz
7013160 2024-04-11T08:52:30.000Z 3049239375000 klaudiusz
7013160 2024-04-11T08:52:30.000Z 5336170572600 0x2bc
7013160 2024-04-11T08:52:30.000Z 5336170572600 Deathix
7013160 2024-04-11T08:52:30.000Z 5336170572600 sieemma
7027650 2024-04-12T09:01:30.000Z 5336170572600 spoonbender
7027650 2024-04-12T09:01:30.000Z 5336170572600 p0k
7027650 2024-04-12T09:01:30.000Z 14490 mr_bovo
7027650 2024-04-12T09:01:30.000Z 5336170572600 klaudiusz
7027650 2024-04-12T09:01:30.000Z 3049239375000 klaudiusz
7027650 2024-04-12T09:01:30.000Z 5336170572600 0x2bc
7027650 2024-04-12T09:01:30.000Z 5336170572600 Deathix
7027650 2024-04-12T09:01:30.000Z 5336170572600 sieemma
7042140 2024-04-13T09:10:42.000Z 5336170572600 spoonbender
7042140 2024-04-13T09:10:42.000Z 5336170572600 p0k
7042140 2024-04-13T09:10:42.000Z 14490 mr_bovo
7042140 2024-04-13T09:10:42.000Z 5336170572600 klaudiusz
7042140 2024-04-13T09:10:42.000Z 3049239375000 klaudiusz
7042140 2024-04-13T09:10:42.000Z 5336170572600 0x2bc
7042140 2024-04-13T09:10:42.000Z 5336170572600 Deathix
7042140 2024-04-13T09:10:42.000Z 5336170572600 sieemma
7056630 2024-04-14T09:23:00.000Z 5336170572600 spoonbender
7056630 2024-04-14T09:23:00.000Z 5336170572600 p0k
7056630 2024-04-14T09:23:00.000Z 14490 mr_bovo
7056630 2024-04-14T09:23:00.000Z 5336170572600 klaudiusz
7056630 2024-04-14T09:23:00.000Z 3049239375000 klaudiusz
7056630 2024-04-14T09:23:00.000Z 5336170572600 0x2bc
7056630 2024-04-14T09:23:00.000Z 5336170572600 Deathix
7056630 2024-04-14T09:23:00.000Z 5336170572600 sieemma
7071120 2024-04-15T09:51:12.000Z 5336170572600 spoonbender
7071120 2024-04-15T09:51:12.000Z 5336170572600 p0k
7071120 2024-04-15T09:51:12.000Z 14490 mr_bovo
7071120 2024-04-15T09:51:12.000Z 5336170572600 klaudiusz
7071120 2024-04-15T09:51:12.000Z 3049239375000 klaudiusz
7071120 2024-04-15T09:51:12.000Z 5336170572600 0x2bc
7071120 2024-04-15T09:51:12.000Z 5336170572600 Deathix
7071120 2024-04-15T09:51:12.000Z 5336170572600 sieemma
7085610 2024-04-16T10:09:24.000Z 5336170572600 spoonbender
7085610 2024-04-16T10:09:24.000Z 4744879650341 p0k
7085610 2024-04-16T10:09:24.000Z 3049239375000 klaudiusz
7085610 2024-04-16T10:09:24.000Z 5336170572600 0x2bc
7085610 2024-04-16T10:09:24.000Z 5336170572600 Deathix
7085610 2024-04-16T10:09:24.000Z 5336170572600 sieemma
7172550 2024-04-22T11:31:54.000Z 559597906235970 spoonbender
7172550 2024-04-22T11:31:54.000Z 452163307097750 0x2bc
7172550 2024-04-22T11:31:54.000Z 1.1352E+15 spoonbender
7172550 2024-04-22T11:31:54.000Z 3200148117180 klaudiusz
ignazio-bovo commented 4 months ago

DWG first refund: coming from 0x2bc amount

jen4ph commented 4 months ago

I like that all the necessary info was written above clearly and the issue is being resolved accordingly.

ignazio-bovo commented 4 months ago

From there worker 23 has been rewarded with missing reward equal to JOY: 5570.5908877146 via the scheduled reward logic. I also awarded (accidentally) the same amount of JOY via spendFromBudget extrinsic (which unfortunately doesn't alter the missing reward field in the worker chain status). The DWG debt has been finally set to 0. The pioneer doesn't display properly that because of a QN bug, but it can be seen by querying the DWG worker status on chain via polkadot-js. Hence the table now becomes:

Member Amount paid Amount established surplus/deficit
spoonbender 1,726,819,253,861,310.00 155,714,200,000,000.00 1,421,105,053,861,310.00
p0k 31,425,732,513,341.00 155,714,200,000,000.00 -124,288,467,486,659.00
mr_bovo 72,450.00 986,666,700,000,000.00 -986,666,699,927,550.00
klaudiusz 48,176,437,230,180.00 244,761,800,000,000.00 -196,585,362,769,820.00
0x2bc ✅ 155,714,200,000,000.00 155,714,200,000,000.00 0.00
sieemma 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00
Deathix 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00
MMX 111,411,817,754,292.00 155,714,200,000,000.00 -44,302,382,245,708.00

I will close the issue once all workers have been correctly compensated

ignazio-bovo commented 4 months ago

spoonbender has already spent almost all the money, now the only possible solution is the following:

  1. spoondbender can give back only 15,000 JOY.
  2. I will forego my salary this term and I will personally fund the budget with the remaining amount such that workers get paid regularly this term. Notice that doing this the debt becomes basically between me and spoonbender and not between him and the DAO. If either party decides to leave the DWG earlier I'll take the loss basically
  3. For the future I will reward 55$ per term to worker spoonbender his remaining 324$ - 55$ = 269$ salary will be added to my salary until the amount of 3300$ has been recouped in tranches of 269$. This will take 13 terms to fully complete
ignazio-bovo commented 4 months ago

Conclusion

I have transferred to the DWG budget: 61257.0565630987 JOY and repaid the remaining workers. So everyone got paid at least the amount planned during the term From the remaining time here's the dept position of worker spoonbender:

Hence worker spoonbender ows in total 1421105053861310 HAPI = 142110.5053861 JOY to me + DWG budget

Next Steps

  1. For the next 4 terms or so his salary will be reduced to the JOY equivalent of 55$ dollar until his debt position against the DWG will be reduced
  2. From there on he will still get paid the same amount (55$) but that's a private arrangement between me and him to estinguish his debt position against me
Final debt table setup (HAPI with 2 decimals to ignore) Member Amount paid Amount established surplus/deficit Remaining paid
spoonbender 1,726,819,253,861,310.00 155,714,200,000,000.00 1,571,105,053,861,310.00 1,421,105,053,861,310.00 0
p0k 31,425,732,513,341.00 155,714,200,000,000.00 -124,288,467,486,659.00 0 124,288,467,486,659.00
mr_bovo 72,450.00 986,666,700,000,000.00 -986,666,699,927,550.00 -986,666,699,927,550.00 0.00
klaudiusz 48,176,437,230,180.00 244,761,800,000,000.00 -196,585,362,769,820.00 0 196,585,362,769,820.00
0x2bc 484,180,330,533,350.00 155,714,200,000,000.00 328,466,130,533,350.00 0 0
sieemma 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00 0 123,697,176,564,400.00
Deathix 32,017,023,435,600.00 155,714,200,000,000.00 -123,697,176,564,400.00 0 123,697,176,564,400.00
MMX 111,411,817,754,292.00 155,714,200,000,000.00 -44,302,382,245,708.00 0 44,302,382,245,708.00
ignazio-bovo commented 4 months ago

From the above, converting the JOY amounts into USD with ema30(term 32) = .021 Spoonbender ows to me: 2072.0 USD (term salary) Spoonbender ows to the DWG budget: 1286.4 USD

An operator salary is 327USD per term, If we set his salary to 55USD per term it means that the remaining 272USD are going to