LCOV - code coverage report
Current view: top level - disco/verify - fd_verify_tile.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 253 0.0 %
Date: 2026-11-26 02:16:43 Functions: 0 30 0.0 %

          Line data    Source code
       1             : #include "fd_verify_tile.h"
       2             : #include "../fd_txn_m.h"
       3             : #include "../metrics/fd_metrics.h"
       4             : #include <linux/futex.h>
       5             : #include "generated/fd_verify_tile_seccomp.h"
       6             : #include "../../flamenco/gossip/fd_gossip_message.h"
       7             : 
       8           0 : #define IN_KIND_QUIC   (0UL)
       9           0 : #define IN_KIND_BUNDLE (1UL)
      10             : 
      11             : FD_FN_CONST static inline ulong
      12           0 : scratch_align( void ) {
      13           0 :   return FD_TCACHE_ALIGN;
      14           0 : }
      15             : 
      16             : FD_FN_PURE static inline ulong
      17           0 : scratch_footprint( fd_topo_tile_t const * tile ) {
      18           0 :   ulong l = FD_LAYOUT_INIT;
      19           0 :   l = FD_LAYOUT_APPEND( l, alignof( fd_verify_ctx_t ), sizeof( fd_verify_ctx_t ) );
      20           0 :   l = FD_LAYOUT_APPEND( l, fd_tcache_align(), fd_tcache_footprint( tile->verify.tcache_depth, 0UL ) );
      21           0 :   l = FD_LAYOUT_APPEND( l, fd_ed25519_verifier_align(), fd_ed25519_verifier_footprint( FD_VERIFY_ED25519_CACHE_ENT_CNT ) );
      22           0 :   return FD_LAYOUT_FINI( l, scratch_align() );
      23           0 : }
      24             : 
      25             : static inline void
      26           0 : metrics_write( fd_verify_ctx_t * ctx ) {
      27           0 :   FD_MCNT_ENUM_COPY( VERIFY, TXN_PROCESSED, ctx->metrics.verify_tile_result );
      28           0 : }
      29             : 
      30             : static int
      31             : before_frag( fd_verify_ctx_t * ctx,
      32             :              ulong             in_idx,
      33             :              ulong             seq,
      34           0 :              ulong             sig ) {
      35             :   /* Bundle tile can produce both "bundles" and "packets", a packet is a
      36             :      regular transaction and should be round-robined between verify
      37             :      tiles, while bundles need to go through verify:0 currently to
      38             :      prevent interleaving of bundle streams. */
      39           0 :   int is_bundle_packet = (ctx->in_kind[ in_idx ]==IN_KIND_BUNDLE && !sig);
      40             : 
      41           0 :   if( FD_LIKELY( is_bundle_packet || ctx->in_kind[ in_idx ]==IN_KIND_QUIC ) ) {
      42           0 :     return (seq % ctx->round_robin_cnt) != ctx->round_robin_idx;
      43           0 :   } else if( FD_LIKELY( ctx->in_kind[ in_idx ]==IN_KIND_BUNDLE ) ) {
      44           0 :     return ctx->round_robin_idx!=0UL;
      45           0 :   }
      46             : 
      47           0 :   return 0;
      48           0 : }
      49             : 
      50             : /* during_frag is called between pairs for sequence number checks, as
      51             :    we are reading incoming frags.  We don't actually need to copy the
      52             :    fragment here, see fd_dedup.c for why we do this.*/
      53             : 
      54             : static inline void
      55             : during_frag( fd_verify_ctx_t * ctx,
      56             :              ulong             in_idx,
      57             :              ulong             seq FD_PARAM_UNUSED,
      58             :              ulong             sig FD_PARAM_UNUSED,
      59             :              ulong             chunk,
      60             :              ulong             sz,
      61           0 :              ulong             ctl FD_PARAM_UNUSED ) {
      62             : 
      63           0 :   ulong in_kind = ctx->in_kind[ in_idx ];
      64           0 :   if( FD_UNLIKELY( in_kind==IN_KIND_BUNDLE || in_kind==IN_KIND_QUIC ) ) {
      65           0 :     if( FD_UNLIKELY( chunk<ctx->in[in_idx].chunk0 || chunk>ctx->in[in_idx].wmark || sz>FD_TPU_RAW_MTU ) )
      66           0 :       FD_LOG_ERR(( "chunk %lu %lu corrupt, not in range [%lu,%lu,%lu]", chunk, sz, ctx->in[in_idx].chunk0, ctx->in[in_idx].wmark, FD_TPU_RAW_MTU ));
      67             : 
      68           0 :     uchar * src = fd_chunk_to_laddr( ctx->in[in_idx].mem, chunk );
      69           0 :     uchar * dst = fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk );
      70           0 :     fd_memcpy( dst, src, sz );
      71           0 :   }
      72           0 : }
      73             : 
      74             : /* Bundles arrive one after another, so only the last one seen can
      75             :    still gain members.  Returns whether bundle_id has a failed member. */
      76             : static inline int
      77             : bundle_peer_failed( fd_verify_ctx_t * ctx,
      78           0 :                     ulong             bundle_id ) {
      79           0 :   if( FD_UNLIKELY( bundle_id!=ctx->bundle_id ) ) {
      80           0 :     ctx->bundle_failed = 0;
      81           0 :     ctx->bundle_id     = bundle_id;
      82           0 :   }
      83           0 :   return ctx->bundle_failed;
      84           0 : }
      85             : 
      86             : /* Verify the pending batch and publish the passing transactions in
      87             :    arrival order, compacting them over the rejected ones.  A fragment
      88             :    of staged_sz bytes at the out chunk is moved along with them; its
      89             :    new address is returned. */
      90             : static fd_txn_m_t *
      91             : batch_flush( fd_verify_ctx_t *   ctx,
      92             :              fd_stem_context_t * stem,
      93           0 :              ulong               staged_sz ) {
      94           0 :   if( FD_LIKELY( !ctx->batch_txn_cnt ) ) return fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk );
      95             : 
      96           0 :   fd_ed25519_verifier_verify_sigs( ctx->verifier, ctx->batch_msg, ctx->batch_msg_sz, ctx->batch_sig, ctx->batch_pubkey,
      97           0 :                                    ctx->batch_result, ctx->batch_sig_cnt );
      98             : 
      99           0 :   ulong chunk = ctx->batch_txn[ 0 ].chunk;
     100           0 :   ulong lane  = 0UL;
     101           0 :   for( ulong i=0UL; i<ctx->batch_txn_cnt; i++ ) {
     102           0 :     fd_verify_batch_txn_t * t = ctx->batch_txn+i;
     103           0 :     int ok = 1;
     104           0 :     for( ulong j=0UL; j<t->sig_cnt; j++ ) ok &= (ctx->batch_result[ lane++ ]==FD_ED25519_SUCCESS);
     105             : 
     106           0 :     int is_bundle = !!t->bundle_id;
     107           0 :     if( FD_UNLIKELY( is_bundle && bundle_peer_failed( ctx, t->bundle_id ) ) ) {
     108           0 :       ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_BUNDLE_PEER_FAILED_IDX ]++;
     109           0 :       continue;
     110           0 :     }
     111           0 :     if( FD_UNLIKELY( !ok ) ) {
     112           0 :       if( FD_UNLIKELY( is_bundle ) ) ctx->bundle_failed = 1;
     113           0 :       ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_SIGNATURE_FAILED_IDX ]++;
     114           0 :       continue;
     115           0 :     }
     116             : 
     117             :     /* Catches duplicates that were pending at once */
     118           0 :     if( FD_LIKELY( !is_bundle ) ) {
     119           0 :       int ha_dup;
     120           0 :       FD_TCACHE_INSERT( ha_dup, *ctx->tcache_sync, ctx->tcache_ring, ctx->tcache_depth, ctx->tcache_map, ctx->tcache_map_cnt, t->dedup_tag );
     121           0 :       if( FD_UNLIKELY( ha_dup ) ) {
     122           0 :         ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_DUPLICATE_IDX ]++;
     123           0 :         continue;
     124           0 :       }
     125           0 :     }
     126             : 
     127           0 :     if( FD_UNLIKELY( t->chunk!=chunk ) ) {
     128           0 :       memmove( fd_chunk_to_laddr( ctx->out_mem, chunk ), fd_chunk_to_laddr( ctx->out_mem, t->chunk ), t->realized_sz );
     129           0 :     }
     130           0 :     ulong tspub = (ulong)fd_frag_meta_ts_comp( fd_tickcount() );
     131           0 :     fd_stem_publish( stem, 0UL, 0UL, chunk, t->realized_sz, 0UL, t->tsorig, tspub );
     132           0 :     chunk = fd_dcache_compact_next( chunk, t->realized_sz, ctx->out_chunk0, ctx->out_wmark );
     133           0 :     ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_SUCCESS_IDX ]++;
     134           0 :   }
     135             : 
     136           0 :   if( FD_UNLIKELY( staged_sz && chunk!=ctx->out_chunk ) ) {
     137           0 :     memmove( fd_chunk_to_laddr( ctx->out_mem, chunk ), fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk ), staged_sz );
     138           0 :   }
     139           0 :   ctx->out_chunk     = chunk;
     140           0 :   ctx->batch_txn_cnt = 0UL;
     141           0 :   ctx->batch_sig_cnt = 0UL;
     142           0 :   return fd_chunk_to_laddr( ctx->out_mem, chunk );
     143           0 : }
     144             : 
     145             : /* Queue the transaction staged at the out chunk; batch_flush publishes
     146             :    it.  A transaction whose signatures don't fit the pending batch
     147             :    flushes it first and starts the next one. */
     148             : static inline void
     149             : batch_enqueue( fd_verify_ctx_t *   ctx,
     150             :                fd_stem_context_t * stem,
     151             :                fd_txn_m_t *        txnm,
     152             :                ulong               tsorig,
     153             :                ulong               dedup_tag,
     154           0 :                ulong               bundle_id ) {
     155           0 :   ulong realized_sz = fd_txn_m_realized_footprint( txnm, 1, 0 );
     156             : 
     157           0 :   fd_txn_t const * txn = fd_txn_m_txn_t( txnm );
     158           0 :   if( FD_UNLIKELY( ctx->batch_sig_cnt+txn->signature_cnt>ctx->batch_sig_max ) ) {
     159           0 :     txnm = batch_flush( ctx, stem, realized_sz );
     160           0 :     txn  = fd_txn_m_txn_t( txnm );
     161           0 :   }
     162           0 :   uchar const * payload = fd_txn_m_payload( txnm );
     163           0 :   ulong         msg_sz  = fd_txn_msg_sz( txn, (ulong)txnm->payload_sz );
     164           0 :   for( ulong j=0UL; j<txn->signature_cnt; j++ ) {
     165           0 :     ulong lane = ctx->batch_sig_cnt++;
     166           0 :     ctx->batch_msg   [ lane ] = payload + txn->message_off;
     167           0 :     ctx->batch_msg_sz[ lane ] = msg_sz;
     168           0 :     ctx->batch_sig   [ lane ] = payload + txn->signature_off + 64UL*j;
     169           0 :     ctx->batch_pubkey[ lane ] = payload + txn->acct_addr_off + 32UL*j;
     170           0 :   }
     171             : 
     172           0 :   fd_verify_batch_txn_t * t = ctx->batch_txn + ctx->batch_txn_cnt++;
     173           0 :   t->chunk       = ctx->out_chunk;
     174           0 :   t->realized_sz = realized_sz;
     175           0 :   t->tsorig      = tsorig;
     176           0 :   t->dedup_tag   = dedup_tag;
     177           0 :   t->bundle_id   = bundle_id;
     178           0 :   t->enq_tick    = fd_tickcount();
     179           0 :   t->sig_cnt     = txn->signature_cnt;
     180           0 :   ctx->out_chunk = fd_dcache_compact_next( ctx->out_chunk, realized_sz, ctx->out_chunk0, ctx->out_wmark );
     181             : 
     182           0 :   if( FD_LIKELY( ctx->batch_sig_cnt>=ctx->batch_sig_max ) ) batch_flush( ctx, stem, 0UL );
     183           0 : }
     184             : 
     185             : /* Is a fragment this tile will take published on some input?  On the
     186             :    round robin links that is the next sequence number in this tile's
     187             :    slot.  A fragment counts only if before_frag keeps it, and not if the
     188             :    input has overrun this tile.  The sig is read without an atomic pair
     189             :    with the seq: a misread only moves one flush decision. */
     190             : static inline int
     191             : frag_ready( fd_verify_ctx_t *         ctx,
     192           0 :             fd_stem_context_t const * stem ) {
     193           0 :   for( ulong i=0UL; i<ctx->in_cnt; i++ ) {
     194           0 :     fd_stem_tile_in_t const * in = stem->in + i;
     195           0 :     ulong in_idx = (ulong)in->idx;
     196           0 :     ulong seq    = in->seq;
     197           0 :     if( FD_LIKELY( fd_seq_lt( seq, ctx->in_ready_seq[ in_idx ] ) ) ) return 1;
     198           0 :     if( FD_LIKELY( ctx->in_kind[ in_idx ]==IN_KIND_QUIC ) ) {
     199           0 :       seq += (ctx->round_robin_idx + ctx->round_robin_cnt - seq%ctx->round_robin_cnt) % ctx->round_robin_cnt;
     200           0 :     }
     201           0 :     fd_frag_meta_t const * mline = in->mcache + fd_mcache_line_idx( seq, in->depth );
     202           0 :     ulong seq_found = fd_frag_meta_seq_query( mline );
     203           0 :     if( FD_LIKELY( fd_seq_ne( seq_found, seq ) ) ) continue;
     204           0 :     ulong sig = FD_VOLATILE_CONST( mline->sig );
     205           0 :     if( FD_UNLIKELY( before_frag( ctx, in_idx, seq, sig ) ) ) continue;
     206           0 :     ctx->in_ready_seq[ in_idx ] = seq+1UL;
     207           0 :     return 1;
     208           0 :   }
     209           0 :   return 0;
     210           0 : }
     211             : 
     212             : static inline void
     213             : after_credit( fd_verify_ctx_t *   ctx,
     214             :               fd_stem_context_t * stem,
     215             :               int *               opt_poll_in FD_PARAM_UNUSED,
     216           0 :               int *               charge_busy ) {
     217           0 :   if( FD_LIKELY( !ctx->batch_txn_cnt ) ) return;
     218           0 :   if( FD_LIKELY( fd_tickcount()-ctx->batch_txn[ 0 ].enq_tick<ctx->batch_max_age_ticks && frag_ready( ctx, stem ) ) ) return;
     219           0 :   batch_flush( ctx, stem, 0UL );
     220           0 :   *charge_busy = 1;
     221           0 : }
     222             : 
     223             : static inline void
     224             : after_frag( fd_verify_ctx_t *   ctx,
     225             :             ulong               in_idx,
     226             :             ulong               seq,
     227             :             ulong               sig,
     228             :             ulong               sz,
     229             :             ulong               tsorig,
     230             :             ulong               _tspub,
     231           0 :             fd_stem_context_t * stem ) {
     232           0 :   (void)in_idx;
     233           0 :   (void)seq;
     234           0 :   (void)sig;
     235           0 :   (void)sz;
     236           0 :   (void)_tspub;
     237             : 
     238           0 :   fd_txn_m_t * txnm = (fd_txn_m_t *)fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk );
     239           0 :   if( FD_UNLIKELY( txnm->payload_sz>FD_TPU_MTU ) ) {
     240           0 :     FD_LOG_ERR(( "verify: txn payload size %hu exceeds max %lu", txnm->payload_sz, FD_TPU_MTU ));
     241           0 :   }
     242           0 :   fd_txn_t *  txnt = fd_txn_m_txn_t( txnm );
     243           0 :   txnm->txn_t_sz = (ushort)fd_txn_parse( fd_txn_m_payload( txnm ), txnm->payload_sz, txnt, NULL );
     244             : 
     245           0 :   ulong bundle_id = txnm->block_engine.bundle_id;
     246             : 
     247             :   /* A member of the bundle that failed last is dropped unverified.
     248             :      The bundle state is read only: it moves behind the queued members,
     249             :      in batch_flush. */
     250           0 :   if( FD_UNLIKELY( bundle_id && bundle_id==ctx->bundle_id && ctx->bundle_failed ) ) {
     251           0 :     ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_BUNDLE_PEER_FAILED_IDX ]++;
     252           0 :     return;
     253           0 :   }
     254             : 
     255           0 :   if( FD_UNLIKELY( !txnm->txn_t_sz ) ) {
     256             :     /* Members queued ahead go out before the bundle is marked failed */
     257           0 :     if( FD_UNLIKELY( bundle_id ) ) {
     258           0 :       batch_flush( ctx, stem, 0UL );
     259           0 :       if( FD_UNLIKELY( bundle_peer_failed( ctx, bundle_id ) ) ) {
     260           0 :         ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_BUNDLE_PEER_FAILED_IDX ]++;
     261           0 :         return;
     262           0 :       }
     263           0 :       ctx->bundle_failed = 1;
     264           0 :     }
     265           0 :     ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_PARSE_FAILED_IDX ]++;
     266           0 :     return;
     267           0 :   }
     268             : 
     269             :   /* Users sometimes send transactions as part of a bundle (with a tip)
     270             :      and via the normal path (without a tip).  Regardless of which
     271             :      arrives first, we want to pack the one with the tip.  Thus, we
     272             :      exempt bundles from the normal HA dedup checks.  The dedup tile
     273             :      will still do a full-bundle dedup check to make sure to drop any
     274             :      identical bundles. */
     275           0 :   ulong dedup_tag = 0UL;
     276           0 :   if( FD_LIKELY( !bundle_id ) ) {
     277           0 :     dedup_tag = fd_hash( ctx->hashmap_seed, fd_txn_m_payload( txnm )+txnt->signature_off, 64UL );
     278           0 :     int ha_dup;
     279           0 :     FD_FN_UNUSED ulong tcache_map_idx = 0;
     280           0 :     FD_TCACHE_QUERY( ha_dup, tcache_map_idx, ctx->tcache_map, ctx->tcache_map_cnt, dedup_tag );
     281           0 :     if( FD_UNLIKELY( ha_dup ) ) {
     282           0 :       ctx->metrics.verify_tile_result[ FD_METRICS_ENUM_VERIFY_RESULT_V_DUPLICATE_IDX ]++;
     283           0 :       return;
     284           0 :     }
     285           0 :   }
     286           0 :   batch_enqueue( ctx, stem, txnm, tsorig, dedup_tag, bundle_id );
     287           0 : }
     288             : 
     289             : static void
     290             : privileged_init( fd_topo_t const *      topo,
     291           0 :                  fd_topo_tile_t const * tile ) {
     292           0 :   void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id );
     293             : 
     294           0 :   FD_SCRATCH_ALLOC_INIT( l, scratch );
     295           0 :   fd_verify_ctx_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof( fd_verify_ctx_t ), sizeof( fd_verify_ctx_t ) );
     296           0 :   FD_TEST( fd_rng_secure( &ctx->hashmap_seed, 8U ) );
     297           0 : }
     298             : 
     299             : static void
     300             : unprivileged_init( fd_topo_t const *      topo,
     301           0 :                    fd_topo_tile_t const * tile ) {
     302           0 :   void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id );
     303             : 
     304           0 :   FD_SCRATCH_ALLOC_INIT( l, scratch );
     305           0 :   fd_verify_ctx_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof( fd_verify_ctx_t ), sizeof( fd_verify_ctx_t ) );
     306           0 :   fd_tcache_t * tcache = fd_tcache_join( fd_tcache_new( FD_SCRATCH_ALLOC_APPEND( l, fd_tcache_align(), fd_tcache_footprint( tile->verify.tcache_depth, 0UL ) ), tile->verify.tcache_depth, 0UL ) );
     307           0 :   if( FD_UNLIKELY( !tcache ) ) FD_LOG_ERR(( "fd_tcache_join failed" ));
     308             : 
     309           0 :   ctx->round_robin_cnt = fd_topo_tile_name_cnt( topo, tile->name );
     310           0 :   ctx->round_robin_idx = tile->kind_id;
     311             : 
     312           0 :   void * _verifier = FD_SCRATCH_ALLOC_APPEND( l, fd_ed25519_verifier_align(), fd_ed25519_verifier_footprint( FD_VERIFY_ED25519_CACHE_ENT_CNT ) );
     313           0 :   ctx->verifier = fd_ed25519_verifier_join( fd_ed25519_verifier_new( _verifier, FD_VERIFY_ED25519_CACHE_ENT_CNT, ctx->hashmap_seed ) );
     314           0 :   if( FD_UNLIKELY( !ctx->verifier ) ) FD_LOG_ERR(( "fd_ed25519_verifier_join failed" ));
     315             : 
     316           0 :   ctx->batch_txn_cnt       = 0UL;
     317           0 :   ctx->batch_sig_cnt       = 0UL;
     318           0 :   ctx->batch_sig_max       = FD_ED25519_VERIFIER_GROUP;
     319           0 :   ctx->batch_max_age_ticks = (long)( fd_tempo_tick_per_ns( NULL ) * (double)FD_VERIFY_BATCH_MAX_AGE_NS );
     320           0 :   ctx->in_cnt              = tile->in_cnt;
     321           0 :   for( ulong i=0UL; i<tile->in_cnt; i++ ) ctx->in_ready_seq[ i ] = 0UL;
     322             : 
     323           0 :   ctx->bundle_failed = 0;
     324           0 :   ctx->bundle_id     = 0UL;
     325             : 
     326           0 :   memset( &ctx->metrics, 0, sizeof( ctx->metrics ) );
     327             : 
     328           0 :   ctx->tcache_depth   = fd_tcache_depth       ( tcache );
     329           0 :   ctx->tcache_map_cnt = fd_tcache_map_cnt     ( tcache );
     330           0 :   ctx->tcache_sync    = fd_tcache_oldest_laddr( tcache );
     331           0 :   ctx->tcache_ring    = fd_tcache_ring_laddr  ( tcache );
     332           0 :   ctx->tcache_map     = fd_tcache_map_laddr   ( tcache );
     333             : 
     334           0 :   FD_CHECK_ERR( tile->in_cnt<=sizeof(ctx->in)/sizeof(ctx->in[0]), "too many input links" );
     335             : 
     336           0 :   for( ulong i=0UL; i<tile->in_cnt; i++ ) {
     337           0 :     fd_topo_link_t const * link = &topo->links[ tile->in_link_id[ i ] ];
     338             : 
     339           0 :     fd_topo_wksp_t const * link_wksp = &topo->workspaces[ topo->objs[ link->dcache_obj_id ].wksp_id ];
     340           0 :     ctx->in[i].mem = link_wksp->wksp;
     341           0 :     ctx->in[i].chunk0 = fd_dcache_compact_chunk0( ctx->in[i].mem, link->dcache );
     342           0 :     ctx->in[i].wmark  = fd_dcache_compact_wmark ( ctx->in[i].mem, link->dcache, link->mtu );
     343             : 
     344           0 :     if(      !strcmp( link->name, "quic_verify"  ) ) ctx->in_kind[ i ] = IN_KIND_QUIC;
     345           0 :     else if( !strcmp( link->name, "bundle_verif" ) ) ctx->in_kind[ i ] = IN_KIND_BUNDLE;
     346           0 :     else FD_LOG_ERR(( "unexpected link name %s", link->name ));
     347           0 :   }
     348             : 
     349           0 :   ctx->out_mem    = topo->workspaces[ topo->objs[ topo->links[ tile->out_link_id[ 0 ] ].dcache_obj_id ].wksp_id ].wksp;
     350           0 :   ctx->out_chunk0 = fd_dcache_compact_chunk0( ctx->out_mem, topo->links[ tile->out_link_id[ 0 ] ].dcache );
     351           0 :   ctx->out_wmark  = fd_dcache_compact_wmark ( ctx->out_mem, topo->links[ tile->out_link_id[ 0 ] ].dcache, topo->links[ tile->out_link_id[ 0 ] ].mtu );
     352           0 :   ctx->out_chunk  = ctx->out_chunk0;
     353             : 
     354           0 :   ulong scratch_top = FD_SCRATCH_ALLOC_FINI( l, scratch_align() );
     355           0 :   if( FD_UNLIKELY( scratch_top > (ulong)scratch + scratch_footprint( tile ) ) )
     356           0 :     FD_LOG_ERR(( "scratch overflow %lu %lu %lu", scratch_top - (ulong)scratch - scratch_footprint( tile ), scratch_top, (ulong)scratch + scratch_footprint( tile ) ));
     357           0 : }
     358             : 
     359             : static ulong
     360             : populate_allowed_seccomp( fd_topo_t const *      topo,
     361             :                           fd_topo_tile_t const * tile,
     362             :                           ulong                  out_cnt,
     363           0 :                           struct sock_filter *   out ) {
     364           0 :   (void)topo;
     365           0 :   (void)tile;
     366             : 
     367           0 :   populate_sock_filter_policy_fd_verify_tile( out_cnt, out, (uint)fd_log_private_logfile_fd() );
     368           0 :   return sock_filter_policy_fd_verify_tile_instr_cnt;
     369           0 : }
     370             : 
     371             : static ulong
     372             : populate_allowed_fds( fd_topo_t const *      topo,
     373             :                       fd_topo_tile_t const * tile,
     374             :                       ulong                  out_fds_cnt,
     375           0 :                       int *                  out_fds ) {
     376           0 :   (void)topo;
     377           0 :   (void)tile;
     378             : 
     379           0 :   if( FD_UNLIKELY( out_fds_cnt<2UL ) ) FD_LOG_ERR(( "out_fds_cnt %lu", out_fds_cnt ));
     380             : 
     381           0 :   ulong out_cnt = 0UL;
     382           0 :   out_fds[ out_cnt++ ] = 2; /* stderr */
     383           0 :   if( FD_LIKELY( -1!=fd_log_private_logfile_fd() ) )
     384           0 :     out_fds[ out_cnt++ ] = fd_log_private_logfile_fd(); /* logfile */
     385           0 :   return out_cnt;
     386           0 : }
     387             : 
     388             : /* A flush publishes every queued transaction */
     389           0 : #define STEM_BURST (FD_VERIFY_BATCH_TXN_MAX)
     390             : 
     391           0 : #define STEM_CALLBACK_CONTEXT_TYPE  fd_verify_ctx_t
     392           0 : #define STEM_CALLBACK_CONTEXT_ALIGN alignof(fd_verify_ctx_t)
     393             : 
     394           0 : #define STEM_CALLBACK_METRICS_WRITE metrics_write
     395           0 : #define STEM_CALLBACK_AFTER_CREDIT  after_credit
     396           0 : #define STEM_CALLBACK_BEFORE_FRAG   before_frag
     397           0 : #define STEM_CALLBACK_DURING_FRAG   during_frag
     398           0 : #define STEM_CALLBACK_AFTER_FRAG    after_frag
     399             : 
     400             : #include "../stem/fd_stem.c"
     401             : 
     402             : #ifndef FD_TILE_TEST
     403             : fd_topo_run_tile_t fd_tile_verify = {
     404             :   .name                     = "verify",
     405             :   .populate_allowed_seccomp = populate_allowed_seccomp,
     406             :   .populate_allowed_fds     = populate_allowed_fds,
     407             :   .scratch_align            = scratch_align,
     408             :   .scratch_footprint        = scratch_footprint,
     409             :   .privileged_init          = privileged_init,
     410             :   .unprivileged_init        = unprivileged_init,
     411             :   .run                      = stem_run,
     412             : };
     413             : #endif

Generated by: LCOV version 1.14