|
| 1 | +//! Conversion between the SVM-level feature set and the full Agave feature set. |
| 2 | +//! |
| 3 | +//! Required for fixtures, precompiles, and other APIs that may come from Agave |
| 4 | +//! libraries higher than or external to SVM. |
| 5 | +
|
| 6 | +use {agave_feature_set::FeatureSet, solana_svm_feature_set::SVMFeatureSet}; |
| 7 | + |
| 8 | +pub fn svm_feature_set_to_feature_set(svm: &SVMFeatureSet) -> FeatureSet { |
| 9 | + let mut fs = FeatureSet::all_enabled(); |
| 10 | + macro_rules! gate { |
| 11 | + ($($field:ident),* $(,)?) => { |
| 12 | + $( |
| 13 | + if !svm.$field { |
| 14 | + fs.deactivate(&agave_feature_set::$field::id()); |
| 15 | + } |
| 16 | + )* |
| 17 | + }; |
| 18 | + } |
| 19 | + gate! { |
| 20 | + move_precompile_verification_to_svm, |
| 21 | + syscall_parameter_address_restrictions, |
| 22 | + virtual_address_space_adjustments, |
| 23 | + account_data_direct_mapping, |
| 24 | + enable_bpf_loader_set_authority_checked_ix, |
| 25 | + enable_loader_v4, |
| 26 | + deplete_cu_meter_on_vm_failure, |
| 27 | + abort_on_invalid_curve, |
| 28 | + blake3_syscall_enabled, |
| 29 | + curve25519_syscall_enabled, |
| 30 | + disable_deploy_of_alloc_free_syscall, |
| 31 | + disable_fees_sysvar, |
| 32 | + disable_sbpf_v0_execution, |
| 33 | + enable_alt_bn128_compression_syscall, |
| 34 | + enable_alt_bn128_syscall, |
| 35 | + enable_big_mod_exp_syscall, |
| 36 | + enable_get_epoch_stake_syscall, |
| 37 | + enable_poseidon_syscall, |
| 38 | + enable_sbpf_v1_deployment_and_execution, |
| 39 | + enable_sbpf_v2_deployment_and_execution, |
| 40 | + enable_sbpf_v3_deployment_and_execution, |
| 41 | + get_sysvar_syscall_enabled, |
| 42 | + last_restart_slot_sysvar, |
| 43 | + reenable_sbpf_v0_execution, |
| 44 | + remaining_compute_units_syscall_enabled, |
| 45 | + remove_bpf_loader_incorrect_program_id, |
| 46 | + move_stake_and_move_lamports_ixs, |
| 47 | + deprecate_legacy_vote_ixs, |
| 48 | + simplify_alt_bn128_syscall_error_codes, |
| 49 | + fix_alt_bn128_multiplication_input_length, |
| 50 | + increase_tx_account_lock_limit, |
| 51 | + enable_extend_program_checked, |
| 52 | + formalize_loaded_transaction_data_size, |
| 53 | + disable_zk_elgamal_proof_program, |
| 54 | + reenable_zk_elgamal_proof_program, |
| 55 | + delay_commission_updates, |
| 56 | + raise_cpi_nesting_limit_to_8, |
| 57 | + provide_instruction_data_offset_in_vm_r2, |
| 58 | + increase_cpi_account_info_limit, |
| 59 | + vote_state_v4, |
| 60 | + poseidon_enforce_padding, |
| 61 | + fix_alt_bn128_pairing_length_check, |
| 62 | + alt_bn128_little_endian, |
| 63 | + create_account_allow_prefund, |
| 64 | + bls_pubkey_management_in_vote_account, |
| 65 | + enable_alt_bn128_g2_syscalls, |
| 66 | + commission_rate_in_basis_points, |
| 67 | + custom_commission_collector, |
| 68 | + enable_bls12_381_syscall, |
| 69 | + block_revenue_sharing, |
| 70 | + vote_account_initialize_v2, |
| 71 | + direct_account_pointers_in_program_input, |
| 72 | + } |
| 73 | + fs |
| 74 | +} |
0 commit comments