ECIP 1039: Monetary policy rounding specification Source

AuthorIsaac Ardis
StatusFinal
TypeStandards Track
CategoryCore
Created2017/11/14

Abstract

This ECIP proposes a precise specification for eventual rounding issues around ECIP-1017 Monetary Policy calculation, particularly around

  • block winner reward calculation
  • block winner reward for including uncles
  • block uncle miner reward for having uncles included in the winning block

The content of the proposal deals exclusively with reward calculation beginning with Era 2.

Motivation

[@rtkacyk] In its current form, [ambiguity in the specification] may lead to different interpretations and implementations that may result in a network split in further eras. See these issues for details:

  • https://github.com/ethereumproject/go-ethereum/issues/352
  • https://github.com/paritytech/parity/issues/6523

Solution

Definitions

  • In this document, the mathematic and code symbol / should be understood as a “floor divide,” and any fractions using / (eg. 1/32) should not be interpreted as floating points.

Block winner reward calculation.

Block winner reward calculation for a given era should be rounded down only once. This can be accomplished using exponentiation. In the following specifications around uncles, use of this strategy will be assumed as well.

eg.

eraBlockReward * 4^era / 5^era

Reasoning: a block reward in this case is always singular, and era number is an essentially arbitrary constant (for any given bock). If the block reward for a given era n is rounded n times, the iterative rounding will eventually cause the final reward to atrophy. I see no reason for magnitude of era to “degrade” the singular block reward.

This, as opposed to the example below (which should NOT be used):

rewardReductionConstant = 4/5
maxBlockReward = 5
eraBlockReward = maxBlockReward # Modified below from initial max reward per era

# Here, rounding would happen n times for n eras
for (era in eras) {
    eraBlockReward = eraBlockReward * depreciationConstant
}

See Block winner comparison table for expected rewards. Note that the discrepency would begin in era 22, where a single rounding will yield 46116860184273879, and iterative rounding will yield 46116860184273878.


Uncle rewards

  • Rewards for both the winning block miner for including and uncles and the miner of the included uncle(s) should round down the winning block reward prior to division by 32 in the calculation of the uncle(s) “bonus” reward.
  • The reward for uncles inclusion should reflect rounding per uncle, as opposed to rounding per “magnitude of uncles,” which to say that an uncles inclusion reward is calculated using 1/32’s (rounded down) of the block winner reward.

Block winner reward for including uncle(s).

  • Uncle(s) inclusion reward should be calculated and rounded down prior to addition with the block winner reward.

eg.

blockWinnerReward = blockWinnerRewardAtEra(n) # Block winner reward rounds down once prior to division
uncleInclusionReward = blockWinnerReward / 32 # Block uncle inclusion reward rounds down per uncle

And then either:

for (uncle in includedUncles) {
     blockWinnerReward = blockWinnerReward + uncleInclusionReward
}

Or:

blockWinnerReward = blockWinnerReward + (nIncludedUncles * uncleInlusionReward)

Reasoning: rounding down happens per uncle, since the reward in this case may be for one or two uncles. Otherwise, far in the future when rounding becomes an issue, a winning block with 2 uncles would get a proportionally higher per-uncle reward than a block with just one uncle. Since I don’t see any reason to incentivize including 2 uncles over 1, I think calculation should be done per uncle.

This, as opposed to the example below (which should NOT be used):

uncleInclusionReward = nIncludedUncles/32 * blockWinnerReward

blockWinnerReward = blockWinnerReward + uncleInclusionReward

See Block winner uncles inclusion reward comparison table for expected rewards. Note, for example, that era 22 yields a correct maximum block winner reward 48999163945790995 of 48999163945790996.


Block uncle miner reward for having an uncle(s) included in the winning block.

  • Uses uncle(s) inclusion reward calculation as described in Uncle rewards.

Reasoning: Like Block winner reward for including uncles, without rounding per uncle reward calculation, an uncle miner rewarded for 2 included blocks would receive a proportionally higher per-uncle reward than for having only 1 uncle included. There is no reason for such asymmetry.

See Uncle miner inclusion reward comparison table for expected rewards. Note, for example, that era 22 yields a correct maximum uncles miner reward of 2882303761517116, while an incorrect calculation yields 2882303761517117.

Reward tables

Expected overview

