LCOV - code coverage report
Current view: top level - flamenco/runtime/program - fd_vote_program.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 1 22 4.5 %
Date: 2025-12-04 04:56:06 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_program_fd_vote_program_h
       2             : #define HEADER_fd_src_flamenco_runtime_program_fd_vote_program_h
       3             : 
       4             : /* The vote program (native program) allows node operators to register
       5             :    their nodes and participate in consensus.  The vote program
       6             :    implements various Tower BFT logic like voting and lockouts.  The set
       7             :    of vote accounts is the 'source of truth' for Solana's consensus
       8             :    algorithm.
       9             : 
      10             :    Address: Vote111111111111111111111111111111111111111 */
      11             : 
      12             : #include "../context/fd_exec_instr_ctx.h"
      13             : #include "../fd_bank.h"
      14             : 
      15             : /* Vote program custom error codes */
      16             : 
      17           0 : #define FD_VOTE_ERR_VOTE_TOO_OLD                    ( 0)
      18           0 : #define FD_VOTE_ERR_SLOTS_MISMATCH                  ( 1)
      19           0 : #define FD_VOTE_ERR_SLOTS_HASH_MISMATCH             ( 2)
      20           0 : #define FD_VOTE_ERR_EMPTY_SLOTS                     ( 3)
      21           0 : #define FD_VOTE_ERR_TIMESTAMP_TOO_OLD               ( 4)
      22           0 : #define FD_VOTE_ERR_TOO_SOON_TO_REAUTHORIZE         ( 5)
      23           0 : #define FD_VOTE_ERR_LOCKOUT_CONFLICT                ( 6)
      24           0 : #define FD_VOTE_ERR_NEW_VOTE_STATE_LOCKOUT_MISMATCH ( 7)
      25           0 : #define FD_VOTE_ERR_SLOTS_NOT_ORDERED               ( 8)
      26           0 : #define FD_VOTE_ERR_CONFIRMATIONS_NOT_ORDERED       ( 9)
      27           0 : #define FD_VOTE_ERR_ZERO_CONFIRMATIONS              (10)
      28           0 : #define FD_VOTE_ERR_CONFIRMATION_TOO_LARGE          (11)
      29           0 : #define FD_VOTE_ERR_ROOT_ROLL_BACK                  (12)
      30           0 : #define FD_VOTE_ERR_CONFIRMATION_ROLL_BACK          (13)
      31           0 : #define FD_VOTE_ERR_SLOT_SMALLER_THAN_ROOT          (14)
      32           0 : #define FD_VOTE_ERR_TOO_MANY_VOTES                  (15)
      33           0 : #define FD_VOTE_ERR_VOTES_TOO_OLD_ALL_FILTERED      (16)
      34           0 : #define FD_VOTE_ERR_ROOT_ON_DIFFERENT_FORK          (17)
      35           0 : #define FD_VOTE_ERR_ACTIVE_VOTE_ACCOUNT_CLOSE       (18)
      36           0 : #define FD_VOTE_ERR_COMMISSION_UPDATE_TOO_LATE      (19)
      37             : 
      38           0 : #define FD_VOTE_STATE_V2_SZ (3731UL)
      39          24 : #define FD_VOTE_STATE_V3_SZ (3762UL)
      40             : 
      41             : FD_PROTOTYPES_BEGIN
      42             : 
      43             : /* fd_vote_program_execute is the instruction processing entrypoint
      44             :    for the vote program. */
      45             : 
      46             : int
      47             : fd_vote_program_execute( fd_exec_instr_ctx_t * ctx );
      48             : 
      49             : /* https://github.com/anza-xyz/agave/blob/v2.0.1/sdk/program/src/vote/state/vote_state_versions.rs#L90 */
      50             : uint
      51             : fd_vote_state_versions_is_correct_and_initialized( fd_txn_account_t * vote_account );
      52             : 
      53             : /* An implementation of solana_sdk::transaction_context::BorrowedAccount::get_state
      54             :    for setting the vote state.
      55             : 
      56             :    https://github.com/anza-xyz/agave/blob/v2.1.14/sdk/src/transaction_context.rs#L965 */
      57             : fd_vote_state_versioned_t *
      58             : fd_vote_get_state( fd_txn_account_t const * self,
      59             :                    uchar *                  mem );
      60             : 
      61             : void
      62             : fd_vote_convert_to_current( fd_vote_state_versioned_t * self,
      63             :                             uchar *                     authorized_voters_mem,
      64             :                             uchar *                     landed_votes_mem );
      65             : 
      66             : void
      67             : fd_vote_store_account( fd_txn_account_t *   vote_account,
      68             :                        fd_bank_t *          bank );
      69             : 
      70             : FD_PROTOTYPES_END
      71             : 
      72             : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_vote_program_h */

Generated by: LCOV version 1.14