@@ -33,6 +33,7 @@ fd_runtime_fuzz_block_refresh_vote_accounts( fd_vote_accounts_pair_global_t_mapn
33
33
for the vote account */
34
34
static void
35
35
fd_runtime_fuzz_block_register_vote_account ( fd_exec_slot_ctx_t * slot_ctx ,
36
+ fd_vote_states_t * vote_states ,
36
37
fd_vote_accounts_pair_global_t_mapnode_t * pool ,
37
38
fd_vote_accounts_pair_global_t_mapnode_t * * root ,
38
39
fd_pubkey_t * pubkey ,
@@ -88,23 +89,8 @@ fd_runtime_fuzz_block_register_vote_account( fd_exec_slot_ctx_t *
88
89
89
90
fd_vote_accounts_pair_global_t_map_insert ( pool , root , node_to_insert );
90
91
91
- /* Record a timestamp for the vote account */
92
- fd_vote_block_timestamp_t const * ts = NULL ;
93
- switch ( vsv -> discriminant ) {
94
- case fd_vote_state_versioned_enum_v0_23_5 :
95
- ts = & vsv -> inner .v0_23_5 .last_timestamp ;
96
- break ;
97
- case fd_vote_state_versioned_enum_v1_14_11 :
98
- ts = & vsv -> inner .v1_14_11 .last_timestamp ;
99
- break ;
100
- case fd_vote_state_versioned_enum_current :
101
- ts = & vsv -> inner .current .last_timestamp ;
102
- break ;
103
- default :
104
- __builtin_unreachable ();
105
- }
106
-
107
- fd_vote_record_timestamp_vote_with_slot ( pubkey , ts -> timestamp , ts -> slot , slot_ctx -> bank );
92
+ fd_vote_states_update_from_account ( vote_states , pubkey , data , account_dlen );
93
+ fd_vote_states_update_stake ( vote_states , pubkey , node_to_insert -> elem .stake );
108
94
}
109
95
110
96
/* Stores an entry in the stake delegations cache for the given vote account. Deserializes and uses the present
@@ -155,6 +141,7 @@ fd_runtime_fuzz_block_register_stake_delegation( fd_exec_slot_ctx_t * slot_c
155
141
static void
156
142
fd_runtime_fuzz_block_update_prev_epoch_votes_cache ( fd_vote_accounts_pair_global_t_mapnode_t * pool ,
157
143
fd_vote_accounts_pair_global_t_mapnode_t * * root ,
144
+ fd_vote_states_t * vote_states ,
158
145
fd_exec_test_vote_account_t * vote_accounts ,
159
146
pb_size_t vote_accounts_cnt ,
160
147
fd_spad_t * spad ) {
@@ -176,6 +163,9 @@ fd_runtime_fuzz_block_update_prev_epoch_votes_cache( fd_vote_accounts_pair_globa
176
163
fd_solana_account_data_update ( & vote_node -> elem .value , data );
177
164
178
165
fd_vote_accounts_pair_global_t_map_insert ( pool , root , vote_node );
166
+
167
+ fd_vote_states_update_from_account ( vote_states , & vote_node -> elem .key , data , vote_node -> elem .value .data_len );
168
+ fd_vote_states_update_stake ( vote_states , & vote_node -> elem .key , stake );
179
169
}
180
170
}
181
171
@@ -229,16 +219,6 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
229
219
230
220
/* All bank mgr stuff here. */
231
221
232
- /* Initialize vote timestamps cache */
233
- fd_clock_timestamp_votes_global_t * clock_timestamp_votes = fd_bank_clock_timestamp_votes_locking_modify ( slot_ctx -> bank );
234
- uchar * pool_mem = (uchar * )fd_ulong_align_up ( (ulong )clock_timestamp_votes + sizeof (fd_clock_timestamp_votes_global_t ), fd_clock_timestamp_vote_t_map_align () );
235
- fd_clock_timestamp_vote_t_mapnode_t * clock_pool = fd_clock_timestamp_vote_t_map_join ( fd_clock_timestamp_vote_t_map_new ( pool_mem , 15000UL ) );
236
- fd_clock_timestamp_vote_t_mapnode_t * clock_root = NULL ;
237
-
238
- fd_clock_timestamp_votes_votes_pool_update ( clock_timestamp_votes , clock_pool );
239
- fd_clock_timestamp_votes_votes_root_update ( clock_timestamp_votes , clock_root );
240
- fd_bank_clock_timestamp_votes_end_locking_modify ( slot_ctx -> bank );
241
-
242
222
slot_ctx -> bank -> slot_ = slot ;
243
223
244
224
fd_bank_block_height_set ( slot_ctx -> bank , test_ctx -> slot_ctx .block_height );
@@ -285,8 +265,16 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
285
265
vote_states = fd_vote_states_join ( fd_vote_states_new ( vote_states , FD_RUNTIME_MAX_VOTE_ACCOUNTS ) );
286
266
fd_bank_vote_states_end_locking_modify ( slot_ctx -> bank );
287
267
268
+ fd_vote_states_t * vote_states_prev = fd_bank_vote_states_prev_locking_modify ( slot_ctx -> bank );
269
+ vote_states_prev = fd_vote_states_join ( fd_vote_states_new ( vote_states_prev , FD_RUNTIME_MAX_VOTE_ACCOUNTS ) );
270
+ fd_bank_vote_states_prev_end_locking_modify ( slot_ctx -> bank );
271
+
272
+ fd_vote_states_t * vote_states_prev_prev = fd_bank_vote_states_prev_prev_locking_modify ( slot_ctx -> bank );
273
+ vote_states_prev_prev = fd_vote_states_join ( fd_vote_states_new ( vote_states_prev_prev , FD_RUNTIME_MAX_VOTE_ACCOUNTS ) );
274
+ fd_bank_vote_states_prev_prev_end_locking_modify ( slot_ctx -> bank );
275
+
288
276
fd_vote_accounts_global_t * curr_stakes = fd_bank_curr_epoch_stakes_locking_modify ( slot_ctx -> bank );
289
- pool_mem = (uchar * )fd_ulong_align_up ( (ulong )curr_stakes + sizeof (fd_vote_accounts_global_t ), fd_vote_accounts_pair_t_map_align () );
277
+ uchar * pool_mem = (uchar * )fd_ulong_align_up ( (ulong )curr_stakes + sizeof (fd_vote_accounts_global_t ), fd_vote_accounts_pair_t_map_align () );
290
278
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_pool = fd_vote_accounts_pair_global_t_map_join ( fd_vote_accounts_pair_global_t_map_new ( pool_mem , vote_acct_max ) );
291
279
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root = NULL ;
292
280
@@ -301,11 +289,14 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
301
289
/* Update vote accounts cache for epoch T */
302
290
fd_pubkey_t pubkey ;
303
291
memcpy ( & pubkey , test_ctx -> acct_states [i ].address , sizeof (fd_pubkey_t ) );
292
+ vote_states = fd_bank_vote_states_locking_modify ( slot_ctx -> bank );
304
293
fd_runtime_fuzz_block_register_vote_account ( slot_ctx ,
294
+ vote_states ,
305
295
vote_accounts_pool ,
306
296
& vote_accounts_root ,
307
297
& pubkey ,
308
298
runner -> spad );
299
+ fd_bank_vote_states_end_locking_modify ( slot_ctx -> bank );
309
300
310
301
/* Update the stake delegations cache for epoch T */
311
302
fd_runtime_fuzz_block_register_stake_delegation ( slot_ctx ,
@@ -347,11 +338,14 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
347
338
vote_accounts_root = NULL ;
348
339
349
340
/* Update vote cache for epoch T-1 */
341
+ vote_states_prev = fd_bank_vote_states_prev_locking_modify ( slot_ctx -> bank );
350
342
fd_runtime_fuzz_block_update_prev_epoch_votes_cache ( vote_accounts_pool ,
351
343
& vote_accounts_root ,
344
+ vote_states_prev ,
352
345
test_ctx -> epoch_ctx .vote_accounts_t_1 ,
353
346
test_ctx -> epoch_ctx .vote_accounts_t_1_count ,
354
347
runner -> spad );
348
+ fd_bank_vote_states_prev_end_locking_modify ( slot_ctx -> bank );
355
349
356
350
fd_vote_accounts_vote_accounts_pool_update ( vote_accounts , vote_accounts_pool );
357
351
fd_vote_accounts_vote_accounts_root_update ( vote_accounts , vote_accounts_root );
@@ -364,11 +358,14 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
364
358
vote_accounts_pool = fd_vote_accounts_pair_global_t_map_join ( fd_vote_accounts_pair_global_t_map_new ( pool_mem , vote_acct_max ) );
365
359
vote_accounts_root = NULL ;
366
360
361
+ vote_states_prev_prev = fd_bank_vote_states_prev_prev_locking_modify ( slot_ctx -> bank );
367
362
fd_runtime_fuzz_block_update_prev_epoch_votes_cache ( vote_accounts_pool ,
368
363
& vote_accounts_root ,
364
+ vote_states_prev_prev ,
369
365
test_ctx -> epoch_ctx .vote_accounts_t_2 ,
370
366
test_ctx -> epoch_ctx .vote_accounts_t_2_count ,
371
367
runner -> spad );
368
+ fd_bank_vote_states_prev_prev_end_locking_modify ( slot_ctx -> bank );
372
369
373
370
fd_vote_accounts_vote_accounts_pool_update ( vote_accounts , vote_accounts_pool );
374
371
fd_vote_accounts_vote_accounts_root_update ( vote_accounts , vote_accounts_root );
@@ -555,7 +552,6 @@ fd_runtime_fuzz_block_ctx_exec( fd_runtime_fuzz_runner_t * runner,
555
552
slot_ctx -> funk ,
556
553
slot_ctx -> funk_txn ,
557
554
txn_ctx ,
558
- runner -> spad ,
559
555
slot_ctx -> bank ,
560
556
capture_ctx );
561
557
0 commit comments