Era Block Winner Reward 1 Uncle Reward 2 Uncles Reward Block Winner w/ 1 Uncle Reward Block Winner w/ 2 Uncles Reward
2 4000000000000000000 125000000000000000 250000000000000000 4125000000000000000 4250000000000000000
3 3200000000000000000 100000000000000000 200000000000000000 3300000000000000000 3400000000000000000
4 2560000000000000000 80000000000000000 160000000000000000 2640000000000000000 2720000000000000000
5 2048000000000000000 64000000000000000 128000000000000000 2112000000000000000 2176000000000000000
6 1638400000000000000 51200000000000000 102400000000000000 1689600000000000000 1740800000000000000
7 1310720000000000000 40960000000000000 81920000000000000 1351680000000000000 1392640000000000000
8 1048576000000000000 32768000000000000 65536000000000000 1081344000000000000 1114112000000000000
9 838860800000000000 26214400000000000 52428800000000000 865075200000000000 891289600000000000
10 671088640000000000 20971520000000000 41943040000000000 692060160000000000 713031680000000000
11 536870912000000000 16777216000000000 33554432000000000 553648128000000000 570425344000000000
12 429496729600000000 13421772800000000 26843545600000000 442918502400000000 456340275200000000
13 343597383680000000 10737418240000000 21474836480000000 354334801920000000 365072220160000000
14 274877906944000000 8589934592000000 17179869184000000 283467841536000000 292057776128000000
15 219902325555200000 6871947673600000 13743895347200000 226774273228800000 233646220902400000
16 175921860444160000 5497558138880000 10995116277760000 181419418583040000 186916976721920000
17 140737488355328000 4398046511104000 8796093022208000 145135534866432000 149533581377536000
18 112589990684262400 3518437208883200 7036874417766400 116108427893145600 119626865102028800
19 90071992547409920 2814749767106560 5629499534213120 92886742314516480 95701492081623040
20 72057594037927936 2251799813685248 4503599627370496 74309393851613184 76561193665298432
21 57646075230342348 1801439850948198 3602879701896396 59447515081290546 61248954932238744
22 46116860184273879 1441151880758558 2882303761517116 47558012065032437 48999163945790995
23 36893488147419103 1152921504606846 2305843009213692 38046409652025949 39199331156632795
24 29514790517935282 922337203685477 1844674407370954 30437127721620759 31359464925306236
25 23611832414348226 737869762948382 1475739525896764 24349702177296608 25087571940244990
26 18889465931478580 590295810358705 1180591620717410 19479761741837285 20070057552195990
27 15111572745182864 472236648286964 944473296573928 15583809393469828 16056046041756792
28 12089258196146291 377789318629571 755578637259142 12467047514775862 12844836833405433
29 9671406556917033 302231454903657 604462909807314 9973638011820690 10275869466724347
30 7737125245533626 241785163922925 483570327845850 7978910409456551 8220695573379476
31 6189700196426901 193428131138340 386856262276680 6383128327565241 6576556458703581
32 4951760157141521 154742504910672 309485009821344 5106502662052193 5261245166962865
33 3961408125713216 123794003928538 247588007857076 4085202129641754 4208996133570292
34 3169126500570573 99035203142830 198070406285660 3268161703713403 3367196906856233
35 2535301200456458 79228162514264 158456325028528 2614529362970722 2693757525484986
36 2028240960365167 63382530011411 126765060022822 2091623490376578 2155006020387989
37 1622592768292133 50706024009129 101412048018258 1673298792301262 1724004816310391
38 1298074214633706 40564819207303 81129638414606 1338639033841009 1379203853048312
39 1038459371706965 32451855365842 64903710731684 1070911227072807 1103363082438649
40 830767497365572 25961484292674 51922968585348 856728981658246 882690465950920
41 664613997892457 20769187434139 41538374868278 685383185326596 706152372760735
42 531691198313966 16615349947311 33230699894622 548306548261277 564921898208588
43 425352958651173 13292279957849 26584559915698 438645238609022 451937518566871
44 340282366920938 10633823966279 21267647932558 350916190887217 361550014853496
45 272225893536750 8507059173023 17014118346046 280732952709773 289240011882796
46 217780714829400 6805647338418 13611294676836 224586362167818 231392009506236
47 174224571863520 5444517870735 10889035741470 179669089734255 185113607604990
48 139379657490816 4355614296588 8711228593176 143735271787404 148090886083992
49 111503725992653 3484491437270 6968982874540 114988217429923 118472708867193
50 89202980794122 2787593149816 5575186299632 91990573943938 94778167093754

Block winner reward comparison

