LCOV - code coverage report
Current view: top level - disco/pack - fd_pack_unwritable.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 5 5 100.0 %
Date: 2025-03-20 12:08:36 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_pack_fd_pack_unwritable_h
       2             : #define HEADER_fd_src_disco_pack_fd_pack_unwritable_h
       3             : 
       4             : /* Table of special addresses that are not allowed to be written to.  We
       5             :    immediately reject and refuse to pack any transaction that tries to
       6             :    write to one of these accounts.  Because we reject any writes to any
       7             :    of these accounts, we actually don't need to track reads of them
       8             :    either.  This is nice, because fd_map_dynamic requires a null address
       9             :    that we promise never to insert.  The zero address is a sysvar, so
      10             :    now we meet that part of the fd_map_dynamic contract. */
      11             : #define MAP_PERFECT_NAME      fd_pack_unwritable
      12             : #define MAP_PERFECT_LG_TBL_SZ 5
      13             : #define MAP_PERFECT_T         fd_acct_addr_t
      14    27984333 : #define MAP_PERFECT_HASH_C    1073878000U
      15    27984333 : #define MAP_PERFECT_HASH_A    1039211272U
      16             : #define MAP_PERFECT_KEY       b
      17             : #define MAP_PERFECT_KEY_T     fd_acct_addr_t const *
      18             : #define MAP_PERFECT_ZERO_KEY  (0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
      19             : #define MAP_PERFECT_COMPLEX_KEY 1
      20    27984333 : #define MAP_PERFECT_KEYS_EQUAL(k1,k2) (!memcmp( (k1), (k2), 32UL ))
      21             : 
      22             : /* This perfect hash table is too full for the normal hash function, but
      23             :    we can get it to fit with this function with two terms. */
      24    27984333 : #define PERFECT_HASH( u ) (((MAP_PERFECT_HASH_C*(u)+MAP_PERFECT_HASH_A)>>27)&0x1FU)
      25             : 
      26             : #define MAP_PERFECT_HASH_PP( a00,a01,a02,a03,a04,a05,a06,a07,a08,a09,a10,a11,a12,a13,a14,a15, \
      27             :                              a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31) \
      28             :                                           PERFECT_HASH( (a13 | (a14<<8) | (a15<<16) | (a16<<24)) )
      29    27984333 : #define MAP_PERFECT_HASH_R( ptr ) PERFECT_HASH( fd_uint_load_4( (uchar const *)ptr->b + 13UL ) )
      30             : 
      31             : /* This list is what Agave's is_maybe_writable contains as of the
      32             :    activation of 8U4skmMVnF6k2kMvrWbQuRUT3qQSiTYpSjqmhmgfthZu (Feb 14,
      33             :    2025 for mainnet). */
      34             : 
      35             : /* Sysvars */
      36             : #define MAP_PERFECT_0  ( SYSVAR_CLOCK_ID          ),
      37             : #define MAP_PERFECT_1  ( SYSVAR_EPOCH_REWARDS_ID  ),
      38             : #define MAP_PERFECT_2  ( SYSVAR_EPOCH_SCHED_ID    ),
      39             : #define MAP_PERFECT_3  ( SYSVAR_FEES_ID           ),
      40             : #define MAP_PERFECT_4  ( SYSVAR_INSTRUCTIONS_ID   ),
      41             : #define MAP_PERFECT_5  ( SYSVAR_LAST_RESTART_ID   ),
      42             : #define MAP_PERFECT_6  ( SYSVAR_RECENT_BLKHASH_ID ),
      43             : #define MAP_PERFECT_7  ( SYSVAR_RENT_ID           ),
      44             : #define MAP_PERFECT_8  ( SYSVAR_REWARDS_ID        ),
      45             : #define MAP_PERFECT_9  ( SYSVAR_SLOT_HASHES_ID    ),
      46             : #define MAP_PERFECT_10 ( SYSVAR_SLOT_HIST_ID      ),
      47             : #define MAP_PERFECT_11 ( SYSVAR_STAKE_HIST_ID     ),
      48             : #define MAP_PERFECT_12 ( SYSVAR_PROG_ID           ),
      49             : 
      50             : /* Programs */
      51             : #define MAP_PERFECT_13 ( ADDR_LUT_PROG_ID         ),
      52             : #define MAP_PERFECT_14 ( BPF_LOADER_2_PROG_ID     ),
      53             : #define MAP_PERFECT_15 ( BPF_LOADER_1_PROG_ID     ),
      54             : #define MAP_PERFECT_16 ( BPF_UPGRADEABLE_PROG_ID  ),
      55             : #define MAP_PERFECT_17 ( COMPUTE_BUDGET_PROG_ID   ),
      56             : #define MAP_PERFECT_18 ( CONFIG_PROG_ID           ),
      57             : #define MAP_PERFECT_19 ( ED25519_SV_PROG_ID       ),
      58             : #define MAP_PERFECT_20 ( FEATURE_ID               ),
      59             : #define MAP_PERFECT_21 ( LOADER_V4_PROG_ID        ),
      60             : #define MAP_PERFECT_22 ( KECCAK_SECP_PROG_ID      ),
      61             : #define MAP_PERFECT_23 ( SECP256R1_PROG_ID        ),
      62             : #define MAP_PERFECT_24 ( STAKE_CONFIG_PROG_ID     ),
      63             : #define MAP_PERFECT_25 ( STAKE_PROG_ID            ),
      64             : #define MAP_PERFECT_26 ( SYS_PROG_ID              ), /* Do not remove. See above. */
      65             : #define MAP_PERFECT_27 ( VOTE_PROG_ID             ),
      66             : #define MAP_PERFECT_28 ( ZK_EL_GAMAL_PROG_ID      ),
      67             : #define MAP_PERFECT_29 ( ZK_TOKEN_PROG_ID         ),
      68             : #define MAP_PERFECT_30 ( NATIVE_LOADER_ID         ),
      69             : 
      70             : #include "../../util/tmpl/fd_map_perfect.c"
      71             : 
      72             : #undef PERFECT_HASH
      73             : 
      74             : #endif /* HEADER_fd_src_disco_pack_fd_pack_unwritable_h */

Generated by: LCOV version 1.14