2

There seems to be a bug in the block reward calculation in Babylon.

For example, in block 664451 there were 26 endorsements. So the reward should be 16 * (0.8 + 0.2 * 26 / 32) = 15.4 XTZ (source). But the baker got 14.4 XTZ.

Can someone explain how the reward is actually calculated, and why there is a discrepancy between the expected amount and the actual reward?

4

The exact formula used in Babylon can be found here:

https://gitlab.com/tezos/tezos/blob/mainnet/src/proto_005_PsBabyM1/lib_protocol/baking.ml#L190

This comes to:

((16 000 000 * (8 + 2 * e / 32)) / 10) / (1 + p)

But note that these are integer divisions, hence, in your example:

8 + 2 * 26 / 32 = 8 + 52 / 32 = 8 + 1 = 9

16 000 000 μꜩ * 9 = 144 000 000 μꜩ

144 000 000 μꜩ / 10 = 14 400 000 μꜩ = 14.4 ꜩ

Edit: This feedback is from the Tezos developers TG group. You can view this spreadsheet to better understand the calculation of block rewards: https://files.fm/u/hb5eazkk

  • Correct formula ought to be – Arthur B Oct 28 '19 at 10:55
  • 1
    (16 000 000 * (256 + 2 * e)) / (320 * (1 + p)) – Arthur B Oct 28 '19 at 10:55
  • Thanks! Could you please add sources/reference to some description and implementation ? – Ezy Oct 28 '19 at 11:19
1

This is a bug in babylon caused by using an integer division in a wrong place and will be fixed in the next proposal.
For now you can use the following formula to calculate the rewards :
The formula is : ((16 000 000 * (8 + floor(2 * e / 32))) / 10) / (1 + p)
More info : https://twitter.com/iguerDUNE/status/1184095825296871425

  • Thanks! Could you please provide sources ? Context ? Implementation etc ? – Ezy Oct 28 '19 at 11:21
  • This is actually a bug in babylon. there should not be the floor function, but they used an integer division which has caused this behavior. This will be fixed in the next proposal. – FiFtHeLeMeNt Oct 28 '19 at 11:30
  • Yes so it would be great if you could contextualize the answer, and provide more infos, links etc so that everyone can understand – Ezy Oct 28 '19 at 11:31
  • I provided more info :) – FiFtHeLeMeNt Oct 28 '19 at 11:35
  • Hi this is not official info. Would it be possible you refer to official doc or implementation maybe ? – Ezy Oct 28 '19 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.