-
Notifications
You must be signed in to change notification settings - Fork 181
/
fd_runtime.c
4728 lines (3954 loc) · 198 KB
/
fd_runtime.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "fd_runtime.h"
#include "fd_acc_mgr.h"
#include "fd_runtime_err.h"
#include "fd_runtime_init.h"
#include "fd_pubkey_utils.h"
#include "fd_executor.h"
#include "fd_account.h"
#include "fd_hashes.h"
#include "sysvar/fd_sysvar_cache.h"
#include "sysvar/fd_sysvar_clock.h"
#include "sysvar/fd_sysvar_epoch_schedule.h"
#include "sysvar/fd_sysvar_recent_hashes.h"
#include "sysvar/fd_sysvar_stake_history.h"
#include "sysvar/fd_sysvar.h"
#include "../../ballet/base58/fd_base58.h"
#include "../../ballet/txn/fd_txn.h"
#include "../../ballet/bmtree/fd_bmtree.h"
#include "../../ballet/bmtree/fd_wbmtree.h"
#include "../stakes/fd_stakes.h"
#include "../rewards/fd_rewards.h"
#include "context/fd_exec_txn_ctx.h"
#include "context/fd_exec_instr_ctx.h"
#include "info/fd_microblock_batch_info.h"
#include "info/fd_microblock_info.h"
#include "program/fd_stake_program.h"
#include "program/fd_builtin_programs.h"
#include "program/fd_system_program.h"
#include "program/fd_vote_program.h"
#include "program/fd_bpf_program_util.h"
#include "program/fd_bpf_loader_program.h"
#include "program/fd_compute_budget_program.h"
#include "sysvar/fd_sysvar_clock.h"
#include "sysvar/fd_sysvar_fees.h"
#include "sysvar/fd_sysvar_last_restart_slot.h"
#include "sysvar/fd_sysvar_recent_hashes.h"
#include "sysvar/fd_sysvar_rent.h"
#include "sysvar/fd_sysvar_slot_hashes.h"
#include "sysvar/fd_sysvar_slot_history.h"
#include "../nanopb/pb_decode.h"
#include "../nanopb/pb_encode.h"
#include "../types/fd_solana_block.pb.h"
#include "fd_system_ids.h"
#include "../vm/fd_vm.h"
#include "fd_blockstore.h"
#include "../../ballet/pack/fd_pack.h"
#include "../fd_rwlock.h"
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#define MICRO_LAMPORTS_PER_LAMPORT (1000000UL)
void
fd_runtime_init_bank_from_genesis( fd_exec_slot_ctx_t * slot_ctx,
fd_genesis_solana_t * genesis_block,
fd_hash_t const * genesis_hash ) {
slot_ctx->slot_bank.slot = 0;
memcpy(&slot_ctx->slot_bank.poh, genesis_hash->hash, FD_SHA256_HASH_SZ);
memset(slot_ctx->slot_bank.banks_hash.hash, 0, FD_SHA256_HASH_SZ);
slot_ctx->slot_bank.fee_rate_governor = genesis_block->fee_rate_governor;
slot_ctx->slot_bank.lamports_per_signature = 0UL;
slot_ctx->prev_lamports_per_signature = 0UL;
fd_poh_config_t *poh = &genesis_block->poh_config;
fd_exec_epoch_ctx_t * epoch_ctx = slot_ctx->epoch_ctx;
fd_epoch_bank_t * epoch_bank = fd_exec_epoch_ctx_epoch_bank( epoch_ctx );
if (poh->has_hashes_per_tick)
epoch_bank->hashes_per_tick = poh->hashes_per_tick;
else
epoch_bank->hashes_per_tick = 0;
epoch_bank->ticks_per_slot = genesis_block->ticks_per_slot;
epoch_bank->genesis_creation_time = genesis_block->creation_time;
uint128 target_tick_duration = ((uint128)poh->target_tick_duration.seconds * 1000000000UL + (uint128)poh->target_tick_duration.nanoseconds);
epoch_bank->ns_per_slot = target_tick_duration * epoch_bank->ticks_per_slot;
epoch_bank->slots_per_year = SECONDS_PER_YEAR * (1000000000.0 / (double)target_tick_duration) / (double)epoch_bank->ticks_per_slot;
epoch_bank->genesis_creation_time = genesis_block->creation_time;
slot_ctx->slot_bank.max_tick_height = epoch_bank->ticks_per_slot * (slot_ctx->slot_bank.slot + 1);
epoch_bank->epoch_schedule = genesis_block->epoch_schedule;
epoch_bank->inflation = genesis_block->inflation;
epoch_bank->rent = genesis_block->rent;
slot_ctx->slot_bank.block_height = 0UL;
fd_block_block_hash_entry_t *hashes = slot_ctx->slot_bank.recent_block_hashes.hashes =
deq_fd_block_block_hash_entry_t_alloc( slot_ctx->valloc, FD_SYSVAR_RECENT_HASHES_CAP );
fd_block_block_hash_entry_t *elem = deq_fd_block_block_hash_entry_t_push_head_nocopy(hashes);
fd_block_block_hash_entry_new(elem);
fd_memcpy(elem->blockhash.hash, genesis_hash, FD_SHA256_HASH_SZ);
elem->fee_calculator.lamports_per_signature = 0UL;
slot_ctx->slot_bank.block_hash_queue.ages_root = NULL;
slot_ctx->slot_bank.block_hash_queue.ages_pool = fd_hash_hash_age_pair_t_map_alloc( slot_ctx->valloc, 400 );
fd_hash_hash_age_pair_t_mapnode_t * node = fd_hash_hash_age_pair_t_map_acquire( slot_ctx->slot_bank.block_hash_queue.ages_pool );
node->elem = (fd_hash_hash_age_pair_t){
.key = *genesis_hash,
.val = (fd_hash_age_t){ .hash_index = 0, .fee_calculator = (fd_fee_calculator_t){.lamports_per_signature = 0UL}, .timestamp = (ulong)fd_log_wallclock() }
};
fd_hash_hash_age_pair_t_map_insert( slot_ctx->slot_bank.block_hash_queue.ages_pool, &slot_ctx->slot_bank.block_hash_queue.ages_root, node );
slot_ctx->slot_bank.block_hash_queue.last_hash_index = 0;
slot_ctx->slot_bank.block_hash_queue.last_hash = fd_valloc_malloc( slot_ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
fd_memcpy( slot_ctx->slot_bank.block_hash_queue.last_hash, genesis_hash, FD_SHA256_HASH_SZ );
slot_ctx->slot_bank.block_hash_queue.max_age = FD_BLOCKHASH_QUEUE_MAX_ENTRIES;
slot_ctx->signature_cnt = 0;
/* Derive epoch stakes */
fd_vote_accounts_pair_t_mapnode_t * vacc_pool = fd_exec_epoch_ctx_stake_votes_join( epoch_ctx );
FD_TEST(vacc_pool);
fd_vote_accounts_pair_t_mapnode_t * vacc_root = NULL;
fd_delegation_pair_t_mapnode_t * sacc_pool = fd_exec_epoch_ctx_stake_delegations_join( epoch_ctx );
fd_delegation_pair_t_mapnode_t * sacc_root = NULL;
fd_stake_history_treap_t * stake_history_treap = fd_exec_epoch_ctx_stake_history_treap_join( epoch_ctx );
fd_stake_history_entry_t * stake_history_pool = fd_exec_epoch_ctx_stake_history_pool_join ( epoch_ctx );
fd_acc_lamports_t capitalization = 0UL;
for (ulong i = 0UL; i < genesis_block->accounts_len; i++) {
fd_pubkey_account_pair_t const *acc = &genesis_block->accounts[i];
capitalization = fd_ulong_sat_add(capitalization, acc->account.lamports);
if (0 == memcmp(acc->account.owner.key, fd_solana_vote_program_id.key, sizeof(fd_pubkey_t))) {
/* Vote Program Account */
fd_vote_accounts_pair_t_mapnode_t *node =
fd_vote_accounts_pair_t_map_acquire(vacc_pool);
FD_TEST(node);
fd_vote_block_timestamp_t last_timestamp;
fd_pubkey_t node_pubkey;
FD_SCRATCH_SCOPE_BEGIN {
/* Deserialize content */
fd_vote_state_versioned_t vs[1];
fd_bincode_decode_ctx_t decode =
{ .data = acc->account.data,
.dataend = acc->account.data + acc->account.data_len,
.valloc = fd_scratch_virtual() };
int decode_err = fd_vote_state_versioned_decode( vs, &decode );
if( FD_UNLIKELY( decode_err!=FD_BINCODE_SUCCESS ) ) {
FD_LOG_WARNING(( "fd_vote_state_versioned_decode failed (%d)", decode_err ));
return;
}
switch( vs->discriminant )
{
case fd_vote_state_versioned_enum_current:
last_timestamp = vs->inner.current.last_timestamp;
node_pubkey = vs->inner.current.node_pubkey;
break;
case fd_vote_state_versioned_enum_v0_23_5:
last_timestamp = vs->inner.v0_23_5.last_timestamp;
node_pubkey = vs->inner.v0_23_5.node_pubkey;
break;
case fd_vote_state_versioned_enum_v1_14_11:
last_timestamp = vs->inner.v1_14_11.last_timestamp;
node_pubkey = vs->inner.v1_14_11.node_pubkey;
break;
default:
__builtin_unreachable();
}
} FD_SCRATCH_SCOPE_END;
fd_memcpy(node->elem.key.key, acc->key.key, sizeof(fd_pubkey_t));
node->elem.stake = acc->account.lamports;
node->elem.value = (fd_solana_vote_account_t){
.lamports = acc->account.lamports,
.node_pubkey = node_pubkey,
.last_timestamp_ts = last_timestamp.timestamp,
.last_timestamp_slot = last_timestamp.slot,
.owner = acc->account.owner,
.executable = acc->account.executable,
.rent_epoch = acc->account.rent_epoch};
fd_vote_accounts_pair_t_map_insert(vacc_pool, &vacc_root, node);
FD_LOG_INFO(( "Adding genesis vote account: key=%s stake=%lu",
FD_BASE58_ENC_32_ALLOCA( node->elem.key.key ),
node->elem.stake ));
} else if (0 == memcmp(acc->account.owner.key, fd_solana_stake_program_id.key, sizeof(fd_pubkey_t))) {
/* stake program account */
fd_stake_state_v2_t stake_state = {0};
fd_account_meta_t meta = {.dlen = acc->account.data_len};
fd_borrowed_account_t stake_account = {
.const_data = acc->account.data,
.const_meta = &meta,
.data = acc->account.data,
.meta = &meta};
FD_TEST(fd_stake_get_state(&stake_account, &slot_ctx->valloc, &stake_state) == 0);
if( stake_state.inner.stake.stake.delegation.stake == 0 ) continue;
fd_delegation_pair_t_mapnode_t query_node;
fd_memcpy(&query_node.elem.account, acc->key.key, sizeof(fd_pubkey_t));
fd_delegation_pair_t_mapnode_t *node = fd_delegation_pair_t_map_find(sacc_pool, sacc_root, &query_node);
if (node == NULL) {
node = fd_delegation_pair_t_map_acquire(sacc_pool);
fd_memcpy(&node->elem.account, acc->key.key, sizeof(fd_pubkey_t));
fd_memcpy(&node->elem.delegation, &stake_state.inner.stake.stake.delegation, sizeof(fd_delegation_t));
fd_delegation_pair_t_map_insert(sacc_pool, &sacc_root, node);
} else {
fd_memcpy(&node->elem.account, acc->key.key, sizeof(fd_pubkey_t));
fd_memcpy(&node->elem.delegation, &stake_state.inner.stake.stake.delegation, sizeof(fd_delegation_t));
}
} else if (0 == memcmp(acc->account.owner.key, fd_solana_feature_program_id.key, sizeof(fd_pubkey_t))) {
/* Feature Account */
/* Scan list of feature IDs to resolve address => feature offset */
fd_feature_id_t const *found = NULL;
for (fd_feature_id_t const *id = fd_feature_iter_init();
!fd_feature_iter_done(id);
id = fd_feature_iter_next(id)) {
if (0 == memcmp(acc->key.key, id->id.key, sizeof(fd_pubkey_t)))
{
found = id;
break;
}
}
if (found) {
/* Load feature activation */
FD_SCRATCH_SCOPE_BEGIN {
fd_bincode_decode_ctx_t decode = {.data = acc->account.data,
.dataend = acc->account.data + acc->account.data_len,
.valloc = fd_scratch_virtual()};
fd_feature_t feature;
int err = fd_feature_decode( &feature, &decode );
FD_TEST( err==FD_BINCODE_SUCCESS );
if( feature.has_activated_at ) {
FD_LOG_DEBUG(( "Feature %s activated at %lu (genesis)", FD_BASE58_ENC_32_ALLOCA( acc->key.key ), feature.activated_at ));
fd_features_set( &slot_ctx->epoch_ctx->features, found, feature.activated_at);
} else {
FD_LOG_DEBUG(( "Feature %s not activated (genesis)", FD_BASE58_ENC_32_ALLOCA( acc->key.key ) ));
fd_features_set( &slot_ctx->epoch_ctx->features, found, ULONG_MAX);
}
} FD_SCRATCH_SCOPE_END;
}
}
}
slot_ctx->slot_bank.epoch_stakes.vote_accounts_pool = fd_vote_accounts_pair_t_map_alloc( slot_ctx->valloc, 100000 ); /* FIXME remove magic constant */
slot_ctx->slot_bank.epoch_stakes.vote_accounts_root = NULL;
fd_vote_accounts_pair_t_mapnode_t * next_pool = fd_exec_epoch_ctx_next_epoch_stakes_join( slot_ctx->epoch_ctx );
fd_vote_accounts_pair_t_mapnode_t * next_root = NULL;
for( fd_vote_accounts_pair_t_mapnode_t *n = fd_vote_accounts_pair_t_map_minimum( vacc_pool, vacc_root );
n;
n = fd_vote_accounts_pair_t_map_successor( vacc_pool, n )) {
fd_vote_accounts_pair_t_mapnode_t * e = fd_vote_accounts_pair_t_map_acquire( slot_ctx->slot_bank.epoch_stakes.vote_accounts_pool );
fd_memcpy( &e->elem, &n->elem, sizeof(fd_vote_accounts_pair_t));
fd_vote_accounts_pair_t_map_insert( slot_ctx->slot_bank.epoch_stakes.vote_accounts_pool, &slot_ctx->slot_bank.epoch_stakes.vote_accounts_root, e );
fd_vote_accounts_pair_t_mapnode_t * next_e = fd_vote_accounts_pair_t_map_acquire( next_pool );
fd_memcpy( &next_e->elem, &n->elem, sizeof(fd_vote_accounts_pair_t));
fd_vote_accounts_pair_t_map_insert( next_pool, &next_root, next_e );
}
for( fd_delegation_pair_t_mapnode_t *n = fd_delegation_pair_t_map_minimum( sacc_pool, sacc_root );
n;
n = fd_delegation_pair_t_map_successor( sacc_pool, n )) {
fd_vote_accounts_pair_t_mapnode_t query_voter;
fd_pubkey_t *voter_pubkey = &n->elem.delegation.voter_pubkey;
fd_memcpy(&query_voter.elem.key, voter_pubkey, sizeof(fd_pubkey_t));
fd_vote_accounts_pair_t_mapnode_t *voter = fd_vote_accounts_pair_t_map_find(vacc_pool, vacc_root, &query_voter);
if (voter != NULL)
voter->elem.stake = fd_ulong_sat_add(voter->elem.stake, n->elem.delegation.stake);
}
epoch_bank->next_epoch_stakes = (fd_vote_accounts_t){
.vote_accounts_pool = next_pool,
.vote_accounts_root = next_root,
};
/* Initializes the stakes cache in the Bank structure. */
epoch_bank->stakes = (fd_stakes_t){
.stake_delegations_pool = sacc_pool,
.stake_delegations_root = sacc_root,
.epoch = 0,
.unused = 0,
.vote_accounts = (fd_vote_accounts_t){
.vote_accounts_pool = vacc_pool,
.vote_accounts_root = vacc_root},
.stake_history = (fd_stake_history_t){.pool = stake_history_pool, .treap = stake_history_treap}};
slot_ctx->slot_bank.capitalization = capitalization;
slot_ctx->slot_bank.timestamp_votes.votes_pool =
fd_clock_timestamp_vote_t_map_alloc( slot_ctx->valloc, 10000 ); /* FIXME: remove magic constant */
slot_ctx->slot_bank.timestamp_votes.votes_root = NULL;
}
void fd_runtime_init_program(fd_exec_slot_ctx_t *slot_ctx)
{
fd_sysvar_recent_hashes_init(slot_ctx);
fd_sysvar_clock_init(slot_ctx);
fd_sysvar_slot_history_init(slot_ctx);
// fd_sysvar_slot_hashes_init( slot_ctx );
fd_sysvar_epoch_schedule_init(slot_ctx);
if( !FD_FEATURE_ACTIVE(slot_ctx, disable_fees_sysvar) ) {
fd_sysvar_fees_init(slot_ctx);
}
fd_sysvar_rent_init(slot_ctx);
fd_sysvar_stake_history_init(slot_ctx);
fd_sysvar_last_restart_slot_init(slot_ctx);
fd_builtin_programs_init(slot_ctx);
fd_stake_program_config_init(slot_ctx);
}
int fd_runtime_parse_microblock_hdr(void const *buf,
ulong buf_sz,
fd_microblock_hdr_t *opt_microblock_hdr,
ulong *opt_microblock_hdr_size)
{
if (buf_sz < sizeof(fd_microblock_hdr_t))
{
return -1;
}
if (opt_microblock_hdr != NULL)
{
*opt_microblock_hdr = *(fd_microblock_hdr_t *)buf;
}
if (opt_microblock_hdr_size != NULL)
{
*opt_microblock_hdr_size = sizeof(fd_microblock_hdr_t);
}
return 0;
}
int fd_runtime_parse_microblock_txns( void const * buf,
ulong buf_sz,
fd_microblock_hdr_t const * microblock_hdr,
fd_txn_p_t * out_txns,
ulong * out_signature_cnt,
ulong * out_account_cnt,
ulong * out_microblock_txns_sz ) {
ulong buf_off = 0;
ulong signature_cnt = 0;
ulong account_cnt = 0;
for (ulong i = 0; i < microblock_hdr->txn_cnt; i++) {
ulong payload_sz = 0;
ulong txn_sz = fd_txn_parse_core( (uchar const *)buf + buf_off, fd_ulong_min( buf_sz-buf_off, FD_TXN_MTU), TXN(&out_txns[i]), NULL, &payload_sz );
if (txn_sz == 0 || txn_sz > FD_TXN_MTU) {
return -1;
}
fd_memcpy( out_txns[i].payload, (uchar *)buf + buf_off, payload_sz );
out_txns[i].payload_sz = (ushort)payload_sz;
signature_cnt += TXN(&out_txns[i])->signature_cnt;
account_cnt += fd_txn_account_cnt( TXN(&out_txns[i]), FD_TXN_ACCT_CAT_ALL );
buf_off += payload_sz;
}
*out_signature_cnt = signature_cnt;
*out_account_cnt = account_cnt;
*out_microblock_txns_sz = buf_off;
return 0;
}
int fd_runtime_microblock_prepare(void const *buf,
ulong buf_sz,
fd_valloc_t valloc,
fd_microblock_info_t *out_microblock_info) {
fd_microblock_info_t microblock_info = {
.raw_microblock = buf,
.signature_cnt = 0,
};
ulong buf_off = 0;
ulong hdr_sz = 0;
if (fd_runtime_parse_microblock_hdr(buf, buf_sz, µblock_info.microblock_hdr, &hdr_sz) != 0)
{
return -1;
}
buf_off += hdr_sz;
ulong txn_cnt = microblock_info.microblock_hdr.txn_cnt;
microblock_info.txns = fd_valloc_malloc(valloc, alignof(fd_txn_p_t), txn_cnt * sizeof(fd_txn_p_t));
ulong txns_sz = 0;
if (fd_runtime_parse_microblock_txns((uchar *)buf + buf_off,
buf_sz - buf_off,
µblock_info.microblock_hdr,
microblock_info.txns,
µblock_info.signature_cnt,
µblock_info.account_cnt,
&txns_sz) != 0)
{
fd_valloc_free(valloc, microblock_info.txns);
return -1;
}
buf_off += txns_sz;
microblock_info.raw_microblock_sz = buf_off;
*out_microblock_info = microblock_info;
return 0;
}
int fd_runtime_microblock_batch_prepare(void const *buf,
ulong buf_sz,
fd_valloc_t valloc,
fd_microblock_batch_info_t * out_microblock_batch_info) {
fd_microblock_batch_info_t microblock_batch_info = {
.raw_microblock_batch = buf,
.signature_cnt = 0,
.txn_cnt = 0,
.account_cnt = 0,
};
ulong buf_off = 0;
if (FD_UNLIKELY(buf_sz < sizeof(ulong)))
{
FD_LOG_WARNING(("microblock batch buffer too small"));
return -1;
}
ulong microblock_cnt = FD_LOAD(ulong, buf);
buf_off += sizeof(ulong);
microblock_batch_info.microblock_cnt = microblock_cnt;
microblock_batch_info.microblock_infos = fd_valloc_malloc(valloc, alignof(fd_microblock_info_t), microblock_cnt * sizeof(fd_microblock_info_t));
ulong signature_cnt = 0;
ulong txn_cnt = 0;
ulong account_cnt = 0;
for (ulong i = 0; i < microblock_cnt; i++) {
fd_microblock_info_t * microblock_info = µblock_batch_info.microblock_infos[i];
if (fd_runtime_microblock_prepare((uchar const *)buf + buf_off, buf_sz - buf_off, valloc, microblock_info) != 0)
{
fd_valloc_free(valloc, microblock_batch_info.microblock_infos);
return -1;
}
signature_cnt += microblock_info->signature_cnt;
txn_cnt += microblock_info->microblock_hdr.txn_cnt;
account_cnt += microblock_info->account_cnt;
buf_off += microblock_info->raw_microblock_sz;
}
microblock_batch_info.signature_cnt = signature_cnt;
microblock_batch_info.txn_cnt = txn_cnt;
microblock_batch_info.account_cnt = account_cnt;
microblock_batch_info.raw_microblock_batch_sz = buf_off;
*out_microblock_batch_info = microblock_batch_info;
return 0;
}
// static void dump_iter( fd_raw_block_txn_iter_t iter ) {
// FD_LOG_WARNING(( "Curr iter data sz %lu offset %lu num txns %lu num mblks %lu curr txn sz %lu", iter.data_sz, iter.curr_offset, iter.remaining_txns, iter.remaining_microblocks, iter.curr_txn_sz ));
// }
static fd_raw_block_txn_iter_t
find_next_txn_in_raw_block( uchar const * data, ulong data_sz, ulong existing_offset, ulong num_microblocks ) {
uchar const * base = data;
ulong num_txns = 0UL;
ulong sz = (ulong)data - (ulong)base;
while( !num_txns && (sz < data_sz) ) {
while( num_microblocks == 0 && (sz < data_sz) ) {
num_microblocks = FD_LOAD( ulong, data );
data += sizeof( ulong );
sz = (ulong)data - (ulong)base;
}
fd_microblock_info_t microblock_info = {
.raw_microblock = data,
.signature_cnt = 0,
};
while( microblock_info.microblock_hdr.txn_cnt == 0 && num_microblocks && sz < data_sz ) {
ulong hdr_sz = 0;
memset( µblock_info, 0UL, sizeof(fd_microblock_info_t) );
microblock_info.raw_microblock = data;
if (fd_runtime_parse_microblock_hdr(data, data_sz - sz, µblock_info.microblock_hdr, &hdr_sz) != 0) {
return (fd_raw_block_txn_iter_t){
.data_sz = 0,
.curr_offset = data_sz,
.remaining_microblocks = 0,
.remaining_txns = 0,
.curr_txn_sz = ULONG_MAX
};
}
data += hdr_sz;
sz = (ulong)data - (ulong)base;
num_microblocks--;
}
num_txns = microblock_info.microblock_hdr.txn_cnt;
}
ulong curr_off = sz;
return (fd_raw_block_txn_iter_t){
.data_sz = fd_ulong_sat_sub(data_sz, curr_off),
.curr_offset = existing_offset + curr_off,
.remaining_microblocks = num_microblocks,
.remaining_txns = num_txns,
.curr_txn_sz = ULONG_MAX
};
}
fd_raw_block_txn_iter_t
fd_raw_block_txn_iter_init( uchar const * data, ulong data_sz ) {
return find_next_txn_in_raw_block( data, data_sz, 0, 0 );
}
ulong
fd_raw_block_txn_iter_done( fd_raw_block_txn_iter_t iter ) {
return iter.data_sz == 0;
}
fd_raw_block_txn_iter_t
fd_raw_block_txn_iter_next( uchar const * data, fd_raw_block_txn_iter_t iter ) {
fd_txn_p_t out_txn;
if( iter.curr_txn_sz == ULONG_MAX ) {
ulong payload_sz = 0;
ulong txn_sz = fd_txn_parse_core( data + iter.curr_offset, fd_ulong_min( iter.data_sz, FD_TXN_MTU), TXN(&out_txn), NULL, &payload_sz );
if (txn_sz == 0 || txn_sz > FD_TXN_MTU) {
FD_LOG_ERR(("Invalid txn parse"));
}
iter.data_sz -= payload_sz;
iter.curr_offset += payload_sz;
} else {
iter.data_sz -= iter.curr_txn_sz;
iter.curr_offset += iter.curr_txn_sz;
iter.curr_txn_sz = ULONG_MAX;
}
if( --iter.remaining_txns ) {
return iter;
}
return find_next_txn_in_raw_block( data + iter.curr_offset, iter.data_sz, iter.curr_offset, iter.remaining_microblocks );
}
void
fd_raw_block_txn_iter_ele( uchar const * data, fd_raw_block_txn_iter_t iter, fd_txn_p_t * out_txn ) {
ulong payload_sz = 0;
ulong txn_sz = fd_txn_parse_core( data + iter.curr_offset, fd_ulong_min( iter.data_sz, FD_TXN_MTU), TXN(out_txn), NULL, &payload_sz );
if (txn_sz == 0 || txn_sz > FD_TXN_MTU) {
FD_LOG_ERR(("Invalid txn parse %lu", txn_sz));
}
fd_memcpy( out_txn->payload, data + iter.curr_offset, payload_sz );
out_txn->payload_sz = (ushort)payload_sz;
iter.curr_txn_sz = payload_sz;
}
fd_microblock_txn_iter_t
fd_microblock_txn_iter_init( fd_microblock_info_t const * microblock_info FD_PARAM_UNUSED ) {
return 0UL;
}
ulong
fd_microblock_txn_iter_done( fd_microblock_info_t const * microblock_info, fd_microblock_txn_iter_t iter ) {
return iter >= microblock_info->microblock_hdr.txn_cnt;
}
fd_microblock_txn_iter_t
fd_microblock_txn_iter_next( fd_microblock_info_t const * microblock_info FD_PARAM_UNUSED, fd_microblock_txn_iter_t iter ) {
return iter + 1UL;
}
fd_txn_p_t *
fd_microblock_txn_iter_ele( fd_microblock_info_t const * microblock_info, fd_microblock_txn_iter_t iter ) {
return µblock_info->txns[iter];
}
fd_microblock_batch_txn_iter_t
fd_microblock_batch_txn_iter_init( fd_microblock_batch_info_t const * microblock_batch_info ) {
fd_microblock_batch_txn_iter_t iter = {
.curr_microblock = ULONG_MAX,
};
for( ulong i = 0UL; i < microblock_batch_info->microblock_cnt; i++ ) {
if( microblock_batch_info->microblock_infos[i].microblock_hdr.txn_cnt > 0 ) {
iter.curr_microblock = i;
break;
}
}
iter.microblock_iter = fd_microblock_txn_iter_init( µblock_batch_info->microblock_infos[iter.curr_microblock] );
return iter;
}
ulong
fd_microblock_batch_txn_iter_done( fd_microblock_batch_info_t const * microblock_batch_info, fd_microblock_batch_txn_iter_t iter ) {
return iter.curr_microblock >= microblock_batch_info->microblock_cnt;
}
fd_microblock_batch_txn_iter_t
fd_microblock_batch_txn_iter_next( fd_microblock_batch_info_t const * microblock_batch_info, fd_microblock_batch_txn_iter_t iter ) {
iter.microblock_iter = fd_microblock_txn_iter_next( µblock_batch_info->microblock_infos[iter.curr_microblock], iter.microblock_iter );
while( fd_microblock_txn_iter_done( µblock_batch_info->microblock_infos[iter.curr_microblock], iter.microblock_iter ) ) {
iter.curr_microblock++;
if( iter.curr_microblock >= microblock_batch_info->microblock_cnt ) {
break;
}
iter.microblock_iter = fd_microblock_txn_iter_init( µblock_batch_info->microblock_infos[iter.curr_microblock] );
}
return iter;
}
fd_txn_p_t *
fd_microblock_batch_txn_iter_ele( fd_microblock_batch_info_t const * microblock_batch_info, fd_microblock_batch_txn_iter_t iter ) {
return fd_microblock_txn_iter_ele( µblock_batch_info->microblock_infos[iter.curr_microblock], iter.microblock_iter );
}
fd_block_txn_iter_t
fd_block_txn_iter_init( fd_block_info_t const * block_info ) {
fd_block_txn_iter_t iter = {
.curr_batch = ULONG_MAX,
};
for( ulong i = 0UL; i < block_info->microblock_batch_cnt; i++ ) {
if( block_info->microblock_batch_infos[i].txn_cnt > 0 ) {
iter.curr_batch = i;
break;
}
}
iter.microblock_batch_iter = fd_microblock_batch_txn_iter_init( &block_info->microblock_batch_infos[iter.curr_batch] );
return iter;
}
ulong
fd_block_txn_iter_done( fd_block_info_t const * block_info, fd_block_txn_iter_t iter ) {
return iter.curr_batch >= block_info->microblock_batch_cnt;
}
fd_block_txn_iter_t
fd_block_txn_iter_next( fd_block_info_t const * block_info, fd_block_txn_iter_t iter ) {
iter.microblock_batch_iter = fd_microblock_batch_txn_iter_next( &block_info->microblock_batch_infos[iter.curr_batch], iter.microblock_batch_iter );
while( fd_microblock_batch_txn_iter_done( &block_info->microblock_batch_infos[iter.curr_batch], iter.microblock_batch_iter ) ) {
iter.curr_batch++;
if( iter.curr_batch >= block_info->microblock_batch_cnt ) {
break;
}
iter.microblock_batch_iter = fd_microblock_batch_txn_iter_init( &block_info->microblock_batch_infos[iter.curr_batch] );
}
return iter;
}
fd_txn_p_t *
fd_block_txn_iter_ele( fd_block_info_t const * block_info, fd_block_txn_iter_t iter ) {
return fd_microblock_batch_txn_iter_ele( &block_info->microblock_batch_infos[iter.curr_batch], iter.microblock_batch_iter );
}
ulong
fd_runtime_microblock_collect_txns( fd_microblock_info_t const * microblock_info,
fd_txn_p_t * out_txns ) {
ulong txn_cnt = microblock_info->microblock_hdr.txn_cnt;
fd_memcpy( out_txns, microblock_info->txns, txn_cnt * sizeof(fd_txn_p_t) );
return txn_cnt;
}
ulong
fd_runtime_microblock_batch_collect_txns( fd_microblock_batch_info_t const * microblock_batch_info,
fd_txn_p_t * out_txns ) {
for( ulong i = 0; i < microblock_batch_info->microblock_cnt; i++ ) {
ulong txns_collected = fd_runtime_microblock_collect_txns( µblock_batch_info->microblock_infos[i], out_txns );
out_txns += txns_collected;
}
return microblock_batch_info->txn_cnt;
}
ulong
fd_runtime_block_collect_txns( fd_block_info_t const * block_info,
fd_txn_p_t * out_txns ) {
for( ulong i = 0; i < block_info->microblock_batch_cnt; i++ ) {
ulong txns_collected = fd_runtime_microblock_batch_collect_txns( &block_info->microblock_batch_infos[i], out_txns );
out_txns += txns_collected;
}
return block_info->txn_cnt;
}
/* This is also the maximum number of microblock batches per block */
#define FD_MAX_DATA_SHREDS_PER_SLOT (32768UL)
int fd_runtime_block_prepare(void const *buf,
ulong buf_sz,
fd_valloc_t valloc,
fd_block_info_t *out_block_info) {
fd_block_info_t block_info = {
.raw_block = buf,
.signature_cnt = 0,
.txn_cnt = 0,
};
ulong buf_off = 0;
ulong microblock_batch_cnt = 0;
ulong microblock_cnt = 0;
ulong signature_cnt = 0;
ulong txn_cnt = 0;
ulong account_cnt = 0;
block_info.microblock_batch_infos = fd_valloc_malloc(valloc, alignof(fd_microblock_batch_info_t), FD_MAX_DATA_SHREDS_PER_SLOT * sizeof(fd_microblock_batch_info_t));
while (buf_off < buf_sz)
{
fd_microblock_batch_info_t *microblock_batch_info = &block_info.microblock_batch_infos[microblock_batch_cnt];
if (fd_runtime_microblock_batch_prepare((uchar const *)buf + buf_off, buf_sz - buf_off, valloc, microblock_batch_info) != 0)
{
return -1;
}
signature_cnt += microblock_batch_info->signature_cnt;
txn_cnt += microblock_batch_info->txn_cnt;
account_cnt += microblock_batch_info->account_cnt;
buf_off += microblock_batch_info->raw_microblock_batch_sz;
microblock_batch_cnt++;
microblock_cnt += microblock_batch_info->microblock_cnt;
}
block_info.microblock_batch_cnt = microblock_batch_cnt;
block_info.microblock_cnt = microblock_cnt;
block_info.signature_cnt = signature_cnt;
block_info.txn_cnt = txn_cnt;
block_info.account_cnt += account_cnt;
block_info.raw_block_sz = buf_off;
if (buf_off != buf_sz)
{
FD_LOG_WARNING(("junk at end of block - consumed: %lu, size: %lu", buf_off, buf_sz));
return -1;
}
*out_block_info = block_info;
return 0;
}
// TODO: this function doesnt do anything!
int
fd_runtime_block_verify_ticks( fd_block_info_t const * block_info,
ulong tick_height,
ulong max_tick_height ) {
(void)tick_height; (void)max_tick_height;
ulong tick_count = 0UL;
for( ulong i = 0UL; i < block_info->microblock_batch_cnt; i++ ) {
fd_microblock_batch_info_t const * microblock_batch_info = &block_info->microblock_batch_infos[ i ];
for( ulong j = 0UL; j < microblock_batch_info->microblock_cnt; j++ ) {
fd_microblock_info_t const * microblock_info = µblock_batch_info->microblock_infos[ i ];
if( microblock_info->microblock_hdr.txn_cnt == 0UL ) {
/* if this mblk is a tick */
tick_count++;
}
}
}
(void)tick_count;
return 0;
}
void
fd_runtime_microblock_destroy( fd_valloc_t valloc,
fd_microblock_info_t * microblock_info ) {
if( microblock_info == NULL ) {
return;
}
fd_valloc_free( valloc, microblock_info->txns );
}
void
fd_runtime_microblock_batch_destroy( fd_valloc_t valloc,
fd_microblock_batch_info_t * microblock_batch_info ) {
if( microblock_batch_info == NULL ) {
return;
}
for( ulong i = 0; i < microblock_batch_info->microblock_cnt; i++ ) {
fd_runtime_microblock_destroy( valloc, µblock_batch_info->microblock_infos[i] );
}
fd_valloc_free( valloc, microblock_batch_info->microblock_infos );
}
void
fd_runtime_block_destroy( fd_valloc_t valloc,
fd_block_info_t * block_info ) {
for( ulong i = 0; i < block_info->microblock_batch_cnt; i++ ) {
fd_runtime_microblock_batch_destroy( valloc, &block_info->microblock_batch_infos[i] );
}
fd_valloc_free( valloc, block_info->microblock_batch_infos );
}
static void FD_FN_UNUSED
fd_runtime_execute_txn_task(void *tpool,
ulong t0 FD_PARAM_UNUSED, ulong t1 FD_PARAM_UNUSED,
void *args FD_PARAM_UNUSED,
void *reduce FD_PARAM_UNUSED, ulong stride FD_PARAM_UNUSED,
ulong l0 FD_PARAM_UNUSED, ulong l1 FD_PARAM_UNUSED,
ulong m0, ulong m1 FD_PARAM_UNUSED,
ulong n0 FD_PARAM_UNUSED, ulong n1 FD_PARAM_UNUSED) {
fd_execute_txn_task_info_t * task_info = (fd_execute_txn_task_info_t *)tpool + m0;
if( !( task_info->txn->flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) {
task_info->exec_res = -1;
return;
}
task_info->txn->flags |= FD_TXN_P_FLAGS_EXECUTE_SUCCESS;
// fd_txn_t const *txn = task_info->txn_ctx->txn_descriptor;
// fd_rawtxn_b_t const *raw_txn = task_info->txn_ctx->_txn_raw;
#ifdef VLOG
FD_LOG_WARNING(("executing txn - slot: %lu, txn_idx: %lu, sig: %s",
task_info->txn_ctx->slot_ctx->slot_bank.slot,
m0,
FD_BASE58_ENC_64_ALLOCA( (uchar *)raw_txn->raw + txn->signature_off )));
#endif
// Leave this here for debugging...
// char txnbuf[100];
// fd_base58_encode_64((uchar *)raw_txn->raw + txn->signature_off , NULL, txnbuf );
// if (!strcmp(txnbuf, "4RGULZH1tkq5naQzD5zmvPf9T8U5Ei7U2oTExnELf8EyHLyWNQzrDukmzNBVvde2p9NrHn5EW4N38oELejX1MDZq"))
// FD_LOG_WARNING(("hi mom"));
task_info->exec_res = fd_execute_txn( task_info->txn_ctx );
if( task_info->exec_res != 0 ) {
return;
}
fd_txn_reclaim_accounts( task_info->txn_ctx );
// FD_LOG_WARNING(( "Transaction result %d for %s %lu %lu %lu",
// task_info->exec_res,
// FD_BASE58_ENC_64_ALLOCA( (uchar *)raw_txn->raw + txn->signature_off ),
// task_info->txn_ctx->compute_meter,
// task_info->txn_ctx->compute_unit_limit,
// task_info->txn_ctx->num_instructions ));
}
int
fd_runtime_prepare_txns_start( fd_exec_slot_ctx_t * slot_ctx,
fd_execute_txn_task_info_t * task_info,
fd_txn_p_t * txns,
ulong txn_cnt ) {
int res = 0;
/* Loop across transactions */
for (ulong txn_idx = 0; txn_idx < txn_cnt; txn_idx++) {
fd_txn_p_t * txn = &txns[txn_idx];
/* Allocate/setup transaction context and task infos */
task_info[txn_idx].txn_ctx = fd_valloc_malloc( fd_scratch_virtual(), FD_EXEC_TXN_CTX_ALIGN, FD_EXEC_TXN_CTX_FOOTPRINT );
fd_exec_txn_ctx_t * txn_ctx = task_info[txn_idx].txn_ctx;
task_info[txn_idx].exec_res = 0;
task_info[txn_idx].txn = txn;
fd_txn_t const * txn_descriptor = (fd_txn_t const *) txn->_;
fd_rawtxn_b_t raw_txn = { .raw = txn->payload, .txn_sz = (ushort)txn->payload_sz };
int err = fd_execute_txn_prepare_start( slot_ctx, txn_ctx, txn_descriptor, &raw_txn );
if( FD_UNLIKELY( err ) ) {
task_info[txn_idx].exec_res = err;
txn->flags = 0U;
res |= err;
}
}
return res;
}
/* fd_txn_sigverify_task and fd_txn_pre_execute_checks_task are responisble
for the bulk of the pre-transaction execution checks in the runtime.
They aim to preserve the ordering present in the Agave client to match
parity in terms of error codes. Sigverify is kept seperate from the rest
of the transaction checks for fuzzing convenience.
For reference this is the general code path which contains all relevant
pre-transactions checks in the v2.0.x Agave client from upstream
to downstream is as follows:
confirm_slot_entries() which calls verify_ticks()
(which is currently unimplemented in firedancer) and
verify_transaction(). verify_transaction() calls verify_and_hash_message()
and verify_precompiles() which parallels fd_executor_txn_verify() and
fd_executor_verify_precompiles().
process_entries() contains a duplicate account check which is part of
agave account lock acquiring. This is checked inline in
fd_txn_pre_execute_checks_task().
load_and_execute_transactions() contains the function check_transactions().
This contains check_age() and check_status_cache() which is paralleled by
fd_check_transaction_age() and fd_executor_check_status_cache()
respectively.
load_and_execute_sanitized_transactions() contains validate_fees()
which is responsible for executing the compute budget instructions,
validating the fee payer and collecting the fee. This is mirrored in
firedancer with fd_executor_compute_budget_program_execute_instructions()
and fd_executor_collect_fees(). load_and_execute_sanitized_transactions()
also checks the total data size of the accounts in load_accounts() and
validates the program accounts in load_transaction_accounts(). This
is paralled by fd_executor_load_transaction_accounts(). */
static void FD_FN_UNUSED
fd_txn_sigverify_task( void *tpool,
ulong t0 FD_PARAM_UNUSED, ulong t1 FD_PARAM_UNUSED,
void *args FD_PARAM_UNUSED,
void *reduce FD_PARAM_UNUSED, ulong stride FD_PARAM_UNUSED,
ulong l0 FD_PARAM_UNUSED, ulong l1 FD_PARAM_UNUSED,
ulong m0, ulong m1 FD_PARAM_UNUSED,
ulong n0 FD_PARAM_UNUSED, ulong n1 FD_PARAM_UNUSED ) {
fd_execute_txn_task_info_t * task_info = (fd_execute_txn_task_info_t *)tpool + m0;
/* the txn failed sanitize sometime earlier */
if( FD_UNLIKELY( !( task_info->txn->flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) ) {
return;
}
fd_exec_txn_ctx_t * txn_ctx = task_info->txn_ctx;
if( FD_UNLIKELY( fd_executor_txn_verify( txn_ctx )!=0 ) ) {
FD_LOG_WARNING(("sigverify failed: %s", FD_BASE58_ENC_64_ALLOCA( (uchar *)txn_ctx->_txn_raw->raw+txn_ctx->txn_descriptor->signature_off ) ));
task_info->txn->flags = 0U;
task_info->exec_res = FD_RUNTIME_TXN_ERR_SIGNATURE_FAILURE;
}
}
void
fd_runtime_pre_execute_check( fd_execute_txn_task_info_t * task_info ) {
if( FD_UNLIKELY( !( task_info->txn->flags & FD_TXN_P_FLAGS_SANITIZE_SUCCESS ) ) ) {
return;
}
fd_exec_txn_ctx_t * txn_ctx = task_info->txn_ctx;
fd_funk_txn_t * parent_txn = txn_ctx->slot_ctx->funk_txn;
txn_ctx->funk_txn = parent_txn;
fd_executor_setup_borrowed_accounts_for_txn( txn_ctx );
int err;
/* https://github.com/anza-xyz/agave/blob/16de8b75ebcd57022409b422de557dd37b1de8db/sdk/src/transaction/sanitized.rs#L263-L275
TODO: Agave's precompile verification is done at the slot level, before batching and executing transactions. This logic should probably
be moved in the future. The Agave call heirarchy looks something like this:
process_single_slot
v
confirm_full_slot
v
confirm_slot_entries --------->
v v
verify_transaction process_entries
v v
verify_precompiles process_batches
v
...
v
load_and_execute_transactions
v
...
v
load_accounts --> load_transaction_accounts
v
general transaction execution
*/
err = fd_executor_verify_precompiles( txn_ctx );
if( FD_UNLIKELY( err!=FD_RUNTIME_EXECUTE_SUCCESS ) ) {
task_info->txn->flags = 0U;
task_info->exec_res = err;
return;
}
/* Post-sanitization checks. Called from `prepare_sanitized_batch()` which, for now, only is used
to lock the accounts and perform a couple basic validations.
https://github.com/anza-xyz/agave/blob/838c1952595809a31520ff1603a13f2c9123aa51/accounts-db/src/account_locks.rs#L118 */
err = fd_executor_validate_account_locks( txn_ctx );