Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/eosio.system/src/producer_pay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <eosio.tedp/eosio.tedp.hpp>
#include <delphioracle/delphioracle.hpp>
#include "system_kick.cpp"
#define MAX_PRODUCERS 42 // revised for TEDP 2 Phase 2, also set in system_rotation.cpp, change in both places
#define MAX_PRODUCERS 35 // revised for TEDP 2 Phase 2, also set in system_rotation.cpp, change in both places
// TELOS END

namespace eosiosystem {
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace eosiosystem {
// activecount = 21: 42
// activecount = 22: 43.2
// ...
// activecount = 42: 63
// activecount = 35: 56.98
double sum_of_multipliers = activecount <= 21 ? (((activecount)/2)*(2*1.2-(activecount-1)*0.02) * 2) : (42 + ((activecount-21)/2)*(2*1.2-(activecount-22)*0.02));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without diving more into the math, I'm unsure if this change needs to be made or not. But I'll leave a comment here so that those with better knowledge of the math can give it some thought.

(42 + ((activecount-21)/2)*(2*1.2-(activecount-22)*0.02))

This formulate for when more than 21 producers exist has 42 hardcoded into the math. Should this also be changed to 35 or potentially use the MAX_PRODUCERS constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

42 is the sum of the multipliers for the first 21 BPs (active producers), which is the sum of [2x1.2, 2x1.18, 2x1.16, ..., 2x0.82, 2x0.8], which is equal to [2.4, 2,36, ..., 1.64,1.6].
If the total number of active producers is less than 21, we only need to sum the first n multipliers. If they exceed 21, it would be 42 plus the sum of the multipliers for the next standby BPs which is sum of [1.2, 1.18, ..., 0.82, 0.8]
For example if the total number of BPs are 25, the sum of the multipliers would be 42 + (1.2 + 1.18 + 1.16 + 1.14) which is equal to 46.68
We should notice that this arithmetic sequence is designated for 21 producers based on the governance proposal. Therefore, we may need to select an alternative common difference and initial term for this series if we modify the total number of active BPs and adjust the formula.


auto shareValue = (_gstate.perblock_bucket / sum_of_multipliers);
Expand All @@ -386,7 +386,7 @@ namespace eosiosystem {
// Applying tiered BP pay multiplier for active BPs (rank 1st until 21st) [1.2, 1.18, ... , 0.82, 0.8] multiplied by 2
pay_amount = (shareValue * int64_t(2) * ((122-2*index)/100.0));
} else if (index >= 22 && index <= MAX_PRODUCERS) {
// Applying tiered BP pay multiplier for standby BPs (rank 22nd until 42nd) [1.2, 1.18, ... , 0.82, 0.8] multiplied by 1
// Applying tiered BP pay multiplier for standby BPs (rank 22nd until 35th) [1.2, 1.18, ... , 0.96, 0.94] multiplied by 1
pay_amount = shareValue * ((164-2*index)/100.0);
} else
break;
Expand Down
2 changes: 1 addition & 1 deletion contracts/eosio.system/src/system_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define ONE_HOUR_US 900000000 // debug version
#define SIX_MINUTES_US 360000000 // debug version
#define TWELVE_MINUTES_US 720000000 // debug version
#define MAX_PRODUCERS 42 // revised for TEDP 2 Phase 2, also set in producer_pay.cpp, change in both places
#define MAX_PRODUCERS 35 // revised for TEDP 2 Phase 2, also set in producer_pay.cpp, change in both places
#define TOP_PRODUCERS 21
#define MAX_VOTE_PRODUCERS 30

Expand Down
2 changes: 1 addition & 1 deletion tests/telos.system_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "eosio.system_tester.hpp"

#define MAX_PRODUCERS 42
#define MAX_PRODUCERS 35

using namespace eosio_system;

Expand Down
Loading