LCOV - code coverage report
Current view: top level - flamenco/runtime/program - fd_vote_program.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 5 27 18.5 %
Date: 2026-05-15 07:18:56 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             : #include "vote/fd_vote_codec.h"
      15             : 
      16             : // https://github.com/anza-xyz/agave/blob/v2.0.1/sdk/program/src/vote/state/mod.rs#L48
      17           0 : #define VOTE_CREDITS_MAXIMUM_PER_SLOT 16
      18             : 
      19             : // https://github.com/anza-xyz/agave/blob/v2.0.1/sdk/program/src/vote/state/mod.rs#L45
      20           0 : #define VOTE_CREDITS_GRACE_SLOTS 2
      21             : 
      22             : /* https://github.com/anza-xyz/agave/blob/v3.1.1/programs/vote/src/vote_state/handler.rs#L597-L598 */
      23           3 : #define DEFAULT_BLOCK_REVENUE_COMMISSION_BPS (10000UL)
      24             : 
      25             : /* Vote program custom error codes */
      26             : 
      27           0 : #define FD_VOTE_ERR_VOTE_TOO_OLD                    ( 0)
      28           0 : #define FD_VOTE_ERR_SLOTS_MISMATCH                  ( 1)
      29           0 : #define FD_VOTE_ERR_SLOTS_HASH_MISMATCH             ( 2)
      30           0 : #define FD_VOTE_ERR_EMPTY_SLOTS                     ( 3)
      31           0 : #define FD_VOTE_ERR_TIMESTAMP_TOO_OLD               ( 4)
      32           0 : #define FD_VOTE_ERR_TOO_SOON_TO_REAUTHORIZE         ( 5)
      33           0 : #define FD_VOTE_ERR_LOCKOUT_CONFLICT                ( 6)
      34           0 : #define FD_VOTE_ERR_NEW_VOTE_STATE_LOCKOUT_MISMATCH ( 7)
      35           0 : #define FD_VOTE_ERR_SLOTS_NOT_ORDERED               ( 8)
      36           0 : #define FD_VOTE_ERR_CONFIRMATIONS_NOT_ORDERED       ( 9)
      37           0 : #define FD_VOTE_ERR_ZERO_CONFIRMATIONS              (10)
      38           0 : #define FD_VOTE_ERR_CONFIRMATION_TOO_LARGE          (11)
      39           0 : #define FD_VOTE_ERR_ROOT_ROLL_BACK                  (12)
      40           0 : #define FD_VOTE_ERR_CONFIRMATION_ROLL_BACK          (13)
      41           0 : #define FD_VOTE_ERR_SLOT_SMALLER_THAN_ROOT          (14)
      42           0 : #define FD_VOTE_ERR_TOO_MANY_VOTES                  (15)
      43           0 : #define FD_VOTE_ERR_VOTES_TOO_OLD_ALL_FILTERED      (16)
      44           0 : #define FD_VOTE_ERR_ROOT_ON_DIFFERENT_FORK          (17)
      45           0 : #define FD_VOTE_ERR_ACTIVE_VOTE_ACCOUNT_CLOSE       (18)
      46           0 : #define FD_VOTE_ERR_COMMISSION_UPDATE_TOO_LATE      (19)
      47             : 
      48             : #define FD_VOTE_STATE_V2_SZ (3731UL)
      49        6879 : #define FD_VOTE_STATE_V3_SZ (3762UL)
      50           9 : #define FD_VOTE_STATE_V4_SZ (3762UL)
      51             : 
      52             : /* Target vote state versions
      53             :    https://github.com/anza-xyz/agave/blob/v3.1.1/programs/vote/src/vote_state/handler.rs#L639-L645 */
      54          12 : #define VOTE_STATE_TARGET_VERSION_V3 (0)
      55          12 : #define VOTE_STATE_TARGET_VERSION_V4 (1)
      56             : 
      57             : FD_PROTOTYPES_BEGIN
      58             : 
      59             : /* fd_vote_program_execute is the instruction processing entrypoint
      60             :    for the vote program. */
      61             : int
      62             : fd_vote_program_execute( fd_exec_instr_ctx_t * ctx );
      63             : 
      64             : FD_PROTOTYPES_END
      65             : 
      66             : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_vote_program_h */

Generated by: LCOV version 1.14