From 6c4d7cfc87f597e11532640a61410532ce2d2bed Mon Sep 17 00:00:00 2001 From: Ravyu Sivakumaran Date: Thu, 5 Dec 2024 18:21:04 -0600 Subject: [PATCH] flamenco, vm: consume requested CUs for VM Interp failures --- src/flamenco/features/fd_features_generated.c | 288 +++++++++--------- src/flamenco/features/fd_features_generated.h | 3 +- src/flamenco/features/feature_map.json | 1 + .../runtime/program/fd_bpf_loader_program.c | 9 +- src/flamenco/vm/fd_vm_interp_core.c | 22 +- 5 files changed, 170 insertions(+), 153 deletions(-) diff --git a/src/flamenco/features/fd_features_generated.c b/src/flamenco/features/fd_features_generated.c index a684fd5ffd..c5a7609765 100644 --- a/src/flamenco/features/fd_features_generated.c +++ b/src/flamenco/features/fd_features_generated.c @@ -891,6 +891,12 @@ fd_feature_id_t const ids[] = { .name = "apply_cost_tracker_during_replay", .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + { .index = offsetof(fd_features_t, consume_requested_cu_on_vm_err)>>3, + .id = {"\x96\x30\x7a\x11\x82\xf7\xe4\xee\x64\x9d\xe0\x5b\x0f\xcc\xe5\x25\x7b\x93\x34\x69\x52\xaa\x5a\x1d\x8f\xd1\x2f\x90\xa6\x98\x75\x98"}, + /* B7H2caeia4ZFcpE3QcgMqbiWiBtWrdBRBSJ1DY6Ktxbq */ + .name = "consume_requested_cu_on_vm_err", + .cleaned_up = {UINT_MAX, UINT_MAX, UINT_MAX} }, + { .index = offsetof(fd_features_t, bpf_account_data_direct_mapping)>>3, .id = {"\xe3\x5a\x16\xee\xe9\x8e\x13\xd7\x1e\x4e\x93\xe2\x30\x83\x0d\x5e\x21\x50\xef\x16\x78\x38\x38\xfe\x63\xae\xba\xaa\x3d\x20\x2c\xf0"}, /* GJVDwRkUPNdk9QaK4VsU4g1N41QNxhy1hevjf8kz45Mq */ @@ -1469,76 +1475,77 @@ fd_feature_id_query( ulong prefix ) { case 0x8ff9cf8537529ed8: return &ids[ 144 ]; case 0xd6120d1b80de5fea: return &ids[ 145 ]; case 0xca9ab2701c9aa81b: return &ids[ 146 ]; - case 0xd7138ee9ee165ae3: return &ids[ 147 ]; - case 0x55d3a0c392cf63e0: return &ids[ 148 ]; - case 0x0e7aa95037c5daac: return &ids[ 149 ]; - case 0xe2d13039d5f9c6a6: return &ids[ 150 ]; - case 0xcae3ec6191402713: return &ids[ 151 ]; - case 0xa6b1a5bbb608b7c9: return &ids[ 152 ]; - case 0x50a615bae8ca3874: return &ids[ 153 ]; - case 0xda4dd6055b75ae43: return &ids[ 154 ]; - case 0x2f51d89fe8ee0500: return &ids[ 155 ]; - case 0x61aaf185493a599f: return &ids[ 156 ]; - case 0x74326f811fd7d861: return &ids[ 157 ]; - case 0x2bd7391d0e103c41: return &ids[ 158 ]; - case 0x401b668e4b13b8f9: return &ids[ 159 ]; - case 0x74b022574093eeec: return &ids[ 160 ]; - case 0x81b8fd99bea25f9b: return &ids[ 161 ]; - case 0x3cbf822ccb2eebd4: return &ids[ 162 ]; - case 0xe9d32123513c4d0d: return &ids[ 163 ]; - case 0x64205286d7935342: return &ids[ 164 ]; - case 0x97f912be04ecd673: return &ids[ 165 ]; - case 0x4b241cb4c6f3b3b2: return &ids[ 166 ]; - case 0x21746beaa849f9d9: return &ids[ 167 ]; - case 0x9bb55b5df1c396c5: return &ids[ 168 ]; - case 0x6b9b55aefe23036c: return &ids[ 169 ]; - case 0xe779d032af3fc8c8: return &ids[ 170 ]; - case 0x583989aa9681db6a: return &ids[ 171 ]; - case 0xa511cde5058d996f: return &ids[ 172 ]; - case 0xa414b36a8ea378a1: return &ids[ 173 ]; - case 0x6c49f08f6ae2dad4: return &ids[ 174 ]; - case 0x8c2c2963ae9f420c: return &ids[ 175 ]; - case 0xcd42326b6c24cb0e: return &ids[ 176 ]; - case 0xd17b392feb1e0fe6: return &ids[ 177 ]; - case 0x0207866b7b2c7452: return &ids[ 178 ]; - case 0x592e701c2ba17409: return &ids[ 179 ]; - case 0xbe955088bcb5a209: return &ids[ 180 ]; - case 0xfbce25936c716309: return &ids[ 181 ]; - case 0x116e31cc55ce7d0b: return &ids[ 182 ]; - case 0x8c43e9b9ea49be60: return &ids[ 183 ]; - case 0x9b6307ae6da60a0b: return &ids[ 184 ]; - case 0xf423d4e1d688cb0e: return &ids[ 185 ]; - case 0xa1518043438beb0d: return &ids[ 186 ]; - case 0xdb27ab6a4a6379d5: return &ids[ 187 ]; - case 0x814079c434b79c66: return &ids[ 188 ]; - case 0xfde0b578d38fc5a1: return &ids[ 189 ]; - case 0xf711255aedfe2d0d: return &ids[ 190 ]; - case 0x81f658d2653a6051: return &ids[ 191 ]; - case 0xf1f206f6027db529: return &ids[ 192 ]; - case 0x1d15c9469c7c0ca8: return &ids[ 193 ]; - case 0xb6edac8134dff06e: return &ids[ 194 ]; - case 0x7e4172e5ba362509: return &ids[ 195 ]; - case 0x8ba9e9038d9fdcff: return &ids[ 196 ]; - case 0xafe148ad652172dd: return &ids[ 197 ]; - case 0x91a7af96555ea309: return &ids[ 198 ]; - case 0x8e1411a93085cb0e: return &ids[ 199 ]; - case 0x0b9047b5bb9ef961: return &ids[ 200 ]; - case 0xa5a66405d0ab6309: return &ids[ 201 ]; - case 0x81fcbfa0d0f6b105: return &ids[ 202 ]; - case 0x2c38e34ff071060d: return &ids[ 203 ]; - case 0x829062f252ef5ba8: return &ids[ 204 ]; - case 0x1db51f609c8fcd07: return &ids[ 205 ]; - case 0xe5937c9dd5edd306: return &ids[ 206 ]; - case 0xefc2cb9c2b40f3ff: return &ids[ 207 ]; - case 0x408e6a8a269a6ad1: return &ids[ 208 ]; - case 0xbec08bda942c5ea5: return &ids[ 209 ]; - case 0xf46b1f18665c4236: return &ids[ 210 ]; - case 0xa9a90df1904da912: return &ids[ 211 ]; - case 0x2434a84be5b684a5: return &ids[ 212 ]; - case 0xd30c04a5f2586e4f: return &ids[ 213 ]; - case 0xaebbcc5ad0a28864: return &ids[ 214 ]; - case 0x7f29632535392bc7: return &ids[ 215 ]; - case 0x8c012a2071caecd9: return &ids[ 216 ]; + case 0xeee4f782117a3096: return &ids[ 147 ]; + case 0xd7138ee9ee165ae3: return &ids[ 148 ]; + case 0x55d3a0c392cf63e0: return &ids[ 149 ]; + case 0x0e7aa95037c5daac: return &ids[ 150 ]; + case 0xe2d13039d5f9c6a6: return &ids[ 151 ]; + case 0xcae3ec6191402713: return &ids[ 152 ]; + case 0xa6b1a5bbb608b7c9: return &ids[ 153 ]; + case 0x50a615bae8ca3874: return &ids[ 154 ]; + case 0xda4dd6055b75ae43: return &ids[ 155 ]; + case 0x2f51d89fe8ee0500: return &ids[ 156 ]; + case 0x61aaf185493a599f: return &ids[ 157 ]; + case 0x74326f811fd7d861: return &ids[ 158 ]; + case 0x2bd7391d0e103c41: return &ids[ 159 ]; + case 0x401b668e4b13b8f9: return &ids[ 160 ]; + case 0x74b022574093eeec: return &ids[ 161 ]; + case 0x81b8fd99bea25f9b: return &ids[ 162 ]; + case 0x3cbf822ccb2eebd4: return &ids[ 163 ]; + case 0xe9d32123513c4d0d: return &ids[ 164 ]; + case 0x64205286d7935342: return &ids[ 165 ]; + case 0x97f912be04ecd673: return &ids[ 166 ]; + case 0x4b241cb4c6f3b3b2: return &ids[ 167 ]; + case 0x21746beaa849f9d9: return &ids[ 168 ]; + case 0x9bb55b5df1c396c5: return &ids[ 169 ]; + case 0x6b9b55aefe23036c: return &ids[ 170 ]; + case 0xe779d032af3fc8c8: return &ids[ 171 ]; + case 0x583989aa9681db6a: return &ids[ 172 ]; + case 0xa511cde5058d996f: return &ids[ 173 ]; + case 0xa414b36a8ea378a1: return &ids[ 174 ]; + case 0x6c49f08f6ae2dad4: return &ids[ 175 ]; + case 0x8c2c2963ae9f420c: return &ids[ 176 ]; + case 0xcd42326b6c24cb0e: return &ids[ 177 ]; + case 0xd17b392feb1e0fe6: return &ids[ 178 ]; + case 0x0207866b7b2c7452: return &ids[ 179 ]; + case 0x592e701c2ba17409: return &ids[ 180 ]; + case 0xbe955088bcb5a209: return &ids[ 181 ]; + case 0xfbce25936c716309: return &ids[ 182 ]; + case 0x116e31cc55ce7d0b: return &ids[ 183 ]; + case 0x8c43e9b9ea49be60: return &ids[ 184 ]; + case 0x9b6307ae6da60a0b: return &ids[ 185 ]; + case 0xf423d4e1d688cb0e: return &ids[ 186 ]; + case 0xa1518043438beb0d: return &ids[ 187 ]; + case 0xdb27ab6a4a6379d5: return &ids[ 188 ]; + case 0x814079c434b79c66: return &ids[ 189 ]; + case 0xfde0b578d38fc5a1: return &ids[ 190 ]; + case 0xf711255aedfe2d0d: return &ids[ 191 ]; + case 0x81f658d2653a6051: return &ids[ 192 ]; + case 0xf1f206f6027db529: return &ids[ 193 ]; + case 0x1d15c9469c7c0ca8: return &ids[ 194 ]; + case 0xb6edac8134dff06e: return &ids[ 195 ]; + case 0x7e4172e5ba362509: return &ids[ 196 ]; + case 0x8ba9e9038d9fdcff: return &ids[ 197 ]; + case 0xafe148ad652172dd: return &ids[ 198 ]; + case 0x91a7af96555ea309: return &ids[ 199 ]; + case 0x8e1411a93085cb0e: return &ids[ 200 ]; + case 0x0b9047b5bb9ef961: return &ids[ 201 ]; + case 0xa5a66405d0ab6309: return &ids[ 202 ]; + case 0x81fcbfa0d0f6b105: return &ids[ 203 ]; + case 0x2c38e34ff071060d: return &ids[ 204 ]; + case 0x829062f252ef5ba8: return &ids[ 205 ]; + case 0x1db51f609c8fcd07: return &ids[ 206 ]; + case 0xe5937c9dd5edd306: return &ids[ 207 ]; + case 0xefc2cb9c2b40f3ff: return &ids[ 208 ]; + case 0x408e6a8a269a6ad1: return &ids[ 209 ]; + case 0xbec08bda942c5ea5: return &ids[ 210 ]; + case 0xf46b1f18665c4236: return &ids[ 211 ]; + case 0xa9a90df1904da912: return &ids[ 212 ]; + case 0x2434a84be5b684a5: return &ids[ 213 ]; + case 0xd30c04a5f2586e4f: return &ids[ 214 ]; + case 0xaebbcc5ad0a28864: return &ids[ 215 ]; + case 0x7f29632535392bc7: return &ids[ 216 ]; + case 0x8c012a2071caecd9: return &ids[ 217 ]; default: break; } @@ -1694,75 +1701,76 @@ FD_STATIC_ASSERT( offsetof( fd_features_t, enable_request_heap_frame_ix FD_STATIC_ASSERT( offsetof( fd_features_t, prevent_rent_paying_rent_recipients )>>3==144UL, layout ); FD_STATIC_ASSERT( offsetof( fd_features_t, delay_visibility_of_program_deployment )>>3==145UL, layout ); FD_STATIC_ASSERT( offsetof( fd_features_t, apply_cost_tracker_during_replay )>>3==146UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, bpf_account_data_direct_mapping )>>3==147UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, add_set_tx_loaded_accounts_data_size_instruction )>>3==148UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, switch_to_new_elf_parser )>>3==149UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, round_up_heap_size )>>3==150UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, remove_bpf_loader_incorrect_program_id )>>3==151UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, include_loaded_accounts_data_size_in_fee_calculation )>>3==152UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, native_programs_consume_cu )>>3==153UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, simplify_writable_program_account_check )>>3==154UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, stop_truncating_strings_in_syscalls )>>3==155UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, clean_up_delegation_errors )>>3==156UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, vote_state_add_vote_latency )>>3==157UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, checked_arithmetic_in_fee_validation )>>3==158UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, last_restart_slot_sysvar )>>3==159UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, reduce_stake_warmup_cooldown )>>3==160UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, revise_turbine_epoch_stakes )>>3==161UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_poseidon_syscall )>>3==162UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, timely_vote_credits )>>3==163UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, remaining_compute_units_syscall_enabled )>>3==164UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_program_runtime_v2_and_loader_v4 )>>3==165UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, require_rent_exempt_split_destination )>>3==166UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, better_error_codes_for_tx_lamport_check )>>3==167UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_alt_bn128_compression_syscall )>>3==168UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, programify_feature_gate_program )>>3==169UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick2 )>>3==170UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick3 )>>3==171UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick4 )>>3==172UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick5 )>>3==173UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick6 )>>3==174UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, validate_fee_collector_account )>>3==175UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_zk_transfer_with_fee )>>3==176UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, drop_legacy_shreds )>>3==177UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, consume_blockstore_duplicate_proofs )>>3==178UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, index_erasure_conflict_duplicate_proofs )>>3==179UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, curve25519_restrict_msm_length )>>3==180UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, allow_commission_decrease_at_any_time )>>3==181UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, merkle_conflict_duplicate_proofs )>>3==182UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, disable_bpf_loader_instructions )>>3==183UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_executable_meta_update_in_bpf_loader )>>3==184UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_zk_proof_from_account )>>3==185UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, cost_model_requested_write_lock_cost )>>3==186UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_gossip_duplicate_proof_ingestion )>>3==187UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_chained_merkle_shreds )>>3==188UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, remove_rounding_in_fee_calculation )>>3==189UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_tower_sync_ix )>>3==190UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_unused_legacy_vote_plumbing )>>3==191UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, reward_full_priority_fee )>>3==192UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, disable_rent_fees_collection )>>3==193UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, add_new_reserved_account_keys )>>3==194UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, chained_merkle_conflict_duplicate_proofs )>>3==195UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, simplify_alt_bn128_syscall_error_codes )>>3==196UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, abort_on_invalid_curve )>>3==197UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, ed25519_precompile_verify_strict )>>3==198UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, zk_elgamal_proof_program_enabled )>>3==199UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, move_stake_and_move_lamports_ixs )>>3==200UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_legacy_vote_ixs )>>3==201UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, partitioned_epoch_rewards_superfeature )>>3==202UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_secp256r1_precompile )>>3==203UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, get_sysvar_syscall_enabled )>>3==204UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, disable_sbpf_v0_execution )>>3==205UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, reenable_sbpf_v0_execution )>>3==206UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v1_deployment_and_execution )>>3==207UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v2_deployment_and_execution )>>3==208UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v3_deployment_and_execution )>>3==209UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_feature_gate_program_to_core_bpf )>>3==210UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_config_program_to_core_bpf )>>3==211UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_address_lookup_table_program_to_core_bpf )>>3==212UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_stake_program_to_core_bpf )>>3==213UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, enable_get_epoch_stake_syscall )>>3==214UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, disable_account_loader_special_case )>>3==215UL, layout ); -FD_STATIC_ASSERT( offsetof( fd_features_t, remove_accounts_executable_flag_checks )>>3==216UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, consume_requested_cu_on_vm_err )>>3==147UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, bpf_account_data_direct_mapping )>>3==148UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, add_set_tx_loaded_accounts_data_size_instruction )>>3==149UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, switch_to_new_elf_parser )>>3==150UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, round_up_heap_size )>>3==151UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, remove_bpf_loader_incorrect_program_id )>>3==152UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, include_loaded_accounts_data_size_in_fee_calculation )>>3==153UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, native_programs_consume_cu )>>3==154UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, simplify_writable_program_account_check )>>3==155UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, stop_truncating_strings_in_syscalls )>>3==156UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, clean_up_delegation_errors )>>3==157UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, vote_state_add_vote_latency )>>3==158UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, checked_arithmetic_in_fee_validation )>>3==159UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, last_restart_slot_sysvar )>>3==160UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, reduce_stake_warmup_cooldown )>>3==161UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, revise_turbine_epoch_stakes )>>3==162UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_poseidon_syscall )>>3==163UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, timely_vote_credits )>>3==164UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, remaining_compute_units_syscall_enabled )>>3==165UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_program_runtime_v2_and_loader_v4 )>>3==166UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, require_rent_exempt_split_destination )>>3==167UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, better_error_codes_for_tx_lamport_check )>>3==168UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_alt_bn128_compression_syscall )>>3==169UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, programify_feature_gate_program )>>3==170UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick2 )>>3==171UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick3 )>>3==172UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick4 )>>3==173UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick5 )>>3==174UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, update_hashes_per_tick6 )>>3==175UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, validate_fee_collector_account )>>3==176UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_zk_transfer_with_fee )>>3==177UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, drop_legacy_shreds )>>3==178UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, consume_blockstore_duplicate_proofs )>>3==179UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, index_erasure_conflict_duplicate_proofs )>>3==180UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, curve25519_restrict_msm_length )>>3==181UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, allow_commission_decrease_at_any_time )>>3==182UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, merkle_conflict_duplicate_proofs )>>3==183UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, disable_bpf_loader_instructions )>>3==184UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_executable_meta_update_in_bpf_loader )>>3==185UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_zk_proof_from_account )>>3==186UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, cost_model_requested_write_lock_cost )>>3==187UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_gossip_duplicate_proof_ingestion )>>3==188UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_chained_merkle_shreds )>>3==189UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, remove_rounding_in_fee_calculation )>>3==190UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_tower_sync_ix )>>3==191UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_unused_legacy_vote_plumbing )>>3==192UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, reward_full_priority_fee )>>3==193UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, disable_rent_fees_collection )>>3==194UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, add_new_reserved_account_keys )>>3==195UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, chained_merkle_conflict_duplicate_proofs )>>3==196UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, simplify_alt_bn128_syscall_error_codes )>>3==197UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, abort_on_invalid_curve )>>3==198UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, ed25519_precompile_verify_strict )>>3==199UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, zk_elgamal_proof_program_enabled )>>3==200UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, move_stake_and_move_lamports_ixs )>>3==201UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, deprecate_legacy_vote_ixs )>>3==202UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, partitioned_epoch_rewards_superfeature )>>3==203UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_secp256r1_precompile )>>3==204UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, get_sysvar_syscall_enabled )>>3==205UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, disable_sbpf_v0_execution )>>3==206UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, reenable_sbpf_v0_execution )>>3==207UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v1_deployment_and_execution )>>3==208UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v2_deployment_and_execution )>>3==209UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_sbpf_v3_deployment_and_execution )>>3==210UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_feature_gate_program_to_core_bpf )>>3==211UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_config_program_to_core_bpf )>>3==212UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_address_lookup_table_program_to_core_bpf )>>3==213UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, migrate_stake_program_to_core_bpf )>>3==214UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, enable_get_epoch_stake_syscall )>>3==215UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, disable_account_loader_special_case )>>3==216UL, layout ); +FD_STATIC_ASSERT( offsetof( fd_features_t, remove_accounts_executable_flag_checks )>>3==217UL, layout ); FD_STATIC_ASSERT( sizeof( fd_features_t )>>3==FD_FEATURE_ID_CNT, layout ); diff --git a/src/flamenco/features/fd_features_generated.h b/src/flamenco/features/fd_features_generated.h index 9f274df64a..0b80733f0e 100644 --- a/src/flamenco/features/fd_features_generated.h +++ b/src/flamenco/features/fd_features_generated.h @@ -6,7 +6,7 @@ /* FEATURE_ID_CNT is the number of features in ids */ -#define FD_FEATURE_ID_CNT (217UL) +#define FD_FEATURE_ID_CNT (218UL) union fd_features { @@ -160,6 +160,7 @@ union fd_features { /* 0x8ff9cf8537529ed8 */ ulong prevent_rent_paying_rent_recipients; /* 0xd6120d1b80de5fea */ ulong delay_visibility_of_program_deployment; /* 0xca9ab2701c9aa81b */ ulong apply_cost_tracker_during_replay; + /* 0xeee4f782117a3096 */ ulong consume_requested_cu_on_vm_err; /* 0xd7138ee9ee165ae3 */ ulong bpf_account_data_direct_mapping; /* 0x55d3a0c392cf63e0 */ ulong add_set_tx_loaded_accounts_data_size_instruction; /* 0x0e7aa95037c5daac */ ulong switch_to_new_elf_parser; diff --git a/src/flamenco/features/feature_map.json b/src/flamenco/features/feature_map.json index 217ee91c5b..c1b8d46c3b 100644 --- a/src/flamenco/features/feature_map.json +++ b/src/flamenco/features/feature_map.json @@ -146,6 +146,7 @@ {"name":"prevent_rent_paying_rent_recipients","pubkey": "Fab5oP3DmsLYCiQZXdjyqT3ukFFPrsmqhXU4WU1AWVVF","cleaned_up":[1,18,0]}, {"name":"delay_visibility_of_program_deployment","pubkey": "GmuBvtFb2aHfSfMXpuFeWZGHyDeCLPS79s48fmCWCfM5","cleaned_up":[1,18,0]}, {"name":"apply_cost_tracker_during_replay","pubkey": "2ry7ygxiYURULZCrypHhveanvP5tzZ4toRwVp89oCNSj"}, + {"name":"consume_requested_cu_on_vm_err","pubkey": "B7H2caeia4ZFcpE3QcgMqbiWiBtWrdBRBSJ1DY6Ktxbq"}, {"name":"bpf_account_data_direct_mapping","pubkey": "GJVDwRkUPNdk9QaK4VsU4g1N41QNxhy1hevjf8kz45Mq","old": "EenyoWx9UMXYKpR8mW5Jmfmy2fRjzUtM7NduYMY8bx33"}, {"name":"add_set_tx_loaded_accounts_data_size_instruction","pubkey": "G6vbf1UBok8MWb8m25ex86aoQHeKTzDKzuZADHkShqm6","cleaned_up":[1,18,0]}, {"name":"switch_to_new_elf_parser","pubkey": "Cdkc8PPTeTNUPoZEfCY5AyetUrEdkZtNPMgz58nqyaHD"}, diff --git a/src/flamenco/runtime/program/fd_bpf_loader_program.c b/src/flamenco/runtime/program/fd_bpf_loader_program.c index 0ca7a0fcf8..20ffdfe010 100644 --- a/src/flamenco/runtime/program/fd_bpf_loader_program.c +++ b/src/flamenco/runtime/program/fd_bpf_loader_program.c @@ -566,7 +566,14 @@ fd_bpf_execute( fd_exec_instr_ctx_t * instr_ctx, fd_sbpf_validated_program_t * p vm->cu -= heap_cost_result; int exec_err = fd_vm_exec( vm ); - instr_ctx->txn_ctx->compute_meter = vm->cu; + + /* (SIMD-182) Consume ALL requested CUs on non-Syscall errors */ + if( FD_FEATURE_ACTIVE( instr_ctx->slot_ctx, consume_requested_cu_on_vm_err ) + && exec_err != FD_VM_ERR_SIGSYSCALL ) { + instr_ctx->txn_ctx->compute_meter = 0UL; + } else { + instr_ctx->txn_ctx->compute_meter = vm->cu; + } if( FD_UNLIKELY( vm->trace ) ) { int err = fd_vm_trace_printf( vm->trace, vm->syscalls ); diff --git a/src/flamenco/vm/fd_vm_interp_core.c b/src/flamenco/vm/fd_vm_interp_core.c index a207f5bc85..81942cc618 100644 --- a/src/flamenco/vm/fd_vm_interp_core.c +++ b/src/flamenco/vm/fd_vm_interp_core.c @@ -1164,17 +1164,17 @@ if ( FD_UNLIKELY( ic_correction > cu ) ) err = FD_VM_ERR_SIGCOST; \ cu -= fd_ulong_min( ic_correction, cu ) -sigtext: err = FD_VM_ERR_SIGTEXT; FD_VM_INTERP_FAULT; goto interp_halt; -sigtextbr: err = FD_VM_ERR_SIGTEXT; /* ic current */ /* cu current */ goto interp_halt; -sigcall: err = FD_VM_ERR_SIGCALL; /* ic current */ /* cu current */ goto interp_halt; -sigstack: err = FD_VM_ERR_SIGSTACK; /* ic current */ /* cu current */ goto interp_halt; -sigill: err = FD_VM_ERR_SIGILL; FD_VM_INTERP_FAULT; goto interp_halt; -sigsegv: err = FD_VM_ERR_SIGSEGV; FD_VM_INTERP_FAULT; goto interp_halt; -sigcost: err = FD_VM_ERR_SIGCOST; /* ic current */ cu = 0UL; goto interp_halt; -sigsyscall: /* err current */ /* ic current */ /* cu current */ goto interp_halt; -sigfpe: err = FD_VM_ERR_SIGFPE; FD_VM_INTERP_FAULT; goto interp_halt; -sigfpeof: err = FD_VM_ERR_SIGFPE_OF;FD_VM_INTERP_FAULT; goto interp_halt; -sigexit: /* err current */ /* ic current */ /* cu current */ goto interp_halt; +sigtext: err = FD_VM_ERR_SIGTEXT; FD_VM_INTERP_FAULT; goto interp_halt; +sigtextbr: err = FD_VM_ERR_SIGTEXT; /* ic current */ /* cu current */ goto interp_halt; +sigcall: err = FD_VM_ERR_SIGCALL; /* ic current */ /* cu current */ goto interp_halt; +sigstack: err = FD_VM_ERR_SIGSTACK; /* ic current */ /* cu current */ goto interp_halt; +sigill: err = FD_VM_ERR_SIGILL; FD_VM_INTERP_FAULT; goto interp_halt; +sigsegv: err = FD_VM_ERR_SIGSEGV; FD_VM_INTERP_FAULT; goto interp_halt; +sigcost: err = FD_VM_ERR_SIGCOST; /* ic current */ cu = 0UL; goto interp_halt; +sigsyscall: err = FD_VM_ERR_SIGSYSCALL; /* ic current */ /* cu current */ goto interp_halt; +sigfpe: err = FD_VM_ERR_SIGFPE; FD_VM_INTERP_FAULT; goto interp_halt; +sigfpeof: err = FD_VM_ERR_SIGFPE_OF; FD_VM_INTERP_FAULT; goto interp_halt; +sigexit: /* err current */ /* ic current */ /* cu current */ goto interp_halt; #undef FD_VM_INTERP_FAULT