@@ -95,12 +95,9 @@ scratch_footprint( fd_topo_tile_t const * tile FD_PARAM_UNUSED ) {
95
95
/* clang-format on */
96
96
}
97
97
98
- static void
99
- execute_txn ( fd_exec_tile_ctx_t * ctx ) {
100
-
101
- FD_SPAD_FRAME_BEGIN ( ctx -> exec_spad ) {
102
-
103
- /* Query the funk transaction for the given slot. */
98
+ static fd_funk_txn_t *
99
+ funk_txn_get ( fd_exec_tile_ctx_t * ctx ) {
100
+ /* Query the funk transaction for the given slot. */
104
101
fd_funk_txn_map_t * txn_map = fd_funk_txn_map ( ctx -> funk );
105
102
if ( FD_UNLIKELY ( !txn_map -> map ) ) {
106
103
FD_LOG_ERR (( "Could not find valid funk transaction map" ));
@@ -112,33 +109,45 @@ execute_txn( fd_exec_tile_ctx_t * ctx ) {
112
109
FD_LOG_ERR (( "Could not find valid funk transaction" ));
113
110
}
114
111
fd_funk_txn_end_read ( ctx -> funk );
115
- ctx -> txn_ctx -> funk_txn = funk_txn ;
112
+ return funk_txn ;
113
+ }
114
+
115
+ static fd_bank_t *
116
+ bank_get ( fd_exec_tile_ctx_t * ctx ) {
117
+ return fd_banks_get_bank ( ctx -> banks , ctx -> slot );
118
+ }
119
+
120
+ static void
121
+ execute_txn ( fd_exec_tile_ctx_t * ctx ) {
122
+
123
+ FD_SPAD_FRAME_BEGIN ( ctx -> exec_spad ) {
124
+
125
+ ctx -> exec_res = 0 ;
126
+
127
+ ctx -> txn_ctx -> funk_txn = funk_txn_get ( ctx );
128
+ if ( FD_UNLIKELY ( !ctx -> txn_ctx -> funk_txn ) ) {
129
+ FD_LOG_CRIT (( "Could not get funk transaction for slot %lu" , ctx -> slot ));
130
+ }
116
131
117
132
/* Get the bank for the given slot. */
118
133
fd_banks_lock ( ctx -> banks );
119
- ctx -> bank = fd_banks_get_bank ( ctx -> banks , ctx -> slot );
134
+ ctx -> bank = bank_get ( ctx );
120
135
if ( FD_UNLIKELY ( !ctx -> bank ) ) {
121
- FD_LOG_ERR (( "Could not get bank for slot %lu" , ctx -> slot ));
136
+ FD_LOG_CRIT (( "Could not get bank for slot %lu" , ctx -> slot ));
122
137
}
123
138
124
- /* Setup and execute the transaction.*/
139
+ /* Setup and execute the transaction. */
125
140
ctx -> txn_ctx -> bank = ctx -> bank ;
126
141
ctx -> txn_ctx -> slot = fd_bank_slot_get ( ctx -> bank );
127
142
ctx -> txn_ctx -> features = fd_bank_features_get ( ctx -> bank );
128
143
129
- fd_execute_txn_task_info_t task_info = {
130
- .txn_ctx = ctx -> txn_ctx ,
131
- .exec_res = 0 ,
132
- .txn = & ctx -> txn ,
133
- };
134
-
135
- fd_txn_t const * txn_descriptor = TXN ( task_info .txn );
144
+ fd_txn_t const * txn_descriptor = TXN ( & ctx -> txn );
136
145
fd_rawtxn_b_t raw_txn = {
137
- .raw = task_info . txn -> payload ,
138
- .txn_sz = (ushort )task_info . txn -> payload_sz
146
+ .raw = ctx -> txn . payload ,
147
+ .txn_sz = (ushort )ctx -> txn . payload_sz
139
148
};
140
149
141
- task_info . txn -> flags = FD_TXN_P_FLAGS_SANITIZE_SUCCESS ;
150
+ ctx -> txn . flags = FD_TXN_P_FLAGS_SANITIZE_SUCCESS ;
142
151
143
152
fd_exec_txn_ctx_setup ( ctx -> txn_ctx , txn_descriptor , & raw_txn );
144
153
ctx -> txn_ctx -> capture_ctx = ctx -> capture_ctx ;
@@ -151,24 +160,27 @@ execute_txn( fd_exec_tile_ctx_t * ctx ) {
151
160
152
161
if ( FD_UNLIKELY ( fd_executor_txn_verify ( ctx -> txn_ctx )!= 0 ) ) {
153
162
FD_LOG_WARNING (( "sigverify failed: %s" , FD_BASE58_ENC_64_ALLOCA ( (uchar * )ctx -> txn_ctx -> _txn_raw -> raw + ctx -> txn_ctx -> txn_descriptor -> signature_off ) ));
154
- task_info . txn -> flags = 0U ;
155
- task_info . exec_res = FD_RUNTIME_TXN_ERR_SIGNATURE_FAILURE ;
163
+ ctx -> txn . flags = 0U ;
164
+ ctx -> exec_res = FD_RUNTIME_TXN_ERR_SIGNATURE_FAILURE ;
156
165
fd_banks_unlock ( ctx -> banks );
157
166
return ;
158
167
}
159
168
160
- fd_runtime_pre_execute_check ( & task_info );
161
- if ( FD_UNLIKELY ( !( task_info . txn -> flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) ) {
169
+ ctx -> exec_res = fd_runtime_pre_execute_check ( & ctx -> txn , ctx -> txn_ctx );
170
+ if ( FD_UNLIKELY ( !( ctx -> txn . flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) ) {
162
171
fd_banks_unlock ( ctx -> banks );
163
172
return ;
164
173
}
165
174
166
175
/* Execute */
167
- task_info .txn -> flags |= FD_TXN_P_FLAGS_EXECUTE_SUCCESS ;
168
- ctx -> exec_res = fd_execute_txn ( & task_info );
176
+ ctx -> txn .flags |= FD_TXN_P_FLAGS_EXECUTE_SUCCESS ;
177
+
178
+ if ( FD_LIKELY ( !(ctx -> txn .flags & FD_TXN_P_FLAGS_FEES_ONLY ) ) ) {
179
+ ctx -> exec_res = fd_execute_txn ( ctx -> txn_ctx );
180
+ }
169
181
170
182
if ( FD_LIKELY ( ctx -> exec_res == FD_EXECUTOR_INSTR_SUCCESS ) ) {
171
- fd_txn_reclaim_accounts ( task_info . txn_ctx );
183
+ fd_txn_reclaim_accounts ( ctx -> txn_ctx );
172
184
}
173
185
fd_banks_unlock ( ctx -> banks );
174
186
@@ -233,33 +245,6 @@ hash_accounts( fd_exec_tile_ctx_t * ctx,
233
245
fd_banks_unlock ( ctx -> banks );
234
246
}
235
247
236
- static void
237
- snap_hash_count ( fd_exec_tile_ctx_t * ctx ) {
238
- ctx -> pairs_len = fd_accounts_sorted_subrange_count ( ctx -> funk , (uint )ctx -> tile_idx , (uint )ctx -> tile_cnt );
239
- }
240
-
241
- static void
242
- snap_hash_gather ( fd_exec_tile_ctx_t * ctx ,
243
- fd_runtime_public_snap_hash_msg_t * msg ) {
244
-
245
- ulong * num_pairs = fd_wksp_laddr_fast ( ctx -> runtime_public_wksp , msg -> num_pairs_out_gaddr );
246
- if ( FD_UNLIKELY ( !num_pairs ) ) {
247
- FD_LOG_ERR (( "Unable to join num_pairs" ));
248
- }
249
- fd_pubkey_hash_pair_t * pairs = fd_wksp_laddr_fast ( ctx -> runtime_public_wksp , msg -> pairs_gaddr );
250
- if ( FD_UNLIKELY ( !pairs ) ) {
251
- FD_LOG_ERR (( "Unable to join pairs" ));
252
- }
253
- fd_lthash_value_t * lthash_value = fd_wksp_laddr_fast ( ctx -> runtime_public_wksp , msg -> lt_hash_value_out_gaddr );
254
- if ( FD_UNLIKELY ( !lthash_value ) ) {
255
- FD_LOG_ERR (( "Unable to join lthash values" ));
256
- }
257
-
258
- fd_accounts_sorted_subrange_gather ( ctx -> funk , (uint )ctx -> tile_idx , (uint )ctx -> tile_cnt ,
259
- num_pairs , lthash_value ,
260
- pairs , & ctx -> runtime_public -> features );
261
- }
262
-
263
248
static void
264
249
during_frag ( fd_exec_tile_ctx_t * ctx ,
265
250
ulong in_idx ,
@@ -289,15 +274,8 @@ during_frag( fd_exec_tile_ctx_t * ctx,
289
274
FD_LOG_DEBUG (( "hash accs=%lu msg recvd" , msg -> end_idx - msg -> start_idx ));
290
275
hash_accounts ( ctx , msg );
291
276
return ;
292
- } else if ( sig == EXEC_SNAP_HASH_ACCS_CNT_SIG ) {
293
- FD_LOG_DEBUG (( "snap hash count msg recvd" ));
294
- snap_hash_count ( ctx );
295
- } else if ( sig == EXEC_SNAP_HASH_ACCS_GATHER_SIG ) {
296
- fd_runtime_public_snap_hash_msg_t * msg = fd_chunk_to_laddr ( ctx -> replay_in_mem , chunk );
297
- FD_LOG_DEBUG (( "snap hash gather msg recvd" ));
298
- snap_hash_gather ( ctx , msg );
299
277
} else {
300
- FD_LOG_ERR (( "Unknown signature" ));
278
+ FD_LOG_CRIT (( "Unknown signature" ));
301
279
}
302
280
}
303
281
}
@@ -326,14 +304,15 @@ after_frag( fd_exec_tile_ctx_t * ctx,
326
304
msg -> exec_tile_id = (uchar )ctx -> tile_idx ;
327
305
msg -> txn_id = ctx -> txn_id ;
328
306
329
- fd_stem_publish ( stem ,
330
- exec_out -> idx ,
331
- FD_WRITER_TXN_SIG ,
332
- exec_out -> chunk ,
333
- sizeof (* msg ),
334
- 0UL ,
335
- tsorig ,
336
- tspub );
307
+ fd_stem_publish (
308
+ stem ,
309
+ exec_out -> idx ,
310
+ FD_WRITER_TXN_SIG ,
311
+ exec_out -> chunk ,
312
+ sizeof (* msg ),
313
+ 0UL ,
314
+ tsorig ,
315
+ tspub );
337
316
exec_out -> chunk = fd_dcache_compact_next ( exec_out -> chunk , sizeof (* msg ), exec_out -> chunk0 , exec_out -> wmark );
338
317
339
318
/* Make sure that the txn/bpf id can never be equal to the sentinel
@@ -345,22 +324,11 @@ after_frag( fd_exec_tile_ctx_t * ctx,
345
324
} else if ( sig == EXEC_HASH_ACCS_SIG ) {
346
325
FD_LOG_DEBUG (( "Sending ack for hash accs msg" ));
347
326
fd_fseq_update ( ctx -> exec_fseq , fd_exec_fseq_set_hash_done ( ctx -> slot ) );
348
- } else if ( sig == EXEC_SNAP_HASH_ACCS_CNT_SIG ) {
349
- FD_LOG_NOTICE (( "Sending ack for snap hash count msg pairs_len=%lu" , ctx -> pairs_len ));
350
- fd_fseq_update ( ctx -> exec_fseq , fd_exec_fseq_set_snap_hash_cnt_done ( (uint )ctx -> pairs_len ) );
351
- } else if ( sig == EXEC_SNAP_HASH_ACCS_GATHER_SIG ) {
352
- FD_LOG_NOTICE (("Sending ack for snap hash gather msg" ));
353
- fd_fseq_update ( ctx -> exec_fseq , fd_exec_fseq_set_snap_hash_gather_done () );
354
327
} else {
355
328
FD_LOG_ERR (( "Unknown message signature" ));
356
329
}
357
330
}
358
331
359
- static void
360
- privileged_init ( fd_topo_t * topo FD_PARAM_UNUSED ,
361
- fd_topo_tile_t * tile FD_PARAM_UNUSED ) {
362
- }
363
-
364
332
static void
365
333
unprivileged_init ( fd_topo_t * topo ,
366
334
fd_topo_tile_t * tile ) {
@@ -629,8 +597,6 @@ populate_allowed_fds( fd_topo_t const * topo,
629
597
return out_cnt ;
630
598
}
631
599
632
- /* The stem burst is bound by the max number of exec tiles that are
633
- posible. */
634
600
#define STEM_BURST (1UL)
635
601
636
602
#define STEM_CALLBACK_CONTEXT_TYPE fd_exec_tile_ctx_t
@@ -649,7 +615,6 @@ fd_topo_run_tile_t fd_tile_execor = {
649
615
.populate_allowed_fds = populate_allowed_fds ,
650
616
.scratch_align = scratch_align ,
651
617
.scratch_footprint = scratch_footprint ,
652
- .privileged_init = privileged_init ,
653
618
.unprivileged_init = unprivileged_init ,
654
619
.run = stem_run ,
655
620
};
0 commit comments