LCOV - code coverage report
Current view: top level - choreo/votor - ag_cert.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 37 0.0 %
Date: 2026-10-22 18:10:43 Functions: 0 129 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_choreo_votor_ag_cert_h
       2             : #define HEADER_fd_src_choreo_votor_ag_cert_h
       3             : 
       4             : #include "../../ballet/bls/fd_bls.h"
       5             : #include "ag_epoch_info.h"
       6             : #include "ag_votor_base.h"
       7             : 
       8           0 : #define AG_CERT_KIND_FINAL          (0)
       9           0 : #define AG_CERT_KIND_FAST_FINAL     (1)
      10           0 : #define AG_CERT_KIND_NOTAR          (2)
      11           0 : #define AG_CERT_KIND_NOTAR_FALLBACK (3)
      12           0 : #define AG_CERT_KIND_SKIP           (4)
      13             : 
      14           0 : #define AG_CERT_VERIFY_SUCCESS       ( 0)
      15           0 : #define AG_CERT_VERIFY_ERR_THRESHOLD (-1) /* the signers do not have enough stake, the signature is not checked */
      16           0 : #define AG_CERT_VERIFY_ERR_SIG       (-2) /* the signature does not verify */
      17             : 
      18             : struct ag_cert_final {
      19             :   ulong        slot;
      20             :   fd_bls_agg_t agg;
      21             :   ulong        stake;
      22             :   ushort       shred_version;
      23             : };
      24             : typedef struct ag_cert_final ag_cert_final_t;
      25             : 
      26             : struct ag_cert_fast_final {
      27             :   ulong           slot;
      28             :   ag_block_hash_t block_hash;
      29             :   fd_bls_agg_t    agg;
      30             :   ulong           stake;
      31             :   ushort          shred_version;
      32             : };
      33             : typedef struct ag_cert_fast_final ag_cert_fast_final_t;
      34             : 
      35             : struct ag_cert_notar {
      36             :   ulong           slot;
      37             :   ag_block_hash_t block_hash;
      38             :   fd_bls_agg_t    agg;
      39             :   ulong           stake;
      40             :   ushort          shred_version;
      41             : };
      42             : typedef struct ag_cert_notar ag_cert_notar_t;
      43             : 
      44             : struct ag_cert_notar_fallback {
      45             :   ulong           slot;
      46             :   ag_block_hash_t block_hash;
      47             :   fd_bls_agg_t    agg_notar;
      48             :   fd_bls_agg_t    agg_notar_fallback;
      49             :   ulong           stake;
      50             :   ushort          shred_version;
      51             : };
      52             : typedef struct ag_cert_notar_fallback ag_cert_notar_fallback_t;
      53             : 
      54             : struct ag_cert_skip {
      55             :   ulong        slot;
      56             :   fd_bls_agg_t agg_skip;
      57             :   fd_bls_agg_t agg_skip_fallback;
      58             :   ulong        stake;
      59             :   ushort       shred_version;
      60             : };
      61             : typedef struct ag_cert_skip ag_cert_skip_t;
      62             : 
      63             : struct ag_cert {
      64             :   uint kind;
      65             :   union {
      66             :     ag_cert_final_t          final;
      67             :     ag_cert_fast_final_t     fast_final;
      68             :     ag_cert_notar_t          notar;
      69             :     ag_cert_notar_fallback_t notar_fallback;
      70             :     ag_cert_skip_t           skip;
      71             :   };
      72             : };
      73             : typedef struct ag_cert ag_cert_t;
      74             : 
      75             : FD_PROTOTYPES_BEGIN
      76             : 
      77             : /* Definition 11. Cert::slot */
      78             : 
      79             : FD_FN_PURE static inline ulong
      80           0 : ag_cert_slot( ag_cert_t const * self ) {
      81           0 :   switch( self->kind ) {
      82           0 :   case AG_CERT_KIND_FINAL:          return self->final.slot;
      83           0 :   case AG_CERT_KIND_FAST_FINAL:     return self->fast_final.slot;
      84           0 :   case AG_CERT_KIND_NOTAR:          return self->notar.slot;
      85           0 :   case AG_CERT_KIND_NOTAR_FALLBACK: return self->notar_fallback.slot;
      86           0 :   case AG_CERT_KIND_SKIP:           return self->skip.slot;
      87           0 :   default:                          FD_LOG_CRIT(( "unreachable" ));
      88           0 :   }
      89           0 : }
      90             : 
      91             : /* Definition 11. Cert::block_hash */
      92             : 
      93             : FD_FN_PURE static inline uchar const *
      94           0 : ag_cert_block_hash( ag_cert_t const * self ) {
      95           0 :   switch( self->kind ) {
      96           0 :   case AG_CERT_KIND_FINAL:          return NULL;
      97           0 :   case AG_CERT_KIND_FAST_FINAL:     return self->fast_final.block_hash;
      98           0 :   case AG_CERT_KIND_NOTAR:          return self->notar.block_hash;
      99           0 :   case AG_CERT_KIND_NOTAR_FALLBACK: return self->notar_fallback.block_hash;
     100           0 :   case AG_CERT_KIND_SKIP:           return NULL;
     101           0 :   default:                          FD_LOG_CRIT(( "unreachable" )); }
     102           0 : }
     103             : 
     104             : FD_FN_PURE static inline ushort
     105           0 : ag_cert_shred_version( ag_cert_t const * self ) {
     106           0 :   switch( self->kind ) {
     107           0 :   case AG_CERT_KIND_FINAL:          return self->final.shred_version;
     108           0 :   case AG_CERT_KIND_FAST_FINAL:     return self->fast_final.shred_version;
     109           0 :   case AG_CERT_KIND_NOTAR:          return self->notar.shred_version;
     110           0 :   case AG_CERT_KIND_NOTAR_FALLBACK: return self->notar_fallback.shred_version;
     111           0 :   case AG_CERT_KIND_SKIP:           return self->skip.shred_version;
     112           0 :   default:                          FD_LOG_CRIT(( "unreachable" ));
     113           0 :   }
     114           0 : }
     115             : 
     116             : /* Definition 13. ValidatedCert::try_new */
     117             : 
     118             : int
     119             : ag_cert_verify( ag_cert_t const *       self,
     120             :                 ag_epoch_info_t const * epoch_info );
     121             : 
     122             : FD_PROTOTYPES_END
     123             : 
     124             : #endif

Generated by: LCOV version 1.14