Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_program_fd_bpf_loader_program_h 2 : #define HEADER_fd_src_flamenco_runtime_program_fd_bpf_loader_program_h 3 : 4 : /* fd_bpf_loader_v3_program.h is the third version of the BPF loader 5 : program. 6 : 7 : Address: BPFLoaderUpgradeab1e11111111111111111111111 */ 8 : 9 : #include "../fd_account.h" 10 : 11 : #define DEFAULT_LOADER_COMPUTE_UNITS (570UL ) 12 : #define DEPRECATED_LOADER_COMPUTE_UNITS (1140UL) 13 : #define UPGRADEABLE_LOADER_COMPUTE_UNITS (2370UL) 14 : #define SIZE_OF_PROGRAM (36UL ) /* UpgradeableLoaderState::size_of_program() */ 15 : #define BUFFER_METADATA_SIZE (37UL ) /* UpgradeableLoaderState::size_of_buffer_metadata() */ 16 12948 : #define PROGRAMDATA_METADATA_SIZE (45UL ) /* UpgradeableLoaderState::size_of_programdata_metadata() */ 17 : #define SIZE_OF_UNINITIALIZED (4UL ) /* UpgradeableLoaderState::size_of_uninitialized() */ 18 : 19 : /* InstructionError conversions 20 : https://github.com/anza-xyz/agave/blob/ced98f1ebe73f7e9691308afa757323003ff744f/sdk/program/src/program_error.rs#L127-L160 */ 21 309 : #define BUILTIN_BIT_SHIFT (32UL) 22 : 23 45 : #define CUSTOM_ZERO ((1UL) << BUILTIN_BIT_SHIFT) 24 0 : #define INVALID_ARGUMENT ((2UL) << BUILTIN_BIT_SHIFT) 25 0 : #define INVALID_INSTRUCTION_DATA ((3UL) << BUILTIN_BIT_SHIFT) 26 0 : #define INVALID_ACCOUNT_DATA ((4UL) << BUILTIN_BIT_SHIFT) 27 0 : #define ACCOUNT_DATA_TOO_SMALL ((5UL) << BUILTIN_BIT_SHIFT) 28 0 : #define INSUFFICIENT_FUNDS ((6UL) << BUILTIN_BIT_SHIFT) 29 0 : #define INCORRECT_PROGRAM_ID ((7UL) << BUILTIN_BIT_SHIFT) 30 0 : #define MISSING_REQUIRED_SIGNATURES ((8UL) << BUILTIN_BIT_SHIFT) 31 0 : #define ACCOUNT_ALREADY_INITIALIZED ((9UL) << BUILTIN_BIT_SHIFT) 32 0 : #define UNINITIALIZED_ACCOUNT ((10UL) << BUILTIN_BIT_SHIFT) 33 57 : #define NOT_ENOUGH_ACCOUNT_KEYS ((11UL) << BUILTIN_BIT_SHIFT) 34 0 : #define ACCOUNT_BORROW_FAILED ((12UL) << BUILTIN_BIT_SHIFT) 35 0 : #define MAX_SEED_LENGTH_EXCEEDED ((13UL) << BUILTIN_BIT_SHIFT) 36 0 : #define INVALID_SEEDS ((14UL) << BUILTIN_BIT_SHIFT) 37 0 : #define BORSH_IO_ERROR ((15UL) << BUILTIN_BIT_SHIFT) 38 0 : #define ACCOUNT_NOT_RENT_EXEMPT ((16UL) << BUILTIN_BIT_SHIFT) 39 0 : #define UNSUPPORTED_SYSVAR ((17UL) << BUILTIN_BIT_SHIFT) 40 0 : #define ILLEGAL_OWNER ((18UL) << BUILTIN_BIT_SHIFT) 41 0 : #define MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED ((19UL) << BUILTIN_BIT_SHIFT) 42 0 : #define INVALID_ACCOUNT_DATA_REALLOC ((20UL) << BUILTIN_BIT_SHIFT) 43 0 : #define MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED ((21UL) << BUILTIN_BIT_SHIFT) 44 0 : #define BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS ((22UL) << BUILTIN_BIT_SHIFT) 45 0 : #define INVALID_ACCOUNT_OWNER ((23UL) << BUILTIN_BIT_SHIFT) 46 0 : #define ARITHMETIC_OVERFLOW ((24UL) << BUILTIN_BIT_SHIFT) 47 0 : #define IMMUTABLE ((25UL) << BUILTIN_BIT_SHIFT) 48 0 : #define INCORRECT_AUTHORITY ((26UL) << BUILTIN_BIT_SHIFT) 49 : 50 : FD_PROTOTYPES_BEGIN 51 : 52 : int 53 : fd_bpf_loader_program_execute( fd_exec_instr_ctx_t * instr_ctx ); 54 : 55 : /* TODO: add comment here */ 56 : 57 : fd_account_meta_t const * 58 : read_bpf_upgradeable_loader_state_for_program( fd_exec_txn_ctx_t * txn_ctx, 59 : uchar program_id, 60 : fd_bpf_upgradeable_loader_state_t * result, 61 : int * opt_err ); 62 : 63 : FD_PROTOTYPES_END 64 : 65 : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_bpf_loader_program_h */