@@ -34,29 +34,37 @@ FD_PROTOTYPES_BEGIN
3434 the max number of stake accounts is FD_BANKS_MAX_STAKE_ACCOUNTS,
3535 then the max number of partiitions is
3636 (FD_BANKS_MAX_STAKE_ACCOUNTS / (STAKE_ACCOUNT_STORES_PER_BLOCK + (FD_BANKS_MAX_STAKE_ACCOUNTS % STAKE_ACCOUNT_STORES_PER_BLOCK)))
37- == 515UL partitions.
37+ == 733UL partitions.
3838*/
3939#define FD_REWARDS_MAX_PARTITIONS ((FD_RUNTIME_MAX_STAKE_ACCOUNTS / STAKE_ACCOUNT_STORES_PER_BLOCK) + (FD_RUNTIME_MAX_STAKE_ACCOUNTS % STAKE_ACCOUNT_STORES_PER_BLOCK != 0))
4040FD_STATIC_ASSERT ( FD_REWARDS_MAX_PARTITIONS == 733 , "incorrect FD_REWARDS_MAX_PARTITIONS" );
4141FD_STATIC_ASSERT ( FD_REWARDS_MAX_PARTITIONS <= FD_RUNTIME_SLOTS_PER_EPOCH / MAX_FACTOR_OF_REWARD_BLOCKS_IN_EPOCH , "incorrect FD_REWARDS_MAX_PARTITIONS" );
4242
43- /* The max of footprint of fd_epoch_stakes is variable depending on the
43+ /* The max of footprint of fd_epoch_rewards is variable depending on the
4444 number of stake accounts that are supported. However, the size can be
4545 bounded out assuming worst case with 3M stake accounts. The total
4646 struct contains the top level header struct, the pool, and the dlists
4747
48- fd_epoch_stake_reward_t: 4192 bytes + 64 bytes align = 4224 bytes
48+ fd_epoch_rewards_t = 5984 bytes
4949
5050 pool's private meta: 32 bytes + 96 bytes align = 128 bytes
51- each pool member : 72 bytes + 56 bytes align = 128 bytes
52- all pool members : 128 bytes * 3M = 384 MB
51+ all pool members : 64 bytes * 3M = 192 MB
52+ total pool footprint : = 192,000,160 bytes
5353
54- each dlist: 24 bytes for sizeof(DLIST_T) = 24 bytes
55- all dlists: 24 bytes * 733 max partitions = 17592 bytes
54+ map footprint: sizeof(MAP_T) + chain_cnt*sizeof(MAP_IDX_T), alignof(MAP_T))
55+ chain_cnt: 2097152 chains is the largest power of 2 less than 3M.
56+ sizeof(MAP_T): 24 bytes
57+ alignof(MAP_T): 8 bytes
58+ 24 + 2097152 * sizeof(uint) = 8,388,632 bytes
5659
57- total footprint: 4224 bytes + 384 MB + 17592 bytes = 384021816 bytes
60+
61+ each dlist: 16 bytes for sizeof(DLIST_T) = 16 bytes
62+ all dlists: 16 bytes * 733 max partitions = 11,728 bytes
63+
64+ total footprint: 5,984 bytes + 192,000,160 bytes + 8,388,632 bytes + 11728 bytes = 200,406,504 bytes
65+ total footprint + align: align up to 128 bytes = 200,406,528 bytes
5866*/
59- #define FD_EPOCH_REWARDS_FOOTPRINT (384021816UL )
67+ #define FD_EPOCH_REWARDS_FOOTPRINT (200406528UL )
6068
6169#define FD_EPOCH_REWARDS_ALIGN (128UL)
6270
@@ -67,10 +75,10 @@ struct fd_epoch_stake_reward {
6775 ulong credits_observed ;
6876 ulong lamports ;
6977 /* Internal pointers for pool, dlist, and map. */
70- ulong prev ;
71- ulong next ;
72- ulong parent ;
73- ulong next_map ;
78+ uint prev ;
79+ uint next ;
80+ uint parent ;
81+ uint next_map ;
7482};
7583typedef struct fd_epoch_stake_reward fd_epoch_stake_reward_t ;
7684
@@ -79,6 +87,7 @@ typedef struct fd_epoch_stake_reward fd_epoch_stake_reward_t;
7987
8088#define DLIST_NAME fd_epoch_stake_reward_dlist
8189#define DLIST_ELE_T fd_epoch_stake_reward_t
90+ #define DLIST_IDX_T uint
8291#include "../../util/tmpl/fd_dlist.c"
8392
8493struct fd_epoch_rewards_iter {
0 commit comments