Skip to content

Commit f359809

Browse files
not passing vectors
1 parent f220f12 commit f359809

File tree

7 files changed

+30
-134
lines changed

7 files changed

+30
-134
lines changed

src/discof/restore/utils/fd_ssload.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,6 @@ fd_ssload_recover( fd_snapshot_manifest_t * manifest,
136136
fd_bank_execution_fees_set( slot_ctx->bank, manifest->collector_fees );
137137
fd_bank_priority_fees_set( slot_ctx->bank, 0UL );
138138

139-
/* FIXME: Remove the magic number here. */
140-
fd_clock_timestamp_votes_global_t * clock_timestamp_votes = fd_bank_clock_timestamp_votes_locking_modify( slot_ctx->bank );
141-
uchar * clock_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() );
142-
fd_clock_timestamp_vote_t_mapnode_t * clock_pool = fd_clock_timestamp_vote_t_map_join( fd_clock_timestamp_vote_t_map_new(clock_pool_mem, 30000UL ) );
143-
clock_timestamp_votes->votes_pool_offset = (ulong)fd_clock_timestamp_vote_t_map_leave( clock_pool) - (ulong)clock_timestamp_votes;
144-
clock_timestamp_votes->votes_root_offset = 0UL;
145-
fd_bank_clock_timestamp_votes_end_locking_modify( slot_ctx->bank );
146-
147-
for( ulong i=0UL; i<manifest->vote_accounts_len; i++ ) {
148-
fd_snapshot_manifest_vote_account_t * account = &manifest->vote_accounts[ i ];
149-
fd_pubkey_t vote_account_pubkey;
150-
fd_memcpy( vote_account_pubkey.uc, account->vote_account_pubkey, 32UL );
151-
if( FD_LIKELY( account->last_slot || account->stake ) ) {
152-
fd_vote_record_timestamp_vote_with_slot( &vote_account_pubkey, account->last_timestamp, account->last_slot, slot_ctx->bank );
153-
}
154-
}
155-
156139
/* Update last restart slot
157140
https://github.com/solana-labs/solana/blob/30531d7a5b74f914dde53bfbb0bc2144f2ac92bb/runtime/src/bank.rs#L2152
158141

src/discof/writer/fd_writer_tile.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ after_frag( fd_writer_tile_ctx_t * ctx,
275275
ctx->funk,
276276
ctx->funk_txn,
277277
txn_ctx,
278-
ctx->spad,
279278
ctx->bank,
280279
ctx->capture_ctx );
281280

src/flamenco/runtime/fd_runtime.c

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,16 @@ fd_runtime_update_leaders( fd_bank_t * bank,
163163
epoch_weights,
164164
0UL,
165165
vote_keyed_lsched ) );
166-
fd_bank_epoch_leaders_end_locking_modify( bank );
167166
if( FD_UNLIKELY( !leaders ) ) {
168167
FD_LOG_ERR(( "Unable to init and join fd_epoch_leaders" ));
169168
}
169+
FD_TEST( leaders );
170+
fd_bank_epoch_leaders_end_locking_modify( bank );
170171
}
171-
172172
} FD_SPAD_FRAME_END;
173+
174+
FD_TEST( fd_bank_epoch_leaders_locking_query( bank ) );
175+
fd_bank_epoch_leaders_end_locking_query( bank );
173176
}
174177

175178
/******************************************************************************/
@@ -1148,7 +1151,6 @@ void
11481151
fd_runtime_finalize_txn( fd_funk_t * funk,
11491152
fd_funk_txn_t * funk_txn,
11501153
fd_exec_txn_ctx_t * txn_ctx,
1151-
fd_spad_t * finalize_spad,
11521154
fd_bank_t * bank,
11531155
fd_capture_ctx_t * capture_ctx ) {
11541156

@@ -1205,38 +1207,6 @@ fd_runtime_finalize_txn( fd_funk_t * funk,
12051207

12061208
if( dirty_vote_acc && 0==memcmp( fd_txn_account_get_owner( acc_rec ), &fd_solana_vote_program_id, sizeof(fd_pubkey_t) ) ) {
12071209
fd_vote_store_account( acc_rec, bank );
1208-
FD_SPAD_FRAME_BEGIN( finalize_spad ) {
1209-
int err;
1210-
fd_vote_state_versioned_t * vsv = fd_bincode_decode_spad(
1211-
vote_state_versioned, finalize_spad,
1212-
fd_txn_account_get_data( acc_rec ),
1213-
fd_txn_account_get_data_len( acc_rec ),
1214-
&err );
1215-
if( FD_UNLIKELY( err ) ) {
1216-
FD_LOG_WARNING(( "failed to decode vote state versioned" ));
1217-
continue;
1218-
}
1219-
1220-
fd_vote_block_timestamp_t const * ts = NULL;
1221-
switch( vsv->discriminant ) {
1222-
case fd_vote_state_versioned_enum_v0_23_5:
1223-
ts = &vsv->inner.v0_23_5.last_timestamp;
1224-
break;
1225-
case fd_vote_state_versioned_enum_v1_14_11:
1226-
ts = &vsv->inner.v1_14_11.last_timestamp;
1227-
break;
1228-
case fd_vote_state_versioned_enum_current:
1229-
ts = &vsv->inner.current.last_timestamp;
1230-
break;
1231-
default:
1232-
__builtin_unreachable();
1233-
}
1234-
1235-
fd_vote_record_timestamp_vote_with_slot( acc_rec->pubkey,
1236-
ts->timestamp,
1237-
ts->slot,
1238-
bank );
1239-
} FD_SPAD_FRAME_END;
12401210
}
12411211

12421212
if( dirty_stake_acc && 0==memcmp( fd_txn_account_get_owner( acc_rec ), &fd_solana_stake_program_id, sizeof(fd_pubkey_t) ) ) {
@@ -2419,13 +2389,6 @@ fd_runtime_init_bank_from_genesis( fd_exec_slot_ctx_t * slot_ctx,
24192389
fd_bank_stake_delegations_end_locking_modify( slot_ctx->bank );
24202390

24212391
fd_bank_capitalization_set( slot_ctx->bank, capitalization );
2422-
2423-
fd_clock_timestamp_votes_global_t * clock_timestamp_votes = fd_bank_clock_timestamp_votes_locking_modify( slot_ctx->bank );
2424-
uchar * clock_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() );
2425-
fd_clock_timestamp_vote_t_mapnode_t * clock_pool = fd_clock_timestamp_vote_t_map_join( fd_clock_timestamp_vote_t_map_new(clock_pool_mem, 30000UL ) );
2426-
clock_timestamp_votes->votes_pool_offset = (ulong)fd_clock_timestamp_vote_t_map_leave( clock_pool) - (ulong)clock_timestamp_votes;
2427-
clock_timestamp_votes->votes_root_offset = 0UL;
2428-
fd_bank_clock_timestamp_votes_end_locking_modify( slot_ctx->bank );
24292392
}
24302393

24312394
static int

src/flamenco/runtime/fd_runtime.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ void
530530
fd_runtime_finalize_txn( fd_funk_t * funk,
531531
fd_funk_txn_t * funk_txn,
532532
fd_exec_txn_ctx_t * txn_ctx,
533-
fd_spad_t * finalize_spad,
534533
fd_bank_t * bank,
535534
fd_capture_ctx_t * capture_ctx );
536535

src/flamenco/runtime/program/fd_vote_program.c

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,44 +2124,6 @@ fd_vote_decode_compact_update( fd_compact_vote_state_update_t * compact_update,
21242124
return 1;
21252125
}
21262126

2127-
void
2128-
fd_vote_record_timestamp_vote_with_slot( fd_pubkey_t const * vote_acc,
2129-
long timestamp,
2130-
ulong slot,
2131-
fd_bank_t * bank ) {
2132-
2133-
fd_clock_timestamp_votes_global_t * clock_timestamp_votes = fd_bank_clock_timestamp_votes_locking_modify( bank );
2134-
2135-
fd_clock_timestamp_vote_t_mapnode_t * pool = fd_clock_timestamp_votes_votes_pool_join( clock_timestamp_votes );
2136-
fd_clock_timestamp_vote_t_mapnode_t * root = fd_clock_timestamp_votes_votes_root_join( clock_timestamp_votes );
2137-
2138-
if( FD_UNLIKELY( !pool ) ) {
2139-
FD_LOG_ERR(( "Timestamp vote account pool not allocated" ));
2140-
}
2141-
2142-
fd_clock_timestamp_vote_t timestamp_vote = {
2143-
.pubkey = *vote_acc,
2144-
.timestamp = (long)timestamp,
2145-
.slot = slot,
2146-
};
2147-
fd_clock_timestamp_vote_t_mapnode_t key = { .elem = timestamp_vote };
2148-
fd_clock_timestamp_vote_t_mapnode_t * node =
2149-
fd_clock_timestamp_vote_t_map_find( pool, root, &key );
2150-
if( NULL != node ) {
2151-
node->elem = timestamp_vote;
2152-
} else {
2153-
node = fd_clock_timestamp_vote_t_map_acquire( pool );
2154-
FD_TEST( node != NULL );
2155-
node->elem = timestamp_vote;
2156-
fd_clock_timestamp_vote_t_map_insert( pool, &root, node );
2157-
}
2158-
2159-
fd_clock_timestamp_votes_votes_pool_update( clock_timestamp_votes, pool );
2160-
fd_clock_timestamp_votes_votes_root_update( clock_timestamp_votes, root );
2161-
2162-
fd_bank_clock_timestamp_votes_end_locking_modify( bank );
2163-
}
2164-
21652127
/// returns commission split as (voter_portion, staker_portion, was_split) tuple
21662128
///
21672129
/// if commission calculation is 100% one way or other, indicate with false for was_split

src/flamenco/runtime/program/fd_vote_program.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ void
6969
fd_vote_convert_to_current( fd_vote_state_versioned_t * self,
7070
fd_spad_t * spad );
7171

72-
void
73-
fd_vote_record_timestamp_vote_with_slot( fd_pubkey_t const * vote_acc,
74-
long timestamp,
75-
ulong slot,
76-
fd_bank_t * bank );
77-
7872
struct fd_commission_split {
7973
ulong voter_portion;
8074
ulong staker_portion;

src/flamenco/runtime/tests/harness/fd_block_harness.c

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fd_runtime_fuzz_block_refresh_vote_accounts( fd_vote_accounts_pair_global_t_mapn
3333
for the vote account */
3434
static void
3535
fd_runtime_fuzz_block_register_vote_account( fd_exec_slot_ctx_t * slot_ctx,
36+
fd_vote_states_t * vote_states,
3637
fd_vote_accounts_pair_global_t_mapnode_t * pool,
3738
fd_vote_accounts_pair_global_t_mapnode_t ** root,
3839
fd_pubkey_t * pubkey,
@@ -88,23 +89,8 @@ fd_runtime_fuzz_block_register_vote_account( fd_exec_slot_ctx_t *
8889

8990
fd_vote_accounts_pair_global_t_map_insert( pool, root, node_to_insert );
9091

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 );
10894
}
10995

11096
/* 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
155141
static void
156142
fd_runtime_fuzz_block_update_prev_epoch_votes_cache( fd_vote_accounts_pair_global_t_mapnode_t * pool,
157143
fd_vote_accounts_pair_global_t_mapnode_t ** root,
144+
fd_vote_states_t * vote_states,
158145
fd_exec_test_vote_account_t * vote_accounts,
159146
pb_size_t vote_accounts_cnt,
160147
fd_spad_t * spad ) {
@@ -176,6 +163,9 @@ fd_runtime_fuzz_block_update_prev_epoch_votes_cache( fd_vote_accounts_pair_globa
176163
fd_solana_account_data_update( &vote_node->elem.value, data );
177164

178165
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 );
179169
}
180170
}
181171

@@ -229,16 +219,6 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
229219

230220
/* All bank mgr stuff here. */
231221

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-
242222
slot_ctx->bank->slot_ = slot;
243223

244224
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,
285265
vote_states = fd_vote_states_join( fd_vote_states_new( vote_states, FD_RUNTIME_MAX_VOTE_ACCOUNTS ) );
286266
fd_bank_vote_states_end_locking_modify( slot_ctx->bank );
287267

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+
288276
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() );
290278
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 ) );
291279
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root = NULL;
292280

@@ -301,11 +289,14 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
301289
/* Update vote accounts cache for epoch T */
302290
fd_pubkey_t pubkey;
303291
memcpy( &pubkey, test_ctx->acct_states[i].address, sizeof(fd_pubkey_t) );
292+
vote_states = fd_bank_vote_states_locking_modify( slot_ctx->bank );
304293
fd_runtime_fuzz_block_register_vote_account( slot_ctx,
294+
vote_states,
305295
vote_accounts_pool,
306296
&vote_accounts_root,
307297
&pubkey,
308298
runner->spad );
299+
fd_bank_vote_states_end_locking_modify( slot_ctx->bank );
309300

310301
/* Update the stake delegations cache for epoch T */
311302
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,
347338
vote_accounts_root = NULL;
348339

349340
/* Update vote cache for epoch T-1 */
341+
vote_states_prev = fd_bank_vote_states_prev_locking_modify( slot_ctx->bank );
350342
fd_runtime_fuzz_block_update_prev_epoch_votes_cache( vote_accounts_pool,
351343
&vote_accounts_root,
344+
vote_states_prev,
352345
test_ctx->epoch_ctx.vote_accounts_t_1,
353346
test_ctx->epoch_ctx.vote_accounts_t_1_count,
354347
runner->spad );
348+
fd_bank_vote_states_prev_end_locking_modify( slot_ctx->bank );
355349

356350
fd_vote_accounts_vote_accounts_pool_update( vote_accounts, vote_accounts_pool );
357351
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,
364358
vote_accounts_pool = fd_vote_accounts_pair_global_t_map_join( fd_vote_accounts_pair_global_t_map_new( pool_mem, vote_acct_max ) );
365359
vote_accounts_root = NULL;
366360

361+
vote_states_prev_prev = fd_bank_vote_states_prev_prev_locking_modify( slot_ctx->bank );
367362
fd_runtime_fuzz_block_update_prev_epoch_votes_cache( vote_accounts_pool,
368363
&vote_accounts_root,
364+
vote_states_prev_prev,
369365
test_ctx->epoch_ctx.vote_accounts_t_2,
370366
test_ctx->epoch_ctx.vote_accounts_t_2_count,
371367
runner->spad );
368+
fd_bank_vote_states_prev_prev_end_locking_modify( slot_ctx->bank );
372369

373370
fd_vote_accounts_vote_accounts_pool_update( vote_accounts, vote_accounts_pool );
374371
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,
555552
slot_ctx->funk,
556553
slot_ctx->funk_txn,
557554
txn_ctx,
558-
runner->spad,
559555
slot_ctx->bank,
560556
capture_ctx );
561557

0 commit comments

Comments
 (0)