Era CORRECT (exponentiation) INCORRECT (eg. looping)
2 4000000000000000000 4000000000000000000
3 3200000000000000000 3200000000000000000
4 2560000000000000000 2560000000000000000
5 2048000000000000000 2048000000000000000
6 1638400000000000000 1638400000000000000
7 1310720000000000000 1310720000000000000
8 1048576000000000000 1048576000000000000
9 838860800000000000 838860800000000000
10 671088640000000000 671088640000000000
11 536870912000000000 536870912000000000
12 429496729600000000 429496729600000000
13 343597383680000000 343597383680000000
14 274877906944000000 274877906944000000
15 219902325555200000 219902325555200000
16 175921860444160000 175921860444160000
17 140737488355328000 140737488355328000
18 112589990684262400 112589990684262400
19 90071992547409920 90071992547409920
20 72057594037927936 72057594037927936
21 57646075230342348 57646075230342348
22 46116860184273879 46116860184273878
23 36893488147419103 36893488147419102
24 29514790517935282 29514790517935281
25 23611832414348226 23611832414348224
26 18889465931478580 18889465931478579
27 15111572745182864 15111572745182863
28 12089258196146291 12089258196146290
29 9671406556917033 9671406556917032
30 7737125245533626 7737125245533625
31 6189700196426901 6189700196426900
32 4951760157141521 4951760157141520
33 3961408125713216 3961408125713216
34 3169126500570573 3169126500570572
35 2535301200456458 2535301200456457
36 2028240960365167 2028240960365165
37 1622592768292133 1622592768292132
38 1298074214633706 1298074214633705
39 1038459371706965 1038459371706964
40 830767497365572 830767497365571
41 664613997892457 664613997892456
42 531691198313966 531691198313964
43 425352958651173 425352958651171
44 340282366920938 340282366920936
45 272225893536750 272225893536748
46 217780714829400 217780714829398
47 174224571863520 174224571863518
48 139379657490816 139379657490814
49 111503725992653 111503725992651
50 89202980794122 89202980794120

Block winner uncles inclusion reward comparison

This table and the next deal exclusively with the reward for 2 uncles, since that’s the only case where rounding discrepencies will happen. These numbers assume use of the CORRECT block winner reward calculation.

