1use std::{
5 collections::{BTreeMap, BTreeSet},
6 sync::{
7 Arc, LazyLock,
8 atomic::{AtomicBool, Ordering},
9 },
10};
11
12use std::sync::Mutex;
13
14use clap::*;
15use fastcrypto::encoding::{Base58, Encoding, Hex};
16use move_binary_format::{
17 binary_config::{BinaryConfig, BinaryFormatLimitsProfile, TableConfig},
18 file_format_common::*,
19};
20use move_core_types::account_address::AccountAddress;
21use move_vm_config::verifier::VerifierConfig;
22use mysten_common::in_integration_test;
23use serde::{Deserialize, Serialize};
24use serde_with::skip_serializing_none;
25use sui_protocol_config_macros::{
26 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
27};
28use tracing::{info, warn};
29
30pub mod reachability;
31
32#[doc(hidden)]
35pub use antithesis_sdk::linkme;
36#[doc(hidden)]
37pub use mysten_common::assert_reachable_simtest;
38
39const MIN_PROTOCOL_VERSION: u64 = 1;
41const MAX_PROTOCOL_VERSION: u64 = 146;
42
43const TESTNET_USDC: &str =
44 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
45
46const MAINNET_USDC: &str =
47 "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
48const MAINNET_USDSUI: &str =
49 "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
50const MAINNET_SUI_USDE: &str =
51 "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
52const MAINNET_USDY: &str =
53 "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY";
54const MAINNET_FDUSD: &str =
55 "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD";
56const MAINNET_AUSD: &str =
57 "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD";
58const MAINNET_USDB: &str =
59 "0xe14726c336e81b32328e92afc37345d159f5b550b09fa92bd43640cfdd0a0cfd::usdb::USDB";
60
61#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
462pub struct ProtocolVersion(u64);
463
464impl ProtocolVersion {
465 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
470
471 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
472
473 #[cfg(not(msim))]
474 pub const MAX_ALLOWED: Self = Self::MAX;
475
476 #[cfg(msim)]
478 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
479
480 pub fn new(v: u64) -> Self {
481 Self(v)
482 }
483
484 pub const fn as_u64(&self) -> u64 {
485 self.0
486 }
487
488 pub fn max() -> Self {
491 Self::MAX
492 }
493
494 pub fn prev(self) -> Self {
495 Self(self.0.checked_sub(1).unwrap())
496 }
497}
498
499impl From<u64> for ProtocolVersion {
500 fn from(v: u64) -> Self {
501 Self::new(v)
502 }
503}
504
505impl std::ops::Sub<u64> for ProtocolVersion {
506 type Output = Self;
507 fn sub(self, rhs: u64) -> Self::Output {
508 Self::new(self.0 - rhs)
509 }
510}
511
512impl std::ops::Add<u64> for ProtocolVersion {
513 type Output = Self;
514 fn add(self, rhs: u64) -> Self::Output {
515 Self::new(self.0 + rhs)
516 }
517}
518
519#[derive(
520 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
521)]
522pub enum Chain {
523 Mainnet,
524 Testnet,
525 #[default]
526 Unknown,
527}
528
529impl Chain {
530 pub fn as_str(self) -> &'static str {
531 match self {
532 Chain::Mainnet => "mainnet",
533 Chain::Testnet => "testnet",
534 Chain::Unknown => "unknown",
535 }
536 }
537}
538
539pub fn max_across_protocol<T: Ord>(f: impl Fn(&ProtocolConfig) -> Option<T>) -> Option<T> {
541 let mut max = None;
542 let mut version = ProtocolVersion::MIN;
543 while version <= ProtocolVersion::MAX {
544 max = max.max(f(&ProtocolConfig::get_for_version(version, Chain::Unknown)));
545 max = max.max(f(&ProtocolConfig::get_for_version(version, Chain::Mainnet)));
546 max = max.max(f(&ProtocolConfig::get_for_version(version, Chain::Testnet)));
547 version = version + 1;
548 }
549 max
550}
551
552pub struct Error(pub String);
553
554#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
557struct FeatureFlags {
558 #[serde(skip_serializing_if = "is_false")]
561 package_upgrades: bool,
562 #[serde(skip_serializing_if = "is_false")]
565 commit_root_state_digest: bool,
566 #[serde(skip_serializing_if = "is_false")]
568 advance_epoch_start_time_in_safe_mode: bool,
569 #[serde(skip_serializing_if = "is_false")]
572 loaded_child_objects_fixed: bool,
573 #[serde(skip_serializing_if = "is_false")]
576 missing_type_is_compatibility_error: bool,
577 #[serde(skip_serializing_if = "is_false")]
580 scoring_decision_with_validity_cutoff: bool,
581
582 #[serde(skip_serializing_if = "is_false")]
585 consensus_order_end_of_epoch_last: bool,
586
587 #[serde(skip_serializing_if = "is_false")]
591 consensus_slim_block_propagation: bool,
592
593 #[serde(skip_serializing_if = "is_false")]
595 disallow_adding_abilities_on_upgrade: bool,
596 #[serde(skip_serializing_if = "is_false")]
598 disable_invariant_violation_check_in_swap_loc: bool,
599 #[serde(skip_serializing_if = "is_false")]
602 advance_to_highest_supported_protocol_version: bool,
603 #[serde(skip_serializing_if = "is_false")]
605 ban_entry_init: bool,
606 #[serde(skip_serializing_if = "is_false")]
608 package_digest_hash_module: bool,
609 #[serde(skip_serializing_if = "is_false")]
611 disallow_change_struct_type_params_on_upgrade: bool,
612 #[serde(skip_serializing_if = "is_false")]
614 no_extraneous_module_bytes: bool,
615 #[serde(skip_serializing_if = "is_false")]
617 narwhal_versioned_metadata: bool,
618
619 #[serde(skip_serializing_if = "is_false")]
621 zklogin_auth: bool,
622 #[serde(skip_serializing_if = "is_zero")]
625 zklogin_circuit_mode: u64,
626 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
628 consensus_transaction_ordering: ConsensusTransactionOrdering,
629
630 #[serde(skip_serializing_if = "is_false")]
638 simplified_unwrap_then_delete: bool,
639 #[serde(skip_serializing_if = "is_false")]
641 upgraded_multisig_supported: bool,
642 #[serde(skip_serializing_if = "is_false")]
644 txn_base_cost_as_multiplier: bool,
645
646 #[serde(skip_serializing_if = "is_false")]
648 shared_object_deletion: bool,
649
650 #[serde(skip_serializing_if = "is_false")]
652 narwhal_new_leader_election_schedule: bool,
653
654 #[serde(skip_serializing_if = "is_empty")]
656 zklogin_supported_providers: BTreeSet<String>,
657
658 #[serde(skip_serializing_if = "is_false")]
660 loaded_child_object_format: bool,
661
662 #[serde(skip_serializing_if = "is_false")]
663 #[skip_protocol_config_accessor]
664 enable_jwk_consensus_updates: bool,
665
666 #[serde(skip_serializing_if = "is_false")]
667 #[skip_protocol_config_accessor]
668 end_of_epoch_transaction_supported: bool,
669
670 #[serde(skip_serializing_if = "is_false")]
673 simple_conservation_checks: bool,
674
675 #[serde(skip_serializing_if = "is_false")]
677 loaded_child_object_format_type: bool,
678
679 #[serde(skip_serializing_if = "is_false")]
681 receive_objects: bool,
682
683 #[serde(skip_serializing_if = "is_false")]
685 consensus_checkpoint_signature_key_includes_digest: bool,
686
687 #[serde(skip_serializing_if = "is_false")]
689 random_beacon: bool,
690
691 #[serde(skip_serializing_if = "is_false")]
693 #[skip_protocol_config_accessor]
694 bridge: bool,
695
696 #[serde(skip_serializing_if = "is_false")]
697 enable_effects_v2: bool,
698
699 #[serde(skip_serializing_if = "is_false")]
701 narwhal_certificate_v2: bool,
702
703 #[serde(skip_serializing_if = "is_false")]
705 verify_legacy_zklogin_address: bool,
706
707 #[serde(skip_serializing_if = "is_false")]
709 throughput_aware_consensus_submission: bool,
710
711 #[serde(skip_serializing_if = "is_false")]
713 recompute_has_public_transfer_in_execution: bool,
714
715 #[serde(skip_serializing_if = "is_false")]
717 accept_zklogin_in_multisig: bool,
718
719 #[serde(skip_serializing_if = "is_false")]
721 accept_passkey_in_multisig: bool,
722
723 #[serde(skip_serializing_if = "is_false")]
725 validate_zklogin_public_identifier: bool,
726
727 #[serde(skip_serializing_if = "is_false")]
730 include_consensus_digest_in_prologue: bool,
731
732 #[serde(skip_serializing_if = "is_false")]
734 hardened_otw_check: bool,
735
736 #[serde(skip_serializing_if = "is_false")]
738 allow_receiving_object_id: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 enable_poseidon: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 enable_coin_deny_list: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
750 enable_group_ops_native_functions: bool,
751
752 #[serde(skip_serializing_if = "is_false")]
754 enable_group_ops_native_function_msm: bool,
755
756 #[serde(skip_serializing_if = "is_false")]
758 enable_ristretto255_group_ops: bool,
759
760 #[serde(skip_serializing_if = "is_false")]
762 enable_verify_bulletproofs_ristretto255: bool,
763
764 #[serde(skip_serializing_if = "is_false")]
766 enable_nitro_attestation: bool,
767
768 #[serde(skip_serializing_if = "is_false")]
770 enable_nitro_attestation_upgraded_parsing: bool,
771
772 #[serde(skip_serializing_if = "is_false")]
774 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
775
776 #[serde(skip_serializing_if = "is_false")]
778 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
779
780 #[serde(skip_serializing_if = "is_false")]
783 simplify_nitro_header_validation: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 reject_mutable_random_on_entry_functions: bool,
788
789 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
791 per_object_congestion_control_mode: PerObjectCongestionControlMode,
792
793 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
795 consensus_choice: ConsensusChoice,
796
797 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
799 consensus_network: ConsensusNetwork,
800
801 #[serde(skip_serializing_if = "is_false")]
803 correct_gas_payment_limit_check: bool,
804
805 #[serde(skip_serializing_if = "Option::is_none")]
807 zklogin_max_epoch_upper_bound_delta: Option<u64>,
808
809 #[serde(skip_serializing_if = "is_false")]
811 mysticeti_leader_scoring_and_schedule: bool,
812
813 #[serde(skip_serializing_if = "is_false")]
815 reshare_at_same_initial_version: bool,
816
817 #[serde(skip_serializing_if = "is_false")]
819 resolve_abort_locations_to_package_id: bool,
820
821 #[serde(skip_serializing_if = "is_false")]
825 mysticeti_use_committed_subdag_digest: bool,
826
827 #[serde(skip_serializing_if = "is_false")]
829 enable_vdf: bool,
830
831 #[serde(skip_serializing_if = "is_false")]
835 record_consensus_determined_version_assignments_in_prologue: bool,
836 #[serde(skip_serializing_if = "is_false")]
839 record_consensus_determined_version_assignments_in_prologue_v2: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 fresh_vm_on_framework_upgrade: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
853 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
854
855 #[serde(skip_serializing_if = "Option::is_none")]
857 mysticeti_num_leaders_per_round: Option<usize>,
858
859 #[serde(skip_serializing_if = "is_false")]
861 soft_bundle: bool,
862
863 #[serde(skip_serializing_if = "is_false")]
865 enable_coin_deny_list_v2: bool,
866
867 #[serde(skip_serializing_if = "is_false")]
869 passkey_auth: bool,
870
871 #[serde(skip_serializing_if = "is_false")]
874 mldsa65_auth: bool,
875
876 #[serde(skip_serializing_if = "is_false")]
879 reject_mldsa65_in_legacy_multisig: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
883 secp256r1_ecrecover_checks_x_below_p: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
888 secp256r1_strict_public_keys: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 complete_effects_size_estimate: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
896 authority_capabilities_v2: bool,
897
898 #[serde(skip_serializing_if = "is_false")]
900 rethrow_serialization_type_layout_errors: bool,
901
902 #[serde(skip_serializing_if = "is_false")]
904 consensus_distributed_vote_scoring_strategy: bool,
905
906 #[serde(skip_serializing_if = "is_false")]
908 consensus_round_prober: bool,
909
910 #[serde(skip_serializing_if = "is_false")]
912 validate_identifier_inputs: bool,
913
914 #[serde(skip_serializing_if = "is_false")]
916 disallow_self_identifier: bool,
917
918 #[serde(skip_serializing_if = "is_false")]
920 mysticeti_fastpath: bool,
921
922 #[serde(skip_serializing_if = "is_false")]
926 disable_preconsensus_locking: bool,
927
928 #[serde(skip_serializing_if = "is_false")]
930 relocate_event_module: bool,
931
932 #[serde(skip_serializing_if = "is_false")]
934 uncompressed_g1_group_elements: bool,
935
936 #[serde(skip_serializing_if = "is_false")]
937 disallow_new_modules_in_deps_only_packages: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 consensus_smart_ancestor_selection: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 consensus_round_prober_probe_accepted_rounds: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 native_charging_v2: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
954 #[skip_protocol_config_accessor]
955 consensus_linearize_subdag_v2: bool,
956
957 #[serde(skip_serializing_if = "is_false")]
959 convert_type_argument_error: bool,
960
961 #[serde(skip_serializing_if = "is_false")]
963 variant_nodes: bool,
964
965 #[serde(skip_serializing_if = "is_false")]
967 consensus_zstd_compression: bool,
968
969 #[serde(skip_serializing_if = "is_false")]
971 minimize_child_object_mutations: bool,
972
973 #[serde(skip_serializing_if = "is_false")]
976 record_additional_state_digest_in_prologue: bool,
977
978 #[serde(skip_serializing_if = "is_false")]
980 move_native_context: bool,
981
982 #[serde(skip_serializing_if = "is_false")]
985 #[skip_protocol_config_accessor]
986 consensus_median_based_commit_timestamp: bool,
987
988 #[serde(skip_serializing_if = "is_false")]
991 normalize_ptb_arguments: bool,
992
993 #[serde(skip_serializing_if = "is_false")]
995 consensus_batched_block_sync: bool,
996
997 #[serde(skip_serializing_if = "is_false")]
999 enforce_checkpoint_timestamp_monotonicity: bool,
1000
1001 #[serde(skip_serializing_if = "is_false")]
1003 max_ptb_value_size_v2: bool,
1004
1005 #[serde(skip_serializing_if = "is_false")]
1007 resolve_type_input_ids_to_defining_id: bool,
1008
1009 #[serde(skip_serializing_if = "is_false")]
1011 enable_party_transfer: bool,
1012
1013 #[serde(skip_serializing_if = "is_false")]
1015 allow_unbounded_system_objects: bool,
1016
1017 #[serde(skip_serializing_if = "is_false")]
1019 type_tags_in_object_runtime: bool,
1020
1021 #[serde(skip_serializing_if = "is_false")]
1023 enable_accumulators: bool,
1024
1025 #[serde(skip_serializing_if = "is_false")]
1027 #[skip_protocol_config_accessor]
1028 enable_coin_reservation_obj_refs: bool,
1029
1030 #[serde(skip_serializing_if = "is_false")]
1033 create_root_accumulator_object: bool,
1034
1035 #[serde(skip_serializing_if = "is_false")]
1037 #[skip_protocol_config_accessor]
1038 enable_authenticated_event_streams: bool,
1039
1040 #[serde(skip_serializing_if = "is_false")]
1042 enable_address_balance_gas_payments: bool,
1043
1044 #[serde(skip_serializing_if = "is_false")]
1046 address_balance_gas_check_rgp_at_signing: bool,
1047
1048 #[serde(skip_serializing_if = "is_false")]
1049 address_balance_gas_reject_gas_coin_arg: bool,
1050
1051 #[serde(skip_serializing_if = "is_false")]
1053 enable_multi_epoch_transaction_expiration: bool,
1054
1055 #[serde(skip_serializing_if = "is_false")]
1057 relax_valid_during_for_owned_inputs: bool,
1058
1059 #[serde(skip_serializing_if = "is_false")]
1061 enable_ptb_execution_v2: bool,
1062
1063 #[serde(skip_serializing_if = "is_false")]
1065 better_adapter_type_resolution_errors: bool,
1066
1067 #[serde(skip_serializing_if = "is_false")]
1069 record_time_estimate_processed: bool,
1070
1071 #[serde(skip_serializing_if = "is_false")]
1073 dependency_linkage_error: bool,
1074
1075 #[serde(skip_serializing_if = "is_false")]
1077 additional_multisig_checks: bool,
1078
1079 #[serde(skip_serializing_if = "is_false")]
1081 ignore_execution_time_observations_after_certs_closed: bool,
1082
1083 #[serde(skip_serializing_if = "is_false")]
1087 debug_fatal_on_move_invariant_violation: bool,
1088
1089 #[serde(skip_serializing_if = "is_false")]
1092 allow_private_accumulator_entrypoints: bool,
1093
1094 #[serde(skip_serializing_if = "is_false")]
1097 additional_consensus_digest_indirect_state: bool,
1098
1099 #[serde(skip_serializing_if = "is_false")]
1101 check_for_init_during_upgrade: bool,
1102
1103 #[serde(skip_serializing_if = "is_false")]
1105 enable_init_on_upgrade: bool,
1106
1107 #[serde(skip_serializing_if = "is_false")]
1109 enable_order_independent_upgrade_init_linkage: bool,
1110
1111 #[serde(skip_serializing_if = "is_false")]
1114 harden_linkage_consistency: bool,
1115
1116 #[serde(skip_serializing_if = "is_false")]
1118 per_command_shared_object_transfer_rules: bool,
1119
1120 #[serde(skip_serializing_if = "is_false")]
1122 validate_ptb_argument_indices: bool,
1123
1124 #[serde(skip_serializing_if = "is_false")]
1126 include_checkpoint_artifacts_digest_in_summary: bool,
1127
1128 #[serde(skip_serializing_if = "is_false")]
1130 use_mfp_txns_in_load_initial_object_debts: bool,
1131
1132 #[serde(skip_serializing_if = "is_false")]
1134 cancel_for_failed_dkg_early: bool,
1135
1136 #[serde(skip_serializing_if = "is_false")]
1138 always_advance_dkg_to_resolution: bool,
1139
1140 #[serde(skip_serializing_if = "is_false")]
1142 allow_dkg_completion_after_timeout: bool,
1143
1144 #[serde(skip_serializing_if = "is_false")]
1146 enable_coin_registry: bool,
1147
1148 #[serde(skip_serializing_if = "is_false")]
1150 abstract_size_in_object_runtime: bool,
1151
1152 #[serde(skip_serializing_if = "is_false")]
1154 object_runtime_charge_cache_load_gas: bool,
1155
1156 #[serde(skip_serializing_if = "is_false")]
1158 additional_borrow_checks: bool,
1159
1160 #[serde(skip_serializing_if = "is_false")]
1162 use_new_commit_handler: bool,
1163
1164 #[serde(skip_serializing_if = "is_false")]
1166 better_loader_errors: bool,
1167
1168 #[serde(skip_serializing_if = "is_false")]
1170 generate_df_type_layouts: bool,
1171
1172 #[serde(skip_serializing_if = "is_false")]
1174 allow_references_in_ptbs: bool,
1175
1176 #[serde(skip_serializing_if = "is_false")]
1183 framework_tx_context_mut_restrictions: bool,
1184
1185 #[serde(skip_serializing_if = "is_false")]
1187 include_function_signatures_in_instantiation_limits: bool,
1188
1189 #[serde(skip_serializing_if = "is_false")]
1194 ptb_tx_context_restrictions: bool,
1195
1196 #[serde(skip_serializing_if = "is_false")]
1198 enable_display_registry: bool,
1199
1200 #[serde(skip_serializing_if = "is_false")]
1202 private_generics_verifier_v2: bool,
1203
1204 #[serde(skip_serializing_if = "is_false")]
1206 deprecate_global_storage_ops_during_deserialization: bool,
1207
1208 #[serde(skip_serializing_if = "is_false")]
1211 enable_non_exclusive_writes: bool,
1212
1213 #[serde(skip_serializing_if = "is_false")]
1215 deprecate_global_storage_ops: bool,
1216
1217 #[serde(skip_serializing_if = "is_false")]
1219 normalize_depth_formula: bool,
1220
1221 #[serde(skip_serializing_if = "is_false")]
1224 charge_ld_const_abstract_size: bool,
1225
1226 #[serde(skip_serializing_if = "is_false")]
1228 consensus_skip_gced_accept_votes: bool,
1229
1230 #[serde(skip_serializing_if = "is_false")]
1233 include_cancelled_randomness_txns_in_prologue: bool,
1234
1235 #[serde(skip_serializing_if = "is_false")]
1237 #[skip_protocol_config_accessor]
1238 address_aliases: bool,
1239
1240 #[serde(skip_serializing_if = "is_false")]
1242 create_forwarding_address_registry: bool,
1243
1244 #[serde(skip_serializing_if = "is_false")]
1246 enable_forwarding_addresses: bool,
1247
1248 #[serde(skip_serializing_if = "is_false")]
1251 fix_checkpoint_signature_mapping: bool,
1252
1253 #[serde(skip_serializing_if = "is_false")]
1255 enable_object_funds_withdraw: bool,
1256
1257 #[serde(skip_serializing_if = "is_false")]
1260 record_net_unsettled_object_withdraws: bool,
1261
1262 #[serde(skip_serializing_if = "is_false")]
1264 consensus_skip_gced_blocks_in_direct_finalization: bool,
1265
1266 #[serde(skip_serializing_if = "is_false")]
1268 gas_rounding_halve_digits: bool,
1269
1270 #[serde(skip_serializing_if = "is_false")]
1272 flexible_tx_context_positions: bool,
1273
1274 #[serde(skip_serializing_if = "is_false")]
1276 disable_entry_point_signature_check: bool,
1277
1278 #[serde(skip_serializing_if = "is_false")]
1280 convert_withdrawal_compatibility_ptb_arguments: bool,
1281
1282 #[serde(skip_serializing_if = "is_false")]
1284 restrict_hot_or_not_entry_functions: bool,
1285
1286 #[serde(skip_serializing_if = "is_false")]
1288 split_checkpoints_in_consensus_handler: bool,
1289
1290 #[serde(skip_serializing_if = "is_false")]
1292 consensus_always_accept_system_transactions: bool,
1293
1294 #[serde(skip_serializing_if = "is_false")]
1296 validator_metadata_verify_v2: bool,
1297
1298 #[serde(skip_serializing_if = "is_false")]
1301 validator_metadata_require_compressed_protocol_pubkey: bool,
1302
1303 #[serde(skip_serializing_if = "is_false")]
1306 defer_unpaid_amplification: bool,
1307
1308 #[serde(skip_serializing_if = "is_false")]
1311 defer_owned_object_double_spend: bool,
1312
1313 #[serde(skip_serializing_if = "is_false")]
1316 allowed_proposers: bool,
1317
1318 #[serde(skip_serializing_if = "is_false")]
1325 #[skip_protocol_config_accessor]
1326 staggered_submission_signal: bool,
1327
1328 #[serde(skip_serializing_if = "is_false")]
1329 randomize_checkpoint_tx_limit_in_tests: bool,
1330
1331 #[serde(skip_serializing_if = "is_false")]
1333 gasless_transaction_drop_safety: bool,
1334
1335 #[serde(skip_serializing_if = "is_false")]
1338 merge_randomness_into_checkpoint: bool,
1339
1340 #[serde(skip_serializing_if = "is_false")]
1342 use_coin_party_owner: bool,
1343
1344 #[serde(skip_serializing_if = "is_false")]
1345 enable_gasless: bool,
1346
1347 #[serde(skip_serializing_if = "is_false")]
1348 gasless_verify_remaining_balance: bool,
1349
1350 #[serde(skip_serializing_if = "is_false")]
1351 disallow_jump_orphans: bool,
1352
1353 #[serde(skip_serializing_if = "is_false")]
1355 early_return_receive_object_mismatched_type: bool,
1356
1357 #[serde(skip_serializing_if = "is_false")]
1362 timestamp_based_epoch_close: bool,
1363
1364 #[serde(skip_serializing_if = "is_false")]
1367 limit_groth16_pvk_inputs: bool,
1368
1369 #[serde(skip_serializing_if = "is_false")]
1373 check_groth16_pvk_length: bool,
1374
1375 #[serde(skip_serializing_if = "is_false")]
1380 enforce_address_balance_change_invariant: bool,
1381
1382 #[serde(skip_serializing_if = "is_false")]
1384 share_transaction_deny_config_in_consensus: bool,
1385
1386 #[serde(skip_serializing_if = "is_false")]
1388 granular_post_execution_checks: bool,
1389
1390 #[serde(skip_serializing_if = "is_false")]
1392 early_exit_on_iffw: bool,
1393
1394 #[serde(skip_serializing_if = "is_false")]
1396 enable_unified_linkage: bool,
1397
1398 #[serde(skip_serializing_if = "is_false")]
1400 package_publish_charge: bool,
1401
1402 #[serde(skip_serializing_if = "is_false")]
1405 #[skip_protocol_config_accessor]
1406 enable_allowances: bool,
1407
1408 #[serde(skip_serializing_if = "is_false")]
1410 fix_ptb_generated_reads: bool,
1411
1412 #[serde(skip_serializing_if = "is_false")]
1413 check_object_funds_withdraw_in_execution: bool,
1414 #[serde(skip_serializing_if = "is_false")]
1416 memory_safety_invariant_check_v2: bool,
1417
1418 #[serde(skip_serializing_if = "is_false")]
1420 disable_effects_tx_dependencies: bool,
1421
1422 #[serde(skip_serializing_if = "is_false")]
1426 merge_colliding_deferrals: bool,
1427
1428 #[serde(skip_serializing_if = "is_false")]
1432 shuffle_consensus_commit_blocks: bool,
1433
1434 #[serde(skip_serializing_if = "is_false")]
1437 disable_id_leak_verifier: bool,
1438
1439 #[serde(skip_serializing_if = "is_false")]
1444 enable_timestamp_transaction_expiration: bool,
1445
1446 #[serde(skip_serializing_if = "is_false")]
1448 create_freeze_list: bool,
1449
1450 #[serde(skip_serializing_if = "is_false")]
1453 enable_coin_regulation: bool,
1454}
1455
1456fn is_false(b: &bool) -> bool {
1457 !b
1458}
1459
1460fn is_empty(b: &BTreeSet<String>) -> bool {
1461 b.is_empty()
1462}
1463
1464fn is_zero(val: &u64) -> bool {
1465 *val == 0
1466}
1467
1468#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1470pub enum ConsensusTransactionOrdering {
1471 #[default]
1473 None,
1474 ByGasPrice,
1476}
1477
1478impl ConsensusTransactionOrdering {
1479 pub fn is_none(&self) -> bool {
1480 matches!(self, ConsensusTransactionOrdering::None)
1481 }
1482}
1483
1484#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1485pub struct ExecutionTimeEstimateParams {
1486 pub target_utilization: u64,
1488 pub allowed_txn_cost_overage_burst_limit_us: u64,
1492
1493 pub randomness_scalar: u64,
1496
1497 pub max_estimate_us: u64,
1499
1500 pub stored_observations_num_included_checkpoints: u64,
1503
1504 pub stored_observations_limit: u64,
1506
1507 #[serde(skip_serializing_if = "is_zero")]
1510 pub stake_weighted_median_threshold: u64,
1511
1512 #[serde(skip_serializing_if = "is_false")]
1516 pub default_none_duration_for_new_keys: bool,
1517
1518 #[serde(skip_serializing_if = "Option::is_none")]
1520 pub observations_chunk_size: Option<u64>,
1521}
1522
1523#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1525pub enum PerObjectCongestionControlMode {
1526 #[default]
1527 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1533
1534impl PerObjectCongestionControlMode {
1535 pub fn is_none(&self) -> bool {
1536 matches!(self, PerObjectCongestionControlMode::None)
1537 }
1538}
1539
1540#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1542pub enum ConsensusChoice {
1543 #[default]
1544 Narwhal,
1545 SwapEachEpoch,
1546 Mysticeti,
1547}
1548
1549impl ConsensusChoice {
1550 pub fn is_narwhal(&self) -> bool {
1551 matches!(self, ConsensusChoice::Narwhal)
1552 }
1553}
1554
1555#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1557pub enum ConsensusNetwork {
1558 #[default]
1559 Anemo,
1560 Tonic,
1561}
1562
1563impl ConsensusNetwork {
1564 pub fn is_anemo(&self) -> bool {
1565 matches!(self, ConsensusNetwork::Anemo)
1566 }
1567}
1568
1569#[skip_serializing_none]
1601#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1602pub struct ProtocolConfig {
1603 pub version: ProtocolVersion,
1604
1605 #[serde(skip)]
1610 chain: Chain,
1611
1612 feature_flags: FeatureFlags,
1613
1614 max_tx_size_bytes: Option<u64>,
1617
1618 max_input_objects: Option<u64>,
1620
1621 max_size_written_objects: Option<u64>,
1625 max_size_written_objects_system_tx: Option<u64>,
1628
1629 max_serialized_tx_effects_size_bytes: Option<u64>,
1631
1632 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1634
1635 max_gas_payment_objects: Option<u32>,
1637
1638 max_modules_in_publish: Option<u32>,
1640
1641 max_package_dependencies: Option<u32>,
1643
1644 max_arguments: Option<u32>,
1647
1648 max_type_arguments: Option<u32>,
1650
1651 max_type_argument_depth: Option<u32>,
1653
1654 max_pure_argument_size: Option<u32>,
1656
1657 max_programmable_tx_commands: Option<u32>,
1659
1660 move_binary_format_version: Option<u32>,
1663 min_move_binary_format_version: Option<u32>,
1664
1665 binary_module_handles: Option<u16>,
1667 binary_struct_handles: Option<u16>,
1668 binary_function_handles: Option<u16>,
1669 binary_function_instantiations: Option<u16>,
1670 binary_signatures: Option<u16>,
1671 binary_constant_pool: Option<u16>,
1672 binary_identifiers: Option<u16>,
1673 binary_address_identifiers: Option<u16>,
1674 binary_struct_defs: Option<u16>,
1675 binary_struct_def_instantiations: Option<u16>,
1676 binary_function_defs: Option<u16>,
1677 binary_field_handles: Option<u16>,
1678 binary_field_instantiations: Option<u16>,
1679 binary_friend_decls: Option<u16>,
1680 binary_enum_defs: Option<u16>,
1681 binary_enum_def_instantiations: Option<u16>,
1682 binary_variant_handles: Option<u16>,
1683 binary_variant_instantiation_handles: Option<u16>,
1684
1685 #[skip_accessor]
1687 binary_format_limits_profile: Option<BinaryFormatLimitsProfile>,
1688
1689 max_move_object_size: Option<u64>,
1691
1692 max_move_package_size: Option<u64>,
1695
1696 max_publish_or_upgrade_per_ptb: Option<u64>,
1698
1699 max_tx_gas: Option<u64>,
1701
1702 max_gas_price: Option<u64>,
1704
1705 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1708
1709 max_gas_computation_bucket: Option<u64>,
1711
1712 gas_rounding_step: Option<u64>,
1714
1715 max_loop_depth: Option<u64>,
1717
1718 max_generic_instantiation_length: Option<u64>,
1720
1721 max_function_parameters: Option<u64>,
1723
1724 max_basic_blocks: Option<u64>,
1726
1727 max_value_stack_size: Option<u64>,
1729
1730 max_type_nodes: Option<u64>,
1732
1733 max_generic_instantiation_type_nodes_per_function: Option<u64>,
1735
1736 max_generic_instantiation_type_nodes_per_module: Option<u64>,
1738
1739 max_accumulator_type_nodes: Option<u64>,
1741
1742 max_push_size: Option<u64>,
1744
1745 max_struct_definitions: Option<u64>,
1747
1748 max_function_definitions: Option<u64>,
1750
1751 max_fields_in_struct: Option<u64>,
1753
1754 max_dependency_depth: Option<u64>,
1756
1757 max_num_event_emit: Option<u64>,
1759
1760 max_num_accumulator_events: Option<u64>,
1764
1765 max_num_new_move_object_ids: Option<u64>,
1767
1768 max_num_new_move_object_ids_system_tx: Option<u64>,
1770
1771 max_num_deleted_move_object_ids: Option<u64>,
1773
1774 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1776
1777 max_num_transferred_move_object_ids: Option<u64>,
1779
1780 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1782
1783 max_event_emit_size: Option<u64>,
1785
1786 max_event_emit_size_total: Option<u64>,
1788
1789 max_move_vector_len: Option<u64>,
1791
1792 max_move_identifier_len: Option<u64>,
1794
1795 max_move_value_depth: Option<u64>,
1797
1798 package_arena_size_in_bytes: Option<u64>,
1801
1802 max_move_enum_variants: Option<u64>,
1804
1805 max_back_edges_per_function: Option<u64>,
1807
1808 max_back_edges_per_module: Option<u64>,
1810
1811 max_verifier_meter_ticks_per_function: Option<u64>,
1813
1814 max_meter_ticks_per_module: Option<u64>,
1816
1817 max_meter_ticks_per_package: Option<u64>,
1819
1820 object_runtime_max_num_cached_objects: Option<u64>,
1824
1825 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1827
1828 object_runtime_max_loaded_child_value_size: Option<u64>,
1830
1831 max_freeze_list_address_reads: Option<u64>,
1834
1835 object_runtime_max_num_store_entries: Option<u64>,
1837
1838 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1840
1841 base_tx_cost_fixed: Option<u64>,
1844
1845 package_publish_cost_fixed: Option<u64>,
1848
1849 base_tx_cost_per_byte: Option<u64>,
1852
1853 package_publish_cost_per_byte: Option<u64>,
1855
1856 package_publish_charge_fixed: Option<u64>,
1858
1859 package_publish_charge_per_module: Option<u64>,
1861
1862 package_publish_charge_per_dependency: Option<u64>,
1864
1865 #[skip_accessor]
1867 mutable_system_object_input_charge_ids: Option<BTreeSet<AccountAddress>>,
1868
1869 mutable_system_object_input_charge: Option<u64>,
1872
1873 obj_access_cost_read_per_byte: Option<u64>,
1875
1876 obj_access_cost_read_per_package_kb: Option<u64>,
1879
1880 obj_access_cost_mutate_per_byte: Option<u64>,
1882
1883 obj_access_cost_delete_per_byte: Option<u64>,
1885
1886 obj_access_cost_verify_per_byte: Option<u64>,
1896
1897 max_type_to_layout_nodes: Option<u64>,
1899
1900 max_ptb_value_size: Option<u64>,
1902
1903 gas_model_version: Option<u64>,
1906
1907 obj_data_cost_refundable: Option<u64>,
1910
1911 obj_metadata_cost_non_refundable: Option<u64>,
1915
1916 storage_rebate_rate: Option<u64>,
1922
1923 storage_fund_reinvest_rate: Option<u64>,
1926
1927 reward_slashing_rate: Option<u64>,
1930
1931 storage_gas_price: Option<u64>,
1933
1934 accumulator_object_storage_cost: Option<u64>,
1936
1937 max_transactions_per_checkpoint: Option<u64>,
1942
1943 max_checkpoint_size_bytes: Option<u64>,
1947
1948 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1953
1954 address_from_bytes_cost_base: Option<u64>,
1959 address_to_u256_cost_base: Option<u64>,
1961 address_from_u256_cost_base: Option<u64>,
1963
1964 config_read_setting_impl_cost_base: Option<u64>,
1969 config_read_setting_impl_cost_per_byte: Option<u64>,
1970
1971 package_original_package_id_impl_cost_base: Option<u64>,
1972 package_original_package_id_impl_cost_per_byte: Option<u64>,
1973
1974 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1977 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1978 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1979 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1980 dynamic_field_add_child_object_cost_base: Option<u64>,
1982 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1983 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1984 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1985 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1987 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1988 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1989 dynamic_field_remove_child_object_cost_base: Option<u64>,
1991 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1992 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1993 dynamic_field_has_child_object_cost_base: Option<u64>,
1995 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1997 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1998 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1999
2000 scratch_add_cost_base: Option<u64>,
2003 scratch_read_cost_base: Option<u64>,
2005 scratch_read_value_cost: Option<u64>,
2006 scratch_remove_cost_base: Option<u64>,
2008 scratch_exists_cost_base: Option<u64>,
2010 scratch_exists_with_type_cost_base: Option<u64>,
2012 scratch_exists_with_type_type_cost: Option<u64>,
2013 max_scratch_pad_size: Option<u64>,
2015
2016 event_emit_cost_base: Option<u64>,
2019 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
2020 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
2021 event_emit_output_cost_per_byte: Option<u64>,
2022 event_emit_auth_stream_cost: Option<u64>,
2023
2024 reserve_object_funds_for_withdrawal_cost_base: Option<u64>,
2027 reserve_object_funds_for_withdrawal_cold_read_cost: Option<u64>,
2029
2030 object_borrow_uid_cost_base: Option<u64>,
2033 object_delete_impl_cost_base: Option<u64>,
2035 object_record_new_uid_cost_base: Option<u64>,
2037 object_record_new_uid_from_hash_cost_base: Option<u64>,
2040 object_is_shared_input_cost_base: Option<u64>,
2042
2043 transfer_transfer_internal_cost_base: Option<u64>,
2046 transfer_party_transfer_internal_cost_base: Option<u64>,
2048 transfer_freeze_object_cost_base: Option<u64>,
2050 transfer_share_object_cost_base: Option<u64>,
2052 transfer_receive_object_cost_base: Option<u64>,
2055 transfer_receive_object_cost_per_byte: Option<u64>,
2056 transfer_receive_object_type_cost_per_byte: Option<u64>,
2057
2058 tx_context_derive_id_cost_base: Option<u64>,
2061 tx_context_fresh_id_cost_base: Option<u64>,
2062 tx_context_sender_cost_base: Option<u64>,
2063 tx_context_epoch_cost_base: Option<u64>,
2064 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
2065 tx_context_sponsor_cost_base: Option<u64>,
2066 tx_context_rgp_cost_base: Option<u64>,
2067 tx_context_gas_price_cost_base: Option<u64>,
2068 tx_context_gas_budget_cost_base: Option<u64>,
2069 tx_context_ids_created_cost_base: Option<u64>,
2070 tx_context_replace_cost_base: Option<u64>,
2071
2072 clock_borrow_cost_base: Option<u64>,
2075
2076 types_is_one_time_witness_cost_base: Option<u64>,
2079 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
2080 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
2081
2082 validator_validate_metadata_cost_base: Option<u64>,
2085 validator_validate_metadata_data_cost_per_byte: Option<u64>,
2086
2087 crypto_invalid_arguments_cost: Option<u64>,
2089 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
2091 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
2092 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
2093
2094 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
2096 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
2097 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
2098
2099 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
2101 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2102 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2103 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
2104 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2105 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2106
2107 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
2109
2110 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
2112 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2113 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
2114 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
2115 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
2116 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
2117
2118 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
2120 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2121 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2122 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
2123 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2124 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2125
2126 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
2128 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2129 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
2130 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
2131 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
2132 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
2133
2134 ecvrf_ecvrf_verify_cost_base: Option<u64>,
2136 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
2137 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
2138
2139 ed25519_ed25519_verify_cost_base: Option<u64>,
2141 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
2142 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
2143
2144 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
2146 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
2147
2148 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
2150 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
2151 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
2152 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
2153 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
2154
2155 hash_blake2b256_cost_base: Option<u64>,
2157 hash_blake2b256_data_cost_per_byte: Option<u64>,
2158 hash_blake2b256_data_cost_per_block: Option<u64>,
2159
2160 hash_keccak256_cost_base: Option<u64>,
2162 hash_keccak256_data_cost_per_byte: Option<u64>,
2163 hash_keccak256_data_cost_per_block: Option<u64>,
2164
2165 poseidon_bn254_cost_base: Option<u64>,
2167 poseidon_bn254_cost_per_block: Option<u64>,
2168
2169 group_ops_bls12381_decode_scalar_cost: Option<u64>,
2171 group_ops_bls12381_decode_g1_cost: Option<u64>,
2172 group_ops_bls12381_decode_g2_cost: Option<u64>,
2173 group_ops_bls12381_decode_gt_cost: Option<u64>,
2174 group_ops_bls12381_scalar_add_cost: Option<u64>,
2175 group_ops_bls12381_g1_add_cost: Option<u64>,
2176 group_ops_bls12381_g2_add_cost: Option<u64>,
2177 group_ops_bls12381_gt_add_cost: Option<u64>,
2178 group_ops_bls12381_scalar_sub_cost: Option<u64>,
2179 group_ops_bls12381_g1_sub_cost: Option<u64>,
2180 group_ops_bls12381_g2_sub_cost: Option<u64>,
2181 group_ops_bls12381_gt_sub_cost: Option<u64>,
2182 group_ops_bls12381_scalar_mul_cost: Option<u64>,
2183 group_ops_bls12381_g1_mul_cost: Option<u64>,
2184 group_ops_bls12381_g2_mul_cost: Option<u64>,
2185 group_ops_bls12381_gt_mul_cost: Option<u64>,
2186 group_ops_bls12381_scalar_div_cost: Option<u64>,
2187 group_ops_bls12381_g1_div_cost: Option<u64>,
2188 group_ops_bls12381_g2_div_cost: Option<u64>,
2189 group_ops_bls12381_gt_div_cost: Option<u64>,
2190 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
2191 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
2192 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
2193 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
2194 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
2195 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
2196 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
2197 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
2198 group_ops_bls12381_msm_max_len: Option<u32>,
2199 group_ops_bls12381_pairing_cost: Option<u64>,
2200 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
2201 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
2202 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
2203 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
2204 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
2205
2206 group_ops_ristretto_decode_scalar_cost: Option<u64>,
2207 group_ops_ristretto_decode_point_cost: Option<u64>,
2208 group_ops_ristretto_scalar_add_cost: Option<u64>,
2209 group_ops_ristretto_point_add_cost: Option<u64>,
2210 group_ops_ristretto_scalar_sub_cost: Option<u64>,
2211 group_ops_ristretto_point_sub_cost: Option<u64>,
2212 group_ops_ristretto_scalar_mul_cost: Option<u64>,
2213 group_ops_ristretto_point_mul_cost: Option<u64>,
2214 group_ops_ristretto_scalar_div_cost: Option<u64>,
2215 group_ops_ristretto_point_div_cost: Option<u64>,
2216
2217 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
2218 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
2219 max_bulletproofs_total_bits: Option<u64>,
2222
2223 hmac_hmac_sha3_256_cost_base: Option<u64>,
2225 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
2226 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
2227
2228 check_zklogin_id_cost_base: Option<u64>,
2230 check_zklogin_issuer_cost_base: Option<u64>,
2232
2233 vdf_verify_vdf_cost: Option<u64>,
2234 vdf_hash_to_input_cost: Option<u64>,
2235
2236 nitro_attestation_parse_base_cost: Option<u64>,
2238 nitro_attestation_parse_cost_per_byte: Option<u64>,
2239 nitro_attestation_verify_base_cost: Option<u64>,
2240 nitro_attestation_verify_cost_per_cert: Option<u64>,
2241
2242 layout_node_cost: Option<u64>,
2244 layout_node_cost_large_layout_threshold: Option<u64>,
2246
2247 bcs_per_input_abstract_unit_cost: Option<u64>,
2249 bcs_per_byte_serialized_cost: Option<u64>,
2250 bcs_legacy_min_output_size_cost: Option<u64>,
2251 bcs_failure_cost: Option<u64>,
2252
2253 hash_sha2_256_base_cost: Option<u64>,
2254 hash_sha2_256_per_byte_cost: Option<u64>,
2255 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
2256 hash_sha3_256_base_cost: Option<u64>,
2257 hash_sha3_256_per_byte_cost: Option<u64>,
2258 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
2259 type_name_get_base_cost: Option<u64>,
2260 type_name_get_per_byte_cost: Option<u64>,
2261 type_name_id_base_cost: Option<u64>,
2262
2263 string_check_utf8_base_cost: Option<u64>,
2264 string_check_utf8_per_byte_cost: Option<u64>,
2265 string_is_char_boundary_base_cost: Option<u64>,
2266 string_sub_string_base_cost: Option<u64>,
2267 string_sub_string_per_byte_cost: Option<u64>,
2268 string_index_of_base_cost: Option<u64>,
2269 string_index_of_per_byte_pattern_cost: Option<u64>,
2270 string_index_of_per_byte_searched_cost: Option<u64>,
2271
2272 vector_empty_base_cost: Option<u64>,
2273 vector_length_base_cost: Option<u64>,
2274 vector_push_back_base_cost: Option<u64>,
2275 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
2276 vector_borrow_base_cost: Option<u64>,
2277 vector_pop_back_base_cost: Option<u64>,
2278 vector_destroy_empty_base_cost: Option<u64>,
2279 vector_swap_base_cost: Option<u64>,
2280 vector_reverse_base_cost: Option<u64>,
2281 vector_reverse_per_elem_cost: Option<u64>,
2282 vector_keep_range_base_cost: Option<u64>,
2283 vector_keep_range_per_dropped_elem_cost: Option<u64>,
2284 vector_keep_range_per_moved_elem_cost: Option<u64>,
2285 vector_copy_range_base_cost: Option<u64>,
2286 vector_copy_range_per_abstract_memory_unit_cost: Option<u64>,
2287 vector_replace_range_base_cost: Option<u64>,
2288 vector_replace_range_per_elem_cost: Option<u64>,
2289 debug_print_base_cost: Option<u64>,
2290 debug_print_stack_trace_base_cost: Option<u64>,
2291
2292 #[custom_setter]
2302 execution_version: Option<u64>,
2303
2304 consensus_bad_nodes_stake_threshold: Option<u64>,
2308
2309 max_jwk_votes_per_validator_per_epoch: Option<u64>,
2310 max_age_of_jwk_in_epochs: Option<u64>,
2314
2315 random_beacon_reduction_allowed_delta: Option<u16>,
2319
2320 random_beacon_reduction_lower_bound: Option<u32>,
2323
2324 random_beacon_dkg_timeout_round: Option<u32>,
2327
2328 random_beacon_min_round_interval_ms: Option<u64>,
2330
2331 random_beacon_dkg_version: Option<u64>,
2334
2335 consensus_max_transaction_size_bytes: Option<u64>,
2338 consensus_max_transactions_in_block_bytes: Option<u64>,
2340 consensus_max_num_transactions_in_block: Option<u64>,
2342
2343 consensus_voting_rounds: Option<u32>,
2345
2346 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
2348
2349 max_deferral_rounds_for_congestion_control: Option<u64>,
2352
2353 epoch_close_deadline_ms: Option<u64>,
2358
2359 max_txn_cost_overage_per_object_in_commit: Option<u64>,
2361
2362 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
2364
2365 min_checkpoint_interval_ms: Option<u64>,
2367
2368 checkpoint_queue_max_undrained_ms: Option<u64>,
2373
2374 checkpoint_summary_version_specific_data: Option<u64>,
2376
2377 max_soft_bundle_size: Option<u64>,
2379
2380 bridge_should_try_to_finalize_committee: Option<bool>,
2384
2385 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2391
2392 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2395
2396 consensus_gc_depth: Option<u32>,
2399
2400 gas_budget_based_txn_cost_cap_factor: Option<u64>,
2402
2403 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
2405
2406 sip_45_consensus_amplification_threshold: Option<u64>,
2409
2410 staggered_submission_signal_window_commits: Option<u64>,
2413 staggered_submission_signal_min_excess_copies_per_commit: Option<u64>,
2418 staggered_submission_signal_min_consensus_user_transactions_per_commit: Option<u64>,
2424 staggered_submission_signal_exit_dwell_commits: Option<u64>,
2429 staggered_submission_signal_band1_enter_ratio_bps: Option<u64>,
2432 staggered_submission_signal_band1_exit_ratio_bps: Option<u64>,
2433 staggered_submission_signal_band2_enter_ratio_bps: Option<u64>,
2434 staggered_submission_signal_band2_exit_ratio_bps: Option<u64>,
2435
2436 use_object_per_epoch_marker_table_v2: Option<bool>,
2439
2440 consensus_commit_rate_estimation_window_size: Option<u32>,
2442
2443 #[serde(skip_serializing_if = "Vec::is_empty")]
2447 aliased_addresses: Vec<AliasedAddress>,
2448
2449 translation_per_command_base_charge: Option<u64>,
2452
2453 translation_per_input_base_charge: Option<u64>,
2456
2457 translation_pure_input_per_byte_charge: Option<u64>,
2459
2460 translation_per_type_node_charge: Option<u64>,
2464
2465 translation_per_reference_node_charge: Option<u64>,
2468
2469 translation_per_linkage_entry_charge: Option<u64>,
2472
2473 max_updates_per_settlement_txn: Option<u32>,
2475
2476 gasless_max_computation_units: Option<u64>,
2478
2479 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
2481
2482 gasless_max_unused_inputs: Option<u64>,
2486
2487 gasless_max_pure_input_bytes: Option<u64>,
2490
2491 gasless_max_tps: Option<u64>,
2493
2494 #[serde(skip_serializing_if = "Option::is_none")]
2495 #[skip_accessor]
2496 include_special_package_amendments: Option<Arc<Amendments>>,
2497
2498 gasless_max_tx_size_bytes: Option<u64>,
2501
2502 translation_per_live_reference_charge: Option<u64>,
2505
2506 max_ptb_live_references: Option<u64>,
2509
2510 max_ptb_returned_references: Option<u64>,
2513
2514 max_ptb_total_returned_references: Option<u64>,
2517}
2518
2519#[derive(Clone, Serialize, Deserialize, Debug)]
2521pub struct AliasedAddress {
2522 pub original: [u8; 32],
2524 pub aliased: [u8; 32],
2526 pub allowed_tx_digests: Vec<[u8; 32]>,
2528}
2529
2530impl ProtocolConfig {
2532 pub fn chain(&self) -> Chain {
2534 self.chain
2535 }
2536
2537 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2550 if self.feature_flags.package_upgrades {
2551 Ok(())
2552 } else {
2553 Err(Error(format!(
2554 "package upgrades are not supported at {:?}",
2555 self.version
2556 )))
2557 }
2558 }
2559
2560 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2561 &self.feature_flags.zklogin_supported_providers
2562 }
2563
2564 pub fn zklogin_circuit_mode(&self) -> u64 {
2567 self.feature_flags.zklogin_circuit_mode
2568 }
2569
2570 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2571 self.feature_flags.consensus_transaction_ordering
2572 }
2573
2574 pub fn enable_jwk_consensus_updates(&self) -> bool {
2575 let ret = self.feature_flags.enable_jwk_consensus_updates;
2576 if ret {
2577 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2579 }
2580 ret
2581 }
2582
2583 pub fn staggered_submission_signal(&self) -> bool {
2584 let ret = self.feature_flags.staggered_submission_signal;
2585 if ret {
2586 assert!(self.feature_flags.allowed_proposers);
2589 }
2590 ret
2591 }
2592
2593 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2594 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2595 if !ret {
2596 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2598 }
2599 ret
2600 }
2601
2602 pub fn dkg_version(&self) -> u64 {
2603 self.random_beacon_dkg_version.unwrap_or(1)
2605 }
2606
2607 pub fn bridge(&self) -> bool {
2608 let ret = self.feature_flags.bridge;
2609 if ret {
2610 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2612 }
2613 ret
2614 }
2615
2616 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2617 if !self.bridge() {
2618 return false;
2619 }
2620 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2622 }
2623
2624 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2625 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2626 }
2627
2628 pub fn enable_allowances(&self) -> bool {
2629 self.feature_flags.enable_allowances && self.enable_accumulators()
2630 }
2631
2632 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2633 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2634 }
2635
2636 pub fn enable_authenticated_event_streams(&self) -> bool {
2637 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2638 }
2639
2640 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2641 self.feature_flags.per_object_congestion_control_mode
2642 }
2643
2644 pub fn consensus_choice(&self) -> ConsensusChoice {
2645 self.feature_flags.consensus_choice
2646 }
2647
2648 pub fn consensus_network(&self) -> ConsensusNetwork {
2649 self.feature_flags.consensus_network
2650 }
2651
2652 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2653 self.feature_flags.mysticeti_num_leaders_per_round
2654 }
2655
2656 pub fn max_transaction_size_bytes(&self) -> u64 {
2657 self.consensus_max_transaction_size_bytes
2659 .unwrap_or(256 * 1024)
2660 }
2661
2662 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2663 if cfg!(msim) {
2664 256 * 1024
2665 } else {
2666 self.consensus_max_transactions_in_block_bytes
2667 .unwrap_or(512 * 1024)
2668 }
2669 }
2670
2671 pub fn max_num_transactions_in_block(&self) -> u64 {
2672 if cfg!(msim) {
2673 8
2674 } else {
2675 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2676 }
2677 }
2678
2679 pub fn gc_depth(&self) -> u32 {
2680 self.consensus_gc_depth.unwrap_or(0)
2681 }
2682
2683 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2684 let res = self.feature_flags.consensus_linearize_subdag_v2;
2685 assert!(
2686 !res || self.gc_depth() > 0,
2687 "The consensus linearize sub dag V2 requires GC to be enabled"
2688 );
2689 res
2690 }
2691
2692 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2693 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2694 assert!(
2695 !res || self.gc_depth() > 0,
2696 "The consensus median based commit timestamp requires GC to be enabled"
2697 );
2698 res
2699 }
2700
2701 pub fn checkpoint_queue_force_drain_ms(&self) -> Option<u64> {
2704 self.checkpoint_queue_max_undrained_ms
2705 .map(|ms| ms.max(self.min_checkpoint_interval_ms.unwrap_or_default()))
2706 }
2707
2708 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2709 self.consensus_commit_rate_estimation_window_size
2710 .unwrap_or(0)
2711 }
2712
2713 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2714 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2718 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2720 window_size
2721 }
2722
2723 pub fn address_aliases(&self) -> bool {
2724 let address_aliases = self.feature_flags.address_aliases;
2725 assert!(
2726 !address_aliases || self.mysticeti_fastpath(),
2727 "Address aliases requires Mysticeti fastpath to be enabled"
2728 );
2729 if address_aliases {
2730 assert!(
2731 self.feature_flags.disable_preconsensus_locking,
2732 "Address aliases requires CertifiedTransaction to be disabled"
2733 );
2734 }
2735 address_aliases
2736 }
2737
2738 pub fn new_vm_enabled(&self) -> bool {
2739 self.execution_version.is_some_and(|v| v >= 4)
2740 }
2741
2742 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2743 debug_assert!(self.gasless_allowed_token_types.is_some());
2744 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2745 }
2746
2747 pub fn mutable_system_object_input_charge_ids(&self) -> Option<&BTreeSet<AccountAddress>> {
2748 self.mutable_system_object_input_charge_ids.as_ref()
2749 }
2750
2751 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2752 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2753 }
2754
2755 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2756 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2757 }
2758
2759 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2760 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2761 }
2762
2763 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2764 &self.include_special_package_amendments
2765 }
2766}
2767
2768static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2769#[cfg(feature = "testing")]
2770static SMALL_CHECKPOINT_TX_LIMITS_IN_TESTS: AtomicBool = AtomicBool::new(false);
2771
2772impl ProtocolConfig {
2774 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2776 assert!(
2778 version >= ProtocolVersion::MIN,
2779 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2780 version,
2781 ProtocolVersion::MIN.0,
2782 );
2783 assert!(
2784 version <= ProtocolVersion::MAX_ALLOWED,
2785 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2786 version,
2787 ProtocolVersion::MAX_ALLOWED.0,
2788 );
2789
2790 let mut ret = Self::get_for_version_impl(version, chain);
2791 ret.version = version;
2792 ret.chain = chain;
2793
2794 ret = Self::apply_config_override(version, ret);
2795
2796 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2797 warn!(
2798 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2799 );
2800 let overrides: ProtocolConfigOptional =
2801 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2802 .expect("failed to parse ProtocolConfig override env variables");
2803 overrides.apply_to(&mut ret);
2804 }
2805
2806 ret
2807 }
2808
2809 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2812 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2813 let mut ret = Self::get_for_version_impl(version, chain);
2814 ret.version = version;
2815 ret.chain = chain;
2816 ret = Self::apply_config_override(version, ret);
2817 Some(ret)
2818 } else {
2819 None
2820 }
2821 }
2822
2823 pub fn poison_get_for_min_version() {
2824 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2825 }
2826
2827 #[cfg(feature = "testing")]
2830 pub fn enable_small_checkpoint_tx_limits_in_tests() {
2831 SMALL_CHECKPOINT_TX_LIMITS_IN_TESTS.store(true, Ordering::Relaxed);
2832 }
2833
2834 fn load_poison_get_for_min_version() -> bool {
2835 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2836 }
2837
2838 pub fn get_for_min_version() -> Self {
2841 if Self::load_poison_get_for_min_version() {
2842 panic!("get_for_min_version called on validator");
2843 }
2844 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2845 }
2846
2847 #[allow(non_snake_case)]
2857 pub fn get_for_max_version_UNSAFE() -> Self {
2858 if Self::load_poison_get_for_min_version() {
2859 panic!("get_for_max_version_UNSAFE called on validator");
2860 }
2861 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2862 }
2863
2864 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2865 #[cfg(msim)]
2866 {
2867 if version == ProtocolVersion::MAX_ALLOWED {
2869 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2870 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2871 return config;
2872 }
2873 }
2874
2875 let mut cfg = Self {
2878 version,
2880 chain,
2881
2882 feature_flags: Default::default(),
2884
2885 max_tx_size_bytes: Some(128 * 1024),
2886 max_input_objects: Some(2048),
2888 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2889 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2890 max_gas_payment_objects: Some(256),
2891 max_modules_in_publish: Some(128),
2892 max_package_dependencies: None,
2893 max_arguments: Some(512),
2894 max_type_arguments: Some(16),
2895 max_type_argument_depth: Some(16),
2896 max_pure_argument_size: Some(16 * 1024),
2897 max_programmable_tx_commands: Some(1024),
2898 move_binary_format_version: Some(6),
2899 min_move_binary_format_version: None,
2900 binary_module_handles: None,
2901 binary_struct_handles: None,
2902 binary_function_handles: None,
2903 binary_function_instantiations: None,
2904 binary_signatures: None,
2905 binary_constant_pool: None,
2906 binary_identifiers: None,
2907 binary_address_identifiers: None,
2908 binary_struct_defs: None,
2909 binary_struct_def_instantiations: None,
2910 binary_function_defs: None,
2911 binary_field_handles: None,
2912 binary_field_instantiations: None,
2913 binary_friend_decls: None,
2914 binary_enum_defs: None,
2915 binary_enum_def_instantiations: None,
2916 binary_variant_handles: None,
2917 binary_variant_instantiation_handles: None,
2918 binary_format_limits_profile: None,
2919 max_move_object_size: Some(250 * 1024),
2920 max_move_package_size: Some(100 * 1024),
2921 max_publish_or_upgrade_per_ptb: None,
2922 max_tx_gas: Some(10_000_000_000),
2923 max_gas_price: Some(100_000),
2924 max_gas_price_rgp_factor_for_aborted_transactions: None,
2925 max_gas_computation_bucket: Some(5_000_000),
2926 max_loop_depth: Some(5),
2927 max_generic_instantiation_length: Some(32),
2928 max_function_parameters: Some(128),
2929 max_basic_blocks: Some(1024),
2930 max_value_stack_size: Some(1024),
2931 max_type_nodes: Some(256),
2932 max_generic_instantiation_type_nodes_per_function: None,
2933 max_generic_instantiation_type_nodes_per_module: None,
2934 max_accumulator_type_nodes: None,
2935 max_push_size: Some(10000),
2936 max_struct_definitions: Some(200),
2937 max_function_definitions: Some(1000),
2938 max_fields_in_struct: Some(32),
2939 max_dependency_depth: Some(100),
2940 max_num_event_emit: Some(256),
2941 max_num_accumulator_events: None,
2942 max_num_new_move_object_ids: Some(2048),
2943 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2944 max_num_deleted_move_object_ids: Some(2048),
2945 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2946 max_num_transferred_move_object_ids: Some(2048),
2947 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2948 max_event_emit_size: Some(250 * 1024),
2949 max_move_vector_len: Some(256 * 1024),
2950 max_type_to_layout_nodes: None,
2951 max_ptb_value_size: None,
2952
2953 max_back_edges_per_function: Some(10_000),
2954 max_back_edges_per_module: Some(10_000),
2955 max_verifier_meter_ticks_per_function: Some(6_000_000),
2956 max_meter_ticks_per_module: Some(6_000_000),
2957 max_meter_ticks_per_package: None,
2958
2959 object_runtime_max_num_cached_objects: Some(1000),
2960 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2961 object_runtime_max_loaded_child_value_size: None,
2962 max_freeze_list_address_reads: None,
2963 object_runtime_max_num_store_entries: Some(1000),
2964 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2965 base_tx_cost_fixed: Some(110_000),
2966 package_publish_cost_fixed: Some(1_000),
2967 base_tx_cost_per_byte: Some(0),
2968 package_publish_cost_per_byte: Some(80),
2969 package_publish_charge_fixed: None,
2970 package_publish_charge_per_module: None,
2971 package_publish_charge_per_dependency: None,
2972 mutable_system_object_input_charge_ids: None,
2973 mutable_system_object_input_charge: None,
2974 obj_access_cost_read_per_byte: Some(15),
2975 obj_access_cost_read_per_package_kb: None,
2976 obj_access_cost_mutate_per_byte: Some(40),
2977 obj_access_cost_delete_per_byte: Some(40),
2978 obj_access_cost_verify_per_byte: Some(200),
2979 obj_data_cost_refundable: Some(100),
2980 obj_metadata_cost_non_refundable: Some(50),
2981 gas_model_version: Some(1),
2982 storage_rebate_rate: Some(9900),
2983 storage_fund_reinvest_rate: Some(500),
2984 reward_slashing_rate: Some(5000),
2985 storage_gas_price: Some(1),
2986 accumulator_object_storage_cost: None,
2987 max_transactions_per_checkpoint: Some(10_000),
2988 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2989
2990 buffer_stake_for_protocol_upgrade_bps: Some(0),
2993
2994 address_from_bytes_cost_base: Some(52),
2998 address_to_u256_cost_base: Some(52),
3000 address_from_u256_cost_base: Some(52),
3002
3003 config_read_setting_impl_cost_base: None,
3006 config_read_setting_impl_cost_per_byte: None,
3007
3008 package_original_package_id_impl_cost_base: None,
3009 package_original_package_id_impl_cost_per_byte: None,
3010
3011 dynamic_field_hash_type_and_key_cost_base: Some(100),
3014 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
3015 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
3016 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
3017 dynamic_field_add_child_object_cost_base: Some(100),
3019 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
3020 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
3021 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
3022 dynamic_field_borrow_child_object_cost_base: Some(100),
3024 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3025 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3026 dynamic_field_remove_child_object_cost_base: Some(100),
3028 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3029 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3030 dynamic_field_has_child_object_cost_base: Some(100),
3032 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3034 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3035 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3036
3037 scratch_add_cost_base: None,
3039 scratch_read_cost_base: None,
3040 scratch_read_value_cost: None,
3041 scratch_remove_cost_base: None,
3042 scratch_exists_cost_base: None,
3043 scratch_exists_with_type_cost_base: None,
3044 scratch_exists_with_type_type_cost: None,
3045 max_scratch_pad_size: None,
3046
3047 event_emit_cost_base: Some(52),
3050 event_emit_value_size_derivation_cost_per_byte: Some(2),
3051 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3052 event_emit_output_cost_per_byte: Some(10),
3053 event_emit_auth_stream_cost: None,
3054
3055 reserve_object_funds_for_withdrawal_cost_base: None,
3057 reserve_object_funds_for_withdrawal_cold_read_cost: None,
3058
3059 object_borrow_uid_cost_base: Some(52),
3062 object_delete_impl_cost_base: Some(52),
3064 object_record_new_uid_cost_base: Some(52),
3066 object_record_new_uid_from_hash_cost_base: None,
3069 object_is_shared_input_cost_base: None,
3072
3073 transfer_transfer_internal_cost_base: Some(52),
3076 transfer_party_transfer_internal_cost_base: None,
3078 transfer_freeze_object_cost_base: Some(52),
3080 transfer_share_object_cost_base: Some(52),
3082 transfer_receive_object_cost_base: None,
3083 transfer_receive_object_type_cost_per_byte: None,
3084 transfer_receive_object_cost_per_byte: None,
3085
3086 tx_context_derive_id_cost_base: Some(52),
3089 tx_context_fresh_id_cost_base: None,
3090 tx_context_sender_cost_base: None,
3091 tx_context_epoch_cost_base: None,
3092 tx_context_epoch_timestamp_ms_cost_base: None,
3093 tx_context_sponsor_cost_base: None,
3094 tx_context_rgp_cost_base: None,
3095 tx_context_gas_price_cost_base: None,
3096 tx_context_gas_budget_cost_base: None,
3097 tx_context_ids_created_cost_base: None,
3098 tx_context_replace_cost_base: None,
3099
3100 clock_borrow_cost_base: None,
3102
3103 types_is_one_time_witness_cost_base: Some(52),
3106 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3107 types_is_one_time_witness_type_cost_per_byte: Some(2),
3108
3109 validator_validate_metadata_cost_base: Some(52),
3112 validator_validate_metadata_data_cost_per_byte: Some(2),
3113
3114 crypto_invalid_arguments_cost: Some(100),
3116 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3118 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3119 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3120
3121 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3123 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3124 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3125
3126 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3128 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3129 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3130 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3131 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3132 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3133
3134 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3136
3137 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3139 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3140 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3141 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3142 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3143 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3144
3145 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3147 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3148 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3149 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3150 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3151 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3152
3153 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3155 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3156 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3157 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3158 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3159 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3160
3161 ecvrf_ecvrf_verify_cost_base: Some(52),
3163 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3164 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3165
3166 ed25519_ed25519_verify_cost_base: Some(52),
3168 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3169 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3170
3171 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3173 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3174
3175 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3177 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3178 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3179 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3180 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3181
3182 hash_blake2b256_cost_base: Some(52),
3184 hash_blake2b256_data_cost_per_byte: Some(2),
3185 hash_blake2b256_data_cost_per_block: Some(2),
3186
3187 hash_keccak256_cost_base: Some(52),
3189 hash_keccak256_data_cost_per_byte: Some(2),
3190 hash_keccak256_data_cost_per_block: Some(2),
3191
3192 poseidon_bn254_cost_base: None,
3193 poseidon_bn254_cost_per_block: None,
3194
3195 hmac_hmac_sha3_256_cost_base: Some(52),
3197 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3198 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3199
3200 group_ops_bls12381_decode_scalar_cost: None,
3202 group_ops_bls12381_decode_g1_cost: None,
3203 group_ops_bls12381_decode_g2_cost: None,
3204 group_ops_bls12381_decode_gt_cost: None,
3205 group_ops_bls12381_scalar_add_cost: None,
3206 group_ops_bls12381_g1_add_cost: None,
3207 group_ops_bls12381_g2_add_cost: None,
3208 group_ops_bls12381_gt_add_cost: None,
3209 group_ops_bls12381_scalar_sub_cost: None,
3210 group_ops_bls12381_g1_sub_cost: None,
3211 group_ops_bls12381_g2_sub_cost: None,
3212 group_ops_bls12381_gt_sub_cost: None,
3213 group_ops_bls12381_scalar_mul_cost: None,
3214 group_ops_bls12381_g1_mul_cost: None,
3215 group_ops_bls12381_g2_mul_cost: None,
3216 group_ops_bls12381_gt_mul_cost: None,
3217 group_ops_bls12381_scalar_div_cost: None,
3218 group_ops_bls12381_g1_div_cost: None,
3219 group_ops_bls12381_g2_div_cost: None,
3220 group_ops_bls12381_gt_div_cost: None,
3221 group_ops_bls12381_g1_hash_to_base_cost: None,
3222 group_ops_bls12381_g2_hash_to_base_cost: None,
3223 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3224 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3225 group_ops_bls12381_g1_msm_base_cost: None,
3226 group_ops_bls12381_g2_msm_base_cost: None,
3227 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3228 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3229 group_ops_bls12381_msm_max_len: None,
3230 group_ops_bls12381_pairing_cost: None,
3231 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3232 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3233 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3234 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3235 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3236
3237 group_ops_ristretto_decode_scalar_cost: None,
3238 group_ops_ristretto_decode_point_cost: None,
3239 group_ops_ristretto_scalar_add_cost: None,
3240 group_ops_ristretto_point_add_cost: None,
3241 group_ops_ristretto_scalar_sub_cost: None,
3242 group_ops_ristretto_point_sub_cost: None,
3243 group_ops_ristretto_scalar_mul_cost: None,
3244 group_ops_ristretto_point_mul_cost: None,
3245 group_ops_ristretto_scalar_div_cost: None,
3246 group_ops_ristretto_point_div_cost: None,
3247
3248 verify_bulletproofs_ristretto255_base_cost: None,
3249 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3250 max_bulletproofs_total_bits: None,
3251
3252 check_zklogin_id_cost_base: None,
3254 check_zklogin_issuer_cost_base: None,
3256
3257 vdf_verify_vdf_cost: None,
3258 vdf_hash_to_input_cost: None,
3259
3260 nitro_attestation_parse_base_cost: None,
3262 nitro_attestation_parse_cost_per_byte: None,
3263 nitro_attestation_verify_base_cost: None,
3264 nitro_attestation_verify_cost_per_cert: None,
3265
3266 layout_node_cost: None,
3267 layout_node_cost_large_layout_threshold: None,
3268 bcs_per_input_abstract_unit_cost: None,
3269 bcs_per_byte_serialized_cost: None,
3270 bcs_legacy_min_output_size_cost: None,
3271 bcs_failure_cost: None,
3272 hash_sha2_256_base_cost: None,
3273 hash_sha2_256_per_byte_cost: None,
3274 hash_sha2_256_legacy_min_input_len_cost: None,
3275 hash_sha3_256_base_cost: None,
3276 hash_sha3_256_per_byte_cost: None,
3277 hash_sha3_256_legacy_min_input_len_cost: None,
3278 type_name_get_base_cost: None,
3279 type_name_get_per_byte_cost: None,
3280 type_name_id_base_cost: None,
3281 string_check_utf8_base_cost: None,
3282 string_check_utf8_per_byte_cost: None,
3283 string_is_char_boundary_base_cost: None,
3284 string_sub_string_base_cost: None,
3285 string_sub_string_per_byte_cost: None,
3286 string_index_of_base_cost: None,
3287 string_index_of_per_byte_pattern_cost: None,
3288 string_index_of_per_byte_searched_cost: None,
3289 vector_empty_base_cost: None,
3290 vector_length_base_cost: None,
3291 vector_push_back_base_cost: None,
3292 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3293 vector_borrow_base_cost: None,
3294 vector_pop_back_base_cost: None,
3295 vector_destroy_empty_base_cost: None,
3296 vector_swap_base_cost: None,
3297 vector_reverse_base_cost: None,
3298 vector_reverse_per_elem_cost: None,
3299 vector_keep_range_base_cost: None,
3300 vector_keep_range_per_dropped_elem_cost: None,
3301 vector_keep_range_per_moved_elem_cost: None,
3302 vector_copy_range_base_cost: None,
3303 vector_copy_range_per_abstract_memory_unit_cost: None,
3304 vector_replace_range_base_cost: None,
3305 vector_replace_range_per_elem_cost: None,
3306 debug_print_base_cost: None,
3307 debug_print_stack_trace_base_cost: None,
3308
3309 max_size_written_objects: None,
3310 max_size_written_objects_system_tx: None,
3311
3312 max_move_identifier_len: None,
3319 max_move_value_depth: None,
3320 package_arena_size_in_bytes: None,
3321 max_move_enum_variants: None,
3322
3323 gas_rounding_step: None,
3324
3325 execution_version: None,
3326
3327 max_event_emit_size_total: None,
3328
3329 consensus_bad_nodes_stake_threshold: None,
3330
3331 max_jwk_votes_per_validator_per_epoch: None,
3332
3333 max_age_of_jwk_in_epochs: None,
3334
3335 random_beacon_reduction_allowed_delta: None,
3336
3337 random_beacon_reduction_lower_bound: None,
3338
3339 random_beacon_dkg_timeout_round: None,
3340
3341 random_beacon_min_round_interval_ms: None,
3342
3343 random_beacon_dkg_version: None,
3344
3345 consensus_max_transaction_size_bytes: None,
3346
3347 consensus_max_transactions_in_block_bytes: None,
3348
3349 consensus_max_num_transactions_in_block: None,
3350
3351 consensus_voting_rounds: None,
3352
3353 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3354
3355 max_deferral_rounds_for_congestion_control: None,
3356
3357 epoch_close_deadline_ms: None,
3358
3359 max_txn_cost_overage_per_object_in_commit: None,
3360
3361 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3362
3363 min_checkpoint_interval_ms: None,
3364 checkpoint_queue_max_undrained_ms: None,
3365
3366 checkpoint_summary_version_specific_data: None,
3367
3368 max_soft_bundle_size: None,
3369
3370 bridge_should_try_to_finalize_committee: None,
3371
3372 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3373
3374 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3375
3376 consensus_gc_depth: None,
3377
3378 gas_budget_based_txn_cost_cap_factor: None,
3379
3380 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3381
3382 sip_45_consensus_amplification_threshold: None,
3383 staggered_submission_signal_window_commits: None,
3384 staggered_submission_signal_min_excess_copies_per_commit: None,
3385 staggered_submission_signal_min_consensus_user_transactions_per_commit: None,
3386 staggered_submission_signal_exit_dwell_commits: None,
3387 staggered_submission_signal_band1_enter_ratio_bps: None,
3388 staggered_submission_signal_band1_exit_ratio_bps: None,
3389 staggered_submission_signal_band2_enter_ratio_bps: None,
3390 staggered_submission_signal_band2_exit_ratio_bps: None,
3391
3392 use_object_per_epoch_marker_table_v2: None,
3393
3394 consensus_commit_rate_estimation_window_size: None,
3395
3396 aliased_addresses: vec![],
3397
3398 translation_per_command_base_charge: None,
3399 translation_per_input_base_charge: None,
3400 translation_pure_input_per_byte_charge: None,
3401 translation_per_type_node_charge: None,
3402 translation_per_reference_node_charge: None,
3403 translation_per_linkage_entry_charge: None,
3404 translation_per_live_reference_charge: None,
3405 max_ptb_live_references: None,
3406 max_ptb_returned_references: None,
3407 max_ptb_total_returned_references: None,
3408
3409 max_updates_per_settlement_txn: None,
3410
3411 gasless_max_computation_units: None,
3412 gasless_allowed_token_types: None,
3413 gasless_max_unused_inputs: None,
3414 gasless_max_pure_input_bytes: None,
3415 gasless_max_tps: None,
3416 include_special_package_amendments: None,
3417 gasless_max_tx_size_bytes: None,
3418 };
3421 for cur in 2..=version.0 {
3422 match cur {
3423 1 => unreachable!(),
3424 2 => {
3425 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3426 }
3427 3 => {
3428 cfg.gas_model_version = Some(2);
3430 cfg.max_tx_gas = Some(50_000_000_000);
3432 cfg.base_tx_cost_fixed = Some(2_000);
3434 cfg.storage_gas_price = Some(76);
3436 cfg.feature_flags.loaded_child_objects_fixed = true;
3437 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3440 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3443 cfg.feature_flags.package_upgrades = true;
3444 }
3445 4 => {
3450 cfg.reward_slashing_rate = Some(10000);
3452 cfg.gas_model_version = Some(3);
3454 }
3455 5 => {
3456 cfg.feature_flags.missing_type_is_compatibility_error = true;
3457 cfg.gas_model_version = Some(4);
3458 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3459 }
3463 6 => {
3464 cfg.gas_model_version = Some(5);
3465 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3466 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3467 }
3468 7 => {
3469 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3470 cfg.feature_flags
3471 .disable_invariant_violation_check_in_swap_loc = true;
3472 cfg.feature_flags.ban_entry_init = true;
3473 cfg.feature_flags.package_digest_hash_module = true;
3474 }
3475 8 => {
3476 cfg.feature_flags
3477 .disallow_change_struct_type_params_on_upgrade = true;
3478 }
3479 9 => {
3480 cfg.max_move_identifier_len = Some(128);
3482 cfg.feature_flags.no_extraneous_module_bytes = true;
3483 cfg.feature_flags
3484 .advance_to_highest_supported_protocol_version = true;
3485 }
3486 10 => {
3487 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3488 cfg.max_meter_ticks_per_module = Some(16_000_000);
3489 }
3490 11 => {
3491 cfg.max_move_value_depth = Some(128);
3492 }
3493 12 => {
3494 cfg.feature_flags.narwhal_versioned_metadata = true;
3495 if chain != Chain::Mainnet {
3496 cfg.feature_flags.commit_root_state_digest = true;
3497 }
3498
3499 if chain != Chain::Mainnet && chain != Chain::Testnet {
3500 cfg.feature_flags.zklogin_auth = true;
3501 }
3502 }
3503 13 => {}
3504 14 => {
3505 cfg.gas_rounding_step = Some(1_000);
3506 cfg.gas_model_version = Some(6);
3507 }
3508 15 => {
3509 cfg.feature_flags.consensus_transaction_ordering =
3510 ConsensusTransactionOrdering::ByGasPrice;
3511 }
3512 16 => {
3513 cfg.feature_flags.simplified_unwrap_then_delete = true;
3514 }
3515 17 => {
3516 cfg.feature_flags.upgraded_multisig_supported = true;
3517 }
3518 18 => {
3519 cfg.execution_version = Some(1);
3520 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3529 cfg.base_tx_cost_fixed = Some(1_000);
3531 }
3532 19 => {
3533 cfg.max_num_event_emit = Some(1024);
3534 cfg.max_event_emit_size_total = Some(
3537 256 * 250 * 1024, );
3539 }
3540 20 => {
3541 cfg.feature_flags.commit_root_state_digest = true;
3542
3543 if chain != Chain::Mainnet {
3544 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3545 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3546 }
3547 }
3548
3549 21 => {
3550 if chain != Chain::Mainnet {
3551 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3552 "Google".to_string(),
3553 "Facebook".to_string(),
3554 "Twitch".to_string(),
3555 ]);
3556 }
3557 }
3558 22 => {
3559 cfg.feature_flags.loaded_child_object_format = true;
3560 }
3561 23 => {
3562 cfg.feature_flags.loaded_child_object_format_type = true;
3563 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3564 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3570 }
3571 24 => {
3572 cfg.feature_flags.simple_conservation_checks = true;
3573 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3574
3575 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3576
3577 if chain != Chain::Mainnet {
3578 cfg.feature_flags.enable_jwk_consensus_updates = true;
3579 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3581 cfg.max_age_of_jwk_in_epochs = Some(1);
3582 }
3583 }
3584 25 => {
3585 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3587 "Google".to_string(),
3588 "Facebook".to_string(),
3589 "Twitch".to_string(),
3590 ]);
3591 cfg.feature_flags.zklogin_auth = true;
3592
3593 cfg.feature_flags.enable_jwk_consensus_updates = true;
3595 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3596 cfg.max_age_of_jwk_in_epochs = Some(1);
3597 }
3598 26 => {
3599 cfg.gas_model_version = Some(7);
3600 if chain != Chain::Mainnet && chain != Chain::Testnet {
3602 cfg.transfer_receive_object_cost_base = Some(52);
3603 cfg.feature_flags.receive_objects = true;
3604 }
3605 }
3606 27 => {
3607 cfg.gas_model_version = Some(8);
3608 }
3609 28 => {
3610 cfg.check_zklogin_id_cost_base = Some(200);
3612 cfg.check_zklogin_issuer_cost_base = Some(200);
3614
3615 if chain != Chain::Mainnet && chain != Chain::Testnet {
3617 cfg.feature_flags.enable_effects_v2 = true;
3618 }
3619 }
3620 29 => {
3621 cfg.feature_flags.verify_legacy_zklogin_address = true;
3622 }
3623 30 => {
3624 if chain != Chain::Mainnet {
3626 cfg.feature_flags.narwhal_certificate_v2 = true;
3627 }
3628
3629 cfg.random_beacon_reduction_allowed_delta = Some(800);
3630 if chain != Chain::Mainnet {
3632 cfg.feature_flags.enable_effects_v2 = true;
3633 }
3634
3635 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3639
3640 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3641 }
3642 31 => {
3643 cfg.execution_version = Some(2);
3644 if chain != Chain::Mainnet && chain != Chain::Testnet {
3646 cfg.feature_flags.shared_object_deletion = true;
3647 }
3648 }
3649 32 => {
3650 if chain != Chain::Mainnet {
3652 cfg.feature_flags.accept_zklogin_in_multisig = true;
3653 }
3654 if chain != Chain::Mainnet {
3656 cfg.transfer_receive_object_cost_base = Some(52);
3657 cfg.feature_flags.receive_objects = true;
3658 }
3659 if chain != Chain::Mainnet && chain != Chain::Testnet {
3661 cfg.feature_flags.random_beacon = true;
3662 cfg.random_beacon_reduction_lower_bound = Some(1600);
3663 cfg.random_beacon_dkg_timeout_round = Some(3000);
3664 cfg.random_beacon_min_round_interval_ms = Some(150);
3665 }
3666 if chain != Chain::Testnet && chain != Chain::Mainnet {
3668 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3669 }
3670
3671 cfg.feature_flags.narwhal_certificate_v2 = true;
3673 }
3674 33 => {
3675 cfg.feature_flags.hardened_otw_check = true;
3676 cfg.feature_flags.allow_receiving_object_id = true;
3677
3678 cfg.transfer_receive_object_cost_base = Some(52);
3680 cfg.feature_flags.receive_objects = true;
3681
3682 if chain != Chain::Mainnet {
3684 cfg.feature_flags.shared_object_deletion = true;
3685 }
3686
3687 cfg.feature_flags.enable_effects_v2 = true;
3688 }
3689 34 => {}
3690 35 => {
3691 if chain != Chain::Mainnet && chain != Chain::Testnet {
3693 cfg.feature_flags.enable_poseidon = true;
3694 cfg.poseidon_bn254_cost_base = Some(260);
3695 cfg.poseidon_bn254_cost_per_block = Some(10);
3696 }
3697
3698 cfg.feature_flags.enable_coin_deny_list = true;
3699 }
3700 36 => {
3701 if chain != Chain::Mainnet && chain != Chain::Testnet {
3703 cfg.feature_flags.enable_group_ops_native_functions = true;
3704 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3705 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3707 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3708 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3709 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3710 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3711 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3712 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3713 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3714 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3715 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3716 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3717 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3718 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3719 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3720 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3721 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3722 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3723 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3724 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3725 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3726 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3727 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3728 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3729 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3730 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3731 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3732 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3733 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3734 cfg.group_ops_bls12381_msm_max_len = Some(32);
3735 cfg.group_ops_bls12381_pairing_cost = Some(52);
3736 }
3737 cfg.feature_flags.shared_object_deletion = true;
3739
3740 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3742 }
3744 37 => {
3745 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3746
3747 if chain != Chain::Mainnet {
3749 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3750 }
3751 }
3752 38 => {
3753 cfg.binary_module_handles = Some(100);
3754 cfg.binary_struct_handles = Some(300);
3755 cfg.binary_function_handles = Some(1500);
3756 cfg.binary_function_instantiations = Some(750);
3757 cfg.binary_signatures = Some(1000);
3758 cfg.binary_constant_pool = Some(4000);
3762 cfg.binary_identifiers = Some(10000);
3763 cfg.binary_address_identifiers = Some(100);
3764 cfg.binary_struct_defs = Some(200);
3765 cfg.binary_struct_def_instantiations = Some(100);
3766 cfg.binary_function_defs = Some(1000);
3767 cfg.binary_field_handles = Some(500);
3768 cfg.binary_field_instantiations = Some(250);
3769 cfg.binary_friend_decls = Some(100);
3770 cfg.max_package_dependencies = Some(32);
3772 cfg.max_modules_in_publish = Some(64);
3773 cfg.execution_version = Some(3);
3775 }
3776 39 => {
3777 }
3779 40 => {}
3780 41 => {
3781 cfg.feature_flags.enable_group_ops_native_functions = true;
3783 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3785 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3786 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3787 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3788 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3789 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3790 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3791 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3792 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3793 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3794 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3795 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3796 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3797 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3798 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3799 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3800 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3801 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3802 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3803 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3804 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3805 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3806 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3807 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3808 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3809 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3810 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3811 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3812 cfg.group_ops_bls12381_msm_max_len = Some(32);
3813 cfg.group_ops_bls12381_pairing_cost = Some(52);
3814 }
3815 42 => {}
3816 43 => {
3817 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3818 cfg.max_meter_ticks_per_package = Some(16_000_000);
3819 }
3820 44 => {
3821 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3823 if chain != Chain::Mainnet {
3825 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3826 }
3827 }
3828 45 => {
3829 if chain != Chain::Testnet && chain != Chain::Mainnet {
3831 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3832 }
3833
3834 if chain != Chain::Mainnet {
3835 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3837 }
3838 cfg.min_move_binary_format_version = Some(6);
3839 cfg.feature_flags.accept_zklogin_in_multisig = true;
3840
3841 if chain != Chain::Mainnet && chain != Chain::Testnet {
3845 cfg.feature_flags.bridge = true;
3846 }
3847 }
3848 46 => {
3849 if chain != Chain::Mainnet {
3851 cfg.feature_flags.bridge = true;
3852 }
3853
3854 cfg.feature_flags.reshare_at_same_initial_version = true;
3856 }
3857 47 => {}
3858 48 => {
3859 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3861
3862 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3864
3865 if chain != Chain::Mainnet {
3867 cfg.feature_flags.random_beacon = true;
3868 cfg.random_beacon_reduction_lower_bound = Some(1600);
3869 cfg.random_beacon_dkg_timeout_round = Some(3000);
3870 cfg.random_beacon_min_round_interval_ms = Some(200);
3871 }
3872
3873 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3875 }
3876 49 => {
3877 if chain != Chain::Testnet && chain != Chain::Mainnet {
3878 cfg.move_binary_format_version = Some(7);
3879 }
3880
3881 if chain != Chain::Mainnet && chain != Chain::Testnet {
3883 cfg.feature_flags.enable_vdf = true;
3884 cfg.vdf_verify_vdf_cost = Some(1500);
3887 cfg.vdf_hash_to_input_cost = Some(100);
3888 }
3889
3890 if chain != Chain::Testnet && chain != Chain::Mainnet {
3892 cfg.feature_flags
3893 .record_consensus_determined_version_assignments_in_prologue = true;
3894 }
3895
3896 if chain != Chain::Mainnet {
3898 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3899 }
3900
3901 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3903 }
3904 50 => {
3905 if chain != Chain::Mainnet {
3907 cfg.checkpoint_summary_version_specific_data = Some(1);
3908 cfg.min_checkpoint_interval_ms = Some(200);
3909 }
3910
3911 if chain != Chain::Testnet && chain != Chain::Mainnet {
3913 cfg.feature_flags
3914 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3915 }
3916
3917 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3918
3919 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3921 }
3922 51 => {
3923 cfg.random_beacon_dkg_version = Some(1);
3924
3925 if chain != Chain::Testnet && chain != Chain::Mainnet {
3926 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3927 }
3928 }
3929 52 => {
3930 if chain != Chain::Mainnet {
3931 cfg.feature_flags.soft_bundle = true;
3932 cfg.max_soft_bundle_size = Some(5);
3933 }
3934
3935 cfg.config_read_setting_impl_cost_base = Some(100);
3936 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3937
3938 if chain != Chain::Testnet && chain != Chain::Mainnet {
3940 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3941 cfg.feature_flags.per_object_congestion_control_mode =
3942 PerObjectCongestionControlMode::TotalTxCount;
3943 }
3944
3945 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3947
3948 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3950
3951 cfg.checkpoint_summary_version_specific_data = Some(1);
3953 cfg.min_checkpoint_interval_ms = Some(200);
3954
3955 if chain != Chain::Mainnet {
3957 cfg.feature_flags
3958 .record_consensus_determined_version_assignments_in_prologue = true;
3959 cfg.feature_flags
3960 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3961 }
3962 if chain != Chain::Mainnet {
3964 cfg.move_binary_format_version = Some(7);
3965 }
3966
3967 if chain != Chain::Testnet && chain != Chain::Mainnet {
3968 cfg.feature_flags.passkey_auth = true;
3969 }
3970 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3971 }
3972 53 => {
3973 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3975
3976 cfg.feature_flags
3978 .record_consensus_determined_version_assignments_in_prologue = true;
3979 cfg.feature_flags
3980 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3981
3982 if chain == Chain::Unknown {
3983 cfg.feature_flags.authority_capabilities_v2 = true;
3984 }
3985
3986 if chain != Chain::Mainnet {
3988 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3989 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3990 cfg.feature_flags.per_object_congestion_control_mode =
3991 PerObjectCongestionControlMode::TotalTxCount;
3992 }
3993
3994 cfg.bcs_per_byte_serialized_cost = Some(2);
3996 cfg.bcs_legacy_min_output_size_cost = Some(1);
3997 cfg.bcs_failure_cost = Some(52);
3998 cfg.debug_print_base_cost = Some(52);
3999 cfg.debug_print_stack_trace_base_cost = Some(52);
4000 cfg.hash_sha2_256_base_cost = Some(52);
4001 cfg.hash_sha2_256_per_byte_cost = Some(2);
4002 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
4003 cfg.hash_sha3_256_base_cost = Some(52);
4004 cfg.hash_sha3_256_per_byte_cost = Some(2);
4005 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
4006 cfg.type_name_get_base_cost = Some(52);
4007 cfg.type_name_get_per_byte_cost = Some(2);
4008 cfg.string_check_utf8_base_cost = Some(52);
4009 cfg.string_check_utf8_per_byte_cost = Some(2);
4010 cfg.string_is_char_boundary_base_cost = Some(52);
4011 cfg.string_sub_string_base_cost = Some(52);
4012 cfg.string_sub_string_per_byte_cost = Some(2);
4013 cfg.string_index_of_base_cost = Some(52);
4014 cfg.string_index_of_per_byte_pattern_cost = Some(2);
4015 cfg.string_index_of_per_byte_searched_cost = Some(2);
4016 cfg.vector_empty_base_cost = Some(52);
4017 cfg.vector_length_base_cost = Some(52);
4018 cfg.vector_push_back_base_cost = Some(52);
4019 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
4020 cfg.vector_borrow_base_cost = Some(52);
4021 cfg.vector_pop_back_base_cost = Some(52);
4022 cfg.vector_destroy_empty_base_cost = Some(52);
4023 cfg.vector_swap_base_cost = Some(52);
4024 }
4025 54 => {
4026 cfg.feature_flags.random_beacon = true;
4028 cfg.random_beacon_reduction_lower_bound = Some(1000);
4029 cfg.random_beacon_dkg_timeout_round = Some(3000);
4030 cfg.random_beacon_min_round_interval_ms = Some(500);
4031
4032 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
4034 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
4035 cfg.feature_flags.per_object_congestion_control_mode =
4036 PerObjectCongestionControlMode::TotalTxCount;
4037
4038 cfg.feature_flags.soft_bundle = true;
4040 cfg.max_soft_bundle_size = Some(5);
4041 }
4042 55 => {
4043 cfg.move_binary_format_version = Some(7);
4045
4046 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
4048 cfg.consensus_max_num_transactions_in_block = Some(512);
4051
4052 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
4053 }
4054 56 => {
4055 if chain == Chain::Mainnet {
4056 cfg.feature_flags.bridge = true;
4057 }
4058 }
4059 57 => {
4060 cfg.random_beacon_reduction_lower_bound = Some(800);
4062 }
4063 58 => {
4064 if chain == Chain::Mainnet {
4065 cfg.bridge_should_try_to_finalize_committee = Some(true);
4066 }
4067
4068 if chain != Chain::Mainnet && chain != Chain::Testnet {
4069 cfg.feature_flags
4071 .consensus_distributed_vote_scoring_strategy = true;
4072 }
4073 }
4074 59 => {
4075 cfg.feature_flags.consensus_round_prober = true;
4077 }
4078 60 => {
4079 cfg.max_type_to_layout_nodes = Some(512);
4080 cfg.feature_flags.validate_identifier_inputs = true;
4081 }
4082 61 => {
4083 if chain != Chain::Mainnet {
4084 cfg.feature_flags
4086 .consensus_distributed_vote_scoring_strategy = true;
4087 }
4088 cfg.random_beacon_reduction_lower_bound = Some(700);
4090
4091 if chain != Chain::Mainnet && chain != Chain::Testnet {
4092 cfg.feature_flags.mysticeti_fastpath = true;
4094 }
4095 }
4096 62 => {
4097 cfg.feature_flags.relocate_event_module = true;
4098 }
4099 63 => {
4100 cfg.feature_flags.per_object_congestion_control_mode =
4101 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4102 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4103 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4104 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4105 }
4106 64 => {
4107 cfg.feature_flags.per_object_congestion_control_mode =
4108 PerObjectCongestionControlMode::TotalTxCount;
4109 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4110 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4111 }
4112 65 => {
4113 cfg.feature_flags
4115 .consensus_distributed_vote_scoring_strategy = true;
4116 }
4117 66 => {
4118 if chain == Chain::Mainnet {
4119 cfg.feature_flags
4121 .consensus_distributed_vote_scoring_strategy = false;
4122 }
4123 }
4124 67 => {
4125 cfg.feature_flags
4127 .consensus_distributed_vote_scoring_strategy = true;
4128 }
4129 68 => {
4130 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4131 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4132 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4133 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4134 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4135
4136 if chain != Chain::Mainnet && chain != Chain::Testnet {
4137 cfg.feature_flags.uncompressed_g1_group_elements = true;
4138 }
4139
4140 cfg.feature_flags.per_object_congestion_control_mode =
4141 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4142 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4143 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4144 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4145 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4147 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4148
4149 cfg.random_beacon_reduction_lower_bound = Some(500);
4151
4152 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4153 }
4154 69 => {
4155 cfg.consensus_voting_rounds = Some(40);
4157
4158 if chain != Chain::Mainnet && chain != Chain::Testnet {
4159 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4161 }
4162
4163 if chain != Chain::Mainnet {
4164 cfg.feature_flags.uncompressed_g1_group_elements = true;
4165 }
4166 }
4167 70 => {
4168 if chain != Chain::Mainnet {
4169 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4171 cfg.feature_flags
4173 .consensus_round_prober_probe_accepted_rounds = true;
4174 }
4175
4176 cfg.poseidon_bn254_cost_per_block = Some(388);
4177
4178 cfg.gas_model_version = Some(9);
4179 cfg.feature_flags.native_charging_v2 = true;
4180 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4181 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4182 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4183 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4184 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4185 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4186 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4187 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4188
4189 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4191 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4192 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4193 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4194
4195 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4196 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4197 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4198 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4199 Some(8213);
4200 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4201 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4202 Some(9484);
4203
4204 cfg.hash_keccak256_cost_base = Some(10);
4205 cfg.hash_blake2b256_cost_base = Some(10);
4206
4207 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4209 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4210 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4211 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4212
4213 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4214 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4215 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4216 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4217
4218 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4219 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4220 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4221 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4222
4223 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4224 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4225 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4226 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4227
4228 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4229 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4230 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4231 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4232
4233 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4234 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4235
4236 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4237 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4238 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4239 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4240
4241 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4242 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4243 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4244 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4245
4246 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4247 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4248
4249 cfg.validator_validate_metadata_cost_base = Some(20000);
4250 }
4251 71 => {
4252 cfg.sip_45_consensus_amplification_threshold = Some(5);
4253
4254 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4256 }
4257 72 => {
4258 cfg.feature_flags.convert_type_argument_error = true;
4259
4260 cfg.max_tx_gas = Some(50_000_000_000_000);
4263 cfg.max_gas_price = Some(50_000_000_000);
4265
4266 cfg.feature_flags.variant_nodes = true;
4267 }
4268 73 => {
4269 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4271
4272 if chain != Chain::Mainnet && chain != Chain::Testnet {
4273 cfg.consensus_gc_depth = Some(60);
4276 }
4277
4278 if chain != Chain::Mainnet {
4279 cfg.feature_flags.consensus_zstd_compression = true;
4281 }
4282
4283 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4285 cfg.feature_flags
4287 .consensus_round_prober_probe_accepted_rounds = true;
4288
4289 cfg.feature_flags.per_object_congestion_control_mode =
4291 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4292 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4293 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4294 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4295 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4297 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4298 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4299 }
4300 74 => {
4301 if chain != Chain::Mainnet && chain != Chain::Testnet {
4303 cfg.feature_flags.enable_nitro_attestation = true;
4304 }
4305 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4306 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4307 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4308 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4309
4310 cfg.feature_flags.consensus_zstd_compression = true;
4312
4313 if chain != Chain::Mainnet && chain != Chain::Testnet {
4314 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4315 }
4316 }
4317 75 => {
4318 if chain != Chain::Mainnet {
4319 cfg.feature_flags.passkey_auth = true;
4320 }
4321 }
4322 76 => {
4323 if chain != Chain::Mainnet && chain != Chain::Testnet {
4324 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4325 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4326 }
4327 cfg.feature_flags.minimize_child_object_mutations = true;
4328
4329 if chain != Chain::Mainnet {
4330 cfg.feature_flags.accept_passkey_in_multisig = true;
4331 }
4332 }
4333 77 => {
4334 cfg.feature_flags.uncompressed_g1_group_elements = true;
4335
4336 if chain != Chain::Mainnet {
4337 cfg.consensus_gc_depth = Some(60);
4338 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4339 }
4340 }
4341 78 => {
4342 cfg.feature_flags.move_native_context = true;
4343 cfg.tx_context_fresh_id_cost_base = Some(52);
4344 cfg.tx_context_sender_cost_base = Some(30);
4345 cfg.tx_context_epoch_cost_base = Some(30);
4346 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4347 cfg.tx_context_sponsor_cost_base = Some(30);
4348 cfg.tx_context_gas_price_cost_base = Some(30);
4349 cfg.tx_context_gas_budget_cost_base = Some(30);
4350 cfg.tx_context_ids_created_cost_base = Some(30);
4351 cfg.tx_context_replace_cost_base = Some(30);
4352 cfg.gas_model_version = Some(10);
4353
4354 if chain != Chain::Mainnet {
4355 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4356 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4357
4358 cfg.feature_flags.per_object_congestion_control_mode =
4360 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4361 ExecutionTimeEstimateParams {
4362 target_utilization: 30,
4363 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4365 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4367 stored_observations_limit: u64::MAX,
4368 stake_weighted_median_threshold: 0,
4369 default_none_duration_for_new_keys: false,
4370 observations_chunk_size: None,
4371 },
4372 );
4373 }
4374 }
4375 79 => {
4376 if chain != Chain::Mainnet {
4377 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4378
4379 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4382
4383 cfg.feature_flags.consensus_batched_block_sync = true;
4384
4385 cfg.feature_flags.enable_nitro_attestation = true
4387 }
4388 cfg.feature_flags.normalize_ptb_arguments = true;
4389
4390 cfg.consensus_gc_depth = Some(60);
4391 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4392 }
4393 80 => {
4394 cfg.max_ptb_value_size = Some(1024 * 1024);
4395 }
4396 81 => {
4397 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4398 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4399 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4400 }
4401 82 => {
4402 cfg.feature_flags.max_ptb_value_size_v2 = true;
4403 }
4404 83 => {
4405 if chain == Chain::Mainnet {
4406 let aliased: [u8; 32] = Hex::decode(
4408 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4409 )
4410 .unwrap()
4411 .try_into()
4412 .unwrap();
4413
4414 cfg.aliased_addresses.push(AliasedAddress {
4416 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4417 aliased,
4418 allowed_tx_digests: vec![
4419 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4420 ],
4421 });
4422
4423 cfg.aliased_addresses.push(AliasedAddress {
4424 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4425 aliased,
4426 allowed_tx_digests: vec![
4427 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4428 ],
4429 });
4430 }
4431
4432 if chain != Chain::Mainnet {
4435 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4436 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4437
4438 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4440 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4441 cfg.feature_flags.per_object_congestion_control_mode =
4442 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4443 ExecutionTimeEstimateParams {
4444 target_utilization: 30,
4445 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4447 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4449 stored_observations_limit: u64::MAX,
4450 stake_weighted_median_threshold: 0,
4451 default_none_duration_for_new_keys: false,
4452 observations_chunk_size: None,
4453 },
4454 );
4455
4456 cfg.feature_flags.consensus_batched_block_sync = true;
4458
4459 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4462 cfg.feature_flags.enable_nitro_attestation = true;
4463 }
4464 }
4465 84 => {
4466 if chain == Chain::Mainnet {
4467 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4468 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4469
4470 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4472 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4473 cfg.feature_flags.per_object_congestion_control_mode =
4474 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4475 ExecutionTimeEstimateParams {
4476 target_utilization: 30,
4477 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4479 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4481 stored_observations_limit: u64::MAX,
4482 stake_weighted_median_threshold: 0,
4483 default_none_duration_for_new_keys: false,
4484 observations_chunk_size: None,
4485 },
4486 );
4487
4488 cfg.feature_flags.consensus_batched_block_sync = true;
4490
4491 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4494 cfg.feature_flags.enable_nitro_attestation = true;
4495 }
4496
4497 cfg.feature_flags.per_object_congestion_control_mode =
4499 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4500 ExecutionTimeEstimateParams {
4501 target_utilization: 30,
4502 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4504 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4506 stored_observations_limit: 20,
4507 stake_weighted_median_threshold: 0,
4508 default_none_duration_for_new_keys: false,
4509 observations_chunk_size: None,
4510 },
4511 );
4512 cfg.feature_flags.allow_unbounded_system_objects = true;
4513 }
4514 85 => {
4515 if chain != Chain::Mainnet && chain != Chain::Testnet {
4516 cfg.feature_flags.enable_party_transfer = true;
4517 }
4518
4519 cfg.feature_flags
4520 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4521 cfg.feature_flags.disallow_self_identifier = true;
4522 cfg.feature_flags.per_object_congestion_control_mode =
4523 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4524 ExecutionTimeEstimateParams {
4525 target_utilization: 50,
4526 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4528 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4530 stored_observations_limit: 20,
4531 stake_weighted_median_threshold: 0,
4532 default_none_duration_for_new_keys: false,
4533 observations_chunk_size: None,
4534 },
4535 );
4536 }
4537 86 => {
4538 cfg.feature_flags.type_tags_in_object_runtime = true;
4539 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4540
4541 cfg.feature_flags.per_object_congestion_control_mode =
4543 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4544 ExecutionTimeEstimateParams {
4545 target_utilization: 50,
4546 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4548 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4550 stored_observations_limit: 20,
4551 stake_weighted_median_threshold: 3334,
4552 default_none_duration_for_new_keys: false,
4553 observations_chunk_size: None,
4554 },
4555 );
4556 if chain != Chain::Mainnet {
4558 cfg.feature_flags.enable_party_transfer = true;
4559 }
4560 }
4561 87 => {
4562 if chain == Chain::Mainnet {
4563 cfg.feature_flags.record_time_estimate_processed = true;
4564 }
4565 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4566 }
4567 88 => {
4568 cfg.feature_flags.record_time_estimate_processed = true;
4569 cfg.tx_context_rgp_cost_base = Some(30);
4570 cfg.feature_flags
4571 .ignore_execution_time_observations_after_certs_closed = true;
4572
4573 cfg.feature_flags.per_object_congestion_control_mode =
4576 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4577 ExecutionTimeEstimateParams {
4578 target_utilization: 50,
4579 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4581 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4583 stored_observations_limit: 20,
4584 stake_weighted_median_threshold: 3334,
4585 default_none_duration_for_new_keys: true,
4586 observations_chunk_size: None,
4587 },
4588 );
4589 }
4590 89 => {
4591 cfg.feature_flags.dependency_linkage_error = true;
4592 cfg.feature_flags.additional_multisig_checks = true;
4593 }
4594 90 => {
4595 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4597 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4598 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4599 cfg.feature_flags.accept_passkey_in_multisig = true;
4600 cfg.feature_flags.passkey_auth = true;
4601 cfg.feature_flags.check_for_init_during_upgrade = true;
4602
4603 if chain != Chain::Mainnet {
4605 cfg.feature_flags.mysticeti_fastpath = true;
4606 }
4607 }
4608 91 => {
4609 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4610 }
4611 92 => {
4612 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4613 }
4614 93 => {
4615 cfg.feature_flags
4616 .consensus_checkpoint_signature_key_includes_digest = true;
4617 }
4618 94 => {
4619 cfg.feature_flags.per_object_congestion_control_mode =
4621 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4622 ExecutionTimeEstimateParams {
4623 target_utilization: 50,
4624 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4626 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4628 stored_observations_limit: 18,
4629 stake_weighted_median_threshold: 3334,
4630 default_none_duration_for_new_keys: true,
4631 observations_chunk_size: None,
4632 },
4633 );
4634
4635 cfg.feature_flags.enable_party_transfer = true;
4637 }
4638 95 => {
4639 cfg.type_name_id_base_cost = Some(52);
4640
4641 cfg.max_transactions_per_checkpoint = Some(20_000);
4643 }
4644 96 => {
4645 if chain != Chain::Mainnet && chain != Chain::Testnet {
4647 cfg.feature_flags
4648 .include_checkpoint_artifacts_digest_in_summary = true;
4649 }
4650 cfg.feature_flags.correct_gas_payment_limit_check = true;
4651 cfg.feature_flags.authority_capabilities_v2 = true;
4652 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4653 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4654 cfg.feature_flags.enable_coin_registry = true;
4655
4656 cfg.feature_flags.mysticeti_fastpath = true;
4658 }
4659 97 => {
4660 cfg.feature_flags.additional_borrow_checks = true;
4661 }
4662 98 => {
4663 cfg.event_emit_auth_stream_cost = Some(52);
4664 cfg.feature_flags.better_loader_errors = true;
4665 cfg.feature_flags.generate_df_type_layouts = true;
4666 }
4667 99 => {
4668 cfg.feature_flags.use_new_commit_handler = true;
4669 }
4670 100 => {
4671 cfg.feature_flags.private_generics_verifier_v2 = true;
4672 }
4673 101 => {
4674 cfg.feature_flags.create_root_accumulator_object = true;
4675 cfg.max_updates_per_settlement_txn = Some(100);
4676 if chain != Chain::Mainnet {
4677 cfg.feature_flags.enable_poseidon = true;
4678 }
4679 }
4680 102 => {
4681 cfg.feature_flags.per_object_congestion_control_mode =
4685 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4686 ExecutionTimeEstimateParams {
4687 target_utilization: 50,
4688 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4690 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4692 stored_observations_limit: 180,
4693 stake_weighted_median_threshold: 3334,
4694 default_none_duration_for_new_keys: true,
4695 observations_chunk_size: Some(18),
4696 },
4697 );
4698 cfg.feature_flags.deprecate_global_storage_ops = true;
4699 }
4700 103 => {}
4701 104 => {
4702 cfg.translation_per_command_base_charge = Some(1);
4703 cfg.translation_per_input_base_charge = Some(1);
4704 cfg.translation_pure_input_per_byte_charge = Some(1);
4705 cfg.translation_per_type_node_charge = Some(1);
4706 cfg.translation_per_reference_node_charge = Some(1);
4707 cfg.translation_per_linkage_entry_charge = Some(10);
4708 cfg.gas_model_version = Some(11);
4709 cfg.feature_flags.abstract_size_in_object_runtime = true;
4710 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4711 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4712 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4713 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4714 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4715 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4716 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4717 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4718 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4719 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4720 cfg.feature_flags.enable_ptb_execution_v2 = true;
4721
4722 cfg.poseidon_bn254_cost_base = Some(260);
4723
4724 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4725
4726 if chain != Chain::Mainnet {
4727 cfg.feature_flags
4728 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4729 }
4730
4731 cfg.feature_flags
4732 .include_cancelled_randomness_txns_in_prologue = true;
4733 }
4734 105 => {
4735 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4736 cfg.feature_flags.disable_preconsensus_locking = true;
4737
4738 if chain != Chain::Mainnet {
4739 cfg.feature_flags
4740 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4741 }
4742 }
4743 106 => {
4744 cfg.accumulator_object_storage_cost = Some(7600);
4746
4747 if chain != Chain::Mainnet && chain != Chain::Testnet {
4748 cfg.feature_flags.enable_accumulators = true;
4749 cfg.feature_flags.enable_address_balance_gas_payments = true;
4750 cfg.feature_flags.enable_authenticated_event_streams = true;
4751 cfg.feature_flags.enable_object_funds_withdraw = true;
4752 }
4753 }
4754 107 => {
4755 cfg.feature_flags
4756 .consensus_skip_gced_blocks_in_direct_finalization = true;
4757
4758 if in_integration_test() {
4760 cfg.consensus_gc_depth = Some(6);
4761 cfg.consensus_max_num_transactions_in_block = Some(8);
4762 }
4763 }
4764 108 => {
4765 cfg.feature_flags.gas_rounding_halve_digits = true;
4766 cfg.feature_flags.flexible_tx_context_positions = true;
4767 cfg.feature_flags.disable_entry_point_signature_check = true;
4768
4769 if chain != Chain::Mainnet {
4770 cfg.feature_flags.address_aliases = true;
4771
4772 cfg.feature_flags.enable_accumulators = true;
4773 cfg.feature_flags.enable_address_balance_gas_payments = true;
4774 }
4775
4776 cfg.feature_flags.enable_poseidon = true;
4777 }
4778 109 => {
4779 cfg.binary_variant_handles = Some(1024);
4780 cfg.binary_variant_instantiation_handles = Some(1024);
4781 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4782 }
4783 110 => {
4784 cfg.feature_flags
4785 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4786 cfg.feature_flags
4787 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4788 if chain != Chain::Mainnet && chain != Chain::Testnet {
4789 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4790 }
4791 cfg.feature_flags.validate_zklogin_public_identifier = true;
4792 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4793 cfg.feature_flags
4794 .consensus_always_accept_system_transactions = true;
4795 if chain != Chain::Mainnet {
4796 cfg.feature_flags.enable_object_funds_withdraw = true;
4797 }
4798 }
4799 111 => {
4800 cfg.feature_flags.validator_metadata_verify_v2 = true;
4801 }
4802 112 => {
4803 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4804 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4805 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4806 cfg.group_ops_ristretto_point_add_cost = Some(500);
4807 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4808 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4809 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4810 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4811 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4812 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4813
4814 if chain != Chain::Mainnet && chain != Chain::Testnet {
4815 cfg.feature_flags.enable_ristretto255_group_ops = true;
4816 }
4817 }
4818 113 => {
4819 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4820 if chain != Chain::Mainnet && chain != Chain::Testnet {
4821 cfg.feature_flags.defer_unpaid_amplification = true;
4822 }
4823 }
4824 114 => {
4825 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4826 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4827 if chain != Chain::Mainnet {
4828 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4829 cfg.feature_flags.enable_authenticated_event_streams = true;
4830 cfg.feature_flags
4831 .include_checkpoint_artifacts_digest_in_summary = true;
4832 }
4833 }
4834 115 => {
4835 cfg.feature_flags.normalize_depth_formula = true;
4836 }
4837 116 => {
4838 cfg.feature_flags.gasless_transaction_drop_safety = true;
4839 cfg.feature_flags.address_aliases = true;
4840 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4841 cfg.feature_flags.defer_unpaid_amplification = false;
4843 cfg.feature_flags.enable_display_registry = true;
4844 }
4845 117 => {}
4846 118 => {
4847 cfg.feature_flags.use_coin_party_owner = true;
4848 }
4849 119 => {
4850 cfg.execution_version = Some(4);
4852 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4853 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4854 if chain != Chain::Mainnet {
4855 cfg.feature_flags.enable_gasless = true;
4856 cfg.gasless_max_computation_units = Some(50_000);
4857 cfg.gasless_allowed_token_types = Some(vec![]);
4858 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4859 cfg.feature_flags
4860 .convert_withdrawal_compatibility_ptb_arguments = true;
4861 }
4862 cfg.gasless_max_unused_inputs = Some(1);
4863 cfg.gasless_max_pure_input_bytes = Some(32);
4864 if chain == Chain::Testnet {
4865 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4866 }
4867 cfg.transfer_receive_object_cost_per_byte = Some(1);
4868 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4869 }
4870 120 => {
4871 cfg.feature_flags.disallow_jump_orphans = true;
4872 }
4873 121 => {
4874 if chain != Chain::Mainnet {
4876 cfg.feature_flags.defer_unpaid_amplification = true;
4877 cfg.gasless_max_tps = Some(50);
4878 }
4879 cfg.feature_flags
4880 .early_return_receive_object_mismatched_type = true;
4881 }
4882 122 => {
4883 cfg.feature_flags.defer_unpaid_amplification = true;
4885 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4887 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4888 if chain != Chain::Mainnet && chain != Chain::Testnet {
4889 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4890 }
4891 cfg.feature_flags.gasless_verify_remaining_balance = true;
4892 cfg.include_special_package_amendments = match chain {
4893 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4894 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4895 Chain::Unknown => None,
4896 };
4897 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4898 cfg.gasless_max_tps = Some(300);
4899 cfg.gasless_max_computation_units = Some(5_000);
4900 }
4901 123 => {
4902 cfg.gas_model_version = Some(13);
4903 }
4904 124 => {
4905 if chain != Chain::Mainnet && chain != Chain::Testnet {
4906 cfg.feature_flags.timestamp_based_epoch_close = true;
4907 }
4908 cfg.gas_model_version = Some(14);
4909 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4910
4911 cfg.feature_flags.enable_accumulators = true;
4917 cfg.feature_flags.enable_address_balance_gas_payments = true;
4918 cfg.feature_flags.enable_authenticated_event_streams = true;
4919 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4920 cfg.feature_flags.enable_object_funds_withdraw = true;
4921 cfg.feature_flags
4922 .convert_withdrawal_compatibility_ptb_arguments = true;
4923 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4924 cfg.feature_flags
4925 .include_checkpoint_artifacts_digest_in_summary = true;
4926 cfg.feature_flags.enable_gasless = true;
4927
4928 if chain == Chain::Mainnet {
4933 cfg.gasless_allowed_token_types = Some(vec![
4934 (MAINNET_USDC.to_string(), 10_000),
4935 (MAINNET_USDSUI.to_string(), 10_000),
4936 (MAINNET_SUI_USDE.to_string(), 10_000),
4937 (MAINNET_USDY.to_string(), 10_000),
4938 (MAINNET_FDUSD.to_string(), 10_000),
4939 (MAINNET_AUSD.to_string(), 10_000),
4940 (MAINNET_USDB.to_string(), 10_000),
4941 ]);
4942 }
4943 }
4944 125 => {
4945 cfg.feature_flags.granular_post_execution_checks = true;
4946 if chain != Chain::Mainnet {
4947 cfg.feature_flags.timestamp_based_epoch_close = true;
4948 }
4949 }
4950 126 => {
4951 cfg.feature_flags.early_exit_on_iffw = true;
4952 }
4953 127 => {
4954 cfg.feature_flags.always_advance_dkg_to_resolution = true;
4955
4956 cfg.verify_bulletproofs_ristretto255_base_cost = Some(23866);
4957 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(1324);
4958 cfg.group_ops_ristretto_decode_scalar_cost = Some(5);
4959 cfg.group_ops_ristretto_decode_point_cost = Some(216);
4960 cfg.group_ops_ristretto_scalar_add_cost = Some(2);
4961 cfg.group_ops_ristretto_point_add_cost = Some(8);
4962 cfg.group_ops_ristretto_scalar_sub_cost = Some(2);
4963 cfg.group_ops_ristretto_point_sub_cost = Some(8);
4964 cfg.group_ops_ristretto_scalar_mul_cost = Some(5);
4965 cfg.group_ops_ristretto_point_mul_cost = Some(1763);
4966 cfg.group_ops_ristretto_scalar_div_cost = Some(557);
4967 cfg.group_ops_ristretto_point_div_cost = Some(2244);
4968
4969 if chain != Chain::Mainnet {
4970 cfg.feature_flags.enable_ristretto255_group_ops = true;
4971 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4972 }
4973
4974 cfg.feature_flags.timestamp_based_epoch_close = true;
4975 }
4976 128 => {
4977 cfg.max_generic_instantiation_type_nodes_per_function = Some(10_000);
4978 cfg.max_generic_instantiation_type_nodes_per_module = Some(500_000);
4979 cfg.binary_enum_defs = Some(200);
4980 cfg.binary_enum_def_instantiations = Some(100);
4981 }
4982 129 => {
4983 cfg.feature_flags.enable_unified_linkage = true;
4984 }
4985 130 => {
4986 cfg.feature_flags.record_net_unsettled_object_withdraws = true;
4987 cfg.feature_flags.enable_init_on_upgrade = true;
4988 cfg.epoch_close_deadline_ms = Some(120_000);
4989 cfg.scratch_add_cost_base = Some(13);
4990 cfg.scratch_read_cost_base = Some(13);
4991 cfg.scratch_read_value_cost = Some(1);
4992 cfg.scratch_remove_cost_base = Some(13);
4993 cfg.scratch_exists_cost_base = Some(13);
4994 cfg.scratch_exists_with_type_cost_base = Some(13);
4995 cfg.scratch_exists_with_type_type_cost = Some(1);
4996 let max_commands = cfg.max_programmable_tx_commands() as u64;
4997 cfg.max_scratch_pad_size = Some(16 * max_commands);
4998 if chain != Chain::Mainnet && chain != Chain::Testnet {
5000 cfg.feature_flags.zklogin_circuit_mode = 1;
5001 }
5002 }
5003 131 => {
5004 cfg.feature_flags.share_transaction_deny_config_in_consensus = true;
5005 cfg.feature_flags.framework_tx_context_mut_restrictions = true;
5006 }
5007 132 => {
5008 if chain != Chain::Mainnet && chain != Chain::Testnet {
5009 cfg.feature_flags.defer_owned_object_double_spend = true;
5010 cfg.feature_flags.create_forwarding_address_registry = true;
5011 }
5012 cfg.object_record_new_uid_from_hash_cost_base = Some(1);
5013 cfg.feature_flags
5014 .enable_order_independent_upgrade_init_linkage = true;
5015 }
5016 133 => {
5017 cfg.feature_flags
5018 .include_function_signatures_in_instantiation_limits = true;
5019 cfg.max_accumulator_type_nodes = Some(16);
5020 }
5021 134 => {
5022 if chain != Chain::Mainnet {
5029 cfg.package_original_package_id_impl_cost_base = Some(52);
5030 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
5031 cfg.package_original_package_id_impl_cost_per_byte =
5032 Some(package_read_cost_per_byte);
5033
5034 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
5035 cfg.consensus_max_num_transactions_in_block = Some(128);
5036 }
5037
5038 if chain == Chain::Mainnet {
5039 cfg.feature_flags.defer_unpaid_amplification = false;
5040 }
5041 }
5042 135 => {
5043 cfg.package_original_package_id_impl_cost_base = Some(52);
5046 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
5047 cfg.package_original_package_id_impl_cost_per_byte =
5048 Some(package_read_cost_per_byte);
5049
5050 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
5051 cfg.consensus_max_num_transactions_in_block = Some(128);
5052
5053 cfg.feature_flags.defer_unpaid_amplification = false;
5054 }
5055 136 => {
5056 cfg.feature_flags.ptb_tx_context_restrictions = true;
5057
5058 cfg.translation_per_live_reference_charge = Some(1);
5059 cfg.max_ptb_live_references = Some(64);
5060 cfg.max_ptb_returned_references = Some(16);
5061 cfg.max_ptb_total_returned_references = Some(256);
5062
5063 if chain != Chain::Mainnet && chain != Chain::Testnet {
5064 cfg.feature_flags.allowed_proposers = true;
5065 }
5066 cfg.feature_flags.harden_linkage_consistency = true;
5067
5068 cfg.package_arena_size_in_bytes = Some(10_000_000);
5069 }
5070 137 => {
5071 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(621);
5072 cfg.max_bulletproofs_total_bits = Some(1024);
5073
5074 if chain != Chain::Mainnet {
5075 cfg.feature_flags.enable_allowances = true;
5076 }
5077 cfg.feature_flags.fix_ptb_generated_reads = true;
5078 cfg.feature_flags.charge_ld_const_abstract_size = true;
5079 if chain != Chain::Mainnet && chain != Chain::Testnet {
5080 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
5081 }
5082 cfg.reserve_object_funds_for_withdrawal_cost_base = Some(52);
5083 cfg.reserve_object_funds_for_withdrawal_cold_read_cost = Some(184);
5086
5087 cfg.feature_flags.allowed_proposers = true;
5088
5089 cfg.feature_flags.validate_ptb_argument_indices = true;
5090 cfg.feature_flags.memory_safety_invariant_check_v2 = true;
5091 }
5092 138 => {
5093 cfg.gas_model_version = Some(15);
5094 cfg.feature_flags.enable_allowances = true;
5095 if chain != Chain::Mainnet {
5096 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
5097 cfg.feature_flags.disable_effects_tx_dependencies = true;
5098 }
5099 cfg.feature_flags.merge_colliding_deferrals = true;
5100 if chain == Chain::Mainnet {
5102 cfg.storage_rebate_rate = Some(9999);
5103 }
5104 }
5105 139 => {
5106 if chain != Chain::Mainnet && chain != Chain::Testnet {
5107 cfg.feature_flags.enable_forwarding_addresses = true;
5108 cfg.feature_flags.mldsa65_auth = true;
5109 }
5110 cfg.storage_rebate_rate = Some(9999);
5111 if chain != Chain::Mainnet {
5112 cfg.feature_flags.allow_dkg_completion_after_timeout = true;
5113 }
5114 cfg.obj_access_cost_read_per_package_kb = Some(154);
5116 }
5117 140 => {
5118 cfg.staggered_submission_signal_window_commits = Some(300);
5121 cfg.staggered_submission_signal_min_excess_copies_per_commit = Some(2);
5122 cfg.staggered_submission_signal_exit_dwell_commits = Some(6000);
5123 cfg.staggered_submission_signal_band1_enter_ratio_bps = Some(1000);
5124 cfg.staggered_submission_signal_band1_exit_ratio_bps = Some(500);
5125 cfg.staggered_submission_signal_band2_enter_ratio_bps = Some(5000);
5126 cfg.staggered_submission_signal_band2_exit_ratio_bps = Some(2500);
5127
5128 cfg.vector_reverse_base_cost = Some(52);
5129 cfg.vector_reverse_per_elem_cost = Some(8);
5130 cfg.vector_keep_range_base_cost = Some(52);
5131 cfg.vector_keep_range_per_dropped_elem_cost = Some(1);
5132 cfg.vector_keep_range_per_moved_elem_cost = Some(8);
5133 cfg.vector_copy_range_base_cost = Some(52);
5134 cfg.vector_replace_range_base_cost = Some(52);
5135 cfg.vector_replace_range_per_elem_cost = Some(8);
5136
5137 if chain != Chain::Mainnet && chain != Chain::Testnet {
5138 cfg.feature_flags.shuffle_consensus_commit_blocks = true;
5139 }
5140
5141 cfg.feature_flags.allow_references_in_ptbs = true;
5142 cfg.feature_flags.disable_id_leak_verifier = true;
5143 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
5144 cfg.feature_flags.disable_effects_tx_dependencies = true;
5145 }
5146 141 => {
5147 cfg.feature_flags.complete_effects_size_estimate = true;
5148 cfg.max_num_accumulator_events = Some(1024);
5149 }
5150 142 => {
5151 cfg.clock_borrow_cost_base = Some(52);
5152 cfg.feature_flags.check_groth16_pvk_length = true;
5153 cfg.object_is_shared_input_cost_base = Some(52);
5154 cfg.feature_flags.secp256r1_ecrecover_checks_x_below_p = true;
5155 cfg.binary_format_limits_profile = Some(BinaryFormatLimitsProfile::V1);
5156 cfg.feature_flags.defer_owned_object_double_spend = true;
5157 }
5158 143 => {
5159 cfg.execution_version = Some(5);
5160 cfg.package_arena_size_in_bytes = Some(20_000_000);
5161 cfg.feature_flags.simplify_nitro_header_validation = true;
5162 cfg.feature_flags.enable_forwarding_addresses = false;
5163 cfg.feature_flags.package_publish_charge = true;
5164 cfg.package_publish_charge_fixed = Some(1_000_000_000);
5165 cfg.package_publish_charge_per_module = Some(10_000_000);
5166 cfg.package_publish_charge_per_dependency = Some(10_000_000);
5167 if chain != Chain::Mainnet {
5168 cfg.feature_flags.mldsa65_auth = true;
5169 }
5170 cfg.layout_node_cost = Some(16);
5171 cfg.layout_node_cost_large_layout_threshold = Some(64);
5172 cfg.bcs_per_input_abstract_unit_cost = Some(20);
5173 cfg.vector_copy_range_per_abstract_memory_unit_cost = Some(1);
5174 }
5175 144 => {
5176 if chain != Chain::Mainnet && chain != Chain::Testnet {
5177 cfg.feature_flags.enable_timestamp_transaction_expiration = true;
5178 }
5179 cfg.object_runtime_max_loaded_child_value_size = Some(5_000_000);
5180
5181 cfg.feature_flags.staggered_submission_signal = true;
5182 cfg.staggered_submission_signal_window_commits = Some(600);
5194 cfg.staggered_submission_signal_min_consensus_user_transactions_per_commit =
5195 Some(1000);
5196 if chain == Chain::Testnet {
5197 cfg.staggered_submission_signal_min_consensus_user_transactions_per_commit = Some(5);
5203 }
5204 }
5205 145 => {
5206 cfg.feature_flags.reject_mldsa65_in_legacy_multisig = true;
5207 cfg.feature_flags.mldsa65_auth = true;
5208 }
5209 146 => {
5210 cfg.feature_flags.secp256r1_strict_public_keys = true;
5211 cfg.feature_flags.create_freeze_list = true;
5212 cfg.feature_flags.enable_coin_regulation = true;
5213 cfg.max_freeze_list_address_reads = Some(10_000);
5214 cfg.feature_flags
5215 .validator_metadata_require_compressed_protocol_pubkey = true;
5216 cfg.mutable_system_object_input_charge_ids = Some(BTreeSet::from([
5217 AccountAddress::from_hex_literal("0xfa").unwrap(),
5218 AccountAddress::from_hex_literal("0xcf").unwrap(),
5219 ]));
5220 cfg.mutable_system_object_input_charge = Some(250_000_000);
5221 cfg.checkpoint_queue_max_undrained_ms = Some(1_000);
5222 }
5223 _ => panic!("unsupported version {:?}", version),
5234 }
5235 }
5236
5237 cfg
5238 }
5239
5240 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
5241 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
5242 || !self.feature_flags.split_checkpoints_in_consensus_handler
5243 {
5244 return;
5245 }
5246
5247 if !mysten_common::in_test_configuration() {
5248 return;
5249 }
5250
5251 use rand::{Rng, SeedableRng, rngs::StdRng};
5252 let mut rng = StdRng::from_seed(*seed);
5253 let mut max_txns = rng.gen_range(10..=100u64);
5256 #[cfg(feature = "testing")]
5259 let small_limits = SMALL_CHECKPOINT_TX_LIMITS_IN_TESTS.load(Ordering::Relaxed);
5260 #[cfg(not(feature = "testing"))]
5261 let small_limits = false;
5262 if self.checkpoint_queue_force_drain_ms().is_some() && small_limits && rng.gen_bool(0.25) {
5263 max_txns = rng.gen_range(2..=3u64);
5264 }
5265 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
5266 self.max_transactions_per_checkpoint = Some(max_txns);
5267 }
5268
5269 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
5275 let (
5276 max_back_edges_per_function,
5277 max_back_edges_per_module,
5278 sanity_check_with_regex_reference_safety,
5279 ) = if let Some((
5280 max_back_edges_per_function,
5281 max_back_edges_per_module,
5282 sanity_check_with_regex_reference_safety,
5283 )) = signing_limits
5284 {
5285 (
5286 Some(max_back_edges_per_function),
5287 Some(max_back_edges_per_module),
5288 Some(sanity_check_with_regex_reference_safety),
5289 )
5290 } else {
5291 (None, None, None)
5292 };
5293
5294 let additional_borrow_checks = if signing_limits.is_some() {
5295 true
5297 } else {
5298 self.additional_borrow_checks()
5299 };
5300 let deprecate_global_storage_ops = if signing_limits.is_some() {
5301 true
5303 } else {
5304 self.deprecate_global_storage_ops()
5305 };
5306
5307 VerifierConfig {
5308 max_loop_depth: Some(self.max_loop_depth() as usize),
5309 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5310 max_function_parameters: Some(self.max_function_parameters() as usize),
5311 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5312 max_value_stack_size: self.max_value_stack_size() as usize,
5313 max_type_nodes: Some(self.max_type_nodes() as usize),
5314 max_generic_instantiation_type_nodes_per_function: self
5315 .max_generic_instantiation_type_nodes_per_function_as_option()
5316 .map(|v| v as usize),
5317 max_generic_instantiation_type_nodes_per_module: self
5318 .max_generic_instantiation_type_nodes_per_module_as_option()
5319 .map(|v| v as usize),
5320 include_function_signatures_in_instantiation_limits: self
5321 .include_function_signatures_in_instantiation_limits(),
5322 max_push_size: Some(self.max_push_size() as usize),
5323 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5324 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5325 max_function_definitions: Some(self.max_function_definitions() as usize),
5326 max_data_definitions: Some(self.max_struct_definitions() as usize),
5327 max_constant_vector_len: Some(self.max_move_vector_len()),
5328 max_back_edges_per_function,
5329 max_back_edges_per_module,
5330 max_basic_blocks_in_script: None,
5331 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5333 allow_receiving_object_id: self.allow_receiving_object_id(),
5334 reject_mutable_random_on_entry_functions: self
5335 .reject_mutable_random_on_entry_functions(),
5336 bytecode_version: self.move_binary_format_version(),
5337 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5338 additional_borrow_checks,
5339 better_loader_errors: self.better_loader_errors(),
5340 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5341 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5342 .map(|limit| limit as u128),
5343 deprecate_global_storage_ops,
5344 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5345 disable_id_leak_verifier: self.disable_id_leak_verifier(),
5346 switch_to_regex_reference_safety: false,
5347 framework_tx_context_mut_restrictions: self.framework_tx_context_mut_restrictions(),
5348 disallow_jump_orphans: self.disallow_jump_orphans(),
5349 }
5350 }
5351
5352 pub fn binary_config(
5353 &self,
5354 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5355 ) -> BinaryConfig {
5356 let deprecate_global_storage_ops =
5357 override_deprecate_global_storage_ops_during_deserialization
5358 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5359 BinaryConfig::new(
5360 self.move_binary_format_version(),
5361 self.min_move_binary_format_version_as_option()
5362 .unwrap_or(VERSION_1),
5363 self.no_extraneous_module_bytes(),
5364 deprecate_global_storage_ops,
5365 TableConfig {
5366 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5367 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5368 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5369 function_instantiations: self
5370 .binary_function_instantiations_as_option()
5371 .unwrap_or(u16::MAX),
5372 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5373 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5374 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5375 address_identifiers: self
5376 .binary_address_identifiers_as_option()
5377 .unwrap_or(u16::MAX),
5378 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5379 struct_def_instantiations: self
5380 .binary_struct_def_instantiations_as_option()
5381 .unwrap_or(u16::MAX),
5382 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5383 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5384 field_instantiations: self
5385 .binary_field_instantiations_as_option()
5386 .unwrap_or(u16::MAX),
5387 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5388 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5389 enum_def_instantiations: self
5390 .binary_enum_def_instantiations_as_option()
5391 .unwrap_or(u16::MAX),
5392 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5393 variant_instantiation_handles: self
5394 .binary_variant_instantiation_handles_as_option()
5395 .unwrap_or(u16::MAX),
5396 },
5397 self.binary_format_limits(),
5398 )
5399 }
5400
5401 pub fn binary_format_limits(
5402 &self,
5403 ) -> &'static move_binary_format::binary_config::BinaryFormatLimits {
5404 self.binary_format_limits_profile
5405 .unwrap_or(BinaryFormatLimitsProfile::LEGACY)
5406 .limits()
5407 }
5408
5409 pub fn apply_overrides_for_testing(
5413 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5414 ) -> OverrideGuard {
5415 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5416 assert!(cur.is_none(), "config override already present");
5417 *cur = Some(Box::new(override_fn));
5418 OverrideGuard
5419 }
5420
5421 #[cfg(feature = "testing")]
5425 pub fn apply_base_overrides_for_testing(
5426 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5427 ) -> BaseOverrideGuard {
5428 info!("installing base ProtocolConfig override for testing");
5429 let override_fn: Arc<OverrideFn> = Arc::new(override_fn);
5430 BASE_CONFIG_OVERRIDES
5431 .lock()
5432 .unwrap()
5433 .push(override_fn.clone());
5434 BaseOverrideGuard { override_fn }
5435 }
5436
5437 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5438 #[cfg(feature = "testing")]
5440 {
5441 let fns = BASE_CONFIG_OVERRIDES.lock().unwrap().clone();
5442 for override_fn in fns {
5443 ret = override_fn(version, ret);
5444 }
5445 }
5446 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5447 warn!(
5448 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5449 );
5450 ret = override_fn(version, ret);
5451 }
5452 ret
5453 }
5454}
5455
5456impl ProtocolConfig {
5460 pub fn set_execution_version_for_testing(&mut self, val: u64) {
5464 let current = self.execution_version.unwrap_or(0);
5465 assert!(
5466 val >= current,
5467 "cannot downgrade execution_version from {current} to {val}: running an old \
5468 executor against a newer protocol config/framework is unsupported. To test \
5469 frozen executor behavior, start from the last protocol version of that executor \
5470 instead, so genesis loads the matching framework snapshot (see \
5471 test_address_balance_gas_v3_accumulator_sign)."
5472 );
5473 self.execution_version = Some(val);
5474 }
5475
5476 pub fn set_zklogin_circuit_mode_for_testing(&mut self, val: u64) {
5479 self.feature_flags.zklogin_circuit_mode = val
5480 }
5481
5482 pub fn set_per_object_congestion_control_mode_for_testing(
5483 &mut self,
5484 val: PerObjectCongestionControlMode,
5485 ) {
5486 self.feature_flags.per_object_congestion_control_mode = val;
5487 }
5488
5489 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5490 self.feature_flags.consensus_choice = val;
5491 }
5492
5493 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5494 self.feature_flags.consensus_network = val;
5495 }
5496
5497 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5498 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5499 }
5500
5501 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5502 self.feature_flags.mysticeti_num_leaders_per_round = val;
5503 }
5504
5505 pub fn disable_accumulators_for_testing(&mut self) {
5506 self.feature_flags.enable_accumulators = false;
5507 self.feature_flags.enable_address_balance_gas_payments = false;
5508 }
5509
5510 pub fn enable_coin_reservation_for_testing(&mut self) {
5511 self.feature_flags.enable_coin_reservation_obj_refs = true;
5512 self.feature_flags
5513 .convert_withdrawal_compatibility_ptb_arguments = true;
5514 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5517 }
5518
5519 pub fn disable_coin_reservation_for_testing(&mut self) {
5520 self.feature_flags.enable_coin_reservation_obj_refs = false;
5521 self.feature_flags
5522 .convert_withdrawal_compatibility_ptb_arguments = false;
5523 }
5524
5525 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5526 self.feature_flags.enable_accumulators = true;
5527 self.feature_flags.allow_private_accumulator_entrypoints = true;
5528 self.feature_flags.enable_address_balance_gas_payments = true;
5529 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5530 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5531 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5532 }
5533
5534 pub fn enable_gasless_for_testing(&mut self) {
5535 self.enable_address_balance_gas_payments_for_testing();
5536 self.feature_flags.enable_gasless = true;
5537 self.feature_flags.gasless_verify_remaining_balance = true;
5538 self.gasless_max_computation_units = Some(5_000);
5539 self.gasless_allowed_token_types = Some(vec![]);
5540 self.gasless_max_tps = Some(1000);
5541 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5542 }
5543
5544 pub fn disable_gasless_for_testing(&mut self) {
5545 self.feature_flags.enable_gasless = false;
5546 self.gasless_max_computation_units = None;
5547 self.gasless_allowed_token_types = None;
5548 }
5549
5550 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5551 self.feature_flags.enable_accumulators = true;
5552 self.feature_flags.enable_authenticated_event_streams = true;
5553 self.feature_flags
5554 .include_checkpoint_artifacts_digest_in_summary = true;
5555 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5556 }
5557}
5558
5559type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5560
5561static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5562
5563#[must_use]
5564pub struct OverrideGuard;
5565
5566impl Drop for OverrideGuard {
5567 fn drop(&mut self) {
5568 info!("restoring override fn");
5569 *CONFIG_OVERRIDE.lock().unwrap() = None;
5570 }
5571}
5572
5573#[cfg(feature = "testing")]
5574static BASE_CONFIG_OVERRIDES: Mutex<Vec<Arc<OverrideFn>>> = Mutex::new(Vec::new());
5575
5576#[cfg(feature = "testing")]
5577#[must_use]
5578pub struct BaseOverrideGuard {
5579 override_fn: Arc<OverrideFn>,
5580}
5581
5582#[cfg(feature = "testing")]
5583impl Drop for BaseOverrideGuard {
5584 fn drop(&mut self) {
5585 BASE_CONFIG_OVERRIDES
5586 .lock()
5587 .unwrap()
5588 .retain(|f| !Arc::ptr_eq(f, &self.override_fn));
5589 }
5590}
5591
5592#[derive(PartialEq, Eq)]
5595pub enum LimitThresholdCrossed {
5596 None,
5597 Soft(u128, u128),
5598 Hard(u128, u128),
5599}
5600
5601pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5604 x: T,
5605 soft_limit: U,
5606 hard_limit: V,
5607) -> LimitThresholdCrossed {
5608 let x: V = x.into();
5609 let soft_limit: V = soft_limit.into();
5610
5611 debug_assert!(soft_limit <= hard_limit);
5612
5613 if x >= hard_limit {
5616 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5617 } else if x < soft_limit {
5618 LimitThresholdCrossed::None
5619 } else {
5620 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5621 }
5622}
5623
5624#[macro_export]
5625macro_rules! assert_set {
5626 ($protocol_config:expr, $($flag:ident),+ $(,)?) => {{
5627 let protocol_config = $protocol_config;
5628 $(
5629 assert!(
5630 protocol_config.$flag(),
5631 "protocol config flag `{}` must be set",
5632 stringify!($flag),
5633 );
5634 )+
5635 }};
5636}
5637
5638#[macro_export]
5639macro_rules! check_limit {
5640 ($x:expr, $hard:expr) => {
5641 check_limit!($x, $hard, $hard)
5642 };
5643 ($x:expr, $soft:expr, $hard:expr) => {
5644 check_limit_in_range($x as u64, $soft, $hard)
5645 };
5646}
5647
5648#[macro_export]
5652macro_rules! check_limit_by_meter {
5653 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5654 let (h, metered_str) = if $is_metered {
5656 ($metered_limit, "metered")
5657 } else {
5658 ($unmetered_hard_limit, "unmetered")
5660 };
5661 use sui_protocol_config::check_limit_in_range;
5662 let result = check_limit_in_range($x as u64, $metered_limit, h);
5663 match result {
5664 LimitThresholdCrossed::None => {}
5665 LimitThresholdCrossed::Soft(_, _) => {
5666 $metric.with_label_values(&[metered_str, "soft"]).inc();
5667 }
5668 LimitThresholdCrossed::Hard(_, _) => {
5669 $metric.with_label_values(&[metered_str, "hard"]).inc();
5670 }
5671 };
5672 result
5673 }};
5674}
5675
5676pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5679
5680static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5681 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5682
5683static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5684 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5685
5686fn parse_amendments(json: &str) -> Arc<Amendments> {
5687 #[derive(serde::Deserialize)]
5688 struct AmendmentEntry {
5689 root: String,
5690 deps: Vec<DepEntry>,
5691 }
5692
5693 #[derive(serde::Deserialize)]
5694 struct DepEntry {
5695 original_id: String,
5696 version_id: String,
5697 }
5698
5699 let entries: Vec<AmendmentEntry> =
5700 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5701 let mut amendments = BTreeMap::new();
5702 for entry in entries {
5703 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5704 let mut dep_ids = BTreeMap::new();
5705 for dep in entry.deps {
5706 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5707 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5708 assert!(
5709 dep_ids.insert(orig_id, upgraded_id).is_none(),
5710 "Duplicate original ID in amendments table"
5711 );
5712 }
5713 assert!(
5714 amendments.insert(root_id, dep_ids).is_none(),
5715 "Duplicate root ID in amendments table"
5716 );
5717 }
5718 Arc::new(amendments)
5719}
5720
5721#[cfg(all(test, not(msim)))]
5722mod test {
5723 use insta::assert_yaml_snapshot;
5724
5725 use super::*;
5726
5727 #[test]
5728 fn snapshot_tests() {
5729 println!("\n============================================================================");
5730 println!("! !");
5731 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5732 println!("! !");
5733 println!("============================================================================\n");
5734 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5735 let chain_str = match chain_id {
5739 Chain::Unknown => "".to_string(),
5740 _ => format!("{:?}_", chain_id),
5741 };
5742 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5743 let cur = ProtocolVersion::new(i);
5744 assert_yaml_snapshot!(
5745 format!("{}version_{}", chain_str, cur.as_u64()),
5746 ProtocolConfig::get_for_version(cur, *chain_id)
5747 );
5748 }
5749 }
5750 }
5751
5752 #[test]
5753 fn binary_format_limits_profile_matches_protocol_version() {
5754 let v141 = ProtocolConfig::get_for_version(ProtocolVersion::new(141), Chain::Unknown);
5755 assert_eq!(
5756 v141.binary_format_limits(),
5757 BinaryFormatLimitsProfile::LEGACY.limits()
5758 );
5759
5760 let v142 = ProtocolConfig::get_for_version(ProtocolVersion::new(142), Chain::Unknown);
5761 assert_eq!(
5762 v142.binary_format_limits(),
5763 BinaryFormatLimitsProfile::V1.limits()
5764 );
5765 }
5766
5767 #[test]
5768 fn checkpoint_queue_force_drain_ms_raises_to_interval() {
5769 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5770 config.checkpoint_queue_max_undrained_ms = None;
5771 assert_eq!(config.checkpoint_queue_force_drain_ms(), None);
5772 config.checkpoint_queue_max_undrained_ms = Some(1000);
5773 config.min_checkpoint_interval_ms = Some(200);
5774 assert_eq!(config.checkpoint_queue_force_drain_ms(), Some(1000));
5775 config.min_checkpoint_interval_ms = Some(1500);
5776 assert_eq!(config.checkpoint_queue_force_drain_ms(), Some(1500));
5777 }
5778
5779 #[test]
5780 fn test_getters() {
5781 let prot: ProtocolConfig =
5782 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5783 assert_eq!(
5784 prot.max_arguments(),
5785 prot.max_arguments_as_option().unwrap()
5786 );
5787 }
5788
5789 #[test]
5790 fn vector_bulk_native_gas_costs_start_at_version_140() {
5791 for chain in [Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5792 let before = ProtocolConfig::get_for_version(ProtocolVersion::new(139), chain);
5793 assert_eq!(before.vector_reverse_base_cost_as_option(), None);
5794 assert_eq!(before.vector_reverse_per_elem_cost_as_option(), None);
5795 assert_eq!(before.vector_keep_range_base_cost_as_option(), None);
5796 assert_eq!(
5797 before.vector_keep_range_per_dropped_elem_cost_as_option(),
5798 None
5799 );
5800 assert_eq!(
5801 before.vector_keep_range_per_moved_elem_cost_as_option(),
5802 None
5803 );
5804 assert_eq!(before.vector_copy_range_base_cost_as_option(), None);
5805 assert_eq!(before.vector_replace_range_base_cost_as_option(), None);
5806 assert_eq!(before.vector_replace_range_per_elem_cost_as_option(), None);
5807
5808 let active = ProtocolConfig::get_for_version(ProtocolVersion::new(140), chain);
5809 assert_eq!(active.vector_reverse_base_cost_as_option(), Some(52));
5810 assert_eq!(active.vector_reverse_per_elem_cost_as_option(), Some(8));
5811 assert_eq!(active.vector_keep_range_base_cost_as_option(), Some(52));
5812 assert_eq!(
5813 active.vector_keep_range_per_dropped_elem_cost_as_option(),
5814 Some(1)
5815 );
5816 assert_eq!(
5817 active.vector_keep_range_per_moved_elem_cost_as_option(),
5818 Some(8)
5819 );
5820 assert_eq!(active.vector_copy_range_base_cost_as_option(), Some(52));
5821 assert_eq!(active.vector_replace_range_base_cost_as_option(), Some(52));
5822 assert_eq!(
5823 active.vector_replace_range_per_elem_cost_as_option(),
5824 Some(8)
5825 );
5826 }
5827 }
5828
5829 #[test]
5830 fn test_setters() {
5831 let mut prot: ProtocolConfig =
5832 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5833 prot.set_max_arguments_for_testing(123);
5834 assert_eq!(prot.max_arguments(), 123);
5835
5836 prot.set_max_arguments_from_str_for_testing("321".to_string());
5837 assert_eq!(prot.max_arguments(), 321);
5838
5839 prot.disable_max_arguments_for_testing();
5840 assert_eq!(prot.max_arguments_as_option(), None);
5841
5842 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5843 assert_eq!(prot.max_arguments(), 456);
5844 }
5845
5846 #[test]
5847 fn test_execution_version_setter_allows_upgrade() {
5848 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5849 let current = prot.execution_version();
5850 prot.set_execution_version_for_testing(current);
5851 prot.set_execution_version_for_testing(current + 1);
5852 assert_eq!(prot.execution_version(), current + 1);
5853 }
5854
5855 #[test]
5856 #[should_panic(expected = "cannot downgrade execution_version")]
5857 fn test_execution_version_setter_panics_on_downgrade() {
5858 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5859 let current = prot.execution_version();
5860 prot.set_execution_version_for_testing(current - 1);
5861 }
5862
5863 #[test]
5864 fn test_feature_flag_setter_by_string() {
5865 let mut prot: ProtocolConfig =
5866 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5867 assert!(!prot.zklogin_auth());
5868 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), true);
5869 assert!(prot.zklogin_auth());
5870 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), false);
5871 assert!(!prot.zklogin_auth());
5872 }
5873
5874 #[test]
5875 #[should_panic(expected = "unknown feature flag")]
5876 fn test_feature_flag_setter_unknown_flag() {
5877 let mut prot: ProtocolConfig =
5878 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5879 prot.set_feature_flag_for_testing("some random string".to_string(), true);
5880 }
5881
5882 #[test]
5883 fn test_get_for_version_if_supported_applies_test_overrides() {
5884 let before =
5885 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5886 .unwrap();
5887
5888 assert!(!before.enable_coin_reservation_obj_refs());
5889
5890 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5891 cfg.enable_coin_reservation_for_testing();
5892 cfg
5893 });
5894
5895 let after =
5896 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5897 .unwrap();
5898
5899 assert!(after.enable_coin_reservation_obj_refs());
5900 }
5901
5902 #[test]
5903 #[should_panic(expected = "unsupported version")]
5904 fn max_version_test() {
5905 let _ = ProtocolConfig::get_for_version_impl(
5908 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5909 Chain::Unknown,
5910 );
5911 }
5912
5913 #[test]
5914 fn lookup_by_string_test() {
5915 let prot: ProtocolConfig =
5916 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5917 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5919
5920 assert!(
5921 prot.lookup_attr("max_arguments".to_string())
5922 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5923 );
5924
5925 assert!(
5927 prot.lookup_attr("max_move_identifier_len".to_string())
5928 .is_none()
5929 );
5930
5931 let prot: ProtocolConfig =
5933 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5934 assert!(
5935 prot.lookup_attr("max_move_identifier_len".to_string())
5936 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5937 );
5938
5939 let prot: ProtocolConfig =
5940 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5941 assert!(
5943 prot.attr_map()
5944 .get("max_move_identifier_len")
5945 .unwrap()
5946 .is_none()
5947 );
5948 assert!(
5950 prot.attr_map().get("max_arguments").unwrap()
5951 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5952 );
5953
5954 let prot: ProtocolConfig =
5956 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5957 assert!(
5959 prot.feature_flags
5960 .lookup_attr("some random string".to_owned())
5961 .is_none()
5962 );
5963 assert!(
5964 !prot
5965 .feature_flags
5966 .attr_map()
5967 .contains_key("some random string")
5968 );
5969
5970 assert!(
5972 prot.feature_flags
5973 .lookup_attr("package_upgrades".to_owned())
5974 == Some(false)
5975 );
5976 assert!(
5977 prot.feature_flags
5978 .attr_map()
5979 .get("package_upgrades")
5980 .unwrap()
5981 == &false
5982 );
5983 let prot: ProtocolConfig =
5984 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5985 assert!(
5987 prot.feature_flags
5988 .lookup_attr("package_upgrades".to_owned())
5989 == Some(true)
5990 );
5991 assert!(
5992 prot.feature_flags
5993 .attr_map()
5994 .get("package_upgrades")
5995 .unwrap()
5996 == &true
5997 );
5998 }
5999
6000 #[test]
6001 fn limit_range_fn_test() {
6002 let low = 100u32;
6003 let high = 10000u64;
6004
6005 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
6006 assert!(matches!(
6007 check_limit!(255u16, low, high),
6008 LimitThresholdCrossed::Soft(255u128, 100)
6009 ));
6010 assert!(matches!(
6016 check_limit!(2550000u64, low, high),
6017 LimitThresholdCrossed::Hard(2550000, 10000)
6018 ));
6019
6020 assert!(matches!(
6021 check_limit!(2550000u64, high, high),
6022 LimitThresholdCrossed::Hard(2550000, 10000)
6023 ));
6024
6025 assert!(matches!(
6026 check_limit!(1u8, high),
6027 LimitThresholdCrossed::None
6028 ));
6029
6030 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
6031
6032 assert!(matches!(
6033 check_limit!(2550000u64, high),
6034 LimitThresholdCrossed::Hard(2550000, 10000)
6035 ));
6036 }
6037
6038 #[test]
6039 fn linkage_amendments_load() {
6040 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
6041 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
6042 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
6043 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
6044 }
6045
6046 #[test]
6047 fn render_scalar_fields_use_precision_safe_encoding() {
6048 use mysten_common::rpc_format::Unmetered;
6049
6050 let config = ProtocolConfig::get_for_max_version_UNSAFE();
6051 let rendered = config
6052 .render::<serde_json::Value>(&mut Unmetered)
6053 .expect("render should succeed");
6054
6055 let max_args = rendered
6056 .get("max_arguments")
6057 .expect("max_arguments set at max version");
6058 assert!(
6059 max_args.is_number(),
6060 "u32 should render as number, got {max_args:?}",
6061 );
6062
6063 let max_tx_size = rendered
6064 .get("max_tx_size_bytes")
6065 .expect("max_tx_size_bytes set at max version");
6066 assert!(
6067 max_tx_size.is_string(),
6068 "u64 should render as string, got {max_tx_size:?}",
6069 );
6070 }
6071
6072 #[test]
6073 fn render_includes_non_scalar_gasless_allowlist_as_json() {
6074 use mysten_common::rpc_format::Unmetered;
6075 use serde_json::json;
6076
6077 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
6078 config.set_gasless_allowed_token_types_for_testing(vec![
6079 ("0xa::usdc::USDC".to_string(), 10_000),
6080 ("0xb::usdt::USDT".to_string(), 0),
6081 ]);
6082
6083 let rendered = config
6084 .render::<serde_json::Value>(&mut Unmetered)
6085 .expect("render should succeed under Unmetered budget");
6086 let allowlist = rendered
6087 .get("gasless_allowed_token_types")
6088 .expect("entry should be present after the testing setter");
6089
6090 assert_eq!(
6093 allowlist,
6094 &json!([["0xa::usdc::USDC", "10000"], ["0xb::usdt::USDT", "0"],]),
6095 );
6096 }
6097
6098 #[test]
6099 fn render_targets_prost_value_for_grpc() {
6100 use mysten_common::rpc_format::Unmetered;
6101 use prost_types::value::Kind;
6102
6103 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
6104 config.set_gasless_allowed_token_types_for_testing(vec![(
6105 "0xa::usdc::USDC".to_string(),
6106 10_000,
6107 )]);
6108
6109 let rendered = config
6110 .render::<prost_types::Value>(&mut Unmetered)
6111 .expect("render to prost Value should succeed");
6112 let allowlist = rendered
6113 .get("gasless_allowed_token_types")
6114 .expect("entry should be present after the testing setter");
6115
6116 let Some(Kind::ListValue(outer)) = &allowlist.kind else {
6118 panic!(
6119 "expected ListValue at the top level, got {:?}",
6120 allowlist.kind
6121 );
6122 };
6123 assert_eq!(outer.values.len(), 1, "one allowlisted entry");
6124 let Some(Kind::ListValue(entry)) = &outer.values[0].kind else {
6125 panic!("expected each entry to be a ListValue");
6126 };
6127 assert_eq!(entry.values.len(), 2, "entry has (coin_type, amount)");
6128
6129 let Some(Kind::StringValue(coin_type)) = &entry.values[0].kind else {
6130 panic!("expected coin_type as StringValue");
6131 };
6132 assert_eq!(coin_type, "0xa::usdc::USDC");
6133
6134 let Some(Kind::StringValue(amount)) = &entry.values[1].kind else {
6136 panic!(
6137 "expected minimum_transfer_amount as StringValue (precision-safe u64); got {:?}",
6138 entry.values[1].kind,
6139 );
6140 };
6141 assert_eq!(amount, "10000");
6142 }
6143
6144 #[test]
6145 fn render_emits_null_for_unset_protocol_versions() {
6146 use mysten_common::rpc_format::Unmetered;
6147
6148 let config = ProtocolConfig::get_for_version(1.into(), Chain::Unknown);
6149 let rendered = config
6150 .render::<serde_json::Value>(&mut Unmetered)
6151 .expect("render should succeed");
6152 let entry = rendered
6156 .get("gasless_allowed_token_types")
6157 .expect("key should be present for every protocol version");
6158 assert!(
6159 entry.is_null(),
6160 "value should be null for pre-feature protocol version, got {entry:?}",
6161 );
6162 }
6163}