solomka_sdk/
feature_set.rs

1//! Collection of all runtime features.
2//!
3//! Steps to add a new feature are outlined below. Note that these steps only cover
4//! the process of getting a feature into the core Solana code.
5//! - For features that are unambiguously good (ie bug fixes), these steps are sufficient.
6//! - For features that should go up for community vote (ie fee structure changes), more
7//!   information on the additional steps to follow can be found at:
8//!   <https://spl.solana.com/feature-proposal#feature-proposal-life-cycle>
9//!
10//! 1. Generate a new keypair with `solomka-keygen new --outfile feature.json --no-passphrase`
11//!    - Keypairs should be held by core contributors only. If you're a non-core contributor going
12//!      through these steps, the PR process will facilitate a keypair holder being picked. That
13//!      person will generate the keypair, provide pubkey for PR, and ultimately enable the feature.
14//! 2. Add a public module for the feature, specifying keypair pubkey as the id with
15//!    `solomka_sdk::declare_id!()` within the module.
16//!    Additionally, add an entry to `FEATURE_NAMES` map.
17//! 3. Add desired logic to check for and switch on feature availability.
18//!
19//! For more information on how features are picked up, see comments for `Feature`.
20
21use {
22    lazy_static::lazy_static,
23    solomka_sdk::{
24        clock::Slot,
25        hash::{Hash, Hasher},
26        pubkey::Pubkey,
27    },
28    std::collections::{HashMap, HashSet},
29};
30
31pub mod deprecate_rewards_sysvar {
32    solomka_sdk::declare_id!("GaBtBJvmS4Arjj5W1NmFcyvPjsHN38UGYDq2MDwbs9Qu");
33}
34
35pub mod pico_inflation {
36    solomka_sdk::declare_id!("4RWNif6C2WCNiKVW7otP4G7dkmkHGyKQWRpuZ1pxKU5m");
37}
38
39pub mod full_inflation {
40    pub mod devnet_and_testnet {
41        solomka_sdk::declare_id!("DT4n6ABDqs6w4bnfwrXT9rsprcPf6cdDga1egctaPkLC");
42    }
43
44    pub mod mainnet {
45        pub mod certusone {
46            pub mod vote {
47                solomka_sdk::declare_id!("BzBBveUDymEYoYzcMWNQCx3cd4jQs7puaVFHLtsbB6fm");
48            }
49            pub mod enable {
50                solomka_sdk::declare_id!("7XRJcS5Ud5vxGB54JbK9N2vBZVwnwdBNeJW1ibRgD9gx");
51            }
52        }
53    }
54}
55
56pub mod secp256k1_program_enabled {
57    solomka_sdk::declare_id!("E3PHP7w8kB7np3CTQ1qQ2tW3KCtjRSXBQgW9vM2mWv2Y");
58}
59
60pub mod spl_token_v2_multisig_fix {
61    solomka_sdk::declare_id!("E5JiFDQCwyC6QfT9REFyMpfK2mHcmv1GUDySU1Ue7TYv");
62}
63
64pub mod no_overflow_rent_distribution {
65    solomka_sdk::declare_id!("4kpdyrcj5jS47CZb2oJGfVxjYbsMm2Kx97gFyZrxxwXz");
66}
67
68pub mod filter_stake_delegation_accounts {
69    solomka_sdk::declare_id!("GE7fRxmW46K6EmCD9AMZSbnaJ2e3LfqCZzdHi9hmYAgi");
70}
71
72pub mod require_custodian_for_locked_stake_authorize {
73    solomka_sdk::declare_id!("D4jsDcXaqdW8tDAWn8H4R25Cdns2YwLneujSL1zvjW6R");
74}
75
76pub mod spl_token_v2_self_transfer_fix {
77    solomka_sdk::declare_id!("BL99GYhdjjcv6ys22C9wPgn2aTVERDbPHHo4NbS3hgp7");
78}
79
80pub mod warp_timestamp_again {
81    solomka_sdk::declare_id!("GvDsGDkH5gyzwpDhxNixx8vtx1kwYHH13RiNAPw27zXb");
82}
83
84pub mod check_init_vote_data {
85    solomka_sdk::declare_id!("3ccR6QpxGYsAbWyfevEtBNGfWV4xBffxRj2tD6A9i39F");
86}
87
88pub mod secp256k1_recover_syscall_enabled {
89    solomka_sdk::declare_id!("6RvdSWHh8oh72Dp7wMTS2DBkf3fRPtChfNrAo3cZZoXJ");
90}
91
92pub mod system_transfer_zero_check {
93    solomka_sdk::declare_id!("BrTR9hzw4WBGFP65AJMbpAo64DcA3U6jdPSga9fMV5cS");
94}
95
96pub mod blake3_syscall_enabled {
97    solomka_sdk::declare_id!("HTW2pSyErTj4BV6KBM9NZ9VBUJVxt7sacNWcf76wtzb3");
98}
99
100pub mod dedupe_config_program_signers {
101    solomka_sdk::declare_id!("8kEuAshXLsgkUEdcFVLqrjCGGHVWFW99ZZpxvAzzMtBp");
102}
103
104pub mod verify_tx_signatures_len {
105    solomka_sdk::declare_id!("EVW9B5xD9FFK7vw1SBARwMA4s5eRo5eKJdKpsBikzKBz");
106}
107
108pub mod vote_stake_checked_instructions {
109    solomka_sdk::declare_id!("BcWknVcgvonN8sL4HE4XFuEVgfcee5MwxWPAgP6ZV89X");
110}
111
112pub mod rent_for_sysvars {
113    solomka_sdk::declare_id!("BKCPBQQBZqggVnFso5nQ8rQ4RwwogYwjuUt9biBjxwNF");
114}
115
116pub mod libsecp256k1_0_5_upgrade_enabled {
117    solomka_sdk::declare_id!("DhsYfRjxfnh2g7HKJYSzT79r74Afa1wbHkAgHndrA1oy");
118}
119
120pub mod tx_wide_compute_cap {
121    solomka_sdk::declare_id!("5ekBxc8itEnPv4NzGJtr8BVVQLNMQuLMNQQj7pHoLNZ9");
122}
123
124pub mod spl_token_v2_set_authority_fix {
125    solomka_sdk::declare_id!("FToKNBYyiF4ky9s8WsmLBXHCht17Ek7RXaLZGHzzQhJ1");
126}
127
128pub mod merge_nonce_error_into_system_error {
129    solomka_sdk::declare_id!("21AWDosvp3pBamFW91KB35pNoaoZVTM7ess8nr2nt53B");
130}
131
132pub mod disable_fees_sysvar {
133    solomka_sdk::declare_id!("JAN1trEUEtZjgXYzNBYHU9DYd7GnThhXfFP7SzPXkPsG");
134}
135
136pub mod stake_merge_with_unmatched_credits_observed {
137    solomka_sdk::declare_id!("meRgp4ArRPhD3KtCY9c5yAf2med7mBLsjKTPeVUHqBL");
138}
139
140pub mod zk_token_sdk_enabled {
141    solomka_sdk::declare_id!("zk1snxsc6Fh3wsGNbbHAJNHiJoYgF29mMnTSusGx5EJ");
142}
143
144pub mod curve25519_syscall_enabled {
145    solomka_sdk::declare_id!("7rcw5UtqgDTBBv2EcynNfYckgdAaH1MAsCjKgXMkN7Ri");
146}
147
148pub mod versioned_tx_message_enabled {
149    solomka_sdk::declare_id!("3KZZ6Ks1885aGBQ45fwRcPXVBCtzUvxhUTkwKMR41Tca");
150}
151
152pub mod libsecp256k1_fail_on_bad_count {
153    solomka_sdk::declare_id!("8aXvSuopd1PUj7UhehfXJRg6619RHp8ZvwTyyJHdUYsj");
154}
155
156pub mod libsecp256k1_fail_on_bad_count2 {
157    solomka_sdk::declare_id!("54KAoNiUERNoWWUhTWWwXgym94gzoXFVnHyQwPA18V9A");
158}
159
160pub mod instructions_sysvar_owned_by_sysvar {
161    solomka_sdk::declare_id!("H3kBSaKdeiUsyHmeHqjJYNc27jesXZ6zWj3zWkowQbkV");
162}
163
164pub mod stake_program_advance_activating_credits_observed {
165    solomka_sdk::declare_id!("SAdVFw3RZvzbo6DvySbSdBnHN4gkzSTH9dSxesyKKPj");
166}
167
168pub mod credits_auto_rewind {
169    solomka_sdk::declare_id!("BUS12ciZ5gCoFafUHWW8qaFMMtwFQGVxjsDheWLdqBE2");
170}
171
172pub mod demote_program_write_locks {
173    solomka_sdk::declare_id!("3E3jV7v9VcdJL8iYZUMax9DiDno8j7EWUVbhm9RtShj2");
174}
175
176pub mod ed25519_program_enabled {
177    solomka_sdk::declare_id!("6ppMXNYLhVd7GcsZ5uV11wQEW7spppiMVfqQv5SXhDpX");
178}
179
180pub mod return_data_syscall_enabled {
181    solomka_sdk::declare_id!("DwScAzPUjuv65TMbDnFY7AgwmotzWy3xpEJMXM3hZFaB");
182}
183
184pub mod reduce_required_deploy_balance {
185    solomka_sdk::declare_id!("EBeznQDjcPG8491sFsKZYBi5S5jTVXMpAKNDJMQPS2kq");
186}
187
188pub mod sol_log_data_syscall_enabled {
189    solomka_sdk::declare_id!("6uaHcKPGUy4J7emLBgUTeufhJdiwhngW6a1R9B7c2ob9");
190}
191
192pub mod stakes_remove_delegation_if_inactive {
193    solomka_sdk::declare_id!("HFpdDDNQjvcXnXKec697HDDsyk6tFoWS2o8fkxuhQZpL");
194}
195
196pub mod do_support_realloc {
197    solomka_sdk::declare_id!("75m6ysz33AfLA5DDEzWM1obBrnPQRSsdVQ2nRmc8Vuu1");
198}
199
200// Note: when this feature is cleaned up, also remove the secp256k1 program from
201// the list of builtins and remove its files from /programs
202pub mod prevent_calling_precompiles_as_programs {
203    solomka_sdk::declare_id!("4ApgRX3ud6p7LNMJmsuaAcZY5HWctGPr5obAsjB3A54d");
204}
205
206pub mod optimize_epoch_boundary_updates {
207    solomka_sdk::declare_id!("265hPS8k8xJ37ot82KEgjRunsUp5w4n4Q4VwwiN9i9ps");
208}
209
210pub mod remove_native_loader {
211    solomka_sdk::declare_id!("HTTgmruMYRZEntyL3EdCDdnS6e4D5wRq1FA7kQsb66qq");
212}
213
214pub mod send_to_tpu_vote_port {
215    solomka_sdk::declare_id!("C5fh68nJ7uyKAuYZg2x9sEQ5YrVf3dkW6oojNBSc3Jvo");
216}
217
218pub mod requestable_heap_size {
219    solomka_sdk::declare_id!("CCu4boMmfLuqcmfTLPHQiUo22ZdUsXjgzPAURYaWt1Bw");
220}
221
222pub mod disable_fee_calculator {
223    solomka_sdk::declare_id!("2jXx2yDmGysmBKfKYNgLj2DQyAQv6mMk2BPh4eSbyB4H");
224}
225
226pub mod add_compute_budget_program {
227    solomka_sdk::declare_id!("4d5AKtxoh93Dwm1vHXUU3iRATuMndx1c431KgT2td52r");
228}
229
230pub mod nonce_must_be_writable {
231    solomka_sdk::declare_id!("BiCU7M5w8ZCMykVSyhZ7Q3m2SWoR2qrEQ86ERcDX77ME");
232}
233
234pub mod spl_token_v3_3_0_release {
235    solomka_sdk::declare_id!("Ftok2jhqAqxUWEiCVRrfRs9DPppWP8cgTB7NQNKL88mS");
236}
237
238pub mod leave_nonce_on_success {
239    solomka_sdk::declare_id!("E8MkiWZNNPGU6n55jkGzyj8ghUmjCHRmDFdYYFYHxWhQ");
240}
241
242pub mod reject_empty_instruction_without_program {
243    solomka_sdk::declare_id!("9kdtFSrXHQg3hKkbXkQ6trJ3Ja1xpJ22CTFSNAciEwmL");
244}
245
246pub mod fixed_memcpy_nonoverlapping_check {
247    solomka_sdk::declare_id!("36PRUK2Dz6HWYdG9SpjeAsF5F3KxnFCakA2BZMbtMhSb");
248}
249
250pub mod reject_non_rent_exempt_vote_withdraws {
251    solomka_sdk::declare_id!("7txXZZD6Um59YoLMF7XUNimbMjsqsWhc7g2EniiTrmp1");
252}
253
254pub mod evict_invalid_stakes_cache_entries {
255    solomka_sdk::declare_id!("EMX9Q7TVFAmQ9V1CggAkhMzhXSg8ECp7fHrWQX2G1chf");
256}
257
258pub mod allow_votes_to_directly_update_vote_state {
259    solomka_sdk::declare_id!("Ff8b1fBeB86q8cjq47ZhsQLgv5EkHu3G1C99zjUfAzrq");
260}
261
262pub mod cap_accounts_data_len {
263    solomka_sdk::declare_id!("capRxUrBjNkkCpjrJxPGfPaWijB7q3JoDfsWXAnt46r");
264}
265
266pub mod max_tx_account_locks {
267    solomka_sdk::declare_id!("CBkDroRDqm8HwHe6ak9cguPjUomrASEkfmxEaZ5CNNxz");
268}
269
270pub mod require_rent_exempt_accounts {
271    solomka_sdk::declare_id!("BkFDxiJQWZXGTZaJQxH7wVEHkAmwCgSEVkrvswFfRJPD");
272}
273
274pub mod filter_votes_outside_slot_hashes {
275    solomka_sdk::declare_id!("3gtZPqvPpsbXZVCx6hceMfWxtsmrjMzmg8C7PLKSxS2d");
276}
277
278pub mod update_syscall_base_costs {
279    solomka_sdk::declare_id!("2h63t332mGCCsWK2nqqqHhN4U9ayyqhLVFvczznHDoTZ");
280}
281
282pub mod stake_deactivate_delinquent_instruction {
283    solomka_sdk::declare_id!("437r62HoAdUb63amq3D7ENnBLDhHT2xY8eFkLJYVKK4x");
284}
285
286pub mod stake_redelegate_instruction {
287    solomka_sdk::declare_id!("3EPmAX94PvVJCjMeFfRFvj4avqCPL8vv3TGsZQg7ydMx");
288}
289
290pub mod vote_withdraw_authority_may_change_authorized_voter {
291    solomka_sdk::declare_id!("AVZS3ZsN4gi6Rkx2QUibYuSJG3S6QHib7xCYhG6vGJxU");
292}
293
294pub mod spl_associated_token_account_v1_0_4 {
295    solomka_sdk::declare_id!("FaTa4SpiaSNH44PGC4z8bnGVTkSRYaWvrBs3KTu8XQQq");
296}
297
298pub mod reject_vote_account_close_unless_zero_credit_epoch {
299    solomka_sdk::declare_id!("ALBk3EWdeAg2WAGf6GPDUf1nynyNqCdEVmgouG7rpuCj");
300}
301
302pub mod add_get_processed_sibling_instruction_syscall {
303    solomka_sdk::declare_id!("CFK1hRCNy8JJuAAY8Pb2GjLFNdCThS2qwZNe3izzBMgn");
304}
305
306pub mod bank_tranaction_count_fix {
307    solomka_sdk::declare_id!("Vo5siZ442SaZBKPXNocthiXysNviW4UYPwRFggmbgAp");
308}
309
310pub mod disable_bpf_deprecated_load_instructions {
311    solomka_sdk::declare_id!("3XgNukcZWf9o3HdA3fpJbm94XFc4qpvTXc8h1wxYwiPi");
312}
313
314pub mod disable_bpf_unresolved_symbols_at_runtime {
315    solomka_sdk::declare_id!("4yuaYAj2jGMGTh1sSmi4G2eFscsDq8qjugJXZoBN6YEa");
316}
317
318pub mod record_instruction_in_transaction_context_push {
319    solomka_sdk::declare_id!("3aJdcZqxoLpSBxgeYGjPwaYS1zzcByxUDqJkbzWAH1Zb");
320}
321
322pub mod syscall_saturated_math {
323    solomka_sdk::declare_id!("HyrbKftCdJ5CrUfEti6x26Cj7rZLNe32weugk7tLcWb8");
324}
325
326pub mod check_physical_overlapping {
327    solomka_sdk::declare_id!("nWBqjr3gpETbiaVj3CBJ3HFC5TMdnJDGt21hnvSTvVZ");
328}
329
330pub mod limit_secp256k1_recovery_id {
331    solomka_sdk::declare_id!("7g9EUwj4j7CS21Yx1wvgWLjSZeh5aPq8x9kpoPwXM8n8");
332}
333
334pub mod disable_deprecated_loader {
335    solomka_sdk::declare_id!("GTUMCZ8LTNxVfxdrw7ZsDFTxXb7TutYkzJnFwinpE6dg");
336}
337
338pub mod check_slice_translation_size {
339    solomka_sdk::declare_id!("GmC19j9qLn2RFk5NduX6QXaDhVpGncVVBzyM8e9WMz2F");
340}
341
342pub mod stake_split_uses_rent_sysvar {
343    solomka_sdk::declare_id!("FQnc7U4koHqWgRvFaBJjZnV8VPg6L6wWK33yJeDp4yvV");
344}
345
346pub mod add_get_minimum_delegation_instruction_to_stake_program {
347    solomka_sdk::declare_id!("St8k9dVXP97xT6faW24YmRSYConLbhsMJA4TJTBLmMT");
348}
349
350pub mod error_on_syscall_bpf_function_hash_collisions {
351    solomka_sdk::declare_id!("8199Q2gMD2kwgfopK5qqVWuDbegLgpuFUFHCcUJQDN8b");
352}
353
354pub mod reject_callx_r10 {
355    solomka_sdk::declare_id!("3NKRSwpySNwD3TvP5pHnRmkAQRsdkXWRr1WaQh8p4PWX");
356}
357
358pub mod drop_redundant_turbine_path {
359    solomka_sdk::declare_id!("4Di3y24QFLt5QEUPZtbnjyfQKfm6ZMTfa6Dw1psfoMKU");
360}
361
362pub mod executables_incur_cpi_data_cost {
363    solomka_sdk::declare_id!("7GUcYgq4tVtaqNCKT3dho9r4665Qp5TxCZ27Qgjx3829");
364}
365
366pub mod fix_recent_blockhashes {
367    solomka_sdk::declare_id!("6iyggb5MTcsvdcugX7bEKbHV8c6jdLbpHwkncrgLMhfo");
368}
369
370pub mod update_rewards_from_cached_accounts {
371    solomka_sdk::declare_id!("28s7i3htzhahXQKqmS2ExzbEoUypg9krwvtK2M9UWXh9");
372}
373
374pub mod spl_token_v3_4_0 {
375    solomka_sdk::declare_id!("Ftok4njE8b7tDffYkC5bAbCaQv5sL6jispYrprzatUwN");
376}
377
378pub mod spl_associated_token_account_v1_1_0 {
379    solomka_sdk::declare_id!("FaTa17gVKoqbh38HcfiQonPsAaQViyDCCSg71AubYZw8");
380}
381
382pub mod default_units_per_instruction {
383    solomka_sdk::declare_id!("J2QdYx8crLbTVK8nur1jeLsmc3krDbfjoxoea2V1Uy5Q");
384}
385
386pub mod stake_allow_zero_undelegated_amount {
387    solomka_sdk::declare_id!("sTKz343FM8mqtyGvYWvbLpTThw3ixRM4Xk8QvZ985mw");
388}
389
390pub mod require_static_program_ids_in_transaction {
391    solomka_sdk::declare_id!("8FdwgyHFEjhAdjWfV2vfqk7wA1g9X3fQpKH7SBpEv3kC");
392}
393
394pub mod stake_raise_minimum_delegation_to_1_sol {
395    // This is a feature-proposal *feature id*.  The feature keypair address is `GQXzC7YiSNkje6FFUk6sc2p53XRvKoaZ9VMktYzUMnpL`.
396    solomka_sdk::declare_id!("9onWzzvCzNC2jfhxxeqRgs5q7nFAAKpCUvkj6T6GJK9i");
397}
398
399pub mod stake_minimum_delegation_for_rewards {
400    solomka_sdk::declare_id!("ELjxSXwNsyXGfAh8TqX8ih22xeT8huF6UngQirbLKYKH");
401}
402
403pub mod add_set_compute_unit_price_ix {
404    solomka_sdk::declare_id!("98std1NSHqXi9WYvFShfVepRdCoq1qvsp8fsR2XZtG8g");
405}
406
407pub mod disable_deploy_of_alloc_free_syscall {
408    solomka_sdk::declare_id!("79HWsX9rpnnJBPcdNURVqygpMAfxdrAirzAGAVmf92im");
409}
410
411pub mod include_account_index_in_rent_error {
412    solomka_sdk::declare_id!("2R72wpcQ7qV7aTJWUumdn8u5wmmTyXbK7qzEy7YSAgyY");
413}
414
415pub mod add_shred_type_to_shred_seed {
416    solomka_sdk::declare_id!("Ds87KVeqhbv7Jw8W6avsS1mqz3Mw5J3pRTpPoDQ2QdiJ");
417}
418
419pub mod warp_timestamp_with_a_vengeance {
420    solomka_sdk::declare_id!("3BX6SBeEBibHaVQXywdkcgyUk6evfYZkHdztXiDtEpFS");
421}
422
423pub mod separate_nonce_from_blockhash {
424    solomka_sdk::declare_id!("Gea3ZkK2N4pHuVZVxWcnAtS6UEDdyumdYt4pFcKjA3ar");
425}
426
427pub mod enable_durable_nonce {
428    solomka_sdk::declare_id!("4EJQtF2pkRyawwcTVfQutzq4Sa5hRhibF6QAK1QXhtEX");
429}
430
431pub mod vote_state_update_credit_per_dequeue {
432    solomka_sdk::declare_id!("CveezY6FDLVBToHDcvJRmtMouqzsmj4UXYh5ths5G5Uv");
433}
434
435pub mod quick_bail_on_panic {
436    solomka_sdk::declare_id!("DpJREPyuMZ5nDfU6H3WTqSqUFSXAfw8u7xqmWtEwJDcP");
437}
438
439pub mod nonce_must_be_authorized {
440    solomka_sdk::declare_id!("HxrEu1gXuH7iD3Puua1ohd5n4iUKJyFNtNxk9DVJkvgr");
441}
442
443pub mod nonce_must_be_advanceable {
444    solomka_sdk::declare_id!("3u3Er5Vc2jVcwz4xr2GJeSAXT3fAj6ADHZ4BJMZiScFd");
445}
446
447pub mod vote_authorize_with_seed {
448    solomka_sdk::declare_id!("6tRxEYKuy2L5nnv5bgn7iT28MxUbYxp5h7F3Ncf1exrT");
449}
450
451pub mod cap_accounts_data_size_per_block {
452    solomka_sdk::declare_id!("qywiJyZmqTKspFg2LeuUHqcA5nNvBgobqb9UprywS9N");
453}
454
455pub mod preserve_rent_epoch_for_rent_exempt_accounts {
456    solomka_sdk::declare_id!("HH3MUYReL2BvqqA3oEcAa7txju5GY6G4nxJ51zvsEjEZ");
457}
458
459pub mod enable_bpf_loader_extend_program_ix {
460    solomka_sdk::declare_id!("8Zs9W7D9MpSEtUWSQdGniZk2cNmV22y6FLJwCx53asme");
461}
462
463pub mod enable_early_verification_of_account_modifications {
464    solomka_sdk::declare_id!("7Vced912WrRnfjaiKRiNBcbuFw7RrnLv3E3z95Y4GTNc");
465}
466
467pub mod prevent_crediting_accounts_that_end_rent_paying {
468    solomka_sdk::declare_id!("812kqX67odAp5NFwM8D2N24cku7WTm9CHUTFUXaDkWPn");
469}
470
471pub mod cap_bpf_program_instruction_accounts {
472    solomka_sdk::declare_id!("9k5ijzTbYPtjzu8wj2ErH9v45xecHzQ1x4PMYMMxFgdM");
473}
474
475pub mod loosen_cpi_size_restriction {
476    solomka_sdk::declare_id!("GDH5TVdbTPUpRnXaRyQqiKUa7uZAbZ28Q2N9bhbKoMLm");
477}
478
479pub mod use_default_units_in_fee_calculation {
480    solomka_sdk::declare_id!("8sKQrMQoUHtQSUP83SPG4ta2JDjSAiWs7t5aJ9uEd6To");
481}
482
483pub mod compact_vote_state_updates {
484    solomka_sdk::declare_id!("86HpNqzutEZwLcPxS6EHDcMNYWk6ikhteg9un7Y2PBKE");
485}
486
487pub mod concurrent_replay_of_forks {
488    solomka_sdk::declare_id!("9F2Dcu8xkBPKxiiy65XKPZYdCG3VZDpjDTuSmeYLozJe");
489}
490
491pub mod incremental_snapshot_only_incremental_hash_calculation {
492    solomka_sdk::declare_id!("25vqsfjk7Nv1prsQJmA4Xu1bN61s8LXCBGUPp8Rfy1UF");
493}
494
495pub mod vote_state_update_root_fix {
496    solomka_sdk::declare_id!("G74BkWBzmsByZ1kxHy44H3wjwp5hp7JbrGRuDpco22tY");
497}
498
499pub mod return_none_for_zero_lamport_accounts {
500    solomka_sdk::declare_id!("7K5HFrS1WAq6ND7RQbShXZXbtAookyTfaDQPTJNuZpze");
501}
502
503pub mod disable_rehash_for_rent_epoch {
504    solomka_sdk::declare_id!("DTVTkmw3JSofd8CJVJte8PXEbxNQ2yZijvVr3pe2APPj");
505}
506
507pub mod on_load_preserve_rent_epoch_for_rent_exempt_accounts {
508    solomka_sdk::declare_id!("CpkdQmspsaZZ8FVAouQTtTWZkc8eeQ7V3uj7dWz543rZ");
509}
510
511pub mod increase_tx_account_lock_limit {
512    solomka_sdk::declare_id!("9LZdXeKGeBV6hRLdxS1rHbHoEUsKqesCC2ZAPTPKJAbK");
513}
514
515pub mod check_syscall_outputs_do_not_overlap {
516    solomka_sdk::declare_id!("3uRVPBpyEJRo1emLCrq38eLRFGcu6uKSpUXqGvU8T7SZ");
517}
518
519pub mod commission_updates_only_allowed_in_first_half_of_epoch {
520    solomka_sdk::declare_id!("noRuG2kzACwgaY7TVmLRnUNPLKNVQE1fb7X55YWBehp");
521}
522
523pub mod enable_turbine_fanout_experiments {
524    solomka_sdk::declare_id!("D31EFnLgdiysi84Woo3of4JMu7VmasUS3Z7j9HYXCeLY");
525}
526
527pub mod disable_turbine_fanout_experiments {
528    solomka_sdk::declare_id!("Gz1aLrbeQ4Q6PTSafCZcGWZXz91yVRi7ASFzFEr1U4sa");
529}
530
531pub mod drop_merkle_shreds {
532    solomka_sdk::declare_id!("84zy5N23Q9vTZuLc9h1HWUtyM9yCFV2SCmyP9W9C3yHZ");
533}
534
535pub mod keep_merkle_shreds {
536    solomka_sdk::declare_id!("HyNQzc7TMNmRhpVHXqDGjpsHzeQie82mDQXSF9hj7nAH");
537}
538
539pub mod move_serialized_len_ptr_in_cpi {
540    solomka_sdk::declare_id!("74CoWuBmt3rUVUrCb2JiSTvh6nXyBWUsK4SaMj3CtE3T");
541}
542
543pub mod disable_builtin_loader_ownership_chains {
544    solomka_sdk::declare_id!("4UDcAfQ6EcA6bdcadkeHpkarkhZGJ7Bpq7wTAiRMjkoi");
545}
546
547pub mod enable_request_heap_frame_ix {
548    solomka_sdk::declare_id!("Hr1nUA9b7NJ6eChS26o7Vi8gYYDDwWD3YeBfzJkTbU86");
549}
550
551pub mod clean_up_delegation_errors {
552    solomka_sdk::declare_id!("Bj2jmUsM2iRhfdLLDSTkhM5UQRQvQHm57HSmPibPtEyu");
553}
554
555lazy_static! {
556    /// Map of feature identifiers to user-visible description
557    pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
558        (secp256k1_program_enabled::id(), "secp256k1 program"),
559        (deprecate_rewards_sysvar::id(), "deprecate unused rewards sysvar"),
560        (pico_inflation::id(), "pico inflation"),
561        (full_inflation::devnet_and_testnet::id(), "full inflation on devnet and testnet"),
562        (spl_token_v2_multisig_fix::id(), "spl-token multisig fix"),
563        (no_overflow_rent_distribution::id(), "no overflow rent distribution"),
564        (filter_stake_delegation_accounts::id(), "filter stake_delegation_accounts #14062"),
565        (require_custodian_for_locked_stake_authorize::id(), "require custodian to authorize withdrawer change for locked stake"),
566        (spl_token_v2_self_transfer_fix::id(), "spl-token self-transfer fix"),
567        (full_inflation::mainnet::certusone::enable::id(), "full inflation enabled by Certus One"),
568        (full_inflation::mainnet::certusone::vote::id(), "community vote allowing Certus One to enable full inflation"),
569        (warp_timestamp_again::id(), "warp timestamp again, adjust bounding to 25% fast 80% slow #15204"),
570        (check_init_vote_data::id(), "check initialized Vote data"),
571        (secp256k1_recover_syscall_enabled::id(), "secp256k1_recover syscall"),
572        (system_transfer_zero_check::id(), "perform all checks for transfers of 0 lamports"),
573        (blake3_syscall_enabled::id(), "blake3 syscall"),
574        (dedupe_config_program_signers::id(), "dedupe config program signers"),
575        (verify_tx_signatures_len::id(), "prohibit extra transaction signatures"),
576        (vote_stake_checked_instructions::id(), "vote/state program checked instructions #18345"),
577        (rent_for_sysvars::id(), "collect rent from accounts owned by sysvars"),
578        (libsecp256k1_0_5_upgrade_enabled::id(), "upgrade libsecp256k1 to v0.5.0"),
579        (tx_wide_compute_cap::id(), "transaction wide compute cap"),
580        (spl_token_v2_set_authority_fix::id(), "spl-token set_authority fix"),
581        (merge_nonce_error_into_system_error::id(), "merge NonceError into SystemError"),
582        (disable_fees_sysvar::id(), "disable fees sysvar"),
583        (stake_merge_with_unmatched_credits_observed::id(), "allow merging active stakes with unmatched credits_observed #18985"),
584        (zk_token_sdk_enabled::id(), "enable Zk Token proof program and syscalls"),
585        (curve25519_syscall_enabled::id(), "enable curve25519 syscalls"),
586        (versioned_tx_message_enabled::id(), "enable versioned transaction message processing"),
587        (libsecp256k1_fail_on_bad_count::id(), "fail libsec256k1_verify if count appears wrong"),
588        (libsecp256k1_fail_on_bad_count2::id(), "fail libsec256k1_verify if count appears wrong"),
589        (instructions_sysvar_owned_by_sysvar::id(), "fix owner for instructions sysvar"),
590        (stake_program_advance_activating_credits_observed::id(), "Enable advancing credits observed for activation epoch #19309"),
591        (credits_auto_rewind::id(), "Auto rewind stake's credits_observed if (accidental) vote recreation is detected #22546"),
592        (demote_program_write_locks::id(), "demote program write locks to readonly, except when upgradeable loader present #19593 #20265"),
593        (ed25519_program_enabled::id(), "enable builtin ed25519 signature verify program"),
594        (return_data_syscall_enabled::id(), "enable sol_{set,get}_return_data syscall"),
595        (reduce_required_deploy_balance::id(), "reduce required payer balance for program deploys"),
596        (sol_log_data_syscall_enabled::id(), "enable sol_log_data syscall"),
597        (stakes_remove_delegation_if_inactive::id(), "remove delegations from stakes cache when inactive"),
598        (do_support_realloc::id(), "support account data reallocation"),
599        (prevent_calling_precompiles_as_programs::id(), "prevent calling precompiles as programs"),
600        (optimize_epoch_boundary_updates::id(), "optimize epoch boundary updates"),
601        (remove_native_loader::id(), "remove support for the native loader"),
602        (send_to_tpu_vote_port::id(), "send votes to the tpu vote port"),
603        (requestable_heap_size::id(), "Requestable heap frame size"),
604        (disable_fee_calculator::id(), "deprecate fee calculator"),
605        (add_compute_budget_program::id(), "Add compute_budget_program"),
606        (nonce_must_be_writable::id(), "nonce must be writable"),
607        (spl_token_v3_3_0_release::id(), "spl-token v3.3.0 release"),
608        (leave_nonce_on_success::id(), "leave nonce as is on success"),
609        (reject_empty_instruction_without_program::id(), "fail instructions which have native_loader as program_id directly"),
610        (fixed_memcpy_nonoverlapping_check::id(), "use correct check for nonoverlapping regions in memcpy syscall"),
611        (reject_non_rent_exempt_vote_withdraws::id(), "fail vote withdraw instructions which leave the account non-rent-exempt"),
612        (evict_invalid_stakes_cache_entries::id(), "evict invalid stakes cache entries on epoch boundaries"),
613        (allow_votes_to_directly_update_vote_state::id(), "enable direct vote state update"),
614        (cap_accounts_data_len::id(), "cap the accounts data len"),
615        (max_tx_account_locks::id(), "enforce max number of locked accounts per transaction"),
616        (require_rent_exempt_accounts::id(), "require all new transaction accounts with data to be rent-exempt"),
617        (filter_votes_outside_slot_hashes::id(), "filter vote slots older than the slot hashes history"),
618        (update_syscall_base_costs::id(), "update syscall base costs"),
619        (stake_deactivate_delinquent_instruction::id(), "enable the deactivate delinquent stake instruction #23932"),
620        (vote_withdraw_authority_may_change_authorized_voter::id(), "vote account withdraw authority may change the authorized voter #22521"),
621        (spl_associated_token_account_v1_0_4::id(), "SPL Associated Token Account Program release version 1.0.4, tied to token 3.3.0 #22648"),
622        (reject_vote_account_close_unless_zero_credit_epoch::id(), "fail vote account withdraw to 0 unless account earned 0 credits in last completed epoch"),
623        (add_get_processed_sibling_instruction_syscall::id(), "add add_get_processed_sibling_instruction_syscall"),
624        (bank_tranaction_count_fix::id(), "fixes Bank::transaction_count to include all committed transactions, not just successful ones"),
625        (disable_bpf_deprecated_load_instructions::id(), "disable ldabs* and ldind* BPF instructions"),
626        (disable_bpf_unresolved_symbols_at_runtime::id(), "disable reporting of unresolved BPF symbols at runtime"),
627        (record_instruction_in_transaction_context_push::id(), "move the CPI stack overflow check to the end of push"),
628        (syscall_saturated_math::id(), "syscalls use saturated math"),
629        (check_physical_overlapping::id(), "check physical overlapping regions"),
630        (limit_secp256k1_recovery_id::id(), "limit secp256k1 recovery id"),
631        (disable_deprecated_loader::id(), "disable the deprecated BPF loader"),
632        (check_slice_translation_size::id(), "check size when translating slices"),
633        (stake_split_uses_rent_sysvar::id(), "stake split instruction uses rent sysvar"),
634        (add_get_minimum_delegation_instruction_to_stake_program::id(), "add GetMinimumDelegation instruction to stake program"),
635        (error_on_syscall_bpf_function_hash_collisions::id(), "error on bpf function hash collisions"),
636        (reject_callx_r10::id(), "Reject bpf callx r10 instructions"),
637        (drop_redundant_turbine_path::id(), "drop redundant turbine path"),
638        (executables_incur_cpi_data_cost::id(), "Executables incur CPI data costs"),
639        (fix_recent_blockhashes::id(), "stop adding hashes for skipped slots to recent blockhashes"),
640        (update_rewards_from_cached_accounts::id(), "update rewards from cached accounts"),
641        (spl_token_v3_4_0::id(), "SPL Token Program version 3.4.0 release #24740"),
642        (spl_associated_token_account_v1_1_0::id(), "SPL Associated Token Account Program version 1.1.0 release #24741"),
643        (default_units_per_instruction::id(), "Default max tx-wide compute units calculated per instruction"),
644        (stake_allow_zero_undelegated_amount::id(), "Allow zero-lamport undelegated amount for initialized stakes #24670"),
645        (require_static_program_ids_in_transaction::id(), "require static program ids in versioned transactions"),
646        (stake_raise_minimum_delegation_to_1_sol::id(), "Raise minimum stake delegation to 1.0 SOL #24357"),
647        (stake_minimum_delegation_for_rewards::id(), "stakes must be at least the minimum delegation to earn rewards"),
648        (add_set_compute_unit_price_ix::id(), "add compute budget ix for setting a compute unit price"),
649        (disable_deploy_of_alloc_free_syscall::id(), "disable new deployments of deprecated sol_alloc_free_ syscall"),
650        (include_account_index_in_rent_error::id(), "include account index in rent tx error #25190"),
651        (add_shred_type_to_shred_seed::id(), "add shred-type to shred seed #25556"),
652        (warp_timestamp_with_a_vengeance::id(), "warp timestamp again, adjust bounding to 150% slow #25666"),
653        (separate_nonce_from_blockhash::id(), "separate durable nonce and blockhash domains #25744"),
654        (enable_durable_nonce::id(), "enable durable nonce #25744"),
655        (vote_state_update_credit_per_dequeue::id(), "Calculate vote credits for VoteStateUpdate per vote dequeue to match credit awards for Vote instruction"),
656        (quick_bail_on_panic::id(), "quick bail on panic"),
657        (nonce_must_be_authorized::id(), "nonce must be authorized"),
658        (nonce_must_be_advanceable::id(), "durable nonces must be advanceable"),
659        (vote_authorize_with_seed::id(), "An instruction you can use to change a vote accounts authority when the current authority is a derived key #25860"),
660        (cap_accounts_data_size_per_block::id(), "cap the accounts data size per block #25517"),
661        (stake_redelegate_instruction::id(), "enable the redelegate stake instruction #26294"),
662        (preserve_rent_epoch_for_rent_exempt_accounts::id(), "preserve rent epoch for rent exempt accounts #26479"),
663        (enable_bpf_loader_extend_program_ix::id(), "enable bpf upgradeable loader ExtendProgram instruction #25234"),
664        (enable_early_verification_of_account_modifications::id(), "enable early verification of account modifications #25899"),
665        (disable_rehash_for_rent_epoch::id(), "on accounts hash calculation, do not try to rehash accounts #28934"),
666        (on_load_preserve_rent_epoch_for_rent_exempt_accounts::id(), "on bank load account, do not try to fix up rent_epoch #28541"),
667        (prevent_crediting_accounts_that_end_rent_paying::id(), "prevent crediting rent paying accounts #26606"),
668        (cap_bpf_program_instruction_accounts::id(), "enforce max number of accounts per bpf program instruction #26628"),
669        (loosen_cpi_size_restriction::id(), "loosen cpi size restrictions #26641"),
670        (use_default_units_in_fee_calculation::id(), "use default units per instruction in fee calculation #26785"),
671        (compact_vote_state_updates::id(), "Compact vote state updates to lower block size"),
672        (concurrent_replay_of_forks::id(), "Allow slots from different forks to be replayed concurrently #26465"),
673        (incremental_snapshot_only_incremental_hash_calculation::id(), "only hash accounts in incremental snapshot during incremental snapshot creation #26799"),
674        (vote_state_update_root_fix::id(), "fix root in vote state updates #27361"),
675        (return_none_for_zero_lamport_accounts::id(), "return none for zero lamport accounts #27800"),
676        (increase_tx_account_lock_limit::id(), "increase tx account lock limit to 128 #27241"),
677        (check_syscall_outputs_do_not_overlap::id(), "check syscall outputs do_not overlap #28600"),
678        (commission_updates_only_allowed_in_first_half_of_epoch::id(), "validator commission updates are only allowed in the first half of an epoch #29362"),
679        (enable_turbine_fanout_experiments::id(), "enable turbine fanout experiments #29393"),
680        (disable_turbine_fanout_experiments::id(), "disable turbine fanout experiments #29393"),
681        (drop_merkle_shreds::id(), "drop merkle shreds #29711"),
682        (keep_merkle_shreds::id(), "keep merkle shreds #29711"),
683        (move_serialized_len_ptr_in_cpi::id(), "cpi ignore serialized_len_ptr #29592"),
684        (disable_builtin_loader_ownership_chains::id(), "disable builtin loader ownership chains #29956"),
685        (enable_request_heap_frame_ix::id(), "Enable transaction to request heap frame using compute budget instruction #30076"),
686        (clean_up_delegation_errors::id(), "Return InsufficientDelegation instead of InsufficientFunds or InsufficientStake where applicable #31206"),
687        /*************** ADD NEW FEATURES HERE ***************/
688    ]
689    .iter()
690    .cloned()
691    .collect();
692
693    /// Unique identifier of the current software's feature set
694    pub static ref ID: Hash = {
695        let mut hasher = Hasher::default();
696        let mut feature_ids = FEATURE_NAMES.keys().collect::<Vec<_>>();
697        feature_ids.sort();
698        for feature in feature_ids {
699            hasher.hash(feature.as_ref());
700        }
701        hasher.result()
702    };
703}
704
705#[derive(Clone, PartialEq, Eq, Hash)]
706pub struct FullInflationFeaturePair {
707    pub vote_id: Pubkey, // Feature that grants the candidate the ability to enable full inflation
708    pub enable_id: Pubkey, // Feature to enable full inflation by the candidate
709}
710
711lazy_static! {
712    /// Set of feature pairs that once enabled will trigger full inflation
713    pub static ref FULL_INFLATION_FEATURE_PAIRS: HashSet<FullInflationFeaturePair> = [
714        FullInflationFeaturePair {
715            vote_id: full_inflation::mainnet::certusone::vote::id(),
716            enable_id: full_inflation::mainnet::certusone::enable::id(),
717        },
718    ]
719    .iter()
720    .cloned()
721    .collect();
722}
723
724/// `FeatureSet` holds the set of currently active/inactive runtime features
725#[derive(AbiExample, Debug, Clone)]
726pub struct FeatureSet {
727    pub active: HashMap<Pubkey, Slot>,
728    pub inactive: HashSet<Pubkey>,
729}
730impl Default for FeatureSet {
731    fn default() -> Self {
732        // All features disabled
733        Self {
734            active: HashMap::new(),
735            inactive: FEATURE_NAMES.keys().cloned().collect(),
736        }
737    }
738}
739impl FeatureSet {
740    pub fn is_active(&self, feature_id: &Pubkey) -> bool {
741        self.active.contains_key(feature_id)
742    }
743
744    pub fn activated_slot(&self, feature_id: &Pubkey) -> Option<Slot> {
745        self.active.get(feature_id).copied()
746    }
747
748    /// List of enabled features that trigger full inflation
749    pub fn full_inflation_features_enabled(&self) -> HashSet<Pubkey> {
750        let mut hash_set = FULL_INFLATION_FEATURE_PAIRS
751            .iter()
752            .filter_map(|pair| {
753                if self.is_active(&pair.vote_id) && self.is_active(&pair.enable_id) {
754                    Some(pair.enable_id)
755                } else {
756                    None
757                }
758            })
759            .collect::<HashSet<_>>();
760
761        if self.is_active(&full_inflation::devnet_and_testnet::id()) {
762            hash_set.insert(full_inflation::devnet_and_testnet::id());
763        }
764        hash_set
765    }
766
767    /// All features enabled, useful for testing
768    pub fn all_enabled() -> Self {
769        Self {
770            active: FEATURE_NAMES.keys().cloned().map(|key| (key, 0)).collect(),
771            inactive: HashSet::new(),
772        }
773    }
774
775    /// Activate a feature
776    pub fn activate(&mut self, feature_id: &Pubkey, slot: u64) {
777        self.inactive.remove(feature_id);
778        self.active.insert(*feature_id, slot);
779    }
780
781    /// Deactivate a feature
782    pub fn deactivate(&mut self, feature_id: &Pubkey) {
783        self.active.remove(feature_id);
784        self.inactive.insert(*feature_id);
785    }
786}
787
788#[cfg(test)]
789mod test {
790    use super::*;
791
792    #[test]
793    fn test_full_inflation_features_enabled_devnet_and_testnet() {
794        let mut feature_set = FeatureSet::default();
795        assert!(feature_set.full_inflation_features_enabled().is_empty());
796        feature_set
797            .active
798            .insert(full_inflation::devnet_and_testnet::id(), 42);
799        assert_eq!(
800            feature_set.full_inflation_features_enabled(),
801            [full_inflation::devnet_and_testnet::id()]
802                .iter()
803                .cloned()
804                .collect()
805        );
806    }
807
808    #[test]
809    fn test_full_inflation_features_enabled() {
810        // Normal sequence: vote_id then enable_id
811        let mut feature_set = FeatureSet::default();
812        assert!(feature_set.full_inflation_features_enabled().is_empty());
813        feature_set
814            .active
815            .insert(full_inflation::mainnet::certusone::vote::id(), 42);
816        assert!(feature_set.full_inflation_features_enabled().is_empty());
817        feature_set
818            .active
819            .insert(full_inflation::mainnet::certusone::enable::id(), 42);
820        assert_eq!(
821            feature_set.full_inflation_features_enabled(),
822            [full_inflation::mainnet::certusone::enable::id()]
823                .iter()
824                .cloned()
825                .collect()
826        );
827
828        // Backwards sequence: enable_id and then vote_id
829        let mut feature_set = FeatureSet::default();
830        assert!(feature_set.full_inflation_features_enabled().is_empty());
831        feature_set
832            .active
833            .insert(full_inflation::mainnet::certusone::enable::id(), 42);
834        assert!(feature_set.full_inflation_features_enabled().is_empty());
835        feature_set
836            .active
837            .insert(full_inflation::mainnet::certusone::vote::id(), 42);
838        assert_eq!(
839            feature_set.full_inflation_features_enabled(),
840            [full_inflation::mainnet::certusone::enable::id()]
841                .iter()
842                .cloned()
843                .collect()
844        );
845    }
846
847    #[test]
848    fn test_feature_set_activate_deactivate() {
849        let mut feature_set = FeatureSet::default();
850
851        let feature = Pubkey::new_unique();
852        assert!(!feature_set.is_active(&feature));
853        feature_set.activate(&feature, 0);
854        assert!(feature_set.is_active(&feature));
855        feature_set.deactivate(&feature);
856        assert!(!feature_set.is_active(&feature));
857    }
858}