Code Monkey home page Code Monkey logo

Comments (10)

habanoz avatar habanoz commented on May 26, 2024 1

I have created a wiki page on rounding.

https://github.com/habanoz/tezos-reward-distributor/wiki/Payment-Rounding

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

My view is as-is should be preserved due to following arguments:

  • I support the minimum payment amount policy for 0 fee customers.
  • The leftovers are tiny and can still be regarded as 0.
  • If delegation is so small that the reward amount is less than 1 millis, the delegate may need to pay the transfer fee for nothing in return.

from tezos-reward-distributor.

nurikabe avatar nurikabe commented on May 26, 2024

Probably a dumb question, but: Why is the min payment amount limited to 0.###?

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

@nurikabe minimum payment amount is 1 milli-tezos. This is a choice made. It could have been a different amount, but I believe 1 milli-tezos is a fair amount.

Please note that a large min payment amount may result in a significant deduction from delegators share. A tiny min payment amount on the other hand may result in transfers amounting less than transfer fee.

I believen It is a good practive to limit decimal places. It is present in payment systems dealing with fiat currencies. After 3 digits decimals makes no sense for the delegator but it makes calculations harder. 1.23+0.345 and 1.230123+0.345002. Former is more managable.

from tezos-reward-distributor.

nurikabe avatar nurikabe commented on May 26, 2024

Could we make this a configuation parameter set to a sensible default of one-milli-tezos?

There are probably some edge cases we can't imagine where users may want to change this. For example, in my case I want to change minimum payout amount in dry-run mode to sanity check the numbers.

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

For example, in my case I want to change the minimum payout amount in dry-run mode to sanity check the numbers.

Could you please provide some more details? I wish to understand how this will going to be useful.

If it will be helpful, we can add another parameter. However, I am afraid that more parameters will move the application into configuration hell. Let's just add parameters that many people will benefit from.

from tezos-reward-distributor.

nurikabe avatar nurikabe commented on May 26, 2024

For example, in my case I want to change the minimum payout amount in dry-run mode to sanity check the numbers.

Could you please provide some more details? I wish to understand how this will going to be useful.

I did some dry runs to make sure the calculations made sense. I was unaware of the rounding behavior; hence delegate calculations looked incorrect. This resulted in #26.

At the very least I think this rounding behavior should be clearly documented.

Personally I would like to turn the rounding off so that I can more easily review the calculations.

Similarly I can imagine wanting to change this rounding level in the future.

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

OK. Let's make rounding behavior documented and configurable. Let's give the option to close the rounding behavior.

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

Rounding behaviour is set to be configurable. pymnt_scale parameter is added to BusinessConfigurationX.py. Default is 3. It can be set to None to turn rounding off.

Example results are given below. Baking fee was 0.

When scale is 3.

2019-02-03 23:02:23,274 - main - INFO - producer  - Reward created for cycle 57 address KT1BTr7z2SBpDxgUV7xR7mNmQzwaTDYDkuHz amount 4.793000 fee 0.000280 tz type D
2019-02-03 23:02:23,274 - main - INFO - producer  - Reward created for cycle 57 address KT1MMhmTkUoHez4u58XMZL7NkpU9FWY4QLn2 amount 1.206000 fee 0.000000 tz type O
2019-02-03 23:02:23,275 - main - INFO - producer  - Reward created for cycle 57 address tz1MWTkFRXA2dwez4RHJWnDWziLpaN6iDTZ9 amount 0.000999 fee 0.000000 tz type F

Some insight on calculations:

total rewards = 6
delegators reward = 4.793280
delegators pymnt  =  scale(4.79328,3) = 4.793000
owners total reward = 6 - 4.79328 = 1.2067199999999998
owners pymnt = scale(1.2067199999999998, 3) = 1.206
founders tota reward = 6 - ( 4.793000 + 1.206 ) = 0.0009999999999998899
founders pymnt = scale(0.0009999999999998899,6) = 0.000999
total_pymnt = 4.793 + 1.206 + 0.000999 = 5.999999000000001

When rounding is turned off.

2019-02-03 23:00:55,202 - main - INFO - producer  - Reward created for cycle 57 address KT1BTr7z2SBpDxgUV7xR7mNmQzwaTDYDkuHz amount 4.793280 fee 0.000000 tz type D
2019-02-03 23:00:55,203 - main - INFO - producer  - Reward created for cycle 57 address KT1MMhmTkUoHez4u58XMZL7NkpU9FWY4QLn2 amount 1.206720 fee 0.000000 tz type O
2019-02-03 23:00:55,203 - main - INFO - producer  - Reward created for cycle 57 address tz1MWTkFRXA2dwez4RHJWnDWziLpaN6iDTZ9 amount 0.000000 fee 0.000000 tz type F

from tezos-reward-distributor.

habanoz avatar habanoz commented on May 26, 2024

Closing this issue. Get update. Test. Feel free to re-open.

from tezos-reward-distributor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.