Era CORRECT Block Winner Reward w/ 2 Uncles INCORRECT Block Winner Reward w/ 2 Uncles
2 4250000000000000000 4250000000000000000
3 3400000000000000000 3400000000000000000
4 2720000000000000000 2720000000000000000
5 2176000000000000000 2176000000000000000
6 1740800000000000000 1740800000000000000
7 1392640000000000000 1392640000000000000
8 1114112000000000000 1114112000000000000
9 891289600000000000 891289600000000000
10 713031680000000000 713031680000000000
11 570425344000000000 570425344000000000
12 456340275200000000 456340275200000000
13 365072220160000000 365072220160000000
14 292057776128000000 292057776128000000
15 233646220902400000 233646220902400000
16 186916976721920000 186916976721920000
17 149533581377536000 149533581377536000
18 119626865102028800 119626865102028800
19 95701492081623040 95701492081623040
20 76561193665298432 76561193665298432
21 61248954932238744 61248954932238744
22 48999163945790995 48999163945790996
23 39199331156632795 39199331156632796
24 31359464925306236 31359464925306237
25 25087571940244990 25087571940244990
26 20070057552195990 20070057552195991
27 16056046041756792 16056046041756793
28 12844836833405433 12844836833405434
29 10275869466724347 10275869466724347
30 8220695573379476 8220695573379477
31 6576556458703581 6576556458703582
32 5261245166962865 5261245166962866
33 4208996133570292 4208996133570292
34 3367196906856233 3367196906856233
35 2693757525484986 2693757525484986
36 2155006020387989 2155006020387989
37 1724004816310391 1724004816310391
38 1379203853048312 1379203853048312
39 1103363082438649 1103363082438650
40 882690465950920 882690465950920
41 706152372760735 706152372760735
42 564921898208588 564921898208588
43 451937518566871 451937518566871
44 361550014853496 361550014853496
45 289240011882796 289240011882796
46 231392009506236 231392009506237
47 185113607604990 185113607604990
48 148090886083992 148090886083992
49 118472708867193 118472708867193
50 94778167093754 94778167093754
51 75822533675003 75822533675003
52 60658026940002 60658026940002
53 48526421552000 48526421552001
54 38821137241600 38821137241601
55 31056909793280 31056909793281
56 24845527834624 24845527834624
57 19876422267699 19876422267699
58 15901137814158 15901137814159
59 12720910251326 12720910251327
60 10176728201061 10176728201061
61 8141382560849 8141382560849
62 6513106048679 6513106048679
63 5210484838942 5210484838943
64 4168387871154 4168387871154
65 3334710296923 3334710296923
66 2667768237538 2667768237538
67 2134214590029 2134214590030
68 1707371672024 1707371672024
69 1365897337619 1365897337619
70 1092717870095 1092717870095
71 874174296076 874174296076
72 699339436860 699339436861
73 559471549488 559471549488
74 447577239590 447577239591
75 358061791671 358061791672
76 286449433337 286449433337
77 229159546669 229159546670
78 183327637335 183327637335
79 146662109867 146662109868
80 117329687894 117329687894
81 93863750314 93863750315
82 75091000251 75091000252
83 60072800200 60072800201
84 48058240160 48058240161
85 38446592128 38446592128
86 30757273703 30757273703
87 24605818961 24605818962
88 19684655169 19684655169
89 15747724134 15747724135
90 12598179307 12598179308
91 10078543446 10078543446
92 8062834756 8062834757
93 6450267806 6450267806
94 5160214244 5160214244
95 4128171394 4128171395
96 3302537115 3302537116
97 2642029692 2642029693
98 2113623753 2113623754
99 1690899002 1690899003
100 1352719201 1352719202
101 1082175362 1082175362
102 865740288 865740289
103 692592230 692592231
104 554073783 554073784
105 443259027 443259027
106 354607222 354607222
107 283685777 283685777
108 226948621 226948621
109 181558896 181558897
110 145247118 145247118
111 116197694 116197694
112 92958154 92958154
113 74366523 74366524
114 59493218 59493219
115 47594574 47594574
116 38075659 38075659
117 30460526 30460527
118 24368422 24368422
119 19494736 19494737
120 15595789 15595790
121 12476630 12476631
122 9981304 9981305
123 7985044 7985044
124 6388035 6388035
125 5110427 5110428
126 4088342 4088342
127 3270673 3270673
128 2616539 2616539
129 2093230 2093231
130 1674584 1674585
131 1339668 1339668
132 1071733 1071734
133 857387 857387
134 685908 685909
135 548727 548727
136 438981 438981
137 351183 351184
138 280948 280948
139 224757 224758
140 179806 179806
141 143844 143845
142 115075 115076
143 92059 92060
144 73648 73648
145 58917 58918
146 47134 47134
147 37708 37708
148 30166 30166
149 24131 24132
150 19304 19305
151 15444 15444
152 12355 12355
153 9883 9884
154 7906 7907
155 6326 6326
156 5059 5060
157 4048 4048
158 3238 3238
159 2590 2590
160 2071 2072
161 1656 1657
162 1326 1326
163 1060 1060
164 847 848
165 677 678
166 541 542
167 433 434
168 347 347
169 277 277
170 221 222
171 177 177
172 142 142
173 113 113
174 89 90
175 72 72
176 56 57
177 45 45
178 37 37
179 28 29
180 22 23
181 17 18
182 14 14
183 11 11
184 9 9
185 7 7
186 5 5
187 4 4
188 3 3
189 3 3
190 2 2
191 1 1
192 1 1
193 1 1
194 0 0
195 0 0
196 0 0
197 0 0
198 0 0
199 0 0
200 0 0

Uncle miner inclusion reward comparison

Like above, this table deals exclusively with the reward for a miner of 2 uncles having those 2 uncles included in the winning block. Inclusion of 2 uncles is the only case where alternate rounding strategies can produce a discrepency, given constant block winner reward rounding.

