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 = 141;
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)]
437pub struct ProtocolVersion(u64);
438
439impl ProtocolVersion {
440 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
445
446 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
447
448 #[cfg(not(msim))]
449 pub const MAX_ALLOWED: Self = Self::MAX;
450
451 #[cfg(msim)]
453 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
454
455 pub fn new(v: u64) -> Self {
456 Self(v)
457 }
458
459 pub const fn as_u64(&self) -> u64 {
460 self.0
461 }
462
463 pub fn max() -> Self {
466 Self::MAX
467 }
468
469 pub fn prev(self) -> Self {
470 Self(self.0.checked_sub(1).unwrap())
471 }
472}
473
474impl From<u64> for ProtocolVersion {
475 fn from(v: u64) -> Self {
476 Self::new(v)
477 }
478}
479
480impl std::ops::Sub<u64> for ProtocolVersion {
481 type Output = Self;
482 fn sub(self, rhs: u64) -> Self::Output {
483 Self::new(self.0 - rhs)
484 }
485}
486
487impl std::ops::Add<u64> for ProtocolVersion {
488 type Output = Self;
489 fn add(self, rhs: u64) -> Self::Output {
490 Self::new(self.0 + rhs)
491 }
492}
493
494#[derive(
495 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
496)]
497pub enum Chain {
498 Mainnet,
499 Testnet,
500 #[default]
501 Unknown,
502}
503
504impl Chain {
505 pub fn as_str(self) -> &'static str {
506 match self {
507 Chain::Mainnet => "mainnet",
508 Chain::Testnet => "testnet",
509 Chain::Unknown => "unknown",
510 }
511 }
512}
513
514pub struct Error(pub String);
515
516#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
519struct FeatureFlags {
520 #[serde(skip_serializing_if = "is_false")]
523 package_upgrades: bool,
524 #[serde(skip_serializing_if = "is_false")]
527 commit_root_state_digest: bool,
528 #[serde(skip_serializing_if = "is_false")]
530 advance_epoch_start_time_in_safe_mode: bool,
531 #[serde(skip_serializing_if = "is_false")]
534 loaded_child_objects_fixed: bool,
535 #[serde(skip_serializing_if = "is_false")]
538 missing_type_is_compatibility_error: bool,
539 #[serde(skip_serializing_if = "is_false")]
542 scoring_decision_with_validity_cutoff: bool,
543
544 #[serde(skip_serializing_if = "is_false")]
547 consensus_order_end_of_epoch_last: bool,
548
549 #[serde(skip_serializing_if = "is_false")]
553 consensus_slim_block_propagation: bool,
554
555 #[serde(skip_serializing_if = "is_false")]
557 disallow_adding_abilities_on_upgrade: bool,
558 #[serde(skip_serializing_if = "is_false")]
560 disable_invariant_violation_check_in_swap_loc: bool,
561 #[serde(skip_serializing_if = "is_false")]
564 advance_to_highest_supported_protocol_version: bool,
565 #[serde(skip_serializing_if = "is_false")]
567 ban_entry_init: bool,
568 #[serde(skip_serializing_if = "is_false")]
570 package_digest_hash_module: bool,
571 #[serde(skip_serializing_if = "is_false")]
573 disallow_change_struct_type_params_on_upgrade: bool,
574 #[serde(skip_serializing_if = "is_false")]
576 no_extraneous_module_bytes: bool,
577 #[serde(skip_serializing_if = "is_false")]
579 narwhal_versioned_metadata: bool,
580
581 #[serde(skip_serializing_if = "is_false")]
583 zklogin_auth: bool,
584 #[serde(skip_serializing_if = "is_zero")]
587 zklogin_circuit_mode: u64,
588 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
590 consensus_transaction_ordering: ConsensusTransactionOrdering,
591
592 #[serde(skip_serializing_if = "is_false")]
600 simplified_unwrap_then_delete: bool,
601 #[serde(skip_serializing_if = "is_false")]
603 upgraded_multisig_supported: bool,
604 #[serde(skip_serializing_if = "is_false")]
606 txn_base_cost_as_multiplier: bool,
607
608 #[serde(skip_serializing_if = "is_false")]
610 shared_object_deletion: bool,
611
612 #[serde(skip_serializing_if = "is_false")]
614 narwhal_new_leader_election_schedule: bool,
615
616 #[serde(skip_serializing_if = "is_empty")]
618 zklogin_supported_providers: BTreeSet<String>,
619
620 #[serde(skip_serializing_if = "is_false")]
622 loaded_child_object_format: bool,
623
624 #[serde(skip_serializing_if = "is_false")]
625 #[skip_protocol_config_accessor]
626 enable_jwk_consensus_updates: bool,
627
628 #[serde(skip_serializing_if = "is_false")]
629 #[skip_protocol_config_accessor]
630 end_of_epoch_transaction_supported: bool,
631
632 #[serde(skip_serializing_if = "is_false")]
635 simple_conservation_checks: bool,
636
637 #[serde(skip_serializing_if = "is_false")]
639 loaded_child_object_format_type: bool,
640
641 #[serde(skip_serializing_if = "is_false")]
643 receive_objects: bool,
644
645 #[serde(skip_serializing_if = "is_false")]
647 consensus_checkpoint_signature_key_includes_digest: bool,
648
649 #[serde(skip_serializing_if = "is_false")]
651 random_beacon: bool,
652
653 #[serde(skip_serializing_if = "is_false")]
655 #[skip_protocol_config_accessor]
656 bridge: bool,
657
658 #[serde(skip_serializing_if = "is_false")]
659 enable_effects_v2: bool,
660
661 #[serde(skip_serializing_if = "is_false")]
663 narwhal_certificate_v2: bool,
664
665 #[serde(skip_serializing_if = "is_false")]
667 verify_legacy_zklogin_address: bool,
668
669 #[serde(skip_serializing_if = "is_false")]
671 throughput_aware_consensus_submission: bool,
672
673 #[serde(skip_serializing_if = "is_false")]
675 recompute_has_public_transfer_in_execution: bool,
676
677 #[serde(skip_serializing_if = "is_false")]
679 accept_zklogin_in_multisig: bool,
680
681 #[serde(skip_serializing_if = "is_false")]
683 accept_passkey_in_multisig: bool,
684
685 #[serde(skip_serializing_if = "is_false")]
687 validate_zklogin_public_identifier: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
692 include_consensus_digest_in_prologue: bool,
693
694 #[serde(skip_serializing_if = "is_false")]
696 hardened_otw_check: bool,
697
698 #[serde(skip_serializing_if = "is_false")]
700 allow_receiving_object_id: bool,
701
702 #[serde(skip_serializing_if = "is_false")]
704 enable_poseidon: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
708 enable_coin_deny_list: bool,
709
710 #[serde(skip_serializing_if = "is_false")]
712 enable_group_ops_native_functions: bool,
713
714 #[serde(skip_serializing_if = "is_false")]
716 enable_group_ops_native_function_msm: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 enable_ristretto255_group_ops: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 enable_verify_bulletproofs_ristretto255: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
728 enable_nitro_attestation: bool,
729
730 #[serde(skip_serializing_if = "is_false")]
732 enable_nitro_attestation_upgraded_parsing: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
736 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
737
738 #[serde(skip_serializing_if = "is_false")]
740 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
741
742 #[serde(skip_serializing_if = "is_false")]
744 reject_mutable_random_on_entry_functions: bool,
745
746 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
748 per_object_congestion_control_mode: PerObjectCongestionControlMode,
749
750 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
752 consensus_choice: ConsensusChoice,
753
754 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
756 consensus_network: ConsensusNetwork,
757
758 #[serde(skip_serializing_if = "is_false")]
760 correct_gas_payment_limit_check: bool,
761
762 #[serde(skip_serializing_if = "Option::is_none")]
764 zklogin_max_epoch_upper_bound_delta: Option<u64>,
765
766 #[serde(skip_serializing_if = "is_false")]
768 mysticeti_leader_scoring_and_schedule: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
772 reshare_at_same_initial_version: bool,
773
774 #[serde(skip_serializing_if = "is_false")]
776 resolve_abort_locations_to_package_id: bool,
777
778 #[serde(skip_serializing_if = "is_false")]
782 mysticeti_use_committed_subdag_digest: bool,
783
784 #[serde(skip_serializing_if = "is_false")]
786 enable_vdf: bool,
787
788 #[serde(skip_serializing_if = "is_false")]
792 record_consensus_determined_version_assignments_in_prologue: bool,
793 #[serde(skip_serializing_if = "is_false")]
796 record_consensus_determined_version_assignments_in_prologue_v2: bool,
797
798 #[serde(skip_serializing_if = "is_false")]
800 fresh_vm_on_framework_upgrade: bool,
801
802 #[serde(skip_serializing_if = "is_false")]
810 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
811
812 #[serde(skip_serializing_if = "Option::is_none")]
814 mysticeti_num_leaders_per_round: Option<usize>,
815
816 #[serde(skip_serializing_if = "is_false")]
818 soft_bundle: bool,
819
820 #[serde(skip_serializing_if = "is_false")]
822 enable_coin_deny_list_v2: bool,
823
824 #[serde(skip_serializing_if = "is_false")]
826 passkey_auth: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
831 mldsa65_auth: bool,
832
833 #[serde(skip_serializing_if = "is_false")]
835 secp256r1_ecrecover_checks_x_below_p: bool,
836
837 #[serde(skip_serializing_if = "is_false")]
839 authority_capabilities_v2: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 rethrow_serialization_type_layout_errors: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
847 consensus_distributed_vote_scoring_strategy: bool,
848
849 #[serde(skip_serializing_if = "is_false")]
851 consensus_round_prober: bool,
852
853 #[serde(skip_serializing_if = "is_false")]
855 validate_identifier_inputs: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 disallow_self_identifier: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 mysticeti_fastpath: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
869 disable_preconsensus_locking: bool,
870
871 #[serde(skip_serializing_if = "is_false")]
873 relocate_event_module: bool,
874
875 #[serde(skip_serializing_if = "is_false")]
877 uncompressed_g1_group_elements: bool,
878
879 #[serde(skip_serializing_if = "is_false")]
880 disallow_new_modules_in_deps_only_packages: bool,
881
882 #[serde(skip_serializing_if = "is_false")]
884 consensus_smart_ancestor_selection: bool,
885
886 #[serde(skip_serializing_if = "is_false")]
888 consensus_round_prober_probe_accepted_rounds: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 native_charging_v2: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
897 #[skip_protocol_config_accessor]
898 consensus_linearize_subdag_v2: bool,
899
900 #[serde(skip_serializing_if = "is_false")]
902 convert_type_argument_error: bool,
903
904 #[serde(skip_serializing_if = "is_false")]
906 variant_nodes: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 consensus_zstd_compression: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 minimize_child_object_mutations: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
919 record_additional_state_digest_in_prologue: bool,
920
921 #[serde(skip_serializing_if = "is_false")]
923 move_native_context: bool,
924
925 #[serde(skip_serializing_if = "is_false")]
928 #[skip_protocol_config_accessor]
929 consensus_median_based_commit_timestamp: bool,
930
931 #[serde(skip_serializing_if = "is_false")]
934 normalize_ptb_arguments: bool,
935
936 #[serde(skip_serializing_if = "is_false")]
938 consensus_batched_block_sync: bool,
939
940 #[serde(skip_serializing_if = "is_false")]
942 enforce_checkpoint_timestamp_monotonicity: bool,
943
944 #[serde(skip_serializing_if = "is_false")]
946 max_ptb_value_size_v2: bool,
947
948 #[serde(skip_serializing_if = "is_false")]
950 resolve_type_input_ids_to_defining_id: bool,
951
952 #[serde(skip_serializing_if = "is_false")]
954 enable_party_transfer: bool,
955
956 #[serde(skip_serializing_if = "is_false")]
958 allow_unbounded_system_objects: bool,
959
960 #[serde(skip_serializing_if = "is_false")]
962 type_tags_in_object_runtime: bool,
963
964 #[serde(skip_serializing_if = "is_false")]
966 enable_accumulators: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
970 #[skip_protocol_config_accessor]
971 enable_coin_reservation_obj_refs: bool,
972
973 #[serde(skip_serializing_if = "is_false")]
976 create_root_accumulator_object: bool,
977
978 #[serde(skip_serializing_if = "is_false")]
980 #[skip_protocol_config_accessor]
981 enable_authenticated_event_streams: bool,
982
983 #[serde(skip_serializing_if = "is_false")]
985 enable_address_balance_gas_payments: bool,
986
987 #[serde(skip_serializing_if = "is_false")]
989 address_balance_gas_check_rgp_at_signing: bool,
990
991 #[serde(skip_serializing_if = "is_false")]
992 address_balance_gas_reject_gas_coin_arg: bool,
993
994 #[serde(skip_serializing_if = "is_false")]
996 enable_multi_epoch_transaction_expiration: bool,
997
998 #[serde(skip_serializing_if = "is_false")]
1000 relax_valid_during_for_owned_inputs: bool,
1001
1002 #[serde(skip_serializing_if = "is_false")]
1004 enable_ptb_execution_v2: bool,
1005
1006 #[serde(skip_serializing_if = "is_false")]
1008 better_adapter_type_resolution_errors: bool,
1009
1010 #[serde(skip_serializing_if = "is_false")]
1012 record_time_estimate_processed: bool,
1013
1014 #[serde(skip_serializing_if = "is_false")]
1016 dependency_linkage_error: bool,
1017
1018 #[serde(skip_serializing_if = "is_false")]
1020 additional_multisig_checks: bool,
1021
1022 #[serde(skip_serializing_if = "is_false")]
1024 ignore_execution_time_observations_after_certs_closed: bool,
1025
1026 #[serde(skip_serializing_if = "is_false")]
1030 debug_fatal_on_move_invariant_violation: bool,
1031
1032 #[serde(skip_serializing_if = "is_false")]
1035 allow_private_accumulator_entrypoints: bool,
1036
1037 #[serde(skip_serializing_if = "is_false")]
1040 additional_consensus_digest_indirect_state: bool,
1041
1042 #[serde(skip_serializing_if = "is_false")]
1044 check_for_init_during_upgrade: bool,
1045
1046 #[serde(skip_serializing_if = "is_false")]
1048 enable_init_on_upgrade: bool,
1049
1050 #[serde(skip_serializing_if = "is_false")]
1052 enable_order_independent_upgrade_init_linkage: bool,
1053
1054 #[serde(skip_serializing_if = "is_false")]
1057 harden_linkage_consistency: bool,
1058
1059 #[serde(skip_serializing_if = "is_false")]
1061 per_command_shared_object_transfer_rules: bool,
1062
1063 #[serde(skip_serializing_if = "is_false")]
1065 validate_ptb_argument_indices: bool,
1066
1067 #[serde(skip_serializing_if = "is_false")]
1069 include_checkpoint_artifacts_digest_in_summary: bool,
1070
1071 #[serde(skip_serializing_if = "is_false")]
1073 use_mfp_txns_in_load_initial_object_debts: bool,
1074
1075 #[serde(skip_serializing_if = "is_false")]
1077 cancel_for_failed_dkg_early: bool,
1078
1079 #[serde(skip_serializing_if = "is_false")]
1081 always_advance_dkg_to_resolution: bool,
1082
1083 #[serde(skip_serializing_if = "is_false")]
1085 allow_dkg_completion_after_timeout: bool,
1086
1087 #[serde(skip_serializing_if = "is_false")]
1089 enable_coin_registry: bool,
1090
1091 #[serde(skip_serializing_if = "is_false")]
1093 abstract_size_in_object_runtime: bool,
1094
1095 #[serde(skip_serializing_if = "is_false")]
1097 object_runtime_charge_cache_load_gas: bool,
1098
1099 #[serde(skip_serializing_if = "is_false")]
1101 additional_borrow_checks: bool,
1102
1103 #[serde(skip_serializing_if = "is_false")]
1105 use_new_commit_handler: bool,
1106
1107 #[serde(skip_serializing_if = "is_false")]
1109 better_loader_errors: bool,
1110
1111 #[serde(skip_serializing_if = "is_false")]
1113 generate_df_type_layouts: bool,
1114
1115 #[serde(skip_serializing_if = "is_false")]
1117 allow_references_in_ptbs: bool,
1118
1119 #[serde(skip_serializing_if = "is_false")]
1126 framework_tx_context_mut_restrictions: bool,
1127
1128 #[serde(skip_serializing_if = "is_false")]
1130 include_function_signatures_in_instantiation_limits: bool,
1131
1132 #[serde(skip_serializing_if = "is_false")]
1137 ptb_tx_context_restrictions: bool,
1138
1139 #[serde(skip_serializing_if = "is_false")]
1141 enable_display_registry: bool,
1142
1143 #[serde(skip_serializing_if = "is_false")]
1145 private_generics_verifier_v2: bool,
1146
1147 #[serde(skip_serializing_if = "is_false")]
1149 deprecate_global_storage_ops_during_deserialization: bool,
1150
1151 #[serde(skip_serializing_if = "is_false")]
1154 enable_non_exclusive_writes: bool,
1155
1156 #[serde(skip_serializing_if = "is_false")]
1158 deprecate_global_storage_ops: bool,
1159
1160 #[serde(skip_serializing_if = "is_false")]
1162 normalize_depth_formula: bool,
1163
1164 #[serde(skip_serializing_if = "is_false")]
1167 charge_ld_const_abstract_size: bool,
1168
1169 #[serde(skip_serializing_if = "is_false")]
1171 consensus_skip_gced_accept_votes: bool,
1172
1173 #[serde(skip_serializing_if = "is_false")]
1176 include_cancelled_randomness_txns_in_prologue: bool,
1177
1178 #[serde(skip_serializing_if = "is_false")]
1180 #[skip_protocol_config_accessor]
1181 address_aliases: bool,
1182
1183 #[serde(skip_serializing_if = "is_false")]
1185 create_forwarding_address_registry: bool,
1186
1187 #[serde(skip_serializing_if = "is_false")]
1189 enable_forwarding_addresses: bool,
1190
1191 #[serde(skip_serializing_if = "is_false")]
1194 fix_checkpoint_signature_mapping: bool,
1195
1196 #[serde(skip_serializing_if = "is_false")]
1198 enable_object_funds_withdraw: bool,
1199
1200 #[serde(skip_serializing_if = "is_false")]
1203 record_net_unsettled_object_withdraws: bool,
1204
1205 #[serde(skip_serializing_if = "is_false")]
1207 consensus_skip_gced_blocks_in_direct_finalization: bool,
1208
1209 #[serde(skip_serializing_if = "is_false")]
1211 gas_rounding_halve_digits: bool,
1212
1213 #[serde(skip_serializing_if = "is_false")]
1215 flexible_tx_context_positions: bool,
1216
1217 #[serde(skip_serializing_if = "is_false")]
1219 disable_entry_point_signature_check: bool,
1220
1221 #[serde(skip_serializing_if = "is_false")]
1223 convert_withdrawal_compatibility_ptb_arguments: bool,
1224
1225 #[serde(skip_serializing_if = "is_false")]
1227 restrict_hot_or_not_entry_functions: bool,
1228
1229 #[serde(skip_serializing_if = "is_false")]
1231 split_checkpoints_in_consensus_handler: bool,
1232
1233 #[serde(skip_serializing_if = "is_false")]
1235 consensus_always_accept_system_transactions: bool,
1236
1237 #[serde(skip_serializing_if = "is_false")]
1239 validator_metadata_verify_v2: bool,
1240
1241 #[serde(skip_serializing_if = "is_false")]
1244 defer_unpaid_amplification: bool,
1245
1246 #[serde(skip_serializing_if = "is_false")]
1249 defer_owned_object_double_spend: bool,
1250
1251 #[serde(skip_serializing_if = "is_false")]
1254 allowed_proposers: bool,
1255
1256 #[serde(skip_serializing_if = "is_false")]
1262 #[skip_protocol_config_accessor]
1263 staggered_submission_signal: bool,
1264
1265 #[serde(skip_serializing_if = "is_false")]
1266 randomize_checkpoint_tx_limit_in_tests: bool,
1267
1268 #[serde(skip_serializing_if = "is_false")]
1270 gasless_transaction_drop_safety: bool,
1271
1272 #[serde(skip_serializing_if = "is_false")]
1275 merge_randomness_into_checkpoint: bool,
1276
1277 #[serde(skip_serializing_if = "is_false")]
1279 use_coin_party_owner: bool,
1280
1281 #[serde(skip_serializing_if = "is_false")]
1282 enable_gasless: bool,
1283
1284 #[serde(skip_serializing_if = "is_false")]
1285 gasless_verify_remaining_balance: bool,
1286
1287 #[serde(skip_serializing_if = "is_false")]
1288 disallow_jump_orphans: bool,
1289
1290 #[serde(skip_serializing_if = "is_false")]
1292 early_return_receive_object_mismatched_type: bool,
1293
1294 #[serde(skip_serializing_if = "is_false")]
1299 timestamp_based_epoch_close: bool,
1300
1301 #[serde(skip_serializing_if = "is_false")]
1304 limit_groth16_pvk_inputs: bool,
1305
1306 #[serde(skip_serializing_if = "is_false")]
1310 check_groth16_pvk_length: bool,
1311
1312 #[serde(skip_serializing_if = "is_false")]
1317 enforce_address_balance_change_invariant: bool,
1318
1319 #[serde(skip_serializing_if = "is_false")]
1321 share_transaction_deny_config_in_consensus: bool,
1322
1323 #[serde(skip_serializing_if = "is_false")]
1325 granular_post_execution_checks: bool,
1326
1327 #[serde(skip_serializing_if = "is_false")]
1329 early_exit_on_iffw: bool,
1330
1331 #[serde(skip_serializing_if = "is_false")]
1333 enable_unified_linkage: bool,
1334
1335 #[serde(skip_serializing_if = "is_false")]
1338 #[skip_protocol_config_accessor]
1339 enable_allowances: bool,
1340
1341 #[serde(skip_serializing_if = "is_false")]
1343 fix_ptb_generated_reads: bool,
1344
1345 #[serde(skip_serializing_if = "is_false")]
1346 check_object_funds_withdraw_in_execution: bool,
1347 #[serde(skip_serializing_if = "is_false")]
1349 memory_safety_invariant_check_v2: bool,
1350
1351 #[serde(skip_serializing_if = "is_false")]
1353 disable_effects_tx_dependencies: bool,
1354
1355 #[serde(skip_serializing_if = "is_false")]
1359 merge_colliding_deferrals: bool,
1360
1361 #[serde(skip_serializing_if = "is_false")]
1365 shuffle_consensus_commit_blocks: bool,
1366
1367 #[serde(skip_serializing_if = "is_false")]
1370 disable_id_leak_verifier: bool,
1371}
1372
1373fn is_false(b: &bool) -> bool {
1374 !b
1375}
1376
1377fn is_empty(b: &BTreeSet<String>) -> bool {
1378 b.is_empty()
1379}
1380
1381fn is_zero(val: &u64) -> bool {
1382 *val == 0
1383}
1384
1385#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1387pub enum ConsensusTransactionOrdering {
1388 #[default]
1390 None,
1391 ByGasPrice,
1393}
1394
1395impl ConsensusTransactionOrdering {
1396 pub fn is_none(&self) -> bool {
1397 matches!(self, ConsensusTransactionOrdering::None)
1398 }
1399}
1400
1401#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1402pub struct ExecutionTimeEstimateParams {
1403 pub target_utilization: u64,
1405 pub allowed_txn_cost_overage_burst_limit_us: u64,
1409
1410 pub randomness_scalar: u64,
1413
1414 pub max_estimate_us: u64,
1416
1417 pub stored_observations_num_included_checkpoints: u64,
1420
1421 pub stored_observations_limit: u64,
1423
1424 #[serde(skip_serializing_if = "is_zero")]
1427 pub stake_weighted_median_threshold: u64,
1428
1429 #[serde(skip_serializing_if = "is_false")]
1433 pub default_none_duration_for_new_keys: bool,
1434
1435 #[serde(skip_serializing_if = "Option::is_none")]
1437 pub observations_chunk_size: Option<u64>,
1438}
1439
1440#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1442pub enum PerObjectCongestionControlMode {
1443 #[default]
1444 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1450
1451impl PerObjectCongestionControlMode {
1452 pub fn is_none(&self) -> bool {
1453 matches!(self, PerObjectCongestionControlMode::None)
1454 }
1455}
1456
1457#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1459pub enum ConsensusChoice {
1460 #[default]
1461 Narwhal,
1462 SwapEachEpoch,
1463 Mysticeti,
1464}
1465
1466impl ConsensusChoice {
1467 pub fn is_narwhal(&self) -> bool {
1468 matches!(self, ConsensusChoice::Narwhal)
1469 }
1470}
1471
1472#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1474pub enum ConsensusNetwork {
1475 #[default]
1476 Anemo,
1477 Tonic,
1478}
1479
1480impl ConsensusNetwork {
1481 pub fn is_anemo(&self) -> bool {
1482 matches!(self, ConsensusNetwork::Anemo)
1483 }
1484}
1485
1486#[skip_serializing_none]
1518#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1519pub struct ProtocolConfig {
1520 pub version: ProtocolVersion,
1521
1522 #[serde(skip)]
1527 chain: Chain,
1528
1529 feature_flags: FeatureFlags,
1530
1531 max_tx_size_bytes: Option<u64>,
1534
1535 max_input_objects: Option<u64>,
1537
1538 max_size_written_objects: Option<u64>,
1542 max_size_written_objects_system_tx: Option<u64>,
1545
1546 max_serialized_tx_effects_size_bytes: Option<u64>,
1548
1549 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1551
1552 max_gas_payment_objects: Option<u32>,
1554
1555 max_modules_in_publish: Option<u32>,
1557
1558 max_package_dependencies: Option<u32>,
1560
1561 max_arguments: Option<u32>,
1564
1565 max_type_arguments: Option<u32>,
1567
1568 max_type_argument_depth: Option<u32>,
1570
1571 max_pure_argument_size: Option<u32>,
1573
1574 max_programmable_tx_commands: Option<u32>,
1576
1577 move_binary_format_version: Option<u32>,
1580 min_move_binary_format_version: Option<u32>,
1581
1582 binary_module_handles: Option<u16>,
1584 binary_struct_handles: Option<u16>,
1585 binary_function_handles: Option<u16>,
1586 binary_function_instantiations: Option<u16>,
1587 binary_signatures: Option<u16>,
1588 binary_constant_pool: Option<u16>,
1589 binary_identifiers: Option<u16>,
1590 binary_address_identifiers: Option<u16>,
1591 binary_struct_defs: Option<u16>,
1592 binary_struct_def_instantiations: Option<u16>,
1593 binary_function_defs: Option<u16>,
1594 binary_field_handles: Option<u16>,
1595 binary_field_instantiations: Option<u16>,
1596 binary_friend_decls: Option<u16>,
1597 binary_enum_defs: Option<u16>,
1598 binary_enum_def_instantiations: Option<u16>,
1599 binary_variant_handles: Option<u16>,
1600 binary_variant_instantiation_handles: Option<u16>,
1601
1602 #[skip_accessor]
1604 binary_format_limits_profile: Option<BinaryFormatLimitsProfile>,
1605
1606 max_move_object_size: Option<u64>,
1608
1609 max_move_package_size: Option<u64>,
1612
1613 max_publish_or_upgrade_per_ptb: Option<u64>,
1615
1616 max_tx_gas: Option<u64>,
1618
1619 max_gas_price: Option<u64>,
1621
1622 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1625
1626 max_gas_computation_bucket: Option<u64>,
1628
1629 gas_rounding_step: Option<u64>,
1631
1632 max_loop_depth: Option<u64>,
1634
1635 max_generic_instantiation_length: Option<u64>,
1637
1638 max_function_parameters: Option<u64>,
1640
1641 max_basic_blocks: Option<u64>,
1643
1644 max_value_stack_size: Option<u64>,
1646
1647 max_type_nodes: Option<u64>,
1649
1650 max_generic_instantiation_type_nodes_per_function: Option<u64>,
1652
1653 max_generic_instantiation_type_nodes_per_module: Option<u64>,
1655
1656 max_accumulator_type_nodes: Option<u64>,
1658
1659 max_push_size: Option<u64>,
1661
1662 max_struct_definitions: Option<u64>,
1664
1665 max_function_definitions: Option<u64>,
1667
1668 max_fields_in_struct: Option<u64>,
1670
1671 max_dependency_depth: Option<u64>,
1673
1674 max_num_event_emit: Option<u64>,
1676
1677 max_num_new_move_object_ids: Option<u64>,
1679
1680 max_num_new_move_object_ids_system_tx: Option<u64>,
1682
1683 max_num_deleted_move_object_ids: Option<u64>,
1685
1686 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1688
1689 max_num_transferred_move_object_ids: Option<u64>,
1691
1692 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1694
1695 max_event_emit_size: Option<u64>,
1697
1698 max_event_emit_size_total: Option<u64>,
1700
1701 max_move_vector_len: Option<u64>,
1703
1704 max_move_identifier_len: Option<u64>,
1706
1707 max_move_value_depth: Option<u64>,
1709
1710 package_arena_size_in_bytes: Option<u64>,
1713
1714 max_move_enum_variants: Option<u64>,
1716
1717 max_back_edges_per_function: Option<u64>,
1719
1720 max_back_edges_per_module: Option<u64>,
1722
1723 max_verifier_meter_ticks_per_function: Option<u64>,
1725
1726 max_meter_ticks_per_module: Option<u64>,
1728
1729 max_meter_ticks_per_package: Option<u64>,
1731
1732 object_runtime_max_num_cached_objects: Option<u64>,
1736
1737 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1739
1740 object_runtime_max_num_store_entries: Option<u64>,
1742
1743 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1745
1746 base_tx_cost_fixed: Option<u64>,
1749
1750 package_publish_cost_fixed: Option<u64>,
1753
1754 base_tx_cost_per_byte: Option<u64>,
1757
1758 package_publish_cost_per_byte: Option<u64>,
1760
1761 obj_access_cost_read_per_byte: Option<u64>,
1763
1764 obj_access_cost_read_per_package_kb: Option<u64>,
1767
1768 obj_access_cost_mutate_per_byte: Option<u64>,
1770
1771 obj_access_cost_delete_per_byte: Option<u64>,
1773
1774 obj_access_cost_verify_per_byte: Option<u64>,
1784
1785 max_type_to_layout_nodes: Option<u64>,
1787
1788 max_ptb_value_size: Option<u64>,
1790
1791 gas_model_version: Option<u64>,
1794
1795 obj_data_cost_refundable: Option<u64>,
1798
1799 obj_metadata_cost_non_refundable: Option<u64>,
1803
1804 storage_rebate_rate: Option<u64>,
1810
1811 storage_fund_reinvest_rate: Option<u64>,
1814
1815 reward_slashing_rate: Option<u64>,
1818
1819 storage_gas_price: Option<u64>,
1821
1822 accumulator_object_storage_cost: Option<u64>,
1824
1825 max_transactions_per_checkpoint: Option<u64>,
1830
1831 max_checkpoint_size_bytes: Option<u64>,
1835
1836 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1841
1842 address_from_bytes_cost_base: Option<u64>,
1847 address_to_u256_cost_base: Option<u64>,
1849 address_from_u256_cost_base: Option<u64>,
1851
1852 config_read_setting_impl_cost_base: Option<u64>,
1857 config_read_setting_impl_cost_per_byte: Option<u64>,
1858
1859 package_original_package_id_impl_cost_base: Option<u64>,
1860 package_original_package_id_impl_cost_per_byte: Option<u64>,
1861
1862 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1865 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1866 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1867 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1868 dynamic_field_add_child_object_cost_base: Option<u64>,
1870 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1871 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1872 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1873 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1875 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1876 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1877 dynamic_field_remove_child_object_cost_base: Option<u64>,
1879 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1880 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1881 dynamic_field_has_child_object_cost_base: Option<u64>,
1883 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1885 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1886 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1887
1888 scratch_add_cost_base: Option<u64>,
1891 scratch_read_cost_base: Option<u64>,
1893 scratch_read_value_cost: Option<u64>,
1894 scratch_remove_cost_base: Option<u64>,
1896 scratch_exists_cost_base: Option<u64>,
1898 scratch_exists_with_type_cost_base: Option<u64>,
1900 scratch_exists_with_type_type_cost: Option<u64>,
1901 max_scratch_pad_size: Option<u64>,
1903
1904 event_emit_cost_base: Option<u64>,
1907 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1908 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1909 event_emit_output_cost_per_byte: Option<u64>,
1910 event_emit_auth_stream_cost: Option<u64>,
1911
1912 reserve_object_funds_for_withdrawal_cost_base: Option<u64>,
1915 reserve_object_funds_for_withdrawal_cold_read_cost: Option<u64>,
1917
1918 object_borrow_uid_cost_base: Option<u64>,
1921 object_delete_impl_cost_base: Option<u64>,
1923 object_record_new_uid_cost_base: Option<u64>,
1925 object_record_new_uid_from_hash_cost_base: Option<u64>,
1928 object_is_shared_input_cost_base: Option<u64>,
1930
1931 transfer_transfer_internal_cost_base: Option<u64>,
1934 transfer_party_transfer_internal_cost_base: Option<u64>,
1936 transfer_freeze_object_cost_base: Option<u64>,
1938 transfer_share_object_cost_base: Option<u64>,
1940 transfer_receive_object_cost_base: Option<u64>,
1943 transfer_receive_object_cost_per_byte: Option<u64>,
1944 transfer_receive_object_type_cost_per_byte: Option<u64>,
1945
1946 tx_context_derive_id_cost_base: Option<u64>,
1949 tx_context_fresh_id_cost_base: Option<u64>,
1950 tx_context_sender_cost_base: Option<u64>,
1951 tx_context_epoch_cost_base: Option<u64>,
1952 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1953 tx_context_sponsor_cost_base: Option<u64>,
1954 tx_context_rgp_cost_base: Option<u64>,
1955 tx_context_gas_price_cost_base: Option<u64>,
1956 tx_context_gas_budget_cost_base: Option<u64>,
1957 tx_context_ids_created_cost_base: Option<u64>,
1958 tx_context_replace_cost_base: Option<u64>,
1959
1960 clock_borrow_cost_base: Option<u64>,
1963
1964 types_is_one_time_witness_cost_base: Option<u64>,
1967 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1968 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1969
1970 validator_validate_metadata_cost_base: Option<u64>,
1973 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1974
1975 crypto_invalid_arguments_cost: Option<u64>,
1977 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1979 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1980 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1981
1982 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1984 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1985 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1986
1987 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1989 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1990 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1991 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1992 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1993 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1994
1995 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1997
1998 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
2000 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2001 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
2002 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
2003 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
2004 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
2005
2006 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
2008 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2009 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2010 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
2011 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2012 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2013
2014 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
2016 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2017 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
2018 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
2019 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
2020 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
2021
2022 ecvrf_ecvrf_verify_cost_base: Option<u64>,
2024 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
2025 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
2026
2027 ed25519_ed25519_verify_cost_base: Option<u64>,
2029 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
2030 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
2031
2032 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
2034 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
2035
2036 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
2038 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
2039 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
2040 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
2041 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
2042
2043 hash_blake2b256_cost_base: Option<u64>,
2045 hash_blake2b256_data_cost_per_byte: Option<u64>,
2046 hash_blake2b256_data_cost_per_block: Option<u64>,
2047
2048 hash_keccak256_cost_base: Option<u64>,
2050 hash_keccak256_data_cost_per_byte: Option<u64>,
2051 hash_keccak256_data_cost_per_block: Option<u64>,
2052
2053 poseidon_bn254_cost_base: Option<u64>,
2055 poseidon_bn254_cost_per_block: Option<u64>,
2056
2057 group_ops_bls12381_decode_scalar_cost: Option<u64>,
2059 group_ops_bls12381_decode_g1_cost: Option<u64>,
2060 group_ops_bls12381_decode_g2_cost: Option<u64>,
2061 group_ops_bls12381_decode_gt_cost: Option<u64>,
2062 group_ops_bls12381_scalar_add_cost: Option<u64>,
2063 group_ops_bls12381_g1_add_cost: Option<u64>,
2064 group_ops_bls12381_g2_add_cost: Option<u64>,
2065 group_ops_bls12381_gt_add_cost: Option<u64>,
2066 group_ops_bls12381_scalar_sub_cost: Option<u64>,
2067 group_ops_bls12381_g1_sub_cost: Option<u64>,
2068 group_ops_bls12381_g2_sub_cost: Option<u64>,
2069 group_ops_bls12381_gt_sub_cost: Option<u64>,
2070 group_ops_bls12381_scalar_mul_cost: Option<u64>,
2071 group_ops_bls12381_g1_mul_cost: Option<u64>,
2072 group_ops_bls12381_g2_mul_cost: Option<u64>,
2073 group_ops_bls12381_gt_mul_cost: Option<u64>,
2074 group_ops_bls12381_scalar_div_cost: Option<u64>,
2075 group_ops_bls12381_g1_div_cost: Option<u64>,
2076 group_ops_bls12381_g2_div_cost: Option<u64>,
2077 group_ops_bls12381_gt_div_cost: Option<u64>,
2078 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
2079 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
2080 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
2081 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
2082 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
2083 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
2084 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
2085 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
2086 group_ops_bls12381_msm_max_len: Option<u32>,
2087 group_ops_bls12381_pairing_cost: Option<u64>,
2088 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
2089 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
2090 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
2091 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
2092 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
2093
2094 group_ops_ristretto_decode_scalar_cost: Option<u64>,
2095 group_ops_ristretto_decode_point_cost: Option<u64>,
2096 group_ops_ristretto_scalar_add_cost: Option<u64>,
2097 group_ops_ristretto_point_add_cost: Option<u64>,
2098 group_ops_ristretto_scalar_sub_cost: Option<u64>,
2099 group_ops_ristretto_point_sub_cost: Option<u64>,
2100 group_ops_ristretto_scalar_mul_cost: Option<u64>,
2101 group_ops_ristretto_point_mul_cost: Option<u64>,
2102 group_ops_ristretto_scalar_div_cost: Option<u64>,
2103 group_ops_ristretto_point_div_cost: Option<u64>,
2104
2105 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
2106 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
2107 max_bulletproofs_total_bits: Option<u64>,
2110
2111 hmac_hmac_sha3_256_cost_base: Option<u64>,
2113 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
2114 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
2115
2116 check_zklogin_id_cost_base: Option<u64>,
2118 check_zklogin_issuer_cost_base: Option<u64>,
2120
2121 vdf_verify_vdf_cost: Option<u64>,
2122 vdf_hash_to_input_cost: Option<u64>,
2123
2124 nitro_attestation_parse_base_cost: Option<u64>,
2126 nitro_attestation_parse_cost_per_byte: Option<u64>,
2127 nitro_attestation_verify_base_cost: Option<u64>,
2128 nitro_attestation_verify_cost_per_cert: Option<u64>,
2129
2130 bcs_per_byte_serialized_cost: Option<u64>,
2132 bcs_legacy_min_output_size_cost: Option<u64>,
2133 bcs_failure_cost: Option<u64>,
2134
2135 hash_sha2_256_base_cost: Option<u64>,
2136 hash_sha2_256_per_byte_cost: Option<u64>,
2137 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
2138 hash_sha3_256_base_cost: Option<u64>,
2139 hash_sha3_256_per_byte_cost: Option<u64>,
2140 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
2141 type_name_get_base_cost: Option<u64>,
2142 type_name_get_per_byte_cost: Option<u64>,
2143 type_name_id_base_cost: Option<u64>,
2144
2145 string_check_utf8_base_cost: Option<u64>,
2146 string_check_utf8_per_byte_cost: Option<u64>,
2147 string_is_char_boundary_base_cost: Option<u64>,
2148 string_sub_string_base_cost: Option<u64>,
2149 string_sub_string_per_byte_cost: Option<u64>,
2150 string_index_of_base_cost: Option<u64>,
2151 string_index_of_per_byte_pattern_cost: Option<u64>,
2152 string_index_of_per_byte_searched_cost: Option<u64>,
2153
2154 vector_empty_base_cost: Option<u64>,
2155 vector_length_base_cost: Option<u64>,
2156 vector_push_back_base_cost: Option<u64>,
2157 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
2158 vector_borrow_base_cost: Option<u64>,
2159 vector_pop_back_base_cost: Option<u64>,
2160 vector_destroy_empty_base_cost: Option<u64>,
2161 vector_swap_base_cost: Option<u64>,
2162 vector_reverse_base_cost: Option<u64>,
2163 vector_reverse_per_elem_cost: Option<u64>,
2164 vector_keep_range_base_cost: Option<u64>,
2165 vector_keep_range_per_dropped_elem_cost: Option<u64>,
2166 vector_keep_range_per_moved_elem_cost: Option<u64>,
2167 vector_copy_range_base_cost: Option<u64>,
2168 vector_replace_range_base_cost: Option<u64>,
2169 vector_replace_range_per_elem_cost: Option<u64>,
2170 debug_print_base_cost: Option<u64>,
2171 debug_print_stack_trace_base_cost: Option<u64>,
2172
2173 #[custom_setter]
2183 execution_version: Option<u64>,
2184
2185 consensus_bad_nodes_stake_threshold: Option<u64>,
2189
2190 max_jwk_votes_per_validator_per_epoch: Option<u64>,
2191 max_age_of_jwk_in_epochs: Option<u64>,
2195
2196 random_beacon_reduction_allowed_delta: Option<u16>,
2200
2201 random_beacon_reduction_lower_bound: Option<u32>,
2204
2205 random_beacon_dkg_timeout_round: Option<u32>,
2208
2209 random_beacon_min_round_interval_ms: Option<u64>,
2211
2212 random_beacon_dkg_version: Option<u64>,
2215
2216 consensus_max_transaction_size_bytes: Option<u64>,
2219 consensus_max_transactions_in_block_bytes: Option<u64>,
2221 consensus_max_num_transactions_in_block: Option<u64>,
2223
2224 consensus_voting_rounds: Option<u32>,
2226
2227 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
2229
2230 max_deferral_rounds_for_congestion_control: Option<u64>,
2233
2234 epoch_close_deadline_ms: Option<u64>,
2239
2240 max_txn_cost_overage_per_object_in_commit: Option<u64>,
2242
2243 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
2245
2246 min_checkpoint_interval_ms: Option<u64>,
2248
2249 checkpoint_summary_version_specific_data: Option<u64>,
2251
2252 max_soft_bundle_size: Option<u64>,
2254
2255 bridge_should_try_to_finalize_committee: Option<bool>,
2259
2260 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2266
2267 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2270
2271 consensus_gc_depth: Option<u32>,
2274
2275 gas_budget_based_txn_cost_cap_factor: Option<u64>,
2277
2278 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
2280
2281 sip_45_consensus_amplification_threshold: Option<u64>,
2284
2285 staggered_submission_signal_window_commits: Option<u64>,
2288 staggered_submission_signal_min_excess_copies_per_commit: Option<u64>,
2290 staggered_submission_signal_exit_dwell_commits: Option<u64>,
2293 staggered_submission_signal_band1_enter_ratio_bps: Option<u64>,
2296 staggered_submission_signal_band1_exit_ratio_bps: Option<u64>,
2297 staggered_submission_signal_band2_enter_ratio_bps: Option<u64>,
2298 staggered_submission_signal_band2_exit_ratio_bps: Option<u64>,
2299
2300 use_object_per_epoch_marker_table_v2: Option<bool>,
2303
2304 consensus_commit_rate_estimation_window_size: Option<u32>,
2306
2307 #[serde(skip_serializing_if = "Vec::is_empty")]
2311 aliased_addresses: Vec<AliasedAddress>,
2312
2313 translation_per_command_base_charge: Option<u64>,
2316
2317 translation_per_input_base_charge: Option<u64>,
2320
2321 translation_pure_input_per_byte_charge: Option<u64>,
2323
2324 translation_per_type_node_charge: Option<u64>,
2328
2329 translation_per_reference_node_charge: Option<u64>,
2332
2333 translation_per_linkage_entry_charge: Option<u64>,
2336
2337 max_updates_per_settlement_txn: Option<u32>,
2339
2340 gasless_max_computation_units: Option<u64>,
2342
2343 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
2345
2346 gasless_max_unused_inputs: Option<u64>,
2350
2351 gasless_max_pure_input_bytes: Option<u64>,
2354
2355 gasless_max_tps: Option<u64>,
2357
2358 #[serde(skip_serializing_if = "Option::is_none")]
2359 #[skip_accessor]
2360 include_special_package_amendments: Option<Arc<Amendments>>,
2361
2362 gasless_max_tx_size_bytes: Option<u64>,
2365
2366 translation_per_live_reference_charge: Option<u64>,
2369
2370 max_ptb_live_references: Option<u64>,
2373
2374 max_ptb_returned_references: Option<u64>,
2377
2378 max_ptb_total_returned_references: Option<u64>,
2381}
2382
2383#[derive(Clone, Serialize, Deserialize, Debug)]
2385pub struct AliasedAddress {
2386 pub original: [u8; 32],
2388 pub aliased: [u8; 32],
2390 pub allowed_tx_digests: Vec<[u8; 32]>,
2392}
2393
2394impl ProtocolConfig {
2396 pub fn chain(&self) -> Chain {
2398 self.chain
2399 }
2400
2401 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2414 if self.feature_flags.package_upgrades {
2415 Ok(())
2416 } else {
2417 Err(Error(format!(
2418 "package upgrades are not supported at {:?}",
2419 self.version
2420 )))
2421 }
2422 }
2423
2424 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2425 &self.feature_flags.zklogin_supported_providers
2426 }
2427
2428 pub fn zklogin_circuit_mode(&self) -> u64 {
2431 self.feature_flags.zklogin_circuit_mode
2432 }
2433
2434 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2435 self.feature_flags.consensus_transaction_ordering
2436 }
2437
2438 pub fn enable_jwk_consensus_updates(&self) -> bool {
2439 let ret = self.feature_flags.enable_jwk_consensus_updates;
2440 if ret {
2441 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2443 }
2444 ret
2445 }
2446
2447 pub fn staggered_submission_signal(&self) -> bool {
2448 let ret = self.feature_flags.staggered_submission_signal;
2449 if ret {
2450 assert!(self.feature_flags.allowed_proposers);
2453 }
2454 ret
2455 }
2456
2457 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2458 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2459 if !ret {
2460 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2462 }
2463 ret
2464 }
2465
2466 pub fn dkg_version(&self) -> u64 {
2467 self.random_beacon_dkg_version.unwrap_or(1)
2469 }
2470
2471 pub fn bridge(&self) -> bool {
2472 let ret = self.feature_flags.bridge;
2473 if ret {
2474 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2476 }
2477 ret
2478 }
2479
2480 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2481 if !self.bridge() {
2482 return false;
2483 }
2484 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2486 }
2487
2488 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2489 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2490 }
2491
2492 pub fn enable_allowances(&self) -> bool {
2493 self.feature_flags.enable_allowances && self.enable_accumulators()
2494 }
2495
2496 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2497 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2498 }
2499
2500 pub fn enable_authenticated_event_streams(&self) -> bool {
2501 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2502 }
2503
2504 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2505 self.feature_flags.per_object_congestion_control_mode
2506 }
2507
2508 pub fn consensus_choice(&self) -> ConsensusChoice {
2509 self.feature_flags.consensus_choice
2510 }
2511
2512 pub fn consensus_network(&self) -> ConsensusNetwork {
2513 self.feature_flags.consensus_network
2514 }
2515
2516 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2517 self.feature_flags.mysticeti_num_leaders_per_round
2518 }
2519
2520 pub fn max_transaction_size_bytes(&self) -> u64 {
2521 self.consensus_max_transaction_size_bytes
2523 .unwrap_or(256 * 1024)
2524 }
2525
2526 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2527 if cfg!(msim) {
2528 256 * 1024
2529 } else {
2530 self.consensus_max_transactions_in_block_bytes
2531 .unwrap_or(512 * 1024)
2532 }
2533 }
2534
2535 pub fn max_num_transactions_in_block(&self) -> u64 {
2536 if cfg!(msim) {
2537 8
2538 } else {
2539 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2540 }
2541 }
2542
2543 pub fn gc_depth(&self) -> u32 {
2544 self.consensus_gc_depth.unwrap_or(0)
2545 }
2546
2547 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2548 let res = self.feature_flags.consensus_linearize_subdag_v2;
2549 assert!(
2550 !res || self.gc_depth() > 0,
2551 "The consensus linearize sub dag V2 requires GC to be enabled"
2552 );
2553 res
2554 }
2555
2556 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2557 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2558 assert!(
2559 !res || self.gc_depth() > 0,
2560 "The consensus median based commit timestamp requires GC to be enabled"
2561 );
2562 res
2563 }
2564
2565 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2566 self.consensus_commit_rate_estimation_window_size
2567 .unwrap_or(0)
2568 }
2569
2570 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2571 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2575 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2577 window_size
2578 }
2579
2580 pub fn address_aliases(&self) -> bool {
2581 let address_aliases = self.feature_flags.address_aliases;
2582 assert!(
2583 !address_aliases || self.mysticeti_fastpath(),
2584 "Address aliases requires Mysticeti fastpath to be enabled"
2585 );
2586 if address_aliases {
2587 assert!(
2588 self.feature_flags.disable_preconsensus_locking,
2589 "Address aliases requires CertifiedTransaction to be disabled"
2590 );
2591 }
2592 address_aliases
2593 }
2594
2595 pub fn new_vm_enabled(&self) -> bool {
2596 self.execution_version.is_some_and(|v| v >= 4)
2597 }
2598
2599 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2600 debug_assert!(self.gasless_allowed_token_types.is_some());
2601 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2602 }
2603
2604 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2605 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2606 }
2607
2608 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2609 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2610 }
2611
2612 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2613 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2614 }
2615
2616 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2617 &self.include_special_package_amendments
2618 }
2619}
2620
2621static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2622
2623impl ProtocolConfig {
2625 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2627 assert!(
2629 version >= ProtocolVersion::MIN,
2630 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2631 version,
2632 ProtocolVersion::MIN.0,
2633 );
2634 assert!(
2635 version <= ProtocolVersion::MAX_ALLOWED,
2636 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2637 version,
2638 ProtocolVersion::MAX_ALLOWED.0,
2639 );
2640
2641 let mut ret = Self::get_for_version_impl(version, chain);
2642 ret.version = version;
2643 ret.chain = chain;
2644
2645 ret = Self::apply_config_override(version, ret);
2646
2647 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2648 warn!(
2649 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2650 );
2651 let overrides: ProtocolConfigOptional =
2652 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2653 .expect("failed to parse ProtocolConfig override env variables");
2654 overrides.apply_to(&mut ret);
2655 }
2656
2657 ret
2658 }
2659
2660 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2663 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2664 let mut ret = Self::get_for_version_impl(version, chain);
2665 ret.version = version;
2666 ret.chain = chain;
2667 ret = Self::apply_config_override(version, ret);
2668 Some(ret)
2669 } else {
2670 None
2671 }
2672 }
2673
2674 pub fn poison_get_for_min_version() {
2675 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2676 }
2677
2678 fn load_poison_get_for_min_version() -> bool {
2679 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2680 }
2681
2682 pub fn get_for_min_version() -> Self {
2685 if Self::load_poison_get_for_min_version() {
2686 panic!("get_for_min_version called on validator");
2687 }
2688 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2689 }
2690
2691 #[allow(non_snake_case)]
2701 pub fn get_for_max_version_UNSAFE() -> Self {
2702 if Self::load_poison_get_for_min_version() {
2703 panic!("get_for_max_version_UNSAFE called on validator");
2704 }
2705 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2706 }
2707
2708 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2709 #[cfg(msim)]
2710 {
2711 if version == ProtocolVersion::MAX_ALLOWED {
2713 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2714 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2715 return config;
2716 }
2717 }
2718
2719 let mut cfg = Self {
2722 version,
2724 chain,
2725
2726 feature_flags: Default::default(),
2728
2729 max_tx_size_bytes: Some(128 * 1024),
2730 max_input_objects: Some(2048),
2732 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2733 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2734 max_gas_payment_objects: Some(256),
2735 max_modules_in_publish: Some(128),
2736 max_package_dependencies: None,
2737 max_arguments: Some(512),
2738 max_type_arguments: Some(16),
2739 max_type_argument_depth: Some(16),
2740 max_pure_argument_size: Some(16 * 1024),
2741 max_programmable_tx_commands: Some(1024),
2742 move_binary_format_version: Some(6),
2743 min_move_binary_format_version: None,
2744 binary_module_handles: None,
2745 binary_struct_handles: None,
2746 binary_function_handles: None,
2747 binary_function_instantiations: None,
2748 binary_signatures: None,
2749 binary_constant_pool: None,
2750 binary_identifiers: None,
2751 binary_address_identifiers: None,
2752 binary_struct_defs: None,
2753 binary_struct_def_instantiations: None,
2754 binary_function_defs: None,
2755 binary_field_handles: None,
2756 binary_field_instantiations: None,
2757 binary_friend_decls: None,
2758 binary_enum_defs: None,
2759 binary_enum_def_instantiations: None,
2760 binary_variant_handles: None,
2761 binary_variant_instantiation_handles: None,
2762 binary_format_limits_profile: None,
2763 max_move_object_size: Some(250 * 1024),
2764 max_move_package_size: Some(100 * 1024),
2765 max_publish_or_upgrade_per_ptb: None,
2766 max_tx_gas: Some(10_000_000_000),
2767 max_gas_price: Some(100_000),
2768 max_gas_price_rgp_factor_for_aborted_transactions: None,
2769 max_gas_computation_bucket: Some(5_000_000),
2770 max_loop_depth: Some(5),
2771 max_generic_instantiation_length: Some(32),
2772 max_function_parameters: Some(128),
2773 max_basic_blocks: Some(1024),
2774 max_value_stack_size: Some(1024),
2775 max_type_nodes: Some(256),
2776 max_generic_instantiation_type_nodes_per_function: None,
2777 max_generic_instantiation_type_nodes_per_module: None,
2778 max_accumulator_type_nodes: None,
2779 max_push_size: Some(10000),
2780 max_struct_definitions: Some(200),
2781 max_function_definitions: Some(1000),
2782 max_fields_in_struct: Some(32),
2783 max_dependency_depth: Some(100),
2784 max_num_event_emit: Some(256),
2785 max_num_new_move_object_ids: Some(2048),
2786 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2787 max_num_deleted_move_object_ids: Some(2048),
2788 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2789 max_num_transferred_move_object_ids: Some(2048),
2790 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2791 max_event_emit_size: Some(250 * 1024),
2792 max_move_vector_len: Some(256 * 1024),
2793 max_type_to_layout_nodes: None,
2794 max_ptb_value_size: None,
2795
2796 max_back_edges_per_function: Some(10_000),
2797 max_back_edges_per_module: Some(10_000),
2798 max_verifier_meter_ticks_per_function: Some(6_000_000),
2799 max_meter_ticks_per_module: Some(6_000_000),
2800 max_meter_ticks_per_package: None,
2801
2802 object_runtime_max_num_cached_objects: Some(1000),
2803 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2804 object_runtime_max_num_store_entries: Some(1000),
2805 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2806 base_tx_cost_fixed: Some(110_000),
2807 package_publish_cost_fixed: Some(1_000),
2808 base_tx_cost_per_byte: Some(0),
2809 package_publish_cost_per_byte: Some(80),
2810 obj_access_cost_read_per_byte: Some(15),
2811 obj_access_cost_read_per_package_kb: None,
2812 obj_access_cost_mutate_per_byte: Some(40),
2813 obj_access_cost_delete_per_byte: Some(40),
2814 obj_access_cost_verify_per_byte: Some(200),
2815 obj_data_cost_refundable: Some(100),
2816 obj_metadata_cost_non_refundable: Some(50),
2817 gas_model_version: Some(1),
2818 storage_rebate_rate: Some(9900),
2819 storage_fund_reinvest_rate: Some(500),
2820 reward_slashing_rate: Some(5000),
2821 storage_gas_price: Some(1),
2822 accumulator_object_storage_cost: None,
2823 max_transactions_per_checkpoint: Some(10_000),
2824 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2825
2826 buffer_stake_for_protocol_upgrade_bps: Some(0),
2829
2830 address_from_bytes_cost_base: Some(52),
2834 address_to_u256_cost_base: Some(52),
2836 address_from_u256_cost_base: Some(52),
2838
2839 config_read_setting_impl_cost_base: None,
2842 config_read_setting_impl_cost_per_byte: None,
2843
2844 package_original_package_id_impl_cost_base: None,
2845 package_original_package_id_impl_cost_per_byte: None,
2846
2847 dynamic_field_hash_type_and_key_cost_base: Some(100),
2850 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2851 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2852 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2853 dynamic_field_add_child_object_cost_base: Some(100),
2855 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2856 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2857 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2858 dynamic_field_borrow_child_object_cost_base: Some(100),
2860 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2861 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2862 dynamic_field_remove_child_object_cost_base: Some(100),
2864 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2865 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2866 dynamic_field_has_child_object_cost_base: Some(100),
2868 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2870 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2871 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2872
2873 scratch_add_cost_base: None,
2875 scratch_read_cost_base: None,
2876 scratch_read_value_cost: None,
2877 scratch_remove_cost_base: None,
2878 scratch_exists_cost_base: None,
2879 scratch_exists_with_type_cost_base: None,
2880 scratch_exists_with_type_type_cost: None,
2881 max_scratch_pad_size: None,
2882
2883 event_emit_cost_base: Some(52),
2886 event_emit_value_size_derivation_cost_per_byte: Some(2),
2887 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2888 event_emit_output_cost_per_byte: Some(10),
2889 event_emit_auth_stream_cost: None,
2890
2891 reserve_object_funds_for_withdrawal_cost_base: None,
2893 reserve_object_funds_for_withdrawal_cold_read_cost: None,
2894
2895 object_borrow_uid_cost_base: Some(52),
2898 object_delete_impl_cost_base: Some(52),
2900 object_record_new_uid_cost_base: Some(52),
2902 object_record_new_uid_from_hash_cost_base: None,
2905 object_is_shared_input_cost_base: None,
2908
2909 transfer_transfer_internal_cost_base: Some(52),
2912 transfer_party_transfer_internal_cost_base: None,
2914 transfer_freeze_object_cost_base: Some(52),
2916 transfer_share_object_cost_base: Some(52),
2918 transfer_receive_object_cost_base: None,
2919 transfer_receive_object_type_cost_per_byte: None,
2920 transfer_receive_object_cost_per_byte: None,
2921
2922 tx_context_derive_id_cost_base: Some(52),
2925 tx_context_fresh_id_cost_base: None,
2926 tx_context_sender_cost_base: None,
2927 tx_context_epoch_cost_base: None,
2928 tx_context_epoch_timestamp_ms_cost_base: None,
2929 tx_context_sponsor_cost_base: None,
2930 tx_context_rgp_cost_base: None,
2931 tx_context_gas_price_cost_base: None,
2932 tx_context_gas_budget_cost_base: None,
2933 tx_context_ids_created_cost_base: None,
2934 tx_context_replace_cost_base: None,
2935
2936 clock_borrow_cost_base: None,
2938
2939 types_is_one_time_witness_cost_base: Some(52),
2942 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2943 types_is_one_time_witness_type_cost_per_byte: Some(2),
2944
2945 validator_validate_metadata_cost_base: Some(52),
2948 validator_validate_metadata_data_cost_per_byte: Some(2),
2949
2950 crypto_invalid_arguments_cost: Some(100),
2952 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2954 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2955 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2956
2957 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2959 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2960 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2961
2962 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2964 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2965 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2966 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2967 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2968 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2969
2970 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2972
2973 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2975 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2976 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2977 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2978 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2979 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2980
2981 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2983 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2984 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2985 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
2986 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2987 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
2988
2989 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
2991 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
2992 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
2993 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
2994 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
2995 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
2996
2997 ecvrf_ecvrf_verify_cost_base: Some(52),
2999 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3000 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3001
3002 ed25519_ed25519_verify_cost_base: Some(52),
3004 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3005 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3006
3007 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3009 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3010
3011 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3013 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3014 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3015 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3016 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3017
3018 hash_blake2b256_cost_base: Some(52),
3020 hash_blake2b256_data_cost_per_byte: Some(2),
3021 hash_blake2b256_data_cost_per_block: Some(2),
3022
3023 hash_keccak256_cost_base: Some(52),
3025 hash_keccak256_data_cost_per_byte: Some(2),
3026 hash_keccak256_data_cost_per_block: Some(2),
3027
3028 poseidon_bn254_cost_base: None,
3029 poseidon_bn254_cost_per_block: None,
3030
3031 hmac_hmac_sha3_256_cost_base: Some(52),
3033 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3034 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3035
3036 group_ops_bls12381_decode_scalar_cost: None,
3038 group_ops_bls12381_decode_g1_cost: None,
3039 group_ops_bls12381_decode_g2_cost: None,
3040 group_ops_bls12381_decode_gt_cost: None,
3041 group_ops_bls12381_scalar_add_cost: None,
3042 group_ops_bls12381_g1_add_cost: None,
3043 group_ops_bls12381_g2_add_cost: None,
3044 group_ops_bls12381_gt_add_cost: None,
3045 group_ops_bls12381_scalar_sub_cost: None,
3046 group_ops_bls12381_g1_sub_cost: None,
3047 group_ops_bls12381_g2_sub_cost: None,
3048 group_ops_bls12381_gt_sub_cost: None,
3049 group_ops_bls12381_scalar_mul_cost: None,
3050 group_ops_bls12381_g1_mul_cost: None,
3051 group_ops_bls12381_g2_mul_cost: None,
3052 group_ops_bls12381_gt_mul_cost: None,
3053 group_ops_bls12381_scalar_div_cost: None,
3054 group_ops_bls12381_g1_div_cost: None,
3055 group_ops_bls12381_g2_div_cost: None,
3056 group_ops_bls12381_gt_div_cost: None,
3057 group_ops_bls12381_g1_hash_to_base_cost: None,
3058 group_ops_bls12381_g2_hash_to_base_cost: None,
3059 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3060 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3061 group_ops_bls12381_g1_msm_base_cost: None,
3062 group_ops_bls12381_g2_msm_base_cost: None,
3063 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3064 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3065 group_ops_bls12381_msm_max_len: None,
3066 group_ops_bls12381_pairing_cost: None,
3067 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3068 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3069 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3070 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3071 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3072
3073 group_ops_ristretto_decode_scalar_cost: None,
3074 group_ops_ristretto_decode_point_cost: None,
3075 group_ops_ristretto_scalar_add_cost: None,
3076 group_ops_ristretto_point_add_cost: None,
3077 group_ops_ristretto_scalar_sub_cost: None,
3078 group_ops_ristretto_point_sub_cost: None,
3079 group_ops_ristretto_scalar_mul_cost: None,
3080 group_ops_ristretto_point_mul_cost: None,
3081 group_ops_ristretto_scalar_div_cost: None,
3082 group_ops_ristretto_point_div_cost: None,
3083
3084 verify_bulletproofs_ristretto255_base_cost: None,
3085 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3086 max_bulletproofs_total_bits: None,
3087
3088 check_zklogin_id_cost_base: None,
3090 check_zklogin_issuer_cost_base: None,
3092
3093 vdf_verify_vdf_cost: None,
3094 vdf_hash_to_input_cost: None,
3095
3096 nitro_attestation_parse_base_cost: None,
3098 nitro_attestation_parse_cost_per_byte: None,
3099 nitro_attestation_verify_base_cost: None,
3100 nitro_attestation_verify_cost_per_cert: None,
3101
3102 bcs_per_byte_serialized_cost: None,
3103 bcs_legacy_min_output_size_cost: None,
3104 bcs_failure_cost: None,
3105 hash_sha2_256_base_cost: None,
3106 hash_sha2_256_per_byte_cost: None,
3107 hash_sha2_256_legacy_min_input_len_cost: None,
3108 hash_sha3_256_base_cost: None,
3109 hash_sha3_256_per_byte_cost: None,
3110 hash_sha3_256_legacy_min_input_len_cost: None,
3111 type_name_get_base_cost: None,
3112 type_name_get_per_byte_cost: None,
3113 type_name_id_base_cost: None,
3114 string_check_utf8_base_cost: None,
3115 string_check_utf8_per_byte_cost: None,
3116 string_is_char_boundary_base_cost: None,
3117 string_sub_string_base_cost: None,
3118 string_sub_string_per_byte_cost: None,
3119 string_index_of_base_cost: None,
3120 string_index_of_per_byte_pattern_cost: None,
3121 string_index_of_per_byte_searched_cost: None,
3122 vector_empty_base_cost: None,
3123 vector_length_base_cost: None,
3124 vector_push_back_base_cost: None,
3125 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3126 vector_borrow_base_cost: None,
3127 vector_pop_back_base_cost: None,
3128 vector_destroy_empty_base_cost: None,
3129 vector_swap_base_cost: None,
3130 vector_reverse_base_cost: None,
3131 vector_reverse_per_elem_cost: None,
3132 vector_keep_range_base_cost: None,
3133 vector_keep_range_per_dropped_elem_cost: None,
3134 vector_keep_range_per_moved_elem_cost: None,
3135 vector_copy_range_base_cost: None,
3136 vector_replace_range_base_cost: None,
3137 vector_replace_range_per_elem_cost: None,
3138 debug_print_base_cost: None,
3139 debug_print_stack_trace_base_cost: None,
3140
3141 max_size_written_objects: None,
3142 max_size_written_objects_system_tx: None,
3143
3144 max_move_identifier_len: None,
3151 max_move_value_depth: None,
3152 package_arena_size_in_bytes: None,
3153 max_move_enum_variants: None,
3154
3155 gas_rounding_step: None,
3156
3157 execution_version: None,
3158
3159 max_event_emit_size_total: None,
3160
3161 consensus_bad_nodes_stake_threshold: None,
3162
3163 max_jwk_votes_per_validator_per_epoch: None,
3164
3165 max_age_of_jwk_in_epochs: None,
3166
3167 random_beacon_reduction_allowed_delta: None,
3168
3169 random_beacon_reduction_lower_bound: None,
3170
3171 random_beacon_dkg_timeout_round: None,
3172
3173 random_beacon_min_round_interval_ms: None,
3174
3175 random_beacon_dkg_version: None,
3176
3177 consensus_max_transaction_size_bytes: None,
3178
3179 consensus_max_transactions_in_block_bytes: None,
3180
3181 consensus_max_num_transactions_in_block: None,
3182
3183 consensus_voting_rounds: None,
3184
3185 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3186
3187 max_deferral_rounds_for_congestion_control: None,
3188
3189 epoch_close_deadline_ms: None,
3190
3191 max_txn_cost_overage_per_object_in_commit: None,
3192
3193 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3194
3195 min_checkpoint_interval_ms: None,
3196
3197 checkpoint_summary_version_specific_data: None,
3198
3199 max_soft_bundle_size: None,
3200
3201 bridge_should_try_to_finalize_committee: None,
3202
3203 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3204
3205 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3206
3207 consensus_gc_depth: None,
3208
3209 gas_budget_based_txn_cost_cap_factor: None,
3210
3211 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3212
3213 sip_45_consensus_amplification_threshold: None,
3214 staggered_submission_signal_window_commits: None,
3215 staggered_submission_signal_min_excess_copies_per_commit: None,
3216 staggered_submission_signal_exit_dwell_commits: None,
3217 staggered_submission_signal_band1_enter_ratio_bps: None,
3218 staggered_submission_signal_band1_exit_ratio_bps: None,
3219 staggered_submission_signal_band2_enter_ratio_bps: None,
3220 staggered_submission_signal_band2_exit_ratio_bps: None,
3221
3222 use_object_per_epoch_marker_table_v2: None,
3223
3224 consensus_commit_rate_estimation_window_size: None,
3225
3226 aliased_addresses: vec![],
3227
3228 translation_per_command_base_charge: None,
3229 translation_per_input_base_charge: None,
3230 translation_pure_input_per_byte_charge: None,
3231 translation_per_type_node_charge: None,
3232 translation_per_reference_node_charge: None,
3233 translation_per_linkage_entry_charge: None,
3234 translation_per_live_reference_charge: None,
3235 max_ptb_live_references: None,
3236 max_ptb_returned_references: None,
3237 max_ptb_total_returned_references: None,
3238
3239 max_updates_per_settlement_txn: None,
3240
3241 gasless_max_computation_units: None,
3242 gasless_allowed_token_types: None,
3243 gasless_max_unused_inputs: None,
3244 gasless_max_pure_input_bytes: None,
3245 gasless_max_tps: None,
3246 include_special_package_amendments: None,
3247 gasless_max_tx_size_bytes: None,
3248 };
3251 for cur in 2..=version.0 {
3252 match cur {
3253 1 => unreachable!(),
3254 2 => {
3255 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3256 }
3257 3 => {
3258 cfg.gas_model_version = Some(2);
3260 cfg.max_tx_gas = Some(50_000_000_000);
3262 cfg.base_tx_cost_fixed = Some(2_000);
3264 cfg.storage_gas_price = Some(76);
3266 cfg.feature_flags.loaded_child_objects_fixed = true;
3267 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3270 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3273 cfg.feature_flags.package_upgrades = true;
3274 }
3275 4 => {
3280 cfg.reward_slashing_rate = Some(10000);
3282 cfg.gas_model_version = Some(3);
3284 }
3285 5 => {
3286 cfg.feature_flags.missing_type_is_compatibility_error = true;
3287 cfg.gas_model_version = Some(4);
3288 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3289 }
3293 6 => {
3294 cfg.gas_model_version = Some(5);
3295 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3296 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3297 }
3298 7 => {
3299 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3300 cfg.feature_flags
3301 .disable_invariant_violation_check_in_swap_loc = true;
3302 cfg.feature_flags.ban_entry_init = true;
3303 cfg.feature_flags.package_digest_hash_module = true;
3304 }
3305 8 => {
3306 cfg.feature_flags
3307 .disallow_change_struct_type_params_on_upgrade = true;
3308 }
3309 9 => {
3310 cfg.max_move_identifier_len = Some(128);
3312 cfg.feature_flags.no_extraneous_module_bytes = true;
3313 cfg.feature_flags
3314 .advance_to_highest_supported_protocol_version = true;
3315 }
3316 10 => {
3317 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3318 cfg.max_meter_ticks_per_module = Some(16_000_000);
3319 }
3320 11 => {
3321 cfg.max_move_value_depth = Some(128);
3322 }
3323 12 => {
3324 cfg.feature_flags.narwhal_versioned_metadata = true;
3325 if chain != Chain::Mainnet {
3326 cfg.feature_flags.commit_root_state_digest = true;
3327 }
3328
3329 if chain != Chain::Mainnet && chain != Chain::Testnet {
3330 cfg.feature_flags.zklogin_auth = true;
3331 }
3332 }
3333 13 => {}
3334 14 => {
3335 cfg.gas_rounding_step = Some(1_000);
3336 cfg.gas_model_version = Some(6);
3337 }
3338 15 => {
3339 cfg.feature_flags.consensus_transaction_ordering =
3340 ConsensusTransactionOrdering::ByGasPrice;
3341 }
3342 16 => {
3343 cfg.feature_flags.simplified_unwrap_then_delete = true;
3344 }
3345 17 => {
3346 cfg.feature_flags.upgraded_multisig_supported = true;
3347 }
3348 18 => {
3349 cfg.execution_version = Some(1);
3350 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3359 cfg.base_tx_cost_fixed = Some(1_000);
3361 }
3362 19 => {
3363 cfg.max_num_event_emit = Some(1024);
3364 cfg.max_event_emit_size_total = Some(
3367 256 * 250 * 1024, );
3369 }
3370 20 => {
3371 cfg.feature_flags.commit_root_state_digest = true;
3372
3373 if chain != Chain::Mainnet {
3374 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3375 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3376 }
3377 }
3378
3379 21 => {
3380 if chain != Chain::Mainnet {
3381 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3382 "Google".to_string(),
3383 "Facebook".to_string(),
3384 "Twitch".to_string(),
3385 ]);
3386 }
3387 }
3388 22 => {
3389 cfg.feature_flags.loaded_child_object_format = true;
3390 }
3391 23 => {
3392 cfg.feature_flags.loaded_child_object_format_type = true;
3393 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3394 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3400 }
3401 24 => {
3402 cfg.feature_flags.simple_conservation_checks = true;
3403 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3404
3405 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3406
3407 if chain != Chain::Mainnet {
3408 cfg.feature_flags.enable_jwk_consensus_updates = true;
3409 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3411 cfg.max_age_of_jwk_in_epochs = Some(1);
3412 }
3413 }
3414 25 => {
3415 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3417 "Google".to_string(),
3418 "Facebook".to_string(),
3419 "Twitch".to_string(),
3420 ]);
3421 cfg.feature_flags.zklogin_auth = true;
3422
3423 cfg.feature_flags.enable_jwk_consensus_updates = true;
3425 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3426 cfg.max_age_of_jwk_in_epochs = Some(1);
3427 }
3428 26 => {
3429 cfg.gas_model_version = Some(7);
3430 if chain != Chain::Mainnet && chain != Chain::Testnet {
3432 cfg.transfer_receive_object_cost_base = Some(52);
3433 cfg.feature_flags.receive_objects = true;
3434 }
3435 }
3436 27 => {
3437 cfg.gas_model_version = Some(8);
3438 }
3439 28 => {
3440 cfg.check_zklogin_id_cost_base = Some(200);
3442 cfg.check_zklogin_issuer_cost_base = Some(200);
3444
3445 if chain != Chain::Mainnet && chain != Chain::Testnet {
3447 cfg.feature_flags.enable_effects_v2 = true;
3448 }
3449 }
3450 29 => {
3451 cfg.feature_flags.verify_legacy_zklogin_address = true;
3452 }
3453 30 => {
3454 if chain != Chain::Mainnet {
3456 cfg.feature_flags.narwhal_certificate_v2 = true;
3457 }
3458
3459 cfg.random_beacon_reduction_allowed_delta = Some(800);
3460 if chain != Chain::Mainnet {
3462 cfg.feature_flags.enable_effects_v2 = true;
3463 }
3464
3465 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3469
3470 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3471 }
3472 31 => {
3473 cfg.execution_version = Some(2);
3474 if chain != Chain::Mainnet && chain != Chain::Testnet {
3476 cfg.feature_flags.shared_object_deletion = true;
3477 }
3478 }
3479 32 => {
3480 if chain != Chain::Mainnet {
3482 cfg.feature_flags.accept_zklogin_in_multisig = true;
3483 }
3484 if chain != Chain::Mainnet {
3486 cfg.transfer_receive_object_cost_base = Some(52);
3487 cfg.feature_flags.receive_objects = true;
3488 }
3489 if chain != Chain::Mainnet && chain != Chain::Testnet {
3491 cfg.feature_flags.random_beacon = true;
3492 cfg.random_beacon_reduction_lower_bound = Some(1600);
3493 cfg.random_beacon_dkg_timeout_round = Some(3000);
3494 cfg.random_beacon_min_round_interval_ms = Some(150);
3495 }
3496 if chain != Chain::Testnet && chain != Chain::Mainnet {
3498 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3499 }
3500
3501 cfg.feature_flags.narwhal_certificate_v2 = true;
3503 }
3504 33 => {
3505 cfg.feature_flags.hardened_otw_check = true;
3506 cfg.feature_flags.allow_receiving_object_id = true;
3507
3508 cfg.transfer_receive_object_cost_base = Some(52);
3510 cfg.feature_flags.receive_objects = true;
3511
3512 if chain != Chain::Mainnet {
3514 cfg.feature_flags.shared_object_deletion = true;
3515 }
3516
3517 cfg.feature_flags.enable_effects_v2 = true;
3518 }
3519 34 => {}
3520 35 => {
3521 if chain != Chain::Mainnet && chain != Chain::Testnet {
3523 cfg.feature_flags.enable_poseidon = true;
3524 cfg.poseidon_bn254_cost_base = Some(260);
3525 cfg.poseidon_bn254_cost_per_block = Some(10);
3526 }
3527
3528 cfg.feature_flags.enable_coin_deny_list = true;
3529 }
3530 36 => {
3531 if chain != Chain::Mainnet && chain != Chain::Testnet {
3533 cfg.feature_flags.enable_group_ops_native_functions = true;
3534 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3535 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3537 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3538 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3539 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3540 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3541 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3542 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3543 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3544 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3545 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3546 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3547 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3548 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3549 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3550 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3551 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3552 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3553 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3554 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3555 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3556 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3557 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3558 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3559 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3560 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3561 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3562 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3563 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3564 cfg.group_ops_bls12381_msm_max_len = Some(32);
3565 cfg.group_ops_bls12381_pairing_cost = Some(52);
3566 }
3567 cfg.feature_flags.shared_object_deletion = true;
3569
3570 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3572 }
3574 37 => {
3575 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3576
3577 if chain != Chain::Mainnet {
3579 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3580 }
3581 }
3582 38 => {
3583 cfg.binary_module_handles = Some(100);
3584 cfg.binary_struct_handles = Some(300);
3585 cfg.binary_function_handles = Some(1500);
3586 cfg.binary_function_instantiations = Some(750);
3587 cfg.binary_signatures = Some(1000);
3588 cfg.binary_constant_pool = Some(4000);
3592 cfg.binary_identifiers = Some(10000);
3593 cfg.binary_address_identifiers = Some(100);
3594 cfg.binary_struct_defs = Some(200);
3595 cfg.binary_struct_def_instantiations = Some(100);
3596 cfg.binary_function_defs = Some(1000);
3597 cfg.binary_field_handles = Some(500);
3598 cfg.binary_field_instantiations = Some(250);
3599 cfg.binary_friend_decls = Some(100);
3600 cfg.max_package_dependencies = Some(32);
3602 cfg.max_modules_in_publish = Some(64);
3603 cfg.execution_version = Some(3);
3605 }
3606 39 => {
3607 }
3609 40 => {}
3610 41 => {
3611 cfg.feature_flags.enable_group_ops_native_functions = true;
3613 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3615 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3616 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3617 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3618 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3619 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3620 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3621 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3622 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3623 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3624 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3625 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3626 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3627 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3628 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3629 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3630 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3631 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3632 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3633 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3634 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3635 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3636 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3637 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3638 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3639 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3640 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3641 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3642 cfg.group_ops_bls12381_msm_max_len = Some(32);
3643 cfg.group_ops_bls12381_pairing_cost = Some(52);
3644 }
3645 42 => {}
3646 43 => {
3647 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3648 cfg.max_meter_ticks_per_package = Some(16_000_000);
3649 }
3650 44 => {
3651 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3653 if chain != Chain::Mainnet {
3655 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3656 }
3657 }
3658 45 => {
3659 if chain != Chain::Testnet && chain != Chain::Mainnet {
3661 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3662 }
3663
3664 if chain != Chain::Mainnet {
3665 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3667 }
3668 cfg.min_move_binary_format_version = Some(6);
3669 cfg.feature_flags.accept_zklogin_in_multisig = true;
3670
3671 if chain != Chain::Mainnet && chain != Chain::Testnet {
3675 cfg.feature_flags.bridge = true;
3676 }
3677 }
3678 46 => {
3679 if chain != Chain::Mainnet {
3681 cfg.feature_flags.bridge = true;
3682 }
3683
3684 cfg.feature_flags.reshare_at_same_initial_version = true;
3686 }
3687 47 => {}
3688 48 => {
3689 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3691
3692 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3694
3695 if chain != Chain::Mainnet {
3697 cfg.feature_flags.random_beacon = true;
3698 cfg.random_beacon_reduction_lower_bound = Some(1600);
3699 cfg.random_beacon_dkg_timeout_round = Some(3000);
3700 cfg.random_beacon_min_round_interval_ms = Some(200);
3701 }
3702
3703 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3705 }
3706 49 => {
3707 if chain != Chain::Testnet && chain != Chain::Mainnet {
3708 cfg.move_binary_format_version = Some(7);
3709 }
3710
3711 if chain != Chain::Mainnet && chain != Chain::Testnet {
3713 cfg.feature_flags.enable_vdf = true;
3714 cfg.vdf_verify_vdf_cost = Some(1500);
3717 cfg.vdf_hash_to_input_cost = Some(100);
3718 }
3719
3720 if chain != Chain::Testnet && chain != Chain::Mainnet {
3722 cfg.feature_flags
3723 .record_consensus_determined_version_assignments_in_prologue = true;
3724 }
3725
3726 if chain != Chain::Mainnet {
3728 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3729 }
3730
3731 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3733 }
3734 50 => {
3735 if chain != Chain::Mainnet {
3737 cfg.checkpoint_summary_version_specific_data = Some(1);
3738 cfg.min_checkpoint_interval_ms = Some(200);
3739 }
3740
3741 if chain != Chain::Testnet && chain != Chain::Mainnet {
3743 cfg.feature_flags
3744 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3745 }
3746
3747 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3748
3749 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3751 }
3752 51 => {
3753 cfg.random_beacon_dkg_version = Some(1);
3754
3755 if chain != Chain::Testnet && chain != Chain::Mainnet {
3756 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3757 }
3758 }
3759 52 => {
3760 if chain != Chain::Mainnet {
3761 cfg.feature_flags.soft_bundle = true;
3762 cfg.max_soft_bundle_size = Some(5);
3763 }
3764
3765 cfg.config_read_setting_impl_cost_base = Some(100);
3766 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3767
3768 if chain != Chain::Testnet && chain != Chain::Mainnet {
3770 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3771 cfg.feature_flags.per_object_congestion_control_mode =
3772 PerObjectCongestionControlMode::TotalTxCount;
3773 }
3774
3775 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3777
3778 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3780
3781 cfg.checkpoint_summary_version_specific_data = Some(1);
3783 cfg.min_checkpoint_interval_ms = Some(200);
3784
3785 if chain != Chain::Mainnet {
3787 cfg.feature_flags
3788 .record_consensus_determined_version_assignments_in_prologue = true;
3789 cfg.feature_flags
3790 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3791 }
3792 if chain != Chain::Mainnet {
3794 cfg.move_binary_format_version = Some(7);
3795 }
3796
3797 if chain != Chain::Testnet && chain != Chain::Mainnet {
3798 cfg.feature_flags.passkey_auth = true;
3799 }
3800 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3801 }
3802 53 => {
3803 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3805
3806 cfg.feature_flags
3808 .record_consensus_determined_version_assignments_in_prologue = true;
3809 cfg.feature_flags
3810 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3811
3812 if chain == Chain::Unknown {
3813 cfg.feature_flags.authority_capabilities_v2 = true;
3814 }
3815
3816 if chain != Chain::Mainnet {
3818 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3819 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3820 cfg.feature_flags.per_object_congestion_control_mode =
3821 PerObjectCongestionControlMode::TotalTxCount;
3822 }
3823
3824 cfg.bcs_per_byte_serialized_cost = Some(2);
3826 cfg.bcs_legacy_min_output_size_cost = Some(1);
3827 cfg.bcs_failure_cost = Some(52);
3828 cfg.debug_print_base_cost = Some(52);
3829 cfg.debug_print_stack_trace_base_cost = Some(52);
3830 cfg.hash_sha2_256_base_cost = Some(52);
3831 cfg.hash_sha2_256_per_byte_cost = Some(2);
3832 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3833 cfg.hash_sha3_256_base_cost = Some(52);
3834 cfg.hash_sha3_256_per_byte_cost = Some(2);
3835 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3836 cfg.type_name_get_base_cost = Some(52);
3837 cfg.type_name_get_per_byte_cost = Some(2);
3838 cfg.string_check_utf8_base_cost = Some(52);
3839 cfg.string_check_utf8_per_byte_cost = Some(2);
3840 cfg.string_is_char_boundary_base_cost = Some(52);
3841 cfg.string_sub_string_base_cost = Some(52);
3842 cfg.string_sub_string_per_byte_cost = Some(2);
3843 cfg.string_index_of_base_cost = Some(52);
3844 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3845 cfg.string_index_of_per_byte_searched_cost = Some(2);
3846 cfg.vector_empty_base_cost = Some(52);
3847 cfg.vector_length_base_cost = Some(52);
3848 cfg.vector_push_back_base_cost = Some(52);
3849 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3850 cfg.vector_borrow_base_cost = Some(52);
3851 cfg.vector_pop_back_base_cost = Some(52);
3852 cfg.vector_destroy_empty_base_cost = Some(52);
3853 cfg.vector_swap_base_cost = Some(52);
3854 }
3855 54 => {
3856 cfg.feature_flags.random_beacon = true;
3858 cfg.random_beacon_reduction_lower_bound = Some(1000);
3859 cfg.random_beacon_dkg_timeout_round = Some(3000);
3860 cfg.random_beacon_min_round_interval_ms = Some(500);
3861
3862 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3864 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3865 cfg.feature_flags.per_object_congestion_control_mode =
3866 PerObjectCongestionControlMode::TotalTxCount;
3867
3868 cfg.feature_flags.soft_bundle = true;
3870 cfg.max_soft_bundle_size = Some(5);
3871 }
3872 55 => {
3873 cfg.move_binary_format_version = Some(7);
3875
3876 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3878 cfg.consensus_max_num_transactions_in_block = Some(512);
3881
3882 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3883 }
3884 56 => {
3885 if chain == Chain::Mainnet {
3886 cfg.feature_flags.bridge = true;
3887 }
3888 }
3889 57 => {
3890 cfg.random_beacon_reduction_lower_bound = Some(800);
3892 }
3893 58 => {
3894 if chain == Chain::Mainnet {
3895 cfg.bridge_should_try_to_finalize_committee = Some(true);
3896 }
3897
3898 if chain != Chain::Mainnet && chain != Chain::Testnet {
3899 cfg.feature_flags
3901 .consensus_distributed_vote_scoring_strategy = true;
3902 }
3903 }
3904 59 => {
3905 cfg.feature_flags.consensus_round_prober = true;
3907 }
3908 60 => {
3909 cfg.max_type_to_layout_nodes = Some(512);
3910 cfg.feature_flags.validate_identifier_inputs = true;
3911 }
3912 61 => {
3913 if chain != Chain::Mainnet {
3914 cfg.feature_flags
3916 .consensus_distributed_vote_scoring_strategy = true;
3917 }
3918 cfg.random_beacon_reduction_lower_bound = Some(700);
3920
3921 if chain != Chain::Mainnet && chain != Chain::Testnet {
3922 cfg.feature_flags.mysticeti_fastpath = true;
3924 }
3925 }
3926 62 => {
3927 cfg.feature_flags.relocate_event_module = true;
3928 }
3929 63 => {
3930 cfg.feature_flags.per_object_congestion_control_mode =
3931 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3932 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3933 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3934 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3935 }
3936 64 => {
3937 cfg.feature_flags.per_object_congestion_control_mode =
3938 PerObjectCongestionControlMode::TotalTxCount;
3939 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3940 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3941 }
3942 65 => {
3943 cfg.feature_flags
3945 .consensus_distributed_vote_scoring_strategy = true;
3946 }
3947 66 => {
3948 if chain == Chain::Mainnet {
3949 cfg.feature_flags
3951 .consensus_distributed_vote_scoring_strategy = false;
3952 }
3953 }
3954 67 => {
3955 cfg.feature_flags
3957 .consensus_distributed_vote_scoring_strategy = true;
3958 }
3959 68 => {
3960 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3961 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3962 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3963 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3964 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3965
3966 if chain != Chain::Mainnet && chain != Chain::Testnet {
3967 cfg.feature_flags.uncompressed_g1_group_elements = true;
3968 }
3969
3970 cfg.feature_flags.per_object_congestion_control_mode =
3971 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3972 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3973 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3974 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3975 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3977 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3978
3979 cfg.random_beacon_reduction_lower_bound = Some(500);
3981
3982 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3983 }
3984 69 => {
3985 cfg.consensus_voting_rounds = Some(40);
3987
3988 if chain != Chain::Mainnet && chain != Chain::Testnet {
3989 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3991 }
3992
3993 if chain != Chain::Mainnet {
3994 cfg.feature_flags.uncompressed_g1_group_elements = true;
3995 }
3996 }
3997 70 => {
3998 if chain != Chain::Mainnet {
3999 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4001 cfg.feature_flags
4003 .consensus_round_prober_probe_accepted_rounds = true;
4004 }
4005
4006 cfg.poseidon_bn254_cost_per_block = Some(388);
4007
4008 cfg.gas_model_version = Some(9);
4009 cfg.feature_flags.native_charging_v2 = true;
4010 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4011 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4012 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4013 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4014 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4015 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4016 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4017 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4018
4019 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4021 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4022 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4023 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4024
4025 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4026 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4027 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4028 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4029 Some(8213);
4030 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4031 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4032 Some(9484);
4033
4034 cfg.hash_keccak256_cost_base = Some(10);
4035 cfg.hash_blake2b256_cost_base = Some(10);
4036
4037 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4039 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4040 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4041 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4042
4043 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4044 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4045 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4046 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4047
4048 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4049 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4050 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4051 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4052
4053 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4054 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4055 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4056 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4057
4058 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4059 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4060 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4061 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4062
4063 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4064 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4065
4066 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4067 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4068 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4069 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4070
4071 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4072 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4073 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4074 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4075
4076 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4077 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4078
4079 cfg.validator_validate_metadata_cost_base = Some(20000);
4080 }
4081 71 => {
4082 cfg.sip_45_consensus_amplification_threshold = Some(5);
4083
4084 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4086 }
4087 72 => {
4088 cfg.feature_flags.convert_type_argument_error = true;
4089
4090 cfg.max_tx_gas = Some(50_000_000_000_000);
4093 cfg.max_gas_price = Some(50_000_000_000);
4095
4096 cfg.feature_flags.variant_nodes = true;
4097 }
4098 73 => {
4099 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4101
4102 if chain != Chain::Mainnet && chain != Chain::Testnet {
4103 cfg.consensus_gc_depth = Some(60);
4106 }
4107
4108 if chain != Chain::Mainnet {
4109 cfg.feature_flags.consensus_zstd_compression = true;
4111 }
4112
4113 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4115 cfg.feature_flags
4117 .consensus_round_prober_probe_accepted_rounds = true;
4118
4119 cfg.feature_flags.per_object_congestion_control_mode =
4121 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4122 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4123 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4124 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4125 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4127 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4128 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4129 }
4130 74 => {
4131 if chain != Chain::Mainnet && chain != Chain::Testnet {
4133 cfg.feature_flags.enable_nitro_attestation = true;
4134 }
4135 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4136 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4137 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4138 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4139
4140 cfg.feature_flags.consensus_zstd_compression = true;
4142
4143 if chain != Chain::Mainnet && chain != Chain::Testnet {
4144 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4145 }
4146 }
4147 75 => {
4148 if chain != Chain::Mainnet {
4149 cfg.feature_flags.passkey_auth = true;
4150 }
4151 }
4152 76 => {
4153 if chain != Chain::Mainnet && chain != Chain::Testnet {
4154 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4155 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4156 }
4157 cfg.feature_flags.minimize_child_object_mutations = true;
4158
4159 if chain != Chain::Mainnet {
4160 cfg.feature_flags.accept_passkey_in_multisig = true;
4161 }
4162 }
4163 77 => {
4164 cfg.feature_flags.uncompressed_g1_group_elements = true;
4165
4166 if chain != Chain::Mainnet {
4167 cfg.consensus_gc_depth = Some(60);
4168 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4169 }
4170 }
4171 78 => {
4172 cfg.feature_flags.move_native_context = true;
4173 cfg.tx_context_fresh_id_cost_base = Some(52);
4174 cfg.tx_context_sender_cost_base = Some(30);
4175 cfg.tx_context_epoch_cost_base = Some(30);
4176 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4177 cfg.tx_context_sponsor_cost_base = Some(30);
4178 cfg.tx_context_gas_price_cost_base = Some(30);
4179 cfg.tx_context_gas_budget_cost_base = Some(30);
4180 cfg.tx_context_ids_created_cost_base = Some(30);
4181 cfg.tx_context_replace_cost_base = Some(30);
4182 cfg.gas_model_version = Some(10);
4183
4184 if chain != Chain::Mainnet {
4185 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4186 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4187
4188 cfg.feature_flags.per_object_congestion_control_mode =
4190 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4191 ExecutionTimeEstimateParams {
4192 target_utilization: 30,
4193 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4195 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4197 stored_observations_limit: u64::MAX,
4198 stake_weighted_median_threshold: 0,
4199 default_none_duration_for_new_keys: false,
4200 observations_chunk_size: None,
4201 },
4202 );
4203 }
4204 }
4205 79 => {
4206 if chain != Chain::Mainnet {
4207 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4208
4209 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4212
4213 cfg.feature_flags.consensus_batched_block_sync = true;
4214
4215 cfg.feature_flags.enable_nitro_attestation = true
4217 }
4218 cfg.feature_flags.normalize_ptb_arguments = true;
4219
4220 cfg.consensus_gc_depth = Some(60);
4221 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4222 }
4223 80 => {
4224 cfg.max_ptb_value_size = Some(1024 * 1024);
4225 }
4226 81 => {
4227 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4228 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4229 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4230 }
4231 82 => {
4232 cfg.feature_flags.max_ptb_value_size_v2 = true;
4233 }
4234 83 => {
4235 if chain == Chain::Mainnet {
4236 let aliased: [u8; 32] = Hex::decode(
4238 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4239 )
4240 .unwrap()
4241 .try_into()
4242 .unwrap();
4243
4244 cfg.aliased_addresses.push(AliasedAddress {
4246 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4247 aliased,
4248 allowed_tx_digests: vec![
4249 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4250 ],
4251 });
4252
4253 cfg.aliased_addresses.push(AliasedAddress {
4254 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4255 aliased,
4256 allowed_tx_digests: vec![
4257 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4258 ],
4259 });
4260 }
4261
4262 if chain != Chain::Mainnet {
4265 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4266 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4267
4268 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4270 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4271 cfg.feature_flags.per_object_congestion_control_mode =
4272 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4273 ExecutionTimeEstimateParams {
4274 target_utilization: 30,
4275 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4277 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4279 stored_observations_limit: u64::MAX,
4280 stake_weighted_median_threshold: 0,
4281 default_none_duration_for_new_keys: false,
4282 observations_chunk_size: None,
4283 },
4284 );
4285
4286 cfg.feature_flags.consensus_batched_block_sync = true;
4288
4289 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4292 cfg.feature_flags.enable_nitro_attestation = true;
4293 }
4294 }
4295 84 => {
4296 if chain == Chain::Mainnet {
4297 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4298 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4299
4300 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4302 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4303 cfg.feature_flags.per_object_congestion_control_mode =
4304 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4305 ExecutionTimeEstimateParams {
4306 target_utilization: 30,
4307 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4309 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4311 stored_observations_limit: u64::MAX,
4312 stake_weighted_median_threshold: 0,
4313 default_none_duration_for_new_keys: false,
4314 observations_chunk_size: None,
4315 },
4316 );
4317
4318 cfg.feature_flags.consensus_batched_block_sync = true;
4320
4321 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4324 cfg.feature_flags.enable_nitro_attestation = true;
4325 }
4326
4327 cfg.feature_flags.per_object_congestion_control_mode =
4329 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4330 ExecutionTimeEstimateParams {
4331 target_utilization: 30,
4332 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4334 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4336 stored_observations_limit: 20,
4337 stake_weighted_median_threshold: 0,
4338 default_none_duration_for_new_keys: false,
4339 observations_chunk_size: None,
4340 },
4341 );
4342 cfg.feature_flags.allow_unbounded_system_objects = true;
4343 }
4344 85 => {
4345 if chain != Chain::Mainnet && chain != Chain::Testnet {
4346 cfg.feature_flags.enable_party_transfer = true;
4347 }
4348
4349 cfg.feature_flags
4350 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4351 cfg.feature_flags.disallow_self_identifier = true;
4352 cfg.feature_flags.per_object_congestion_control_mode =
4353 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4354 ExecutionTimeEstimateParams {
4355 target_utilization: 50,
4356 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4358 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4360 stored_observations_limit: 20,
4361 stake_weighted_median_threshold: 0,
4362 default_none_duration_for_new_keys: false,
4363 observations_chunk_size: None,
4364 },
4365 );
4366 }
4367 86 => {
4368 cfg.feature_flags.type_tags_in_object_runtime = true;
4369 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4370
4371 cfg.feature_flags.per_object_congestion_control_mode =
4373 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4374 ExecutionTimeEstimateParams {
4375 target_utilization: 50,
4376 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4378 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4380 stored_observations_limit: 20,
4381 stake_weighted_median_threshold: 3334,
4382 default_none_duration_for_new_keys: false,
4383 observations_chunk_size: None,
4384 },
4385 );
4386 if chain != Chain::Mainnet {
4388 cfg.feature_flags.enable_party_transfer = true;
4389 }
4390 }
4391 87 => {
4392 if chain == Chain::Mainnet {
4393 cfg.feature_flags.record_time_estimate_processed = true;
4394 }
4395 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4396 }
4397 88 => {
4398 cfg.feature_flags.record_time_estimate_processed = true;
4399 cfg.tx_context_rgp_cost_base = Some(30);
4400 cfg.feature_flags
4401 .ignore_execution_time_observations_after_certs_closed = true;
4402
4403 cfg.feature_flags.per_object_congestion_control_mode =
4406 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4407 ExecutionTimeEstimateParams {
4408 target_utilization: 50,
4409 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4411 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4413 stored_observations_limit: 20,
4414 stake_weighted_median_threshold: 3334,
4415 default_none_duration_for_new_keys: true,
4416 observations_chunk_size: None,
4417 },
4418 );
4419 }
4420 89 => {
4421 cfg.feature_flags.dependency_linkage_error = true;
4422 cfg.feature_flags.additional_multisig_checks = true;
4423 }
4424 90 => {
4425 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4427 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4428 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4429 cfg.feature_flags.accept_passkey_in_multisig = true;
4430 cfg.feature_flags.passkey_auth = true;
4431 cfg.feature_flags.check_for_init_during_upgrade = true;
4432
4433 if chain != Chain::Mainnet {
4435 cfg.feature_flags.mysticeti_fastpath = true;
4436 }
4437 }
4438 91 => {
4439 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4440 }
4441 92 => {
4442 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4443 }
4444 93 => {
4445 cfg.feature_flags
4446 .consensus_checkpoint_signature_key_includes_digest = true;
4447 }
4448 94 => {
4449 cfg.feature_flags.per_object_congestion_control_mode =
4451 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4452 ExecutionTimeEstimateParams {
4453 target_utilization: 50,
4454 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4456 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4458 stored_observations_limit: 18,
4459 stake_weighted_median_threshold: 3334,
4460 default_none_duration_for_new_keys: true,
4461 observations_chunk_size: None,
4462 },
4463 );
4464
4465 cfg.feature_flags.enable_party_transfer = true;
4467 }
4468 95 => {
4469 cfg.type_name_id_base_cost = Some(52);
4470
4471 cfg.max_transactions_per_checkpoint = Some(20_000);
4473 }
4474 96 => {
4475 if chain != Chain::Mainnet && chain != Chain::Testnet {
4477 cfg.feature_flags
4478 .include_checkpoint_artifacts_digest_in_summary = true;
4479 }
4480 cfg.feature_flags.correct_gas_payment_limit_check = true;
4481 cfg.feature_flags.authority_capabilities_v2 = true;
4482 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4483 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4484 cfg.feature_flags.enable_coin_registry = true;
4485
4486 cfg.feature_flags.mysticeti_fastpath = true;
4488 }
4489 97 => {
4490 cfg.feature_flags.additional_borrow_checks = true;
4491 }
4492 98 => {
4493 cfg.event_emit_auth_stream_cost = Some(52);
4494 cfg.feature_flags.better_loader_errors = true;
4495 cfg.feature_flags.generate_df_type_layouts = true;
4496 }
4497 99 => {
4498 cfg.feature_flags.use_new_commit_handler = true;
4499 }
4500 100 => {
4501 cfg.feature_flags.private_generics_verifier_v2 = true;
4502 }
4503 101 => {
4504 cfg.feature_flags.create_root_accumulator_object = true;
4505 cfg.max_updates_per_settlement_txn = Some(100);
4506 if chain != Chain::Mainnet {
4507 cfg.feature_flags.enable_poseidon = true;
4508 }
4509 }
4510 102 => {
4511 cfg.feature_flags.per_object_congestion_control_mode =
4515 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4516 ExecutionTimeEstimateParams {
4517 target_utilization: 50,
4518 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4520 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4522 stored_observations_limit: 180,
4523 stake_weighted_median_threshold: 3334,
4524 default_none_duration_for_new_keys: true,
4525 observations_chunk_size: Some(18),
4526 },
4527 );
4528 cfg.feature_flags.deprecate_global_storage_ops = true;
4529 }
4530 103 => {}
4531 104 => {
4532 cfg.translation_per_command_base_charge = Some(1);
4533 cfg.translation_per_input_base_charge = Some(1);
4534 cfg.translation_pure_input_per_byte_charge = Some(1);
4535 cfg.translation_per_type_node_charge = Some(1);
4536 cfg.translation_per_reference_node_charge = Some(1);
4537 cfg.translation_per_linkage_entry_charge = Some(10);
4538 cfg.gas_model_version = Some(11);
4539 cfg.feature_flags.abstract_size_in_object_runtime = true;
4540 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4541 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4542 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4543 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4544 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4545 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4546 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4547 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4548 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4549 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4550 cfg.feature_flags.enable_ptb_execution_v2 = true;
4551
4552 cfg.poseidon_bn254_cost_base = Some(260);
4553
4554 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4555
4556 if chain != Chain::Mainnet {
4557 cfg.feature_flags
4558 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4559 }
4560
4561 cfg.feature_flags
4562 .include_cancelled_randomness_txns_in_prologue = true;
4563 }
4564 105 => {
4565 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4566 cfg.feature_flags.disable_preconsensus_locking = true;
4567
4568 if chain != Chain::Mainnet {
4569 cfg.feature_flags
4570 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4571 }
4572 }
4573 106 => {
4574 cfg.accumulator_object_storage_cost = Some(7600);
4576
4577 if chain != Chain::Mainnet && chain != Chain::Testnet {
4578 cfg.feature_flags.enable_accumulators = true;
4579 cfg.feature_flags.enable_address_balance_gas_payments = true;
4580 cfg.feature_flags.enable_authenticated_event_streams = true;
4581 cfg.feature_flags.enable_object_funds_withdraw = true;
4582 }
4583 }
4584 107 => {
4585 cfg.feature_flags
4586 .consensus_skip_gced_blocks_in_direct_finalization = true;
4587
4588 if in_integration_test() {
4590 cfg.consensus_gc_depth = Some(6);
4591 cfg.consensus_max_num_transactions_in_block = Some(8);
4592 }
4593 }
4594 108 => {
4595 cfg.feature_flags.gas_rounding_halve_digits = true;
4596 cfg.feature_flags.flexible_tx_context_positions = true;
4597 cfg.feature_flags.disable_entry_point_signature_check = true;
4598
4599 if chain != Chain::Mainnet {
4600 cfg.feature_flags.address_aliases = true;
4601
4602 cfg.feature_flags.enable_accumulators = true;
4603 cfg.feature_flags.enable_address_balance_gas_payments = true;
4604 }
4605
4606 cfg.feature_flags.enable_poseidon = true;
4607 }
4608 109 => {
4609 cfg.binary_variant_handles = Some(1024);
4610 cfg.binary_variant_instantiation_handles = Some(1024);
4611 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4612 }
4613 110 => {
4614 cfg.feature_flags
4615 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4616 cfg.feature_flags
4617 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4618 if chain != Chain::Mainnet && chain != Chain::Testnet {
4619 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4620 }
4621 cfg.feature_flags.validate_zklogin_public_identifier = true;
4622 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4623 cfg.feature_flags
4624 .consensus_always_accept_system_transactions = true;
4625 if chain != Chain::Mainnet {
4626 cfg.feature_flags.enable_object_funds_withdraw = true;
4627 }
4628 }
4629 111 => {
4630 cfg.feature_flags.validator_metadata_verify_v2 = true;
4631 }
4632 112 => {
4633 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4634 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4635 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4636 cfg.group_ops_ristretto_point_add_cost = Some(500);
4637 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4638 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4639 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4640 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4641 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4642 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4643
4644 if chain != Chain::Mainnet && chain != Chain::Testnet {
4645 cfg.feature_flags.enable_ristretto255_group_ops = true;
4646 }
4647 }
4648 113 => {
4649 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4650 if chain != Chain::Mainnet && chain != Chain::Testnet {
4651 cfg.feature_flags.defer_unpaid_amplification = true;
4652 }
4653 }
4654 114 => {
4655 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4656 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4657 if chain != Chain::Mainnet {
4658 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4659 cfg.feature_flags.enable_authenticated_event_streams = true;
4660 cfg.feature_flags
4661 .include_checkpoint_artifacts_digest_in_summary = true;
4662 }
4663 }
4664 115 => {
4665 cfg.feature_flags.normalize_depth_formula = true;
4666 }
4667 116 => {
4668 cfg.feature_flags.gasless_transaction_drop_safety = true;
4669 cfg.feature_flags.address_aliases = true;
4670 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4671 cfg.feature_flags.defer_unpaid_amplification = false;
4673 cfg.feature_flags.enable_display_registry = true;
4674 }
4675 117 => {}
4676 118 => {
4677 cfg.feature_flags.use_coin_party_owner = true;
4678 }
4679 119 => {
4680 cfg.execution_version = Some(4);
4682 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4683 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4684 if chain != Chain::Mainnet {
4685 cfg.feature_flags.enable_gasless = true;
4686 cfg.gasless_max_computation_units = Some(50_000);
4687 cfg.gasless_allowed_token_types = Some(vec![]);
4688 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4689 cfg.feature_flags
4690 .convert_withdrawal_compatibility_ptb_arguments = true;
4691 }
4692 cfg.gasless_max_unused_inputs = Some(1);
4693 cfg.gasless_max_pure_input_bytes = Some(32);
4694 if chain == Chain::Testnet {
4695 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4696 }
4697 cfg.transfer_receive_object_cost_per_byte = Some(1);
4698 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4699 }
4700 120 => {
4701 cfg.feature_flags.disallow_jump_orphans = true;
4702 }
4703 121 => {
4704 if chain != Chain::Mainnet {
4706 cfg.feature_flags.defer_unpaid_amplification = true;
4707 cfg.gasless_max_tps = Some(50);
4708 }
4709 cfg.feature_flags
4710 .early_return_receive_object_mismatched_type = true;
4711 }
4712 122 => {
4713 cfg.feature_flags.defer_unpaid_amplification = true;
4715 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4717 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4718 if chain != Chain::Mainnet && chain != Chain::Testnet {
4719 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4720 }
4721 cfg.feature_flags.gasless_verify_remaining_balance = true;
4722 cfg.include_special_package_amendments = match chain {
4723 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4724 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4725 Chain::Unknown => None,
4726 };
4727 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4728 cfg.gasless_max_tps = Some(300);
4729 cfg.gasless_max_computation_units = Some(5_000);
4730 }
4731 123 => {
4732 cfg.gas_model_version = Some(13);
4733 }
4734 124 => {
4735 if chain != Chain::Mainnet && chain != Chain::Testnet {
4736 cfg.feature_flags.timestamp_based_epoch_close = true;
4737 }
4738 cfg.gas_model_version = Some(14);
4739 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4740
4741 cfg.feature_flags.enable_accumulators = true;
4747 cfg.feature_flags.enable_address_balance_gas_payments = true;
4748 cfg.feature_flags.enable_authenticated_event_streams = true;
4749 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4750 cfg.feature_flags.enable_object_funds_withdraw = true;
4751 cfg.feature_flags
4752 .convert_withdrawal_compatibility_ptb_arguments = true;
4753 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4754 cfg.feature_flags
4755 .include_checkpoint_artifacts_digest_in_summary = true;
4756 cfg.feature_flags.enable_gasless = true;
4757
4758 if chain == Chain::Mainnet {
4763 cfg.gasless_allowed_token_types = Some(vec![
4764 (MAINNET_USDC.to_string(), 10_000),
4765 (MAINNET_USDSUI.to_string(), 10_000),
4766 (MAINNET_SUI_USDE.to_string(), 10_000),
4767 (MAINNET_USDY.to_string(), 10_000),
4768 (MAINNET_FDUSD.to_string(), 10_000),
4769 (MAINNET_AUSD.to_string(), 10_000),
4770 (MAINNET_USDB.to_string(), 10_000),
4771 ]);
4772 }
4773 }
4774 125 => {
4775 cfg.feature_flags.granular_post_execution_checks = true;
4776 if chain != Chain::Mainnet {
4777 cfg.feature_flags.timestamp_based_epoch_close = true;
4778 }
4779 }
4780 126 => {
4781 cfg.feature_flags.early_exit_on_iffw = true;
4782 }
4783 127 => {
4784 cfg.feature_flags.always_advance_dkg_to_resolution = true;
4785
4786 cfg.verify_bulletproofs_ristretto255_base_cost = Some(23866);
4787 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(1324);
4788 cfg.group_ops_ristretto_decode_scalar_cost = Some(5);
4789 cfg.group_ops_ristretto_decode_point_cost = Some(216);
4790 cfg.group_ops_ristretto_scalar_add_cost = Some(2);
4791 cfg.group_ops_ristretto_point_add_cost = Some(8);
4792 cfg.group_ops_ristretto_scalar_sub_cost = Some(2);
4793 cfg.group_ops_ristretto_point_sub_cost = Some(8);
4794 cfg.group_ops_ristretto_scalar_mul_cost = Some(5);
4795 cfg.group_ops_ristretto_point_mul_cost = Some(1763);
4796 cfg.group_ops_ristretto_scalar_div_cost = Some(557);
4797 cfg.group_ops_ristretto_point_div_cost = Some(2244);
4798
4799 if chain != Chain::Mainnet {
4800 cfg.feature_flags.enable_ristretto255_group_ops = true;
4801 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4802 }
4803
4804 cfg.feature_flags.timestamp_based_epoch_close = true;
4805 }
4806 128 => {
4807 cfg.max_generic_instantiation_type_nodes_per_function = Some(10_000);
4808 cfg.max_generic_instantiation_type_nodes_per_module = Some(500_000);
4809 cfg.binary_enum_defs = Some(200);
4810 cfg.binary_enum_def_instantiations = Some(100);
4811 }
4812 129 => {
4813 cfg.feature_flags.enable_unified_linkage = true;
4814 }
4815 130 => {
4816 cfg.feature_flags.record_net_unsettled_object_withdraws = true;
4817 cfg.feature_flags.enable_init_on_upgrade = true;
4818 cfg.epoch_close_deadline_ms = Some(120_000);
4819 cfg.scratch_add_cost_base = Some(13);
4820 cfg.scratch_read_cost_base = Some(13);
4821 cfg.scratch_read_value_cost = Some(1);
4822 cfg.scratch_remove_cost_base = Some(13);
4823 cfg.scratch_exists_cost_base = Some(13);
4824 cfg.scratch_exists_with_type_cost_base = Some(13);
4825 cfg.scratch_exists_with_type_type_cost = Some(1);
4826 let max_commands = cfg.max_programmable_tx_commands() as u64;
4827 cfg.max_scratch_pad_size = Some(16 * max_commands);
4828 if chain != Chain::Mainnet && chain != Chain::Testnet {
4830 cfg.feature_flags.zklogin_circuit_mode = 1;
4831 }
4832 }
4833 131 => {
4834 cfg.feature_flags.share_transaction_deny_config_in_consensus = true;
4835 cfg.feature_flags.framework_tx_context_mut_restrictions = true;
4836 }
4837 132 => {
4838 if chain != Chain::Mainnet && chain != Chain::Testnet {
4839 cfg.feature_flags.defer_owned_object_double_spend = true;
4840 cfg.feature_flags.create_forwarding_address_registry = true;
4841 }
4842 cfg.object_record_new_uid_from_hash_cost_base = Some(1);
4843 cfg.feature_flags
4844 .enable_order_independent_upgrade_init_linkage = true;
4845 }
4846 133 => {
4847 cfg.feature_flags
4848 .include_function_signatures_in_instantiation_limits = true;
4849 cfg.max_accumulator_type_nodes = Some(16);
4850 }
4851 134 => {
4852 if chain != Chain::Mainnet {
4859 cfg.package_original_package_id_impl_cost_base = Some(52);
4860 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4861 cfg.package_original_package_id_impl_cost_per_byte =
4862 Some(package_read_cost_per_byte);
4863
4864 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4865 cfg.consensus_max_num_transactions_in_block = Some(128);
4866 }
4867
4868 if chain == Chain::Mainnet {
4869 cfg.feature_flags.defer_unpaid_amplification = false;
4870 }
4871 }
4872 135 => {
4873 cfg.package_original_package_id_impl_cost_base = Some(52);
4876 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4877 cfg.package_original_package_id_impl_cost_per_byte =
4878 Some(package_read_cost_per_byte);
4879
4880 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4881 cfg.consensus_max_num_transactions_in_block = Some(128);
4882
4883 cfg.feature_flags.defer_unpaid_amplification = false;
4884 }
4885 136 => {
4886 cfg.feature_flags.ptb_tx_context_restrictions = true;
4887
4888 cfg.translation_per_live_reference_charge = Some(1);
4889 cfg.max_ptb_live_references = Some(64);
4890 cfg.max_ptb_returned_references = Some(16);
4891 cfg.max_ptb_total_returned_references = Some(256);
4892
4893 if chain != Chain::Mainnet && chain != Chain::Testnet {
4894 cfg.feature_flags.allowed_proposers = true;
4895 }
4896 cfg.feature_flags.harden_linkage_consistency = true;
4897
4898 cfg.package_arena_size_in_bytes = Some(10_000_000);
4899 }
4900 137 => {
4901 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(621);
4902 cfg.max_bulletproofs_total_bits = Some(1024);
4903
4904 if chain != Chain::Mainnet {
4905 cfg.feature_flags.enable_allowances = true;
4906 }
4907 cfg.feature_flags.fix_ptb_generated_reads = true;
4908 cfg.feature_flags.charge_ld_const_abstract_size = true;
4909 if chain != Chain::Mainnet && chain != Chain::Testnet {
4910 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4911 }
4912 cfg.reserve_object_funds_for_withdrawal_cost_base = Some(52);
4913 cfg.reserve_object_funds_for_withdrawal_cold_read_cost = Some(184);
4916
4917 cfg.feature_flags.allowed_proposers = true;
4918
4919 cfg.feature_flags.validate_ptb_argument_indices = true;
4920 cfg.feature_flags.memory_safety_invariant_check_v2 = true;
4921 }
4922 138 => {
4923 cfg.gas_model_version = Some(15);
4924 cfg.feature_flags.enable_allowances = true;
4925 if chain != Chain::Mainnet {
4926 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4927 cfg.feature_flags.disable_effects_tx_dependencies = true;
4928 }
4929 cfg.feature_flags.merge_colliding_deferrals = true;
4930 if chain == Chain::Mainnet {
4932 cfg.storage_rebate_rate = Some(9999);
4933 }
4934 }
4935 139 => {
4936 if chain != Chain::Mainnet && chain != Chain::Testnet {
4937 cfg.feature_flags.enable_forwarding_addresses = true;
4938 cfg.feature_flags.mldsa65_auth = true;
4939 }
4940 cfg.storage_rebate_rate = Some(9999);
4941 if chain != Chain::Mainnet {
4942 cfg.feature_flags.allow_dkg_completion_after_timeout = true;
4943 }
4944 cfg.obj_access_cost_read_per_package_kb = Some(154);
4946 }
4947 140 => {
4948 cfg.staggered_submission_signal_window_commits = Some(300);
4951 cfg.staggered_submission_signal_min_excess_copies_per_commit = Some(2);
4952 cfg.staggered_submission_signal_exit_dwell_commits = Some(6000);
4953 cfg.staggered_submission_signal_band1_enter_ratio_bps = Some(1000);
4954 cfg.staggered_submission_signal_band1_exit_ratio_bps = Some(500);
4955 cfg.staggered_submission_signal_band2_enter_ratio_bps = Some(5000);
4956 cfg.staggered_submission_signal_band2_exit_ratio_bps = Some(2500);
4957
4958 cfg.vector_reverse_base_cost = Some(52);
4959 cfg.vector_reverse_per_elem_cost = Some(8);
4960 cfg.vector_keep_range_base_cost = Some(52);
4961 cfg.vector_keep_range_per_dropped_elem_cost = Some(1);
4962 cfg.vector_keep_range_per_moved_elem_cost = Some(8);
4963 cfg.vector_copy_range_base_cost = Some(52);
4964 cfg.vector_replace_range_base_cost = Some(52);
4965 cfg.vector_replace_range_per_elem_cost = Some(8);
4966
4967 if chain != Chain::Mainnet && chain != Chain::Testnet {
4968 cfg.feature_flags.shuffle_consensus_commit_blocks = true;
4969 }
4970
4971 cfg.feature_flags.allow_references_in_ptbs = true;
4972 cfg.feature_flags.disable_id_leak_verifier = true;
4973 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4974 cfg.feature_flags.disable_effects_tx_dependencies = true;
4975 }
4976 141 => {
4977 cfg.clock_borrow_cost_base = Some(52);
4978 cfg.feature_flags.check_groth16_pvk_length = true;
4979 cfg.object_is_shared_input_cost_base = Some(52);
4980 cfg.feature_flags.secp256r1_ecrecover_checks_x_below_p = true;
4981 cfg.binary_format_limits_profile = Some(BinaryFormatLimitsProfile::V1);
4982 }
4983 _ => panic!("unsupported version {:?}", version),
4994 }
4995 }
4996
4997 cfg
4998 }
4999
5000 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
5001 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
5002 || !self.feature_flags.split_checkpoints_in_consensus_handler
5003 {
5004 return;
5005 }
5006
5007 if !mysten_common::in_test_configuration() {
5008 return;
5009 }
5010
5011 use rand::{Rng, SeedableRng, rngs::StdRng};
5012 let mut rng = StdRng::from_seed(*seed);
5013 let max_txns = rng.gen_range(10..=100u64);
5014 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
5015 self.max_transactions_per_checkpoint = Some(max_txns);
5016 }
5017
5018 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
5024 let (
5025 max_back_edges_per_function,
5026 max_back_edges_per_module,
5027 sanity_check_with_regex_reference_safety,
5028 ) = if let Some((
5029 max_back_edges_per_function,
5030 max_back_edges_per_module,
5031 sanity_check_with_regex_reference_safety,
5032 )) = signing_limits
5033 {
5034 (
5035 Some(max_back_edges_per_function),
5036 Some(max_back_edges_per_module),
5037 Some(sanity_check_with_regex_reference_safety),
5038 )
5039 } else {
5040 (None, None, None)
5041 };
5042
5043 let additional_borrow_checks = if signing_limits.is_some() {
5044 true
5046 } else {
5047 self.additional_borrow_checks()
5048 };
5049 let deprecate_global_storage_ops = if signing_limits.is_some() {
5050 true
5052 } else {
5053 self.deprecate_global_storage_ops()
5054 };
5055
5056 VerifierConfig {
5057 max_loop_depth: Some(self.max_loop_depth() as usize),
5058 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5059 max_function_parameters: Some(self.max_function_parameters() as usize),
5060 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5061 max_value_stack_size: self.max_value_stack_size() as usize,
5062 max_type_nodes: Some(self.max_type_nodes() as usize),
5063 max_generic_instantiation_type_nodes_per_function: self
5064 .max_generic_instantiation_type_nodes_per_function_as_option()
5065 .map(|v| v as usize),
5066 max_generic_instantiation_type_nodes_per_module: self
5067 .max_generic_instantiation_type_nodes_per_module_as_option()
5068 .map(|v| v as usize),
5069 include_function_signatures_in_instantiation_limits: self
5070 .include_function_signatures_in_instantiation_limits(),
5071 max_push_size: Some(self.max_push_size() as usize),
5072 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5073 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5074 max_function_definitions: Some(self.max_function_definitions() as usize),
5075 max_data_definitions: Some(self.max_struct_definitions() as usize),
5076 max_constant_vector_len: Some(self.max_move_vector_len()),
5077 max_back_edges_per_function,
5078 max_back_edges_per_module,
5079 max_basic_blocks_in_script: None,
5080 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5082 allow_receiving_object_id: self.allow_receiving_object_id(),
5083 reject_mutable_random_on_entry_functions: self
5084 .reject_mutable_random_on_entry_functions(),
5085 bytecode_version: self.move_binary_format_version(),
5086 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5087 additional_borrow_checks,
5088 better_loader_errors: self.better_loader_errors(),
5089 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5090 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5091 .map(|limit| limit as u128),
5092 deprecate_global_storage_ops,
5093 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5094 disable_id_leak_verifier: self.disable_id_leak_verifier(),
5095 switch_to_regex_reference_safety: false,
5096 framework_tx_context_mut_restrictions: self.framework_tx_context_mut_restrictions(),
5097 disallow_jump_orphans: self.disallow_jump_orphans(),
5098 }
5099 }
5100
5101 pub fn binary_config(
5102 &self,
5103 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5104 ) -> BinaryConfig {
5105 let deprecate_global_storage_ops =
5106 override_deprecate_global_storage_ops_during_deserialization
5107 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5108 BinaryConfig::new(
5109 self.move_binary_format_version(),
5110 self.min_move_binary_format_version_as_option()
5111 .unwrap_or(VERSION_1),
5112 self.no_extraneous_module_bytes(),
5113 deprecate_global_storage_ops,
5114 TableConfig {
5115 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5116 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5117 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5118 function_instantiations: self
5119 .binary_function_instantiations_as_option()
5120 .unwrap_or(u16::MAX),
5121 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5122 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5123 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5124 address_identifiers: self
5125 .binary_address_identifiers_as_option()
5126 .unwrap_or(u16::MAX),
5127 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5128 struct_def_instantiations: self
5129 .binary_struct_def_instantiations_as_option()
5130 .unwrap_or(u16::MAX),
5131 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5132 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5133 field_instantiations: self
5134 .binary_field_instantiations_as_option()
5135 .unwrap_or(u16::MAX),
5136 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5137 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5138 enum_def_instantiations: self
5139 .binary_enum_def_instantiations_as_option()
5140 .unwrap_or(u16::MAX),
5141 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5142 variant_instantiation_handles: self
5143 .binary_variant_instantiation_handles_as_option()
5144 .unwrap_or(u16::MAX),
5145 },
5146 self.binary_format_limits(),
5147 )
5148 }
5149
5150 pub fn binary_format_limits(
5151 &self,
5152 ) -> &'static move_binary_format::binary_config::BinaryFormatLimits {
5153 self.binary_format_limits_profile
5154 .unwrap_or(BinaryFormatLimitsProfile::LEGACY)
5155 .limits()
5156 }
5157
5158 pub fn apply_overrides_for_testing(
5162 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5163 ) -> OverrideGuard {
5164 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5165 assert!(cur.is_none(), "config override already present");
5166 *cur = Some(Box::new(override_fn));
5167 OverrideGuard
5168 }
5169
5170 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5171 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5172 warn!(
5173 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5174 );
5175 ret = override_fn(version, ret);
5176 }
5177 ret
5178 }
5179}
5180
5181impl ProtocolConfig {
5185 pub fn set_execution_version_for_testing(&mut self, val: u64) {
5189 let current = self.execution_version.unwrap_or(0);
5190 assert!(
5191 val >= current,
5192 "cannot downgrade execution_version from {current} to {val}: running an old \
5193 executor against a newer protocol config/framework is unsupported. To test \
5194 frozen executor behavior, start from the last protocol version of that executor \
5195 instead, so genesis loads the matching framework snapshot (see \
5196 test_address_balance_gas_v3_accumulator_sign)."
5197 );
5198 self.execution_version = Some(val);
5199 }
5200
5201 pub fn set_zklogin_circuit_mode_for_testing(&mut self, val: u64) {
5204 self.feature_flags.zklogin_circuit_mode = val
5205 }
5206
5207 pub fn set_per_object_congestion_control_mode_for_testing(
5208 &mut self,
5209 val: PerObjectCongestionControlMode,
5210 ) {
5211 self.feature_flags.per_object_congestion_control_mode = val;
5212 }
5213
5214 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5215 self.feature_flags.consensus_choice = val;
5216 }
5217
5218 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5219 self.feature_flags.consensus_network = val;
5220 }
5221
5222 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5223 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5224 }
5225
5226 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5227 self.feature_flags.mysticeti_num_leaders_per_round = val;
5228 }
5229
5230 pub fn disable_accumulators_for_testing(&mut self) {
5231 self.feature_flags.enable_accumulators = false;
5232 self.feature_flags.enable_address_balance_gas_payments = false;
5233 }
5234
5235 pub fn enable_coin_reservation_for_testing(&mut self) {
5236 self.feature_flags.enable_coin_reservation_obj_refs = true;
5237 self.feature_flags
5238 .convert_withdrawal_compatibility_ptb_arguments = true;
5239 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5242 }
5243
5244 pub fn disable_coin_reservation_for_testing(&mut self) {
5245 self.feature_flags.enable_coin_reservation_obj_refs = false;
5246 self.feature_flags
5247 .convert_withdrawal_compatibility_ptb_arguments = false;
5248 }
5249
5250 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5251 self.feature_flags.enable_accumulators = true;
5252 self.feature_flags.allow_private_accumulator_entrypoints = true;
5253 self.feature_flags.enable_address_balance_gas_payments = true;
5254 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5255 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5256 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5257 }
5258
5259 pub fn enable_gasless_for_testing(&mut self) {
5260 self.enable_address_balance_gas_payments_for_testing();
5261 self.feature_flags.enable_gasless = true;
5262 self.feature_flags.gasless_verify_remaining_balance = true;
5263 self.gasless_max_computation_units = Some(5_000);
5264 self.gasless_allowed_token_types = Some(vec![]);
5265 self.gasless_max_tps = Some(1000);
5266 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5267 }
5268
5269 pub fn disable_gasless_for_testing(&mut self) {
5270 self.feature_flags.enable_gasless = false;
5271 self.gasless_max_computation_units = None;
5272 self.gasless_allowed_token_types = None;
5273 }
5274
5275 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5276 self.feature_flags.enable_accumulators = true;
5277 self.feature_flags.enable_authenticated_event_streams = true;
5278 self.feature_flags
5279 .include_checkpoint_artifacts_digest_in_summary = true;
5280 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5281 }
5282}
5283
5284type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5285
5286static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5287
5288#[must_use]
5289pub struct OverrideGuard;
5290
5291impl Drop for OverrideGuard {
5292 fn drop(&mut self) {
5293 info!("restoring override fn");
5294 *CONFIG_OVERRIDE.lock().unwrap() = None;
5295 }
5296}
5297
5298#[derive(PartialEq, Eq)]
5301pub enum LimitThresholdCrossed {
5302 None,
5303 Soft(u128, u128),
5304 Hard(u128, u128),
5305}
5306
5307pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5310 x: T,
5311 soft_limit: U,
5312 hard_limit: V,
5313) -> LimitThresholdCrossed {
5314 let x: V = x.into();
5315 let soft_limit: V = soft_limit.into();
5316
5317 debug_assert!(soft_limit <= hard_limit);
5318
5319 if x >= hard_limit {
5322 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5323 } else if x < soft_limit {
5324 LimitThresholdCrossed::None
5325 } else {
5326 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5327 }
5328}
5329
5330#[macro_export]
5331macro_rules! check_limit {
5332 ($x:expr, $hard:expr) => {
5333 check_limit!($x, $hard, $hard)
5334 };
5335 ($x:expr, $soft:expr, $hard:expr) => {
5336 check_limit_in_range($x as u64, $soft, $hard)
5337 };
5338}
5339
5340#[macro_export]
5344macro_rules! check_limit_by_meter {
5345 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5346 let (h, metered_str) = if $is_metered {
5348 ($metered_limit, "metered")
5349 } else {
5350 ($unmetered_hard_limit, "unmetered")
5352 };
5353 use sui_protocol_config::check_limit_in_range;
5354 let result = check_limit_in_range($x as u64, $metered_limit, h);
5355 match result {
5356 LimitThresholdCrossed::None => {}
5357 LimitThresholdCrossed::Soft(_, _) => {
5358 $metric.with_label_values(&[metered_str, "soft"]).inc();
5359 }
5360 LimitThresholdCrossed::Hard(_, _) => {
5361 $metric.with_label_values(&[metered_str, "hard"]).inc();
5362 }
5363 };
5364 result
5365 }};
5366}
5367
5368pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5371
5372static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5373 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5374
5375static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5376 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5377
5378fn parse_amendments(json: &str) -> Arc<Amendments> {
5379 #[derive(serde::Deserialize)]
5380 struct AmendmentEntry {
5381 root: String,
5382 deps: Vec<DepEntry>,
5383 }
5384
5385 #[derive(serde::Deserialize)]
5386 struct DepEntry {
5387 original_id: String,
5388 version_id: String,
5389 }
5390
5391 let entries: Vec<AmendmentEntry> =
5392 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5393 let mut amendments = BTreeMap::new();
5394 for entry in entries {
5395 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5396 let mut dep_ids = BTreeMap::new();
5397 for dep in entry.deps {
5398 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5399 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5400 assert!(
5401 dep_ids.insert(orig_id, upgraded_id).is_none(),
5402 "Duplicate original ID in amendments table"
5403 );
5404 }
5405 assert!(
5406 amendments.insert(root_id, dep_ids).is_none(),
5407 "Duplicate root ID in amendments table"
5408 );
5409 }
5410 Arc::new(amendments)
5411}
5412
5413#[cfg(all(test, not(msim)))]
5414mod test {
5415 use insta::assert_yaml_snapshot;
5416
5417 use super::*;
5418
5419 #[test]
5420 fn snapshot_tests() {
5421 println!("\n============================================================================");
5422 println!("! !");
5423 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5424 println!("! !");
5425 println!("============================================================================\n");
5426 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5427 let chain_str = match chain_id {
5431 Chain::Unknown => "".to_string(),
5432 _ => format!("{:?}_", chain_id),
5433 };
5434 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5435 let cur = ProtocolVersion::new(i);
5436 assert_yaml_snapshot!(
5437 format!("{}version_{}", chain_str, cur.as_u64()),
5438 ProtocolConfig::get_for_version(cur, *chain_id)
5439 );
5440 }
5441 }
5442 }
5443
5444 #[test]
5445 fn binary_format_limits_profile_matches_protocol_version() {
5446 let v140 = ProtocolConfig::get_for_version(ProtocolVersion::new(140), Chain::Unknown);
5447 assert_eq!(
5448 v140.binary_format_limits(),
5449 BinaryFormatLimitsProfile::LEGACY.limits()
5450 );
5451
5452 let v141 = ProtocolConfig::get_for_version(ProtocolVersion::new(141), Chain::Unknown);
5453 assert_eq!(
5454 v141.binary_format_limits(),
5455 BinaryFormatLimitsProfile::V1.limits()
5456 );
5457 }
5458
5459 #[test]
5460 fn test_getters() {
5461 let prot: ProtocolConfig =
5462 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5463 assert_eq!(
5464 prot.max_arguments(),
5465 prot.max_arguments_as_option().unwrap()
5466 );
5467 }
5468
5469 #[test]
5470 fn vector_bulk_native_gas_costs_start_at_version_140() {
5471 for chain in [Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5472 let before = ProtocolConfig::get_for_version(ProtocolVersion::new(139), chain);
5473 assert_eq!(before.vector_reverse_base_cost_as_option(), None);
5474 assert_eq!(before.vector_reverse_per_elem_cost_as_option(), None);
5475 assert_eq!(before.vector_keep_range_base_cost_as_option(), None);
5476 assert_eq!(
5477 before.vector_keep_range_per_dropped_elem_cost_as_option(),
5478 None
5479 );
5480 assert_eq!(
5481 before.vector_keep_range_per_moved_elem_cost_as_option(),
5482 None
5483 );
5484 assert_eq!(before.vector_copy_range_base_cost_as_option(), None);
5485 assert_eq!(before.vector_replace_range_base_cost_as_option(), None);
5486 assert_eq!(before.vector_replace_range_per_elem_cost_as_option(), None);
5487
5488 let active = ProtocolConfig::get_for_version(ProtocolVersion::new(140), chain);
5489 assert_eq!(active.vector_reverse_base_cost_as_option(), Some(52));
5490 assert_eq!(active.vector_reverse_per_elem_cost_as_option(), Some(8));
5491 assert_eq!(active.vector_keep_range_base_cost_as_option(), Some(52));
5492 assert_eq!(
5493 active.vector_keep_range_per_dropped_elem_cost_as_option(),
5494 Some(1)
5495 );
5496 assert_eq!(
5497 active.vector_keep_range_per_moved_elem_cost_as_option(),
5498 Some(8)
5499 );
5500 assert_eq!(active.vector_copy_range_base_cost_as_option(), Some(52));
5501 assert_eq!(active.vector_replace_range_base_cost_as_option(), Some(52));
5502 assert_eq!(
5503 active.vector_replace_range_per_elem_cost_as_option(),
5504 Some(8)
5505 );
5506 }
5507 }
5508
5509 #[test]
5510 fn test_setters() {
5511 let mut prot: ProtocolConfig =
5512 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5513 prot.set_max_arguments_for_testing(123);
5514 assert_eq!(prot.max_arguments(), 123);
5515
5516 prot.set_max_arguments_from_str_for_testing("321".to_string());
5517 assert_eq!(prot.max_arguments(), 321);
5518
5519 prot.disable_max_arguments_for_testing();
5520 assert_eq!(prot.max_arguments_as_option(), None);
5521
5522 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5523 assert_eq!(prot.max_arguments(), 456);
5524 }
5525
5526 #[test]
5527 fn test_execution_version_setter_allows_upgrade() {
5528 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5529 let current = prot.execution_version();
5530 prot.set_execution_version_for_testing(current);
5531 prot.set_execution_version_for_testing(current + 1);
5532 assert_eq!(prot.execution_version(), current + 1);
5533 }
5534
5535 #[test]
5536 #[should_panic(expected = "cannot downgrade execution_version")]
5537 fn test_execution_version_setter_panics_on_downgrade() {
5538 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5539 let current = prot.execution_version();
5540 prot.set_execution_version_for_testing(current - 1);
5541 }
5542
5543 #[test]
5544 fn test_feature_flag_setter_by_string() {
5545 let mut prot: ProtocolConfig =
5546 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5547 assert!(!prot.zklogin_auth());
5548 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), true);
5549 assert!(prot.zklogin_auth());
5550 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), false);
5551 assert!(!prot.zklogin_auth());
5552 }
5553
5554 #[test]
5555 #[should_panic(expected = "unknown feature flag")]
5556 fn test_feature_flag_setter_unknown_flag() {
5557 let mut prot: ProtocolConfig =
5558 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5559 prot.set_feature_flag_for_testing("some random string".to_string(), true);
5560 }
5561
5562 #[test]
5563 fn test_get_for_version_if_supported_applies_test_overrides() {
5564 let before =
5565 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5566 .unwrap();
5567
5568 assert!(!before.enable_coin_reservation_obj_refs());
5569
5570 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5571 cfg.enable_coin_reservation_for_testing();
5572 cfg
5573 });
5574
5575 let after =
5576 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5577 .unwrap();
5578
5579 assert!(after.enable_coin_reservation_obj_refs());
5580 }
5581
5582 #[test]
5583 #[should_panic(expected = "unsupported version")]
5584 fn max_version_test() {
5585 let _ = ProtocolConfig::get_for_version_impl(
5588 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5589 Chain::Unknown,
5590 );
5591 }
5592
5593 #[test]
5594 fn lookup_by_string_test() {
5595 let prot: ProtocolConfig =
5596 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5597 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5599
5600 assert!(
5601 prot.lookup_attr("max_arguments".to_string())
5602 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5603 );
5604
5605 assert!(
5607 prot.lookup_attr("max_move_identifier_len".to_string())
5608 .is_none()
5609 );
5610
5611 let prot: ProtocolConfig =
5613 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5614 assert!(
5615 prot.lookup_attr("max_move_identifier_len".to_string())
5616 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5617 );
5618
5619 let prot: ProtocolConfig =
5620 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5621 assert!(
5623 prot.attr_map()
5624 .get("max_move_identifier_len")
5625 .unwrap()
5626 .is_none()
5627 );
5628 assert!(
5630 prot.attr_map().get("max_arguments").unwrap()
5631 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5632 );
5633
5634 let prot: ProtocolConfig =
5636 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5637 assert!(
5639 prot.feature_flags
5640 .lookup_attr("some random string".to_owned())
5641 .is_none()
5642 );
5643 assert!(
5644 !prot
5645 .feature_flags
5646 .attr_map()
5647 .contains_key("some random string")
5648 );
5649
5650 assert!(
5652 prot.feature_flags
5653 .lookup_attr("package_upgrades".to_owned())
5654 == Some(false)
5655 );
5656 assert!(
5657 prot.feature_flags
5658 .attr_map()
5659 .get("package_upgrades")
5660 .unwrap()
5661 == &false
5662 );
5663 let prot: ProtocolConfig =
5664 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5665 assert!(
5667 prot.feature_flags
5668 .lookup_attr("package_upgrades".to_owned())
5669 == Some(true)
5670 );
5671 assert!(
5672 prot.feature_flags
5673 .attr_map()
5674 .get("package_upgrades")
5675 .unwrap()
5676 == &true
5677 );
5678 }
5679
5680 #[test]
5681 fn limit_range_fn_test() {
5682 let low = 100u32;
5683 let high = 10000u64;
5684
5685 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5686 assert!(matches!(
5687 check_limit!(255u16, low, high),
5688 LimitThresholdCrossed::Soft(255u128, 100)
5689 ));
5690 assert!(matches!(
5696 check_limit!(2550000u64, low, high),
5697 LimitThresholdCrossed::Hard(2550000, 10000)
5698 ));
5699
5700 assert!(matches!(
5701 check_limit!(2550000u64, high, high),
5702 LimitThresholdCrossed::Hard(2550000, 10000)
5703 ));
5704
5705 assert!(matches!(
5706 check_limit!(1u8, high),
5707 LimitThresholdCrossed::None
5708 ));
5709
5710 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5711
5712 assert!(matches!(
5713 check_limit!(2550000u64, high),
5714 LimitThresholdCrossed::Hard(2550000, 10000)
5715 ));
5716 }
5717
5718 #[test]
5719 fn linkage_amendments_load() {
5720 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5721 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5722 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5723 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5724 }
5725
5726 #[test]
5727 fn render_scalar_fields_use_precision_safe_encoding() {
5728 use mysten_common::rpc_format::Unmetered;
5729
5730 let config = ProtocolConfig::get_for_max_version_UNSAFE();
5731 let rendered = config
5732 .render::<serde_json::Value>(&mut Unmetered)
5733 .expect("render should succeed");
5734
5735 let max_args = rendered
5736 .get("max_arguments")
5737 .expect("max_arguments set at max version");
5738 assert!(
5739 max_args.is_number(),
5740 "u32 should render as number, got {max_args:?}",
5741 );
5742
5743 let max_tx_size = rendered
5744 .get("max_tx_size_bytes")
5745 .expect("max_tx_size_bytes set at max version");
5746 assert!(
5747 max_tx_size.is_string(),
5748 "u64 should render as string, got {max_tx_size:?}",
5749 );
5750 }
5751
5752 #[test]
5753 fn render_includes_non_scalar_gasless_allowlist_as_json() {
5754 use mysten_common::rpc_format::Unmetered;
5755 use serde_json::json;
5756
5757 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5758 config.set_gasless_allowed_token_types_for_testing(vec![
5759 ("0xa::usdc::USDC".to_string(), 10_000),
5760 ("0xb::usdt::USDT".to_string(), 0),
5761 ]);
5762
5763 let rendered = config
5764 .render::<serde_json::Value>(&mut Unmetered)
5765 .expect("render should succeed under Unmetered budget");
5766 let allowlist = rendered
5767 .get("gasless_allowed_token_types")
5768 .expect("entry should be present after the testing setter");
5769
5770 assert_eq!(
5773 allowlist,
5774 &json!([["0xa::usdc::USDC", "10000"], ["0xb::usdt::USDT", "0"],]),
5775 );
5776 }
5777
5778 #[test]
5779 fn render_targets_prost_value_for_grpc() {
5780 use mysten_common::rpc_format::Unmetered;
5781 use prost_types::value::Kind;
5782
5783 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5784 config.set_gasless_allowed_token_types_for_testing(vec![(
5785 "0xa::usdc::USDC".to_string(),
5786 10_000,
5787 )]);
5788
5789 let rendered = config
5790 .render::<prost_types::Value>(&mut Unmetered)
5791 .expect("render to prost Value should succeed");
5792 let allowlist = rendered
5793 .get("gasless_allowed_token_types")
5794 .expect("entry should be present after the testing setter");
5795
5796 let Some(Kind::ListValue(outer)) = &allowlist.kind else {
5798 panic!(
5799 "expected ListValue at the top level, got {:?}",
5800 allowlist.kind
5801 );
5802 };
5803 assert_eq!(outer.values.len(), 1, "one allowlisted entry");
5804 let Some(Kind::ListValue(entry)) = &outer.values[0].kind else {
5805 panic!("expected each entry to be a ListValue");
5806 };
5807 assert_eq!(entry.values.len(), 2, "entry has (coin_type, amount)");
5808
5809 let Some(Kind::StringValue(coin_type)) = &entry.values[0].kind else {
5810 panic!("expected coin_type as StringValue");
5811 };
5812 assert_eq!(coin_type, "0xa::usdc::USDC");
5813
5814 let Some(Kind::StringValue(amount)) = &entry.values[1].kind else {
5816 panic!(
5817 "expected minimum_transfer_amount as StringValue (precision-safe u64); got {:?}",
5818 entry.values[1].kind,
5819 );
5820 };
5821 assert_eq!(amount, "10000");
5822 }
5823
5824 #[test]
5825 fn render_emits_null_for_unset_protocol_versions() {
5826 use mysten_common::rpc_format::Unmetered;
5827
5828 let config = ProtocolConfig::get_for_version(1.into(), Chain::Unknown);
5829 let rendered = config
5830 .render::<serde_json::Value>(&mut Unmetered)
5831 .expect("render should succeed");
5832 let entry = rendered
5836 .get("gasless_allowed_token_types")
5837 .expect("key should be present for every protocol version");
5838 assert!(
5839 entry.is_null(),
5840 "value should be null for pre-feature protocol version, got {entry:?}",
5841 );
5842 }
5843}