LCOV - code coverage report
Current view: top level - discof/restore - fd_snapla_tile.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 269 0.0 %
Date: 2026-02-13 06:06:24 Functions: 0 14 0.0 %

          Line data    Source code
       1             : #include "../../disco/topo/fd_topo.h"
       2             : #include "../../disco/metrics/fd_metrics.h"
       3             : #include "../../ballet/lthash/fd_lthash.h"
       4             : #include "../../ballet/lthash/fd_lthash_adder.h"
       5             : 
       6             : #include "generated/fd_snapla_tile_seccomp.h"
       7             : 
       8             : #include "utils/fd_ssctrl.h"
       9             : #include "utils/fd_ssparse.h"
      10             : #include "utils/fd_ssmanifest_parser.h"
      11             : 
      12             : #define NAME "snapla"
      13             : 
      14           0 : #define FD_SNAPLA_OUT_CTRL 0UL
      15             : 
      16             : struct fd_snapla_tile {
      17             :   int state;
      18             :   int full;
      19             : 
      20             :   ulong seed;
      21             :   int   hash_account;
      22             :   ulong num_hash_tiles;
      23             :   ulong hash_tile_idx;
      24             :   ulong accounts_seen;
      25             : 
      26             :   fd_lthash_adder_t adder[1];
      27             :   uchar             data[ FD_RUNTIME_ACC_SZ_MAX ];
      28             :   ulong             acc_data_sz;
      29             : 
      30             :   fd_ssparse_t *           ssparse;
      31             :   fd_ssmanifest_parser_t * manifest_parser;
      32             :   fd_lthash_value_t        running_lthash;
      33             : 
      34             :   struct {
      35             :     uchar pubkey[ FD_HASH_FOOTPRINT ];
      36             :     uchar owner[ FD_HASH_FOOTPRINT ];
      37             :     ulong data_len;
      38             :     ulong lamports;
      39             :     int   executable;
      40             :   } account_hdr;
      41             : 
      42             :   struct {
      43             :     struct {
      44             :       ulong accounts_hashed;
      45             :     } full;
      46             : 
      47             :     struct {
      48             :       ulong accounts_hashed;
      49             :     } incremental;
      50             :   } metrics;
      51             : 
      52             :   struct {
      53             :     fd_wksp_t * wksp;
      54             :     ulong       chunk0;
      55             :     ulong       wmark;
      56             :     ulong       mtu;
      57             :     ulong       pos;
      58             :   } in;
      59             : 
      60             :   struct {
      61             :     fd_wksp_t * wksp;
      62             :     ulong       chunk0;
      63             :     ulong       wmark;
      64             :     ulong       chunk;
      65             :     ulong       mtu;
      66             :   } out;
      67             : 
      68             :   fd_snapshot_manifest_t manifest[1];
      69             : };
      70             : 
      71             : typedef struct fd_snapla_tile fd_snapla_tile_t;
      72             : 
      73             : static inline int
      74           0 : should_shutdown( fd_snapla_tile_t * ctx ) {
      75           0 :   return ctx->state==FD_SNAPSHOT_STATE_SHUTDOWN;
      76           0 : }
      77             : 
      78             : static ulong
      79           0 : scratch_align( void ) {
      80           0 :   return fd_ulong_max( alignof(fd_snapla_tile_t),
      81           0 :                        fd_ulong_max( fd_ssparse_align(), fd_ssmanifest_parser_align() ) );
      82           0 : }
      83             : 
      84             : static ulong
      85           0 : scratch_footprint( fd_topo_tile_t const * tile ) {
      86           0 :   (void)tile;
      87           0 :   ulong l = FD_LAYOUT_INIT;
      88           0 :   l = FD_LAYOUT_APPEND( l, alignof(fd_snapla_tile_t),    sizeof(fd_snapla_tile_t)         );
      89           0 :   l = FD_LAYOUT_APPEND( l, fd_ssparse_align(),           fd_ssparse_footprint( 1UL<<24UL ) );
      90           0 :   l = FD_LAYOUT_APPEND( l, fd_ssmanifest_parser_align(), fd_ssmanifest_parser_footprint()  );
      91           0 :   return FD_LAYOUT_FINI( l, alignof(fd_snapla_tile_t) );
      92           0 : }
      93             : 
      94             : static void
      95           0 : metrics_write( fd_snapla_tile_t * ctx ) {
      96           0 :   FD_MGAUGE_SET( SNAPLA, FULL_ACCOUNTS_HASHED,        ctx->metrics.full.accounts_hashed );
      97           0 :   FD_MGAUGE_SET( SNAPLA, INCREMENTAL_ACCOUNTS_HASHED, ctx->metrics.incremental.accounts_hashed );
      98           0 :   FD_MGAUGE_SET( SNAPLA, STATE,                       (ulong)(ctx->state) );
      99           0 : }
     100             : 
     101             : static void
     102             : transition_malformed( fd_snapla_tile_t *  ctx,
     103           0 :                       fd_stem_context_t * stem ) {
     104           0 :   if( FD_UNLIKELY( ctx->state==FD_SNAPSHOT_STATE_ERROR ) ) return;
     105           0 :   ctx->state = FD_SNAPSHOT_STATE_ERROR;
     106           0 :   fd_stem_publish( stem, FD_SNAPLA_OUT_CTRL, FD_SNAPSHOT_MSG_CTRL_ERROR, 0UL, 0UL, 0UL, 0UL, 0UL );
     107           0 : }
     108             : 
     109             : static int
     110           0 : should_hash_account( fd_snapla_tile_t * ctx ) {
     111           0 :   return ctx->accounts_seen%ctx->num_hash_tiles==ctx->hash_tile_idx;
     112           0 : }
     113             : 
     114             : static void
     115             : streamlined_hash( fd_snapla_tile_t * ctx,
     116           0 :                   uchar const *      frame ) {
     117           0 :   ulong data_len   = fd_ulong_load_8_fast( frame+0x08UL );
     118           0 :   uchar pubkey[32];  memcpy( pubkey, frame+0x10UL, 32UL );
     119           0 :   ulong lamports   = fd_ulong_load_8_fast( frame+0x30UL );
     120           0 :   ulong rent_epoch = fd_ulong_load_8_fast( frame+0x38UL ); (void)rent_epoch;
     121           0 :   uchar owner[32];   memcpy( owner, frame+0x40UL, 32UL );
     122           0 :   _Bool executable = !!frame[ 0x60UL ];
     123             : 
     124           0 :   if( FD_UNLIKELY( data_len > FD_RUNTIME_ACC_SZ_MAX ) ) FD_LOG_ERR(( "Found unusually large account (data_sz=%lu), aborting", data_len ));
     125           0 :   if( FD_UNLIKELY( lamports==0UL ) ) return;
     126             : 
     127           0 :   uchar executable_flag = executable & 0x1;
     128             : 
     129           0 :   fd_lthash_adder_push_solana_account( ctx->adder,
     130           0 :                                        &ctx->running_lthash,
     131           0 :                                        pubkey,
     132           0 :                                        frame+0x88UL,
     133           0 :                                        data_len,
     134           0 :                                        lamports,
     135           0 :                                        executable_flag,
     136           0 :                                        owner );
     137             : 
     138           0 :   if( FD_LIKELY( ctx->full ) ) ctx->metrics.full.accounts_hashed++;
     139           0 :   else                         ctx->metrics.incremental.accounts_hashed++;
     140           0 : }
     141             : 
     142             : static int
     143             : handle_data_frag( fd_snapla_tile_t *  ctx,
     144             :                   ulong               chunk,
     145             :                   ulong               sz,
     146           0 :                   fd_stem_context_t * stem ) {
     147           0 :   if( FD_UNLIKELY( ctx->state==FD_SNAPSHOT_STATE_FINISHING ) ) {
     148           0 :     FD_LOG_WARNING(( "received data fragment while in finishing state" ));
     149           0 :     transition_malformed( ctx, stem );
     150           0 :     return 0;
     151           0 :   } else if( FD_UNLIKELY( ctx->state==FD_SNAPSHOT_STATE_ERROR ) ) {
     152             :     /* Ignore all data frags after observing an error in the stream until
     153             :        we receive fail & init control messages to restart processing. */
     154           0 :     return 0;
     155           0 :   } else if( FD_UNLIKELY( ctx->state!=FD_SNAPSHOT_STATE_PROCESSING ) ) {
     156           0 :     FD_LOG_ERR(( "invalid state for data frag %d", ctx->state ));
     157           0 :   }
     158             : 
     159           0 :   FD_TEST( chunk>=ctx->in.chunk0 && chunk<=ctx->in.wmark && sz<=ctx->in.mtu );
     160             : 
     161           0 :   for(;;) {
     162           0 :     if( FD_UNLIKELY( sz-ctx->in.pos==0UL ) ) break;
     163           0 :     uchar const * data = (uchar const *)fd_chunk_to_laddr_const( ctx->in.wksp, chunk ) + ctx->in.pos;
     164             : 
     165           0 :     fd_ssparse_advance_result_t result[1];
     166           0 :     int res = fd_ssparse_advance( ctx->ssparse, data, sz-ctx->in.pos, result );
     167           0 :     switch( res ) {
     168           0 :       case FD_SSPARSE_ADVANCE_ERROR:
     169           0 :         transition_malformed( ctx, stem );
     170           0 :         return 0;
     171           0 :       case FD_SSPARSE_ADVANCE_AGAIN:
     172           0 :         break;
     173           0 :       case FD_SSPARSE_ADVANCE_STATUS_CACHE:
     174             :         /* ignore */
     175           0 :         break;
     176           0 :       case FD_SSPARSE_ADVANCE_MANIFEST: {
     177           0 :         int res = fd_ssmanifest_parser_consume( ctx->manifest_parser,
     178           0 :           result->manifest.data,
     179           0 :           result->manifest.data_sz,
     180           0 :           result->manifest.acc_vec_map,
     181           0 :           result->manifest.acc_vec_pool );
     182           0 :         if( FD_UNLIKELY( res==FD_SSMANIFEST_PARSER_ADVANCE_ERROR ) ) {
     183           0 :           transition_malformed( ctx, stem );
     184           0 :           return 0;
     185           0 :         }
     186           0 :         break;
     187           0 :       }
     188           0 :       case FD_SSPARSE_ADVANCE_ACCOUNT_HEADER:
     189           0 :         if( FD_LIKELY( should_hash_account( ctx ) && result->account_header.lamports!=0UL ) ) {
     190           0 :           FD_TEST( ctx->acc_data_sz==0UL );
     191           0 :           ctx->hash_account = 1;
     192           0 :           fd_memcpy( ctx->account_hdr.pubkey, result->account_header.pubkey, FD_HASH_FOOTPRINT );
     193           0 :           fd_memcpy( ctx->account_hdr.owner,  result->account_header.owner,  FD_HASH_FOOTPRINT );
     194           0 :           ctx->account_hdr.data_len   = result->account_header.data_len;
     195           0 :           ctx->account_hdr.executable = result->account_header.executable;
     196           0 :           ctx->account_hdr.lamports   = result->account_header.lamports;
     197           0 :         }
     198           0 :         ctx->accounts_seen++;
     199           0 :         break;
     200           0 :       case FD_SSPARSE_ADVANCE_ACCOUNT_DATA:
     201           0 :         if( FD_LIKELY( ctx->hash_account ) ) {
     202           0 :           fd_memcpy( ctx->data + ctx->acc_data_sz, result->account_data.data, result->account_data.data_sz );
     203           0 :           ctx->acc_data_sz += result->account_data.data_sz;
     204           0 :         }
     205           0 :         break;
     206           0 :       case FD_SSPARSE_ADVANCE_ACCOUNT_BATCH: {
     207           0 :         for( ulong i=0UL; i<result->account_batch.batch_cnt; i++ ) {
     208           0 :           if( FD_LIKELY( should_hash_account( ctx ) ) ) streamlined_hash( ctx, result->account_batch.batch[ i ] );
     209           0 :           ctx->accounts_seen++;
     210           0 :         }
     211           0 :         break;
     212           0 :       }
     213           0 :       case FD_SSPARSE_ADVANCE_DONE:
     214           0 :         ctx->state = FD_SNAPSHOT_STATE_FINISHING;
     215           0 :         break;
     216           0 :       default:
     217           0 :         FD_LOG_ERR(( "unexpected fd_ssparse_advance result %d", res ));
     218           0 :         break;
     219           0 :     }
     220             : 
     221           0 :     ctx->in.pos += result->bytes_consumed;
     222           0 :     if( FD_LIKELY( ctx->hash_account && ctx->acc_data_sz==ctx->account_hdr.data_len ) ) {
     223           0 :       fd_lthash_adder_push_solana_account( ctx->adder,
     224           0 :                                            &ctx->running_lthash,
     225           0 :                                            ctx->account_hdr.pubkey,
     226           0 :                                            ctx->data,
     227           0 :                                            ctx->account_hdr.data_len,
     228           0 :                                            ctx->account_hdr.lamports,
     229           0 :                                            (uchar)ctx->account_hdr.executable,
     230           0 :                                            ctx->account_hdr.owner );
     231           0 :       ctx->acc_data_sz  = 0UL;
     232           0 :       ctx->hash_account = 0;
     233             : 
     234           0 :       if( FD_LIKELY( ctx->full ) ) ctx->metrics.full.accounts_hashed++;
     235           0 :       else                         ctx->metrics.incremental.accounts_hashed++;
     236           0 :     }
     237           0 :   }
     238             : 
     239           0 :   int reprocess_frag = ctx->in.pos<sz;
     240           0 :   if( FD_LIKELY( !reprocess_frag ) ) ctx->in.pos = 0UL;
     241           0 :   return reprocess_frag;
     242           0 : }
     243             : 
     244             : static void
     245             : handle_control_frag( fd_snapla_tile_t *  ctx,
     246             :                      fd_stem_context_t *  stem,
     247           0 :                      ulong                sig ) {
     248           0 :   if( ctx->state==FD_SNAPSHOT_STATE_ERROR && sig!=FD_SNAPSHOT_MSG_CTRL_FAIL ) {
     249             :     /* Control messages move along the snapshot load pipeline.  Since
     250             :        error conditions can be triggered by any tile in the pipeline,
     251             :        it is possible to be in error state and still receive otherwise
     252             :        valid messages.  Only a fail message can revert this. */
     253           0 :     return;
     254           0 :   };
     255             : 
     256           0 :   switch( sig ) {
     257           0 :     case FD_SNAPSHOT_MSG_CTRL_INIT_FULL:
     258           0 :     case FD_SNAPSHOT_MSG_CTRL_INIT_INCR: {
     259           0 :       FD_TEST( ctx->state==FD_SNAPSHOT_STATE_IDLE );
     260           0 :       ctx->full          = sig==FD_SNAPSHOT_MSG_CTRL_INIT_FULL;
     261           0 :       ctx->state         = FD_SNAPSHOT_STATE_PROCESSING;
     262           0 :       ctx->accounts_seen = 0UL;
     263           0 :       ctx->hash_account  = 0;
     264           0 :       ctx->acc_data_sz   = 0UL;
     265           0 :       fd_memset( &ctx->account_hdr, 0, sizeof(ctx->account_hdr) );
     266           0 :       fd_lthash_zero( &ctx->running_lthash );
     267           0 :       fd_ssparse_reset( ctx->ssparse );
     268           0 :       fd_ssmanifest_parser_init( ctx->manifest_parser, ctx->manifest );
     269           0 :       fd_lthash_adder_new( ctx->adder );
     270           0 :       if( ctx->full ) ctx->metrics.full.accounts_hashed = 0UL;
     271           0 :       ctx->metrics.incremental.accounts_hashed = 0UL;
     272           0 :       break;
     273           0 :     }
     274             : 
     275           0 :     case FD_SNAPSHOT_MSG_CTRL_FINI: {
     276             :       /* This is a special case: handle_data_frag must have already
     277             :          processed FD_SSPARSE_ADVANCE_DONE and moved the state into
     278             :          FD_SNAPSHOT_STATE_FINISHING. */
     279           0 :       FD_TEST( ctx->state==FD_SNAPSHOT_STATE_FINISHING );
     280           0 :       ctx->state = FD_SNAPSHOT_STATE_FINISHING;
     281           0 :       fd_lthash_adder_flush( ctx->adder, &ctx->running_lthash );
     282           0 :       uchar * lthash_out = fd_chunk_to_laddr( ctx->out.wksp, ctx->out.chunk );
     283           0 :       fd_memcpy( lthash_out, &ctx->running_lthash, sizeof(fd_lthash_value_t) );
     284           0 :       fd_stem_publish( stem, 0UL, FD_SNAPSHOT_HASH_MSG_RESULT_ADD, ctx->out.chunk, FD_LTHASH_LEN_BYTES, 0UL, 0UL, 0UL );
     285           0 :       ctx->out.chunk = fd_dcache_compact_next( ctx->out.chunk, FD_LTHASH_LEN_BYTES, ctx->out.chunk0, ctx->out.wmark );
     286           0 :       break;
     287           0 :     }
     288             : 
     289           0 :     case FD_SNAPSHOT_MSG_CTRL_NEXT:
     290           0 :     case FD_SNAPSHOT_MSG_CTRL_DONE: {
     291           0 :       FD_TEST( ctx->state==FD_SNAPSHOT_STATE_FINISHING );
     292           0 :       ctx->state = FD_SNAPSHOT_STATE_IDLE;
     293           0 :       break;
     294           0 :     }
     295             : 
     296           0 :     case FD_SNAPSHOT_MSG_CTRL_ERROR: {
     297           0 :       FD_TEST( ctx->state!=FD_SNAPSHOT_STATE_SHUTDOWN );
     298           0 :       ctx->state = FD_SNAPSHOT_STATE_ERROR;
     299           0 :       break;
     300           0 :     }
     301             : 
     302           0 :     case FD_SNAPSHOT_MSG_CTRL_FAIL: {
     303           0 :       FD_TEST( ctx->state!=FD_SNAPSHOT_STATE_SHUTDOWN );
     304           0 :       ctx->state = FD_SNAPSHOT_STATE_IDLE;
     305           0 :       break;
     306           0 :     }
     307             : 
     308           0 :     case FD_SNAPSHOT_MSG_CTRL_SHUTDOWN: {
     309           0 :       FD_TEST( ctx->state==FD_SNAPSHOT_STATE_IDLE );
     310           0 :       ctx->state = FD_SNAPSHOT_STATE_SHUTDOWN;
     311           0 :       break;
     312           0 :     }
     313             : 
     314           0 :     default: {
     315           0 :       FD_LOG_ERR(( "unexpected control sig %lu", sig ));
     316           0 :       break;
     317           0 :     }
     318           0 :   }
     319             : 
     320             :   /* Forward the control message down the pipeline */
     321           0 :   fd_stem_publish( stem, FD_SNAPLA_OUT_CTRL, sig, 0UL, 0UL, 0UL, 0UL, 0UL );
     322           0 : }
     323             : 
     324             : static inline int
     325             : returnable_frag( fd_snapla_tile_t *  ctx,
     326             :                  ulong                in_idx FD_PARAM_UNUSED,
     327             :                  ulong                seq    FD_PARAM_UNUSED,
     328             :                  ulong                sig,
     329             :                  ulong                chunk,
     330             :                  ulong                sz,
     331             :                  ulong                ctl    FD_PARAM_UNUSED,
     332             :                  ulong                tsorig FD_PARAM_UNUSED,
     333             :                  ulong                tspub  FD_PARAM_UNUSED,
     334           0 :                  fd_stem_context_t *  stem ) {
     335           0 :   FD_TEST( ctx->state!=FD_SNAPSHOT_STATE_SHUTDOWN );
     336             : 
     337           0 :   if( FD_UNLIKELY( sig==FD_SNAPSHOT_MSG_DATA ) ) return handle_data_frag( ctx, chunk, sz, stem );
     338           0 :   else                                           handle_control_frag( ctx, stem, sig );
     339             : 
     340           0 :   return 0;
     341           0 : }
     342             : 
     343             : static ulong
     344             : populate_allowed_fds( fd_topo_t      const * topo FD_PARAM_UNUSED,
     345             :                       fd_topo_tile_t const * tile FD_PARAM_UNUSED,
     346             :                       ulong                  out_fds_cnt,
     347           0 :                       int *                  out_fds ) {
     348           0 :   if( FD_UNLIKELY( out_fds_cnt<2UL ) ) FD_LOG_ERR(( "out_fds_cnt %lu", out_fds_cnt ));
     349             : 
     350           0 :   ulong out_cnt = 0;
     351           0 :   out_fds[ out_cnt++ ] = 2UL; /* stderr */
     352           0 :   if( FD_LIKELY( -1!=fd_log_private_logfile_fd() ) ) {
     353           0 :     out_fds[ out_cnt++ ] = fd_log_private_logfile_fd(); /* logfile */
     354           0 :   }
     355             : 
     356           0 :   return out_cnt;
     357           0 : }
     358             : 
     359             : static ulong
     360             : populate_allowed_seccomp( fd_topo_t const *      topo FD_PARAM_UNUSED,
     361             :                           fd_topo_tile_t const * tile FD_PARAM_UNUSED,
     362             :                           ulong                  out_cnt,
     363           0 :                           struct sock_filter *   out ) {
     364           0 :   populate_sock_filter_policy_fd_snapla_tile( out_cnt, out, (uint)fd_log_private_logfile_fd() );
     365           0 :   return sock_filter_policy_fd_snapla_tile_instr_cnt;
     366           0 : }
     367             : 
     368             : static void
     369             : privileged_init( fd_topo_t *      topo,
     370           0 :                  fd_topo_tile_t * tile ) {
     371           0 :   void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id );
     372             : 
     373           0 :   FD_SCRATCH_ALLOC_INIT( l, scratch );
     374           0 :   fd_snapla_tile_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_snapla_tile_t), sizeof(fd_snapla_tile_t) );
     375             : 
     376           0 :   FD_TEST( fd_rng_secure( &ctx->seed, 8UL ) );
     377           0 : }
     378             : 
     379             : static void
     380             : unprivileged_init( fd_topo_t *      topo,
     381           0 :                    fd_topo_tile_t * tile ) {
     382           0 :   void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id );
     383             : 
     384           0 :   FD_SCRATCH_ALLOC_INIT( l, scratch );
     385           0 :   fd_snapla_tile_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_snapla_tile_t),   sizeof(fd_snapla_tile_t)        );
     386           0 :   void * _ssparse         = FD_SCRATCH_ALLOC_APPEND( l, fd_ssparse_align(),           fd_ssparse_footprint( 1UL<<24UL ));
     387           0 :   void * _manifest_parser = FD_SCRATCH_ALLOC_APPEND( l, fd_ssmanifest_parser_align(), fd_ssmanifest_parser_footprint() );
     388             : 
     389           0 :   if( FD_UNLIKELY( tile->in_cnt!=1UL ) )  FD_LOG_ERR(( "tile `" NAME "` has %lu ins, expected 1",  tile->in_cnt  ));
     390           0 :   if( FD_UNLIKELY( tile->out_cnt!=1UL ) ) FD_LOG_ERR(( "tile `" NAME "` has %lu outs, expected 1", tile->out_cnt  ));
     391             : 
     392           0 :   fd_topo_link_t const * in_link = &topo->links[ tile->in_link_id[ 0UL ] ];
     393           0 :   fd_topo_wksp_t const * in_wksp = &topo->workspaces[ topo->objs[ in_link->dcache_obj_id ].wksp_id ];
     394           0 :   ctx->in.wksp                   = in_wksp->wksp;;
     395           0 :   ctx->in.chunk0                 = fd_dcache_compact_chunk0( ctx->in.wksp, in_link->dcache );
     396           0 :   ctx->in.wmark                  = fd_dcache_compact_wmark( ctx->in.wksp, in_link->dcache, in_link->mtu );
     397           0 :   ctx->in.mtu                    = in_link->mtu;
     398           0 :   ctx->in.pos                    = 0UL;
     399             : 
     400           0 :   fd_topo_link_t * out_link = &topo->links[ tile->out_link_id[ 0UL ] ];
     401           0 :   ctx->out.wksp    = topo->workspaces[ topo->objs[ out_link->dcache_obj_id ].wksp_id ].wksp;
     402           0 :   ctx->out.chunk0  = fd_dcache_compact_chunk0( fd_wksp_containing( out_link->dcache ), out_link->dcache );
     403           0 :   ctx->out.wmark   = fd_dcache_compact_wmark ( ctx->out.wksp, out_link->dcache, out_link->mtu );
     404           0 :   ctx->out.chunk   = ctx->out.chunk0;
     405           0 :   ctx->out.mtu     = out_link->mtu;
     406           0 :   FD_TEST( 0==strcmp( out_link->name, "snapla_ls" ) );
     407             : 
     408           0 :   ctx->ssparse = fd_ssparse_new( _ssparse, 1UL<<24UL, 0UL );
     409           0 :   FD_TEST( ctx->ssparse );
     410             : 
     411           0 :   ctx->manifest_parser = fd_ssmanifest_parser_join( fd_ssmanifest_parser_new( _manifest_parser ) );
     412           0 :   FD_TEST( ctx->manifest_parser );
     413             : 
     414           0 :   fd_ssparse_batch_enable( ctx->ssparse, 1 );
     415           0 :   fd_lthash_adder_new( ctx->adder );
     416           0 :   fd_ssmanifest_parser_init( ctx->manifest_parser, ctx->manifest );
     417             : 
     418           0 :   ctx->metrics.full.accounts_hashed        = 0UL;
     419           0 :   ctx->metrics.incremental.accounts_hashed = 0UL;
     420             : 
     421           0 :   ctx->state                   = FD_SNAPSHOT_STATE_IDLE;
     422           0 :   ctx->full                    = 1;
     423           0 :   ctx->acc_data_sz             = 0UL;
     424           0 :   ctx->hash_account            = 0;
     425           0 :   ctx->num_hash_tiles          = fd_topo_tile_name_cnt( topo, "snapla" );
     426           0 :   ctx->hash_tile_idx           = tile->kind_id;
     427           0 :   ctx->accounts_seen           = 0UL;
     428           0 :   fd_lthash_zero( &ctx->running_lthash );
     429           0 : }
     430             : 
     431           0 : #define STEM_BURST 2UL /* one control message and one malformed message or one hash result message */
     432           0 : #define STEM_LAZY  1000L
     433             : 
     434           0 : #define STEM_CALLBACK_CONTEXT_TYPE  fd_snapla_tile_t
     435           0 : #define STEM_CALLBACK_CONTEXT_ALIGN alignof(fd_snapla_tile_t)
     436             : 
     437             : #define STEM_CALLBACK_SHOULD_SHUTDOWN should_shutdown
     438           0 : #define STEM_CALLBACK_METRICS_WRITE   metrics_write
     439           0 : #define STEM_CALLBACK_RETURNABLE_FRAG returnable_frag
     440             : 
     441             : #include "../../disco/stem/fd_stem.c"
     442             : 
     443             : fd_topo_run_tile_t fd_tile_snapla = {
     444             :   .name                     = NAME,
     445             :   .populate_allowed_fds     = populate_allowed_fds,
     446             :   .populate_allowed_seccomp = populate_allowed_seccomp,
     447             :   .scratch_align            = scratch_align,
     448             :   .scratch_footprint        = scratch_footprint,
     449             :   .privileged_init          = privileged_init,
     450             :   .unprivileged_init        = unprivileged_init,
     451             :   .run                      = stem_run,
     452             : };
     453             : 
     454             : #undef NAME

Generated by: LCOV version 1.14