Era CORRECT Uncle Miner w/ 2 Uncles Reward INCORRECT Uncle Miner w/ 2 Uncles Reward
2 250000000000000000 250000000000000000
3 200000000000000000 200000000000000000
4 160000000000000000 160000000000000000
5 128000000000000000 128000000000000000
6 102400000000000000 102400000000000000
7 81920000000000000 81920000000000000
8 65536000000000000 65536000000000000
9 52428800000000000 52428800000000000
10 41943040000000000 41943040000000000
11 33554432000000000 33554432000000000
12 26843545600000000 26843545600000000
13 21474836480000000 21474836480000000
14 17179869184000000 17179869184000000
15 13743895347200000 13743895347200000
16 10995116277760000 10995116277760000
17 8796093022208000 8796093022208000
18 7036874417766400 7036874417766400
19 5629499534213120 5629499534213120
20 4503599627370496 4503599627370496
21 3602879701896396 3602879701896396
22 2882303761517116 2882303761517117
23 2305843009213692 2305843009213693
24 1844674407370954 1844674407370955
25 1475739525896764 1475739525896764
26 1180591620717410 1180591620717411
27 944473296573928 944473296573929
28 755578637259142 755578637259143
29 604462909807314 604462909807314
30 483570327845850 483570327845851
31 386856262276680 386856262276681
32 309485009821344 309485009821345
33 247588007857076 247588007857076
34 198070406285660 198070406285660
35 158456325028528 158456325028528
36 126765060022822 126765060022822
37 101412048018258 101412048018258
38 81129638414606 81129638414606
39 64903710731684 64903710731685
40 51922968585348 51922968585348
41 41538374868278 41538374868278
42 33230699894622 33230699894622
43 26584559915698 26584559915698
44 21267647932558 21267647932558
45 17014118346046 17014118346046
46 13611294676836 13611294676837
47 10889035741470 10889035741470
48 8711228593176 8711228593176
49 6968982874540 6968982874540
50 5575186299632 5575186299632
51 4460149039706 4460149039706
52 3568119231764 3568119231764
53 2854495385410 2854495385411
54 2283596308328 2283596308329
55 1826877046662 1826877046663
56 1461501637330 1461501637330
57 1169201309864 1169201309864
58 935361047890 935361047891
59 748288838312 748288838313
60 598631070650 598631070650
61 478904856520 478904856520
62 383123885216 383123885216
63 306499108172 306499108173
64 245199286538 245199286538
65 196159429230 196159429230
66 156927543384 156927543384
67 125542034706 125542034707
68 100433627766 100433627766
69 80346902212 80346902212
70 64277521770 64277521770
71 51422017416 51422017416
72 41137613932 41137613933
73 32910091146 32910091146
74 26328072916 26328072917
75 21062458332 21062458333
76 16849966666 16849966666
77 13479973332 13479973333
78 10783978666 10783978666
79 8627182932 8627182933
80 6901746346 6901746346
81 5521397076 5521397077
82 4417117660 4417117661
83 3533694128 3533694129
84 2826955302 2826955303
85 2261564242 2261564242
86 1809251394 1809251394
87 1447401114 1447401115
88 1157920892 1157920892
89 926336712 926336713
90 741069370 741069371
91 592855496 592855496
92 474284396 474284397
93 379427518 379427518
94 303542014 303542014
95 242833610 242833611
96 194266888 194266889
97 155413510 155413511
98 124330808 124330809
99 99464646 99464647
100 79571716 79571717
101 63657374 63657374
102 50925898 50925899
103 40740718 40740719
104 32592574 32592575
105 26074060 26074060
106 20859248 20859248
107 16687398 16687398
108 13349918 13349918
109 10679934 10679935
110 8543948 8543948
111 6835158 6835158
112 5468126 5468126
113 4374500 4374501
114 3499600 3499601
115 2799680 2799680
116 2239744 2239744
117 1791794 1791795
118 1433436 1433436
119 1146748 1146749
120 917398 917399
121 733918 733919
122 587134 587135
123 469708 469708
124 375766 375766
125 300612 300613
126 240490 240490
127 192392 192392
128 153914 153914
129 123130 123131
130 98504 98505
131 78804 78804
132 63042 63043
133 50434 50434
134 40346 40347
135 32278 32278
136 25822 25822
137 20656 20657
138 16526 16526
139 13220 13221
140 10576 10576
141 8460 8461
142 6768 6769
143 5414 5415
144 4332 4332
145 3464 3465
146 2772 2772
147 2218 2218
148 1774 1774
149 1418 1419
150 1134 1135
151 908 908
152 726 726
153 580 581
154 464 465
155 372 372
156 296 297
157 238 238
158 190 190
159 152 152
160 120 121
161 96 97
162 78 78
163 62 62
164 48 49
165 38 39
166 30 31
167 24 25
168 20 20
169 16 16
170 12 13
171 10 10
172 8 8
173 6 6
174 4 5
175 4 4
176 2 3
177 2 2
178 2 2
179 0 1
180 0 1
181 0 1
182 0 0
183 0 0
184 0 0
185 0 0
186 0 0
187 0 0
188 0 0
189 0 0
190 0 0
191 0 0
192 0 0
193 0 0
194 0 0
195 0 0
196 0 0
197 0 0
198 0 0
199 0 0
200 0 0