1use std::{
5 cell::RefCell,
6 collections::BTreeSet,
7 sync::atomic::{AtomicBool, Ordering},
8};
9
10use clap::*;
11use fastcrypto::encoding::{Base58, Encoding, Hex};
12use move_binary_format::{
13 binary_config::{BinaryConfig, TableConfig},
14 file_format_common::VERSION_1,
15};
16use move_vm_config::verifier::VerifierConfig;
17use mysten_common::in_integration_test;
18use serde::{Deserialize, Serialize};
19use serde_with::skip_serializing_none;
20use sui_protocol_config_macros::{
21 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
22};
23use tracing::{info, warn};
24
25const MIN_PROTOCOL_VERSION: u64 = 1;
27const MAX_PROTOCOL_VERSION: u64 = 115;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
306pub struct ProtocolVersion(u64);
307
308impl ProtocolVersion {
309 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
314
315 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
316
317 #[cfg(not(msim))]
318 pub const MAX_ALLOWED: Self = Self::MAX;
319
320 #[cfg(msim)]
322 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
323
324 pub fn new(v: u64) -> Self {
325 Self(v)
326 }
327
328 pub const fn as_u64(&self) -> u64 {
329 self.0
330 }
331
332 pub fn max() -> Self {
335 Self::MAX
336 }
337
338 pub fn prev(self) -> Self {
339 Self(self.0.checked_sub(1).unwrap())
340 }
341}
342
343impl From<u64> for ProtocolVersion {
344 fn from(v: u64) -> Self {
345 Self::new(v)
346 }
347}
348
349impl std::ops::Sub<u64> for ProtocolVersion {
350 type Output = Self;
351 fn sub(self, rhs: u64) -> Self::Output {
352 Self::new(self.0 - rhs)
353 }
354}
355
356impl std::ops::Add<u64> for ProtocolVersion {
357 type Output = Self;
358 fn add(self, rhs: u64) -> Self::Output {
359 Self::new(self.0 + rhs)
360 }
361}
362
363#[derive(
364 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
365)]
366pub enum Chain {
367 Mainnet,
368 Testnet,
369 #[default]
370 Unknown,
371}
372
373impl Chain {
374 pub fn as_str(self) -> &'static str {
375 match self {
376 Chain::Mainnet => "mainnet",
377 Chain::Testnet => "testnet",
378 Chain::Unknown => "unknown",
379 }
380 }
381}
382
383pub struct Error(pub String);
384
385#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
388struct FeatureFlags {
389 #[serde(skip_serializing_if = "is_false")]
392 package_upgrades: bool,
393 #[serde(skip_serializing_if = "is_false")]
396 commit_root_state_digest: bool,
397 #[serde(skip_serializing_if = "is_false")]
399 advance_epoch_start_time_in_safe_mode: bool,
400 #[serde(skip_serializing_if = "is_false")]
403 loaded_child_objects_fixed: bool,
404 #[serde(skip_serializing_if = "is_false")]
407 missing_type_is_compatibility_error: bool,
408 #[serde(skip_serializing_if = "is_false")]
411 scoring_decision_with_validity_cutoff: bool,
412
413 #[serde(skip_serializing_if = "is_false")]
416 consensus_order_end_of_epoch_last: bool,
417
418 #[serde(skip_serializing_if = "is_false")]
420 disallow_adding_abilities_on_upgrade: bool,
421 #[serde(skip_serializing_if = "is_false")]
423 disable_invariant_violation_check_in_swap_loc: bool,
424 #[serde(skip_serializing_if = "is_false")]
427 advance_to_highest_supported_protocol_version: bool,
428 #[serde(skip_serializing_if = "is_false")]
430 ban_entry_init: bool,
431 #[serde(skip_serializing_if = "is_false")]
433 package_digest_hash_module: bool,
434 #[serde(skip_serializing_if = "is_false")]
436 disallow_change_struct_type_params_on_upgrade: bool,
437 #[serde(skip_serializing_if = "is_false")]
439 no_extraneous_module_bytes: bool,
440 #[serde(skip_serializing_if = "is_false")]
442 narwhal_versioned_metadata: bool,
443
444 #[serde(skip_serializing_if = "is_false")]
446 zklogin_auth: bool,
447 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
449 consensus_transaction_ordering: ConsensusTransactionOrdering,
450
451 #[serde(skip_serializing_if = "is_false")]
459 simplified_unwrap_then_delete: bool,
460 #[serde(skip_serializing_if = "is_false")]
462 upgraded_multisig_supported: bool,
463 #[serde(skip_serializing_if = "is_false")]
465 txn_base_cost_as_multiplier: bool,
466
467 #[serde(skip_serializing_if = "is_false")]
469 shared_object_deletion: bool,
470
471 #[serde(skip_serializing_if = "is_false")]
473 narwhal_new_leader_election_schedule: bool,
474
475 #[serde(skip_serializing_if = "is_empty")]
477 zklogin_supported_providers: BTreeSet<String>,
478
479 #[serde(skip_serializing_if = "is_false")]
481 loaded_child_object_format: bool,
482
483 #[serde(skip_serializing_if = "is_false")]
484 enable_jwk_consensus_updates: bool,
485
486 #[serde(skip_serializing_if = "is_false")]
487 end_of_epoch_transaction_supported: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
492 simple_conservation_checks: bool,
493
494 #[serde(skip_serializing_if = "is_false")]
496 loaded_child_object_format_type: bool,
497
498 #[serde(skip_serializing_if = "is_false")]
500 receive_objects: bool,
501
502 #[serde(skip_serializing_if = "is_false")]
504 consensus_checkpoint_signature_key_includes_digest: bool,
505
506 #[serde(skip_serializing_if = "is_false")]
508 random_beacon: bool,
509
510 #[serde(skip_serializing_if = "is_false")]
512 bridge: bool,
513
514 #[serde(skip_serializing_if = "is_false")]
515 enable_effects_v2: bool,
516
517 #[serde(skip_serializing_if = "is_false")]
519 narwhal_certificate_v2: bool,
520
521 #[serde(skip_serializing_if = "is_false")]
523 verify_legacy_zklogin_address: bool,
524
525 #[serde(skip_serializing_if = "is_false")]
527 throughput_aware_consensus_submission: bool,
528
529 #[serde(skip_serializing_if = "is_false")]
531 recompute_has_public_transfer_in_execution: bool,
532
533 #[serde(skip_serializing_if = "is_false")]
535 accept_zklogin_in_multisig: bool,
536
537 #[serde(skip_serializing_if = "is_false")]
539 accept_passkey_in_multisig: bool,
540
541 #[serde(skip_serializing_if = "is_false")]
543 validate_zklogin_public_identifier: bool,
544
545 #[serde(skip_serializing_if = "is_false")]
548 include_consensus_digest_in_prologue: bool,
549
550 #[serde(skip_serializing_if = "is_false")]
552 hardened_otw_check: bool,
553
554 #[serde(skip_serializing_if = "is_false")]
556 allow_receiving_object_id: bool,
557
558 #[serde(skip_serializing_if = "is_false")]
560 enable_poseidon: bool,
561
562 #[serde(skip_serializing_if = "is_false")]
564 enable_coin_deny_list: bool,
565
566 #[serde(skip_serializing_if = "is_false")]
568 enable_group_ops_native_functions: bool,
569
570 #[serde(skip_serializing_if = "is_false")]
572 enable_group_ops_native_function_msm: bool,
573
574 #[serde(skip_serializing_if = "is_false")]
576 enable_ristretto255_group_ops: bool,
577
578 #[serde(skip_serializing_if = "is_false")]
580 enable_nitro_attestation: bool,
581
582 #[serde(skip_serializing_if = "is_false")]
584 enable_nitro_attestation_upgraded_parsing: bool,
585
586 #[serde(skip_serializing_if = "is_false")]
588 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
589
590 #[serde(skip_serializing_if = "is_false")]
592 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
593
594 #[serde(skip_serializing_if = "is_false")]
596 reject_mutable_random_on_entry_functions: bool,
597
598 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
600 per_object_congestion_control_mode: PerObjectCongestionControlMode,
601
602 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
604 consensus_choice: ConsensusChoice,
605
606 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
608 consensus_network: ConsensusNetwork,
609
610 #[serde(skip_serializing_if = "is_false")]
612 correct_gas_payment_limit_check: bool,
613
614 #[serde(skip_serializing_if = "Option::is_none")]
616 zklogin_max_epoch_upper_bound_delta: Option<u64>,
617
618 #[serde(skip_serializing_if = "is_false")]
620 mysticeti_leader_scoring_and_schedule: bool,
621
622 #[serde(skip_serializing_if = "is_false")]
624 reshare_at_same_initial_version: bool,
625
626 #[serde(skip_serializing_if = "is_false")]
628 resolve_abort_locations_to_package_id: bool,
629
630 #[serde(skip_serializing_if = "is_false")]
634 mysticeti_use_committed_subdag_digest: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
638 enable_vdf: bool,
639
640 #[serde(skip_serializing_if = "is_false")]
645 record_consensus_determined_version_assignments_in_prologue: bool,
646 #[serde(skip_serializing_if = "is_false")]
647 record_consensus_determined_version_assignments_in_prologue_v2: bool,
648
649 #[serde(skip_serializing_if = "is_false")]
651 fresh_vm_on_framework_upgrade: bool,
652
653 #[serde(skip_serializing_if = "is_false")]
661 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
662
663 #[serde(skip_serializing_if = "Option::is_none")]
665 mysticeti_num_leaders_per_round: Option<usize>,
666
667 #[serde(skip_serializing_if = "is_false")]
669 soft_bundle: bool,
670
671 #[serde(skip_serializing_if = "is_false")]
673 enable_coin_deny_list_v2: bool,
674
675 #[serde(skip_serializing_if = "is_false")]
677 passkey_auth: bool,
678
679 #[serde(skip_serializing_if = "is_false")]
681 authority_capabilities_v2: bool,
682
683 #[serde(skip_serializing_if = "is_false")]
685 rethrow_serialization_type_layout_errors: bool,
686
687 #[serde(skip_serializing_if = "is_false")]
689 consensus_distributed_vote_scoring_strategy: bool,
690
691 #[serde(skip_serializing_if = "is_false")]
693 consensus_round_prober: bool,
694
695 #[serde(skip_serializing_if = "is_false")]
697 validate_identifier_inputs: bool,
698
699 #[serde(skip_serializing_if = "is_false")]
701 disallow_self_identifier: bool,
702
703 #[serde(skip_serializing_if = "is_false")]
705 mysticeti_fastpath: bool,
706
707 #[serde(skip_serializing_if = "is_false")]
711 disable_preconsensus_locking: bool,
712
713 #[serde(skip_serializing_if = "is_false")]
715 relocate_event_module: bool,
716
717 #[serde(skip_serializing_if = "is_false")]
719 uncompressed_g1_group_elements: bool,
720
721 #[serde(skip_serializing_if = "is_false")]
722 disallow_new_modules_in_deps_only_packages: bool,
723
724 #[serde(skip_serializing_if = "is_false")]
726 consensus_smart_ancestor_selection: bool,
727
728 #[serde(skip_serializing_if = "is_false")]
730 consensus_round_prober_probe_accepted_rounds: bool,
731
732 #[serde(skip_serializing_if = "is_false")]
734 native_charging_v2: bool,
735
736 #[serde(skip_serializing_if = "is_false")]
739 consensus_linearize_subdag_v2: bool,
740
741 #[serde(skip_serializing_if = "is_false")]
743 convert_type_argument_error: bool,
744
745 #[serde(skip_serializing_if = "is_false")]
747 variant_nodes: bool,
748
749 #[serde(skip_serializing_if = "is_false")]
751 consensus_zstd_compression: bool,
752
753 #[serde(skip_serializing_if = "is_false")]
755 minimize_child_object_mutations: bool,
756
757 #[serde(skip_serializing_if = "is_false")]
759 record_additional_state_digest_in_prologue: bool,
760
761 #[serde(skip_serializing_if = "is_false")]
763 move_native_context: bool,
764
765 #[serde(skip_serializing_if = "is_false")]
768 consensus_median_based_commit_timestamp: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
773 normalize_ptb_arguments: bool,
774
775 #[serde(skip_serializing_if = "is_false")]
777 consensus_batched_block_sync: bool,
778
779 #[serde(skip_serializing_if = "is_false")]
781 enforce_checkpoint_timestamp_monotonicity: bool,
782
783 #[serde(skip_serializing_if = "is_false")]
785 max_ptb_value_size_v2: bool,
786
787 #[serde(skip_serializing_if = "is_false")]
789 resolve_type_input_ids_to_defining_id: bool,
790
791 #[serde(skip_serializing_if = "is_false")]
793 enable_party_transfer: bool,
794
795 #[serde(skip_serializing_if = "is_false")]
797 allow_unbounded_system_objects: bool,
798
799 #[serde(skip_serializing_if = "is_false")]
801 type_tags_in_object_runtime: bool,
802
803 #[serde(skip_serializing_if = "is_false")]
805 enable_accumulators: bool,
806
807 #[serde(skip_serializing_if = "is_false")]
809 enable_coin_reservation_obj_refs: bool,
810
811 #[serde(skip_serializing_if = "is_false")]
814 create_root_accumulator_object: bool,
815
816 #[serde(skip_serializing_if = "is_false")]
818 enable_authenticated_event_streams: bool,
819
820 #[serde(skip_serializing_if = "is_false")]
822 enable_address_balance_gas_payments: bool,
823
824 #[serde(skip_serializing_if = "is_false")]
826 address_balance_gas_check_rgp_at_signing: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
829 address_balance_gas_reject_gas_coin_arg: bool,
830
831 #[serde(skip_serializing_if = "is_false")]
833 enable_multi_epoch_transaction_expiration: bool,
834
835 #[serde(skip_serializing_if = "is_false")]
837 enable_ptb_execution_v2: bool,
838
839 #[serde(skip_serializing_if = "is_false")]
841 better_adapter_type_resolution_errors: bool,
842
843 #[serde(skip_serializing_if = "is_false")]
845 record_time_estimate_processed: bool,
846
847 #[serde(skip_serializing_if = "is_false")]
849 dependency_linkage_error: bool,
850
851 #[serde(skip_serializing_if = "is_false")]
853 additional_multisig_checks: bool,
854
855 #[serde(skip_serializing_if = "is_false")]
857 ignore_execution_time_observations_after_certs_closed: bool,
858
859 #[serde(skip_serializing_if = "is_false")]
863 debug_fatal_on_move_invariant_violation: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
868 allow_private_accumulator_entrypoints: bool,
869
870 #[serde(skip_serializing_if = "is_false")]
872 additional_consensus_digest_indirect_state: bool,
873
874 #[serde(skip_serializing_if = "is_false")]
876 check_for_init_during_upgrade: bool,
877
878 #[serde(skip_serializing_if = "is_false")]
880 per_command_shared_object_transfer_rules: bool,
881
882 #[serde(skip_serializing_if = "is_false")]
884 include_checkpoint_artifacts_digest_in_summary: bool,
885
886 #[serde(skip_serializing_if = "is_false")]
888 use_mfp_txns_in_load_initial_object_debts: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 cancel_for_failed_dkg_early: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
896 enable_coin_registry: bool,
897
898 #[serde(skip_serializing_if = "is_false")]
900 abstract_size_in_object_runtime: bool,
901
902 #[serde(skip_serializing_if = "is_false")]
904 object_runtime_charge_cache_load_gas: bool,
905
906 #[serde(skip_serializing_if = "is_false")]
908 additional_borrow_checks: bool,
909
910 #[serde(skip_serializing_if = "is_false")]
912 use_new_commit_handler: bool,
913
914 #[serde(skip_serializing_if = "is_false")]
916 better_loader_errors: bool,
917
918 #[serde(skip_serializing_if = "is_false")]
920 generate_df_type_layouts: bool,
921
922 #[serde(skip_serializing_if = "is_false")]
924 allow_references_in_ptbs: bool,
925
926 #[serde(skip_serializing_if = "is_false")]
928 enable_display_registry: bool,
929
930 #[serde(skip_serializing_if = "is_false")]
932 private_generics_verifier_v2: bool,
933
934 #[serde(skip_serializing_if = "is_false")]
936 deprecate_global_storage_ops_during_deserialization: bool,
937
938 #[serde(skip_serializing_if = "is_false")]
941 enable_non_exclusive_writes: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 deprecate_global_storage_ops: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 consensus_skip_gced_accept_votes: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 include_cancelled_randomness_txns_in_prologue: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 address_aliases: bool,
958
959 #[serde(skip_serializing_if = "is_false")]
962 fix_checkpoint_signature_mapping: bool,
963
964 #[serde(skip_serializing_if = "is_false")]
966 enable_object_funds_withdraw: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
970 consensus_skip_gced_blocks_in_direct_finalization: bool,
971
972 #[serde(skip_serializing_if = "is_false")]
974 gas_rounding_halve_digits: bool,
975
976 #[serde(skip_serializing_if = "is_false")]
978 flexible_tx_context_positions: bool,
979
980 #[serde(skip_serializing_if = "is_false")]
982 disable_entry_point_signature_check: bool,
983
984 #[serde(skip_serializing_if = "is_false")]
986 convert_withdrawal_compatibility_ptb_arguments: bool,
987
988 #[serde(skip_serializing_if = "is_false")]
990 restrict_hot_or_not_entry_functions: bool,
991
992 #[serde(skip_serializing_if = "is_false")]
994 split_checkpoints_in_consensus_handler: bool,
995
996 #[serde(skip_serializing_if = "is_false")]
998 consensus_always_accept_system_transactions: bool,
999
1000 #[serde(skip_serializing_if = "is_false")]
1002 validator_metadata_verify_v2: bool,
1003
1004 #[serde(skip_serializing_if = "is_false")]
1007 defer_unpaid_amplification: bool,
1008
1009 #[serde(skip_serializing_if = "is_false")]
1010 randomize_checkpoint_tx_limit_in_tests: bool,
1011
1012 #[serde(skip_serializing_if = "is_false")]
1014 gasless_transaction_drop_safety: bool,
1015}
1016
1017fn is_false(b: &bool) -> bool {
1018 !b
1019}
1020
1021fn is_empty(b: &BTreeSet<String>) -> bool {
1022 b.is_empty()
1023}
1024
1025fn is_zero(val: &u64) -> bool {
1026 *val == 0
1027}
1028
1029#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1031pub enum ConsensusTransactionOrdering {
1032 #[default]
1034 None,
1035 ByGasPrice,
1037}
1038
1039impl ConsensusTransactionOrdering {
1040 pub fn is_none(&self) -> bool {
1041 matches!(self, ConsensusTransactionOrdering::None)
1042 }
1043}
1044
1045#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1046pub struct ExecutionTimeEstimateParams {
1047 pub target_utilization: u64,
1049 pub allowed_txn_cost_overage_burst_limit_us: u64,
1053
1054 pub randomness_scalar: u64,
1057
1058 pub max_estimate_us: u64,
1060
1061 pub stored_observations_num_included_checkpoints: u64,
1064
1065 pub stored_observations_limit: u64,
1067
1068 #[serde(skip_serializing_if = "is_zero")]
1071 pub stake_weighted_median_threshold: u64,
1072
1073 #[serde(skip_serializing_if = "is_false")]
1077 pub default_none_duration_for_new_keys: bool,
1078
1079 #[serde(skip_serializing_if = "Option::is_none")]
1081 pub observations_chunk_size: Option<u64>,
1082}
1083
1084#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1086pub enum PerObjectCongestionControlMode {
1087 #[default]
1088 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1094
1095impl PerObjectCongestionControlMode {
1096 pub fn is_none(&self) -> bool {
1097 matches!(self, PerObjectCongestionControlMode::None)
1098 }
1099}
1100
1101#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1103pub enum ConsensusChoice {
1104 #[default]
1105 Narwhal,
1106 SwapEachEpoch,
1107 Mysticeti,
1108}
1109
1110impl ConsensusChoice {
1111 pub fn is_narwhal(&self) -> bool {
1112 matches!(self, ConsensusChoice::Narwhal)
1113 }
1114}
1115
1116#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1118pub enum ConsensusNetwork {
1119 #[default]
1120 Anemo,
1121 Tonic,
1122}
1123
1124impl ConsensusNetwork {
1125 pub fn is_anemo(&self) -> bool {
1126 matches!(self, ConsensusNetwork::Anemo)
1127 }
1128}
1129
1130#[skip_serializing_none]
1162#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1163pub struct ProtocolConfig {
1164 pub version: ProtocolVersion,
1165
1166 feature_flags: FeatureFlags,
1167
1168 max_tx_size_bytes: Option<u64>,
1171
1172 max_input_objects: Option<u64>,
1174
1175 max_size_written_objects: Option<u64>,
1179 max_size_written_objects_system_tx: Option<u64>,
1182
1183 max_serialized_tx_effects_size_bytes: Option<u64>,
1185
1186 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1188
1189 max_gas_payment_objects: Option<u32>,
1191
1192 max_modules_in_publish: Option<u32>,
1194
1195 max_package_dependencies: Option<u32>,
1197
1198 max_arguments: Option<u32>,
1201
1202 max_type_arguments: Option<u32>,
1204
1205 max_type_argument_depth: Option<u32>,
1207
1208 max_pure_argument_size: Option<u32>,
1210
1211 max_programmable_tx_commands: Option<u32>,
1213
1214 move_binary_format_version: Option<u32>,
1217 min_move_binary_format_version: Option<u32>,
1218
1219 binary_module_handles: Option<u16>,
1221 binary_struct_handles: Option<u16>,
1222 binary_function_handles: Option<u16>,
1223 binary_function_instantiations: Option<u16>,
1224 binary_signatures: Option<u16>,
1225 binary_constant_pool: Option<u16>,
1226 binary_identifiers: Option<u16>,
1227 binary_address_identifiers: Option<u16>,
1228 binary_struct_defs: Option<u16>,
1229 binary_struct_def_instantiations: Option<u16>,
1230 binary_function_defs: Option<u16>,
1231 binary_field_handles: Option<u16>,
1232 binary_field_instantiations: Option<u16>,
1233 binary_friend_decls: Option<u16>,
1234 binary_enum_defs: Option<u16>,
1235 binary_enum_def_instantiations: Option<u16>,
1236 binary_variant_handles: Option<u16>,
1237 binary_variant_instantiation_handles: Option<u16>,
1238
1239 max_move_object_size: Option<u64>,
1241
1242 max_move_package_size: Option<u64>,
1245
1246 max_publish_or_upgrade_per_ptb: Option<u64>,
1248
1249 max_tx_gas: Option<u64>,
1251
1252 max_gas_price: Option<u64>,
1254
1255 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1258
1259 max_gas_computation_bucket: Option<u64>,
1261
1262 gas_rounding_step: Option<u64>,
1264
1265 max_loop_depth: Option<u64>,
1267
1268 max_generic_instantiation_length: Option<u64>,
1270
1271 max_function_parameters: Option<u64>,
1273
1274 max_basic_blocks: Option<u64>,
1276
1277 max_value_stack_size: Option<u64>,
1279
1280 max_type_nodes: Option<u64>,
1282
1283 max_push_size: Option<u64>,
1285
1286 max_struct_definitions: Option<u64>,
1288
1289 max_function_definitions: Option<u64>,
1291
1292 max_fields_in_struct: Option<u64>,
1294
1295 max_dependency_depth: Option<u64>,
1297
1298 max_num_event_emit: Option<u64>,
1300
1301 max_num_new_move_object_ids: Option<u64>,
1303
1304 max_num_new_move_object_ids_system_tx: Option<u64>,
1306
1307 max_num_deleted_move_object_ids: Option<u64>,
1309
1310 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1312
1313 max_num_transferred_move_object_ids: Option<u64>,
1315
1316 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1318
1319 max_event_emit_size: Option<u64>,
1321
1322 max_event_emit_size_total: Option<u64>,
1324
1325 max_move_vector_len: Option<u64>,
1327
1328 max_move_identifier_len: Option<u64>,
1330
1331 max_move_value_depth: Option<u64>,
1333
1334 max_move_enum_variants: Option<u64>,
1336
1337 max_back_edges_per_function: Option<u64>,
1339
1340 max_back_edges_per_module: Option<u64>,
1342
1343 max_verifier_meter_ticks_per_function: Option<u64>,
1345
1346 max_meter_ticks_per_module: Option<u64>,
1348
1349 max_meter_ticks_per_package: Option<u64>,
1351
1352 object_runtime_max_num_cached_objects: Option<u64>,
1356
1357 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1359
1360 object_runtime_max_num_store_entries: Option<u64>,
1362
1363 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1365
1366 base_tx_cost_fixed: Option<u64>,
1369
1370 package_publish_cost_fixed: Option<u64>,
1373
1374 base_tx_cost_per_byte: Option<u64>,
1377
1378 package_publish_cost_per_byte: Option<u64>,
1380
1381 obj_access_cost_read_per_byte: Option<u64>,
1383
1384 obj_access_cost_mutate_per_byte: Option<u64>,
1386
1387 obj_access_cost_delete_per_byte: Option<u64>,
1389
1390 obj_access_cost_verify_per_byte: Option<u64>,
1400
1401 max_type_to_layout_nodes: Option<u64>,
1403
1404 max_ptb_value_size: Option<u64>,
1406
1407 gas_model_version: Option<u64>,
1410
1411 obj_data_cost_refundable: Option<u64>,
1414
1415 obj_metadata_cost_non_refundable: Option<u64>,
1419
1420 storage_rebate_rate: Option<u64>,
1426
1427 storage_fund_reinvest_rate: Option<u64>,
1430
1431 reward_slashing_rate: Option<u64>,
1434
1435 storage_gas_price: Option<u64>,
1437
1438 accumulator_object_storage_cost: Option<u64>,
1440
1441 max_transactions_per_checkpoint: Option<u64>,
1446
1447 max_checkpoint_size_bytes: Option<u64>,
1451
1452 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1457
1458 address_from_bytes_cost_base: Option<u64>,
1463 address_to_u256_cost_base: Option<u64>,
1465 address_from_u256_cost_base: Option<u64>,
1467
1468 config_read_setting_impl_cost_base: Option<u64>,
1473 config_read_setting_impl_cost_per_byte: Option<u64>,
1474
1475 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1478 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1479 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1480 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1481 dynamic_field_add_child_object_cost_base: Option<u64>,
1483 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1484 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1485 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1486 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1488 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1489 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1490 dynamic_field_remove_child_object_cost_base: Option<u64>,
1492 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1493 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1494 dynamic_field_has_child_object_cost_base: Option<u64>,
1496 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1498 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1499 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1500
1501 event_emit_cost_base: Option<u64>,
1504 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1505 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1506 event_emit_output_cost_per_byte: Option<u64>,
1507 event_emit_auth_stream_cost: Option<u64>,
1508
1509 object_borrow_uid_cost_base: Option<u64>,
1512 object_delete_impl_cost_base: Option<u64>,
1514 object_record_new_uid_cost_base: Option<u64>,
1516
1517 transfer_transfer_internal_cost_base: Option<u64>,
1520 transfer_party_transfer_internal_cost_base: Option<u64>,
1522 transfer_freeze_object_cost_base: Option<u64>,
1524 transfer_share_object_cost_base: Option<u64>,
1526 transfer_receive_object_cost_base: Option<u64>,
1529
1530 tx_context_derive_id_cost_base: Option<u64>,
1533 tx_context_fresh_id_cost_base: Option<u64>,
1534 tx_context_sender_cost_base: Option<u64>,
1535 tx_context_epoch_cost_base: Option<u64>,
1536 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1537 tx_context_sponsor_cost_base: Option<u64>,
1538 tx_context_rgp_cost_base: Option<u64>,
1539 tx_context_gas_price_cost_base: Option<u64>,
1540 tx_context_gas_budget_cost_base: Option<u64>,
1541 tx_context_ids_created_cost_base: Option<u64>,
1542 tx_context_replace_cost_base: Option<u64>,
1543
1544 types_is_one_time_witness_cost_base: Option<u64>,
1547 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1548 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1549
1550 validator_validate_metadata_cost_base: Option<u64>,
1553 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1554
1555 crypto_invalid_arguments_cost: Option<u64>,
1557 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1559 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1560 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1561
1562 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1564 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1565 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1566
1567 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1569 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1570 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1571 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1572 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1573 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1574
1575 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1577
1578 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1580 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1581 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1582 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1583 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1584 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1585
1586 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1588 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1589 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1590 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1591 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1592 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1593
1594 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1596 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1597 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1598 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1599 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1600 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1601
1602 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1604 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1605 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1606
1607 ed25519_ed25519_verify_cost_base: Option<u64>,
1609 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1610 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1611
1612 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1614 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1615
1616 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1618 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1619 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1620 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1621 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1622
1623 hash_blake2b256_cost_base: Option<u64>,
1625 hash_blake2b256_data_cost_per_byte: Option<u64>,
1626 hash_blake2b256_data_cost_per_block: Option<u64>,
1627
1628 hash_keccak256_cost_base: Option<u64>,
1630 hash_keccak256_data_cost_per_byte: Option<u64>,
1631 hash_keccak256_data_cost_per_block: Option<u64>,
1632
1633 poseidon_bn254_cost_base: Option<u64>,
1635 poseidon_bn254_cost_per_block: Option<u64>,
1636
1637 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1639 group_ops_bls12381_decode_g1_cost: Option<u64>,
1640 group_ops_bls12381_decode_g2_cost: Option<u64>,
1641 group_ops_bls12381_decode_gt_cost: Option<u64>,
1642 group_ops_bls12381_scalar_add_cost: Option<u64>,
1643 group_ops_bls12381_g1_add_cost: Option<u64>,
1644 group_ops_bls12381_g2_add_cost: Option<u64>,
1645 group_ops_bls12381_gt_add_cost: Option<u64>,
1646 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1647 group_ops_bls12381_g1_sub_cost: Option<u64>,
1648 group_ops_bls12381_g2_sub_cost: Option<u64>,
1649 group_ops_bls12381_gt_sub_cost: Option<u64>,
1650 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1651 group_ops_bls12381_g1_mul_cost: Option<u64>,
1652 group_ops_bls12381_g2_mul_cost: Option<u64>,
1653 group_ops_bls12381_gt_mul_cost: Option<u64>,
1654 group_ops_bls12381_scalar_div_cost: Option<u64>,
1655 group_ops_bls12381_g1_div_cost: Option<u64>,
1656 group_ops_bls12381_g2_div_cost: Option<u64>,
1657 group_ops_bls12381_gt_div_cost: Option<u64>,
1658 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1659 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1660 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1661 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1662 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1663 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1664 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1665 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1666 group_ops_bls12381_msm_max_len: Option<u32>,
1667 group_ops_bls12381_pairing_cost: Option<u64>,
1668 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1669 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1670 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1671 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1672 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1673
1674 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1675 group_ops_ristretto_decode_point_cost: Option<u64>,
1676 group_ops_ristretto_scalar_add_cost: Option<u64>,
1677 group_ops_ristretto_point_add_cost: Option<u64>,
1678 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1679 group_ops_ristretto_point_sub_cost: Option<u64>,
1680 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1681 group_ops_ristretto_point_mul_cost: Option<u64>,
1682 group_ops_ristretto_scalar_div_cost: Option<u64>,
1683 group_ops_ristretto_point_div_cost: Option<u64>,
1684
1685 hmac_hmac_sha3_256_cost_base: Option<u64>,
1687 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1688 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1689
1690 check_zklogin_id_cost_base: Option<u64>,
1692 check_zklogin_issuer_cost_base: Option<u64>,
1694
1695 vdf_verify_vdf_cost: Option<u64>,
1696 vdf_hash_to_input_cost: Option<u64>,
1697
1698 nitro_attestation_parse_base_cost: Option<u64>,
1700 nitro_attestation_parse_cost_per_byte: Option<u64>,
1701 nitro_attestation_verify_base_cost: Option<u64>,
1702 nitro_attestation_verify_cost_per_cert: Option<u64>,
1703
1704 bcs_per_byte_serialized_cost: Option<u64>,
1706 bcs_legacy_min_output_size_cost: Option<u64>,
1707 bcs_failure_cost: Option<u64>,
1708
1709 hash_sha2_256_base_cost: Option<u64>,
1710 hash_sha2_256_per_byte_cost: Option<u64>,
1711 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1712 hash_sha3_256_base_cost: Option<u64>,
1713 hash_sha3_256_per_byte_cost: Option<u64>,
1714 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1715 type_name_get_base_cost: Option<u64>,
1716 type_name_get_per_byte_cost: Option<u64>,
1717 type_name_id_base_cost: Option<u64>,
1718
1719 string_check_utf8_base_cost: Option<u64>,
1720 string_check_utf8_per_byte_cost: Option<u64>,
1721 string_is_char_boundary_base_cost: Option<u64>,
1722 string_sub_string_base_cost: Option<u64>,
1723 string_sub_string_per_byte_cost: Option<u64>,
1724 string_index_of_base_cost: Option<u64>,
1725 string_index_of_per_byte_pattern_cost: Option<u64>,
1726 string_index_of_per_byte_searched_cost: Option<u64>,
1727
1728 vector_empty_base_cost: Option<u64>,
1729 vector_length_base_cost: Option<u64>,
1730 vector_push_back_base_cost: Option<u64>,
1731 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1732 vector_borrow_base_cost: Option<u64>,
1733 vector_pop_back_base_cost: Option<u64>,
1734 vector_destroy_empty_base_cost: Option<u64>,
1735 vector_swap_base_cost: Option<u64>,
1736 debug_print_base_cost: Option<u64>,
1737 debug_print_stack_trace_base_cost: Option<u64>,
1738
1739 execution_version: Option<u64>,
1748
1749 consensus_bad_nodes_stake_threshold: Option<u64>,
1753
1754 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1755 max_age_of_jwk_in_epochs: Option<u64>,
1759
1760 random_beacon_reduction_allowed_delta: Option<u16>,
1764
1765 random_beacon_reduction_lower_bound: Option<u32>,
1768
1769 random_beacon_dkg_timeout_round: Option<u32>,
1772
1773 random_beacon_min_round_interval_ms: Option<u64>,
1775
1776 random_beacon_dkg_version: Option<u64>,
1779
1780 consensus_max_transaction_size_bytes: Option<u64>,
1783 consensus_max_transactions_in_block_bytes: Option<u64>,
1785 consensus_max_num_transactions_in_block: Option<u64>,
1787
1788 consensus_voting_rounds: Option<u32>,
1790
1791 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1793
1794 max_deferral_rounds_for_congestion_control: Option<u64>,
1797
1798 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1800
1801 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1803
1804 min_checkpoint_interval_ms: Option<u64>,
1806
1807 checkpoint_summary_version_specific_data: Option<u64>,
1809
1810 max_soft_bundle_size: Option<u64>,
1812
1813 bridge_should_try_to_finalize_committee: Option<bool>,
1817
1818 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1824
1825 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1828
1829 consensus_gc_depth: Option<u32>,
1832
1833 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1835
1836 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1838
1839 sip_45_consensus_amplification_threshold: Option<u64>,
1842
1843 use_object_per_epoch_marker_table_v2: Option<bool>,
1846
1847 consensus_commit_rate_estimation_window_size: Option<u32>,
1849
1850 #[serde(skip_serializing_if = "Vec::is_empty")]
1854 aliased_addresses: Vec<AliasedAddress>,
1855
1856 translation_per_command_base_charge: Option<u64>,
1859
1860 translation_per_input_base_charge: Option<u64>,
1863
1864 translation_pure_input_per_byte_charge: Option<u64>,
1866
1867 translation_per_type_node_charge: Option<u64>,
1871
1872 translation_per_reference_node_charge: Option<u64>,
1875
1876 translation_per_linkage_entry_charge: Option<u64>,
1879
1880 max_updates_per_settlement_txn: Option<u32>,
1882}
1883
1884#[derive(Clone, Serialize, Deserialize, Debug)]
1886pub struct AliasedAddress {
1887 pub original: [u8; 32],
1889 pub aliased: [u8; 32],
1891 pub allowed_tx_digests: Vec<[u8; 32]>,
1893}
1894
1895impl ProtocolConfig {
1897 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1910 if self.feature_flags.package_upgrades {
1911 Ok(())
1912 } else {
1913 Err(Error(format!(
1914 "package upgrades are not supported at {:?}",
1915 self.version
1916 )))
1917 }
1918 }
1919
1920 pub fn allow_receiving_object_id(&self) -> bool {
1921 self.feature_flags.allow_receiving_object_id
1922 }
1923
1924 pub fn receiving_objects_supported(&self) -> bool {
1925 self.feature_flags.receive_objects
1926 }
1927
1928 pub fn package_upgrades_supported(&self) -> bool {
1929 self.feature_flags.package_upgrades
1930 }
1931
1932 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1933 self.feature_flags.commit_root_state_digest
1934 }
1935
1936 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1937 self.feature_flags.advance_epoch_start_time_in_safe_mode
1938 }
1939
1940 pub fn loaded_child_objects_fixed(&self) -> bool {
1941 self.feature_flags.loaded_child_objects_fixed
1942 }
1943
1944 pub fn missing_type_is_compatibility_error(&self) -> bool {
1945 self.feature_flags.missing_type_is_compatibility_error
1946 }
1947
1948 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1949 self.feature_flags.scoring_decision_with_validity_cutoff
1950 }
1951
1952 pub fn narwhal_versioned_metadata(&self) -> bool {
1953 self.feature_flags.narwhal_versioned_metadata
1954 }
1955
1956 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1957 self.feature_flags.consensus_order_end_of_epoch_last
1958 }
1959
1960 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1961 self.feature_flags.disallow_adding_abilities_on_upgrade
1962 }
1963
1964 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1965 self.feature_flags
1966 .disable_invariant_violation_check_in_swap_loc
1967 }
1968
1969 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1970 self.feature_flags
1971 .advance_to_highest_supported_protocol_version
1972 }
1973
1974 pub fn ban_entry_init(&self) -> bool {
1975 self.feature_flags.ban_entry_init
1976 }
1977
1978 pub fn package_digest_hash_module(&self) -> bool {
1979 self.feature_flags.package_digest_hash_module
1980 }
1981
1982 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1983 self.feature_flags
1984 .disallow_change_struct_type_params_on_upgrade
1985 }
1986
1987 pub fn no_extraneous_module_bytes(&self) -> bool {
1988 self.feature_flags.no_extraneous_module_bytes
1989 }
1990
1991 pub fn zklogin_auth(&self) -> bool {
1992 self.feature_flags.zklogin_auth
1993 }
1994
1995 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
1996 &self.feature_flags.zklogin_supported_providers
1997 }
1998
1999 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2000 self.feature_flags.consensus_transaction_ordering
2001 }
2002
2003 pub fn simplified_unwrap_then_delete(&self) -> bool {
2004 self.feature_flags.simplified_unwrap_then_delete
2005 }
2006
2007 pub fn supports_upgraded_multisig(&self) -> bool {
2008 self.feature_flags.upgraded_multisig_supported
2009 }
2010
2011 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2012 self.feature_flags.txn_base_cost_as_multiplier
2013 }
2014
2015 pub fn shared_object_deletion(&self) -> bool {
2016 self.feature_flags.shared_object_deletion
2017 }
2018
2019 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2020 self.feature_flags.narwhal_new_leader_election_schedule
2021 }
2022
2023 pub fn loaded_child_object_format(&self) -> bool {
2024 self.feature_flags.loaded_child_object_format
2025 }
2026
2027 pub fn enable_jwk_consensus_updates(&self) -> bool {
2028 let ret = self.feature_flags.enable_jwk_consensus_updates;
2029 if ret {
2030 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2032 }
2033 ret
2034 }
2035
2036 pub fn simple_conservation_checks(&self) -> bool {
2037 self.feature_flags.simple_conservation_checks
2038 }
2039
2040 pub fn loaded_child_object_format_type(&self) -> bool {
2041 self.feature_flags.loaded_child_object_format_type
2042 }
2043
2044 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2045 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2046 if !ret {
2047 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2049 }
2050 ret
2051 }
2052
2053 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2054 self.feature_flags
2055 .recompute_has_public_transfer_in_execution
2056 }
2057
2058 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2060 self.enable_jwk_consensus_updates()
2061 }
2062
2063 pub fn random_beacon(&self) -> bool {
2064 self.feature_flags.random_beacon
2065 }
2066
2067 pub fn dkg_version(&self) -> u64 {
2068 self.random_beacon_dkg_version.unwrap_or(1)
2070 }
2071
2072 pub fn enable_bridge(&self) -> bool {
2073 let ret = self.feature_flags.bridge;
2074 if ret {
2075 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2077 }
2078 ret
2079 }
2080
2081 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2082 if !self.enable_bridge() {
2083 return false;
2084 }
2085 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2087 }
2088
2089 pub fn enable_effects_v2(&self) -> bool {
2090 self.feature_flags.enable_effects_v2
2091 }
2092
2093 pub fn narwhal_certificate_v2(&self) -> bool {
2094 self.feature_flags.narwhal_certificate_v2
2095 }
2096
2097 pub fn verify_legacy_zklogin_address(&self) -> bool {
2098 self.feature_flags.verify_legacy_zklogin_address
2099 }
2100
2101 pub fn accept_zklogin_in_multisig(&self) -> bool {
2102 self.feature_flags.accept_zklogin_in_multisig
2103 }
2104
2105 pub fn accept_passkey_in_multisig(&self) -> bool {
2106 self.feature_flags.accept_passkey_in_multisig
2107 }
2108
2109 pub fn validate_zklogin_public_identifier(&self) -> bool {
2110 self.feature_flags.validate_zklogin_public_identifier
2111 }
2112
2113 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2114 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2115 }
2116
2117 pub fn throughput_aware_consensus_submission(&self) -> bool {
2118 self.feature_flags.throughput_aware_consensus_submission
2119 }
2120
2121 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2122 self.feature_flags.include_consensus_digest_in_prologue
2123 }
2124
2125 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2126 self.feature_flags
2127 .record_consensus_determined_version_assignments_in_prologue
2128 }
2129
2130 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2131 self.feature_flags
2132 .record_additional_state_digest_in_prologue
2133 }
2134
2135 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2136 self.feature_flags
2137 .record_consensus_determined_version_assignments_in_prologue_v2
2138 }
2139
2140 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2141 self.feature_flags
2142 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2143 }
2144
2145 pub fn hardened_otw_check(&self) -> bool {
2146 self.feature_flags.hardened_otw_check
2147 }
2148
2149 pub fn enable_poseidon(&self) -> bool {
2150 self.feature_flags.enable_poseidon
2151 }
2152
2153 pub fn enable_coin_deny_list_v1(&self) -> bool {
2154 self.feature_flags.enable_coin_deny_list
2155 }
2156
2157 pub fn enable_accumulators(&self) -> bool {
2158 self.feature_flags.enable_accumulators
2159 }
2160
2161 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2162 self.feature_flags.enable_coin_reservation_obj_refs
2163 }
2164
2165 pub fn create_root_accumulator_object(&self) -> bool {
2166 self.feature_flags.create_root_accumulator_object
2167 }
2168
2169 pub fn enable_address_balance_gas_payments(&self) -> bool {
2170 self.feature_flags.enable_address_balance_gas_payments
2171 }
2172
2173 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2174 self.feature_flags.address_balance_gas_check_rgp_at_signing
2175 }
2176
2177 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2178 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2179 }
2180
2181 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2182 self.feature_flags.enable_multi_epoch_transaction_expiration
2183 }
2184
2185 pub fn enable_authenticated_event_streams(&self) -> bool {
2186 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2187 }
2188
2189 pub fn enable_non_exclusive_writes(&self) -> bool {
2190 self.feature_flags.enable_non_exclusive_writes
2191 }
2192
2193 pub fn enable_coin_registry(&self) -> bool {
2194 self.feature_flags.enable_coin_registry
2195 }
2196
2197 pub fn enable_display_registry(&self) -> bool {
2198 self.feature_flags.enable_display_registry
2199 }
2200
2201 pub fn enable_coin_deny_list_v2(&self) -> bool {
2202 self.feature_flags.enable_coin_deny_list_v2
2203 }
2204
2205 pub fn enable_group_ops_native_functions(&self) -> bool {
2206 self.feature_flags.enable_group_ops_native_functions
2207 }
2208
2209 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2210 self.feature_flags.enable_group_ops_native_function_msm
2211 }
2212
2213 pub fn enable_ristretto255_group_ops(&self) -> bool {
2214 self.feature_flags.enable_ristretto255_group_ops
2215 }
2216
2217 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2218 self.feature_flags.reject_mutable_random_on_entry_functions
2219 }
2220
2221 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2222 self.feature_flags.per_object_congestion_control_mode
2223 }
2224
2225 pub fn consensus_choice(&self) -> ConsensusChoice {
2226 self.feature_flags.consensus_choice
2227 }
2228
2229 pub fn consensus_network(&self) -> ConsensusNetwork {
2230 self.feature_flags.consensus_network
2231 }
2232
2233 pub fn correct_gas_payment_limit_check(&self) -> bool {
2234 self.feature_flags.correct_gas_payment_limit_check
2235 }
2236
2237 pub fn reshare_at_same_initial_version(&self) -> bool {
2238 self.feature_flags.reshare_at_same_initial_version
2239 }
2240
2241 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2242 self.feature_flags.resolve_abort_locations_to_package_id
2243 }
2244
2245 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2246 self.feature_flags.mysticeti_use_committed_subdag_digest
2247 }
2248
2249 pub fn enable_vdf(&self) -> bool {
2250 self.feature_flags.enable_vdf
2251 }
2252
2253 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2254 self.feature_flags.fresh_vm_on_framework_upgrade
2255 }
2256
2257 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2258 self.feature_flags.mysticeti_num_leaders_per_round
2259 }
2260
2261 pub fn soft_bundle(&self) -> bool {
2262 self.feature_flags.soft_bundle
2263 }
2264
2265 pub fn passkey_auth(&self) -> bool {
2266 self.feature_flags.passkey_auth
2267 }
2268
2269 pub fn authority_capabilities_v2(&self) -> bool {
2270 self.feature_flags.authority_capabilities_v2
2271 }
2272
2273 pub fn max_transaction_size_bytes(&self) -> u64 {
2274 self.consensus_max_transaction_size_bytes
2276 .unwrap_or(256 * 1024)
2277 }
2278
2279 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2280 if cfg!(msim) {
2281 256 * 1024
2282 } else {
2283 self.consensus_max_transactions_in_block_bytes
2284 .unwrap_or(512 * 1024)
2285 }
2286 }
2287
2288 pub fn max_num_transactions_in_block(&self) -> u64 {
2289 if cfg!(msim) {
2290 8
2291 } else {
2292 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2293 }
2294 }
2295
2296 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2297 self.feature_flags.rethrow_serialization_type_layout_errors
2298 }
2299
2300 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2301 self.feature_flags
2302 .consensus_distributed_vote_scoring_strategy
2303 }
2304
2305 pub fn consensus_round_prober(&self) -> bool {
2306 self.feature_flags.consensus_round_prober
2307 }
2308
2309 pub fn validate_identifier_inputs(&self) -> bool {
2310 self.feature_flags.validate_identifier_inputs
2311 }
2312
2313 pub fn gc_depth(&self) -> u32 {
2314 self.consensus_gc_depth.unwrap_or(0)
2315 }
2316
2317 pub fn mysticeti_fastpath(&self) -> bool {
2318 self.feature_flags.mysticeti_fastpath
2319 }
2320
2321 pub fn relocate_event_module(&self) -> bool {
2322 self.feature_flags.relocate_event_module
2323 }
2324
2325 pub fn uncompressed_g1_group_elements(&self) -> bool {
2326 self.feature_flags.uncompressed_g1_group_elements
2327 }
2328
2329 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2330 self.feature_flags
2331 .disallow_new_modules_in_deps_only_packages
2332 }
2333
2334 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2335 self.feature_flags.consensus_smart_ancestor_selection
2336 }
2337
2338 pub fn disable_preconsensus_locking(&self) -> bool {
2339 self.feature_flags.disable_preconsensus_locking
2340 }
2341
2342 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2343 self.feature_flags
2344 .consensus_round_prober_probe_accepted_rounds
2345 }
2346
2347 pub fn native_charging_v2(&self) -> bool {
2348 self.feature_flags.native_charging_v2
2349 }
2350
2351 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2352 let res = self.feature_flags.consensus_linearize_subdag_v2;
2353 assert!(
2354 !res || self.gc_depth() > 0,
2355 "The consensus linearize sub dag V2 requires GC to be enabled"
2356 );
2357 res
2358 }
2359
2360 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2361 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2362 assert!(
2363 !res || self.gc_depth() > 0,
2364 "The consensus median based commit timestamp requires GC to be enabled"
2365 );
2366 res
2367 }
2368
2369 pub fn consensus_batched_block_sync(&self) -> bool {
2370 self.feature_flags.consensus_batched_block_sync
2371 }
2372
2373 pub fn convert_type_argument_error(&self) -> bool {
2374 self.feature_flags.convert_type_argument_error
2375 }
2376
2377 pub fn variant_nodes(&self) -> bool {
2378 self.feature_flags.variant_nodes
2379 }
2380
2381 pub fn consensus_zstd_compression(&self) -> bool {
2382 self.feature_flags.consensus_zstd_compression
2383 }
2384
2385 pub fn enable_nitro_attestation(&self) -> bool {
2386 self.feature_flags.enable_nitro_attestation
2387 }
2388
2389 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2390 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2391 }
2392
2393 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2394 self.feature_flags
2395 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2396 }
2397
2398 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2399 self.feature_flags
2400 .enable_nitro_attestation_always_include_required_pcrs_parsing
2401 }
2402
2403 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2404 self.consensus_commit_rate_estimation_window_size
2405 .unwrap_or(0)
2406 }
2407
2408 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2409 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2413 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2415 window_size
2416 }
2417
2418 pub fn minimize_child_object_mutations(&self) -> bool {
2419 self.feature_flags.minimize_child_object_mutations
2420 }
2421
2422 pub fn move_native_context(&self) -> bool {
2423 self.feature_flags.move_native_context
2424 }
2425
2426 pub fn normalize_ptb_arguments(&self) -> bool {
2427 self.feature_flags.normalize_ptb_arguments
2428 }
2429
2430 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2431 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2432 }
2433
2434 pub fn max_ptb_value_size_v2(&self) -> bool {
2435 self.feature_flags.max_ptb_value_size_v2
2436 }
2437
2438 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2439 self.feature_flags.resolve_type_input_ids_to_defining_id
2440 }
2441
2442 pub fn enable_party_transfer(&self) -> bool {
2443 self.feature_flags.enable_party_transfer
2444 }
2445
2446 pub fn allow_unbounded_system_objects(&self) -> bool {
2447 self.feature_flags.allow_unbounded_system_objects
2448 }
2449
2450 pub fn type_tags_in_object_runtime(&self) -> bool {
2451 self.feature_flags.type_tags_in_object_runtime
2452 }
2453
2454 pub fn enable_ptb_execution_v2(&self) -> bool {
2455 self.feature_flags.enable_ptb_execution_v2
2456 }
2457
2458 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2459 self.feature_flags.better_adapter_type_resolution_errors
2460 }
2461
2462 pub fn record_time_estimate_processed(&self) -> bool {
2463 self.feature_flags.record_time_estimate_processed
2464 }
2465
2466 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2467 self.feature_flags
2468 .ignore_execution_time_observations_after_certs_closed
2469 }
2470
2471 pub fn dependency_linkage_error(&self) -> bool {
2472 self.feature_flags.dependency_linkage_error
2473 }
2474
2475 pub fn additional_multisig_checks(&self) -> bool {
2476 self.feature_flags.additional_multisig_checks
2477 }
2478
2479 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2480 self.feature_flags.debug_fatal_on_move_invariant_violation
2481 }
2482
2483 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2484 self.feature_flags.allow_private_accumulator_entrypoints
2485 }
2486
2487 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2488 self.feature_flags
2489 .additional_consensus_digest_indirect_state
2490 }
2491
2492 pub fn check_for_init_during_upgrade(&self) -> bool {
2493 self.feature_flags.check_for_init_during_upgrade
2494 }
2495
2496 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2497 self.feature_flags.per_command_shared_object_transfer_rules
2498 }
2499
2500 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2501 self.feature_flags
2502 .consensus_checkpoint_signature_key_includes_digest
2503 }
2504
2505 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2506 self.feature_flags
2507 .include_checkpoint_artifacts_digest_in_summary
2508 }
2509
2510 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2511 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2512 }
2513
2514 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2515 self.feature_flags.cancel_for_failed_dkg_early
2516 }
2517
2518 pub fn abstract_size_in_object_runtime(&self) -> bool {
2519 self.feature_flags.abstract_size_in_object_runtime
2520 }
2521
2522 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2523 self.feature_flags.object_runtime_charge_cache_load_gas
2524 }
2525
2526 pub fn additional_borrow_checks(&self) -> bool {
2527 self.feature_flags.additional_borrow_checks
2528 }
2529
2530 pub fn use_new_commit_handler(&self) -> bool {
2531 self.feature_flags.use_new_commit_handler
2532 }
2533
2534 pub fn better_loader_errors(&self) -> bool {
2535 self.feature_flags.better_loader_errors
2536 }
2537
2538 pub fn generate_df_type_layouts(&self) -> bool {
2539 self.feature_flags.generate_df_type_layouts
2540 }
2541
2542 pub fn allow_references_in_ptbs(&self) -> bool {
2543 self.feature_flags.allow_references_in_ptbs
2544 }
2545
2546 pub fn private_generics_verifier_v2(&self) -> bool {
2547 self.feature_flags.private_generics_verifier_v2
2548 }
2549
2550 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2551 self.feature_flags
2552 .deprecate_global_storage_ops_during_deserialization
2553 }
2554
2555 pub fn enable_observation_chunking(&self) -> bool {
2556 matches!(self.feature_flags.per_object_congestion_control_mode,
2557 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2558 if params.observations_chunk_size.is_some()
2559 )
2560 }
2561
2562 pub fn deprecate_global_storage_ops(&self) -> bool {
2563 self.feature_flags.deprecate_global_storage_ops
2564 }
2565
2566 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2567 self.feature_flags.consensus_skip_gced_accept_votes
2568 }
2569
2570 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2571 self.feature_flags
2572 .include_cancelled_randomness_txns_in_prologue
2573 }
2574
2575 pub fn address_aliases(&self) -> bool {
2576 let address_aliases = self.feature_flags.address_aliases;
2577 assert!(
2578 !address_aliases || self.mysticeti_fastpath(),
2579 "Address aliases requires Mysticeti fastpath to be enabled"
2580 );
2581 if address_aliases {
2582 assert!(
2583 self.feature_flags.disable_preconsensus_locking,
2584 "Address aliases requires CertifiedTransaction to be disabled"
2585 );
2586 }
2587 address_aliases
2588 }
2589
2590 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2591 self.feature_flags.fix_checkpoint_signature_mapping
2592 }
2593
2594 pub fn enable_object_funds_withdraw(&self) -> bool {
2595 self.feature_flags.enable_object_funds_withdraw
2596 }
2597
2598 pub fn gas_rounding_halve_digits(&self) -> bool {
2599 self.feature_flags.gas_rounding_halve_digits
2600 }
2601
2602 pub fn flexible_tx_context_positions(&self) -> bool {
2603 self.feature_flags.flexible_tx_context_positions
2604 }
2605
2606 pub fn disable_entry_point_signature_check(&self) -> bool {
2607 self.feature_flags.disable_entry_point_signature_check
2608 }
2609
2610 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2611 self.feature_flags
2612 .consensus_skip_gced_blocks_in_direct_finalization
2613 }
2614
2615 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2616 self.feature_flags
2617 .convert_withdrawal_compatibility_ptb_arguments
2618 }
2619
2620 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2621 self.feature_flags.restrict_hot_or_not_entry_functions
2622 }
2623
2624 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2625 self.feature_flags.split_checkpoints_in_consensus_handler
2626 }
2627
2628 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2629 self.feature_flags
2630 .consensus_always_accept_system_transactions
2631 }
2632
2633 pub fn validator_metadata_verify_v2(&self) -> bool {
2634 self.feature_flags.validator_metadata_verify_v2
2635 }
2636
2637 pub fn defer_unpaid_amplification(&self) -> bool {
2638 self.feature_flags.defer_unpaid_amplification
2639 }
2640
2641 pub fn gasless_transaction_drop_safety(&self) -> bool {
2642 self.feature_flags.gasless_transaction_drop_safety
2643 }
2644}
2645
2646#[cfg(not(msim))]
2647static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2648
2649#[cfg(msim)]
2651thread_local! {
2652 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2653}
2654
2655impl ProtocolConfig {
2657 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2659 assert!(
2661 version >= ProtocolVersion::MIN,
2662 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2663 version,
2664 ProtocolVersion::MIN.0,
2665 );
2666 assert!(
2667 version <= ProtocolVersion::MAX_ALLOWED,
2668 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2669 version,
2670 ProtocolVersion::MAX_ALLOWED.0,
2671 );
2672
2673 let mut ret = Self::get_for_version_impl(version, chain);
2674 ret.version = version;
2675
2676 ret = CONFIG_OVERRIDE.with(|ovr| {
2677 if let Some(override_fn) = &*ovr.borrow() {
2678 warn!(
2679 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2680 );
2681 override_fn(version, ret)
2682 } else {
2683 ret
2684 }
2685 });
2686
2687 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2688 warn!(
2689 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2690 );
2691 let overrides: ProtocolConfigOptional =
2692 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2693 .expect("failed to parse ProtocolConfig override env variables");
2694 overrides.apply_to(&mut ret);
2695 }
2696
2697 ret
2698 }
2699
2700 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2703 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2704 let mut ret = Self::get_for_version_impl(version, chain);
2705 ret.version = version;
2706 Some(ret)
2707 } else {
2708 None
2709 }
2710 }
2711
2712 #[cfg(not(msim))]
2713 pub fn poison_get_for_min_version() {
2714 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2715 }
2716
2717 #[cfg(not(msim))]
2718 fn load_poison_get_for_min_version() -> bool {
2719 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2720 }
2721
2722 #[cfg(msim)]
2723 pub fn poison_get_for_min_version() {
2724 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2725 }
2726
2727 #[cfg(msim)]
2728 fn load_poison_get_for_min_version() -> bool {
2729 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2730 }
2731
2732 pub fn get_for_min_version() -> Self {
2735 if Self::load_poison_get_for_min_version() {
2736 panic!("get_for_min_version called on validator");
2737 }
2738 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2739 }
2740
2741 #[allow(non_snake_case)]
2751 pub fn get_for_max_version_UNSAFE() -> Self {
2752 if Self::load_poison_get_for_min_version() {
2753 panic!("get_for_max_version_UNSAFE called on validator");
2754 }
2755 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2756 }
2757
2758 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2759 #[cfg(msim)]
2760 {
2761 if version == ProtocolVersion::MAX_ALLOWED {
2763 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2764 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2765 return config;
2766 }
2767 }
2768
2769 let mut cfg = Self {
2772 version,
2774
2775 feature_flags: Default::default(),
2777
2778 max_tx_size_bytes: Some(128 * 1024),
2779 max_input_objects: Some(2048),
2781 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2782 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2783 max_gas_payment_objects: Some(256),
2784 max_modules_in_publish: Some(128),
2785 max_package_dependencies: None,
2786 max_arguments: Some(512),
2787 max_type_arguments: Some(16),
2788 max_type_argument_depth: Some(16),
2789 max_pure_argument_size: Some(16 * 1024),
2790 max_programmable_tx_commands: Some(1024),
2791 move_binary_format_version: Some(6),
2792 min_move_binary_format_version: None,
2793 binary_module_handles: None,
2794 binary_struct_handles: None,
2795 binary_function_handles: None,
2796 binary_function_instantiations: None,
2797 binary_signatures: None,
2798 binary_constant_pool: None,
2799 binary_identifiers: None,
2800 binary_address_identifiers: None,
2801 binary_struct_defs: None,
2802 binary_struct_def_instantiations: None,
2803 binary_function_defs: None,
2804 binary_field_handles: None,
2805 binary_field_instantiations: None,
2806 binary_friend_decls: None,
2807 binary_enum_defs: None,
2808 binary_enum_def_instantiations: None,
2809 binary_variant_handles: None,
2810 binary_variant_instantiation_handles: None,
2811 max_move_object_size: Some(250 * 1024),
2812 max_move_package_size: Some(100 * 1024),
2813 max_publish_or_upgrade_per_ptb: None,
2814 max_tx_gas: Some(10_000_000_000),
2815 max_gas_price: Some(100_000),
2816 max_gas_price_rgp_factor_for_aborted_transactions: None,
2817 max_gas_computation_bucket: Some(5_000_000),
2818 max_loop_depth: Some(5),
2819 max_generic_instantiation_length: Some(32),
2820 max_function_parameters: Some(128),
2821 max_basic_blocks: Some(1024),
2822 max_value_stack_size: Some(1024),
2823 max_type_nodes: Some(256),
2824 max_push_size: Some(10000),
2825 max_struct_definitions: Some(200),
2826 max_function_definitions: Some(1000),
2827 max_fields_in_struct: Some(32),
2828 max_dependency_depth: Some(100),
2829 max_num_event_emit: Some(256),
2830 max_num_new_move_object_ids: Some(2048),
2831 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2832 max_num_deleted_move_object_ids: Some(2048),
2833 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2834 max_num_transferred_move_object_ids: Some(2048),
2835 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2836 max_event_emit_size: Some(250 * 1024),
2837 max_move_vector_len: Some(256 * 1024),
2838 max_type_to_layout_nodes: None,
2839 max_ptb_value_size: None,
2840
2841 max_back_edges_per_function: Some(10_000),
2842 max_back_edges_per_module: Some(10_000),
2843 max_verifier_meter_ticks_per_function: Some(6_000_000),
2844 max_meter_ticks_per_module: Some(6_000_000),
2845 max_meter_ticks_per_package: None,
2846
2847 object_runtime_max_num_cached_objects: Some(1000),
2848 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2849 object_runtime_max_num_store_entries: Some(1000),
2850 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2851 base_tx_cost_fixed: Some(110_000),
2852 package_publish_cost_fixed: Some(1_000),
2853 base_tx_cost_per_byte: Some(0),
2854 package_publish_cost_per_byte: Some(80),
2855 obj_access_cost_read_per_byte: Some(15),
2856 obj_access_cost_mutate_per_byte: Some(40),
2857 obj_access_cost_delete_per_byte: Some(40),
2858 obj_access_cost_verify_per_byte: Some(200),
2859 obj_data_cost_refundable: Some(100),
2860 obj_metadata_cost_non_refundable: Some(50),
2861 gas_model_version: Some(1),
2862 storage_rebate_rate: Some(9900),
2863 storage_fund_reinvest_rate: Some(500),
2864 reward_slashing_rate: Some(5000),
2865 storage_gas_price: Some(1),
2866 accumulator_object_storage_cost: None,
2867 max_transactions_per_checkpoint: Some(10_000),
2868 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2869
2870 buffer_stake_for_protocol_upgrade_bps: Some(0),
2873
2874 address_from_bytes_cost_base: Some(52),
2878 address_to_u256_cost_base: Some(52),
2880 address_from_u256_cost_base: Some(52),
2882
2883 config_read_setting_impl_cost_base: None,
2886 config_read_setting_impl_cost_per_byte: None,
2887
2888 dynamic_field_hash_type_and_key_cost_base: Some(100),
2891 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2892 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2893 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2894 dynamic_field_add_child_object_cost_base: Some(100),
2896 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2897 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2898 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2899 dynamic_field_borrow_child_object_cost_base: Some(100),
2901 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2902 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2903 dynamic_field_remove_child_object_cost_base: Some(100),
2905 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2906 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2907 dynamic_field_has_child_object_cost_base: Some(100),
2909 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2911 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2912 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2913
2914 event_emit_cost_base: Some(52),
2917 event_emit_value_size_derivation_cost_per_byte: Some(2),
2918 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2919 event_emit_output_cost_per_byte: Some(10),
2920 event_emit_auth_stream_cost: None,
2921
2922 object_borrow_uid_cost_base: Some(52),
2925 object_delete_impl_cost_base: Some(52),
2927 object_record_new_uid_cost_base: Some(52),
2929
2930 transfer_transfer_internal_cost_base: Some(52),
2933 transfer_party_transfer_internal_cost_base: None,
2935 transfer_freeze_object_cost_base: Some(52),
2937 transfer_share_object_cost_base: Some(52),
2939 transfer_receive_object_cost_base: None,
2940
2941 tx_context_derive_id_cost_base: Some(52),
2944 tx_context_fresh_id_cost_base: None,
2945 tx_context_sender_cost_base: None,
2946 tx_context_epoch_cost_base: None,
2947 tx_context_epoch_timestamp_ms_cost_base: None,
2948 tx_context_sponsor_cost_base: None,
2949 tx_context_rgp_cost_base: None,
2950 tx_context_gas_price_cost_base: None,
2951 tx_context_gas_budget_cost_base: None,
2952 tx_context_ids_created_cost_base: None,
2953 tx_context_replace_cost_base: None,
2954
2955 types_is_one_time_witness_cost_base: Some(52),
2958 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2959 types_is_one_time_witness_type_cost_per_byte: Some(2),
2960
2961 validator_validate_metadata_cost_base: Some(52),
2964 validator_validate_metadata_data_cost_per_byte: Some(2),
2965
2966 crypto_invalid_arguments_cost: Some(100),
2968 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2970 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2971 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2972
2973 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2975 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2976 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2977
2978 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2980 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2981 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2982 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2983 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2984 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2985
2986 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2988
2989 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2991 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2992 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2993 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2994 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2995 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2996
2997 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2999 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3000 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3001 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3002 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3003 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3004
3005 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3007 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3008 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3009 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3010 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3011 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3012
3013 ecvrf_ecvrf_verify_cost_base: Some(52),
3015 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3016 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3017
3018 ed25519_ed25519_verify_cost_base: Some(52),
3020 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3021 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3022
3023 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3025 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3026
3027 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3029 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3030 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3031 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3032 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3033
3034 hash_blake2b256_cost_base: Some(52),
3036 hash_blake2b256_data_cost_per_byte: Some(2),
3037 hash_blake2b256_data_cost_per_block: Some(2),
3038
3039 hash_keccak256_cost_base: Some(52),
3041 hash_keccak256_data_cost_per_byte: Some(2),
3042 hash_keccak256_data_cost_per_block: Some(2),
3043
3044 poseidon_bn254_cost_base: None,
3045 poseidon_bn254_cost_per_block: None,
3046
3047 hmac_hmac_sha3_256_cost_base: Some(52),
3049 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3050 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3051
3052 group_ops_bls12381_decode_scalar_cost: None,
3054 group_ops_bls12381_decode_g1_cost: None,
3055 group_ops_bls12381_decode_g2_cost: None,
3056 group_ops_bls12381_decode_gt_cost: None,
3057 group_ops_bls12381_scalar_add_cost: None,
3058 group_ops_bls12381_g1_add_cost: None,
3059 group_ops_bls12381_g2_add_cost: None,
3060 group_ops_bls12381_gt_add_cost: None,
3061 group_ops_bls12381_scalar_sub_cost: None,
3062 group_ops_bls12381_g1_sub_cost: None,
3063 group_ops_bls12381_g2_sub_cost: None,
3064 group_ops_bls12381_gt_sub_cost: None,
3065 group_ops_bls12381_scalar_mul_cost: None,
3066 group_ops_bls12381_g1_mul_cost: None,
3067 group_ops_bls12381_g2_mul_cost: None,
3068 group_ops_bls12381_gt_mul_cost: None,
3069 group_ops_bls12381_scalar_div_cost: None,
3070 group_ops_bls12381_g1_div_cost: None,
3071 group_ops_bls12381_g2_div_cost: None,
3072 group_ops_bls12381_gt_div_cost: None,
3073 group_ops_bls12381_g1_hash_to_base_cost: None,
3074 group_ops_bls12381_g2_hash_to_base_cost: None,
3075 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3076 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3077 group_ops_bls12381_g1_msm_base_cost: None,
3078 group_ops_bls12381_g2_msm_base_cost: None,
3079 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3080 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3081 group_ops_bls12381_msm_max_len: None,
3082 group_ops_bls12381_pairing_cost: None,
3083 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3084 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3085 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3086 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3087 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3088
3089 group_ops_ristretto_decode_scalar_cost: None,
3090 group_ops_ristretto_decode_point_cost: None,
3091 group_ops_ristretto_scalar_add_cost: None,
3092 group_ops_ristretto_point_add_cost: None,
3093 group_ops_ristretto_scalar_sub_cost: None,
3094 group_ops_ristretto_point_sub_cost: None,
3095 group_ops_ristretto_scalar_mul_cost: None,
3096 group_ops_ristretto_point_mul_cost: None,
3097 group_ops_ristretto_scalar_div_cost: None,
3098 group_ops_ristretto_point_div_cost: None,
3099
3100 check_zklogin_id_cost_base: None,
3102 check_zklogin_issuer_cost_base: None,
3104
3105 vdf_verify_vdf_cost: None,
3106 vdf_hash_to_input_cost: None,
3107
3108 nitro_attestation_parse_base_cost: None,
3110 nitro_attestation_parse_cost_per_byte: None,
3111 nitro_attestation_verify_base_cost: None,
3112 nitro_attestation_verify_cost_per_cert: None,
3113
3114 bcs_per_byte_serialized_cost: None,
3115 bcs_legacy_min_output_size_cost: None,
3116 bcs_failure_cost: None,
3117 hash_sha2_256_base_cost: None,
3118 hash_sha2_256_per_byte_cost: None,
3119 hash_sha2_256_legacy_min_input_len_cost: None,
3120 hash_sha3_256_base_cost: None,
3121 hash_sha3_256_per_byte_cost: None,
3122 hash_sha3_256_legacy_min_input_len_cost: None,
3123 type_name_get_base_cost: None,
3124 type_name_get_per_byte_cost: None,
3125 type_name_id_base_cost: None,
3126 string_check_utf8_base_cost: None,
3127 string_check_utf8_per_byte_cost: None,
3128 string_is_char_boundary_base_cost: None,
3129 string_sub_string_base_cost: None,
3130 string_sub_string_per_byte_cost: None,
3131 string_index_of_base_cost: None,
3132 string_index_of_per_byte_pattern_cost: None,
3133 string_index_of_per_byte_searched_cost: None,
3134 vector_empty_base_cost: None,
3135 vector_length_base_cost: None,
3136 vector_push_back_base_cost: None,
3137 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3138 vector_borrow_base_cost: None,
3139 vector_pop_back_base_cost: None,
3140 vector_destroy_empty_base_cost: None,
3141 vector_swap_base_cost: None,
3142 debug_print_base_cost: None,
3143 debug_print_stack_trace_base_cost: None,
3144
3145 max_size_written_objects: None,
3146 max_size_written_objects_system_tx: None,
3147
3148 max_move_identifier_len: None,
3155 max_move_value_depth: None,
3156 max_move_enum_variants: None,
3157
3158 gas_rounding_step: None,
3159
3160 execution_version: None,
3161
3162 max_event_emit_size_total: None,
3163
3164 consensus_bad_nodes_stake_threshold: None,
3165
3166 max_jwk_votes_per_validator_per_epoch: None,
3167
3168 max_age_of_jwk_in_epochs: None,
3169
3170 random_beacon_reduction_allowed_delta: None,
3171
3172 random_beacon_reduction_lower_bound: None,
3173
3174 random_beacon_dkg_timeout_round: None,
3175
3176 random_beacon_min_round_interval_ms: None,
3177
3178 random_beacon_dkg_version: None,
3179
3180 consensus_max_transaction_size_bytes: None,
3181
3182 consensus_max_transactions_in_block_bytes: None,
3183
3184 consensus_max_num_transactions_in_block: None,
3185
3186 consensus_voting_rounds: None,
3187
3188 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3189
3190 max_deferral_rounds_for_congestion_control: None,
3191
3192 max_txn_cost_overage_per_object_in_commit: None,
3193
3194 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3195
3196 min_checkpoint_interval_ms: None,
3197
3198 checkpoint_summary_version_specific_data: None,
3199
3200 max_soft_bundle_size: None,
3201
3202 bridge_should_try_to_finalize_committee: None,
3203
3204 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3205
3206 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3207
3208 consensus_gc_depth: None,
3209
3210 gas_budget_based_txn_cost_cap_factor: None,
3211
3212 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3213
3214 sip_45_consensus_amplification_threshold: None,
3215
3216 use_object_per_epoch_marker_table_v2: None,
3217
3218 consensus_commit_rate_estimation_window_size: None,
3219
3220 aliased_addresses: vec![],
3221
3222 translation_per_command_base_charge: None,
3223 translation_per_input_base_charge: None,
3224 translation_pure_input_per_byte_charge: None,
3225 translation_per_type_node_charge: None,
3226 translation_per_reference_node_charge: None,
3227 translation_per_linkage_entry_charge: None,
3228
3229 max_updates_per_settlement_txn: None,
3230 };
3233 for cur in 2..=version.0 {
3234 match cur {
3235 1 => unreachable!(),
3236 2 => {
3237 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3238 }
3239 3 => {
3240 cfg.gas_model_version = Some(2);
3242 cfg.max_tx_gas = Some(50_000_000_000);
3244 cfg.base_tx_cost_fixed = Some(2_000);
3246 cfg.storage_gas_price = Some(76);
3248 cfg.feature_flags.loaded_child_objects_fixed = true;
3249 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3252 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3255 cfg.feature_flags.package_upgrades = true;
3256 }
3257 4 => {
3262 cfg.reward_slashing_rate = Some(10000);
3264 cfg.gas_model_version = Some(3);
3266 }
3267 5 => {
3268 cfg.feature_flags.missing_type_is_compatibility_error = true;
3269 cfg.gas_model_version = Some(4);
3270 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3271 }
3275 6 => {
3276 cfg.gas_model_version = Some(5);
3277 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3278 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3279 }
3280 7 => {
3281 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3282 cfg.feature_flags
3283 .disable_invariant_violation_check_in_swap_loc = true;
3284 cfg.feature_flags.ban_entry_init = true;
3285 cfg.feature_flags.package_digest_hash_module = true;
3286 }
3287 8 => {
3288 cfg.feature_flags
3289 .disallow_change_struct_type_params_on_upgrade = true;
3290 }
3291 9 => {
3292 cfg.max_move_identifier_len = Some(128);
3294 cfg.feature_flags.no_extraneous_module_bytes = true;
3295 cfg.feature_flags
3296 .advance_to_highest_supported_protocol_version = true;
3297 }
3298 10 => {
3299 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3300 cfg.max_meter_ticks_per_module = Some(16_000_000);
3301 }
3302 11 => {
3303 cfg.max_move_value_depth = Some(128);
3304 }
3305 12 => {
3306 cfg.feature_flags.narwhal_versioned_metadata = true;
3307 if chain != Chain::Mainnet {
3308 cfg.feature_flags.commit_root_state_digest = true;
3309 }
3310
3311 if chain != Chain::Mainnet && chain != Chain::Testnet {
3312 cfg.feature_flags.zklogin_auth = true;
3313 }
3314 }
3315 13 => {}
3316 14 => {
3317 cfg.gas_rounding_step = Some(1_000);
3318 cfg.gas_model_version = Some(6);
3319 }
3320 15 => {
3321 cfg.feature_flags.consensus_transaction_ordering =
3322 ConsensusTransactionOrdering::ByGasPrice;
3323 }
3324 16 => {
3325 cfg.feature_flags.simplified_unwrap_then_delete = true;
3326 }
3327 17 => {
3328 cfg.feature_flags.upgraded_multisig_supported = true;
3329 }
3330 18 => {
3331 cfg.execution_version = Some(1);
3332 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3341 cfg.base_tx_cost_fixed = Some(1_000);
3343 }
3344 19 => {
3345 cfg.max_num_event_emit = Some(1024);
3346 cfg.max_event_emit_size_total = Some(
3349 256 * 250 * 1024, );
3351 }
3352 20 => {
3353 cfg.feature_flags.commit_root_state_digest = true;
3354
3355 if chain != Chain::Mainnet {
3356 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3357 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3358 }
3359 }
3360
3361 21 => {
3362 if chain != Chain::Mainnet {
3363 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3364 "Google".to_string(),
3365 "Facebook".to_string(),
3366 "Twitch".to_string(),
3367 ]);
3368 }
3369 }
3370 22 => {
3371 cfg.feature_flags.loaded_child_object_format = true;
3372 }
3373 23 => {
3374 cfg.feature_flags.loaded_child_object_format_type = true;
3375 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3376 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3382 }
3383 24 => {
3384 cfg.feature_flags.simple_conservation_checks = true;
3385 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3386
3387 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3388
3389 if chain != Chain::Mainnet {
3390 cfg.feature_flags.enable_jwk_consensus_updates = true;
3391 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3393 cfg.max_age_of_jwk_in_epochs = Some(1);
3394 }
3395 }
3396 25 => {
3397 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3399 "Google".to_string(),
3400 "Facebook".to_string(),
3401 "Twitch".to_string(),
3402 ]);
3403 cfg.feature_flags.zklogin_auth = true;
3404
3405 cfg.feature_flags.enable_jwk_consensus_updates = true;
3407 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3408 cfg.max_age_of_jwk_in_epochs = Some(1);
3409 }
3410 26 => {
3411 cfg.gas_model_version = Some(7);
3412 if chain != Chain::Mainnet && chain != Chain::Testnet {
3414 cfg.transfer_receive_object_cost_base = Some(52);
3415 cfg.feature_flags.receive_objects = true;
3416 }
3417 }
3418 27 => {
3419 cfg.gas_model_version = Some(8);
3420 }
3421 28 => {
3422 cfg.check_zklogin_id_cost_base = Some(200);
3424 cfg.check_zklogin_issuer_cost_base = Some(200);
3426
3427 if chain != Chain::Mainnet && chain != Chain::Testnet {
3429 cfg.feature_flags.enable_effects_v2 = true;
3430 }
3431 }
3432 29 => {
3433 cfg.feature_flags.verify_legacy_zklogin_address = true;
3434 }
3435 30 => {
3436 if chain != Chain::Mainnet {
3438 cfg.feature_flags.narwhal_certificate_v2 = true;
3439 }
3440
3441 cfg.random_beacon_reduction_allowed_delta = Some(800);
3442 if chain != Chain::Mainnet {
3444 cfg.feature_flags.enable_effects_v2 = true;
3445 }
3446
3447 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3451
3452 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3453 }
3454 31 => {
3455 cfg.execution_version = Some(2);
3456 if chain != Chain::Mainnet && chain != Chain::Testnet {
3458 cfg.feature_flags.shared_object_deletion = true;
3459 }
3460 }
3461 32 => {
3462 if chain != Chain::Mainnet {
3464 cfg.feature_flags.accept_zklogin_in_multisig = true;
3465 }
3466 if chain != Chain::Mainnet {
3468 cfg.transfer_receive_object_cost_base = Some(52);
3469 cfg.feature_flags.receive_objects = true;
3470 }
3471 if chain != Chain::Mainnet && chain != Chain::Testnet {
3473 cfg.feature_flags.random_beacon = true;
3474 cfg.random_beacon_reduction_lower_bound = Some(1600);
3475 cfg.random_beacon_dkg_timeout_round = Some(3000);
3476 cfg.random_beacon_min_round_interval_ms = Some(150);
3477 }
3478 if chain != Chain::Testnet && chain != Chain::Mainnet {
3480 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3481 }
3482
3483 cfg.feature_flags.narwhal_certificate_v2 = true;
3485 }
3486 33 => {
3487 cfg.feature_flags.hardened_otw_check = true;
3488 cfg.feature_flags.allow_receiving_object_id = true;
3489
3490 cfg.transfer_receive_object_cost_base = Some(52);
3492 cfg.feature_flags.receive_objects = true;
3493
3494 if chain != Chain::Mainnet {
3496 cfg.feature_flags.shared_object_deletion = true;
3497 }
3498
3499 cfg.feature_flags.enable_effects_v2 = true;
3500 }
3501 34 => {}
3502 35 => {
3503 if chain != Chain::Mainnet && chain != Chain::Testnet {
3505 cfg.feature_flags.enable_poseidon = true;
3506 cfg.poseidon_bn254_cost_base = Some(260);
3507 cfg.poseidon_bn254_cost_per_block = Some(10);
3508 }
3509
3510 cfg.feature_flags.enable_coin_deny_list = true;
3511 }
3512 36 => {
3513 if chain != Chain::Mainnet && chain != Chain::Testnet {
3515 cfg.feature_flags.enable_group_ops_native_functions = true;
3516 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3517 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3519 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3520 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3521 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3522 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3523 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3524 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3525 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3526 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3527 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3528 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3529 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3530 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3531 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3532 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3533 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3534 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3535 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3536 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3537 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3538 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3539 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3540 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3541 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3542 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3543 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3544 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3545 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3546 cfg.group_ops_bls12381_msm_max_len = Some(32);
3547 cfg.group_ops_bls12381_pairing_cost = Some(52);
3548 }
3549 cfg.feature_flags.shared_object_deletion = true;
3551
3552 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3554 }
3556 37 => {
3557 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3558
3559 if chain != Chain::Mainnet {
3561 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3562 }
3563 }
3564 38 => {
3565 cfg.binary_module_handles = Some(100);
3566 cfg.binary_struct_handles = Some(300);
3567 cfg.binary_function_handles = Some(1500);
3568 cfg.binary_function_instantiations = Some(750);
3569 cfg.binary_signatures = Some(1000);
3570 cfg.binary_constant_pool = Some(4000);
3574 cfg.binary_identifiers = Some(10000);
3575 cfg.binary_address_identifiers = Some(100);
3576 cfg.binary_struct_defs = Some(200);
3577 cfg.binary_struct_def_instantiations = Some(100);
3578 cfg.binary_function_defs = Some(1000);
3579 cfg.binary_field_handles = Some(500);
3580 cfg.binary_field_instantiations = Some(250);
3581 cfg.binary_friend_decls = Some(100);
3582 cfg.max_package_dependencies = Some(32);
3584 cfg.max_modules_in_publish = Some(64);
3585 cfg.execution_version = Some(3);
3587 }
3588 39 => {
3589 }
3591 40 => {}
3592 41 => {
3593 cfg.feature_flags.enable_group_ops_native_functions = true;
3595 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3597 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3598 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3599 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3600 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3601 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3602 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3603 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3604 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3605 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3606 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3607 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3608 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3609 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3610 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3611 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3612 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3613 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3614 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3615 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3616 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3617 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3618 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3619 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3620 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3621 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3622 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3623 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3624 cfg.group_ops_bls12381_msm_max_len = Some(32);
3625 cfg.group_ops_bls12381_pairing_cost = Some(52);
3626 }
3627 42 => {}
3628 43 => {
3629 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3630 cfg.max_meter_ticks_per_package = Some(16_000_000);
3631 }
3632 44 => {
3633 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3635 if chain != Chain::Mainnet {
3637 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3638 }
3639 }
3640 45 => {
3641 if chain != Chain::Testnet && chain != Chain::Mainnet {
3643 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3644 }
3645
3646 if chain != Chain::Mainnet {
3647 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3649 }
3650 cfg.min_move_binary_format_version = Some(6);
3651 cfg.feature_flags.accept_zklogin_in_multisig = true;
3652
3653 if chain != Chain::Mainnet && chain != Chain::Testnet {
3657 cfg.feature_flags.bridge = true;
3658 }
3659 }
3660 46 => {
3661 if chain != Chain::Mainnet {
3663 cfg.feature_flags.bridge = true;
3664 }
3665
3666 cfg.feature_flags.reshare_at_same_initial_version = true;
3668 }
3669 47 => {}
3670 48 => {
3671 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3673
3674 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3676
3677 if chain != Chain::Mainnet {
3679 cfg.feature_flags.random_beacon = true;
3680 cfg.random_beacon_reduction_lower_bound = Some(1600);
3681 cfg.random_beacon_dkg_timeout_round = Some(3000);
3682 cfg.random_beacon_min_round_interval_ms = Some(200);
3683 }
3684
3685 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3687 }
3688 49 => {
3689 if chain != Chain::Testnet && chain != Chain::Mainnet {
3690 cfg.move_binary_format_version = Some(7);
3691 }
3692
3693 if chain != Chain::Mainnet && chain != Chain::Testnet {
3695 cfg.feature_flags.enable_vdf = true;
3696 cfg.vdf_verify_vdf_cost = Some(1500);
3699 cfg.vdf_hash_to_input_cost = Some(100);
3700 }
3701
3702 if chain != Chain::Testnet && chain != Chain::Mainnet {
3704 cfg.feature_flags
3705 .record_consensus_determined_version_assignments_in_prologue = true;
3706 }
3707
3708 if chain != Chain::Mainnet {
3710 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3711 }
3712
3713 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3715 }
3716 50 => {
3717 if chain != Chain::Mainnet {
3719 cfg.checkpoint_summary_version_specific_data = Some(1);
3720 cfg.min_checkpoint_interval_ms = Some(200);
3721 }
3722
3723 if chain != Chain::Testnet && chain != Chain::Mainnet {
3725 cfg.feature_flags
3726 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3727 }
3728
3729 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3730
3731 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3733 }
3734 51 => {
3735 cfg.random_beacon_dkg_version = Some(1);
3736
3737 if chain != Chain::Testnet && chain != Chain::Mainnet {
3738 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3739 }
3740 }
3741 52 => {
3742 if chain != Chain::Mainnet {
3743 cfg.feature_flags.soft_bundle = true;
3744 cfg.max_soft_bundle_size = Some(5);
3745 }
3746
3747 cfg.config_read_setting_impl_cost_base = Some(100);
3748 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3749
3750 if chain != Chain::Testnet && chain != Chain::Mainnet {
3752 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3753 cfg.feature_flags.per_object_congestion_control_mode =
3754 PerObjectCongestionControlMode::TotalTxCount;
3755 }
3756
3757 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3759
3760 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3762
3763 cfg.checkpoint_summary_version_specific_data = Some(1);
3765 cfg.min_checkpoint_interval_ms = Some(200);
3766
3767 if chain != Chain::Mainnet {
3769 cfg.feature_flags
3770 .record_consensus_determined_version_assignments_in_prologue = true;
3771 cfg.feature_flags
3772 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3773 }
3774 if chain != Chain::Mainnet {
3776 cfg.move_binary_format_version = Some(7);
3777 }
3778
3779 if chain != Chain::Testnet && chain != Chain::Mainnet {
3780 cfg.feature_flags.passkey_auth = true;
3781 }
3782 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3783 }
3784 53 => {
3785 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3787
3788 cfg.feature_flags
3790 .record_consensus_determined_version_assignments_in_prologue = true;
3791 cfg.feature_flags
3792 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3793
3794 if chain == Chain::Unknown {
3795 cfg.feature_flags.authority_capabilities_v2 = true;
3796 }
3797
3798 if chain != Chain::Mainnet {
3800 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3801 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3802 cfg.feature_flags.per_object_congestion_control_mode =
3803 PerObjectCongestionControlMode::TotalTxCount;
3804 }
3805
3806 cfg.bcs_per_byte_serialized_cost = Some(2);
3808 cfg.bcs_legacy_min_output_size_cost = Some(1);
3809 cfg.bcs_failure_cost = Some(52);
3810 cfg.debug_print_base_cost = Some(52);
3811 cfg.debug_print_stack_trace_base_cost = Some(52);
3812 cfg.hash_sha2_256_base_cost = Some(52);
3813 cfg.hash_sha2_256_per_byte_cost = Some(2);
3814 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3815 cfg.hash_sha3_256_base_cost = Some(52);
3816 cfg.hash_sha3_256_per_byte_cost = Some(2);
3817 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3818 cfg.type_name_get_base_cost = Some(52);
3819 cfg.type_name_get_per_byte_cost = Some(2);
3820 cfg.string_check_utf8_base_cost = Some(52);
3821 cfg.string_check_utf8_per_byte_cost = Some(2);
3822 cfg.string_is_char_boundary_base_cost = Some(52);
3823 cfg.string_sub_string_base_cost = Some(52);
3824 cfg.string_sub_string_per_byte_cost = Some(2);
3825 cfg.string_index_of_base_cost = Some(52);
3826 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3827 cfg.string_index_of_per_byte_searched_cost = Some(2);
3828 cfg.vector_empty_base_cost = Some(52);
3829 cfg.vector_length_base_cost = Some(52);
3830 cfg.vector_push_back_base_cost = Some(52);
3831 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3832 cfg.vector_borrow_base_cost = Some(52);
3833 cfg.vector_pop_back_base_cost = Some(52);
3834 cfg.vector_destroy_empty_base_cost = Some(52);
3835 cfg.vector_swap_base_cost = Some(52);
3836 }
3837 54 => {
3838 cfg.feature_flags.random_beacon = true;
3840 cfg.random_beacon_reduction_lower_bound = Some(1000);
3841 cfg.random_beacon_dkg_timeout_round = Some(3000);
3842 cfg.random_beacon_min_round_interval_ms = Some(500);
3843
3844 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3846 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3847 cfg.feature_flags.per_object_congestion_control_mode =
3848 PerObjectCongestionControlMode::TotalTxCount;
3849
3850 cfg.feature_flags.soft_bundle = true;
3852 cfg.max_soft_bundle_size = Some(5);
3853 }
3854 55 => {
3855 cfg.move_binary_format_version = Some(7);
3857
3858 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3860 cfg.consensus_max_num_transactions_in_block = Some(512);
3863
3864 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3865 }
3866 56 => {
3867 if chain == Chain::Mainnet {
3868 cfg.feature_flags.bridge = true;
3869 }
3870 }
3871 57 => {
3872 cfg.random_beacon_reduction_lower_bound = Some(800);
3874 }
3875 58 => {
3876 if chain == Chain::Mainnet {
3877 cfg.bridge_should_try_to_finalize_committee = Some(true);
3878 }
3879
3880 if chain != Chain::Mainnet && chain != Chain::Testnet {
3881 cfg.feature_flags
3883 .consensus_distributed_vote_scoring_strategy = true;
3884 }
3885 }
3886 59 => {
3887 cfg.feature_flags.consensus_round_prober = true;
3889 }
3890 60 => {
3891 cfg.max_type_to_layout_nodes = Some(512);
3892 cfg.feature_flags.validate_identifier_inputs = true;
3893 }
3894 61 => {
3895 if chain != Chain::Mainnet {
3896 cfg.feature_flags
3898 .consensus_distributed_vote_scoring_strategy = true;
3899 }
3900 cfg.random_beacon_reduction_lower_bound = Some(700);
3902
3903 if chain != Chain::Mainnet && chain != Chain::Testnet {
3904 cfg.feature_flags.mysticeti_fastpath = true;
3906 }
3907 }
3908 62 => {
3909 cfg.feature_flags.relocate_event_module = true;
3910 }
3911 63 => {
3912 cfg.feature_flags.per_object_congestion_control_mode =
3913 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3914 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3915 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3916 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3917 }
3918 64 => {
3919 cfg.feature_flags.per_object_congestion_control_mode =
3920 PerObjectCongestionControlMode::TotalTxCount;
3921 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3922 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3923 }
3924 65 => {
3925 cfg.feature_flags
3927 .consensus_distributed_vote_scoring_strategy = true;
3928 }
3929 66 => {
3930 if chain == Chain::Mainnet {
3931 cfg.feature_flags
3933 .consensus_distributed_vote_scoring_strategy = false;
3934 }
3935 }
3936 67 => {
3937 cfg.feature_flags
3939 .consensus_distributed_vote_scoring_strategy = true;
3940 }
3941 68 => {
3942 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3943 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3944 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3945 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3946 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3947
3948 if chain != Chain::Mainnet && chain != Chain::Testnet {
3949 cfg.feature_flags.uncompressed_g1_group_elements = true;
3950 }
3951
3952 cfg.feature_flags.per_object_congestion_control_mode =
3953 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3954 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3955 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3956 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3957 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3959 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3960
3961 cfg.random_beacon_reduction_lower_bound = Some(500);
3963
3964 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3965 }
3966 69 => {
3967 cfg.consensus_voting_rounds = Some(40);
3969
3970 if chain != Chain::Mainnet && chain != Chain::Testnet {
3971 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3973 }
3974
3975 if chain != Chain::Mainnet {
3976 cfg.feature_flags.uncompressed_g1_group_elements = true;
3977 }
3978 }
3979 70 => {
3980 if chain != Chain::Mainnet {
3981 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3983 cfg.feature_flags
3985 .consensus_round_prober_probe_accepted_rounds = true;
3986 }
3987
3988 cfg.poseidon_bn254_cost_per_block = Some(388);
3989
3990 cfg.gas_model_version = Some(9);
3991 cfg.feature_flags.native_charging_v2 = true;
3992 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
3993 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
3994 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
3995 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
3996 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
3997 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
3998 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
3999 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4000
4001 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4003 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4004 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4005 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4006
4007 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4008 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4009 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4010 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4011 Some(8213);
4012 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4013 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4014 Some(9484);
4015
4016 cfg.hash_keccak256_cost_base = Some(10);
4017 cfg.hash_blake2b256_cost_base = Some(10);
4018
4019 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4021 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4022 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4023 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4024
4025 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4026 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4027 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4028 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4029
4030 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4031 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4032 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4033 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4034
4035 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4036 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4037 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4038 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4039
4040 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4041 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4042 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4043 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4044
4045 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4046 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4047
4048 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4049 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4050 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4051 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4052
4053 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4054 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4055 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4056 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4057
4058 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4059 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4060
4061 cfg.validator_validate_metadata_cost_base = Some(20000);
4062 }
4063 71 => {
4064 cfg.sip_45_consensus_amplification_threshold = Some(5);
4065
4066 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4068 }
4069 72 => {
4070 cfg.feature_flags.convert_type_argument_error = true;
4071
4072 cfg.max_tx_gas = Some(50_000_000_000_000);
4075 cfg.max_gas_price = Some(50_000_000_000);
4077
4078 cfg.feature_flags.variant_nodes = true;
4079 }
4080 73 => {
4081 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4083
4084 if chain != Chain::Mainnet && chain != Chain::Testnet {
4085 cfg.consensus_gc_depth = Some(60);
4088 }
4089
4090 if chain != Chain::Mainnet {
4091 cfg.feature_flags.consensus_zstd_compression = true;
4093 }
4094
4095 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4097 cfg.feature_flags
4099 .consensus_round_prober_probe_accepted_rounds = true;
4100
4101 cfg.feature_flags.per_object_congestion_control_mode =
4103 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4104 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4105 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4106 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4107 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4109 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4110 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4111 }
4112 74 => {
4113 if chain != Chain::Mainnet && chain != Chain::Testnet {
4115 cfg.feature_flags.enable_nitro_attestation = true;
4116 }
4117 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4118 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4119 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4120 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4121
4122 cfg.feature_flags.consensus_zstd_compression = true;
4124
4125 if chain != Chain::Mainnet && chain != Chain::Testnet {
4126 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4127 }
4128 }
4129 75 => {
4130 if chain != Chain::Mainnet {
4131 cfg.feature_flags.passkey_auth = true;
4132 }
4133 }
4134 76 => {
4135 if chain != Chain::Mainnet && chain != Chain::Testnet {
4136 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4137 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4138 }
4139 cfg.feature_flags.minimize_child_object_mutations = true;
4140
4141 if chain != Chain::Mainnet {
4142 cfg.feature_flags.accept_passkey_in_multisig = true;
4143 }
4144 }
4145 77 => {
4146 cfg.feature_flags.uncompressed_g1_group_elements = true;
4147
4148 if chain != Chain::Mainnet {
4149 cfg.consensus_gc_depth = Some(60);
4150 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4151 }
4152 }
4153 78 => {
4154 cfg.feature_flags.move_native_context = true;
4155 cfg.tx_context_fresh_id_cost_base = Some(52);
4156 cfg.tx_context_sender_cost_base = Some(30);
4157 cfg.tx_context_epoch_cost_base = Some(30);
4158 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4159 cfg.tx_context_sponsor_cost_base = Some(30);
4160 cfg.tx_context_gas_price_cost_base = Some(30);
4161 cfg.tx_context_gas_budget_cost_base = Some(30);
4162 cfg.tx_context_ids_created_cost_base = Some(30);
4163 cfg.tx_context_replace_cost_base = Some(30);
4164 cfg.gas_model_version = Some(10);
4165
4166 if chain != Chain::Mainnet {
4167 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4168 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4169
4170 cfg.feature_flags.per_object_congestion_control_mode =
4172 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4173 ExecutionTimeEstimateParams {
4174 target_utilization: 30,
4175 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4177 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4179 stored_observations_limit: u64::MAX,
4180 stake_weighted_median_threshold: 0,
4181 default_none_duration_for_new_keys: false,
4182 observations_chunk_size: None,
4183 },
4184 );
4185 }
4186 }
4187 79 => {
4188 if chain != Chain::Mainnet {
4189 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4190
4191 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4194
4195 cfg.feature_flags.consensus_batched_block_sync = true;
4196
4197 cfg.feature_flags.enable_nitro_attestation = true
4199 }
4200 cfg.feature_flags.normalize_ptb_arguments = true;
4201
4202 cfg.consensus_gc_depth = Some(60);
4203 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4204 }
4205 80 => {
4206 cfg.max_ptb_value_size = Some(1024 * 1024);
4207 }
4208 81 => {
4209 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4210 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4211 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4212 }
4213 82 => {
4214 cfg.feature_flags.max_ptb_value_size_v2 = true;
4215 }
4216 83 => {
4217 if chain == Chain::Mainnet {
4218 let aliased: [u8; 32] = Hex::decode(
4220 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4221 )
4222 .unwrap()
4223 .try_into()
4224 .unwrap();
4225
4226 cfg.aliased_addresses.push(AliasedAddress {
4228 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4229 aliased,
4230 allowed_tx_digests: vec![
4231 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4232 ],
4233 });
4234
4235 cfg.aliased_addresses.push(AliasedAddress {
4236 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4237 aliased,
4238 allowed_tx_digests: vec![
4239 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4240 ],
4241 });
4242 }
4243
4244 if chain != Chain::Mainnet {
4247 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4248 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4249
4250 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4252 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4253 cfg.feature_flags.per_object_congestion_control_mode =
4254 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4255 ExecutionTimeEstimateParams {
4256 target_utilization: 30,
4257 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4259 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4261 stored_observations_limit: u64::MAX,
4262 stake_weighted_median_threshold: 0,
4263 default_none_duration_for_new_keys: false,
4264 observations_chunk_size: None,
4265 },
4266 );
4267
4268 cfg.feature_flags.consensus_batched_block_sync = true;
4270
4271 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4274 cfg.feature_flags.enable_nitro_attestation = true;
4275 }
4276 }
4277 84 => {
4278 if chain == Chain::Mainnet {
4279 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4280 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4281
4282 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4284 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4285 cfg.feature_flags.per_object_congestion_control_mode =
4286 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4287 ExecutionTimeEstimateParams {
4288 target_utilization: 30,
4289 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4291 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4293 stored_observations_limit: u64::MAX,
4294 stake_weighted_median_threshold: 0,
4295 default_none_duration_for_new_keys: false,
4296 observations_chunk_size: None,
4297 },
4298 );
4299
4300 cfg.feature_flags.consensus_batched_block_sync = true;
4302
4303 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4306 cfg.feature_flags.enable_nitro_attestation = true;
4307 }
4308
4309 cfg.feature_flags.per_object_congestion_control_mode =
4311 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4312 ExecutionTimeEstimateParams {
4313 target_utilization: 30,
4314 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4316 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4318 stored_observations_limit: 20,
4319 stake_weighted_median_threshold: 0,
4320 default_none_duration_for_new_keys: false,
4321 observations_chunk_size: None,
4322 },
4323 );
4324 cfg.feature_flags.allow_unbounded_system_objects = true;
4325 }
4326 85 => {
4327 if chain != Chain::Mainnet && chain != Chain::Testnet {
4328 cfg.feature_flags.enable_party_transfer = true;
4329 }
4330
4331 cfg.feature_flags
4332 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4333 cfg.feature_flags.disallow_self_identifier = true;
4334 cfg.feature_flags.per_object_congestion_control_mode =
4335 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4336 ExecutionTimeEstimateParams {
4337 target_utilization: 50,
4338 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4340 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4342 stored_observations_limit: 20,
4343 stake_weighted_median_threshold: 0,
4344 default_none_duration_for_new_keys: false,
4345 observations_chunk_size: None,
4346 },
4347 );
4348 }
4349 86 => {
4350 cfg.feature_flags.type_tags_in_object_runtime = true;
4351 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4352
4353 cfg.feature_flags.per_object_congestion_control_mode =
4355 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4356 ExecutionTimeEstimateParams {
4357 target_utilization: 50,
4358 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4360 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4362 stored_observations_limit: 20,
4363 stake_weighted_median_threshold: 3334,
4364 default_none_duration_for_new_keys: false,
4365 observations_chunk_size: None,
4366 },
4367 );
4368 if chain != Chain::Mainnet {
4370 cfg.feature_flags.enable_party_transfer = true;
4371 }
4372 }
4373 87 => {
4374 if chain == Chain::Mainnet {
4375 cfg.feature_flags.record_time_estimate_processed = true;
4376 }
4377 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4378 }
4379 88 => {
4380 cfg.feature_flags.record_time_estimate_processed = true;
4381 cfg.tx_context_rgp_cost_base = Some(30);
4382 cfg.feature_flags
4383 .ignore_execution_time_observations_after_certs_closed = true;
4384
4385 cfg.feature_flags.per_object_congestion_control_mode =
4388 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4389 ExecutionTimeEstimateParams {
4390 target_utilization: 50,
4391 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4393 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4395 stored_observations_limit: 20,
4396 stake_weighted_median_threshold: 3334,
4397 default_none_duration_for_new_keys: true,
4398 observations_chunk_size: None,
4399 },
4400 );
4401 }
4402 89 => {
4403 cfg.feature_flags.dependency_linkage_error = true;
4404 cfg.feature_flags.additional_multisig_checks = true;
4405 }
4406 90 => {
4407 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4409 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4410 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4411 cfg.feature_flags.accept_passkey_in_multisig = true;
4412 cfg.feature_flags.passkey_auth = true;
4413 cfg.feature_flags.check_for_init_during_upgrade = true;
4414
4415 if chain != Chain::Mainnet {
4417 cfg.feature_flags.mysticeti_fastpath = true;
4418 }
4419 }
4420 91 => {
4421 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4422 }
4423 92 => {
4424 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4425 }
4426 93 => {
4427 cfg.feature_flags
4428 .consensus_checkpoint_signature_key_includes_digest = true;
4429 }
4430 94 => {
4431 cfg.feature_flags.per_object_congestion_control_mode =
4433 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4434 ExecutionTimeEstimateParams {
4435 target_utilization: 50,
4436 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4438 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4440 stored_observations_limit: 18,
4441 stake_weighted_median_threshold: 3334,
4442 default_none_duration_for_new_keys: true,
4443 observations_chunk_size: None,
4444 },
4445 );
4446
4447 cfg.feature_flags.enable_party_transfer = true;
4449 }
4450 95 => {
4451 cfg.type_name_id_base_cost = Some(52);
4452
4453 cfg.max_transactions_per_checkpoint = Some(20_000);
4455 }
4456 96 => {
4457 if chain != Chain::Mainnet && chain != Chain::Testnet {
4459 cfg.feature_flags
4460 .include_checkpoint_artifacts_digest_in_summary = true;
4461 }
4462 cfg.feature_flags.correct_gas_payment_limit_check = true;
4463 cfg.feature_flags.authority_capabilities_v2 = true;
4464 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4465 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4466 cfg.feature_flags.enable_coin_registry = true;
4467
4468 cfg.feature_flags.mysticeti_fastpath = true;
4470 }
4471 97 => {
4472 cfg.feature_flags.additional_borrow_checks = true;
4473 }
4474 98 => {
4475 cfg.event_emit_auth_stream_cost = Some(52);
4476 cfg.feature_flags.better_loader_errors = true;
4477 cfg.feature_flags.generate_df_type_layouts = true;
4478 }
4479 99 => {
4480 cfg.feature_flags.use_new_commit_handler = true;
4481 }
4482 100 => {
4483 cfg.feature_flags.private_generics_verifier_v2 = true;
4484 }
4485 101 => {
4486 cfg.feature_flags.create_root_accumulator_object = true;
4487 cfg.max_updates_per_settlement_txn = Some(100);
4488 if chain != Chain::Mainnet {
4489 cfg.feature_flags.enable_poseidon = true;
4490 }
4491 }
4492 102 => {
4493 cfg.feature_flags.per_object_congestion_control_mode =
4497 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4498 ExecutionTimeEstimateParams {
4499 target_utilization: 50,
4500 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4502 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4504 stored_observations_limit: 180,
4505 stake_weighted_median_threshold: 3334,
4506 default_none_duration_for_new_keys: true,
4507 observations_chunk_size: Some(18),
4508 },
4509 );
4510 cfg.feature_flags.deprecate_global_storage_ops = true;
4511 }
4512 103 => {}
4513 104 => {
4514 cfg.translation_per_command_base_charge = Some(1);
4515 cfg.translation_per_input_base_charge = Some(1);
4516 cfg.translation_pure_input_per_byte_charge = Some(1);
4517 cfg.translation_per_type_node_charge = Some(1);
4518 cfg.translation_per_reference_node_charge = Some(1);
4519 cfg.translation_per_linkage_entry_charge = Some(10);
4520 cfg.gas_model_version = Some(11);
4521 cfg.feature_flags.abstract_size_in_object_runtime = true;
4522 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4523 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4524 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4525 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4526 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4527 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4528 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4529 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4530 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4531 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4532 cfg.feature_flags.enable_ptb_execution_v2 = true;
4533
4534 cfg.poseidon_bn254_cost_base = Some(260);
4535
4536 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4537
4538 if chain != Chain::Mainnet {
4539 cfg.feature_flags
4540 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4541 }
4542
4543 cfg.feature_flags
4544 .include_cancelled_randomness_txns_in_prologue = true;
4545 }
4546 105 => {
4547 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4548 cfg.feature_flags.disable_preconsensus_locking = true;
4549
4550 if chain != Chain::Mainnet {
4551 cfg.feature_flags
4552 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4553 }
4554 }
4555 106 => {
4556 cfg.accumulator_object_storage_cost = Some(7600);
4558
4559 if chain != Chain::Mainnet && chain != Chain::Testnet {
4560 cfg.feature_flags.enable_accumulators = true;
4561 cfg.feature_flags.enable_address_balance_gas_payments = true;
4562 cfg.feature_flags.enable_authenticated_event_streams = true;
4563 cfg.feature_flags.enable_object_funds_withdraw = true;
4564 }
4565 }
4566 107 => {
4567 cfg.feature_flags
4568 .consensus_skip_gced_blocks_in_direct_finalization = true;
4569
4570 if in_integration_test() {
4572 cfg.consensus_gc_depth = Some(6);
4573 cfg.consensus_max_num_transactions_in_block = Some(8);
4574 }
4575 }
4576 108 => {
4577 cfg.feature_flags.gas_rounding_halve_digits = true;
4578 cfg.feature_flags.flexible_tx_context_positions = true;
4579 cfg.feature_flags.disable_entry_point_signature_check = true;
4580
4581 if chain != Chain::Mainnet {
4582 cfg.feature_flags.address_aliases = true;
4583
4584 cfg.feature_flags.enable_accumulators = true;
4585 cfg.feature_flags.enable_address_balance_gas_payments = true;
4586 }
4587
4588 cfg.feature_flags.enable_poseidon = true;
4589 }
4590 109 => {
4591 cfg.binary_variant_handles = Some(1024);
4592 cfg.binary_variant_instantiation_handles = Some(1024);
4593 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4594 }
4595 110 => {
4596 cfg.feature_flags
4597 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4598 cfg.feature_flags
4599 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4600 if chain != Chain::Mainnet && chain != Chain::Testnet {
4601 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4602 }
4603 cfg.feature_flags.validate_zklogin_public_identifier = true;
4604 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4605 cfg.feature_flags
4606 .consensus_always_accept_system_transactions = true;
4607 if chain != Chain::Mainnet {
4608 cfg.feature_flags.enable_object_funds_withdraw = true;
4609 }
4610 }
4611 111 => {
4612 cfg.feature_flags.validator_metadata_verify_v2 = true;
4613 }
4614 112 => {
4615 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4616 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4617 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4618 cfg.group_ops_ristretto_point_add_cost = Some(500);
4619 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4620 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4621 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4622 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4623 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4624 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4625
4626 if chain != Chain::Mainnet && chain != Chain::Testnet {
4627 cfg.feature_flags.enable_ristretto255_group_ops = true;
4628 }
4629 }
4630 113 => {
4631 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4632 if chain != Chain::Mainnet && chain != Chain::Testnet {
4633 cfg.feature_flags.defer_unpaid_amplification = true;
4634 }
4635 }
4636 114 => {
4637 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4638 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4639 if chain != Chain::Mainnet {
4640 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4641 cfg.feature_flags.enable_authenticated_event_streams = true;
4642 cfg.feature_flags
4643 .include_checkpoint_artifacts_digest_in_summary = true;
4644 }
4645 cfg.feature_flags.defer_unpaid_amplification = false;
4647 }
4648 115 => {
4649 cfg.feature_flags.gasless_transaction_drop_safety = true;
4650 cfg.feature_flags.address_aliases = true;
4651 }
4652 _ => panic!("unsupported version {:?}", version),
4663 }
4664 }
4665
4666 cfg
4667 }
4668
4669 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4670 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4671 || !self.feature_flags.split_checkpoints_in_consensus_handler
4672 {
4673 return;
4674 }
4675
4676 if !mysten_common::in_test_configuration() {
4677 return;
4678 }
4679
4680 use rand::{Rng, SeedableRng, rngs::StdRng};
4681 let mut rng = StdRng::from_seed(*seed);
4682 let max_txns = rng.gen_range(10..=100u64);
4683 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4684 self.max_transactions_per_checkpoint = Some(max_txns);
4685 }
4686
4687 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4693 let (
4694 max_back_edges_per_function,
4695 max_back_edges_per_module,
4696 sanity_check_with_regex_reference_safety,
4697 ) = if let Some((
4698 max_back_edges_per_function,
4699 max_back_edges_per_module,
4700 sanity_check_with_regex_reference_safety,
4701 )) = signing_limits
4702 {
4703 (
4704 Some(max_back_edges_per_function),
4705 Some(max_back_edges_per_module),
4706 Some(sanity_check_with_regex_reference_safety),
4707 )
4708 } else {
4709 (None, None, None)
4710 };
4711
4712 let additional_borrow_checks = if signing_limits.is_some() {
4713 true
4715 } else {
4716 self.additional_borrow_checks()
4717 };
4718 let deprecate_global_storage_ops = if signing_limits.is_some() {
4719 true
4721 } else {
4722 self.deprecate_global_storage_ops()
4723 };
4724
4725 VerifierConfig {
4726 max_loop_depth: Some(self.max_loop_depth() as usize),
4727 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4728 max_function_parameters: Some(self.max_function_parameters() as usize),
4729 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4730 max_value_stack_size: self.max_value_stack_size() as usize,
4731 max_type_nodes: Some(self.max_type_nodes() as usize),
4732 max_push_size: Some(self.max_push_size() as usize),
4733 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4734 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4735 max_function_definitions: Some(self.max_function_definitions() as usize),
4736 max_data_definitions: Some(self.max_struct_definitions() as usize),
4737 max_constant_vector_len: Some(self.max_move_vector_len()),
4738 max_back_edges_per_function,
4739 max_back_edges_per_module,
4740 max_basic_blocks_in_script: None,
4741 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4743 allow_receiving_object_id: self.allow_receiving_object_id(),
4744 reject_mutable_random_on_entry_functions: self
4745 .reject_mutable_random_on_entry_functions(),
4746 bytecode_version: self.move_binary_format_version(),
4747 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4748 additional_borrow_checks,
4749 better_loader_errors: self.better_loader_errors(),
4750 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4751 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4752 .map(|limit| limit as u128),
4753 deprecate_global_storage_ops,
4754 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4755 switch_to_regex_reference_safety: false,
4756 }
4757 }
4758
4759 pub fn binary_config(
4760 &self,
4761 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4762 ) -> BinaryConfig {
4763 let deprecate_global_storage_ops =
4764 override_deprecate_global_storage_ops_during_deserialization
4765 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4766 BinaryConfig::new(
4767 self.move_binary_format_version(),
4768 self.min_move_binary_format_version_as_option()
4769 .unwrap_or(VERSION_1),
4770 self.no_extraneous_module_bytes(),
4771 deprecate_global_storage_ops,
4772 TableConfig {
4773 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4774 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4775 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4776 function_instantiations: self
4777 .binary_function_instantiations_as_option()
4778 .unwrap_or(u16::MAX),
4779 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4780 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4781 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4782 address_identifiers: self
4783 .binary_address_identifiers_as_option()
4784 .unwrap_or(u16::MAX),
4785 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4786 struct_def_instantiations: self
4787 .binary_struct_def_instantiations_as_option()
4788 .unwrap_or(u16::MAX),
4789 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4790 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4791 field_instantiations: self
4792 .binary_field_instantiations_as_option()
4793 .unwrap_or(u16::MAX),
4794 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4795 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4796 enum_def_instantiations: self
4797 .binary_enum_def_instantiations_as_option()
4798 .unwrap_or(u16::MAX),
4799 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4800 variant_instantiation_handles: self
4801 .binary_variant_instantiation_handles_as_option()
4802 .unwrap_or(u16::MAX),
4803 },
4804 )
4805 }
4806
4807 pub fn apply_overrides_for_testing(
4811 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4812 ) -> OverrideGuard {
4813 CONFIG_OVERRIDE.with(|ovr| {
4814 let mut cur = ovr.borrow_mut();
4815 assert!(cur.is_none(), "config override already present");
4816 *cur = Some(Box::new(override_fn));
4817 OverrideGuard
4818 })
4819 }
4820}
4821
4822impl ProtocolConfig {
4826 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4827 self.feature_flags
4828 .advance_to_highest_supported_protocol_version = val
4829 }
4830 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4831 self.feature_flags.commit_root_state_digest = val
4832 }
4833 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4834 self.feature_flags.zklogin_auth = val
4835 }
4836 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4837 self.feature_flags.enable_jwk_consensus_updates = val
4838 }
4839 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4840 self.feature_flags.random_beacon = val
4841 }
4842
4843 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4844 self.feature_flags.upgraded_multisig_supported = val
4845 }
4846 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4847 self.feature_flags.accept_zklogin_in_multisig = val
4848 }
4849
4850 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4851 self.feature_flags.shared_object_deletion = val;
4852 }
4853
4854 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4855 self.feature_flags.narwhal_new_leader_election_schedule = val;
4856 }
4857
4858 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4859 self.feature_flags.receive_objects = val
4860 }
4861 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4862 self.feature_flags.narwhal_certificate_v2 = val
4863 }
4864 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4865 self.feature_flags.verify_legacy_zklogin_address = val
4866 }
4867
4868 pub fn set_per_object_congestion_control_mode_for_testing(
4869 &mut self,
4870 val: PerObjectCongestionControlMode,
4871 ) {
4872 self.feature_flags.per_object_congestion_control_mode = val;
4873 }
4874
4875 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4876 self.feature_flags.consensus_choice = val;
4877 }
4878
4879 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4880 self.feature_flags.consensus_network = val;
4881 }
4882
4883 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4884 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4885 }
4886
4887 pub fn set_disable_bridge_for_testing(&mut self) {
4888 self.feature_flags.bridge = false
4889 }
4890
4891 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4892 self.feature_flags.mysticeti_num_leaders_per_round = val;
4893 }
4894
4895 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4896 self.feature_flags.soft_bundle = val;
4897 }
4898
4899 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4900 self.feature_flags.passkey_auth = val
4901 }
4902
4903 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4904 self.feature_flags.enable_party_transfer = val
4905 }
4906
4907 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4908 self.feature_flags
4909 .consensus_distributed_vote_scoring_strategy = val;
4910 }
4911
4912 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4913 self.feature_flags.consensus_round_prober = val;
4914 }
4915
4916 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4917 self.feature_flags
4918 .disallow_new_modules_in_deps_only_packages = val;
4919 }
4920
4921 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4922 self.feature_flags.correct_gas_payment_limit_check = val;
4923 }
4924
4925 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4926 self.feature_flags.address_aliases = val;
4927 }
4928
4929 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4930 self.feature_flags
4931 .consensus_round_prober_probe_accepted_rounds = val;
4932 }
4933
4934 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4935 self.feature_flags.mysticeti_fastpath = val;
4936 }
4937
4938 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4939 self.feature_flags.accept_passkey_in_multisig = val;
4940 }
4941
4942 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4943 self.feature_flags.consensus_batched_block_sync = val;
4944 }
4945
4946 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4947 self.feature_flags.record_time_estimate_processed = val;
4948 }
4949
4950 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4951 &mut self,
4952 val: bool,
4953 ) {
4954 self.feature_flags
4955 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4956 }
4957
4958 pub fn enable_accumulators_for_testing(&mut self) {
4959 self.feature_flags.enable_accumulators = true;
4960 }
4961
4962 pub fn disable_accumulators_for_testing(&mut self) {
4963 self.feature_flags.enable_accumulators = false;
4964 self.feature_flags.enable_address_balance_gas_payments = false;
4965 }
4966
4967 pub fn enable_coin_reservation_for_testing(&mut self) {
4968 self.feature_flags.enable_coin_reservation_obj_refs = true;
4969 }
4970
4971 pub fn create_root_accumulator_object_for_testing(&mut self) {
4972 self.feature_flags.create_root_accumulator_object = true;
4973 }
4974
4975 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
4976 self.feature_flags.create_root_accumulator_object = false;
4977 }
4978
4979 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
4980 self.feature_flags.enable_accumulators = true;
4981 self.feature_flags.allow_private_accumulator_entrypoints = true;
4982 self.feature_flags.enable_address_balance_gas_payments = true;
4983 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4984 self.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4985 }
4986
4987 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
4988 self.feature_flags.enable_address_balance_gas_payments = false;
4989 }
4990
4991 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
4992 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
4993 }
4994
4995 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
4996 self.enable_accumulators_for_testing();
4997 self.feature_flags.enable_authenticated_event_streams = true;
4998 self.feature_flags
4999 .include_checkpoint_artifacts_digest_in_summary = true;
5000 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5001 }
5002
5003 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5004 self.feature_flags.enable_authenticated_event_streams = false;
5005 }
5006
5007 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5008 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5009 }
5010
5011 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5012 self.feature_flags.enable_non_exclusive_writes = true;
5013 }
5014
5015 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5016 &mut self,
5017 val: bool,
5018 ) {
5019 self.feature_flags
5020 .ignore_execution_time_observations_after_certs_closed = val;
5021 }
5022
5023 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5024 &mut self,
5025 val: bool,
5026 ) {
5027 self.feature_flags
5028 .consensus_checkpoint_signature_key_includes_digest = val;
5029 }
5030
5031 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5032 self.feature_flags.cancel_for_failed_dkg_early = val;
5033 }
5034
5035 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5036 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5037 }
5038
5039 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5040 self.feature_flags.authority_capabilities_v2 = val;
5041 }
5042
5043 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5044 self.feature_flags.allow_references_in_ptbs = true;
5045 }
5046
5047 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5048 self.feature_flags.consensus_skip_gced_accept_votes = val;
5049 }
5050
5051 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5052 self.feature_flags.enable_object_funds_withdraw = val;
5053 }
5054
5055 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5056 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5057 }
5058}
5059
5060type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5061
5062thread_local! {
5063 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5064}
5065
5066#[must_use]
5067pub struct OverrideGuard;
5068
5069impl Drop for OverrideGuard {
5070 fn drop(&mut self) {
5071 info!("restoring override fn");
5072 CONFIG_OVERRIDE.with(|ovr| {
5073 *ovr.borrow_mut() = None;
5074 });
5075 }
5076}
5077
5078#[derive(PartialEq, Eq)]
5081pub enum LimitThresholdCrossed {
5082 None,
5083 Soft(u128, u128),
5084 Hard(u128, u128),
5085}
5086
5087pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5090 x: T,
5091 soft_limit: U,
5092 hard_limit: V,
5093) -> LimitThresholdCrossed {
5094 let x: V = x.into();
5095 let soft_limit: V = soft_limit.into();
5096
5097 debug_assert!(soft_limit <= hard_limit);
5098
5099 if x >= hard_limit {
5102 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5103 } else if x < soft_limit {
5104 LimitThresholdCrossed::None
5105 } else {
5106 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5107 }
5108}
5109
5110#[macro_export]
5111macro_rules! check_limit {
5112 ($x:expr, $hard:expr) => {
5113 check_limit!($x, $hard, $hard)
5114 };
5115 ($x:expr, $soft:expr, $hard:expr) => {
5116 check_limit_in_range($x as u64, $soft, $hard)
5117 };
5118}
5119
5120#[macro_export]
5124macro_rules! check_limit_by_meter {
5125 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5126 let (h, metered_str) = if $is_metered {
5128 ($metered_limit, "metered")
5129 } else {
5130 ($unmetered_hard_limit, "unmetered")
5132 };
5133 use sui_protocol_config::check_limit_in_range;
5134 let result = check_limit_in_range($x as u64, $metered_limit, h);
5135 match result {
5136 LimitThresholdCrossed::None => {}
5137 LimitThresholdCrossed::Soft(_, _) => {
5138 $metric.with_label_values(&[metered_str, "soft"]).inc();
5139 }
5140 LimitThresholdCrossed::Hard(_, _) => {
5141 $metric.with_label_values(&[metered_str, "hard"]).inc();
5142 }
5143 };
5144 result
5145 }};
5146}
5147#[cfg(all(test, not(msim)))]
5148mod test {
5149 use insta::assert_yaml_snapshot;
5150
5151 use super::*;
5152
5153 #[test]
5154 fn snapshot_tests() {
5155 println!("\n============================================================================");
5156 println!("! !");
5157 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5158 println!("! !");
5159 println!("============================================================================\n");
5160 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5161 let chain_str = match chain_id {
5165 Chain::Unknown => "".to_string(),
5166 _ => format!("{:?}_", chain_id),
5167 };
5168 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5169 let cur = ProtocolVersion::new(i);
5170 assert_yaml_snapshot!(
5171 format!("{}version_{}", chain_str, cur.as_u64()),
5172 ProtocolConfig::get_for_version(cur, *chain_id)
5173 );
5174 }
5175 }
5176 }
5177
5178 #[test]
5179 fn test_getters() {
5180 let prot: ProtocolConfig =
5181 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5182 assert_eq!(
5183 prot.max_arguments(),
5184 prot.max_arguments_as_option().unwrap()
5185 );
5186 }
5187
5188 #[test]
5189 fn test_setters() {
5190 let mut prot: ProtocolConfig =
5191 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5192 prot.set_max_arguments_for_testing(123);
5193 assert_eq!(prot.max_arguments(), 123);
5194
5195 prot.set_max_arguments_from_str_for_testing("321".to_string());
5196 assert_eq!(prot.max_arguments(), 321);
5197
5198 prot.disable_max_arguments_for_testing();
5199 assert_eq!(prot.max_arguments_as_option(), None);
5200
5201 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5202 assert_eq!(prot.max_arguments(), 456);
5203 }
5204
5205 #[test]
5206 #[should_panic(expected = "unsupported version")]
5207 fn max_version_test() {
5208 let _ = ProtocolConfig::get_for_version_impl(
5211 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5212 Chain::Unknown,
5213 );
5214 }
5215
5216 #[test]
5217 fn lookup_by_string_test() {
5218 let prot: ProtocolConfig =
5219 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5220 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5222
5223 assert!(
5224 prot.lookup_attr("max_arguments".to_string())
5225 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5226 );
5227
5228 assert!(
5230 prot.lookup_attr("max_move_identifier_len".to_string())
5231 .is_none()
5232 );
5233
5234 let prot: ProtocolConfig =
5236 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5237 assert!(
5238 prot.lookup_attr("max_move_identifier_len".to_string())
5239 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5240 );
5241
5242 let prot: ProtocolConfig =
5243 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5244 assert!(
5246 prot.attr_map()
5247 .get("max_move_identifier_len")
5248 .unwrap()
5249 .is_none()
5250 );
5251 assert!(
5253 prot.attr_map().get("max_arguments").unwrap()
5254 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5255 );
5256
5257 let prot: ProtocolConfig =
5259 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5260 assert!(
5262 prot.feature_flags
5263 .lookup_attr("some random string".to_owned())
5264 .is_none()
5265 );
5266 assert!(
5267 !prot
5268 .feature_flags
5269 .attr_map()
5270 .contains_key("some random string")
5271 );
5272
5273 assert!(
5275 prot.feature_flags
5276 .lookup_attr("package_upgrades".to_owned())
5277 == Some(false)
5278 );
5279 assert!(
5280 prot.feature_flags
5281 .attr_map()
5282 .get("package_upgrades")
5283 .unwrap()
5284 == &false
5285 );
5286 let prot: ProtocolConfig =
5287 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5288 assert!(
5290 prot.feature_flags
5291 .lookup_attr("package_upgrades".to_owned())
5292 == Some(true)
5293 );
5294 assert!(
5295 prot.feature_flags
5296 .attr_map()
5297 .get("package_upgrades")
5298 .unwrap()
5299 == &true
5300 );
5301 }
5302
5303 #[test]
5304 fn limit_range_fn_test() {
5305 let low = 100u32;
5306 let high = 10000u64;
5307
5308 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5309 assert!(matches!(
5310 check_limit!(255u16, low, high),
5311 LimitThresholdCrossed::Soft(255u128, 100)
5312 ));
5313 assert!(matches!(
5319 check_limit!(2550000u64, low, high),
5320 LimitThresholdCrossed::Hard(2550000, 10000)
5321 ));
5322
5323 assert!(matches!(
5324 check_limit!(2550000u64, high, high),
5325 LimitThresholdCrossed::Hard(2550000, 10000)
5326 ));
5327
5328 assert!(matches!(
5329 check_limit!(1u8, high),
5330 LimitThresholdCrossed::None
5331 ));
5332
5333 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5334
5335 assert!(matches!(
5336 check_limit!(2550000u64, high),
5337 LimitThresholdCrossed::Hard(2550000, 10000)
5338 ));
5339 }
5340}