/ consensus-specs Public

# Inactivity Penalty Quotient rationale and computation#1633

Closed
opened this issue Feb 29, 2020 · 2 comments
Closed

# Inactivity Penalty Quotient rationale and computation #1633

opened this issue Feb 29, 2020 · 2 comments

### ghost commented Feb 29, 2020

 Per @JustinDrake advice, I'm cross posting https://ethresear.ch/t/inactivity-penalty-quotient-rationale-and-computation/7043 Looking to gain insight on the matter of the inactivity penalty quotient. While the Serenity Design Rationale document states that With the current parametrization, if blocks stop being finalized, validators lose 1% of their deposits after 2.6 days, 10% after 8.4 days, and 50% after 21 days. This means for example that if 50% of validators drop offline, blocks will start finalizing again after 21 days. If we examine the current parametrization we have `penalties[index] += Gwei(effective_balance * finality_delay // INACTIVITY_PENALTY_QUOTIENT)` with `INACTIVITY_PENALTY_QUOTIENT` = `2**25` (`33,554,432`). Now, if we build and run a quick python script ```balance = 100.0 for i in range(4,4726): balance -= (i * balance) / 2**25 print(str(i) + "\t" + str(balance))``` our results are, for an initial balance of `100` ``````4 99.99998807907104 5 99.99997317791163 6 99.99995529652298 [snip] 4723 71.71416019772546 4724 71.70406383570766 4725 71.69396675817036 `````` adjusting the exponent of `2` in the above script, with `2**23.94128` we get ``````[snip] 567 99.00533232662947 568 99.00184121683876 569 98.99834408404766 [snip] 1840 90.01886280962862 1841 90.00857450307387 1842 89.99828178458043 [snip] 4723 50.026236935763414 4724 50.01156578060706 4725 49.996895823295965 `````` Which are closer to the statements in the rationale, namely, losing 1% at 2.6 days (568 epochs), 10% after 8.2 days (1841 epochs), and 50% after 21 days (4724 epochs). So the short question is why 2**25 was chosen as the Inactivity Penalty Quotient instead of 2**24. And the long question is about the methodology used to compute the coefficient . The text was updated successfully, but these errors were encountered:

### JustinDrake commented Feb 29, 2020

 It does look like there is a discrepancy. In general the spec is the source of truth, i.e. takes precedence over the design rationale document. We use exact powers of 2 to minimise bikeshedding. If my calculations are correct, validators would lose 50% in ~30 days with `INACTIVITY_PENALTY_QUOTIENT = 2**25`. Both `2**24` and `2**25` may be reasonable.

 Just adding before closing With the following script ```balance = 100.0 for i in range(4,10000): balance -= (i * balance) / 2**25 if balance < 50: days = i * 32 * 12 / 24 / 3600 print("at 2**25 it takes " + "{0:.2f}".format(days) + " days") break balance = 100.0 for i in range(4,10000): balance -= (i * balance) / 2**24 if balance < 50: days = i * 32 * 12 / 24 / 3600 print("at 2**24 it takes " + "{0:.2f}".format(days) + " days") break``` The results are ``````at 2**25 it takes 30.31 days at 2**24 it takes 21.43 days `````` This computation is not including the inactivity penalty all validators receive (regardless they have voted or not) every epoch of `Gwei(BASE_REWARDS_PER_EPOCH * get_base_reward(state, index))`.

closed this as completed Feb 29, 2020
This issue was closed.