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 = 143;
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)]
441pub struct ProtocolVersion(u64);
442
443impl ProtocolVersion {
444 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
449
450 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
451
452 #[cfg(not(msim))]
453 pub const MAX_ALLOWED: Self = Self::MAX;
454
455 #[cfg(msim)]
457 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
458
459 pub fn new(v: u64) -> Self {
460 Self(v)
461 }
462
463 pub const fn as_u64(&self) -> u64 {
464 self.0
465 }
466
467 pub fn max() -> Self {
470 Self::MAX
471 }
472
473 pub fn prev(self) -> Self {
474 Self(self.0.checked_sub(1).unwrap())
475 }
476}
477
478impl From<u64> for ProtocolVersion {
479 fn from(v: u64) -> Self {
480 Self::new(v)
481 }
482}
483
484impl std::ops::Sub<u64> for ProtocolVersion {
485 type Output = Self;
486 fn sub(self, rhs: u64) -> Self::Output {
487 Self::new(self.0 - rhs)
488 }
489}
490
491impl std::ops::Add<u64> for ProtocolVersion {
492 type Output = Self;
493 fn add(self, rhs: u64) -> Self::Output {
494 Self::new(self.0 + rhs)
495 }
496}
497
498#[derive(
499 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
500)]
501pub enum Chain {
502 Mainnet,
503 Testnet,
504 #[default]
505 Unknown,
506}
507
508impl Chain {
509 pub fn as_str(self) -> &'static str {
510 match self {
511 Chain::Mainnet => "mainnet",
512 Chain::Testnet => "testnet",
513 Chain::Unknown => "unknown",
514 }
515 }
516}
517
518pub struct Error(pub String);
519
520#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
523struct FeatureFlags {
524 #[serde(skip_serializing_if = "is_false")]
527 package_upgrades: bool,
528 #[serde(skip_serializing_if = "is_false")]
531 commit_root_state_digest: bool,
532 #[serde(skip_serializing_if = "is_false")]
534 advance_epoch_start_time_in_safe_mode: bool,
535 #[serde(skip_serializing_if = "is_false")]
538 loaded_child_objects_fixed: bool,
539 #[serde(skip_serializing_if = "is_false")]
542 missing_type_is_compatibility_error: bool,
543 #[serde(skip_serializing_if = "is_false")]
546 scoring_decision_with_validity_cutoff: bool,
547
548 #[serde(skip_serializing_if = "is_false")]
551 consensus_order_end_of_epoch_last: bool,
552
553 #[serde(skip_serializing_if = "is_false")]
557 consensus_slim_block_propagation: bool,
558
559 #[serde(skip_serializing_if = "is_false")]
561 disallow_adding_abilities_on_upgrade: bool,
562 #[serde(skip_serializing_if = "is_false")]
564 disable_invariant_violation_check_in_swap_loc: bool,
565 #[serde(skip_serializing_if = "is_false")]
568 advance_to_highest_supported_protocol_version: bool,
569 #[serde(skip_serializing_if = "is_false")]
571 ban_entry_init: bool,
572 #[serde(skip_serializing_if = "is_false")]
574 package_digest_hash_module: bool,
575 #[serde(skip_serializing_if = "is_false")]
577 disallow_change_struct_type_params_on_upgrade: bool,
578 #[serde(skip_serializing_if = "is_false")]
580 no_extraneous_module_bytes: bool,
581 #[serde(skip_serializing_if = "is_false")]
583 narwhal_versioned_metadata: bool,
584
585 #[serde(skip_serializing_if = "is_false")]
587 zklogin_auth: bool,
588 #[serde(skip_serializing_if = "is_zero")]
591 zklogin_circuit_mode: u64,
592 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
594 consensus_transaction_ordering: ConsensusTransactionOrdering,
595
596 #[serde(skip_serializing_if = "is_false")]
604 simplified_unwrap_then_delete: bool,
605 #[serde(skip_serializing_if = "is_false")]
607 upgraded_multisig_supported: bool,
608 #[serde(skip_serializing_if = "is_false")]
610 txn_base_cost_as_multiplier: bool,
611
612 #[serde(skip_serializing_if = "is_false")]
614 shared_object_deletion: bool,
615
616 #[serde(skip_serializing_if = "is_false")]
618 narwhal_new_leader_election_schedule: bool,
619
620 #[serde(skip_serializing_if = "is_empty")]
622 zklogin_supported_providers: BTreeSet<String>,
623
624 #[serde(skip_serializing_if = "is_false")]
626 loaded_child_object_format: bool,
627
628 #[serde(skip_serializing_if = "is_false")]
629 #[skip_protocol_config_accessor]
630 enable_jwk_consensus_updates: bool,
631
632 #[serde(skip_serializing_if = "is_false")]
633 #[skip_protocol_config_accessor]
634 end_of_epoch_transaction_supported: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
639 simple_conservation_checks: bool,
640
641 #[serde(skip_serializing_if = "is_false")]
643 loaded_child_object_format_type: bool,
644
645 #[serde(skip_serializing_if = "is_false")]
647 receive_objects: bool,
648
649 #[serde(skip_serializing_if = "is_false")]
651 consensus_checkpoint_signature_key_includes_digest: bool,
652
653 #[serde(skip_serializing_if = "is_false")]
655 random_beacon: bool,
656
657 #[serde(skip_serializing_if = "is_false")]
659 #[skip_protocol_config_accessor]
660 bridge: bool,
661
662 #[serde(skip_serializing_if = "is_false")]
663 enable_effects_v2: bool,
664
665 #[serde(skip_serializing_if = "is_false")]
667 narwhal_certificate_v2: bool,
668
669 #[serde(skip_serializing_if = "is_false")]
671 verify_legacy_zklogin_address: bool,
672
673 #[serde(skip_serializing_if = "is_false")]
675 throughput_aware_consensus_submission: bool,
676
677 #[serde(skip_serializing_if = "is_false")]
679 recompute_has_public_transfer_in_execution: bool,
680
681 #[serde(skip_serializing_if = "is_false")]
683 accept_zklogin_in_multisig: bool,
684
685 #[serde(skip_serializing_if = "is_false")]
687 accept_passkey_in_multisig: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 validate_zklogin_public_identifier: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
696 include_consensus_digest_in_prologue: bool,
697
698 #[serde(skip_serializing_if = "is_false")]
700 hardened_otw_check: bool,
701
702 #[serde(skip_serializing_if = "is_false")]
704 allow_receiving_object_id: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
708 enable_poseidon: bool,
709
710 #[serde(skip_serializing_if = "is_false")]
712 enable_coin_deny_list: bool,
713
714 #[serde(skip_serializing_if = "is_false")]
716 enable_group_ops_native_functions: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 enable_group_ops_native_function_msm: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 enable_ristretto255_group_ops: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
728 enable_verify_bulletproofs_ristretto255: bool,
729
730 #[serde(skip_serializing_if = "is_false")]
732 enable_nitro_attestation: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
736 enable_nitro_attestation_upgraded_parsing: bool,
737
738 #[serde(skip_serializing_if = "is_false")]
740 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
741
742 #[serde(skip_serializing_if = "is_false")]
744 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
745
746 #[serde(skip_serializing_if = "is_false")]
748 reject_mutable_random_on_entry_functions: bool,
749
750 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
752 per_object_congestion_control_mode: PerObjectCongestionControlMode,
753
754 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
756 consensus_choice: ConsensusChoice,
757
758 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
760 consensus_network: ConsensusNetwork,
761
762 #[serde(skip_serializing_if = "is_false")]
764 correct_gas_payment_limit_check: bool,
765
766 #[serde(skip_serializing_if = "Option::is_none")]
768 zklogin_max_epoch_upper_bound_delta: Option<u64>,
769
770 #[serde(skip_serializing_if = "is_false")]
772 mysticeti_leader_scoring_and_schedule: bool,
773
774 #[serde(skip_serializing_if = "is_false")]
776 reshare_at_same_initial_version: bool,
777
778 #[serde(skip_serializing_if = "is_false")]
780 resolve_abort_locations_to_package_id: bool,
781
782 #[serde(skip_serializing_if = "is_false")]
786 mysticeti_use_committed_subdag_digest: bool,
787
788 #[serde(skip_serializing_if = "is_false")]
790 enable_vdf: bool,
791
792 #[serde(skip_serializing_if = "is_false")]
796 record_consensus_determined_version_assignments_in_prologue: bool,
797 #[serde(skip_serializing_if = "is_false")]
800 record_consensus_determined_version_assignments_in_prologue_v2: bool,
801
802 #[serde(skip_serializing_if = "is_false")]
804 fresh_vm_on_framework_upgrade: bool,
805
806 #[serde(skip_serializing_if = "is_false")]
814 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
815
816 #[serde(skip_serializing_if = "Option::is_none")]
818 mysticeti_num_leaders_per_round: Option<usize>,
819
820 #[serde(skip_serializing_if = "is_false")]
822 soft_bundle: bool,
823
824 #[serde(skip_serializing_if = "is_false")]
826 enable_coin_deny_list_v2: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
830 passkey_auth: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
835 mldsa65_auth: bool,
836
837 #[serde(skip_serializing_if = "is_false")]
839 secp256r1_ecrecover_checks_x_below_p: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 complete_effects_size_estimate: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
847 authority_capabilities_v2: bool,
848
849 #[serde(skip_serializing_if = "is_false")]
851 rethrow_serialization_type_layout_errors: bool,
852
853 #[serde(skip_serializing_if = "is_false")]
855 consensus_distributed_vote_scoring_strategy: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 consensus_round_prober: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 validate_identifier_inputs: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
867 disallow_self_identifier: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
871 mysticeti_fastpath: bool,
872
873 #[serde(skip_serializing_if = "is_false")]
877 disable_preconsensus_locking: bool,
878
879 #[serde(skip_serializing_if = "is_false")]
881 relocate_event_module: bool,
882
883 #[serde(skip_serializing_if = "is_false")]
885 uncompressed_g1_group_elements: bool,
886
887 #[serde(skip_serializing_if = "is_false")]
888 disallow_new_modules_in_deps_only_packages: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 consensus_smart_ancestor_selection: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
896 consensus_round_prober_probe_accepted_rounds: bool,
897
898 #[serde(skip_serializing_if = "is_false")]
900 native_charging_v2: bool,
901
902 #[serde(skip_serializing_if = "is_false")]
905 #[skip_protocol_config_accessor]
906 consensus_linearize_subdag_v2: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 convert_type_argument_error: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 variant_nodes: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
918 consensus_zstd_compression: bool,
919
920 #[serde(skip_serializing_if = "is_false")]
922 minimize_child_object_mutations: bool,
923
924 #[serde(skip_serializing_if = "is_false")]
927 record_additional_state_digest_in_prologue: bool,
928
929 #[serde(skip_serializing_if = "is_false")]
931 move_native_context: bool,
932
933 #[serde(skip_serializing_if = "is_false")]
936 #[skip_protocol_config_accessor]
937 consensus_median_based_commit_timestamp: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
942 normalize_ptb_arguments: bool,
943
944 #[serde(skip_serializing_if = "is_false")]
946 consensus_batched_block_sync: bool,
947
948 #[serde(skip_serializing_if = "is_false")]
950 enforce_checkpoint_timestamp_monotonicity: bool,
951
952 #[serde(skip_serializing_if = "is_false")]
954 max_ptb_value_size_v2: bool,
955
956 #[serde(skip_serializing_if = "is_false")]
958 resolve_type_input_ids_to_defining_id: bool,
959
960 #[serde(skip_serializing_if = "is_false")]
962 enable_party_transfer: bool,
963
964 #[serde(skip_serializing_if = "is_false")]
966 allow_unbounded_system_objects: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
970 type_tags_in_object_runtime: bool,
971
972 #[serde(skip_serializing_if = "is_false")]
974 enable_accumulators: bool,
975
976 #[serde(skip_serializing_if = "is_false")]
978 #[skip_protocol_config_accessor]
979 enable_coin_reservation_obj_refs: bool,
980
981 #[serde(skip_serializing_if = "is_false")]
984 create_root_accumulator_object: bool,
985
986 #[serde(skip_serializing_if = "is_false")]
988 #[skip_protocol_config_accessor]
989 enable_authenticated_event_streams: bool,
990
991 #[serde(skip_serializing_if = "is_false")]
993 enable_address_balance_gas_payments: bool,
994
995 #[serde(skip_serializing_if = "is_false")]
997 address_balance_gas_check_rgp_at_signing: bool,
998
999 #[serde(skip_serializing_if = "is_false")]
1000 address_balance_gas_reject_gas_coin_arg: bool,
1001
1002 #[serde(skip_serializing_if = "is_false")]
1004 enable_multi_epoch_transaction_expiration: bool,
1005
1006 #[serde(skip_serializing_if = "is_false")]
1008 relax_valid_during_for_owned_inputs: bool,
1009
1010 #[serde(skip_serializing_if = "is_false")]
1012 enable_ptb_execution_v2: bool,
1013
1014 #[serde(skip_serializing_if = "is_false")]
1016 better_adapter_type_resolution_errors: bool,
1017
1018 #[serde(skip_serializing_if = "is_false")]
1020 record_time_estimate_processed: bool,
1021
1022 #[serde(skip_serializing_if = "is_false")]
1024 dependency_linkage_error: bool,
1025
1026 #[serde(skip_serializing_if = "is_false")]
1028 additional_multisig_checks: bool,
1029
1030 #[serde(skip_serializing_if = "is_false")]
1032 ignore_execution_time_observations_after_certs_closed: bool,
1033
1034 #[serde(skip_serializing_if = "is_false")]
1038 debug_fatal_on_move_invariant_violation: bool,
1039
1040 #[serde(skip_serializing_if = "is_false")]
1043 allow_private_accumulator_entrypoints: bool,
1044
1045 #[serde(skip_serializing_if = "is_false")]
1048 additional_consensus_digest_indirect_state: bool,
1049
1050 #[serde(skip_serializing_if = "is_false")]
1052 check_for_init_during_upgrade: bool,
1053
1054 #[serde(skip_serializing_if = "is_false")]
1056 enable_init_on_upgrade: bool,
1057
1058 #[serde(skip_serializing_if = "is_false")]
1060 enable_order_independent_upgrade_init_linkage: bool,
1061
1062 #[serde(skip_serializing_if = "is_false")]
1065 harden_linkage_consistency: bool,
1066
1067 #[serde(skip_serializing_if = "is_false")]
1069 per_command_shared_object_transfer_rules: bool,
1070
1071 #[serde(skip_serializing_if = "is_false")]
1073 validate_ptb_argument_indices: bool,
1074
1075 #[serde(skip_serializing_if = "is_false")]
1077 include_checkpoint_artifacts_digest_in_summary: bool,
1078
1079 #[serde(skip_serializing_if = "is_false")]
1081 use_mfp_txns_in_load_initial_object_debts: bool,
1082
1083 #[serde(skip_serializing_if = "is_false")]
1085 cancel_for_failed_dkg_early: bool,
1086
1087 #[serde(skip_serializing_if = "is_false")]
1089 always_advance_dkg_to_resolution: bool,
1090
1091 #[serde(skip_serializing_if = "is_false")]
1093 allow_dkg_completion_after_timeout: bool,
1094
1095 #[serde(skip_serializing_if = "is_false")]
1097 enable_coin_registry: bool,
1098
1099 #[serde(skip_serializing_if = "is_false")]
1101 abstract_size_in_object_runtime: bool,
1102
1103 #[serde(skip_serializing_if = "is_false")]
1105 object_runtime_charge_cache_load_gas: bool,
1106
1107 #[serde(skip_serializing_if = "is_false")]
1109 additional_borrow_checks: bool,
1110
1111 #[serde(skip_serializing_if = "is_false")]
1113 use_new_commit_handler: bool,
1114
1115 #[serde(skip_serializing_if = "is_false")]
1117 better_loader_errors: bool,
1118
1119 #[serde(skip_serializing_if = "is_false")]
1121 generate_df_type_layouts: bool,
1122
1123 #[serde(skip_serializing_if = "is_false")]
1125 allow_references_in_ptbs: bool,
1126
1127 #[serde(skip_serializing_if = "is_false")]
1134 framework_tx_context_mut_restrictions: bool,
1135
1136 #[serde(skip_serializing_if = "is_false")]
1138 include_function_signatures_in_instantiation_limits: bool,
1139
1140 #[serde(skip_serializing_if = "is_false")]
1145 ptb_tx_context_restrictions: bool,
1146
1147 #[serde(skip_serializing_if = "is_false")]
1149 enable_display_registry: bool,
1150
1151 #[serde(skip_serializing_if = "is_false")]
1153 private_generics_verifier_v2: bool,
1154
1155 #[serde(skip_serializing_if = "is_false")]
1157 deprecate_global_storage_ops_during_deserialization: bool,
1158
1159 #[serde(skip_serializing_if = "is_false")]
1162 enable_non_exclusive_writes: bool,
1163
1164 #[serde(skip_serializing_if = "is_false")]
1166 deprecate_global_storage_ops: bool,
1167
1168 #[serde(skip_serializing_if = "is_false")]
1170 normalize_depth_formula: bool,
1171
1172 #[serde(skip_serializing_if = "is_false")]
1175 charge_ld_const_abstract_size: bool,
1176
1177 #[serde(skip_serializing_if = "is_false")]
1179 consensus_skip_gced_accept_votes: bool,
1180
1181 #[serde(skip_serializing_if = "is_false")]
1184 include_cancelled_randomness_txns_in_prologue: bool,
1185
1186 #[serde(skip_serializing_if = "is_false")]
1188 #[skip_protocol_config_accessor]
1189 address_aliases: bool,
1190
1191 #[serde(skip_serializing_if = "is_false")]
1193 create_forwarding_address_registry: bool,
1194
1195 #[serde(skip_serializing_if = "is_false")]
1197 enable_forwarding_addresses: bool,
1198
1199 #[serde(skip_serializing_if = "is_false")]
1202 fix_checkpoint_signature_mapping: bool,
1203
1204 #[serde(skip_serializing_if = "is_false")]
1206 enable_object_funds_withdraw: bool,
1207
1208 #[serde(skip_serializing_if = "is_false")]
1211 record_net_unsettled_object_withdraws: bool,
1212
1213 #[serde(skip_serializing_if = "is_false")]
1215 consensus_skip_gced_blocks_in_direct_finalization: bool,
1216
1217 #[serde(skip_serializing_if = "is_false")]
1219 gas_rounding_halve_digits: bool,
1220
1221 #[serde(skip_serializing_if = "is_false")]
1223 flexible_tx_context_positions: bool,
1224
1225 #[serde(skip_serializing_if = "is_false")]
1227 disable_entry_point_signature_check: bool,
1228
1229 #[serde(skip_serializing_if = "is_false")]
1231 convert_withdrawal_compatibility_ptb_arguments: bool,
1232
1233 #[serde(skip_serializing_if = "is_false")]
1235 restrict_hot_or_not_entry_functions: bool,
1236
1237 #[serde(skip_serializing_if = "is_false")]
1239 split_checkpoints_in_consensus_handler: bool,
1240
1241 #[serde(skip_serializing_if = "is_false")]
1243 consensus_always_accept_system_transactions: bool,
1244
1245 #[serde(skip_serializing_if = "is_false")]
1247 validator_metadata_verify_v2: bool,
1248
1249 #[serde(skip_serializing_if = "is_false")]
1252 defer_unpaid_amplification: bool,
1253
1254 #[serde(skip_serializing_if = "is_false")]
1257 defer_owned_object_double_spend: bool,
1258
1259 #[serde(skip_serializing_if = "is_false")]
1262 allowed_proposers: bool,
1263
1264 #[serde(skip_serializing_if = "is_false")]
1270 #[skip_protocol_config_accessor]
1271 staggered_submission_signal: bool,
1272
1273 #[serde(skip_serializing_if = "is_false")]
1274 randomize_checkpoint_tx_limit_in_tests: bool,
1275
1276 #[serde(skip_serializing_if = "is_false")]
1278 gasless_transaction_drop_safety: bool,
1279
1280 #[serde(skip_serializing_if = "is_false")]
1283 merge_randomness_into_checkpoint: bool,
1284
1285 #[serde(skip_serializing_if = "is_false")]
1287 use_coin_party_owner: bool,
1288
1289 #[serde(skip_serializing_if = "is_false")]
1290 enable_gasless: bool,
1291
1292 #[serde(skip_serializing_if = "is_false")]
1293 gasless_verify_remaining_balance: bool,
1294
1295 #[serde(skip_serializing_if = "is_false")]
1296 disallow_jump_orphans: bool,
1297
1298 #[serde(skip_serializing_if = "is_false")]
1300 early_return_receive_object_mismatched_type: bool,
1301
1302 #[serde(skip_serializing_if = "is_false")]
1307 timestamp_based_epoch_close: bool,
1308
1309 #[serde(skip_serializing_if = "is_false")]
1312 limit_groth16_pvk_inputs: bool,
1313
1314 #[serde(skip_serializing_if = "is_false")]
1318 check_groth16_pvk_length: bool,
1319
1320 #[serde(skip_serializing_if = "is_false")]
1325 enforce_address_balance_change_invariant: bool,
1326
1327 #[serde(skip_serializing_if = "is_false")]
1329 share_transaction_deny_config_in_consensus: bool,
1330
1331 #[serde(skip_serializing_if = "is_false")]
1333 granular_post_execution_checks: bool,
1334
1335 #[serde(skip_serializing_if = "is_false")]
1337 early_exit_on_iffw: bool,
1338
1339 #[serde(skip_serializing_if = "is_false")]
1341 enable_unified_linkage: bool,
1342
1343 #[serde(skip_serializing_if = "is_false")]
1346 #[skip_protocol_config_accessor]
1347 enable_allowances: bool,
1348
1349 #[serde(skip_serializing_if = "is_false")]
1351 fix_ptb_generated_reads: bool,
1352
1353 #[serde(skip_serializing_if = "is_false")]
1354 check_object_funds_withdraw_in_execution: bool,
1355 #[serde(skip_serializing_if = "is_false")]
1357 memory_safety_invariant_check_v2: bool,
1358
1359 #[serde(skip_serializing_if = "is_false")]
1361 disable_effects_tx_dependencies: bool,
1362
1363 #[serde(skip_serializing_if = "is_false")]
1367 merge_colliding_deferrals: bool,
1368
1369 #[serde(skip_serializing_if = "is_false")]
1373 shuffle_consensus_commit_blocks: bool,
1374
1375 #[serde(skip_serializing_if = "is_false")]
1378 disable_id_leak_verifier: bool,
1379}
1380
1381fn is_false(b: &bool) -> bool {
1382 !b
1383}
1384
1385fn is_empty(b: &BTreeSet<String>) -> bool {
1386 b.is_empty()
1387}
1388
1389fn is_zero(val: &u64) -> bool {
1390 *val == 0
1391}
1392
1393#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1395pub enum ConsensusTransactionOrdering {
1396 #[default]
1398 None,
1399 ByGasPrice,
1401}
1402
1403impl ConsensusTransactionOrdering {
1404 pub fn is_none(&self) -> bool {
1405 matches!(self, ConsensusTransactionOrdering::None)
1406 }
1407}
1408
1409#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1410pub struct ExecutionTimeEstimateParams {
1411 pub target_utilization: u64,
1413 pub allowed_txn_cost_overage_burst_limit_us: u64,
1417
1418 pub randomness_scalar: u64,
1421
1422 pub max_estimate_us: u64,
1424
1425 pub stored_observations_num_included_checkpoints: u64,
1428
1429 pub stored_observations_limit: u64,
1431
1432 #[serde(skip_serializing_if = "is_zero")]
1435 pub stake_weighted_median_threshold: u64,
1436
1437 #[serde(skip_serializing_if = "is_false")]
1441 pub default_none_duration_for_new_keys: bool,
1442
1443 #[serde(skip_serializing_if = "Option::is_none")]
1445 pub observations_chunk_size: Option<u64>,
1446}
1447
1448#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1450pub enum PerObjectCongestionControlMode {
1451 #[default]
1452 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1458
1459impl PerObjectCongestionControlMode {
1460 pub fn is_none(&self) -> bool {
1461 matches!(self, PerObjectCongestionControlMode::None)
1462 }
1463}
1464
1465#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1467pub enum ConsensusChoice {
1468 #[default]
1469 Narwhal,
1470 SwapEachEpoch,
1471 Mysticeti,
1472}
1473
1474impl ConsensusChoice {
1475 pub fn is_narwhal(&self) -> bool {
1476 matches!(self, ConsensusChoice::Narwhal)
1477 }
1478}
1479
1480#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1482pub enum ConsensusNetwork {
1483 #[default]
1484 Anemo,
1485 Tonic,
1486}
1487
1488impl ConsensusNetwork {
1489 pub fn is_anemo(&self) -> bool {
1490 matches!(self, ConsensusNetwork::Anemo)
1491 }
1492}
1493
1494#[skip_serializing_none]
1526#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1527pub struct ProtocolConfig {
1528 pub version: ProtocolVersion,
1529
1530 #[serde(skip)]
1535 chain: Chain,
1536
1537 feature_flags: FeatureFlags,
1538
1539 max_tx_size_bytes: Option<u64>,
1542
1543 max_input_objects: Option<u64>,
1545
1546 max_size_written_objects: Option<u64>,
1550 max_size_written_objects_system_tx: Option<u64>,
1553
1554 max_serialized_tx_effects_size_bytes: Option<u64>,
1556
1557 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1559
1560 max_gas_payment_objects: Option<u32>,
1562
1563 max_modules_in_publish: Option<u32>,
1565
1566 max_package_dependencies: Option<u32>,
1568
1569 max_arguments: Option<u32>,
1572
1573 max_type_arguments: Option<u32>,
1575
1576 max_type_argument_depth: Option<u32>,
1578
1579 max_pure_argument_size: Option<u32>,
1581
1582 max_programmable_tx_commands: Option<u32>,
1584
1585 move_binary_format_version: Option<u32>,
1588 min_move_binary_format_version: Option<u32>,
1589
1590 binary_module_handles: Option<u16>,
1592 binary_struct_handles: Option<u16>,
1593 binary_function_handles: Option<u16>,
1594 binary_function_instantiations: Option<u16>,
1595 binary_signatures: Option<u16>,
1596 binary_constant_pool: Option<u16>,
1597 binary_identifiers: Option<u16>,
1598 binary_address_identifiers: Option<u16>,
1599 binary_struct_defs: Option<u16>,
1600 binary_struct_def_instantiations: Option<u16>,
1601 binary_function_defs: Option<u16>,
1602 binary_field_handles: Option<u16>,
1603 binary_field_instantiations: Option<u16>,
1604 binary_friend_decls: Option<u16>,
1605 binary_enum_defs: Option<u16>,
1606 binary_enum_def_instantiations: Option<u16>,
1607 binary_variant_handles: Option<u16>,
1608 binary_variant_instantiation_handles: Option<u16>,
1609
1610 #[skip_accessor]
1612 binary_format_limits_profile: Option<BinaryFormatLimitsProfile>,
1613
1614 max_move_object_size: Option<u64>,
1616
1617 max_move_package_size: Option<u64>,
1620
1621 max_publish_or_upgrade_per_ptb: Option<u64>,
1623
1624 max_tx_gas: Option<u64>,
1626
1627 max_gas_price: Option<u64>,
1629
1630 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1633
1634 max_gas_computation_bucket: Option<u64>,
1636
1637 gas_rounding_step: Option<u64>,
1639
1640 max_loop_depth: Option<u64>,
1642
1643 max_generic_instantiation_length: Option<u64>,
1645
1646 max_function_parameters: Option<u64>,
1648
1649 max_basic_blocks: Option<u64>,
1651
1652 max_value_stack_size: Option<u64>,
1654
1655 max_type_nodes: Option<u64>,
1657
1658 max_generic_instantiation_type_nodes_per_function: Option<u64>,
1660
1661 max_generic_instantiation_type_nodes_per_module: Option<u64>,
1663
1664 max_accumulator_type_nodes: Option<u64>,
1666
1667 max_push_size: Option<u64>,
1669
1670 max_struct_definitions: Option<u64>,
1672
1673 max_function_definitions: Option<u64>,
1675
1676 max_fields_in_struct: Option<u64>,
1678
1679 max_dependency_depth: Option<u64>,
1681
1682 max_num_event_emit: Option<u64>,
1684
1685 max_num_accumulator_events: Option<u64>,
1689
1690 max_num_new_move_object_ids: Option<u64>,
1692
1693 max_num_new_move_object_ids_system_tx: Option<u64>,
1695
1696 max_num_deleted_move_object_ids: Option<u64>,
1698
1699 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1701
1702 max_num_transferred_move_object_ids: Option<u64>,
1704
1705 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1707
1708 max_event_emit_size: Option<u64>,
1710
1711 max_event_emit_size_total: Option<u64>,
1713
1714 max_move_vector_len: Option<u64>,
1716
1717 max_move_identifier_len: Option<u64>,
1719
1720 max_move_value_depth: Option<u64>,
1722
1723 package_arena_size_in_bytes: Option<u64>,
1726
1727 max_move_enum_variants: Option<u64>,
1729
1730 max_back_edges_per_function: Option<u64>,
1732
1733 max_back_edges_per_module: Option<u64>,
1735
1736 max_verifier_meter_ticks_per_function: Option<u64>,
1738
1739 max_meter_ticks_per_module: Option<u64>,
1741
1742 max_meter_ticks_per_package: Option<u64>,
1744
1745 object_runtime_max_num_cached_objects: Option<u64>,
1749
1750 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1752
1753 object_runtime_max_num_store_entries: Option<u64>,
1755
1756 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1758
1759 base_tx_cost_fixed: Option<u64>,
1762
1763 package_publish_cost_fixed: Option<u64>,
1766
1767 base_tx_cost_per_byte: Option<u64>,
1770
1771 package_publish_cost_per_byte: Option<u64>,
1773
1774 obj_access_cost_read_per_byte: Option<u64>,
1776
1777 obj_access_cost_read_per_package_kb: Option<u64>,
1780
1781 obj_access_cost_mutate_per_byte: Option<u64>,
1783
1784 obj_access_cost_delete_per_byte: Option<u64>,
1786
1787 obj_access_cost_verify_per_byte: Option<u64>,
1797
1798 max_type_to_layout_nodes: Option<u64>,
1800
1801 max_ptb_value_size: Option<u64>,
1803
1804 gas_model_version: Option<u64>,
1807
1808 obj_data_cost_refundable: Option<u64>,
1811
1812 obj_metadata_cost_non_refundable: Option<u64>,
1816
1817 storage_rebate_rate: Option<u64>,
1823
1824 storage_fund_reinvest_rate: Option<u64>,
1827
1828 reward_slashing_rate: Option<u64>,
1831
1832 storage_gas_price: Option<u64>,
1834
1835 accumulator_object_storage_cost: Option<u64>,
1837
1838 max_transactions_per_checkpoint: Option<u64>,
1843
1844 max_checkpoint_size_bytes: Option<u64>,
1848
1849 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1854
1855 address_from_bytes_cost_base: Option<u64>,
1860 address_to_u256_cost_base: Option<u64>,
1862 address_from_u256_cost_base: Option<u64>,
1864
1865 config_read_setting_impl_cost_base: Option<u64>,
1870 config_read_setting_impl_cost_per_byte: Option<u64>,
1871
1872 package_original_package_id_impl_cost_base: Option<u64>,
1873 package_original_package_id_impl_cost_per_byte: Option<u64>,
1874
1875 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1878 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1879 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1880 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1881 dynamic_field_add_child_object_cost_base: Option<u64>,
1883 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1884 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1885 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1886 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1888 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1889 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1890 dynamic_field_remove_child_object_cost_base: Option<u64>,
1892 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1893 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1894 dynamic_field_has_child_object_cost_base: Option<u64>,
1896 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1898 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1899 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1900
1901 scratch_add_cost_base: Option<u64>,
1904 scratch_read_cost_base: Option<u64>,
1906 scratch_read_value_cost: Option<u64>,
1907 scratch_remove_cost_base: Option<u64>,
1909 scratch_exists_cost_base: Option<u64>,
1911 scratch_exists_with_type_cost_base: Option<u64>,
1913 scratch_exists_with_type_type_cost: Option<u64>,
1914 max_scratch_pad_size: Option<u64>,
1916
1917 event_emit_cost_base: Option<u64>,
1920 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1921 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1922 event_emit_output_cost_per_byte: Option<u64>,
1923 event_emit_auth_stream_cost: Option<u64>,
1924
1925 reserve_object_funds_for_withdrawal_cost_base: Option<u64>,
1928 reserve_object_funds_for_withdrawal_cold_read_cost: Option<u64>,
1930
1931 object_borrow_uid_cost_base: Option<u64>,
1934 object_delete_impl_cost_base: Option<u64>,
1936 object_record_new_uid_cost_base: Option<u64>,
1938 object_record_new_uid_from_hash_cost_base: Option<u64>,
1941 object_is_shared_input_cost_base: Option<u64>,
1943
1944 transfer_transfer_internal_cost_base: Option<u64>,
1947 transfer_party_transfer_internal_cost_base: Option<u64>,
1949 transfer_freeze_object_cost_base: Option<u64>,
1951 transfer_share_object_cost_base: Option<u64>,
1953 transfer_receive_object_cost_base: Option<u64>,
1956 transfer_receive_object_cost_per_byte: Option<u64>,
1957 transfer_receive_object_type_cost_per_byte: Option<u64>,
1958
1959 tx_context_derive_id_cost_base: Option<u64>,
1962 tx_context_fresh_id_cost_base: Option<u64>,
1963 tx_context_sender_cost_base: Option<u64>,
1964 tx_context_epoch_cost_base: Option<u64>,
1965 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1966 tx_context_sponsor_cost_base: Option<u64>,
1967 tx_context_rgp_cost_base: Option<u64>,
1968 tx_context_gas_price_cost_base: Option<u64>,
1969 tx_context_gas_budget_cost_base: Option<u64>,
1970 tx_context_ids_created_cost_base: Option<u64>,
1971 tx_context_replace_cost_base: Option<u64>,
1972
1973 clock_borrow_cost_base: Option<u64>,
1976
1977 types_is_one_time_witness_cost_base: Option<u64>,
1980 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1981 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1982
1983 validator_validate_metadata_cost_base: Option<u64>,
1986 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1987
1988 crypto_invalid_arguments_cost: Option<u64>,
1990 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1992 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1993 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1994
1995 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1997 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1998 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1999
2000 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
2002 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2003 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2004 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
2005 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2006 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2007
2008 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
2010
2011 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
2013 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2014 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
2015 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
2016 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
2017 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
2018
2019 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
2021 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2022 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2023 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
2024 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2025 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2026
2027 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
2029 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2030 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
2031 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
2032 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
2033 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
2034
2035 ecvrf_ecvrf_verify_cost_base: Option<u64>,
2037 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
2038 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
2039
2040 ed25519_ed25519_verify_cost_base: Option<u64>,
2042 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
2043 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
2044
2045 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
2047 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
2048
2049 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
2051 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
2052 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
2053 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
2054 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
2055
2056 hash_blake2b256_cost_base: Option<u64>,
2058 hash_blake2b256_data_cost_per_byte: Option<u64>,
2059 hash_blake2b256_data_cost_per_block: Option<u64>,
2060
2061 hash_keccak256_cost_base: Option<u64>,
2063 hash_keccak256_data_cost_per_byte: Option<u64>,
2064 hash_keccak256_data_cost_per_block: Option<u64>,
2065
2066 poseidon_bn254_cost_base: Option<u64>,
2068 poseidon_bn254_cost_per_block: Option<u64>,
2069
2070 group_ops_bls12381_decode_scalar_cost: Option<u64>,
2072 group_ops_bls12381_decode_g1_cost: Option<u64>,
2073 group_ops_bls12381_decode_g2_cost: Option<u64>,
2074 group_ops_bls12381_decode_gt_cost: Option<u64>,
2075 group_ops_bls12381_scalar_add_cost: Option<u64>,
2076 group_ops_bls12381_g1_add_cost: Option<u64>,
2077 group_ops_bls12381_g2_add_cost: Option<u64>,
2078 group_ops_bls12381_gt_add_cost: Option<u64>,
2079 group_ops_bls12381_scalar_sub_cost: Option<u64>,
2080 group_ops_bls12381_g1_sub_cost: Option<u64>,
2081 group_ops_bls12381_g2_sub_cost: Option<u64>,
2082 group_ops_bls12381_gt_sub_cost: Option<u64>,
2083 group_ops_bls12381_scalar_mul_cost: Option<u64>,
2084 group_ops_bls12381_g1_mul_cost: Option<u64>,
2085 group_ops_bls12381_g2_mul_cost: Option<u64>,
2086 group_ops_bls12381_gt_mul_cost: Option<u64>,
2087 group_ops_bls12381_scalar_div_cost: Option<u64>,
2088 group_ops_bls12381_g1_div_cost: Option<u64>,
2089 group_ops_bls12381_g2_div_cost: Option<u64>,
2090 group_ops_bls12381_gt_div_cost: Option<u64>,
2091 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
2092 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
2093 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
2094 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
2095 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
2096 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
2097 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
2098 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
2099 group_ops_bls12381_msm_max_len: Option<u32>,
2100 group_ops_bls12381_pairing_cost: Option<u64>,
2101 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
2102 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
2103 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
2104 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
2105 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
2106
2107 group_ops_ristretto_decode_scalar_cost: Option<u64>,
2108 group_ops_ristretto_decode_point_cost: Option<u64>,
2109 group_ops_ristretto_scalar_add_cost: Option<u64>,
2110 group_ops_ristretto_point_add_cost: Option<u64>,
2111 group_ops_ristretto_scalar_sub_cost: Option<u64>,
2112 group_ops_ristretto_point_sub_cost: Option<u64>,
2113 group_ops_ristretto_scalar_mul_cost: Option<u64>,
2114 group_ops_ristretto_point_mul_cost: Option<u64>,
2115 group_ops_ristretto_scalar_div_cost: Option<u64>,
2116 group_ops_ristretto_point_div_cost: Option<u64>,
2117
2118 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
2119 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
2120 max_bulletproofs_total_bits: Option<u64>,
2123
2124 hmac_hmac_sha3_256_cost_base: Option<u64>,
2126 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
2127 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
2128
2129 check_zklogin_id_cost_base: Option<u64>,
2131 check_zklogin_issuer_cost_base: Option<u64>,
2133
2134 vdf_verify_vdf_cost: Option<u64>,
2135 vdf_hash_to_input_cost: Option<u64>,
2136
2137 nitro_attestation_parse_base_cost: Option<u64>,
2139 nitro_attestation_parse_cost_per_byte: Option<u64>,
2140 nitro_attestation_verify_base_cost: Option<u64>,
2141 nitro_attestation_verify_cost_per_cert: Option<u64>,
2142
2143 bcs_per_byte_serialized_cost: Option<u64>,
2145 bcs_legacy_min_output_size_cost: Option<u64>,
2146 bcs_failure_cost: Option<u64>,
2147
2148 hash_sha2_256_base_cost: Option<u64>,
2149 hash_sha2_256_per_byte_cost: Option<u64>,
2150 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
2151 hash_sha3_256_base_cost: Option<u64>,
2152 hash_sha3_256_per_byte_cost: Option<u64>,
2153 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
2154 type_name_get_base_cost: Option<u64>,
2155 type_name_get_per_byte_cost: Option<u64>,
2156 type_name_id_base_cost: Option<u64>,
2157
2158 string_check_utf8_base_cost: Option<u64>,
2159 string_check_utf8_per_byte_cost: Option<u64>,
2160 string_is_char_boundary_base_cost: Option<u64>,
2161 string_sub_string_base_cost: Option<u64>,
2162 string_sub_string_per_byte_cost: Option<u64>,
2163 string_index_of_base_cost: Option<u64>,
2164 string_index_of_per_byte_pattern_cost: Option<u64>,
2165 string_index_of_per_byte_searched_cost: Option<u64>,
2166
2167 vector_empty_base_cost: Option<u64>,
2168 vector_length_base_cost: Option<u64>,
2169 vector_push_back_base_cost: Option<u64>,
2170 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
2171 vector_borrow_base_cost: Option<u64>,
2172 vector_pop_back_base_cost: Option<u64>,
2173 vector_destroy_empty_base_cost: Option<u64>,
2174 vector_swap_base_cost: Option<u64>,
2175 vector_reverse_base_cost: Option<u64>,
2176 vector_reverse_per_elem_cost: Option<u64>,
2177 vector_keep_range_base_cost: Option<u64>,
2178 vector_keep_range_per_dropped_elem_cost: Option<u64>,
2179 vector_keep_range_per_moved_elem_cost: Option<u64>,
2180 vector_copy_range_base_cost: Option<u64>,
2181 vector_replace_range_base_cost: Option<u64>,
2182 vector_replace_range_per_elem_cost: Option<u64>,
2183 debug_print_base_cost: Option<u64>,
2184 debug_print_stack_trace_base_cost: Option<u64>,
2185
2186 #[custom_setter]
2196 execution_version: Option<u64>,
2197
2198 consensus_bad_nodes_stake_threshold: Option<u64>,
2202
2203 max_jwk_votes_per_validator_per_epoch: Option<u64>,
2204 max_age_of_jwk_in_epochs: Option<u64>,
2208
2209 random_beacon_reduction_allowed_delta: Option<u16>,
2213
2214 random_beacon_reduction_lower_bound: Option<u32>,
2217
2218 random_beacon_dkg_timeout_round: Option<u32>,
2221
2222 random_beacon_min_round_interval_ms: Option<u64>,
2224
2225 random_beacon_dkg_version: Option<u64>,
2228
2229 consensus_max_transaction_size_bytes: Option<u64>,
2232 consensus_max_transactions_in_block_bytes: Option<u64>,
2234 consensus_max_num_transactions_in_block: Option<u64>,
2236
2237 consensus_voting_rounds: Option<u32>,
2239
2240 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
2242
2243 max_deferral_rounds_for_congestion_control: Option<u64>,
2246
2247 epoch_close_deadline_ms: Option<u64>,
2252
2253 max_txn_cost_overage_per_object_in_commit: Option<u64>,
2255
2256 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
2258
2259 min_checkpoint_interval_ms: Option<u64>,
2261
2262 checkpoint_summary_version_specific_data: Option<u64>,
2264
2265 max_soft_bundle_size: Option<u64>,
2267
2268 bridge_should_try_to_finalize_committee: Option<bool>,
2272
2273 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2279
2280 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2283
2284 consensus_gc_depth: Option<u32>,
2287
2288 gas_budget_based_txn_cost_cap_factor: Option<u64>,
2290
2291 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
2293
2294 sip_45_consensus_amplification_threshold: Option<u64>,
2297
2298 staggered_submission_signal_window_commits: Option<u64>,
2301 staggered_submission_signal_min_excess_copies_per_commit: Option<u64>,
2303 staggered_submission_signal_exit_dwell_commits: Option<u64>,
2306 staggered_submission_signal_band1_enter_ratio_bps: Option<u64>,
2309 staggered_submission_signal_band1_exit_ratio_bps: Option<u64>,
2310 staggered_submission_signal_band2_enter_ratio_bps: Option<u64>,
2311 staggered_submission_signal_band2_exit_ratio_bps: Option<u64>,
2312
2313 use_object_per_epoch_marker_table_v2: Option<bool>,
2316
2317 consensus_commit_rate_estimation_window_size: Option<u32>,
2319
2320 #[serde(skip_serializing_if = "Vec::is_empty")]
2324 aliased_addresses: Vec<AliasedAddress>,
2325
2326 translation_per_command_base_charge: Option<u64>,
2329
2330 translation_per_input_base_charge: Option<u64>,
2333
2334 translation_pure_input_per_byte_charge: Option<u64>,
2336
2337 translation_per_type_node_charge: Option<u64>,
2341
2342 translation_per_reference_node_charge: Option<u64>,
2345
2346 translation_per_linkage_entry_charge: Option<u64>,
2349
2350 max_updates_per_settlement_txn: Option<u32>,
2352
2353 gasless_max_computation_units: Option<u64>,
2355
2356 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
2358
2359 gasless_max_unused_inputs: Option<u64>,
2363
2364 gasless_max_pure_input_bytes: Option<u64>,
2367
2368 gasless_max_tps: Option<u64>,
2370
2371 #[serde(skip_serializing_if = "Option::is_none")]
2372 #[skip_accessor]
2373 include_special_package_amendments: Option<Arc<Amendments>>,
2374
2375 gasless_max_tx_size_bytes: Option<u64>,
2378
2379 translation_per_live_reference_charge: Option<u64>,
2382
2383 max_ptb_live_references: Option<u64>,
2386
2387 max_ptb_returned_references: Option<u64>,
2390
2391 max_ptb_total_returned_references: Option<u64>,
2394}
2395
2396#[derive(Clone, Serialize, Deserialize, Debug)]
2398pub struct AliasedAddress {
2399 pub original: [u8; 32],
2401 pub aliased: [u8; 32],
2403 pub allowed_tx_digests: Vec<[u8; 32]>,
2405}
2406
2407impl ProtocolConfig {
2409 pub fn chain(&self) -> Chain {
2411 self.chain
2412 }
2413
2414 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2427 if self.feature_flags.package_upgrades {
2428 Ok(())
2429 } else {
2430 Err(Error(format!(
2431 "package upgrades are not supported at {:?}",
2432 self.version
2433 )))
2434 }
2435 }
2436
2437 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2438 &self.feature_flags.zklogin_supported_providers
2439 }
2440
2441 pub fn zklogin_circuit_mode(&self) -> u64 {
2444 self.feature_flags.zklogin_circuit_mode
2445 }
2446
2447 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2448 self.feature_flags.consensus_transaction_ordering
2449 }
2450
2451 pub fn enable_jwk_consensus_updates(&self) -> bool {
2452 let ret = self.feature_flags.enable_jwk_consensus_updates;
2453 if ret {
2454 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2456 }
2457 ret
2458 }
2459
2460 pub fn staggered_submission_signal(&self) -> bool {
2461 let ret = self.feature_flags.staggered_submission_signal;
2462 if ret {
2463 assert!(self.feature_flags.allowed_proposers);
2466 }
2467 ret
2468 }
2469
2470 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2471 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2472 if !ret {
2473 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2475 }
2476 ret
2477 }
2478
2479 pub fn dkg_version(&self) -> u64 {
2480 self.random_beacon_dkg_version.unwrap_or(1)
2482 }
2483
2484 pub fn bridge(&self) -> bool {
2485 let ret = self.feature_flags.bridge;
2486 if ret {
2487 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2489 }
2490 ret
2491 }
2492
2493 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2494 if !self.bridge() {
2495 return false;
2496 }
2497 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2499 }
2500
2501 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2502 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2503 }
2504
2505 pub fn enable_allowances(&self) -> bool {
2506 self.feature_flags.enable_allowances && self.enable_accumulators()
2507 }
2508
2509 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2510 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2511 }
2512
2513 pub fn enable_authenticated_event_streams(&self) -> bool {
2514 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2515 }
2516
2517 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2518 self.feature_flags.per_object_congestion_control_mode
2519 }
2520
2521 pub fn consensus_choice(&self) -> ConsensusChoice {
2522 self.feature_flags.consensus_choice
2523 }
2524
2525 pub fn consensus_network(&self) -> ConsensusNetwork {
2526 self.feature_flags.consensus_network
2527 }
2528
2529 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2530 self.feature_flags.mysticeti_num_leaders_per_round
2531 }
2532
2533 pub fn max_transaction_size_bytes(&self) -> u64 {
2534 self.consensus_max_transaction_size_bytes
2536 .unwrap_or(256 * 1024)
2537 }
2538
2539 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2540 if cfg!(msim) {
2541 256 * 1024
2542 } else {
2543 self.consensus_max_transactions_in_block_bytes
2544 .unwrap_or(512 * 1024)
2545 }
2546 }
2547
2548 pub fn max_num_transactions_in_block(&self) -> u64 {
2549 if cfg!(msim) {
2550 8
2551 } else {
2552 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2553 }
2554 }
2555
2556 pub fn gc_depth(&self) -> u32 {
2557 self.consensus_gc_depth.unwrap_or(0)
2558 }
2559
2560 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2561 let res = self.feature_flags.consensus_linearize_subdag_v2;
2562 assert!(
2563 !res || self.gc_depth() > 0,
2564 "The consensus linearize sub dag V2 requires GC to be enabled"
2565 );
2566 res
2567 }
2568
2569 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2570 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2571 assert!(
2572 !res || self.gc_depth() > 0,
2573 "The consensus median based commit timestamp requires GC to be enabled"
2574 );
2575 res
2576 }
2577
2578 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2579 self.consensus_commit_rate_estimation_window_size
2580 .unwrap_or(0)
2581 }
2582
2583 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2584 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2588 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2590 window_size
2591 }
2592
2593 pub fn address_aliases(&self) -> bool {
2594 let address_aliases = self.feature_flags.address_aliases;
2595 assert!(
2596 !address_aliases || self.mysticeti_fastpath(),
2597 "Address aliases requires Mysticeti fastpath to be enabled"
2598 );
2599 if address_aliases {
2600 assert!(
2601 self.feature_flags.disable_preconsensus_locking,
2602 "Address aliases requires CertifiedTransaction to be disabled"
2603 );
2604 }
2605 address_aliases
2606 }
2607
2608 pub fn new_vm_enabled(&self) -> bool {
2609 self.execution_version.is_some_and(|v| v >= 4)
2610 }
2611
2612 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2613 debug_assert!(self.gasless_allowed_token_types.is_some());
2614 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2615 }
2616
2617 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2618 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2619 }
2620
2621 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2622 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2623 }
2624
2625 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2626 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2627 }
2628
2629 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2630 &self.include_special_package_amendments
2631 }
2632}
2633
2634static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2635
2636impl ProtocolConfig {
2638 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2640 assert!(
2642 version >= ProtocolVersion::MIN,
2643 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2644 version,
2645 ProtocolVersion::MIN.0,
2646 );
2647 assert!(
2648 version <= ProtocolVersion::MAX_ALLOWED,
2649 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2650 version,
2651 ProtocolVersion::MAX_ALLOWED.0,
2652 );
2653
2654 let mut ret = Self::get_for_version_impl(version, chain);
2655 ret.version = version;
2656 ret.chain = chain;
2657
2658 ret = Self::apply_config_override(version, ret);
2659
2660 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2661 warn!(
2662 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2663 );
2664 let overrides: ProtocolConfigOptional =
2665 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2666 .expect("failed to parse ProtocolConfig override env variables");
2667 overrides.apply_to(&mut ret);
2668 }
2669
2670 ret
2671 }
2672
2673 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2676 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2677 let mut ret = Self::get_for_version_impl(version, chain);
2678 ret.version = version;
2679 ret.chain = chain;
2680 ret = Self::apply_config_override(version, ret);
2681 Some(ret)
2682 } else {
2683 None
2684 }
2685 }
2686
2687 pub fn poison_get_for_min_version() {
2688 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2689 }
2690
2691 fn load_poison_get_for_min_version() -> bool {
2692 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2693 }
2694
2695 pub fn get_for_min_version() -> Self {
2698 if Self::load_poison_get_for_min_version() {
2699 panic!("get_for_min_version called on validator");
2700 }
2701 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2702 }
2703
2704 #[allow(non_snake_case)]
2714 pub fn get_for_max_version_UNSAFE() -> Self {
2715 if Self::load_poison_get_for_min_version() {
2716 panic!("get_for_max_version_UNSAFE called on validator");
2717 }
2718 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2719 }
2720
2721 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2722 #[cfg(msim)]
2723 {
2724 if version == ProtocolVersion::MAX_ALLOWED {
2726 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2727 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2728 return config;
2729 }
2730 }
2731
2732 let mut cfg = Self {
2735 version,
2737 chain,
2738
2739 feature_flags: Default::default(),
2741
2742 max_tx_size_bytes: Some(128 * 1024),
2743 max_input_objects: Some(2048),
2745 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2746 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2747 max_gas_payment_objects: Some(256),
2748 max_modules_in_publish: Some(128),
2749 max_package_dependencies: None,
2750 max_arguments: Some(512),
2751 max_type_arguments: Some(16),
2752 max_type_argument_depth: Some(16),
2753 max_pure_argument_size: Some(16 * 1024),
2754 max_programmable_tx_commands: Some(1024),
2755 move_binary_format_version: Some(6),
2756 min_move_binary_format_version: None,
2757 binary_module_handles: None,
2758 binary_struct_handles: None,
2759 binary_function_handles: None,
2760 binary_function_instantiations: None,
2761 binary_signatures: None,
2762 binary_constant_pool: None,
2763 binary_identifiers: None,
2764 binary_address_identifiers: None,
2765 binary_struct_defs: None,
2766 binary_struct_def_instantiations: None,
2767 binary_function_defs: None,
2768 binary_field_handles: None,
2769 binary_field_instantiations: None,
2770 binary_friend_decls: None,
2771 binary_enum_defs: None,
2772 binary_enum_def_instantiations: None,
2773 binary_variant_handles: None,
2774 binary_variant_instantiation_handles: None,
2775 binary_format_limits_profile: None,
2776 max_move_object_size: Some(250 * 1024),
2777 max_move_package_size: Some(100 * 1024),
2778 max_publish_or_upgrade_per_ptb: None,
2779 max_tx_gas: Some(10_000_000_000),
2780 max_gas_price: Some(100_000),
2781 max_gas_price_rgp_factor_for_aborted_transactions: None,
2782 max_gas_computation_bucket: Some(5_000_000),
2783 max_loop_depth: Some(5),
2784 max_generic_instantiation_length: Some(32),
2785 max_function_parameters: Some(128),
2786 max_basic_blocks: Some(1024),
2787 max_value_stack_size: Some(1024),
2788 max_type_nodes: Some(256),
2789 max_generic_instantiation_type_nodes_per_function: None,
2790 max_generic_instantiation_type_nodes_per_module: None,
2791 max_accumulator_type_nodes: None,
2792 max_push_size: Some(10000),
2793 max_struct_definitions: Some(200),
2794 max_function_definitions: Some(1000),
2795 max_fields_in_struct: Some(32),
2796 max_dependency_depth: Some(100),
2797 max_num_event_emit: Some(256),
2798 max_num_accumulator_events: None,
2799 max_num_new_move_object_ids: Some(2048),
2800 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2801 max_num_deleted_move_object_ids: Some(2048),
2802 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2803 max_num_transferred_move_object_ids: Some(2048),
2804 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2805 max_event_emit_size: Some(250 * 1024),
2806 max_move_vector_len: Some(256 * 1024),
2807 max_type_to_layout_nodes: None,
2808 max_ptb_value_size: None,
2809
2810 max_back_edges_per_function: Some(10_000),
2811 max_back_edges_per_module: Some(10_000),
2812 max_verifier_meter_ticks_per_function: Some(6_000_000),
2813 max_meter_ticks_per_module: Some(6_000_000),
2814 max_meter_ticks_per_package: None,
2815
2816 object_runtime_max_num_cached_objects: Some(1000),
2817 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2818 object_runtime_max_num_store_entries: Some(1000),
2819 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2820 base_tx_cost_fixed: Some(110_000),
2821 package_publish_cost_fixed: Some(1_000),
2822 base_tx_cost_per_byte: Some(0),
2823 package_publish_cost_per_byte: Some(80),
2824 obj_access_cost_read_per_byte: Some(15),
2825 obj_access_cost_read_per_package_kb: None,
2826 obj_access_cost_mutate_per_byte: Some(40),
2827 obj_access_cost_delete_per_byte: Some(40),
2828 obj_access_cost_verify_per_byte: Some(200),
2829 obj_data_cost_refundable: Some(100),
2830 obj_metadata_cost_non_refundable: Some(50),
2831 gas_model_version: Some(1),
2832 storage_rebate_rate: Some(9900),
2833 storage_fund_reinvest_rate: Some(500),
2834 reward_slashing_rate: Some(5000),
2835 storage_gas_price: Some(1),
2836 accumulator_object_storage_cost: None,
2837 max_transactions_per_checkpoint: Some(10_000),
2838 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2839
2840 buffer_stake_for_protocol_upgrade_bps: Some(0),
2843
2844 address_from_bytes_cost_base: Some(52),
2848 address_to_u256_cost_base: Some(52),
2850 address_from_u256_cost_base: Some(52),
2852
2853 config_read_setting_impl_cost_base: None,
2856 config_read_setting_impl_cost_per_byte: None,
2857
2858 package_original_package_id_impl_cost_base: None,
2859 package_original_package_id_impl_cost_per_byte: None,
2860
2861 dynamic_field_hash_type_and_key_cost_base: Some(100),
2864 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2865 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2866 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2867 dynamic_field_add_child_object_cost_base: Some(100),
2869 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2870 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2871 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2872 dynamic_field_borrow_child_object_cost_base: Some(100),
2874 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2875 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2876 dynamic_field_remove_child_object_cost_base: Some(100),
2878 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2879 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2880 dynamic_field_has_child_object_cost_base: Some(100),
2882 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2884 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2885 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2886
2887 scratch_add_cost_base: None,
2889 scratch_read_cost_base: None,
2890 scratch_read_value_cost: None,
2891 scratch_remove_cost_base: None,
2892 scratch_exists_cost_base: None,
2893 scratch_exists_with_type_cost_base: None,
2894 scratch_exists_with_type_type_cost: None,
2895 max_scratch_pad_size: None,
2896
2897 event_emit_cost_base: Some(52),
2900 event_emit_value_size_derivation_cost_per_byte: Some(2),
2901 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2902 event_emit_output_cost_per_byte: Some(10),
2903 event_emit_auth_stream_cost: None,
2904
2905 reserve_object_funds_for_withdrawal_cost_base: None,
2907 reserve_object_funds_for_withdrawal_cold_read_cost: None,
2908
2909 object_borrow_uid_cost_base: Some(52),
2912 object_delete_impl_cost_base: Some(52),
2914 object_record_new_uid_cost_base: Some(52),
2916 object_record_new_uid_from_hash_cost_base: None,
2919 object_is_shared_input_cost_base: None,
2922
2923 transfer_transfer_internal_cost_base: Some(52),
2926 transfer_party_transfer_internal_cost_base: None,
2928 transfer_freeze_object_cost_base: Some(52),
2930 transfer_share_object_cost_base: Some(52),
2932 transfer_receive_object_cost_base: None,
2933 transfer_receive_object_type_cost_per_byte: None,
2934 transfer_receive_object_cost_per_byte: None,
2935
2936 tx_context_derive_id_cost_base: Some(52),
2939 tx_context_fresh_id_cost_base: None,
2940 tx_context_sender_cost_base: None,
2941 tx_context_epoch_cost_base: None,
2942 tx_context_epoch_timestamp_ms_cost_base: None,
2943 tx_context_sponsor_cost_base: None,
2944 tx_context_rgp_cost_base: None,
2945 tx_context_gas_price_cost_base: None,
2946 tx_context_gas_budget_cost_base: None,
2947 tx_context_ids_created_cost_base: None,
2948 tx_context_replace_cost_base: None,
2949
2950 clock_borrow_cost_base: None,
2952
2953 types_is_one_time_witness_cost_base: Some(52),
2956 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2957 types_is_one_time_witness_type_cost_per_byte: Some(2),
2958
2959 validator_validate_metadata_cost_base: Some(52),
2962 validator_validate_metadata_data_cost_per_byte: Some(2),
2963
2964 crypto_invalid_arguments_cost: Some(100),
2966 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2968 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2969 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2970
2971 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2973 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2974 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2975
2976 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2978 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2979 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2980 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2981 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2982 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2983
2984 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2986
2987 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2989 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2990 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2991 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2992 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2993 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2994
2995 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2997 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2998 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2999 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3000 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3001 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3002
3003 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3005 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3006 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3007 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3008 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3009 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3010
3011 ecvrf_ecvrf_verify_cost_base: Some(52),
3013 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3014 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3015
3016 ed25519_ed25519_verify_cost_base: Some(52),
3018 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3019 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3020
3021 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3023 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3024
3025 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3027 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3028 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3029 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3030 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3031
3032 hash_blake2b256_cost_base: Some(52),
3034 hash_blake2b256_data_cost_per_byte: Some(2),
3035 hash_blake2b256_data_cost_per_block: Some(2),
3036
3037 hash_keccak256_cost_base: Some(52),
3039 hash_keccak256_data_cost_per_byte: Some(2),
3040 hash_keccak256_data_cost_per_block: Some(2),
3041
3042 poseidon_bn254_cost_base: None,
3043 poseidon_bn254_cost_per_block: None,
3044
3045 hmac_hmac_sha3_256_cost_base: Some(52),
3047 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3048 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3049
3050 group_ops_bls12381_decode_scalar_cost: None,
3052 group_ops_bls12381_decode_g1_cost: None,
3053 group_ops_bls12381_decode_g2_cost: None,
3054 group_ops_bls12381_decode_gt_cost: None,
3055 group_ops_bls12381_scalar_add_cost: None,
3056 group_ops_bls12381_g1_add_cost: None,
3057 group_ops_bls12381_g2_add_cost: None,
3058 group_ops_bls12381_gt_add_cost: None,
3059 group_ops_bls12381_scalar_sub_cost: None,
3060 group_ops_bls12381_g1_sub_cost: None,
3061 group_ops_bls12381_g2_sub_cost: None,
3062 group_ops_bls12381_gt_sub_cost: None,
3063 group_ops_bls12381_scalar_mul_cost: None,
3064 group_ops_bls12381_g1_mul_cost: None,
3065 group_ops_bls12381_g2_mul_cost: None,
3066 group_ops_bls12381_gt_mul_cost: None,
3067 group_ops_bls12381_scalar_div_cost: None,
3068 group_ops_bls12381_g1_div_cost: None,
3069 group_ops_bls12381_g2_div_cost: None,
3070 group_ops_bls12381_gt_div_cost: None,
3071 group_ops_bls12381_g1_hash_to_base_cost: None,
3072 group_ops_bls12381_g2_hash_to_base_cost: None,
3073 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3074 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3075 group_ops_bls12381_g1_msm_base_cost: None,
3076 group_ops_bls12381_g2_msm_base_cost: None,
3077 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3078 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3079 group_ops_bls12381_msm_max_len: None,
3080 group_ops_bls12381_pairing_cost: None,
3081 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3082 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3083 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3084 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3085 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3086
3087 group_ops_ristretto_decode_scalar_cost: None,
3088 group_ops_ristretto_decode_point_cost: None,
3089 group_ops_ristretto_scalar_add_cost: None,
3090 group_ops_ristretto_point_add_cost: None,
3091 group_ops_ristretto_scalar_sub_cost: None,
3092 group_ops_ristretto_point_sub_cost: None,
3093 group_ops_ristretto_scalar_mul_cost: None,
3094 group_ops_ristretto_point_mul_cost: None,
3095 group_ops_ristretto_scalar_div_cost: None,
3096 group_ops_ristretto_point_div_cost: None,
3097
3098 verify_bulletproofs_ristretto255_base_cost: None,
3099 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3100 max_bulletproofs_total_bits: None,
3101
3102 check_zklogin_id_cost_base: None,
3104 check_zklogin_issuer_cost_base: None,
3106
3107 vdf_verify_vdf_cost: None,
3108 vdf_hash_to_input_cost: None,
3109
3110 nitro_attestation_parse_base_cost: None,
3112 nitro_attestation_parse_cost_per_byte: None,
3113 nitro_attestation_verify_base_cost: None,
3114 nitro_attestation_verify_cost_per_cert: None,
3115
3116 bcs_per_byte_serialized_cost: None,
3117 bcs_legacy_min_output_size_cost: None,
3118 bcs_failure_cost: None,
3119 hash_sha2_256_base_cost: None,
3120 hash_sha2_256_per_byte_cost: None,
3121 hash_sha2_256_legacy_min_input_len_cost: None,
3122 hash_sha3_256_base_cost: None,
3123 hash_sha3_256_per_byte_cost: None,
3124 hash_sha3_256_legacy_min_input_len_cost: None,
3125 type_name_get_base_cost: None,
3126 type_name_get_per_byte_cost: None,
3127 type_name_id_base_cost: None,
3128 string_check_utf8_base_cost: None,
3129 string_check_utf8_per_byte_cost: None,
3130 string_is_char_boundary_base_cost: None,
3131 string_sub_string_base_cost: None,
3132 string_sub_string_per_byte_cost: None,
3133 string_index_of_base_cost: None,
3134 string_index_of_per_byte_pattern_cost: None,
3135 string_index_of_per_byte_searched_cost: None,
3136 vector_empty_base_cost: None,
3137 vector_length_base_cost: None,
3138 vector_push_back_base_cost: None,
3139 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3140 vector_borrow_base_cost: None,
3141 vector_pop_back_base_cost: None,
3142 vector_destroy_empty_base_cost: None,
3143 vector_swap_base_cost: None,
3144 vector_reverse_base_cost: None,
3145 vector_reverse_per_elem_cost: None,
3146 vector_keep_range_base_cost: None,
3147 vector_keep_range_per_dropped_elem_cost: None,
3148 vector_keep_range_per_moved_elem_cost: None,
3149 vector_copy_range_base_cost: None,
3150 vector_replace_range_base_cost: None,
3151 vector_replace_range_per_elem_cost: None,
3152 debug_print_base_cost: None,
3153 debug_print_stack_trace_base_cost: None,
3154
3155 max_size_written_objects: None,
3156 max_size_written_objects_system_tx: None,
3157
3158 max_move_identifier_len: None,
3165 max_move_value_depth: None,
3166 package_arena_size_in_bytes: None,
3167 max_move_enum_variants: None,
3168
3169 gas_rounding_step: None,
3170
3171 execution_version: None,
3172
3173 max_event_emit_size_total: None,
3174
3175 consensus_bad_nodes_stake_threshold: None,
3176
3177 max_jwk_votes_per_validator_per_epoch: None,
3178
3179 max_age_of_jwk_in_epochs: None,
3180
3181 random_beacon_reduction_allowed_delta: None,
3182
3183 random_beacon_reduction_lower_bound: None,
3184
3185 random_beacon_dkg_timeout_round: None,
3186
3187 random_beacon_min_round_interval_ms: None,
3188
3189 random_beacon_dkg_version: None,
3190
3191 consensus_max_transaction_size_bytes: None,
3192
3193 consensus_max_transactions_in_block_bytes: None,
3194
3195 consensus_max_num_transactions_in_block: None,
3196
3197 consensus_voting_rounds: None,
3198
3199 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3200
3201 max_deferral_rounds_for_congestion_control: None,
3202
3203 epoch_close_deadline_ms: None,
3204
3205 max_txn_cost_overage_per_object_in_commit: None,
3206
3207 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3208
3209 min_checkpoint_interval_ms: None,
3210
3211 checkpoint_summary_version_specific_data: None,
3212
3213 max_soft_bundle_size: None,
3214
3215 bridge_should_try_to_finalize_committee: None,
3216
3217 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3218
3219 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3220
3221 consensus_gc_depth: None,
3222
3223 gas_budget_based_txn_cost_cap_factor: None,
3224
3225 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3226
3227 sip_45_consensus_amplification_threshold: None,
3228 staggered_submission_signal_window_commits: None,
3229 staggered_submission_signal_min_excess_copies_per_commit: None,
3230 staggered_submission_signal_exit_dwell_commits: None,
3231 staggered_submission_signal_band1_enter_ratio_bps: None,
3232 staggered_submission_signal_band1_exit_ratio_bps: None,
3233 staggered_submission_signal_band2_enter_ratio_bps: None,
3234 staggered_submission_signal_band2_exit_ratio_bps: None,
3235
3236 use_object_per_epoch_marker_table_v2: None,
3237
3238 consensus_commit_rate_estimation_window_size: None,
3239
3240 aliased_addresses: vec![],
3241
3242 translation_per_command_base_charge: None,
3243 translation_per_input_base_charge: None,
3244 translation_pure_input_per_byte_charge: None,
3245 translation_per_type_node_charge: None,
3246 translation_per_reference_node_charge: None,
3247 translation_per_linkage_entry_charge: None,
3248 translation_per_live_reference_charge: None,
3249 max_ptb_live_references: None,
3250 max_ptb_returned_references: None,
3251 max_ptb_total_returned_references: None,
3252
3253 max_updates_per_settlement_txn: None,
3254
3255 gasless_max_computation_units: None,
3256 gasless_allowed_token_types: None,
3257 gasless_max_unused_inputs: None,
3258 gasless_max_pure_input_bytes: None,
3259 gasless_max_tps: None,
3260 include_special_package_amendments: None,
3261 gasless_max_tx_size_bytes: None,
3262 };
3265 for cur in 2..=version.0 {
3266 match cur {
3267 1 => unreachable!(),
3268 2 => {
3269 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3270 }
3271 3 => {
3272 cfg.gas_model_version = Some(2);
3274 cfg.max_tx_gas = Some(50_000_000_000);
3276 cfg.base_tx_cost_fixed = Some(2_000);
3278 cfg.storage_gas_price = Some(76);
3280 cfg.feature_flags.loaded_child_objects_fixed = true;
3281 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3284 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3287 cfg.feature_flags.package_upgrades = true;
3288 }
3289 4 => {
3294 cfg.reward_slashing_rate = Some(10000);
3296 cfg.gas_model_version = Some(3);
3298 }
3299 5 => {
3300 cfg.feature_flags.missing_type_is_compatibility_error = true;
3301 cfg.gas_model_version = Some(4);
3302 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3303 }
3307 6 => {
3308 cfg.gas_model_version = Some(5);
3309 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3310 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3311 }
3312 7 => {
3313 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3314 cfg.feature_flags
3315 .disable_invariant_violation_check_in_swap_loc = true;
3316 cfg.feature_flags.ban_entry_init = true;
3317 cfg.feature_flags.package_digest_hash_module = true;
3318 }
3319 8 => {
3320 cfg.feature_flags
3321 .disallow_change_struct_type_params_on_upgrade = true;
3322 }
3323 9 => {
3324 cfg.max_move_identifier_len = Some(128);
3326 cfg.feature_flags.no_extraneous_module_bytes = true;
3327 cfg.feature_flags
3328 .advance_to_highest_supported_protocol_version = true;
3329 }
3330 10 => {
3331 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3332 cfg.max_meter_ticks_per_module = Some(16_000_000);
3333 }
3334 11 => {
3335 cfg.max_move_value_depth = Some(128);
3336 }
3337 12 => {
3338 cfg.feature_flags.narwhal_versioned_metadata = true;
3339 if chain != Chain::Mainnet {
3340 cfg.feature_flags.commit_root_state_digest = true;
3341 }
3342
3343 if chain != Chain::Mainnet && chain != Chain::Testnet {
3344 cfg.feature_flags.zklogin_auth = true;
3345 }
3346 }
3347 13 => {}
3348 14 => {
3349 cfg.gas_rounding_step = Some(1_000);
3350 cfg.gas_model_version = Some(6);
3351 }
3352 15 => {
3353 cfg.feature_flags.consensus_transaction_ordering =
3354 ConsensusTransactionOrdering::ByGasPrice;
3355 }
3356 16 => {
3357 cfg.feature_flags.simplified_unwrap_then_delete = true;
3358 }
3359 17 => {
3360 cfg.feature_flags.upgraded_multisig_supported = true;
3361 }
3362 18 => {
3363 cfg.execution_version = Some(1);
3364 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3373 cfg.base_tx_cost_fixed = Some(1_000);
3375 }
3376 19 => {
3377 cfg.max_num_event_emit = Some(1024);
3378 cfg.max_event_emit_size_total = Some(
3381 256 * 250 * 1024, );
3383 }
3384 20 => {
3385 cfg.feature_flags.commit_root_state_digest = true;
3386
3387 if chain != Chain::Mainnet {
3388 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3389 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3390 }
3391 }
3392
3393 21 => {
3394 if chain != Chain::Mainnet {
3395 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3396 "Google".to_string(),
3397 "Facebook".to_string(),
3398 "Twitch".to_string(),
3399 ]);
3400 }
3401 }
3402 22 => {
3403 cfg.feature_flags.loaded_child_object_format = true;
3404 }
3405 23 => {
3406 cfg.feature_flags.loaded_child_object_format_type = true;
3407 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3408 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3414 }
3415 24 => {
3416 cfg.feature_flags.simple_conservation_checks = true;
3417 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3418
3419 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3420
3421 if chain != Chain::Mainnet {
3422 cfg.feature_flags.enable_jwk_consensus_updates = true;
3423 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3425 cfg.max_age_of_jwk_in_epochs = Some(1);
3426 }
3427 }
3428 25 => {
3429 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3431 "Google".to_string(),
3432 "Facebook".to_string(),
3433 "Twitch".to_string(),
3434 ]);
3435 cfg.feature_flags.zklogin_auth = true;
3436
3437 cfg.feature_flags.enable_jwk_consensus_updates = true;
3439 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3440 cfg.max_age_of_jwk_in_epochs = Some(1);
3441 }
3442 26 => {
3443 cfg.gas_model_version = Some(7);
3444 if chain != Chain::Mainnet && chain != Chain::Testnet {
3446 cfg.transfer_receive_object_cost_base = Some(52);
3447 cfg.feature_flags.receive_objects = true;
3448 }
3449 }
3450 27 => {
3451 cfg.gas_model_version = Some(8);
3452 }
3453 28 => {
3454 cfg.check_zklogin_id_cost_base = Some(200);
3456 cfg.check_zklogin_issuer_cost_base = Some(200);
3458
3459 if chain != Chain::Mainnet && chain != Chain::Testnet {
3461 cfg.feature_flags.enable_effects_v2 = true;
3462 }
3463 }
3464 29 => {
3465 cfg.feature_flags.verify_legacy_zklogin_address = true;
3466 }
3467 30 => {
3468 if chain != Chain::Mainnet {
3470 cfg.feature_flags.narwhal_certificate_v2 = true;
3471 }
3472
3473 cfg.random_beacon_reduction_allowed_delta = Some(800);
3474 if chain != Chain::Mainnet {
3476 cfg.feature_flags.enable_effects_v2 = true;
3477 }
3478
3479 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3483
3484 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3485 }
3486 31 => {
3487 cfg.execution_version = Some(2);
3488 if chain != Chain::Mainnet && chain != Chain::Testnet {
3490 cfg.feature_flags.shared_object_deletion = true;
3491 }
3492 }
3493 32 => {
3494 if chain != Chain::Mainnet {
3496 cfg.feature_flags.accept_zklogin_in_multisig = true;
3497 }
3498 if chain != Chain::Mainnet {
3500 cfg.transfer_receive_object_cost_base = Some(52);
3501 cfg.feature_flags.receive_objects = true;
3502 }
3503 if chain != Chain::Mainnet && chain != Chain::Testnet {
3505 cfg.feature_flags.random_beacon = true;
3506 cfg.random_beacon_reduction_lower_bound = Some(1600);
3507 cfg.random_beacon_dkg_timeout_round = Some(3000);
3508 cfg.random_beacon_min_round_interval_ms = Some(150);
3509 }
3510 if chain != Chain::Testnet && chain != Chain::Mainnet {
3512 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3513 }
3514
3515 cfg.feature_flags.narwhal_certificate_v2 = true;
3517 }
3518 33 => {
3519 cfg.feature_flags.hardened_otw_check = true;
3520 cfg.feature_flags.allow_receiving_object_id = true;
3521
3522 cfg.transfer_receive_object_cost_base = Some(52);
3524 cfg.feature_flags.receive_objects = true;
3525
3526 if chain != Chain::Mainnet {
3528 cfg.feature_flags.shared_object_deletion = true;
3529 }
3530
3531 cfg.feature_flags.enable_effects_v2 = true;
3532 }
3533 34 => {}
3534 35 => {
3535 if chain != Chain::Mainnet && chain != Chain::Testnet {
3537 cfg.feature_flags.enable_poseidon = true;
3538 cfg.poseidon_bn254_cost_base = Some(260);
3539 cfg.poseidon_bn254_cost_per_block = Some(10);
3540 }
3541
3542 cfg.feature_flags.enable_coin_deny_list = true;
3543 }
3544 36 => {
3545 if chain != Chain::Mainnet && chain != Chain::Testnet {
3547 cfg.feature_flags.enable_group_ops_native_functions = true;
3548 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3549 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3551 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3552 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3553 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3554 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3555 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3556 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3557 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3558 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3559 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3560 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3561 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3562 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3563 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3564 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3565 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3566 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3567 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3568 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3569 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3570 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3571 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3572 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3573 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3574 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3575 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3576 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3577 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3578 cfg.group_ops_bls12381_msm_max_len = Some(32);
3579 cfg.group_ops_bls12381_pairing_cost = Some(52);
3580 }
3581 cfg.feature_flags.shared_object_deletion = true;
3583
3584 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3586 }
3588 37 => {
3589 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3590
3591 if chain != Chain::Mainnet {
3593 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3594 }
3595 }
3596 38 => {
3597 cfg.binary_module_handles = Some(100);
3598 cfg.binary_struct_handles = Some(300);
3599 cfg.binary_function_handles = Some(1500);
3600 cfg.binary_function_instantiations = Some(750);
3601 cfg.binary_signatures = Some(1000);
3602 cfg.binary_constant_pool = Some(4000);
3606 cfg.binary_identifiers = Some(10000);
3607 cfg.binary_address_identifiers = Some(100);
3608 cfg.binary_struct_defs = Some(200);
3609 cfg.binary_struct_def_instantiations = Some(100);
3610 cfg.binary_function_defs = Some(1000);
3611 cfg.binary_field_handles = Some(500);
3612 cfg.binary_field_instantiations = Some(250);
3613 cfg.binary_friend_decls = Some(100);
3614 cfg.max_package_dependencies = Some(32);
3616 cfg.max_modules_in_publish = Some(64);
3617 cfg.execution_version = Some(3);
3619 }
3620 39 => {
3621 }
3623 40 => {}
3624 41 => {
3625 cfg.feature_flags.enable_group_ops_native_functions = true;
3627 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3629 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3630 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3631 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3632 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3633 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3634 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3635 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3636 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3637 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3638 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3639 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3640 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3641 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3642 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3643 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3644 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3645 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3646 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3647 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3648 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3649 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3650 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3651 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3652 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3653 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3654 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3655 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3656 cfg.group_ops_bls12381_msm_max_len = Some(32);
3657 cfg.group_ops_bls12381_pairing_cost = Some(52);
3658 }
3659 42 => {}
3660 43 => {
3661 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3662 cfg.max_meter_ticks_per_package = Some(16_000_000);
3663 }
3664 44 => {
3665 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3667 if chain != Chain::Mainnet {
3669 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3670 }
3671 }
3672 45 => {
3673 if chain != Chain::Testnet && chain != Chain::Mainnet {
3675 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3676 }
3677
3678 if chain != Chain::Mainnet {
3679 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3681 }
3682 cfg.min_move_binary_format_version = Some(6);
3683 cfg.feature_flags.accept_zklogin_in_multisig = true;
3684
3685 if chain != Chain::Mainnet && chain != Chain::Testnet {
3689 cfg.feature_flags.bridge = true;
3690 }
3691 }
3692 46 => {
3693 if chain != Chain::Mainnet {
3695 cfg.feature_flags.bridge = true;
3696 }
3697
3698 cfg.feature_flags.reshare_at_same_initial_version = true;
3700 }
3701 47 => {}
3702 48 => {
3703 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3705
3706 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3708
3709 if chain != Chain::Mainnet {
3711 cfg.feature_flags.random_beacon = true;
3712 cfg.random_beacon_reduction_lower_bound = Some(1600);
3713 cfg.random_beacon_dkg_timeout_round = Some(3000);
3714 cfg.random_beacon_min_round_interval_ms = Some(200);
3715 }
3716
3717 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3719 }
3720 49 => {
3721 if chain != Chain::Testnet && chain != Chain::Mainnet {
3722 cfg.move_binary_format_version = Some(7);
3723 }
3724
3725 if chain != Chain::Mainnet && chain != Chain::Testnet {
3727 cfg.feature_flags.enable_vdf = true;
3728 cfg.vdf_verify_vdf_cost = Some(1500);
3731 cfg.vdf_hash_to_input_cost = Some(100);
3732 }
3733
3734 if chain != Chain::Testnet && chain != Chain::Mainnet {
3736 cfg.feature_flags
3737 .record_consensus_determined_version_assignments_in_prologue = true;
3738 }
3739
3740 if chain != Chain::Mainnet {
3742 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3743 }
3744
3745 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3747 }
3748 50 => {
3749 if chain != Chain::Mainnet {
3751 cfg.checkpoint_summary_version_specific_data = Some(1);
3752 cfg.min_checkpoint_interval_ms = Some(200);
3753 }
3754
3755 if chain != Chain::Testnet && chain != Chain::Mainnet {
3757 cfg.feature_flags
3758 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3759 }
3760
3761 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3762
3763 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3765 }
3766 51 => {
3767 cfg.random_beacon_dkg_version = Some(1);
3768
3769 if chain != Chain::Testnet && chain != Chain::Mainnet {
3770 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3771 }
3772 }
3773 52 => {
3774 if chain != Chain::Mainnet {
3775 cfg.feature_flags.soft_bundle = true;
3776 cfg.max_soft_bundle_size = Some(5);
3777 }
3778
3779 cfg.config_read_setting_impl_cost_base = Some(100);
3780 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3781
3782 if chain != Chain::Testnet && chain != Chain::Mainnet {
3784 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3785 cfg.feature_flags.per_object_congestion_control_mode =
3786 PerObjectCongestionControlMode::TotalTxCount;
3787 }
3788
3789 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3791
3792 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3794
3795 cfg.checkpoint_summary_version_specific_data = Some(1);
3797 cfg.min_checkpoint_interval_ms = Some(200);
3798
3799 if chain != Chain::Mainnet {
3801 cfg.feature_flags
3802 .record_consensus_determined_version_assignments_in_prologue = true;
3803 cfg.feature_flags
3804 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3805 }
3806 if chain != Chain::Mainnet {
3808 cfg.move_binary_format_version = Some(7);
3809 }
3810
3811 if chain != Chain::Testnet && chain != Chain::Mainnet {
3812 cfg.feature_flags.passkey_auth = true;
3813 }
3814 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3815 }
3816 53 => {
3817 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3819
3820 cfg.feature_flags
3822 .record_consensus_determined_version_assignments_in_prologue = true;
3823 cfg.feature_flags
3824 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3825
3826 if chain == Chain::Unknown {
3827 cfg.feature_flags.authority_capabilities_v2 = true;
3828 }
3829
3830 if chain != Chain::Mainnet {
3832 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3833 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3834 cfg.feature_flags.per_object_congestion_control_mode =
3835 PerObjectCongestionControlMode::TotalTxCount;
3836 }
3837
3838 cfg.bcs_per_byte_serialized_cost = Some(2);
3840 cfg.bcs_legacy_min_output_size_cost = Some(1);
3841 cfg.bcs_failure_cost = Some(52);
3842 cfg.debug_print_base_cost = Some(52);
3843 cfg.debug_print_stack_trace_base_cost = Some(52);
3844 cfg.hash_sha2_256_base_cost = Some(52);
3845 cfg.hash_sha2_256_per_byte_cost = Some(2);
3846 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3847 cfg.hash_sha3_256_base_cost = Some(52);
3848 cfg.hash_sha3_256_per_byte_cost = Some(2);
3849 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3850 cfg.type_name_get_base_cost = Some(52);
3851 cfg.type_name_get_per_byte_cost = Some(2);
3852 cfg.string_check_utf8_base_cost = Some(52);
3853 cfg.string_check_utf8_per_byte_cost = Some(2);
3854 cfg.string_is_char_boundary_base_cost = Some(52);
3855 cfg.string_sub_string_base_cost = Some(52);
3856 cfg.string_sub_string_per_byte_cost = Some(2);
3857 cfg.string_index_of_base_cost = Some(52);
3858 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3859 cfg.string_index_of_per_byte_searched_cost = Some(2);
3860 cfg.vector_empty_base_cost = Some(52);
3861 cfg.vector_length_base_cost = Some(52);
3862 cfg.vector_push_back_base_cost = Some(52);
3863 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3864 cfg.vector_borrow_base_cost = Some(52);
3865 cfg.vector_pop_back_base_cost = Some(52);
3866 cfg.vector_destroy_empty_base_cost = Some(52);
3867 cfg.vector_swap_base_cost = Some(52);
3868 }
3869 54 => {
3870 cfg.feature_flags.random_beacon = true;
3872 cfg.random_beacon_reduction_lower_bound = Some(1000);
3873 cfg.random_beacon_dkg_timeout_round = Some(3000);
3874 cfg.random_beacon_min_round_interval_ms = Some(500);
3875
3876 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3878 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3879 cfg.feature_flags.per_object_congestion_control_mode =
3880 PerObjectCongestionControlMode::TotalTxCount;
3881
3882 cfg.feature_flags.soft_bundle = true;
3884 cfg.max_soft_bundle_size = Some(5);
3885 }
3886 55 => {
3887 cfg.move_binary_format_version = Some(7);
3889
3890 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3892 cfg.consensus_max_num_transactions_in_block = Some(512);
3895
3896 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3897 }
3898 56 => {
3899 if chain == Chain::Mainnet {
3900 cfg.feature_flags.bridge = true;
3901 }
3902 }
3903 57 => {
3904 cfg.random_beacon_reduction_lower_bound = Some(800);
3906 }
3907 58 => {
3908 if chain == Chain::Mainnet {
3909 cfg.bridge_should_try_to_finalize_committee = Some(true);
3910 }
3911
3912 if chain != Chain::Mainnet && chain != Chain::Testnet {
3913 cfg.feature_flags
3915 .consensus_distributed_vote_scoring_strategy = true;
3916 }
3917 }
3918 59 => {
3919 cfg.feature_flags.consensus_round_prober = true;
3921 }
3922 60 => {
3923 cfg.max_type_to_layout_nodes = Some(512);
3924 cfg.feature_flags.validate_identifier_inputs = true;
3925 }
3926 61 => {
3927 if chain != Chain::Mainnet {
3928 cfg.feature_flags
3930 .consensus_distributed_vote_scoring_strategy = true;
3931 }
3932 cfg.random_beacon_reduction_lower_bound = Some(700);
3934
3935 if chain != Chain::Mainnet && chain != Chain::Testnet {
3936 cfg.feature_flags.mysticeti_fastpath = true;
3938 }
3939 }
3940 62 => {
3941 cfg.feature_flags.relocate_event_module = true;
3942 }
3943 63 => {
3944 cfg.feature_flags.per_object_congestion_control_mode =
3945 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3946 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3947 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3948 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3949 }
3950 64 => {
3951 cfg.feature_flags.per_object_congestion_control_mode =
3952 PerObjectCongestionControlMode::TotalTxCount;
3953 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3954 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3955 }
3956 65 => {
3957 cfg.feature_flags
3959 .consensus_distributed_vote_scoring_strategy = true;
3960 }
3961 66 => {
3962 if chain == Chain::Mainnet {
3963 cfg.feature_flags
3965 .consensus_distributed_vote_scoring_strategy = false;
3966 }
3967 }
3968 67 => {
3969 cfg.feature_flags
3971 .consensus_distributed_vote_scoring_strategy = true;
3972 }
3973 68 => {
3974 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3975 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3976 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3977 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3978 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3979
3980 if chain != Chain::Mainnet && chain != Chain::Testnet {
3981 cfg.feature_flags.uncompressed_g1_group_elements = true;
3982 }
3983
3984 cfg.feature_flags.per_object_congestion_control_mode =
3985 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3986 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3987 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3988 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3989 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3991 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3992
3993 cfg.random_beacon_reduction_lower_bound = Some(500);
3995
3996 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3997 }
3998 69 => {
3999 cfg.consensus_voting_rounds = Some(40);
4001
4002 if chain != Chain::Mainnet && chain != Chain::Testnet {
4003 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4005 }
4006
4007 if chain != Chain::Mainnet {
4008 cfg.feature_flags.uncompressed_g1_group_elements = true;
4009 }
4010 }
4011 70 => {
4012 if chain != Chain::Mainnet {
4013 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4015 cfg.feature_flags
4017 .consensus_round_prober_probe_accepted_rounds = true;
4018 }
4019
4020 cfg.poseidon_bn254_cost_per_block = Some(388);
4021
4022 cfg.gas_model_version = Some(9);
4023 cfg.feature_flags.native_charging_v2 = true;
4024 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4025 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4026 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4027 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4028 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4029 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4030 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4031 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4032
4033 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4035 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4036 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4037 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4038
4039 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4040 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4041 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4042 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4043 Some(8213);
4044 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4045 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4046 Some(9484);
4047
4048 cfg.hash_keccak256_cost_base = Some(10);
4049 cfg.hash_blake2b256_cost_base = Some(10);
4050
4051 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4053 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4054 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4055 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4056
4057 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4058 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4059 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4060 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4061
4062 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4063 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4064 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4065 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4066
4067 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4068 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4069 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4070 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4071
4072 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4073 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4074 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4075 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4076
4077 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4078 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4079
4080 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4081 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4082 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4083 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4084
4085 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4086 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4087 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4088 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4089
4090 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4091 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4092
4093 cfg.validator_validate_metadata_cost_base = Some(20000);
4094 }
4095 71 => {
4096 cfg.sip_45_consensus_amplification_threshold = Some(5);
4097
4098 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4100 }
4101 72 => {
4102 cfg.feature_flags.convert_type_argument_error = true;
4103
4104 cfg.max_tx_gas = Some(50_000_000_000_000);
4107 cfg.max_gas_price = Some(50_000_000_000);
4109
4110 cfg.feature_flags.variant_nodes = true;
4111 }
4112 73 => {
4113 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4115
4116 if chain != Chain::Mainnet && chain != Chain::Testnet {
4117 cfg.consensus_gc_depth = Some(60);
4120 }
4121
4122 if chain != Chain::Mainnet {
4123 cfg.feature_flags.consensus_zstd_compression = true;
4125 }
4126
4127 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4129 cfg.feature_flags
4131 .consensus_round_prober_probe_accepted_rounds = true;
4132
4133 cfg.feature_flags.per_object_congestion_control_mode =
4135 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4136 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4137 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4138 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4139 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4141 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4142 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4143 }
4144 74 => {
4145 if chain != Chain::Mainnet && chain != Chain::Testnet {
4147 cfg.feature_flags.enable_nitro_attestation = true;
4148 }
4149 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4150 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4151 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4152 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4153
4154 cfg.feature_flags.consensus_zstd_compression = true;
4156
4157 if chain != Chain::Mainnet && chain != Chain::Testnet {
4158 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4159 }
4160 }
4161 75 => {
4162 if chain != Chain::Mainnet {
4163 cfg.feature_flags.passkey_auth = true;
4164 }
4165 }
4166 76 => {
4167 if chain != Chain::Mainnet && chain != Chain::Testnet {
4168 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4169 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4170 }
4171 cfg.feature_flags.minimize_child_object_mutations = true;
4172
4173 if chain != Chain::Mainnet {
4174 cfg.feature_flags.accept_passkey_in_multisig = true;
4175 }
4176 }
4177 77 => {
4178 cfg.feature_flags.uncompressed_g1_group_elements = true;
4179
4180 if chain != Chain::Mainnet {
4181 cfg.consensus_gc_depth = Some(60);
4182 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4183 }
4184 }
4185 78 => {
4186 cfg.feature_flags.move_native_context = true;
4187 cfg.tx_context_fresh_id_cost_base = Some(52);
4188 cfg.tx_context_sender_cost_base = Some(30);
4189 cfg.tx_context_epoch_cost_base = Some(30);
4190 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4191 cfg.tx_context_sponsor_cost_base = Some(30);
4192 cfg.tx_context_gas_price_cost_base = Some(30);
4193 cfg.tx_context_gas_budget_cost_base = Some(30);
4194 cfg.tx_context_ids_created_cost_base = Some(30);
4195 cfg.tx_context_replace_cost_base = Some(30);
4196 cfg.gas_model_version = Some(10);
4197
4198 if chain != Chain::Mainnet {
4199 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4200 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4201
4202 cfg.feature_flags.per_object_congestion_control_mode =
4204 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4205 ExecutionTimeEstimateParams {
4206 target_utilization: 30,
4207 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4209 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4211 stored_observations_limit: u64::MAX,
4212 stake_weighted_median_threshold: 0,
4213 default_none_duration_for_new_keys: false,
4214 observations_chunk_size: None,
4215 },
4216 );
4217 }
4218 }
4219 79 => {
4220 if chain != Chain::Mainnet {
4221 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4222
4223 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4226
4227 cfg.feature_flags.consensus_batched_block_sync = true;
4228
4229 cfg.feature_flags.enable_nitro_attestation = true
4231 }
4232 cfg.feature_flags.normalize_ptb_arguments = true;
4233
4234 cfg.consensus_gc_depth = Some(60);
4235 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4236 }
4237 80 => {
4238 cfg.max_ptb_value_size = Some(1024 * 1024);
4239 }
4240 81 => {
4241 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4242 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4243 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4244 }
4245 82 => {
4246 cfg.feature_flags.max_ptb_value_size_v2 = true;
4247 }
4248 83 => {
4249 if chain == Chain::Mainnet {
4250 let aliased: [u8; 32] = Hex::decode(
4252 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4253 )
4254 .unwrap()
4255 .try_into()
4256 .unwrap();
4257
4258 cfg.aliased_addresses.push(AliasedAddress {
4260 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4261 aliased,
4262 allowed_tx_digests: vec![
4263 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4264 ],
4265 });
4266
4267 cfg.aliased_addresses.push(AliasedAddress {
4268 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4269 aliased,
4270 allowed_tx_digests: vec![
4271 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4272 ],
4273 });
4274 }
4275
4276 if chain != Chain::Mainnet {
4279 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4280 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4281
4282 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4284 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4285 cfg.feature_flags.per_object_congestion_control_mode =
4286 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4287 ExecutionTimeEstimateParams {
4288 target_utilization: 30,
4289 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4291 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4293 stored_observations_limit: u64::MAX,
4294 stake_weighted_median_threshold: 0,
4295 default_none_duration_for_new_keys: false,
4296 observations_chunk_size: None,
4297 },
4298 );
4299
4300 cfg.feature_flags.consensus_batched_block_sync = true;
4302
4303 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4306 cfg.feature_flags.enable_nitro_attestation = true;
4307 }
4308 }
4309 84 => {
4310 if chain == Chain::Mainnet {
4311 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4312 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4313
4314 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4316 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4317 cfg.feature_flags.per_object_congestion_control_mode =
4318 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4319 ExecutionTimeEstimateParams {
4320 target_utilization: 30,
4321 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4323 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4325 stored_observations_limit: u64::MAX,
4326 stake_weighted_median_threshold: 0,
4327 default_none_duration_for_new_keys: false,
4328 observations_chunk_size: None,
4329 },
4330 );
4331
4332 cfg.feature_flags.consensus_batched_block_sync = true;
4334
4335 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4338 cfg.feature_flags.enable_nitro_attestation = true;
4339 }
4340
4341 cfg.feature_flags.per_object_congestion_control_mode =
4343 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4344 ExecutionTimeEstimateParams {
4345 target_utilization: 30,
4346 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4348 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4350 stored_observations_limit: 20,
4351 stake_weighted_median_threshold: 0,
4352 default_none_duration_for_new_keys: false,
4353 observations_chunk_size: None,
4354 },
4355 );
4356 cfg.feature_flags.allow_unbounded_system_objects = true;
4357 }
4358 85 => {
4359 if chain != Chain::Mainnet && chain != Chain::Testnet {
4360 cfg.feature_flags.enable_party_transfer = true;
4361 }
4362
4363 cfg.feature_flags
4364 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4365 cfg.feature_flags.disallow_self_identifier = true;
4366 cfg.feature_flags.per_object_congestion_control_mode =
4367 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4368 ExecutionTimeEstimateParams {
4369 target_utilization: 50,
4370 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4372 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4374 stored_observations_limit: 20,
4375 stake_weighted_median_threshold: 0,
4376 default_none_duration_for_new_keys: false,
4377 observations_chunk_size: None,
4378 },
4379 );
4380 }
4381 86 => {
4382 cfg.feature_flags.type_tags_in_object_runtime = true;
4383 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4384
4385 cfg.feature_flags.per_object_congestion_control_mode =
4387 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4388 ExecutionTimeEstimateParams {
4389 target_utilization: 50,
4390 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4392 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4394 stored_observations_limit: 20,
4395 stake_weighted_median_threshold: 3334,
4396 default_none_duration_for_new_keys: false,
4397 observations_chunk_size: None,
4398 },
4399 );
4400 if chain != Chain::Mainnet {
4402 cfg.feature_flags.enable_party_transfer = true;
4403 }
4404 }
4405 87 => {
4406 if chain == Chain::Mainnet {
4407 cfg.feature_flags.record_time_estimate_processed = true;
4408 }
4409 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4410 }
4411 88 => {
4412 cfg.feature_flags.record_time_estimate_processed = true;
4413 cfg.tx_context_rgp_cost_base = Some(30);
4414 cfg.feature_flags
4415 .ignore_execution_time_observations_after_certs_closed = true;
4416
4417 cfg.feature_flags.per_object_congestion_control_mode =
4420 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4421 ExecutionTimeEstimateParams {
4422 target_utilization: 50,
4423 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4425 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4427 stored_observations_limit: 20,
4428 stake_weighted_median_threshold: 3334,
4429 default_none_duration_for_new_keys: true,
4430 observations_chunk_size: None,
4431 },
4432 );
4433 }
4434 89 => {
4435 cfg.feature_flags.dependency_linkage_error = true;
4436 cfg.feature_flags.additional_multisig_checks = true;
4437 }
4438 90 => {
4439 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4441 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4442 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4443 cfg.feature_flags.accept_passkey_in_multisig = true;
4444 cfg.feature_flags.passkey_auth = true;
4445 cfg.feature_flags.check_for_init_during_upgrade = true;
4446
4447 if chain != Chain::Mainnet {
4449 cfg.feature_flags.mysticeti_fastpath = true;
4450 }
4451 }
4452 91 => {
4453 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4454 }
4455 92 => {
4456 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4457 }
4458 93 => {
4459 cfg.feature_flags
4460 .consensus_checkpoint_signature_key_includes_digest = true;
4461 }
4462 94 => {
4463 cfg.feature_flags.per_object_congestion_control_mode =
4465 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4466 ExecutionTimeEstimateParams {
4467 target_utilization: 50,
4468 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4470 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4472 stored_observations_limit: 18,
4473 stake_weighted_median_threshold: 3334,
4474 default_none_duration_for_new_keys: true,
4475 observations_chunk_size: None,
4476 },
4477 );
4478
4479 cfg.feature_flags.enable_party_transfer = true;
4481 }
4482 95 => {
4483 cfg.type_name_id_base_cost = Some(52);
4484
4485 cfg.max_transactions_per_checkpoint = Some(20_000);
4487 }
4488 96 => {
4489 if chain != Chain::Mainnet && chain != Chain::Testnet {
4491 cfg.feature_flags
4492 .include_checkpoint_artifacts_digest_in_summary = true;
4493 }
4494 cfg.feature_flags.correct_gas_payment_limit_check = true;
4495 cfg.feature_flags.authority_capabilities_v2 = true;
4496 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4497 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4498 cfg.feature_flags.enable_coin_registry = true;
4499
4500 cfg.feature_flags.mysticeti_fastpath = true;
4502 }
4503 97 => {
4504 cfg.feature_flags.additional_borrow_checks = true;
4505 }
4506 98 => {
4507 cfg.event_emit_auth_stream_cost = Some(52);
4508 cfg.feature_flags.better_loader_errors = true;
4509 cfg.feature_flags.generate_df_type_layouts = true;
4510 }
4511 99 => {
4512 cfg.feature_flags.use_new_commit_handler = true;
4513 }
4514 100 => {
4515 cfg.feature_flags.private_generics_verifier_v2 = true;
4516 }
4517 101 => {
4518 cfg.feature_flags.create_root_accumulator_object = true;
4519 cfg.max_updates_per_settlement_txn = Some(100);
4520 if chain != Chain::Mainnet {
4521 cfg.feature_flags.enable_poseidon = true;
4522 }
4523 }
4524 102 => {
4525 cfg.feature_flags.per_object_congestion_control_mode =
4529 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4530 ExecutionTimeEstimateParams {
4531 target_utilization: 50,
4532 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4534 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4536 stored_observations_limit: 180,
4537 stake_weighted_median_threshold: 3334,
4538 default_none_duration_for_new_keys: true,
4539 observations_chunk_size: Some(18),
4540 },
4541 );
4542 cfg.feature_flags.deprecate_global_storage_ops = true;
4543 }
4544 103 => {}
4545 104 => {
4546 cfg.translation_per_command_base_charge = Some(1);
4547 cfg.translation_per_input_base_charge = Some(1);
4548 cfg.translation_pure_input_per_byte_charge = Some(1);
4549 cfg.translation_per_type_node_charge = Some(1);
4550 cfg.translation_per_reference_node_charge = Some(1);
4551 cfg.translation_per_linkage_entry_charge = Some(10);
4552 cfg.gas_model_version = Some(11);
4553 cfg.feature_flags.abstract_size_in_object_runtime = true;
4554 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4555 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4556 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4557 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4558 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4559 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4560 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4561 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4562 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4563 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4564 cfg.feature_flags.enable_ptb_execution_v2 = true;
4565
4566 cfg.poseidon_bn254_cost_base = Some(260);
4567
4568 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4569
4570 if chain != Chain::Mainnet {
4571 cfg.feature_flags
4572 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4573 }
4574
4575 cfg.feature_flags
4576 .include_cancelled_randomness_txns_in_prologue = true;
4577 }
4578 105 => {
4579 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4580 cfg.feature_flags.disable_preconsensus_locking = true;
4581
4582 if chain != Chain::Mainnet {
4583 cfg.feature_flags
4584 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4585 }
4586 }
4587 106 => {
4588 cfg.accumulator_object_storage_cost = Some(7600);
4590
4591 if chain != Chain::Mainnet && chain != Chain::Testnet {
4592 cfg.feature_flags.enable_accumulators = true;
4593 cfg.feature_flags.enable_address_balance_gas_payments = true;
4594 cfg.feature_flags.enable_authenticated_event_streams = true;
4595 cfg.feature_flags.enable_object_funds_withdraw = true;
4596 }
4597 }
4598 107 => {
4599 cfg.feature_flags
4600 .consensus_skip_gced_blocks_in_direct_finalization = true;
4601
4602 if in_integration_test() {
4604 cfg.consensus_gc_depth = Some(6);
4605 cfg.consensus_max_num_transactions_in_block = Some(8);
4606 }
4607 }
4608 108 => {
4609 cfg.feature_flags.gas_rounding_halve_digits = true;
4610 cfg.feature_flags.flexible_tx_context_positions = true;
4611 cfg.feature_flags.disable_entry_point_signature_check = true;
4612
4613 if chain != Chain::Mainnet {
4614 cfg.feature_flags.address_aliases = true;
4615
4616 cfg.feature_flags.enable_accumulators = true;
4617 cfg.feature_flags.enable_address_balance_gas_payments = true;
4618 }
4619
4620 cfg.feature_flags.enable_poseidon = true;
4621 }
4622 109 => {
4623 cfg.binary_variant_handles = Some(1024);
4624 cfg.binary_variant_instantiation_handles = Some(1024);
4625 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4626 }
4627 110 => {
4628 cfg.feature_flags
4629 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4630 cfg.feature_flags
4631 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4632 if chain != Chain::Mainnet && chain != Chain::Testnet {
4633 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4634 }
4635 cfg.feature_flags.validate_zklogin_public_identifier = true;
4636 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4637 cfg.feature_flags
4638 .consensus_always_accept_system_transactions = true;
4639 if chain != Chain::Mainnet {
4640 cfg.feature_flags.enable_object_funds_withdraw = true;
4641 }
4642 }
4643 111 => {
4644 cfg.feature_flags.validator_metadata_verify_v2 = true;
4645 }
4646 112 => {
4647 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4648 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4649 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4650 cfg.group_ops_ristretto_point_add_cost = Some(500);
4651 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4652 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4653 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4654 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4655 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4656 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4657
4658 if chain != Chain::Mainnet && chain != Chain::Testnet {
4659 cfg.feature_flags.enable_ristretto255_group_ops = true;
4660 }
4661 }
4662 113 => {
4663 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4664 if chain != Chain::Mainnet && chain != Chain::Testnet {
4665 cfg.feature_flags.defer_unpaid_amplification = true;
4666 }
4667 }
4668 114 => {
4669 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4670 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4671 if chain != Chain::Mainnet {
4672 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4673 cfg.feature_flags.enable_authenticated_event_streams = true;
4674 cfg.feature_flags
4675 .include_checkpoint_artifacts_digest_in_summary = true;
4676 }
4677 }
4678 115 => {
4679 cfg.feature_flags.normalize_depth_formula = true;
4680 }
4681 116 => {
4682 cfg.feature_flags.gasless_transaction_drop_safety = true;
4683 cfg.feature_flags.address_aliases = true;
4684 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4685 cfg.feature_flags.defer_unpaid_amplification = false;
4687 cfg.feature_flags.enable_display_registry = true;
4688 }
4689 117 => {}
4690 118 => {
4691 cfg.feature_flags.use_coin_party_owner = true;
4692 }
4693 119 => {
4694 cfg.execution_version = Some(4);
4696 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4697 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4698 if chain != Chain::Mainnet {
4699 cfg.feature_flags.enable_gasless = true;
4700 cfg.gasless_max_computation_units = Some(50_000);
4701 cfg.gasless_allowed_token_types = Some(vec![]);
4702 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4703 cfg.feature_flags
4704 .convert_withdrawal_compatibility_ptb_arguments = true;
4705 }
4706 cfg.gasless_max_unused_inputs = Some(1);
4707 cfg.gasless_max_pure_input_bytes = Some(32);
4708 if chain == Chain::Testnet {
4709 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4710 }
4711 cfg.transfer_receive_object_cost_per_byte = Some(1);
4712 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4713 }
4714 120 => {
4715 cfg.feature_flags.disallow_jump_orphans = true;
4716 }
4717 121 => {
4718 if chain != Chain::Mainnet {
4720 cfg.feature_flags.defer_unpaid_amplification = true;
4721 cfg.gasless_max_tps = Some(50);
4722 }
4723 cfg.feature_flags
4724 .early_return_receive_object_mismatched_type = true;
4725 }
4726 122 => {
4727 cfg.feature_flags.defer_unpaid_amplification = true;
4729 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4731 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4732 if chain != Chain::Mainnet && chain != Chain::Testnet {
4733 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4734 }
4735 cfg.feature_flags.gasless_verify_remaining_balance = true;
4736 cfg.include_special_package_amendments = match chain {
4737 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4738 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4739 Chain::Unknown => None,
4740 };
4741 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4742 cfg.gasless_max_tps = Some(300);
4743 cfg.gasless_max_computation_units = Some(5_000);
4744 }
4745 123 => {
4746 cfg.gas_model_version = Some(13);
4747 }
4748 124 => {
4749 if chain != Chain::Mainnet && chain != Chain::Testnet {
4750 cfg.feature_flags.timestamp_based_epoch_close = true;
4751 }
4752 cfg.gas_model_version = Some(14);
4753 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4754
4755 cfg.feature_flags.enable_accumulators = true;
4761 cfg.feature_flags.enable_address_balance_gas_payments = true;
4762 cfg.feature_flags.enable_authenticated_event_streams = true;
4763 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4764 cfg.feature_flags.enable_object_funds_withdraw = true;
4765 cfg.feature_flags
4766 .convert_withdrawal_compatibility_ptb_arguments = true;
4767 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4768 cfg.feature_flags
4769 .include_checkpoint_artifacts_digest_in_summary = true;
4770 cfg.feature_flags.enable_gasless = true;
4771
4772 if chain == Chain::Mainnet {
4777 cfg.gasless_allowed_token_types = Some(vec![
4778 (MAINNET_USDC.to_string(), 10_000),
4779 (MAINNET_USDSUI.to_string(), 10_000),
4780 (MAINNET_SUI_USDE.to_string(), 10_000),
4781 (MAINNET_USDY.to_string(), 10_000),
4782 (MAINNET_FDUSD.to_string(), 10_000),
4783 (MAINNET_AUSD.to_string(), 10_000),
4784 (MAINNET_USDB.to_string(), 10_000),
4785 ]);
4786 }
4787 }
4788 125 => {
4789 cfg.feature_flags.granular_post_execution_checks = true;
4790 if chain != Chain::Mainnet {
4791 cfg.feature_flags.timestamp_based_epoch_close = true;
4792 }
4793 }
4794 126 => {
4795 cfg.feature_flags.early_exit_on_iffw = true;
4796 }
4797 127 => {
4798 cfg.feature_flags.always_advance_dkg_to_resolution = true;
4799
4800 cfg.verify_bulletproofs_ristretto255_base_cost = Some(23866);
4801 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(1324);
4802 cfg.group_ops_ristretto_decode_scalar_cost = Some(5);
4803 cfg.group_ops_ristretto_decode_point_cost = Some(216);
4804 cfg.group_ops_ristretto_scalar_add_cost = Some(2);
4805 cfg.group_ops_ristretto_point_add_cost = Some(8);
4806 cfg.group_ops_ristretto_scalar_sub_cost = Some(2);
4807 cfg.group_ops_ristretto_point_sub_cost = Some(8);
4808 cfg.group_ops_ristretto_scalar_mul_cost = Some(5);
4809 cfg.group_ops_ristretto_point_mul_cost = Some(1763);
4810 cfg.group_ops_ristretto_scalar_div_cost = Some(557);
4811 cfg.group_ops_ristretto_point_div_cost = Some(2244);
4812
4813 if chain != Chain::Mainnet {
4814 cfg.feature_flags.enable_ristretto255_group_ops = true;
4815 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4816 }
4817
4818 cfg.feature_flags.timestamp_based_epoch_close = true;
4819 }
4820 128 => {
4821 cfg.max_generic_instantiation_type_nodes_per_function = Some(10_000);
4822 cfg.max_generic_instantiation_type_nodes_per_module = Some(500_000);
4823 cfg.binary_enum_defs = Some(200);
4824 cfg.binary_enum_def_instantiations = Some(100);
4825 }
4826 129 => {
4827 cfg.feature_flags.enable_unified_linkage = true;
4828 }
4829 130 => {
4830 cfg.feature_flags.record_net_unsettled_object_withdraws = true;
4831 cfg.feature_flags.enable_init_on_upgrade = true;
4832 cfg.epoch_close_deadline_ms = Some(120_000);
4833 cfg.scratch_add_cost_base = Some(13);
4834 cfg.scratch_read_cost_base = Some(13);
4835 cfg.scratch_read_value_cost = Some(1);
4836 cfg.scratch_remove_cost_base = Some(13);
4837 cfg.scratch_exists_cost_base = Some(13);
4838 cfg.scratch_exists_with_type_cost_base = Some(13);
4839 cfg.scratch_exists_with_type_type_cost = Some(1);
4840 let max_commands = cfg.max_programmable_tx_commands() as u64;
4841 cfg.max_scratch_pad_size = Some(16 * max_commands);
4842 if chain != Chain::Mainnet && chain != Chain::Testnet {
4844 cfg.feature_flags.zklogin_circuit_mode = 1;
4845 }
4846 }
4847 131 => {
4848 cfg.feature_flags.share_transaction_deny_config_in_consensus = true;
4849 cfg.feature_flags.framework_tx_context_mut_restrictions = true;
4850 }
4851 132 => {
4852 if chain != Chain::Mainnet && chain != Chain::Testnet {
4853 cfg.feature_flags.defer_owned_object_double_spend = true;
4854 cfg.feature_flags.create_forwarding_address_registry = true;
4855 }
4856 cfg.object_record_new_uid_from_hash_cost_base = Some(1);
4857 cfg.feature_flags
4858 .enable_order_independent_upgrade_init_linkage = true;
4859 }
4860 133 => {
4861 cfg.feature_flags
4862 .include_function_signatures_in_instantiation_limits = true;
4863 cfg.max_accumulator_type_nodes = Some(16);
4864 }
4865 134 => {
4866 if chain != Chain::Mainnet {
4873 cfg.package_original_package_id_impl_cost_base = Some(52);
4874 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4875 cfg.package_original_package_id_impl_cost_per_byte =
4876 Some(package_read_cost_per_byte);
4877
4878 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4879 cfg.consensus_max_num_transactions_in_block = Some(128);
4880 }
4881
4882 if chain == Chain::Mainnet {
4883 cfg.feature_flags.defer_unpaid_amplification = false;
4884 }
4885 }
4886 135 => {
4887 cfg.package_original_package_id_impl_cost_base = Some(52);
4890 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4891 cfg.package_original_package_id_impl_cost_per_byte =
4892 Some(package_read_cost_per_byte);
4893
4894 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4895 cfg.consensus_max_num_transactions_in_block = Some(128);
4896
4897 cfg.feature_flags.defer_unpaid_amplification = false;
4898 }
4899 136 => {
4900 cfg.feature_flags.ptb_tx_context_restrictions = true;
4901
4902 cfg.translation_per_live_reference_charge = Some(1);
4903 cfg.max_ptb_live_references = Some(64);
4904 cfg.max_ptb_returned_references = Some(16);
4905 cfg.max_ptb_total_returned_references = Some(256);
4906
4907 if chain != Chain::Mainnet && chain != Chain::Testnet {
4908 cfg.feature_flags.allowed_proposers = true;
4909 }
4910 cfg.feature_flags.harden_linkage_consistency = true;
4911
4912 cfg.package_arena_size_in_bytes = Some(10_000_000);
4913 }
4914 137 => {
4915 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(621);
4916 cfg.max_bulletproofs_total_bits = Some(1024);
4917
4918 if chain != Chain::Mainnet {
4919 cfg.feature_flags.enable_allowances = true;
4920 }
4921 cfg.feature_flags.fix_ptb_generated_reads = true;
4922 cfg.feature_flags.charge_ld_const_abstract_size = true;
4923 if chain != Chain::Mainnet && chain != Chain::Testnet {
4924 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4925 }
4926 cfg.reserve_object_funds_for_withdrawal_cost_base = Some(52);
4927 cfg.reserve_object_funds_for_withdrawal_cold_read_cost = Some(184);
4930
4931 cfg.feature_flags.allowed_proposers = true;
4932
4933 cfg.feature_flags.validate_ptb_argument_indices = true;
4934 cfg.feature_flags.memory_safety_invariant_check_v2 = true;
4935 }
4936 138 => {
4937 cfg.gas_model_version = Some(15);
4938 cfg.feature_flags.enable_allowances = true;
4939 if chain != Chain::Mainnet {
4940 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4941 cfg.feature_flags.disable_effects_tx_dependencies = true;
4942 }
4943 cfg.feature_flags.merge_colliding_deferrals = true;
4944 if chain == Chain::Mainnet {
4946 cfg.storage_rebate_rate = Some(9999);
4947 }
4948 }
4949 139 => {
4950 if chain != Chain::Mainnet && chain != Chain::Testnet {
4951 cfg.feature_flags.enable_forwarding_addresses = true;
4952 cfg.feature_flags.mldsa65_auth = true;
4953 }
4954 cfg.storage_rebate_rate = Some(9999);
4955 if chain != Chain::Mainnet {
4956 cfg.feature_flags.allow_dkg_completion_after_timeout = true;
4957 }
4958 cfg.obj_access_cost_read_per_package_kb = Some(154);
4960 }
4961 140 => {
4962 cfg.staggered_submission_signal_window_commits = Some(300);
4965 cfg.staggered_submission_signal_min_excess_copies_per_commit = Some(2);
4966 cfg.staggered_submission_signal_exit_dwell_commits = Some(6000);
4967 cfg.staggered_submission_signal_band1_enter_ratio_bps = Some(1000);
4968 cfg.staggered_submission_signal_band1_exit_ratio_bps = Some(500);
4969 cfg.staggered_submission_signal_band2_enter_ratio_bps = Some(5000);
4970 cfg.staggered_submission_signal_band2_exit_ratio_bps = Some(2500);
4971
4972 cfg.vector_reverse_base_cost = Some(52);
4973 cfg.vector_reverse_per_elem_cost = Some(8);
4974 cfg.vector_keep_range_base_cost = Some(52);
4975 cfg.vector_keep_range_per_dropped_elem_cost = Some(1);
4976 cfg.vector_keep_range_per_moved_elem_cost = Some(8);
4977 cfg.vector_copy_range_base_cost = Some(52);
4978 cfg.vector_replace_range_base_cost = Some(52);
4979 cfg.vector_replace_range_per_elem_cost = Some(8);
4980
4981 if chain != Chain::Mainnet && chain != Chain::Testnet {
4982 cfg.feature_flags.shuffle_consensus_commit_blocks = true;
4983 }
4984
4985 cfg.feature_flags.allow_references_in_ptbs = true;
4986 cfg.feature_flags.disable_id_leak_verifier = true;
4987 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4988 cfg.feature_flags.disable_effects_tx_dependencies = true;
4989 }
4990 141 => {
4991 cfg.feature_flags.complete_effects_size_estimate = true;
4992 cfg.max_num_accumulator_events = Some(1024);
4993 }
4994 142 => {
4995 cfg.clock_borrow_cost_base = Some(52);
4996 cfg.feature_flags.check_groth16_pvk_length = true;
4997 cfg.object_is_shared_input_cost_base = Some(52);
4998 cfg.feature_flags.secp256r1_ecrecover_checks_x_below_p = true;
4999 cfg.binary_format_limits_profile = Some(BinaryFormatLimitsProfile::V1);
5000 cfg.feature_flags.defer_owned_object_double_spend = true;
5001 }
5002 143 => {
5003 cfg.execution_version = Some(5);
5004 }
5005 _ => panic!("unsupported version {:?}", version),
5016 }
5017 }
5018
5019 cfg
5020 }
5021
5022 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
5023 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
5024 || !self.feature_flags.split_checkpoints_in_consensus_handler
5025 {
5026 return;
5027 }
5028
5029 if !mysten_common::in_test_configuration() {
5030 return;
5031 }
5032
5033 use rand::{Rng, SeedableRng, rngs::StdRng};
5034 let mut rng = StdRng::from_seed(*seed);
5035 let max_txns = rng.gen_range(10..=100u64);
5036 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
5037 self.max_transactions_per_checkpoint = Some(max_txns);
5038 }
5039
5040 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
5046 let (
5047 max_back_edges_per_function,
5048 max_back_edges_per_module,
5049 sanity_check_with_regex_reference_safety,
5050 ) = if let Some((
5051 max_back_edges_per_function,
5052 max_back_edges_per_module,
5053 sanity_check_with_regex_reference_safety,
5054 )) = signing_limits
5055 {
5056 (
5057 Some(max_back_edges_per_function),
5058 Some(max_back_edges_per_module),
5059 Some(sanity_check_with_regex_reference_safety),
5060 )
5061 } else {
5062 (None, None, None)
5063 };
5064
5065 let additional_borrow_checks = if signing_limits.is_some() {
5066 true
5068 } else {
5069 self.additional_borrow_checks()
5070 };
5071 let deprecate_global_storage_ops = if signing_limits.is_some() {
5072 true
5074 } else {
5075 self.deprecate_global_storage_ops()
5076 };
5077
5078 VerifierConfig {
5079 max_loop_depth: Some(self.max_loop_depth() as usize),
5080 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5081 max_function_parameters: Some(self.max_function_parameters() as usize),
5082 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5083 max_value_stack_size: self.max_value_stack_size() as usize,
5084 max_type_nodes: Some(self.max_type_nodes() as usize),
5085 max_generic_instantiation_type_nodes_per_function: self
5086 .max_generic_instantiation_type_nodes_per_function_as_option()
5087 .map(|v| v as usize),
5088 max_generic_instantiation_type_nodes_per_module: self
5089 .max_generic_instantiation_type_nodes_per_module_as_option()
5090 .map(|v| v as usize),
5091 include_function_signatures_in_instantiation_limits: self
5092 .include_function_signatures_in_instantiation_limits(),
5093 max_push_size: Some(self.max_push_size() as usize),
5094 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5095 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5096 max_function_definitions: Some(self.max_function_definitions() as usize),
5097 max_data_definitions: Some(self.max_struct_definitions() as usize),
5098 max_constant_vector_len: Some(self.max_move_vector_len()),
5099 max_back_edges_per_function,
5100 max_back_edges_per_module,
5101 max_basic_blocks_in_script: None,
5102 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5104 allow_receiving_object_id: self.allow_receiving_object_id(),
5105 reject_mutable_random_on_entry_functions: self
5106 .reject_mutable_random_on_entry_functions(),
5107 bytecode_version: self.move_binary_format_version(),
5108 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5109 additional_borrow_checks,
5110 better_loader_errors: self.better_loader_errors(),
5111 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5112 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5113 .map(|limit| limit as u128),
5114 deprecate_global_storage_ops,
5115 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5116 disable_id_leak_verifier: self.disable_id_leak_verifier(),
5117 switch_to_regex_reference_safety: false,
5118 framework_tx_context_mut_restrictions: self.framework_tx_context_mut_restrictions(),
5119 disallow_jump_orphans: self.disallow_jump_orphans(),
5120 }
5121 }
5122
5123 pub fn binary_config(
5124 &self,
5125 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5126 ) -> BinaryConfig {
5127 let deprecate_global_storage_ops =
5128 override_deprecate_global_storage_ops_during_deserialization
5129 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5130 BinaryConfig::new(
5131 self.move_binary_format_version(),
5132 self.min_move_binary_format_version_as_option()
5133 .unwrap_or(VERSION_1),
5134 self.no_extraneous_module_bytes(),
5135 deprecate_global_storage_ops,
5136 TableConfig {
5137 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5138 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5139 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5140 function_instantiations: self
5141 .binary_function_instantiations_as_option()
5142 .unwrap_or(u16::MAX),
5143 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5144 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5145 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5146 address_identifiers: self
5147 .binary_address_identifiers_as_option()
5148 .unwrap_or(u16::MAX),
5149 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5150 struct_def_instantiations: self
5151 .binary_struct_def_instantiations_as_option()
5152 .unwrap_or(u16::MAX),
5153 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5154 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5155 field_instantiations: self
5156 .binary_field_instantiations_as_option()
5157 .unwrap_or(u16::MAX),
5158 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5159 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5160 enum_def_instantiations: self
5161 .binary_enum_def_instantiations_as_option()
5162 .unwrap_or(u16::MAX),
5163 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5164 variant_instantiation_handles: self
5165 .binary_variant_instantiation_handles_as_option()
5166 .unwrap_or(u16::MAX),
5167 },
5168 self.binary_format_limits(),
5169 )
5170 }
5171
5172 pub fn binary_format_limits(
5173 &self,
5174 ) -> &'static move_binary_format::binary_config::BinaryFormatLimits {
5175 self.binary_format_limits_profile
5176 .unwrap_or(BinaryFormatLimitsProfile::LEGACY)
5177 .limits()
5178 }
5179
5180 pub fn apply_overrides_for_testing(
5184 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5185 ) -> OverrideGuard {
5186 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5187 assert!(cur.is_none(), "config override already present");
5188 *cur = Some(Box::new(override_fn));
5189 OverrideGuard
5190 }
5191
5192 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5193 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5194 warn!(
5195 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5196 );
5197 ret = override_fn(version, ret);
5198 }
5199 ret
5200 }
5201}
5202
5203impl ProtocolConfig {
5207 pub fn set_execution_version_for_testing(&mut self, val: u64) {
5211 let current = self.execution_version.unwrap_or(0);
5212 assert!(
5213 val >= current,
5214 "cannot downgrade execution_version from {current} to {val}: running an old \
5215 executor against a newer protocol config/framework is unsupported. To test \
5216 frozen executor behavior, start from the last protocol version of that executor \
5217 instead, so genesis loads the matching framework snapshot (see \
5218 test_address_balance_gas_v3_accumulator_sign)."
5219 );
5220 self.execution_version = Some(val);
5221 }
5222
5223 pub fn set_zklogin_circuit_mode_for_testing(&mut self, val: u64) {
5226 self.feature_flags.zklogin_circuit_mode = val
5227 }
5228
5229 pub fn set_per_object_congestion_control_mode_for_testing(
5230 &mut self,
5231 val: PerObjectCongestionControlMode,
5232 ) {
5233 self.feature_flags.per_object_congestion_control_mode = val;
5234 }
5235
5236 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5237 self.feature_flags.consensus_choice = val;
5238 }
5239
5240 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5241 self.feature_flags.consensus_network = val;
5242 }
5243
5244 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5245 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5246 }
5247
5248 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5249 self.feature_flags.mysticeti_num_leaders_per_round = val;
5250 }
5251
5252 pub fn disable_accumulators_for_testing(&mut self) {
5253 self.feature_flags.enable_accumulators = false;
5254 self.feature_flags.enable_address_balance_gas_payments = false;
5255 }
5256
5257 pub fn enable_coin_reservation_for_testing(&mut self) {
5258 self.feature_flags.enable_coin_reservation_obj_refs = true;
5259 self.feature_flags
5260 .convert_withdrawal_compatibility_ptb_arguments = true;
5261 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5264 }
5265
5266 pub fn disable_coin_reservation_for_testing(&mut self) {
5267 self.feature_flags.enable_coin_reservation_obj_refs = false;
5268 self.feature_flags
5269 .convert_withdrawal_compatibility_ptb_arguments = false;
5270 }
5271
5272 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5273 self.feature_flags.enable_accumulators = true;
5274 self.feature_flags.allow_private_accumulator_entrypoints = true;
5275 self.feature_flags.enable_address_balance_gas_payments = true;
5276 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5277 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5278 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5279 }
5280
5281 pub fn enable_gasless_for_testing(&mut self) {
5282 self.enable_address_balance_gas_payments_for_testing();
5283 self.feature_flags.enable_gasless = true;
5284 self.feature_flags.gasless_verify_remaining_balance = true;
5285 self.gasless_max_computation_units = Some(5_000);
5286 self.gasless_allowed_token_types = Some(vec![]);
5287 self.gasless_max_tps = Some(1000);
5288 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5289 }
5290
5291 pub fn disable_gasless_for_testing(&mut self) {
5292 self.feature_flags.enable_gasless = false;
5293 self.gasless_max_computation_units = None;
5294 self.gasless_allowed_token_types = None;
5295 }
5296
5297 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5298 self.feature_flags.enable_accumulators = true;
5299 self.feature_flags.enable_authenticated_event_streams = true;
5300 self.feature_flags
5301 .include_checkpoint_artifacts_digest_in_summary = true;
5302 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5303 }
5304}
5305
5306type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5307
5308static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5309
5310#[must_use]
5311pub struct OverrideGuard;
5312
5313impl Drop for OverrideGuard {
5314 fn drop(&mut self) {
5315 info!("restoring override fn");
5316 *CONFIG_OVERRIDE.lock().unwrap() = None;
5317 }
5318}
5319
5320#[derive(PartialEq, Eq)]
5323pub enum LimitThresholdCrossed {
5324 None,
5325 Soft(u128, u128),
5326 Hard(u128, u128),
5327}
5328
5329pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5332 x: T,
5333 soft_limit: U,
5334 hard_limit: V,
5335) -> LimitThresholdCrossed {
5336 let x: V = x.into();
5337 let soft_limit: V = soft_limit.into();
5338
5339 debug_assert!(soft_limit <= hard_limit);
5340
5341 if x >= hard_limit {
5344 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5345 } else if x < soft_limit {
5346 LimitThresholdCrossed::None
5347 } else {
5348 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5349 }
5350}
5351
5352#[macro_export]
5353macro_rules! check_limit {
5354 ($x:expr, $hard:expr) => {
5355 check_limit!($x, $hard, $hard)
5356 };
5357 ($x:expr, $soft:expr, $hard:expr) => {
5358 check_limit_in_range($x as u64, $soft, $hard)
5359 };
5360}
5361
5362#[macro_export]
5366macro_rules! check_limit_by_meter {
5367 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5368 let (h, metered_str) = if $is_metered {
5370 ($metered_limit, "metered")
5371 } else {
5372 ($unmetered_hard_limit, "unmetered")
5374 };
5375 use sui_protocol_config::check_limit_in_range;
5376 let result = check_limit_in_range($x as u64, $metered_limit, h);
5377 match result {
5378 LimitThresholdCrossed::None => {}
5379 LimitThresholdCrossed::Soft(_, _) => {
5380 $metric.with_label_values(&[metered_str, "soft"]).inc();
5381 }
5382 LimitThresholdCrossed::Hard(_, _) => {
5383 $metric.with_label_values(&[metered_str, "hard"]).inc();
5384 }
5385 };
5386 result
5387 }};
5388}
5389
5390pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5393
5394static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5395 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5396
5397static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5398 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5399
5400fn parse_amendments(json: &str) -> Arc<Amendments> {
5401 #[derive(serde::Deserialize)]
5402 struct AmendmentEntry {
5403 root: String,
5404 deps: Vec<DepEntry>,
5405 }
5406
5407 #[derive(serde::Deserialize)]
5408 struct DepEntry {
5409 original_id: String,
5410 version_id: String,
5411 }
5412
5413 let entries: Vec<AmendmentEntry> =
5414 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5415 let mut amendments = BTreeMap::new();
5416 for entry in entries {
5417 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5418 let mut dep_ids = BTreeMap::new();
5419 for dep in entry.deps {
5420 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5421 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5422 assert!(
5423 dep_ids.insert(orig_id, upgraded_id).is_none(),
5424 "Duplicate original ID in amendments table"
5425 );
5426 }
5427 assert!(
5428 amendments.insert(root_id, dep_ids).is_none(),
5429 "Duplicate root ID in amendments table"
5430 );
5431 }
5432 Arc::new(amendments)
5433}
5434
5435#[cfg(all(test, not(msim)))]
5436mod test {
5437 use insta::assert_yaml_snapshot;
5438
5439 use super::*;
5440
5441 #[test]
5442 fn snapshot_tests() {
5443 println!("\n============================================================================");
5444 println!("! !");
5445 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5446 println!("! !");
5447 println!("============================================================================\n");
5448 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5449 let chain_str = match chain_id {
5453 Chain::Unknown => "".to_string(),
5454 _ => format!("{:?}_", chain_id),
5455 };
5456 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5457 let cur = ProtocolVersion::new(i);
5458 assert_yaml_snapshot!(
5459 format!("{}version_{}", chain_str, cur.as_u64()),
5460 ProtocolConfig::get_for_version(cur, *chain_id)
5461 );
5462 }
5463 }
5464 }
5465
5466 #[test]
5467 fn binary_format_limits_profile_matches_protocol_version() {
5468 let v141 = ProtocolConfig::get_for_version(ProtocolVersion::new(141), Chain::Unknown);
5469 assert_eq!(
5470 v141.binary_format_limits(),
5471 BinaryFormatLimitsProfile::LEGACY.limits()
5472 );
5473
5474 let v142 = ProtocolConfig::get_for_version(ProtocolVersion::new(142), Chain::Unknown);
5475 assert_eq!(
5476 v142.binary_format_limits(),
5477 BinaryFormatLimitsProfile::V1.limits()
5478 );
5479 }
5480
5481 #[test]
5482 fn test_getters() {
5483 let prot: ProtocolConfig =
5484 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5485 assert_eq!(
5486 prot.max_arguments(),
5487 prot.max_arguments_as_option().unwrap()
5488 );
5489 }
5490
5491 #[test]
5492 fn vector_bulk_native_gas_costs_start_at_version_140() {
5493 for chain in [Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5494 let before = ProtocolConfig::get_for_version(ProtocolVersion::new(139), chain);
5495 assert_eq!(before.vector_reverse_base_cost_as_option(), None);
5496 assert_eq!(before.vector_reverse_per_elem_cost_as_option(), None);
5497 assert_eq!(before.vector_keep_range_base_cost_as_option(), None);
5498 assert_eq!(
5499 before.vector_keep_range_per_dropped_elem_cost_as_option(),
5500 None
5501 );
5502 assert_eq!(
5503 before.vector_keep_range_per_moved_elem_cost_as_option(),
5504 None
5505 );
5506 assert_eq!(before.vector_copy_range_base_cost_as_option(), None);
5507 assert_eq!(before.vector_replace_range_base_cost_as_option(), None);
5508 assert_eq!(before.vector_replace_range_per_elem_cost_as_option(), None);
5509
5510 let active = ProtocolConfig::get_for_version(ProtocolVersion::new(140), chain);
5511 assert_eq!(active.vector_reverse_base_cost_as_option(), Some(52));
5512 assert_eq!(active.vector_reverse_per_elem_cost_as_option(), Some(8));
5513 assert_eq!(active.vector_keep_range_base_cost_as_option(), Some(52));
5514 assert_eq!(
5515 active.vector_keep_range_per_dropped_elem_cost_as_option(),
5516 Some(1)
5517 );
5518 assert_eq!(
5519 active.vector_keep_range_per_moved_elem_cost_as_option(),
5520 Some(8)
5521 );
5522 assert_eq!(active.vector_copy_range_base_cost_as_option(), Some(52));
5523 assert_eq!(active.vector_replace_range_base_cost_as_option(), Some(52));
5524 assert_eq!(
5525 active.vector_replace_range_per_elem_cost_as_option(),
5526 Some(8)
5527 );
5528 }
5529 }
5530
5531 #[test]
5532 fn test_setters() {
5533 let mut prot: ProtocolConfig =
5534 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5535 prot.set_max_arguments_for_testing(123);
5536 assert_eq!(prot.max_arguments(), 123);
5537
5538 prot.set_max_arguments_from_str_for_testing("321".to_string());
5539 assert_eq!(prot.max_arguments(), 321);
5540
5541 prot.disable_max_arguments_for_testing();
5542 assert_eq!(prot.max_arguments_as_option(), None);
5543
5544 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5545 assert_eq!(prot.max_arguments(), 456);
5546 }
5547
5548 #[test]
5549 fn test_execution_version_setter_allows_upgrade() {
5550 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5551 let current = prot.execution_version();
5552 prot.set_execution_version_for_testing(current);
5553 prot.set_execution_version_for_testing(current + 1);
5554 assert_eq!(prot.execution_version(), current + 1);
5555 }
5556
5557 #[test]
5558 #[should_panic(expected = "cannot downgrade execution_version")]
5559 fn test_execution_version_setter_panics_on_downgrade() {
5560 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5561 let current = prot.execution_version();
5562 prot.set_execution_version_for_testing(current - 1);
5563 }
5564
5565 #[test]
5566 fn test_feature_flag_setter_by_string() {
5567 let mut prot: ProtocolConfig =
5568 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5569 assert!(!prot.zklogin_auth());
5570 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), true);
5571 assert!(prot.zklogin_auth());
5572 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), false);
5573 assert!(!prot.zklogin_auth());
5574 }
5575
5576 #[test]
5577 #[should_panic(expected = "unknown feature flag")]
5578 fn test_feature_flag_setter_unknown_flag() {
5579 let mut prot: ProtocolConfig =
5580 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5581 prot.set_feature_flag_for_testing("some random string".to_string(), true);
5582 }
5583
5584 #[test]
5585 fn test_get_for_version_if_supported_applies_test_overrides() {
5586 let before =
5587 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5588 .unwrap();
5589
5590 assert!(!before.enable_coin_reservation_obj_refs());
5591
5592 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5593 cfg.enable_coin_reservation_for_testing();
5594 cfg
5595 });
5596
5597 let after =
5598 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5599 .unwrap();
5600
5601 assert!(after.enable_coin_reservation_obj_refs());
5602 }
5603
5604 #[test]
5605 #[should_panic(expected = "unsupported version")]
5606 fn max_version_test() {
5607 let _ = ProtocolConfig::get_for_version_impl(
5610 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5611 Chain::Unknown,
5612 );
5613 }
5614
5615 #[test]
5616 fn lookup_by_string_test() {
5617 let prot: ProtocolConfig =
5618 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5619 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5621
5622 assert!(
5623 prot.lookup_attr("max_arguments".to_string())
5624 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5625 );
5626
5627 assert!(
5629 prot.lookup_attr("max_move_identifier_len".to_string())
5630 .is_none()
5631 );
5632
5633 let prot: ProtocolConfig =
5635 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5636 assert!(
5637 prot.lookup_attr("max_move_identifier_len".to_string())
5638 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5639 );
5640
5641 let prot: ProtocolConfig =
5642 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5643 assert!(
5645 prot.attr_map()
5646 .get("max_move_identifier_len")
5647 .unwrap()
5648 .is_none()
5649 );
5650 assert!(
5652 prot.attr_map().get("max_arguments").unwrap()
5653 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5654 );
5655
5656 let prot: ProtocolConfig =
5658 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5659 assert!(
5661 prot.feature_flags
5662 .lookup_attr("some random string".to_owned())
5663 .is_none()
5664 );
5665 assert!(
5666 !prot
5667 .feature_flags
5668 .attr_map()
5669 .contains_key("some random string")
5670 );
5671
5672 assert!(
5674 prot.feature_flags
5675 .lookup_attr("package_upgrades".to_owned())
5676 == Some(false)
5677 );
5678 assert!(
5679 prot.feature_flags
5680 .attr_map()
5681 .get("package_upgrades")
5682 .unwrap()
5683 == &false
5684 );
5685 let prot: ProtocolConfig =
5686 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5687 assert!(
5689 prot.feature_flags
5690 .lookup_attr("package_upgrades".to_owned())
5691 == Some(true)
5692 );
5693 assert!(
5694 prot.feature_flags
5695 .attr_map()
5696 .get("package_upgrades")
5697 .unwrap()
5698 == &true
5699 );
5700 }
5701
5702 #[test]
5703 fn limit_range_fn_test() {
5704 let low = 100u32;
5705 let high = 10000u64;
5706
5707 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5708 assert!(matches!(
5709 check_limit!(255u16, low, high),
5710 LimitThresholdCrossed::Soft(255u128, 100)
5711 ));
5712 assert!(matches!(
5718 check_limit!(2550000u64, low, high),
5719 LimitThresholdCrossed::Hard(2550000, 10000)
5720 ));
5721
5722 assert!(matches!(
5723 check_limit!(2550000u64, high, high),
5724 LimitThresholdCrossed::Hard(2550000, 10000)
5725 ));
5726
5727 assert!(matches!(
5728 check_limit!(1u8, high),
5729 LimitThresholdCrossed::None
5730 ));
5731
5732 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5733
5734 assert!(matches!(
5735 check_limit!(2550000u64, high),
5736 LimitThresholdCrossed::Hard(2550000, 10000)
5737 ));
5738 }
5739
5740 #[test]
5741 fn linkage_amendments_load() {
5742 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5743 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5744 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5745 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5746 }
5747
5748 #[test]
5749 fn render_scalar_fields_use_precision_safe_encoding() {
5750 use mysten_common::rpc_format::Unmetered;
5751
5752 let config = ProtocolConfig::get_for_max_version_UNSAFE();
5753 let rendered = config
5754 .render::<serde_json::Value>(&mut Unmetered)
5755 .expect("render should succeed");
5756
5757 let max_args = rendered
5758 .get("max_arguments")
5759 .expect("max_arguments set at max version");
5760 assert!(
5761 max_args.is_number(),
5762 "u32 should render as number, got {max_args:?}",
5763 );
5764
5765 let max_tx_size = rendered
5766 .get("max_tx_size_bytes")
5767 .expect("max_tx_size_bytes set at max version");
5768 assert!(
5769 max_tx_size.is_string(),
5770 "u64 should render as string, got {max_tx_size:?}",
5771 );
5772 }
5773
5774 #[test]
5775 fn render_includes_non_scalar_gasless_allowlist_as_json() {
5776 use mysten_common::rpc_format::Unmetered;
5777 use serde_json::json;
5778
5779 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5780 config.set_gasless_allowed_token_types_for_testing(vec![
5781 ("0xa::usdc::USDC".to_string(), 10_000),
5782 ("0xb::usdt::USDT".to_string(), 0),
5783 ]);
5784
5785 let rendered = config
5786 .render::<serde_json::Value>(&mut Unmetered)
5787 .expect("render should succeed under Unmetered budget");
5788 let allowlist = rendered
5789 .get("gasless_allowed_token_types")
5790 .expect("entry should be present after the testing setter");
5791
5792 assert_eq!(
5795 allowlist,
5796 &json!([["0xa::usdc::USDC", "10000"], ["0xb::usdt::USDT", "0"],]),
5797 );
5798 }
5799
5800 #[test]
5801 fn render_targets_prost_value_for_grpc() {
5802 use mysten_common::rpc_format::Unmetered;
5803 use prost_types::value::Kind;
5804
5805 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5806 config.set_gasless_allowed_token_types_for_testing(vec![(
5807 "0xa::usdc::USDC".to_string(),
5808 10_000,
5809 )]);
5810
5811 let rendered = config
5812 .render::<prost_types::Value>(&mut Unmetered)
5813 .expect("render to prost Value should succeed");
5814 let allowlist = rendered
5815 .get("gasless_allowed_token_types")
5816 .expect("entry should be present after the testing setter");
5817
5818 let Some(Kind::ListValue(outer)) = &allowlist.kind else {
5820 panic!(
5821 "expected ListValue at the top level, got {:?}",
5822 allowlist.kind
5823 );
5824 };
5825 assert_eq!(outer.values.len(), 1, "one allowlisted entry");
5826 let Some(Kind::ListValue(entry)) = &outer.values[0].kind else {
5827 panic!("expected each entry to be a ListValue");
5828 };
5829 assert_eq!(entry.values.len(), 2, "entry has (coin_type, amount)");
5830
5831 let Some(Kind::StringValue(coin_type)) = &entry.values[0].kind else {
5832 panic!("expected coin_type as StringValue");
5833 };
5834 assert_eq!(coin_type, "0xa::usdc::USDC");
5835
5836 let Some(Kind::StringValue(amount)) = &entry.values[1].kind else {
5838 panic!(
5839 "expected minimum_transfer_amount as StringValue (precision-safe u64); got {:?}",
5840 entry.values[1].kind,
5841 );
5842 };
5843 assert_eq!(amount, "10000");
5844 }
5845
5846 #[test]
5847 fn render_emits_null_for_unset_protocol_versions() {
5848 use mysten_common::rpc_format::Unmetered;
5849
5850 let config = ProtocolConfig::get_for_version(1.into(), Chain::Unknown);
5851 let rendered = config
5852 .render::<serde_json::Value>(&mut Unmetered)
5853 .expect("render should succeed");
5854 let entry = rendered
5858 .get("gasless_allowed_token_types")
5859 .expect("key should be present for every protocol version");
5860 assert!(
5861 entry.is_null(),
5862 "value should be null for pre-feature protocol version, got {entry:?}",
5863 );
5864 }
5865}