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")]
1345 package_publish_charge: bool,
1346
1347 #[serde(skip_serializing_if = "is_false")]
1350 #[skip_protocol_config_accessor]
1351 enable_allowances: bool,
1352
1353 #[serde(skip_serializing_if = "is_false")]
1355 fix_ptb_generated_reads: bool,
1356
1357 #[serde(skip_serializing_if = "is_false")]
1358 check_object_funds_withdraw_in_execution: bool,
1359 #[serde(skip_serializing_if = "is_false")]
1361 memory_safety_invariant_check_v2: bool,
1362
1363 #[serde(skip_serializing_if = "is_false")]
1365 disable_effects_tx_dependencies: bool,
1366
1367 #[serde(skip_serializing_if = "is_false")]
1371 merge_colliding_deferrals: bool,
1372
1373 #[serde(skip_serializing_if = "is_false")]
1377 shuffle_consensus_commit_blocks: bool,
1378
1379 #[serde(skip_serializing_if = "is_false")]
1382 disable_id_leak_verifier: bool,
1383}
1384
1385fn is_false(b: &bool) -> bool {
1386 !b
1387}
1388
1389fn is_empty(b: &BTreeSet<String>) -> bool {
1390 b.is_empty()
1391}
1392
1393fn is_zero(val: &u64) -> bool {
1394 *val == 0
1395}
1396
1397#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1399pub enum ConsensusTransactionOrdering {
1400 #[default]
1402 None,
1403 ByGasPrice,
1405}
1406
1407impl ConsensusTransactionOrdering {
1408 pub fn is_none(&self) -> bool {
1409 matches!(self, ConsensusTransactionOrdering::None)
1410 }
1411}
1412
1413#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1414pub struct ExecutionTimeEstimateParams {
1415 pub target_utilization: u64,
1417 pub allowed_txn_cost_overage_burst_limit_us: u64,
1421
1422 pub randomness_scalar: u64,
1425
1426 pub max_estimate_us: u64,
1428
1429 pub stored_observations_num_included_checkpoints: u64,
1432
1433 pub stored_observations_limit: u64,
1435
1436 #[serde(skip_serializing_if = "is_zero")]
1439 pub stake_weighted_median_threshold: u64,
1440
1441 #[serde(skip_serializing_if = "is_false")]
1445 pub default_none_duration_for_new_keys: bool,
1446
1447 #[serde(skip_serializing_if = "Option::is_none")]
1449 pub observations_chunk_size: Option<u64>,
1450}
1451
1452#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1454pub enum PerObjectCongestionControlMode {
1455 #[default]
1456 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1462
1463impl PerObjectCongestionControlMode {
1464 pub fn is_none(&self) -> bool {
1465 matches!(self, PerObjectCongestionControlMode::None)
1466 }
1467}
1468
1469#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1471pub enum ConsensusChoice {
1472 #[default]
1473 Narwhal,
1474 SwapEachEpoch,
1475 Mysticeti,
1476}
1477
1478impl ConsensusChoice {
1479 pub fn is_narwhal(&self) -> bool {
1480 matches!(self, ConsensusChoice::Narwhal)
1481 }
1482}
1483
1484#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1486pub enum ConsensusNetwork {
1487 #[default]
1488 Anemo,
1489 Tonic,
1490}
1491
1492impl ConsensusNetwork {
1493 pub fn is_anemo(&self) -> bool {
1494 matches!(self, ConsensusNetwork::Anemo)
1495 }
1496}
1497
1498#[skip_serializing_none]
1530#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1531pub struct ProtocolConfig {
1532 pub version: ProtocolVersion,
1533
1534 #[serde(skip)]
1539 chain: Chain,
1540
1541 feature_flags: FeatureFlags,
1542
1543 max_tx_size_bytes: Option<u64>,
1546
1547 max_input_objects: Option<u64>,
1549
1550 max_size_written_objects: Option<u64>,
1554 max_size_written_objects_system_tx: Option<u64>,
1557
1558 max_serialized_tx_effects_size_bytes: Option<u64>,
1560
1561 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1563
1564 max_gas_payment_objects: Option<u32>,
1566
1567 max_modules_in_publish: Option<u32>,
1569
1570 max_package_dependencies: Option<u32>,
1572
1573 max_arguments: Option<u32>,
1576
1577 max_type_arguments: Option<u32>,
1579
1580 max_type_argument_depth: Option<u32>,
1582
1583 max_pure_argument_size: Option<u32>,
1585
1586 max_programmable_tx_commands: Option<u32>,
1588
1589 move_binary_format_version: Option<u32>,
1592 min_move_binary_format_version: Option<u32>,
1593
1594 binary_module_handles: Option<u16>,
1596 binary_struct_handles: Option<u16>,
1597 binary_function_handles: Option<u16>,
1598 binary_function_instantiations: Option<u16>,
1599 binary_signatures: Option<u16>,
1600 binary_constant_pool: Option<u16>,
1601 binary_identifiers: Option<u16>,
1602 binary_address_identifiers: Option<u16>,
1603 binary_struct_defs: Option<u16>,
1604 binary_struct_def_instantiations: Option<u16>,
1605 binary_function_defs: Option<u16>,
1606 binary_field_handles: Option<u16>,
1607 binary_field_instantiations: Option<u16>,
1608 binary_friend_decls: Option<u16>,
1609 binary_enum_defs: Option<u16>,
1610 binary_enum_def_instantiations: Option<u16>,
1611 binary_variant_handles: Option<u16>,
1612 binary_variant_instantiation_handles: Option<u16>,
1613
1614 #[skip_accessor]
1616 binary_format_limits_profile: Option<BinaryFormatLimitsProfile>,
1617
1618 max_move_object_size: Option<u64>,
1620
1621 max_move_package_size: Option<u64>,
1624
1625 max_publish_or_upgrade_per_ptb: Option<u64>,
1627
1628 max_tx_gas: Option<u64>,
1630
1631 max_gas_price: Option<u64>,
1633
1634 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1637
1638 max_gas_computation_bucket: Option<u64>,
1640
1641 gas_rounding_step: Option<u64>,
1643
1644 max_loop_depth: Option<u64>,
1646
1647 max_generic_instantiation_length: Option<u64>,
1649
1650 max_function_parameters: Option<u64>,
1652
1653 max_basic_blocks: Option<u64>,
1655
1656 max_value_stack_size: Option<u64>,
1658
1659 max_type_nodes: Option<u64>,
1661
1662 max_generic_instantiation_type_nodes_per_function: Option<u64>,
1664
1665 max_generic_instantiation_type_nodes_per_module: Option<u64>,
1667
1668 max_accumulator_type_nodes: Option<u64>,
1670
1671 max_push_size: Option<u64>,
1673
1674 max_struct_definitions: Option<u64>,
1676
1677 max_function_definitions: Option<u64>,
1679
1680 max_fields_in_struct: Option<u64>,
1682
1683 max_dependency_depth: Option<u64>,
1685
1686 max_num_event_emit: Option<u64>,
1688
1689 max_num_accumulator_events: Option<u64>,
1693
1694 max_num_new_move_object_ids: Option<u64>,
1696
1697 max_num_new_move_object_ids_system_tx: Option<u64>,
1699
1700 max_num_deleted_move_object_ids: Option<u64>,
1702
1703 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1705
1706 max_num_transferred_move_object_ids: Option<u64>,
1708
1709 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1711
1712 max_event_emit_size: Option<u64>,
1714
1715 max_event_emit_size_total: Option<u64>,
1717
1718 max_move_vector_len: Option<u64>,
1720
1721 max_move_identifier_len: Option<u64>,
1723
1724 max_move_value_depth: Option<u64>,
1726
1727 package_arena_size_in_bytes: Option<u64>,
1730
1731 max_move_enum_variants: Option<u64>,
1733
1734 max_back_edges_per_function: Option<u64>,
1736
1737 max_back_edges_per_module: Option<u64>,
1739
1740 max_verifier_meter_ticks_per_function: Option<u64>,
1742
1743 max_meter_ticks_per_module: Option<u64>,
1745
1746 max_meter_ticks_per_package: Option<u64>,
1748
1749 object_runtime_max_num_cached_objects: Option<u64>,
1753
1754 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1756
1757 object_runtime_max_num_store_entries: Option<u64>,
1759
1760 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1762
1763 base_tx_cost_fixed: Option<u64>,
1766
1767 package_publish_cost_fixed: Option<u64>,
1770
1771 base_tx_cost_per_byte: Option<u64>,
1774
1775 package_publish_cost_per_byte: Option<u64>,
1777
1778 package_publish_charge_fixed: Option<u64>,
1780
1781 package_publish_charge_per_module: Option<u64>,
1783
1784 package_publish_charge_per_dependency: Option<u64>,
1786
1787 obj_access_cost_read_per_byte: Option<u64>,
1789
1790 obj_access_cost_read_per_package_kb: Option<u64>,
1793
1794 obj_access_cost_mutate_per_byte: Option<u64>,
1796
1797 obj_access_cost_delete_per_byte: Option<u64>,
1799
1800 obj_access_cost_verify_per_byte: Option<u64>,
1810
1811 max_type_to_layout_nodes: Option<u64>,
1813
1814 max_ptb_value_size: Option<u64>,
1816
1817 gas_model_version: Option<u64>,
1820
1821 obj_data_cost_refundable: Option<u64>,
1824
1825 obj_metadata_cost_non_refundable: Option<u64>,
1829
1830 storage_rebate_rate: Option<u64>,
1836
1837 storage_fund_reinvest_rate: Option<u64>,
1840
1841 reward_slashing_rate: Option<u64>,
1844
1845 storage_gas_price: Option<u64>,
1847
1848 accumulator_object_storage_cost: Option<u64>,
1850
1851 max_transactions_per_checkpoint: Option<u64>,
1856
1857 max_checkpoint_size_bytes: Option<u64>,
1861
1862 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1867
1868 address_from_bytes_cost_base: Option<u64>,
1873 address_to_u256_cost_base: Option<u64>,
1875 address_from_u256_cost_base: Option<u64>,
1877
1878 config_read_setting_impl_cost_base: Option<u64>,
1883 config_read_setting_impl_cost_per_byte: Option<u64>,
1884
1885 package_original_package_id_impl_cost_base: Option<u64>,
1886 package_original_package_id_impl_cost_per_byte: Option<u64>,
1887
1888 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1891 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1892 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1893 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1894 dynamic_field_add_child_object_cost_base: Option<u64>,
1896 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1897 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1898 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1899 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1901 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1902 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1903 dynamic_field_remove_child_object_cost_base: Option<u64>,
1905 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1906 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1907 dynamic_field_has_child_object_cost_base: Option<u64>,
1909 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1911 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1912 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1913
1914 scratch_add_cost_base: Option<u64>,
1917 scratch_read_cost_base: Option<u64>,
1919 scratch_read_value_cost: Option<u64>,
1920 scratch_remove_cost_base: Option<u64>,
1922 scratch_exists_cost_base: Option<u64>,
1924 scratch_exists_with_type_cost_base: Option<u64>,
1926 scratch_exists_with_type_type_cost: Option<u64>,
1927 max_scratch_pad_size: Option<u64>,
1929
1930 event_emit_cost_base: Option<u64>,
1933 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1934 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1935 event_emit_output_cost_per_byte: Option<u64>,
1936 event_emit_auth_stream_cost: Option<u64>,
1937
1938 reserve_object_funds_for_withdrawal_cost_base: Option<u64>,
1941 reserve_object_funds_for_withdrawal_cold_read_cost: Option<u64>,
1943
1944 object_borrow_uid_cost_base: Option<u64>,
1947 object_delete_impl_cost_base: Option<u64>,
1949 object_record_new_uid_cost_base: Option<u64>,
1951 object_record_new_uid_from_hash_cost_base: Option<u64>,
1954 object_is_shared_input_cost_base: Option<u64>,
1956
1957 transfer_transfer_internal_cost_base: Option<u64>,
1960 transfer_party_transfer_internal_cost_base: Option<u64>,
1962 transfer_freeze_object_cost_base: Option<u64>,
1964 transfer_share_object_cost_base: Option<u64>,
1966 transfer_receive_object_cost_base: Option<u64>,
1969 transfer_receive_object_cost_per_byte: Option<u64>,
1970 transfer_receive_object_type_cost_per_byte: Option<u64>,
1971
1972 tx_context_derive_id_cost_base: Option<u64>,
1975 tx_context_fresh_id_cost_base: Option<u64>,
1976 tx_context_sender_cost_base: Option<u64>,
1977 tx_context_epoch_cost_base: Option<u64>,
1978 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1979 tx_context_sponsor_cost_base: Option<u64>,
1980 tx_context_rgp_cost_base: Option<u64>,
1981 tx_context_gas_price_cost_base: Option<u64>,
1982 tx_context_gas_budget_cost_base: Option<u64>,
1983 tx_context_ids_created_cost_base: Option<u64>,
1984 tx_context_replace_cost_base: Option<u64>,
1985
1986 clock_borrow_cost_base: Option<u64>,
1989
1990 types_is_one_time_witness_cost_base: Option<u64>,
1993 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1994 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1995
1996 validator_validate_metadata_cost_base: Option<u64>,
1999 validator_validate_metadata_data_cost_per_byte: Option<u64>,
2000
2001 crypto_invalid_arguments_cost: Option<u64>,
2003 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
2005 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
2006 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
2007
2008 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
2010 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
2011 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
2012
2013 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
2015 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2016 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2017 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
2018 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2019 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2020
2021 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
2023
2024 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
2026 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2027 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
2028 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
2029 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
2030 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
2031
2032 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
2034 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2035 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2036 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
2037 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2038 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2039
2040 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
2042 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2043 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
2044 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
2045 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
2046 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
2047
2048 ecvrf_ecvrf_verify_cost_base: Option<u64>,
2050 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
2051 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
2052
2053 ed25519_ed25519_verify_cost_base: Option<u64>,
2055 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
2056 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
2057
2058 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
2060 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
2061
2062 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
2064 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
2065 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
2066 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
2067 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
2068
2069 hash_blake2b256_cost_base: Option<u64>,
2071 hash_blake2b256_data_cost_per_byte: Option<u64>,
2072 hash_blake2b256_data_cost_per_block: Option<u64>,
2073
2074 hash_keccak256_cost_base: Option<u64>,
2076 hash_keccak256_data_cost_per_byte: Option<u64>,
2077 hash_keccak256_data_cost_per_block: Option<u64>,
2078
2079 poseidon_bn254_cost_base: Option<u64>,
2081 poseidon_bn254_cost_per_block: Option<u64>,
2082
2083 group_ops_bls12381_decode_scalar_cost: Option<u64>,
2085 group_ops_bls12381_decode_g1_cost: Option<u64>,
2086 group_ops_bls12381_decode_g2_cost: Option<u64>,
2087 group_ops_bls12381_decode_gt_cost: Option<u64>,
2088 group_ops_bls12381_scalar_add_cost: Option<u64>,
2089 group_ops_bls12381_g1_add_cost: Option<u64>,
2090 group_ops_bls12381_g2_add_cost: Option<u64>,
2091 group_ops_bls12381_gt_add_cost: Option<u64>,
2092 group_ops_bls12381_scalar_sub_cost: Option<u64>,
2093 group_ops_bls12381_g1_sub_cost: Option<u64>,
2094 group_ops_bls12381_g2_sub_cost: Option<u64>,
2095 group_ops_bls12381_gt_sub_cost: Option<u64>,
2096 group_ops_bls12381_scalar_mul_cost: Option<u64>,
2097 group_ops_bls12381_g1_mul_cost: Option<u64>,
2098 group_ops_bls12381_g2_mul_cost: Option<u64>,
2099 group_ops_bls12381_gt_mul_cost: Option<u64>,
2100 group_ops_bls12381_scalar_div_cost: Option<u64>,
2101 group_ops_bls12381_g1_div_cost: Option<u64>,
2102 group_ops_bls12381_g2_div_cost: Option<u64>,
2103 group_ops_bls12381_gt_div_cost: Option<u64>,
2104 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
2105 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
2106 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
2107 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
2108 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
2109 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
2110 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
2111 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
2112 group_ops_bls12381_msm_max_len: Option<u32>,
2113 group_ops_bls12381_pairing_cost: Option<u64>,
2114 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
2115 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
2116 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
2117 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
2118 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
2119
2120 group_ops_ristretto_decode_scalar_cost: Option<u64>,
2121 group_ops_ristretto_decode_point_cost: Option<u64>,
2122 group_ops_ristretto_scalar_add_cost: Option<u64>,
2123 group_ops_ristretto_point_add_cost: Option<u64>,
2124 group_ops_ristretto_scalar_sub_cost: Option<u64>,
2125 group_ops_ristretto_point_sub_cost: Option<u64>,
2126 group_ops_ristretto_scalar_mul_cost: Option<u64>,
2127 group_ops_ristretto_point_mul_cost: Option<u64>,
2128 group_ops_ristretto_scalar_div_cost: Option<u64>,
2129 group_ops_ristretto_point_div_cost: Option<u64>,
2130
2131 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
2132 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
2133 max_bulletproofs_total_bits: Option<u64>,
2136
2137 hmac_hmac_sha3_256_cost_base: Option<u64>,
2139 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
2140 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
2141
2142 check_zklogin_id_cost_base: Option<u64>,
2144 check_zklogin_issuer_cost_base: Option<u64>,
2146
2147 vdf_verify_vdf_cost: Option<u64>,
2148 vdf_hash_to_input_cost: Option<u64>,
2149
2150 nitro_attestation_parse_base_cost: Option<u64>,
2152 nitro_attestation_parse_cost_per_byte: Option<u64>,
2153 nitro_attestation_verify_base_cost: Option<u64>,
2154 nitro_attestation_verify_cost_per_cert: Option<u64>,
2155
2156 bcs_per_byte_serialized_cost: Option<u64>,
2158 bcs_legacy_min_output_size_cost: Option<u64>,
2159 bcs_failure_cost: Option<u64>,
2160
2161 hash_sha2_256_base_cost: Option<u64>,
2162 hash_sha2_256_per_byte_cost: Option<u64>,
2163 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
2164 hash_sha3_256_base_cost: Option<u64>,
2165 hash_sha3_256_per_byte_cost: Option<u64>,
2166 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
2167 type_name_get_base_cost: Option<u64>,
2168 type_name_get_per_byte_cost: Option<u64>,
2169 type_name_id_base_cost: Option<u64>,
2170
2171 string_check_utf8_base_cost: Option<u64>,
2172 string_check_utf8_per_byte_cost: Option<u64>,
2173 string_is_char_boundary_base_cost: Option<u64>,
2174 string_sub_string_base_cost: Option<u64>,
2175 string_sub_string_per_byte_cost: Option<u64>,
2176 string_index_of_base_cost: Option<u64>,
2177 string_index_of_per_byte_pattern_cost: Option<u64>,
2178 string_index_of_per_byte_searched_cost: Option<u64>,
2179
2180 vector_empty_base_cost: Option<u64>,
2181 vector_length_base_cost: Option<u64>,
2182 vector_push_back_base_cost: Option<u64>,
2183 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
2184 vector_borrow_base_cost: Option<u64>,
2185 vector_pop_back_base_cost: Option<u64>,
2186 vector_destroy_empty_base_cost: Option<u64>,
2187 vector_swap_base_cost: Option<u64>,
2188 vector_reverse_base_cost: Option<u64>,
2189 vector_reverse_per_elem_cost: Option<u64>,
2190 vector_keep_range_base_cost: Option<u64>,
2191 vector_keep_range_per_dropped_elem_cost: Option<u64>,
2192 vector_keep_range_per_moved_elem_cost: Option<u64>,
2193 vector_copy_range_base_cost: Option<u64>,
2194 vector_replace_range_base_cost: Option<u64>,
2195 vector_replace_range_per_elem_cost: Option<u64>,
2196 debug_print_base_cost: Option<u64>,
2197 debug_print_stack_trace_base_cost: Option<u64>,
2198
2199 #[custom_setter]
2209 execution_version: Option<u64>,
2210
2211 consensus_bad_nodes_stake_threshold: Option<u64>,
2215
2216 max_jwk_votes_per_validator_per_epoch: Option<u64>,
2217 max_age_of_jwk_in_epochs: Option<u64>,
2221
2222 random_beacon_reduction_allowed_delta: Option<u16>,
2226
2227 random_beacon_reduction_lower_bound: Option<u32>,
2230
2231 random_beacon_dkg_timeout_round: Option<u32>,
2234
2235 random_beacon_min_round_interval_ms: Option<u64>,
2237
2238 random_beacon_dkg_version: Option<u64>,
2241
2242 consensus_max_transaction_size_bytes: Option<u64>,
2245 consensus_max_transactions_in_block_bytes: Option<u64>,
2247 consensus_max_num_transactions_in_block: Option<u64>,
2249
2250 consensus_voting_rounds: Option<u32>,
2252
2253 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
2255
2256 max_deferral_rounds_for_congestion_control: Option<u64>,
2259
2260 epoch_close_deadline_ms: Option<u64>,
2265
2266 max_txn_cost_overage_per_object_in_commit: Option<u64>,
2268
2269 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
2271
2272 min_checkpoint_interval_ms: Option<u64>,
2274
2275 checkpoint_summary_version_specific_data: Option<u64>,
2277
2278 max_soft_bundle_size: Option<u64>,
2280
2281 bridge_should_try_to_finalize_committee: Option<bool>,
2285
2286 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2292
2293 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2296
2297 consensus_gc_depth: Option<u32>,
2300
2301 gas_budget_based_txn_cost_cap_factor: Option<u64>,
2303
2304 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
2306
2307 sip_45_consensus_amplification_threshold: Option<u64>,
2310
2311 staggered_submission_signal_window_commits: Option<u64>,
2314 staggered_submission_signal_min_excess_copies_per_commit: Option<u64>,
2316 staggered_submission_signal_exit_dwell_commits: Option<u64>,
2319 staggered_submission_signal_band1_enter_ratio_bps: Option<u64>,
2322 staggered_submission_signal_band1_exit_ratio_bps: Option<u64>,
2323 staggered_submission_signal_band2_enter_ratio_bps: Option<u64>,
2324 staggered_submission_signal_band2_exit_ratio_bps: Option<u64>,
2325
2326 use_object_per_epoch_marker_table_v2: Option<bool>,
2329
2330 consensus_commit_rate_estimation_window_size: Option<u32>,
2332
2333 #[serde(skip_serializing_if = "Vec::is_empty")]
2337 aliased_addresses: Vec<AliasedAddress>,
2338
2339 translation_per_command_base_charge: Option<u64>,
2342
2343 translation_per_input_base_charge: Option<u64>,
2346
2347 translation_pure_input_per_byte_charge: Option<u64>,
2349
2350 translation_per_type_node_charge: Option<u64>,
2354
2355 translation_per_reference_node_charge: Option<u64>,
2358
2359 translation_per_linkage_entry_charge: Option<u64>,
2362
2363 max_updates_per_settlement_txn: Option<u32>,
2365
2366 gasless_max_computation_units: Option<u64>,
2368
2369 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
2371
2372 gasless_max_unused_inputs: Option<u64>,
2376
2377 gasless_max_pure_input_bytes: Option<u64>,
2380
2381 gasless_max_tps: Option<u64>,
2383
2384 #[serde(skip_serializing_if = "Option::is_none")]
2385 #[skip_accessor]
2386 include_special_package_amendments: Option<Arc<Amendments>>,
2387
2388 gasless_max_tx_size_bytes: Option<u64>,
2391
2392 translation_per_live_reference_charge: Option<u64>,
2395
2396 max_ptb_live_references: Option<u64>,
2399
2400 max_ptb_returned_references: Option<u64>,
2403
2404 max_ptb_total_returned_references: Option<u64>,
2407}
2408
2409#[derive(Clone, Serialize, Deserialize, Debug)]
2411pub struct AliasedAddress {
2412 pub original: [u8; 32],
2414 pub aliased: [u8; 32],
2416 pub allowed_tx_digests: Vec<[u8; 32]>,
2418}
2419
2420impl ProtocolConfig {
2422 pub fn chain(&self) -> Chain {
2424 self.chain
2425 }
2426
2427 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2440 if self.feature_flags.package_upgrades {
2441 Ok(())
2442 } else {
2443 Err(Error(format!(
2444 "package upgrades are not supported at {:?}",
2445 self.version
2446 )))
2447 }
2448 }
2449
2450 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2451 &self.feature_flags.zklogin_supported_providers
2452 }
2453
2454 pub fn zklogin_circuit_mode(&self) -> u64 {
2457 self.feature_flags.zklogin_circuit_mode
2458 }
2459
2460 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2461 self.feature_flags.consensus_transaction_ordering
2462 }
2463
2464 pub fn enable_jwk_consensus_updates(&self) -> bool {
2465 let ret = self.feature_flags.enable_jwk_consensus_updates;
2466 if ret {
2467 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2469 }
2470 ret
2471 }
2472
2473 pub fn staggered_submission_signal(&self) -> bool {
2474 let ret = self.feature_flags.staggered_submission_signal;
2475 if ret {
2476 assert!(self.feature_flags.allowed_proposers);
2479 }
2480 ret
2481 }
2482
2483 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2484 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2485 if !ret {
2486 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2488 }
2489 ret
2490 }
2491
2492 pub fn dkg_version(&self) -> u64 {
2493 self.random_beacon_dkg_version.unwrap_or(1)
2495 }
2496
2497 pub fn bridge(&self) -> bool {
2498 let ret = self.feature_flags.bridge;
2499 if ret {
2500 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2502 }
2503 ret
2504 }
2505
2506 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2507 if !self.bridge() {
2508 return false;
2509 }
2510 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2512 }
2513
2514 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2515 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2516 }
2517
2518 pub fn enable_allowances(&self) -> bool {
2519 self.feature_flags.enable_allowances && self.enable_accumulators()
2520 }
2521
2522 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2523 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2524 }
2525
2526 pub fn enable_authenticated_event_streams(&self) -> bool {
2527 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2528 }
2529
2530 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2531 self.feature_flags.per_object_congestion_control_mode
2532 }
2533
2534 pub fn consensus_choice(&self) -> ConsensusChoice {
2535 self.feature_flags.consensus_choice
2536 }
2537
2538 pub fn consensus_network(&self) -> ConsensusNetwork {
2539 self.feature_flags.consensus_network
2540 }
2541
2542 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2543 self.feature_flags.mysticeti_num_leaders_per_round
2544 }
2545
2546 pub fn max_transaction_size_bytes(&self) -> u64 {
2547 self.consensus_max_transaction_size_bytes
2549 .unwrap_or(256 * 1024)
2550 }
2551
2552 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2553 if cfg!(msim) {
2554 256 * 1024
2555 } else {
2556 self.consensus_max_transactions_in_block_bytes
2557 .unwrap_or(512 * 1024)
2558 }
2559 }
2560
2561 pub fn max_num_transactions_in_block(&self) -> u64 {
2562 if cfg!(msim) {
2563 8
2564 } else {
2565 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2566 }
2567 }
2568
2569 pub fn gc_depth(&self) -> u32 {
2570 self.consensus_gc_depth.unwrap_or(0)
2571 }
2572
2573 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2574 let res = self.feature_flags.consensus_linearize_subdag_v2;
2575 assert!(
2576 !res || self.gc_depth() > 0,
2577 "The consensus linearize sub dag V2 requires GC to be enabled"
2578 );
2579 res
2580 }
2581
2582 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2583 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2584 assert!(
2585 !res || self.gc_depth() > 0,
2586 "The consensus median based commit timestamp requires GC to be enabled"
2587 );
2588 res
2589 }
2590
2591 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2592 self.consensus_commit_rate_estimation_window_size
2593 .unwrap_or(0)
2594 }
2595
2596 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2597 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2601 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2603 window_size
2604 }
2605
2606 pub fn address_aliases(&self) -> bool {
2607 let address_aliases = self.feature_flags.address_aliases;
2608 assert!(
2609 !address_aliases || self.mysticeti_fastpath(),
2610 "Address aliases requires Mysticeti fastpath to be enabled"
2611 );
2612 if address_aliases {
2613 assert!(
2614 self.feature_flags.disable_preconsensus_locking,
2615 "Address aliases requires CertifiedTransaction to be disabled"
2616 );
2617 }
2618 address_aliases
2619 }
2620
2621 pub fn new_vm_enabled(&self) -> bool {
2622 self.execution_version.is_some_and(|v| v >= 4)
2623 }
2624
2625 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2626 debug_assert!(self.gasless_allowed_token_types.is_some());
2627 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2628 }
2629
2630 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2631 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2632 }
2633
2634 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2635 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2636 }
2637
2638 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2639 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2640 }
2641
2642 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2643 &self.include_special_package_amendments
2644 }
2645}
2646
2647static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2648
2649impl ProtocolConfig {
2651 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2653 assert!(
2655 version >= ProtocolVersion::MIN,
2656 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2657 version,
2658 ProtocolVersion::MIN.0,
2659 );
2660 assert!(
2661 version <= ProtocolVersion::MAX_ALLOWED,
2662 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2663 version,
2664 ProtocolVersion::MAX_ALLOWED.0,
2665 );
2666
2667 let mut ret = Self::get_for_version_impl(version, chain);
2668 ret.version = version;
2669 ret.chain = chain;
2670
2671 ret = Self::apply_config_override(version, ret);
2672
2673 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2674 warn!(
2675 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2676 );
2677 let overrides: ProtocolConfigOptional =
2678 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2679 .expect("failed to parse ProtocolConfig override env variables");
2680 overrides.apply_to(&mut ret);
2681 }
2682
2683 ret
2684 }
2685
2686 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2689 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2690 let mut ret = Self::get_for_version_impl(version, chain);
2691 ret.version = version;
2692 ret.chain = chain;
2693 ret = Self::apply_config_override(version, ret);
2694 Some(ret)
2695 } else {
2696 None
2697 }
2698 }
2699
2700 pub fn poison_get_for_min_version() {
2701 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2702 }
2703
2704 fn load_poison_get_for_min_version() -> bool {
2705 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2706 }
2707
2708 pub fn get_for_min_version() -> Self {
2711 if Self::load_poison_get_for_min_version() {
2712 panic!("get_for_min_version called on validator");
2713 }
2714 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2715 }
2716
2717 #[allow(non_snake_case)]
2727 pub fn get_for_max_version_UNSAFE() -> Self {
2728 if Self::load_poison_get_for_min_version() {
2729 panic!("get_for_max_version_UNSAFE called on validator");
2730 }
2731 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2732 }
2733
2734 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2735 #[cfg(msim)]
2736 {
2737 if version == ProtocolVersion::MAX_ALLOWED {
2739 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2740 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2741 return config;
2742 }
2743 }
2744
2745 let mut cfg = Self {
2748 version,
2750 chain,
2751
2752 feature_flags: Default::default(),
2754
2755 max_tx_size_bytes: Some(128 * 1024),
2756 max_input_objects: Some(2048),
2758 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2759 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2760 max_gas_payment_objects: Some(256),
2761 max_modules_in_publish: Some(128),
2762 max_package_dependencies: None,
2763 max_arguments: Some(512),
2764 max_type_arguments: Some(16),
2765 max_type_argument_depth: Some(16),
2766 max_pure_argument_size: Some(16 * 1024),
2767 max_programmable_tx_commands: Some(1024),
2768 move_binary_format_version: Some(6),
2769 min_move_binary_format_version: None,
2770 binary_module_handles: None,
2771 binary_struct_handles: None,
2772 binary_function_handles: None,
2773 binary_function_instantiations: None,
2774 binary_signatures: None,
2775 binary_constant_pool: None,
2776 binary_identifiers: None,
2777 binary_address_identifiers: None,
2778 binary_struct_defs: None,
2779 binary_struct_def_instantiations: None,
2780 binary_function_defs: None,
2781 binary_field_handles: None,
2782 binary_field_instantiations: None,
2783 binary_friend_decls: None,
2784 binary_enum_defs: None,
2785 binary_enum_def_instantiations: None,
2786 binary_variant_handles: None,
2787 binary_variant_instantiation_handles: None,
2788 binary_format_limits_profile: None,
2789 max_move_object_size: Some(250 * 1024),
2790 max_move_package_size: Some(100 * 1024),
2791 max_publish_or_upgrade_per_ptb: None,
2792 max_tx_gas: Some(10_000_000_000),
2793 max_gas_price: Some(100_000),
2794 max_gas_price_rgp_factor_for_aborted_transactions: None,
2795 max_gas_computation_bucket: Some(5_000_000),
2796 max_loop_depth: Some(5),
2797 max_generic_instantiation_length: Some(32),
2798 max_function_parameters: Some(128),
2799 max_basic_blocks: Some(1024),
2800 max_value_stack_size: Some(1024),
2801 max_type_nodes: Some(256),
2802 max_generic_instantiation_type_nodes_per_function: None,
2803 max_generic_instantiation_type_nodes_per_module: None,
2804 max_accumulator_type_nodes: None,
2805 max_push_size: Some(10000),
2806 max_struct_definitions: Some(200),
2807 max_function_definitions: Some(1000),
2808 max_fields_in_struct: Some(32),
2809 max_dependency_depth: Some(100),
2810 max_num_event_emit: Some(256),
2811 max_num_accumulator_events: None,
2812 max_num_new_move_object_ids: Some(2048),
2813 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2814 max_num_deleted_move_object_ids: Some(2048),
2815 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2816 max_num_transferred_move_object_ids: Some(2048),
2817 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2818 max_event_emit_size: Some(250 * 1024),
2819 max_move_vector_len: Some(256 * 1024),
2820 max_type_to_layout_nodes: None,
2821 max_ptb_value_size: None,
2822
2823 max_back_edges_per_function: Some(10_000),
2824 max_back_edges_per_module: Some(10_000),
2825 max_verifier_meter_ticks_per_function: Some(6_000_000),
2826 max_meter_ticks_per_module: Some(6_000_000),
2827 max_meter_ticks_per_package: None,
2828
2829 object_runtime_max_num_cached_objects: Some(1000),
2830 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2831 object_runtime_max_num_store_entries: Some(1000),
2832 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2833 base_tx_cost_fixed: Some(110_000),
2834 package_publish_cost_fixed: Some(1_000),
2835 base_tx_cost_per_byte: Some(0),
2836 package_publish_cost_per_byte: Some(80),
2837 package_publish_charge_fixed: None,
2838 package_publish_charge_per_module: None,
2839 package_publish_charge_per_dependency: None,
2840 obj_access_cost_read_per_byte: Some(15),
2841 obj_access_cost_read_per_package_kb: None,
2842 obj_access_cost_mutate_per_byte: Some(40),
2843 obj_access_cost_delete_per_byte: Some(40),
2844 obj_access_cost_verify_per_byte: Some(200),
2845 obj_data_cost_refundable: Some(100),
2846 obj_metadata_cost_non_refundable: Some(50),
2847 gas_model_version: Some(1),
2848 storage_rebate_rate: Some(9900),
2849 storage_fund_reinvest_rate: Some(500),
2850 reward_slashing_rate: Some(5000),
2851 storage_gas_price: Some(1),
2852 accumulator_object_storage_cost: None,
2853 max_transactions_per_checkpoint: Some(10_000),
2854 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2855
2856 buffer_stake_for_protocol_upgrade_bps: Some(0),
2859
2860 address_from_bytes_cost_base: Some(52),
2864 address_to_u256_cost_base: Some(52),
2866 address_from_u256_cost_base: Some(52),
2868
2869 config_read_setting_impl_cost_base: None,
2872 config_read_setting_impl_cost_per_byte: None,
2873
2874 package_original_package_id_impl_cost_base: None,
2875 package_original_package_id_impl_cost_per_byte: None,
2876
2877 dynamic_field_hash_type_and_key_cost_base: Some(100),
2880 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2881 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2882 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2883 dynamic_field_add_child_object_cost_base: Some(100),
2885 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2886 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2887 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2888 dynamic_field_borrow_child_object_cost_base: Some(100),
2890 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2891 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2892 dynamic_field_remove_child_object_cost_base: Some(100),
2894 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2895 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2896 dynamic_field_has_child_object_cost_base: Some(100),
2898 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2900 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2901 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2902
2903 scratch_add_cost_base: None,
2905 scratch_read_cost_base: None,
2906 scratch_read_value_cost: None,
2907 scratch_remove_cost_base: None,
2908 scratch_exists_cost_base: None,
2909 scratch_exists_with_type_cost_base: None,
2910 scratch_exists_with_type_type_cost: None,
2911 max_scratch_pad_size: None,
2912
2913 event_emit_cost_base: Some(52),
2916 event_emit_value_size_derivation_cost_per_byte: Some(2),
2917 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2918 event_emit_output_cost_per_byte: Some(10),
2919 event_emit_auth_stream_cost: None,
2920
2921 reserve_object_funds_for_withdrawal_cost_base: None,
2923 reserve_object_funds_for_withdrawal_cold_read_cost: None,
2924
2925 object_borrow_uid_cost_base: Some(52),
2928 object_delete_impl_cost_base: Some(52),
2930 object_record_new_uid_cost_base: Some(52),
2932 object_record_new_uid_from_hash_cost_base: None,
2935 object_is_shared_input_cost_base: None,
2938
2939 transfer_transfer_internal_cost_base: Some(52),
2942 transfer_party_transfer_internal_cost_base: None,
2944 transfer_freeze_object_cost_base: Some(52),
2946 transfer_share_object_cost_base: Some(52),
2948 transfer_receive_object_cost_base: None,
2949 transfer_receive_object_type_cost_per_byte: None,
2950 transfer_receive_object_cost_per_byte: None,
2951
2952 tx_context_derive_id_cost_base: Some(52),
2955 tx_context_fresh_id_cost_base: None,
2956 tx_context_sender_cost_base: None,
2957 tx_context_epoch_cost_base: None,
2958 tx_context_epoch_timestamp_ms_cost_base: None,
2959 tx_context_sponsor_cost_base: None,
2960 tx_context_rgp_cost_base: None,
2961 tx_context_gas_price_cost_base: None,
2962 tx_context_gas_budget_cost_base: None,
2963 tx_context_ids_created_cost_base: None,
2964 tx_context_replace_cost_base: None,
2965
2966 clock_borrow_cost_base: None,
2968
2969 types_is_one_time_witness_cost_base: Some(52),
2972 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2973 types_is_one_time_witness_type_cost_per_byte: Some(2),
2974
2975 validator_validate_metadata_cost_base: Some(52),
2978 validator_validate_metadata_data_cost_per_byte: Some(2),
2979
2980 crypto_invalid_arguments_cost: Some(100),
2982 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2984 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2985 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2986
2987 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2989 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2990 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2991
2992 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2994 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2995 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2996 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2997 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2998 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2999
3000 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3002
3003 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3005 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3006 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3007 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3008 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3009 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3010
3011 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3013 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3014 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3015 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3016 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3017 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3018
3019 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3021 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3022 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3023 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3024 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3025 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3026
3027 ecvrf_ecvrf_verify_cost_base: Some(52),
3029 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3030 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3031
3032 ed25519_ed25519_verify_cost_base: Some(52),
3034 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3035 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3036
3037 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3039 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3040
3041 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3043 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3044 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3045 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3046 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3047
3048 hash_blake2b256_cost_base: Some(52),
3050 hash_blake2b256_data_cost_per_byte: Some(2),
3051 hash_blake2b256_data_cost_per_block: Some(2),
3052
3053 hash_keccak256_cost_base: Some(52),
3055 hash_keccak256_data_cost_per_byte: Some(2),
3056 hash_keccak256_data_cost_per_block: Some(2),
3057
3058 poseidon_bn254_cost_base: None,
3059 poseidon_bn254_cost_per_block: None,
3060
3061 hmac_hmac_sha3_256_cost_base: Some(52),
3063 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3064 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3065
3066 group_ops_bls12381_decode_scalar_cost: None,
3068 group_ops_bls12381_decode_g1_cost: None,
3069 group_ops_bls12381_decode_g2_cost: None,
3070 group_ops_bls12381_decode_gt_cost: None,
3071 group_ops_bls12381_scalar_add_cost: None,
3072 group_ops_bls12381_g1_add_cost: None,
3073 group_ops_bls12381_g2_add_cost: None,
3074 group_ops_bls12381_gt_add_cost: None,
3075 group_ops_bls12381_scalar_sub_cost: None,
3076 group_ops_bls12381_g1_sub_cost: None,
3077 group_ops_bls12381_g2_sub_cost: None,
3078 group_ops_bls12381_gt_sub_cost: None,
3079 group_ops_bls12381_scalar_mul_cost: None,
3080 group_ops_bls12381_g1_mul_cost: None,
3081 group_ops_bls12381_g2_mul_cost: None,
3082 group_ops_bls12381_gt_mul_cost: None,
3083 group_ops_bls12381_scalar_div_cost: None,
3084 group_ops_bls12381_g1_div_cost: None,
3085 group_ops_bls12381_g2_div_cost: None,
3086 group_ops_bls12381_gt_div_cost: None,
3087 group_ops_bls12381_g1_hash_to_base_cost: None,
3088 group_ops_bls12381_g2_hash_to_base_cost: None,
3089 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3090 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3091 group_ops_bls12381_g1_msm_base_cost: None,
3092 group_ops_bls12381_g2_msm_base_cost: None,
3093 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3094 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3095 group_ops_bls12381_msm_max_len: None,
3096 group_ops_bls12381_pairing_cost: None,
3097 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3098 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3099 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3100 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3101 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3102
3103 group_ops_ristretto_decode_scalar_cost: None,
3104 group_ops_ristretto_decode_point_cost: None,
3105 group_ops_ristretto_scalar_add_cost: None,
3106 group_ops_ristretto_point_add_cost: None,
3107 group_ops_ristretto_scalar_sub_cost: None,
3108 group_ops_ristretto_point_sub_cost: None,
3109 group_ops_ristretto_scalar_mul_cost: None,
3110 group_ops_ristretto_point_mul_cost: None,
3111 group_ops_ristretto_scalar_div_cost: None,
3112 group_ops_ristretto_point_div_cost: None,
3113
3114 verify_bulletproofs_ristretto255_base_cost: None,
3115 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3116 max_bulletproofs_total_bits: None,
3117
3118 check_zklogin_id_cost_base: None,
3120 check_zklogin_issuer_cost_base: None,
3122
3123 vdf_verify_vdf_cost: None,
3124 vdf_hash_to_input_cost: None,
3125
3126 nitro_attestation_parse_base_cost: None,
3128 nitro_attestation_parse_cost_per_byte: None,
3129 nitro_attestation_verify_base_cost: None,
3130 nitro_attestation_verify_cost_per_cert: None,
3131
3132 bcs_per_byte_serialized_cost: None,
3133 bcs_legacy_min_output_size_cost: None,
3134 bcs_failure_cost: None,
3135 hash_sha2_256_base_cost: None,
3136 hash_sha2_256_per_byte_cost: None,
3137 hash_sha2_256_legacy_min_input_len_cost: None,
3138 hash_sha3_256_base_cost: None,
3139 hash_sha3_256_per_byte_cost: None,
3140 hash_sha3_256_legacy_min_input_len_cost: None,
3141 type_name_get_base_cost: None,
3142 type_name_get_per_byte_cost: None,
3143 type_name_id_base_cost: None,
3144 string_check_utf8_base_cost: None,
3145 string_check_utf8_per_byte_cost: None,
3146 string_is_char_boundary_base_cost: None,
3147 string_sub_string_base_cost: None,
3148 string_sub_string_per_byte_cost: None,
3149 string_index_of_base_cost: None,
3150 string_index_of_per_byte_pattern_cost: None,
3151 string_index_of_per_byte_searched_cost: None,
3152 vector_empty_base_cost: None,
3153 vector_length_base_cost: None,
3154 vector_push_back_base_cost: None,
3155 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3156 vector_borrow_base_cost: None,
3157 vector_pop_back_base_cost: None,
3158 vector_destroy_empty_base_cost: None,
3159 vector_swap_base_cost: None,
3160 vector_reverse_base_cost: None,
3161 vector_reverse_per_elem_cost: None,
3162 vector_keep_range_base_cost: None,
3163 vector_keep_range_per_dropped_elem_cost: None,
3164 vector_keep_range_per_moved_elem_cost: None,
3165 vector_copy_range_base_cost: None,
3166 vector_replace_range_base_cost: None,
3167 vector_replace_range_per_elem_cost: None,
3168 debug_print_base_cost: None,
3169 debug_print_stack_trace_base_cost: None,
3170
3171 max_size_written_objects: None,
3172 max_size_written_objects_system_tx: None,
3173
3174 max_move_identifier_len: None,
3181 max_move_value_depth: None,
3182 package_arena_size_in_bytes: None,
3183 max_move_enum_variants: None,
3184
3185 gas_rounding_step: None,
3186
3187 execution_version: None,
3188
3189 max_event_emit_size_total: None,
3190
3191 consensus_bad_nodes_stake_threshold: None,
3192
3193 max_jwk_votes_per_validator_per_epoch: None,
3194
3195 max_age_of_jwk_in_epochs: None,
3196
3197 random_beacon_reduction_allowed_delta: None,
3198
3199 random_beacon_reduction_lower_bound: None,
3200
3201 random_beacon_dkg_timeout_round: None,
3202
3203 random_beacon_min_round_interval_ms: None,
3204
3205 random_beacon_dkg_version: None,
3206
3207 consensus_max_transaction_size_bytes: None,
3208
3209 consensus_max_transactions_in_block_bytes: None,
3210
3211 consensus_max_num_transactions_in_block: None,
3212
3213 consensus_voting_rounds: None,
3214
3215 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3216
3217 max_deferral_rounds_for_congestion_control: None,
3218
3219 epoch_close_deadline_ms: None,
3220
3221 max_txn_cost_overage_per_object_in_commit: None,
3222
3223 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3224
3225 min_checkpoint_interval_ms: None,
3226
3227 checkpoint_summary_version_specific_data: None,
3228
3229 max_soft_bundle_size: None,
3230
3231 bridge_should_try_to_finalize_committee: None,
3232
3233 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3234
3235 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3236
3237 consensus_gc_depth: None,
3238
3239 gas_budget_based_txn_cost_cap_factor: None,
3240
3241 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3242
3243 sip_45_consensus_amplification_threshold: None,
3244 staggered_submission_signal_window_commits: None,
3245 staggered_submission_signal_min_excess_copies_per_commit: None,
3246 staggered_submission_signal_exit_dwell_commits: None,
3247 staggered_submission_signal_band1_enter_ratio_bps: None,
3248 staggered_submission_signal_band1_exit_ratio_bps: None,
3249 staggered_submission_signal_band2_enter_ratio_bps: None,
3250 staggered_submission_signal_band2_exit_ratio_bps: None,
3251
3252 use_object_per_epoch_marker_table_v2: None,
3253
3254 consensus_commit_rate_estimation_window_size: None,
3255
3256 aliased_addresses: vec![],
3257
3258 translation_per_command_base_charge: None,
3259 translation_per_input_base_charge: None,
3260 translation_pure_input_per_byte_charge: None,
3261 translation_per_type_node_charge: None,
3262 translation_per_reference_node_charge: None,
3263 translation_per_linkage_entry_charge: None,
3264 translation_per_live_reference_charge: None,
3265 max_ptb_live_references: None,
3266 max_ptb_returned_references: None,
3267 max_ptb_total_returned_references: None,
3268
3269 max_updates_per_settlement_txn: None,
3270
3271 gasless_max_computation_units: None,
3272 gasless_allowed_token_types: None,
3273 gasless_max_unused_inputs: None,
3274 gasless_max_pure_input_bytes: None,
3275 gasless_max_tps: None,
3276 include_special_package_amendments: None,
3277 gasless_max_tx_size_bytes: None,
3278 };
3281 for cur in 2..=version.0 {
3282 match cur {
3283 1 => unreachable!(),
3284 2 => {
3285 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3286 }
3287 3 => {
3288 cfg.gas_model_version = Some(2);
3290 cfg.max_tx_gas = Some(50_000_000_000);
3292 cfg.base_tx_cost_fixed = Some(2_000);
3294 cfg.storage_gas_price = Some(76);
3296 cfg.feature_flags.loaded_child_objects_fixed = true;
3297 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3300 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3303 cfg.feature_flags.package_upgrades = true;
3304 }
3305 4 => {
3310 cfg.reward_slashing_rate = Some(10000);
3312 cfg.gas_model_version = Some(3);
3314 }
3315 5 => {
3316 cfg.feature_flags.missing_type_is_compatibility_error = true;
3317 cfg.gas_model_version = Some(4);
3318 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3319 }
3323 6 => {
3324 cfg.gas_model_version = Some(5);
3325 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3326 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3327 }
3328 7 => {
3329 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3330 cfg.feature_flags
3331 .disable_invariant_violation_check_in_swap_loc = true;
3332 cfg.feature_flags.ban_entry_init = true;
3333 cfg.feature_flags.package_digest_hash_module = true;
3334 }
3335 8 => {
3336 cfg.feature_flags
3337 .disallow_change_struct_type_params_on_upgrade = true;
3338 }
3339 9 => {
3340 cfg.max_move_identifier_len = Some(128);
3342 cfg.feature_flags.no_extraneous_module_bytes = true;
3343 cfg.feature_flags
3344 .advance_to_highest_supported_protocol_version = true;
3345 }
3346 10 => {
3347 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3348 cfg.max_meter_ticks_per_module = Some(16_000_000);
3349 }
3350 11 => {
3351 cfg.max_move_value_depth = Some(128);
3352 }
3353 12 => {
3354 cfg.feature_flags.narwhal_versioned_metadata = true;
3355 if chain != Chain::Mainnet {
3356 cfg.feature_flags.commit_root_state_digest = true;
3357 }
3358
3359 if chain != Chain::Mainnet && chain != Chain::Testnet {
3360 cfg.feature_flags.zklogin_auth = true;
3361 }
3362 }
3363 13 => {}
3364 14 => {
3365 cfg.gas_rounding_step = Some(1_000);
3366 cfg.gas_model_version = Some(6);
3367 }
3368 15 => {
3369 cfg.feature_flags.consensus_transaction_ordering =
3370 ConsensusTransactionOrdering::ByGasPrice;
3371 }
3372 16 => {
3373 cfg.feature_flags.simplified_unwrap_then_delete = true;
3374 }
3375 17 => {
3376 cfg.feature_flags.upgraded_multisig_supported = true;
3377 }
3378 18 => {
3379 cfg.execution_version = Some(1);
3380 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3389 cfg.base_tx_cost_fixed = Some(1_000);
3391 }
3392 19 => {
3393 cfg.max_num_event_emit = Some(1024);
3394 cfg.max_event_emit_size_total = Some(
3397 256 * 250 * 1024, );
3399 }
3400 20 => {
3401 cfg.feature_flags.commit_root_state_digest = true;
3402
3403 if chain != Chain::Mainnet {
3404 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3405 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3406 }
3407 }
3408
3409 21 => {
3410 if chain != Chain::Mainnet {
3411 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3412 "Google".to_string(),
3413 "Facebook".to_string(),
3414 "Twitch".to_string(),
3415 ]);
3416 }
3417 }
3418 22 => {
3419 cfg.feature_flags.loaded_child_object_format = true;
3420 }
3421 23 => {
3422 cfg.feature_flags.loaded_child_object_format_type = true;
3423 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3424 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3430 }
3431 24 => {
3432 cfg.feature_flags.simple_conservation_checks = true;
3433 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3434
3435 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3436
3437 if chain != Chain::Mainnet {
3438 cfg.feature_flags.enable_jwk_consensus_updates = true;
3439 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3441 cfg.max_age_of_jwk_in_epochs = Some(1);
3442 }
3443 }
3444 25 => {
3445 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3447 "Google".to_string(),
3448 "Facebook".to_string(),
3449 "Twitch".to_string(),
3450 ]);
3451 cfg.feature_flags.zklogin_auth = true;
3452
3453 cfg.feature_flags.enable_jwk_consensus_updates = true;
3455 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3456 cfg.max_age_of_jwk_in_epochs = Some(1);
3457 }
3458 26 => {
3459 cfg.gas_model_version = Some(7);
3460 if chain != Chain::Mainnet && chain != Chain::Testnet {
3462 cfg.transfer_receive_object_cost_base = Some(52);
3463 cfg.feature_flags.receive_objects = true;
3464 }
3465 }
3466 27 => {
3467 cfg.gas_model_version = Some(8);
3468 }
3469 28 => {
3470 cfg.check_zklogin_id_cost_base = Some(200);
3472 cfg.check_zklogin_issuer_cost_base = Some(200);
3474
3475 if chain != Chain::Mainnet && chain != Chain::Testnet {
3477 cfg.feature_flags.enable_effects_v2 = true;
3478 }
3479 }
3480 29 => {
3481 cfg.feature_flags.verify_legacy_zklogin_address = true;
3482 }
3483 30 => {
3484 if chain != Chain::Mainnet {
3486 cfg.feature_flags.narwhal_certificate_v2 = true;
3487 }
3488
3489 cfg.random_beacon_reduction_allowed_delta = Some(800);
3490 if chain != Chain::Mainnet {
3492 cfg.feature_flags.enable_effects_v2 = true;
3493 }
3494
3495 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3499
3500 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3501 }
3502 31 => {
3503 cfg.execution_version = Some(2);
3504 if chain != Chain::Mainnet && chain != Chain::Testnet {
3506 cfg.feature_flags.shared_object_deletion = true;
3507 }
3508 }
3509 32 => {
3510 if chain != Chain::Mainnet {
3512 cfg.feature_flags.accept_zklogin_in_multisig = true;
3513 }
3514 if chain != Chain::Mainnet {
3516 cfg.transfer_receive_object_cost_base = Some(52);
3517 cfg.feature_flags.receive_objects = true;
3518 }
3519 if chain != Chain::Mainnet && chain != Chain::Testnet {
3521 cfg.feature_flags.random_beacon = true;
3522 cfg.random_beacon_reduction_lower_bound = Some(1600);
3523 cfg.random_beacon_dkg_timeout_round = Some(3000);
3524 cfg.random_beacon_min_round_interval_ms = Some(150);
3525 }
3526 if chain != Chain::Testnet && chain != Chain::Mainnet {
3528 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3529 }
3530
3531 cfg.feature_flags.narwhal_certificate_v2 = true;
3533 }
3534 33 => {
3535 cfg.feature_flags.hardened_otw_check = true;
3536 cfg.feature_flags.allow_receiving_object_id = true;
3537
3538 cfg.transfer_receive_object_cost_base = Some(52);
3540 cfg.feature_flags.receive_objects = true;
3541
3542 if chain != Chain::Mainnet {
3544 cfg.feature_flags.shared_object_deletion = true;
3545 }
3546
3547 cfg.feature_flags.enable_effects_v2 = true;
3548 }
3549 34 => {}
3550 35 => {
3551 if chain != Chain::Mainnet && chain != Chain::Testnet {
3553 cfg.feature_flags.enable_poseidon = true;
3554 cfg.poseidon_bn254_cost_base = Some(260);
3555 cfg.poseidon_bn254_cost_per_block = Some(10);
3556 }
3557
3558 cfg.feature_flags.enable_coin_deny_list = true;
3559 }
3560 36 => {
3561 if chain != Chain::Mainnet && chain != Chain::Testnet {
3563 cfg.feature_flags.enable_group_ops_native_functions = true;
3564 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3565 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3567 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3568 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3569 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3570 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3571 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3572 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3573 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3574 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3575 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3576 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3577 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3578 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3579 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3580 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3581 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3582 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3583 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3584 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3585 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3586 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3587 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3588 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3589 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3590 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3591 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3592 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3593 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3594 cfg.group_ops_bls12381_msm_max_len = Some(32);
3595 cfg.group_ops_bls12381_pairing_cost = Some(52);
3596 }
3597 cfg.feature_flags.shared_object_deletion = true;
3599
3600 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3602 }
3604 37 => {
3605 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3606
3607 if chain != Chain::Mainnet {
3609 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3610 }
3611 }
3612 38 => {
3613 cfg.binary_module_handles = Some(100);
3614 cfg.binary_struct_handles = Some(300);
3615 cfg.binary_function_handles = Some(1500);
3616 cfg.binary_function_instantiations = Some(750);
3617 cfg.binary_signatures = Some(1000);
3618 cfg.binary_constant_pool = Some(4000);
3622 cfg.binary_identifiers = Some(10000);
3623 cfg.binary_address_identifiers = Some(100);
3624 cfg.binary_struct_defs = Some(200);
3625 cfg.binary_struct_def_instantiations = Some(100);
3626 cfg.binary_function_defs = Some(1000);
3627 cfg.binary_field_handles = Some(500);
3628 cfg.binary_field_instantiations = Some(250);
3629 cfg.binary_friend_decls = Some(100);
3630 cfg.max_package_dependencies = Some(32);
3632 cfg.max_modules_in_publish = Some(64);
3633 cfg.execution_version = Some(3);
3635 }
3636 39 => {
3637 }
3639 40 => {}
3640 41 => {
3641 cfg.feature_flags.enable_group_ops_native_functions = true;
3643 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3645 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3646 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3647 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3648 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3649 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3650 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3651 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3652 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3653 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3654 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3655 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3656 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3657 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3658 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3659 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3660 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3661 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3662 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3663 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3664 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3665 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3666 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3667 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3668 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3669 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3670 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3671 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3672 cfg.group_ops_bls12381_msm_max_len = Some(32);
3673 cfg.group_ops_bls12381_pairing_cost = Some(52);
3674 }
3675 42 => {}
3676 43 => {
3677 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3678 cfg.max_meter_ticks_per_package = Some(16_000_000);
3679 }
3680 44 => {
3681 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3683 if chain != Chain::Mainnet {
3685 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3686 }
3687 }
3688 45 => {
3689 if chain != Chain::Testnet && chain != Chain::Mainnet {
3691 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3692 }
3693
3694 if chain != Chain::Mainnet {
3695 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3697 }
3698 cfg.min_move_binary_format_version = Some(6);
3699 cfg.feature_flags.accept_zklogin_in_multisig = true;
3700
3701 if chain != Chain::Mainnet && chain != Chain::Testnet {
3705 cfg.feature_flags.bridge = true;
3706 }
3707 }
3708 46 => {
3709 if chain != Chain::Mainnet {
3711 cfg.feature_flags.bridge = true;
3712 }
3713
3714 cfg.feature_flags.reshare_at_same_initial_version = true;
3716 }
3717 47 => {}
3718 48 => {
3719 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3721
3722 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3724
3725 if chain != Chain::Mainnet {
3727 cfg.feature_flags.random_beacon = true;
3728 cfg.random_beacon_reduction_lower_bound = Some(1600);
3729 cfg.random_beacon_dkg_timeout_round = Some(3000);
3730 cfg.random_beacon_min_round_interval_ms = Some(200);
3731 }
3732
3733 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3735 }
3736 49 => {
3737 if chain != Chain::Testnet && chain != Chain::Mainnet {
3738 cfg.move_binary_format_version = Some(7);
3739 }
3740
3741 if chain != Chain::Mainnet && chain != Chain::Testnet {
3743 cfg.feature_flags.enable_vdf = true;
3744 cfg.vdf_verify_vdf_cost = Some(1500);
3747 cfg.vdf_hash_to_input_cost = Some(100);
3748 }
3749
3750 if chain != Chain::Testnet && chain != Chain::Mainnet {
3752 cfg.feature_flags
3753 .record_consensus_determined_version_assignments_in_prologue = true;
3754 }
3755
3756 if chain != Chain::Mainnet {
3758 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3759 }
3760
3761 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3763 }
3764 50 => {
3765 if chain != Chain::Mainnet {
3767 cfg.checkpoint_summary_version_specific_data = Some(1);
3768 cfg.min_checkpoint_interval_ms = Some(200);
3769 }
3770
3771 if chain != Chain::Testnet && chain != Chain::Mainnet {
3773 cfg.feature_flags
3774 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3775 }
3776
3777 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3778
3779 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3781 }
3782 51 => {
3783 cfg.random_beacon_dkg_version = Some(1);
3784
3785 if chain != Chain::Testnet && chain != Chain::Mainnet {
3786 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3787 }
3788 }
3789 52 => {
3790 if chain != Chain::Mainnet {
3791 cfg.feature_flags.soft_bundle = true;
3792 cfg.max_soft_bundle_size = Some(5);
3793 }
3794
3795 cfg.config_read_setting_impl_cost_base = Some(100);
3796 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3797
3798 if chain != Chain::Testnet && chain != Chain::Mainnet {
3800 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3801 cfg.feature_flags.per_object_congestion_control_mode =
3802 PerObjectCongestionControlMode::TotalTxCount;
3803 }
3804
3805 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3807
3808 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3810
3811 cfg.checkpoint_summary_version_specific_data = Some(1);
3813 cfg.min_checkpoint_interval_ms = Some(200);
3814
3815 if chain != Chain::Mainnet {
3817 cfg.feature_flags
3818 .record_consensus_determined_version_assignments_in_prologue = true;
3819 cfg.feature_flags
3820 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3821 }
3822 if chain != Chain::Mainnet {
3824 cfg.move_binary_format_version = Some(7);
3825 }
3826
3827 if chain != Chain::Testnet && chain != Chain::Mainnet {
3828 cfg.feature_flags.passkey_auth = true;
3829 }
3830 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3831 }
3832 53 => {
3833 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3835
3836 cfg.feature_flags
3838 .record_consensus_determined_version_assignments_in_prologue = true;
3839 cfg.feature_flags
3840 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3841
3842 if chain == Chain::Unknown {
3843 cfg.feature_flags.authority_capabilities_v2 = true;
3844 }
3845
3846 if chain != Chain::Mainnet {
3848 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3849 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3850 cfg.feature_flags.per_object_congestion_control_mode =
3851 PerObjectCongestionControlMode::TotalTxCount;
3852 }
3853
3854 cfg.bcs_per_byte_serialized_cost = Some(2);
3856 cfg.bcs_legacy_min_output_size_cost = Some(1);
3857 cfg.bcs_failure_cost = Some(52);
3858 cfg.debug_print_base_cost = Some(52);
3859 cfg.debug_print_stack_trace_base_cost = Some(52);
3860 cfg.hash_sha2_256_base_cost = Some(52);
3861 cfg.hash_sha2_256_per_byte_cost = Some(2);
3862 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3863 cfg.hash_sha3_256_base_cost = Some(52);
3864 cfg.hash_sha3_256_per_byte_cost = Some(2);
3865 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3866 cfg.type_name_get_base_cost = Some(52);
3867 cfg.type_name_get_per_byte_cost = Some(2);
3868 cfg.string_check_utf8_base_cost = Some(52);
3869 cfg.string_check_utf8_per_byte_cost = Some(2);
3870 cfg.string_is_char_boundary_base_cost = Some(52);
3871 cfg.string_sub_string_base_cost = Some(52);
3872 cfg.string_sub_string_per_byte_cost = Some(2);
3873 cfg.string_index_of_base_cost = Some(52);
3874 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3875 cfg.string_index_of_per_byte_searched_cost = Some(2);
3876 cfg.vector_empty_base_cost = Some(52);
3877 cfg.vector_length_base_cost = Some(52);
3878 cfg.vector_push_back_base_cost = Some(52);
3879 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3880 cfg.vector_borrow_base_cost = Some(52);
3881 cfg.vector_pop_back_base_cost = Some(52);
3882 cfg.vector_destroy_empty_base_cost = Some(52);
3883 cfg.vector_swap_base_cost = Some(52);
3884 }
3885 54 => {
3886 cfg.feature_flags.random_beacon = true;
3888 cfg.random_beacon_reduction_lower_bound = Some(1000);
3889 cfg.random_beacon_dkg_timeout_round = Some(3000);
3890 cfg.random_beacon_min_round_interval_ms = Some(500);
3891
3892 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3894 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3895 cfg.feature_flags.per_object_congestion_control_mode =
3896 PerObjectCongestionControlMode::TotalTxCount;
3897
3898 cfg.feature_flags.soft_bundle = true;
3900 cfg.max_soft_bundle_size = Some(5);
3901 }
3902 55 => {
3903 cfg.move_binary_format_version = Some(7);
3905
3906 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3908 cfg.consensus_max_num_transactions_in_block = Some(512);
3911
3912 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3913 }
3914 56 => {
3915 if chain == Chain::Mainnet {
3916 cfg.feature_flags.bridge = true;
3917 }
3918 }
3919 57 => {
3920 cfg.random_beacon_reduction_lower_bound = Some(800);
3922 }
3923 58 => {
3924 if chain == Chain::Mainnet {
3925 cfg.bridge_should_try_to_finalize_committee = Some(true);
3926 }
3927
3928 if chain != Chain::Mainnet && chain != Chain::Testnet {
3929 cfg.feature_flags
3931 .consensus_distributed_vote_scoring_strategy = true;
3932 }
3933 }
3934 59 => {
3935 cfg.feature_flags.consensus_round_prober = true;
3937 }
3938 60 => {
3939 cfg.max_type_to_layout_nodes = Some(512);
3940 cfg.feature_flags.validate_identifier_inputs = true;
3941 }
3942 61 => {
3943 if chain != Chain::Mainnet {
3944 cfg.feature_flags
3946 .consensus_distributed_vote_scoring_strategy = true;
3947 }
3948 cfg.random_beacon_reduction_lower_bound = Some(700);
3950
3951 if chain != Chain::Mainnet && chain != Chain::Testnet {
3952 cfg.feature_flags.mysticeti_fastpath = true;
3954 }
3955 }
3956 62 => {
3957 cfg.feature_flags.relocate_event_module = true;
3958 }
3959 63 => {
3960 cfg.feature_flags.per_object_congestion_control_mode =
3961 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3962 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3963 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3964 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3965 }
3966 64 => {
3967 cfg.feature_flags.per_object_congestion_control_mode =
3968 PerObjectCongestionControlMode::TotalTxCount;
3969 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3970 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3971 }
3972 65 => {
3973 cfg.feature_flags
3975 .consensus_distributed_vote_scoring_strategy = true;
3976 }
3977 66 => {
3978 if chain == Chain::Mainnet {
3979 cfg.feature_flags
3981 .consensus_distributed_vote_scoring_strategy = false;
3982 }
3983 }
3984 67 => {
3985 cfg.feature_flags
3987 .consensus_distributed_vote_scoring_strategy = true;
3988 }
3989 68 => {
3990 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3991 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3992 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3993 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3994 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3995
3996 if chain != Chain::Mainnet && chain != Chain::Testnet {
3997 cfg.feature_flags.uncompressed_g1_group_elements = true;
3998 }
3999
4000 cfg.feature_flags.per_object_congestion_control_mode =
4001 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4002 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4003 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4004 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4005 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4007 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4008
4009 cfg.random_beacon_reduction_lower_bound = Some(500);
4011
4012 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4013 }
4014 69 => {
4015 cfg.consensus_voting_rounds = Some(40);
4017
4018 if chain != Chain::Mainnet && chain != Chain::Testnet {
4019 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4021 }
4022
4023 if chain != Chain::Mainnet {
4024 cfg.feature_flags.uncompressed_g1_group_elements = true;
4025 }
4026 }
4027 70 => {
4028 if chain != Chain::Mainnet {
4029 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4031 cfg.feature_flags
4033 .consensus_round_prober_probe_accepted_rounds = true;
4034 }
4035
4036 cfg.poseidon_bn254_cost_per_block = Some(388);
4037
4038 cfg.gas_model_version = Some(9);
4039 cfg.feature_flags.native_charging_v2 = true;
4040 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4041 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4042 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4043 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4044 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4045 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4046 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4047 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4048
4049 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4051 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4052 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4053 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4054
4055 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4056 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4057 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4058 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4059 Some(8213);
4060 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4061 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4062 Some(9484);
4063
4064 cfg.hash_keccak256_cost_base = Some(10);
4065 cfg.hash_blake2b256_cost_base = Some(10);
4066
4067 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4069 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4070 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4071 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4072
4073 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4074 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4075 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4076 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4077
4078 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4079 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4080 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4081 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4082
4083 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4084 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4085 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4086 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4087
4088 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4089 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4090 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4091 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4092
4093 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4094 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4095
4096 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4097 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4098 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4099 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4100
4101 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4102 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4103 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4104 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4105
4106 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4107 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4108
4109 cfg.validator_validate_metadata_cost_base = Some(20000);
4110 }
4111 71 => {
4112 cfg.sip_45_consensus_amplification_threshold = Some(5);
4113
4114 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4116 }
4117 72 => {
4118 cfg.feature_flags.convert_type_argument_error = true;
4119
4120 cfg.max_tx_gas = Some(50_000_000_000_000);
4123 cfg.max_gas_price = Some(50_000_000_000);
4125
4126 cfg.feature_flags.variant_nodes = true;
4127 }
4128 73 => {
4129 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4131
4132 if chain != Chain::Mainnet && chain != Chain::Testnet {
4133 cfg.consensus_gc_depth = Some(60);
4136 }
4137
4138 if chain != Chain::Mainnet {
4139 cfg.feature_flags.consensus_zstd_compression = true;
4141 }
4142
4143 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4145 cfg.feature_flags
4147 .consensus_round_prober_probe_accepted_rounds = true;
4148
4149 cfg.feature_flags.per_object_congestion_control_mode =
4151 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4152 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4153 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4154 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4155 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4157 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4158 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4159 }
4160 74 => {
4161 if chain != Chain::Mainnet && chain != Chain::Testnet {
4163 cfg.feature_flags.enable_nitro_attestation = true;
4164 }
4165 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4166 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4167 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4168 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4169
4170 cfg.feature_flags.consensus_zstd_compression = true;
4172
4173 if chain != Chain::Mainnet && chain != Chain::Testnet {
4174 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4175 }
4176 }
4177 75 => {
4178 if chain != Chain::Mainnet {
4179 cfg.feature_flags.passkey_auth = true;
4180 }
4181 }
4182 76 => {
4183 if chain != Chain::Mainnet && chain != Chain::Testnet {
4184 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4185 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4186 }
4187 cfg.feature_flags.minimize_child_object_mutations = true;
4188
4189 if chain != Chain::Mainnet {
4190 cfg.feature_flags.accept_passkey_in_multisig = true;
4191 }
4192 }
4193 77 => {
4194 cfg.feature_flags.uncompressed_g1_group_elements = true;
4195
4196 if chain != Chain::Mainnet {
4197 cfg.consensus_gc_depth = Some(60);
4198 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4199 }
4200 }
4201 78 => {
4202 cfg.feature_flags.move_native_context = true;
4203 cfg.tx_context_fresh_id_cost_base = Some(52);
4204 cfg.tx_context_sender_cost_base = Some(30);
4205 cfg.tx_context_epoch_cost_base = Some(30);
4206 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4207 cfg.tx_context_sponsor_cost_base = Some(30);
4208 cfg.tx_context_gas_price_cost_base = Some(30);
4209 cfg.tx_context_gas_budget_cost_base = Some(30);
4210 cfg.tx_context_ids_created_cost_base = Some(30);
4211 cfg.tx_context_replace_cost_base = Some(30);
4212 cfg.gas_model_version = Some(10);
4213
4214 if chain != Chain::Mainnet {
4215 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4216 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4217
4218 cfg.feature_flags.per_object_congestion_control_mode =
4220 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4221 ExecutionTimeEstimateParams {
4222 target_utilization: 30,
4223 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4225 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4227 stored_observations_limit: u64::MAX,
4228 stake_weighted_median_threshold: 0,
4229 default_none_duration_for_new_keys: false,
4230 observations_chunk_size: None,
4231 },
4232 );
4233 }
4234 }
4235 79 => {
4236 if chain != Chain::Mainnet {
4237 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4238
4239 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4242
4243 cfg.feature_flags.consensus_batched_block_sync = true;
4244
4245 cfg.feature_flags.enable_nitro_attestation = true
4247 }
4248 cfg.feature_flags.normalize_ptb_arguments = true;
4249
4250 cfg.consensus_gc_depth = Some(60);
4251 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4252 }
4253 80 => {
4254 cfg.max_ptb_value_size = Some(1024 * 1024);
4255 }
4256 81 => {
4257 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4258 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4259 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4260 }
4261 82 => {
4262 cfg.feature_flags.max_ptb_value_size_v2 = true;
4263 }
4264 83 => {
4265 if chain == Chain::Mainnet {
4266 let aliased: [u8; 32] = Hex::decode(
4268 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4269 )
4270 .unwrap()
4271 .try_into()
4272 .unwrap();
4273
4274 cfg.aliased_addresses.push(AliasedAddress {
4276 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4277 aliased,
4278 allowed_tx_digests: vec![
4279 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4280 ],
4281 });
4282
4283 cfg.aliased_addresses.push(AliasedAddress {
4284 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4285 aliased,
4286 allowed_tx_digests: vec![
4287 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4288 ],
4289 });
4290 }
4291
4292 if chain != Chain::Mainnet {
4295 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4296 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4297
4298 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4300 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4301 cfg.feature_flags.per_object_congestion_control_mode =
4302 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4303 ExecutionTimeEstimateParams {
4304 target_utilization: 30,
4305 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4307 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4309 stored_observations_limit: u64::MAX,
4310 stake_weighted_median_threshold: 0,
4311 default_none_duration_for_new_keys: false,
4312 observations_chunk_size: None,
4313 },
4314 );
4315
4316 cfg.feature_flags.consensus_batched_block_sync = true;
4318
4319 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4322 cfg.feature_flags.enable_nitro_attestation = true;
4323 }
4324 }
4325 84 => {
4326 if chain == Chain::Mainnet {
4327 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4328 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4329
4330 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4332 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4333 cfg.feature_flags.per_object_congestion_control_mode =
4334 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4335 ExecutionTimeEstimateParams {
4336 target_utilization: 30,
4337 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4339 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4341 stored_observations_limit: u64::MAX,
4342 stake_weighted_median_threshold: 0,
4343 default_none_duration_for_new_keys: false,
4344 observations_chunk_size: None,
4345 },
4346 );
4347
4348 cfg.feature_flags.consensus_batched_block_sync = true;
4350
4351 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4354 cfg.feature_flags.enable_nitro_attestation = true;
4355 }
4356
4357 cfg.feature_flags.per_object_congestion_control_mode =
4359 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4360 ExecutionTimeEstimateParams {
4361 target_utilization: 30,
4362 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4364 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4366 stored_observations_limit: 20,
4367 stake_weighted_median_threshold: 0,
4368 default_none_duration_for_new_keys: false,
4369 observations_chunk_size: None,
4370 },
4371 );
4372 cfg.feature_flags.allow_unbounded_system_objects = true;
4373 }
4374 85 => {
4375 if chain != Chain::Mainnet && chain != Chain::Testnet {
4376 cfg.feature_flags.enable_party_transfer = true;
4377 }
4378
4379 cfg.feature_flags
4380 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4381 cfg.feature_flags.disallow_self_identifier = true;
4382 cfg.feature_flags.per_object_congestion_control_mode =
4383 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4384 ExecutionTimeEstimateParams {
4385 target_utilization: 50,
4386 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4388 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4390 stored_observations_limit: 20,
4391 stake_weighted_median_threshold: 0,
4392 default_none_duration_for_new_keys: false,
4393 observations_chunk_size: None,
4394 },
4395 );
4396 }
4397 86 => {
4398 cfg.feature_flags.type_tags_in_object_runtime = true;
4399 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4400
4401 cfg.feature_flags.per_object_congestion_control_mode =
4403 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4404 ExecutionTimeEstimateParams {
4405 target_utilization: 50,
4406 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4408 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4410 stored_observations_limit: 20,
4411 stake_weighted_median_threshold: 3334,
4412 default_none_duration_for_new_keys: false,
4413 observations_chunk_size: None,
4414 },
4415 );
4416 if chain != Chain::Mainnet {
4418 cfg.feature_flags.enable_party_transfer = true;
4419 }
4420 }
4421 87 => {
4422 if chain == Chain::Mainnet {
4423 cfg.feature_flags.record_time_estimate_processed = true;
4424 }
4425 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4426 }
4427 88 => {
4428 cfg.feature_flags.record_time_estimate_processed = true;
4429 cfg.tx_context_rgp_cost_base = Some(30);
4430 cfg.feature_flags
4431 .ignore_execution_time_observations_after_certs_closed = true;
4432
4433 cfg.feature_flags.per_object_congestion_control_mode =
4436 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4437 ExecutionTimeEstimateParams {
4438 target_utilization: 50,
4439 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4441 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4443 stored_observations_limit: 20,
4444 stake_weighted_median_threshold: 3334,
4445 default_none_duration_for_new_keys: true,
4446 observations_chunk_size: None,
4447 },
4448 );
4449 }
4450 89 => {
4451 cfg.feature_flags.dependency_linkage_error = true;
4452 cfg.feature_flags.additional_multisig_checks = true;
4453 }
4454 90 => {
4455 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4457 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4458 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4459 cfg.feature_flags.accept_passkey_in_multisig = true;
4460 cfg.feature_flags.passkey_auth = true;
4461 cfg.feature_flags.check_for_init_during_upgrade = true;
4462
4463 if chain != Chain::Mainnet {
4465 cfg.feature_flags.mysticeti_fastpath = true;
4466 }
4467 }
4468 91 => {
4469 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4470 }
4471 92 => {
4472 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4473 }
4474 93 => {
4475 cfg.feature_flags
4476 .consensus_checkpoint_signature_key_includes_digest = true;
4477 }
4478 94 => {
4479 cfg.feature_flags.per_object_congestion_control_mode =
4481 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4482 ExecutionTimeEstimateParams {
4483 target_utilization: 50,
4484 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4486 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4488 stored_observations_limit: 18,
4489 stake_weighted_median_threshold: 3334,
4490 default_none_duration_for_new_keys: true,
4491 observations_chunk_size: None,
4492 },
4493 );
4494
4495 cfg.feature_flags.enable_party_transfer = true;
4497 }
4498 95 => {
4499 cfg.type_name_id_base_cost = Some(52);
4500
4501 cfg.max_transactions_per_checkpoint = Some(20_000);
4503 }
4504 96 => {
4505 if chain != Chain::Mainnet && chain != Chain::Testnet {
4507 cfg.feature_flags
4508 .include_checkpoint_artifacts_digest_in_summary = true;
4509 }
4510 cfg.feature_flags.correct_gas_payment_limit_check = true;
4511 cfg.feature_flags.authority_capabilities_v2 = true;
4512 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4513 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4514 cfg.feature_flags.enable_coin_registry = true;
4515
4516 cfg.feature_flags.mysticeti_fastpath = true;
4518 }
4519 97 => {
4520 cfg.feature_flags.additional_borrow_checks = true;
4521 }
4522 98 => {
4523 cfg.event_emit_auth_stream_cost = Some(52);
4524 cfg.feature_flags.better_loader_errors = true;
4525 cfg.feature_flags.generate_df_type_layouts = true;
4526 }
4527 99 => {
4528 cfg.feature_flags.use_new_commit_handler = true;
4529 }
4530 100 => {
4531 cfg.feature_flags.private_generics_verifier_v2 = true;
4532 }
4533 101 => {
4534 cfg.feature_flags.create_root_accumulator_object = true;
4535 cfg.max_updates_per_settlement_txn = Some(100);
4536 if chain != Chain::Mainnet {
4537 cfg.feature_flags.enable_poseidon = true;
4538 }
4539 }
4540 102 => {
4541 cfg.feature_flags.per_object_congestion_control_mode =
4545 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4546 ExecutionTimeEstimateParams {
4547 target_utilization: 50,
4548 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4550 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4552 stored_observations_limit: 180,
4553 stake_weighted_median_threshold: 3334,
4554 default_none_duration_for_new_keys: true,
4555 observations_chunk_size: Some(18),
4556 },
4557 );
4558 cfg.feature_flags.deprecate_global_storage_ops = true;
4559 }
4560 103 => {}
4561 104 => {
4562 cfg.translation_per_command_base_charge = Some(1);
4563 cfg.translation_per_input_base_charge = Some(1);
4564 cfg.translation_pure_input_per_byte_charge = Some(1);
4565 cfg.translation_per_type_node_charge = Some(1);
4566 cfg.translation_per_reference_node_charge = Some(1);
4567 cfg.translation_per_linkage_entry_charge = Some(10);
4568 cfg.gas_model_version = Some(11);
4569 cfg.feature_flags.abstract_size_in_object_runtime = true;
4570 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4571 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4572 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4573 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4574 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4575 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4576 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4577 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4578 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4579 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4580 cfg.feature_flags.enable_ptb_execution_v2 = true;
4581
4582 cfg.poseidon_bn254_cost_base = Some(260);
4583
4584 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4585
4586 if chain != Chain::Mainnet {
4587 cfg.feature_flags
4588 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4589 }
4590
4591 cfg.feature_flags
4592 .include_cancelled_randomness_txns_in_prologue = true;
4593 }
4594 105 => {
4595 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4596 cfg.feature_flags.disable_preconsensus_locking = true;
4597
4598 if chain != Chain::Mainnet {
4599 cfg.feature_flags
4600 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4601 }
4602 }
4603 106 => {
4604 cfg.accumulator_object_storage_cost = Some(7600);
4606
4607 if chain != Chain::Mainnet && chain != Chain::Testnet {
4608 cfg.feature_flags.enable_accumulators = true;
4609 cfg.feature_flags.enable_address_balance_gas_payments = true;
4610 cfg.feature_flags.enable_authenticated_event_streams = true;
4611 cfg.feature_flags.enable_object_funds_withdraw = true;
4612 }
4613 }
4614 107 => {
4615 cfg.feature_flags
4616 .consensus_skip_gced_blocks_in_direct_finalization = true;
4617
4618 if in_integration_test() {
4620 cfg.consensus_gc_depth = Some(6);
4621 cfg.consensus_max_num_transactions_in_block = Some(8);
4622 }
4623 }
4624 108 => {
4625 cfg.feature_flags.gas_rounding_halve_digits = true;
4626 cfg.feature_flags.flexible_tx_context_positions = true;
4627 cfg.feature_flags.disable_entry_point_signature_check = true;
4628
4629 if chain != Chain::Mainnet {
4630 cfg.feature_flags.address_aliases = true;
4631
4632 cfg.feature_flags.enable_accumulators = true;
4633 cfg.feature_flags.enable_address_balance_gas_payments = true;
4634 }
4635
4636 cfg.feature_flags.enable_poseidon = true;
4637 }
4638 109 => {
4639 cfg.binary_variant_handles = Some(1024);
4640 cfg.binary_variant_instantiation_handles = Some(1024);
4641 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4642 }
4643 110 => {
4644 cfg.feature_flags
4645 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4646 cfg.feature_flags
4647 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4648 if chain != Chain::Mainnet && chain != Chain::Testnet {
4649 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4650 }
4651 cfg.feature_flags.validate_zklogin_public_identifier = true;
4652 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4653 cfg.feature_flags
4654 .consensus_always_accept_system_transactions = true;
4655 if chain != Chain::Mainnet {
4656 cfg.feature_flags.enable_object_funds_withdraw = true;
4657 }
4658 }
4659 111 => {
4660 cfg.feature_flags.validator_metadata_verify_v2 = true;
4661 }
4662 112 => {
4663 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4664 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4665 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4666 cfg.group_ops_ristretto_point_add_cost = Some(500);
4667 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4668 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4669 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4670 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4671 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4672 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4673
4674 if chain != Chain::Mainnet && chain != Chain::Testnet {
4675 cfg.feature_flags.enable_ristretto255_group_ops = true;
4676 }
4677 }
4678 113 => {
4679 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4680 if chain != Chain::Mainnet && chain != Chain::Testnet {
4681 cfg.feature_flags.defer_unpaid_amplification = true;
4682 }
4683 }
4684 114 => {
4685 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4686 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4687 if chain != Chain::Mainnet {
4688 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4689 cfg.feature_flags.enable_authenticated_event_streams = true;
4690 cfg.feature_flags
4691 .include_checkpoint_artifacts_digest_in_summary = true;
4692 }
4693 }
4694 115 => {
4695 cfg.feature_flags.normalize_depth_formula = true;
4696 }
4697 116 => {
4698 cfg.feature_flags.gasless_transaction_drop_safety = true;
4699 cfg.feature_flags.address_aliases = true;
4700 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4701 cfg.feature_flags.defer_unpaid_amplification = false;
4703 cfg.feature_flags.enable_display_registry = true;
4704 }
4705 117 => {}
4706 118 => {
4707 cfg.feature_flags.use_coin_party_owner = true;
4708 }
4709 119 => {
4710 cfg.execution_version = Some(4);
4712 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4713 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4714 if chain != Chain::Mainnet {
4715 cfg.feature_flags.enable_gasless = true;
4716 cfg.gasless_max_computation_units = Some(50_000);
4717 cfg.gasless_allowed_token_types = Some(vec![]);
4718 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4719 cfg.feature_flags
4720 .convert_withdrawal_compatibility_ptb_arguments = true;
4721 }
4722 cfg.gasless_max_unused_inputs = Some(1);
4723 cfg.gasless_max_pure_input_bytes = Some(32);
4724 if chain == Chain::Testnet {
4725 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4726 }
4727 cfg.transfer_receive_object_cost_per_byte = Some(1);
4728 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4729 }
4730 120 => {
4731 cfg.feature_flags.disallow_jump_orphans = true;
4732 }
4733 121 => {
4734 if chain != Chain::Mainnet {
4736 cfg.feature_flags.defer_unpaid_amplification = true;
4737 cfg.gasless_max_tps = Some(50);
4738 }
4739 cfg.feature_flags
4740 .early_return_receive_object_mismatched_type = true;
4741 }
4742 122 => {
4743 cfg.feature_flags.defer_unpaid_amplification = true;
4745 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4747 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4748 if chain != Chain::Mainnet && chain != Chain::Testnet {
4749 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4750 }
4751 cfg.feature_flags.gasless_verify_remaining_balance = true;
4752 cfg.include_special_package_amendments = match chain {
4753 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4754 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4755 Chain::Unknown => None,
4756 };
4757 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4758 cfg.gasless_max_tps = Some(300);
4759 cfg.gasless_max_computation_units = Some(5_000);
4760 }
4761 123 => {
4762 cfg.gas_model_version = Some(13);
4763 }
4764 124 => {
4765 if chain != Chain::Mainnet && chain != Chain::Testnet {
4766 cfg.feature_flags.timestamp_based_epoch_close = true;
4767 }
4768 cfg.gas_model_version = Some(14);
4769 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4770
4771 cfg.feature_flags.enable_accumulators = true;
4777 cfg.feature_flags.enable_address_balance_gas_payments = true;
4778 cfg.feature_flags.enable_authenticated_event_streams = true;
4779 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4780 cfg.feature_flags.enable_object_funds_withdraw = true;
4781 cfg.feature_flags
4782 .convert_withdrawal_compatibility_ptb_arguments = true;
4783 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4784 cfg.feature_flags
4785 .include_checkpoint_artifacts_digest_in_summary = true;
4786 cfg.feature_flags.enable_gasless = true;
4787
4788 if chain == Chain::Mainnet {
4793 cfg.gasless_allowed_token_types = Some(vec![
4794 (MAINNET_USDC.to_string(), 10_000),
4795 (MAINNET_USDSUI.to_string(), 10_000),
4796 (MAINNET_SUI_USDE.to_string(), 10_000),
4797 (MAINNET_USDY.to_string(), 10_000),
4798 (MAINNET_FDUSD.to_string(), 10_000),
4799 (MAINNET_AUSD.to_string(), 10_000),
4800 (MAINNET_USDB.to_string(), 10_000),
4801 ]);
4802 }
4803 }
4804 125 => {
4805 cfg.feature_flags.granular_post_execution_checks = true;
4806 if chain != Chain::Mainnet {
4807 cfg.feature_flags.timestamp_based_epoch_close = true;
4808 }
4809 }
4810 126 => {
4811 cfg.feature_flags.early_exit_on_iffw = true;
4812 }
4813 127 => {
4814 cfg.feature_flags.always_advance_dkg_to_resolution = true;
4815
4816 cfg.verify_bulletproofs_ristretto255_base_cost = Some(23866);
4817 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(1324);
4818 cfg.group_ops_ristretto_decode_scalar_cost = Some(5);
4819 cfg.group_ops_ristretto_decode_point_cost = Some(216);
4820 cfg.group_ops_ristretto_scalar_add_cost = Some(2);
4821 cfg.group_ops_ristretto_point_add_cost = Some(8);
4822 cfg.group_ops_ristretto_scalar_sub_cost = Some(2);
4823 cfg.group_ops_ristretto_point_sub_cost = Some(8);
4824 cfg.group_ops_ristretto_scalar_mul_cost = Some(5);
4825 cfg.group_ops_ristretto_point_mul_cost = Some(1763);
4826 cfg.group_ops_ristretto_scalar_div_cost = Some(557);
4827 cfg.group_ops_ristretto_point_div_cost = Some(2244);
4828
4829 if chain != Chain::Mainnet {
4830 cfg.feature_flags.enable_ristretto255_group_ops = true;
4831 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4832 }
4833
4834 cfg.feature_flags.timestamp_based_epoch_close = true;
4835 }
4836 128 => {
4837 cfg.max_generic_instantiation_type_nodes_per_function = Some(10_000);
4838 cfg.max_generic_instantiation_type_nodes_per_module = Some(500_000);
4839 cfg.binary_enum_defs = Some(200);
4840 cfg.binary_enum_def_instantiations = Some(100);
4841 }
4842 129 => {
4843 cfg.feature_flags.enable_unified_linkage = true;
4844 }
4845 130 => {
4846 cfg.feature_flags.record_net_unsettled_object_withdraws = true;
4847 cfg.feature_flags.enable_init_on_upgrade = true;
4848 cfg.epoch_close_deadline_ms = Some(120_000);
4849 cfg.scratch_add_cost_base = Some(13);
4850 cfg.scratch_read_cost_base = Some(13);
4851 cfg.scratch_read_value_cost = Some(1);
4852 cfg.scratch_remove_cost_base = Some(13);
4853 cfg.scratch_exists_cost_base = Some(13);
4854 cfg.scratch_exists_with_type_cost_base = Some(13);
4855 cfg.scratch_exists_with_type_type_cost = Some(1);
4856 let max_commands = cfg.max_programmable_tx_commands() as u64;
4857 cfg.max_scratch_pad_size = Some(16 * max_commands);
4858 if chain != Chain::Mainnet && chain != Chain::Testnet {
4860 cfg.feature_flags.zklogin_circuit_mode = 1;
4861 }
4862 }
4863 131 => {
4864 cfg.feature_flags.share_transaction_deny_config_in_consensus = true;
4865 cfg.feature_flags.framework_tx_context_mut_restrictions = true;
4866 }
4867 132 => {
4868 if chain != Chain::Mainnet && chain != Chain::Testnet {
4869 cfg.feature_flags.defer_owned_object_double_spend = true;
4870 cfg.feature_flags.create_forwarding_address_registry = true;
4871 }
4872 cfg.object_record_new_uid_from_hash_cost_base = Some(1);
4873 cfg.feature_flags
4874 .enable_order_independent_upgrade_init_linkage = true;
4875 }
4876 133 => {
4877 cfg.feature_flags
4878 .include_function_signatures_in_instantiation_limits = true;
4879 cfg.max_accumulator_type_nodes = Some(16);
4880 }
4881 134 => {
4882 if chain != Chain::Mainnet {
4889 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
4898 if chain == Chain::Mainnet {
4899 cfg.feature_flags.defer_unpaid_amplification = false;
4900 }
4901 }
4902 135 => {
4903 cfg.package_original_package_id_impl_cost_base = Some(52);
4906 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4907 cfg.package_original_package_id_impl_cost_per_byte =
4908 Some(package_read_cost_per_byte);
4909
4910 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4911 cfg.consensus_max_num_transactions_in_block = Some(128);
4912
4913 cfg.feature_flags.defer_unpaid_amplification = false;
4914 }
4915 136 => {
4916 cfg.feature_flags.ptb_tx_context_restrictions = true;
4917
4918 cfg.translation_per_live_reference_charge = Some(1);
4919 cfg.max_ptb_live_references = Some(64);
4920 cfg.max_ptb_returned_references = Some(16);
4921 cfg.max_ptb_total_returned_references = Some(256);
4922
4923 if chain != Chain::Mainnet && chain != Chain::Testnet {
4924 cfg.feature_flags.allowed_proposers = true;
4925 }
4926 cfg.feature_flags.harden_linkage_consistency = true;
4927
4928 cfg.package_arena_size_in_bytes = Some(10_000_000);
4929 }
4930 137 => {
4931 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(621);
4932 cfg.max_bulletproofs_total_bits = Some(1024);
4933
4934 if chain != Chain::Mainnet {
4935 cfg.feature_flags.enable_allowances = true;
4936 }
4937 cfg.feature_flags.fix_ptb_generated_reads = true;
4938 cfg.feature_flags.charge_ld_const_abstract_size = true;
4939 if chain != Chain::Mainnet && chain != Chain::Testnet {
4940 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4941 }
4942 cfg.reserve_object_funds_for_withdrawal_cost_base = Some(52);
4943 cfg.reserve_object_funds_for_withdrawal_cold_read_cost = Some(184);
4946
4947 cfg.feature_flags.allowed_proposers = true;
4948
4949 cfg.feature_flags.validate_ptb_argument_indices = true;
4950 cfg.feature_flags.memory_safety_invariant_check_v2 = true;
4951 }
4952 138 => {
4953 cfg.gas_model_version = Some(15);
4954 cfg.feature_flags.enable_allowances = true;
4955 if chain != Chain::Mainnet {
4956 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4957 cfg.feature_flags.disable_effects_tx_dependencies = true;
4958 }
4959 cfg.feature_flags.merge_colliding_deferrals = true;
4960 if chain == Chain::Mainnet {
4962 cfg.storage_rebate_rate = Some(9999);
4963 }
4964 }
4965 139 => {
4966 if chain != Chain::Mainnet && chain != Chain::Testnet {
4967 cfg.feature_flags.enable_forwarding_addresses = true;
4968 cfg.feature_flags.mldsa65_auth = true;
4969 }
4970 cfg.storage_rebate_rate = Some(9999);
4971 if chain != Chain::Mainnet {
4972 cfg.feature_flags.allow_dkg_completion_after_timeout = true;
4973 }
4974 cfg.obj_access_cost_read_per_package_kb = Some(154);
4976 }
4977 140 => {
4978 cfg.staggered_submission_signal_window_commits = Some(300);
4981 cfg.staggered_submission_signal_min_excess_copies_per_commit = Some(2);
4982 cfg.staggered_submission_signal_exit_dwell_commits = Some(6000);
4983 cfg.staggered_submission_signal_band1_enter_ratio_bps = Some(1000);
4984 cfg.staggered_submission_signal_band1_exit_ratio_bps = Some(500);
4985 cfg.staggered_submission_signal_band2_enter_ratio_bps = Some(5000);
4986 cfg.staggered_submission_signal_band2_exit_ratio_bps = Some(2500);
4987
4988 cfg.vector_reverse_base_cost = Some(52);
4989 cfg.vector_reverse_per_elem_cost = Some(8);
4990 cfg.vector_keep_range_base_cost = Some(52);
4991 cfg.vector_keep_range_per_dropped_elem_cost = Some(1);
4992 cfg.vector_keep_range_per_moved_elem_cost = Some(8);
4993 cfg.vector_copy_range_base_cost = Some(52);
4994 cfg.vector_replace_range_base_cost = Some(52);
4995 cfg.vector_replace_range_per_elem_cost = Some(8);
4996
4997 if chain != Chain::Mainnet && chain != Chain::Testnet {
4998 cfg.feature_flags.shuffle_consensus_commit_blocks = true;
4999 }
5000
5001 cfg.feature_flags.allow_references_in_ptbs = true;
5002 cfg.feature_flags.disable_id_leak_verifier = true;
5003 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
5004 cfg.feature_flags.disable_effects_tx_dependencies = true;
5005 }
5006 141 => {
5007 cfg.feature_flags.complete_effects_size_estimate = true;
5008 cfg.max_num_accumulator_events = Some(1024);
5009 }
5010 142 => {
5011 cfg.clock_borrow_cost_base = Some(52);
5012 cfg.feature_flags.check_groth16_pvk_length = true;
5013 cfg.object_is_shared_input_cost_base = Some(52);
5014 cfg.feature_flags.secp256r1_ecrecover_checks_x_below_p = true;
5015 cfg.binary_format_limits_profile = Some(BinaryFormatLimitsProfile::V1);
5016 cfg.feature_flags.defer_owned_object_double_spend = true;
5017 }
5018 143 => {
5019 cfg.execution_version = Some(5);
5020 cfg.package_arena_size_in_bytes = Some(20_000_000);
5021 }
5022 _ => panic!("unsupported version {:?}", version),
5033 }
5034 }
5035
5036 cfg
5037 }
5038
5039 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
5040 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
5041 || !self.feature_flags.split_checkpoints_in_consensus_handler
5042 {
5043 return;
5044 }
5045
5046 if !mysten_common::in_test_configuration() {
5047 return;
5048 }
5049
5050 use rand::{Rng, SeedableRng, rngs::StdRng};
5051 let mut rng = StdRng::from_seed(*seed);
5052 let max_txns = rng.gen_range(10..=100u64);
5053 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
5054 self.max_transactions_per_checkpoint = Some(max_txns);
5055 }
5056
5057 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
5063 let (
5064 max_back_edges_per_function,
5065 max_back_edges_per_module,
5066 sanity_check_with_regex_reference_safety,
5067 ) = if let Some((
5068 max_back_edges_per_function,
5069 max_back_edges_per_module,
5070 sanity_check_with_regex_reference_safety,
5071 )) = signing_limits
5072 {
5073 (
5074 Some(max_back_edges_per_function),
5075 Some(max_back_edges_per_module),
5076 Some(sanity_check_with_regex_reference_safety),
5077 )
5078 } else {
5079 (None, None, None)
5080 };
5081
5082 let additional_borrow_checks = if signing_limits.is_some() {
5083 true
5085 } else {
5086 self.additional_borrow_checks()
5087 };
5088 let deprecate_global_storage_ops = if signing_limits.is_some() {
5089 true
5091 } else {
5092 self.deprecate_global_storage_ops()
5093 };
5094
5095 VerifierConfig {
5096 max_loop_depth: Some(self.max_loop_depth() as usize),
5097 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5098 max_function_parameters: Some(self.max_function_parameters() as usize),
5099 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5100 max_value_stack_size: self.max_value_stack_size() as usize,
5101 max_type_nodes: Some(self.max_type_nodes() as usize),
5102 max_generic_instantiation_type_nodes_per_function: self
5103 .max_generic_instantiation_type_nodes_per_function_as_option()
5104 .map(|v| v as usize),
5105 max_generic_instantiation_type_nodes_per_module: self
5106 .max_generic_instantiation_type_nodes_per_module_as_option()
5107 .map(|v| v as usize),
5108 include_function_signatures_in_instantiation_limits: self
5109 .include_function_signatures_in_instantiation_limits(),
5110 max_push_size: Some(self.max_push_size() as usize),
5111 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5112 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5113 max_function_definitions: Some(self.max_function_definitions() as usize),
5114 max_data_definitions: Some(self.max_struct_definitions() as usize),
5115 max_constant_vector_len: Some(self.max_move_vector_len()),
5116 max_back_edges_per_function,
5117 max_back_edges_per_module,
5118 max_basic_blocks_in_script: None,
5119 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5121 allow_receiving_object_id: self.allow_receiving_object_id(),
5122 reject_mutable_random_on_entry_functions: self
5123 .reject_mutable_random_on_entry_functions(),
5124 bytecode_version: self.move_binary_format_version(),
5125 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5126 additional_borrow_checks,
5127 better_loader_errors: self.better_loader_errors(),
5128 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5129 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5130 .map(|limit| limit as u128),
5131 deprecate_global_storage_ops,
5132 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5133 disable_id_leak_verifier: self.disable_id_leak_verifier(),
5134 switch_to_regex_reference_safety: false,
5135 framework_tx_context_mut_restrictions: self.framework_tx_context_mut_restrictions(),
5136 disallow_jump_orphans: self.disallow_jump_orphans(),
5137 }
5138 }
5139
5140 pub fn binary_config(
5141 &self,
5142 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5143 ) -> BinaryConfig {
5144 let deprecate_global_storage_ops =
5145 override_deprecate_global_storage_ops_during_deserialization
5146 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5147 BinaryConfig::new(
5148 self.move_binary_format_version(),
5149 self.min_move_binary_format_version_as_option()
5150 .unwrap_or(VERSION_1),
5151 self.no_extraneous_module_bytes(),
5152 deprecate_global_storage_ops,
5153 TableConfig {
5154 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5155 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5156 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5157 function_instantiations: self
5158 .binary_function_instantiations_as_option()
5159 .unwrap_or(u16::MAX),
5160 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5161 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5162 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5163 address_identifiers: self
5164 .binary_address_identifiers_as_option()
5165 .unwrap_or(u16::MAX),
5166 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5167 struct_def_instantiations: self
5168 .binary_struct_def_instantiations_as_option()
5169 .unwrap_or(u16::MAX),
5170 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5171 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5172 field_instantiations: self
5173 .binary_field_instantiations_as_option()
5174 .unwrap_or(u16::MAX),
5175 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5176 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5177 enum_def_instantiations: self
5178 .binary_enum_def_instantiations_as_option()
5179 .unwrap_or(u16::MAX),
5180 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5181 variant_instantiation_handles: self
5182 .binary_variant_instantiation_handles_as_option()
5183 .unwrap_or(u16::MAX),
5184 },
5185 self.binary_format_limits(),
5186 )
5187 }
5188
5189 pub fn binary_format_limits(
5190 &self,
5191 ) -> &'static move_binary_format::binary_config::BinaryFormatLimits {
5192 self.binary_format_limits_profile
5193 .unwrap_or(BinaryFormatLimitsProfile::LEGACY)
5194 .limits()
5195 }
5196
5197 pub fn apply_overrides_for_testing(
5201 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5202 ) -> OverrideGuard {
5203 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5204 assert!(cur.is_none(), "config override already present");
5205 *cur = Some(Box::new(override_fn));
5206 OverrideGuard
5207 }
5208
5209 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5210 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5211 warn!(
5212 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5213 );
5214 ret = override_fn(version, ret);
5215 }
5216 ret
5217 }
5218}
5219
5220impl ProtocolConfig {
5224 pub fn set_execution_version_for_testing(&mut self, val: u64) {
5228 let current = self.execution_version.unwrap_or(0);
5229 assert!(
5230 val >= current,
5231 "cannot downgrade execution_version from {current} to {val}: running an old \
5232 executor against a newer protocol config/framework is unsupported. To test \
5233 frozen executor behavior, start from the last protocol version of that executor \
5234 instead, so genesis loads the matching framework snapshot (see \
5235 test_address_balance_gas_v3_accumulator_sign)."
5236 );
5237 self.execution_version = Some(val);
5238 }
5239
5240 pub fn set_zklogin_circuit_mode_for_testing(&mut self, val: u64) {
5243 self.feature_flags.zklogin_circuit_mode = val
5244 }
5245
5246 pub fn set_per_object_congestion_control_mode_for_testing(
5247 &mut self,
5248 val: PerObjectCongestionControlMode,
5249 ) {
5250 self.feature_flags.per_object_congestion_control_mode = val;
5251 }
5252
5253 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5254 self.feature_flags.consensus_choice = val;
5255 }
5256
5257 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5258 self.feature_flags.consensus_network = val;
5259 }
5260
5261 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5262 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5263 }
5264
5265 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5266 self.feature_flags.mysticeti_num_leaders_per_round = val;
5267 }
5268
5269 pub fn disable_accumulators_for_testing(&mut self) {
5270 self.feature_flags.enable_accumulators = false;
5271 self.feature_flags.enable_address_balance_gas_payments = false;
5272 }
5273
5274 pub fn enable_coin_reservation_for_testing(&mut self) {
5275 self.feature_flags.enable_coin_reservation_obj_refs = true;
5276 self.feature_flags
5277 .convert_withdrawal_compatibility_ptb_arguments = true;
5278 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5281 }
5282
5283 pub fn disable_coin_reservation_for_testing(&mut self) {
5284 self.feature_flags.enable_coin_reservation_obj_refs = false;
5285 self.feature_flags
5286 .convert_withdrawal_compatibility_ptb_arguments = false;
5287 }
5288
5289 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5290 self.feature_flags.enable_accumulators = true;
5291 self.feature_flags.allow_private_accumulator_entrypoints = true;
5292 self.feature_flags.enable_address_balance_gas_payments = true;
5293 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5294 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5295 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5296 }
5297
5298 pub fn enable_gasless_for_testing(&mut self) {
5299 self.enable_address_balance_gas_payments_for_testing();
5300 self.feature_flags.enable_gasless = true;
5301 self.feature_flags.gasless_verify_remaining_balance = true;
5302 self.gasless_max_computation_units = Some(5_000);
5303 self.gasless_allowed_token_types = Some(vec![]);
5304 self.gasless_max_tps = Some(1000);
5305 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5306 }
5307
5308 pub fn disable_gasless_for_testing(&mut self) {
5309 self.feature_flags.enable_gasless = false;
5310 self.gasless_max_computation_units = None;
5311 self.gasless_allowed_token_types = None;
5312 }
5313
5314 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5315 self.feature_flags.enable_accumulators = true;
5316 self.feature_flags.enable_authenticated_event_streams = true;
5317 self.feature_flags
5318 .include_checkpoint_artifacts_digest_in_summary = true;
5319 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5320 }
5321}
5322
5323type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5324
5325static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5326
5327#[must_use]
5328pub struct OverrideGuard;
5329
5330impl Drop for OverrideGuard {
5331 fn drop(&mut self) {
5332 info!("restoring override fn");
5333 *CONFIG_OVERRIDE.lock().unwrap() = None;
5334 }
5335}
5336
5337#[derive(PartialEq, Eq)]
5340pub enum LimitThresholdCrossed {
5341 None,
5342 Soft(u128, u128),
5343 Hard(u128, u128),
5344}
5345
5346pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5349 x: T,
5350 soft_limit: U,
5351 hard_limit: V,
5352) -> LimitThresholdCrossed {
5353 let x: V = x.into();
5354 let soft_limit: V = soft_limit.into();
5355
5356 debug_assert!(soft_limit <= hard_limit);
5357
5358 if x >= hard_limit {
5361 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5362 } else if x < soft_limit {
5363 LimitThresholdCrossed::None
5364 } else {
5365 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5366 }
5367}
5368
5369#[macro_export]
5370macro_rules! assert_set {
5371 ($protocol_config:expr, $($flag:ident),+ $(,)?) => {{
5372 let protocol_config = $protocol_config;
5373 $(
5374 assert!(
5375 protocol_config.$flag(),
5376 "protocol config flag `{}` must be set",
5377 stringify!($flag),
5378 );
5379 )+
5380 }};
5381}
5382
5383#[macro_export]
5384macro_rules! check_limit {
5385 ($x:expr, $hard:expr) => {
5386 check_limit!($x, $hard, $hard)
5387 };
5388 ($x:expr, $soft:expr, $hard:expr) => {
5389 check_limit_in_range($x as u64, $soft, $hard)
5390 };
5391}
5392
5393#[macro_export]
5397macro_rules! check_limit_by_meter {
5398 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5399 let (h, metered_str) = if $is_metered {
5401 ($metered_limit, "metered")
5402 } else {
5403 ($unmetered_hard_limit, "unmetered")
5405 };
5406 use sui_protocol_config::check_limit_in_range;
5407 let result = check_limit_in_range($x as u64, $metered_limit, h);
5408 match result {
5409 LimitThresholdCrossed::None => {}
5410 LimitThresholdCrossed::Soft(_, _) => {
5411 $metric.with_label_values(&[metered_str, "soft"]).inc();
5412 }
5413 LimitThresholdCrossed::Hard(_, _) => {
5414 $metric.with_label_values(&[metered_str, "hard"]).inc();
5415 }
5416 };
5417 result
5418 }};
5419}
5420
5421pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5424
5425static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5426 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5427
5428static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5429 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5430
5431fn parse_amendments(json: &str) -> Arc<Amendments> {
5432 #[derive(serde::Deserialize)]
5433 struct AmendmentEntry {
5434 root: String,
5435 deps: Vec<DepEntry>,
5436 }
5437
5438 #[derive(serde::Deserialize)]
5439 struct DepEntry {
5440 original_id: String,
5441 version_id: String,
5442 }
5443
5444 let entries: Vec<AmendmentEntry> =
5445 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5446 let mut amendments = BTreeMap::new();
5447 for entry in entries {
5448 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5449 let mut dep_ids = BTreeMap::new();
5450 for dep in entry.deps {
5451 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5452 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5453 assert!(
5454 dep_ids.insert(orig_id, upgraded_id).is_none(),
5455 "Duplicate original ID in amendments table"
5456 );
5457 }
5458 assert!(
5459 amendments.insert(root_id, dep_ids).is_none(),
5460 "Duplicate root ID in amendments table"
5461 );
5462 }
5463 Arc::new(amendments)
5464}
5465
5466#[cfg(all(test, not(msim)))]
5467mod test {
5468 use insta::assert_yaml_snapshot;
5469
5470 use super::*;
5471
5472 #[test]
5473 fn snapshot_tests() {
5474 println!("\n============================================================================");
5475 println!("! !");
5476 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5477 println!("! !");
5478 println!("============================================================================\n");
5479 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5480 let chain_str = match chain_id {
5484 Chain::Unknown => "".to_string(),
5485 _ => format!("{:?}_", chain_id),
5486 };
5487 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5488 let cur = ProtocolVersion::new(i);
5489 assert_yaml_snapshot!(
5490 format!("{}version_{}", chain_str, cur.as_u64()),
5491 ProtocolConfig::get_for_version(cur, *chain_id)
5492 );
5493 }
5494 }
5495 }
5496
5497 #[test]
5498 fn binary_format_limits_profile_matches_protocol_version() {
5499 let v141 = ProtocolConfig::get_for_version(ProtocolVersion::new(141), Chain::Unknown);
5500 assert_eq!(
5501 v141.binary_format_limits(),
5502 BinaryFormatLimitsProfile::LEGACY.limits()
5503 );
5504
5505 let v142 = ProtocolConfig::get_for_version(ProtocolVersion::new(142), Chain::Unknown);
5506 assert_eq!(
5507 v142.binary_format_limits(),
5508 BinaryFormatLimitsProfile::V1.limits()
5509 );
5510 }
5511
5512 #[test]
5513 fn test_getters() {
5514 let prot: ProtocolConfig =
5515 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5516 assert_eq!(
5517 prot.max_arguments(),
5518 prot.max_arguments_as_option().unwrap()
5519 );
5520 }
5521
5522 #[test]
5523 fn vector_bulk_native_gas_costs_start_at_version_140() {
5524 for chain in [Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5525 let before = ProtocolConfig::get_for_version(ProtocolVersion::new(139), chain);
5526 assert_eq!(before.vector_reverse_base_cost_as_option(), None);
5527 assert_eq!(before.vector_reverse_per_elem_cost_as_option(), None);
5528 assert_eq!(before.vector_keep_range_base_cost_as_option(), None);
5529 assert_eq!(
5530 before.vector_keep_range_per_dropped_elem_cost_as_option(),
5531 None
5532 );
5533 assert_eq!(
5534 before.vector_keep_range_per_moved_elem_cost_as_option(),
5535 None
5536 );
5537 assert_eq!(before.vector_copy_range_base_cost_as_option(), None);
5538 assert_eq!(before.vector_replace_range_base_cost_as_option(), None);
5539 assert_eq!(before.vector_replace_range_per_elem_cost_as_option(), None);
5540
5541 let active = ProtocolConfig::get_for_version(ProtocolVersion::new(140), chain);
5542 assert_eq!(active.vector_reverse_base_cost_as_option(), Some(52));
5543 assert_eq!(active.vector_reverse_per_elem_cost_as_option(), Some(8));
5544 assert_eq!(active.vector_keep_range_base_cost_as_option(), Some(52));
5545 assert_eq!(
5546 active.vector_keep_range_per_dropped_elem_cost_as_option(),
5547 Some(1)
5548 );
5549 assert_eq!(
5550 active.vector_keep_range_per_moved_elem_cost_as_option(),
5551 Some(8)
5552 );
5553 assert_eq!(active.vector_copy_range_base_cost_as_option(), Some(52));
5554 assert_eq!(active.vector_replace_range_base_cost_as_option(), Some(52));
5555 assert_eq!(
5556 active.vector_replace_range_per_elem_cost_as_option(),
5557 Some(8)
5558 );
5559 }
5560 }
5561
5562 #[test]
5563 fn test_setters() {
5564 let mut prot: ProtocolConfig =
5565 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5566 prot.set_max_arguments_for_testing(123);
5567 assert_eq!(prot.max_arguments(), 123);
5568
5569 prot.set_max_arguments_from_str_for_testing("321".to_string());
5570 assert_eq!(prot.max_arguments(), 321);
5571
5572 prot.disable_max_arguments_for_testing();
5573 assert_eq!(prot.max_arguments_as_option(), None);
5574
5575 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5576 assert_eq!(prot.max_arguments(), 456);
5577 }
5578
5579 #[test]
5580 fn test_execution_version_setter_allows_upgrade() {
5581 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5582 let current = prot.execution_version();
5583 prot.set_execution_version_for_testing(current);
5584 prot.set_execution_version_for_testing(current + 1);
5585 assert_eq!(prot.execution_version(), current + 1);
5586 }
5587
5588 #[test]
5589 #[should_panic(expected = "cannot downgrade execution_version")]
5590 fn test_execution_version_setter_panics_on_downgrade() {
5591 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5592 let current = prot.execution_version();
5593 prot.set_execution_version_for_testing(current - 1);
5594 }
5595
5596 #[test]
5597 fn test_feature_flag_setter_by_string() {
5598 let mut prot: ProtocolConfig =
5599 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5600 assert!(!prot.zklogin_auth());
5601 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), true);
5602 assert!(prot.zklogin_auth());
5603 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), false);
5604 assert!(!prot.zklogin_auth());
5605 }
5606
5607 #[test]
5608 #[should_panic(expected = "unknown feature flag")]
5609 fn test_feature_flag_setter_unknown_flag() {
5610 let mut prot: ProtocolConfig =
5611 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5612 prot.set_feature_flag_for_testing("some random string".to_string(), true);
5613 }
5614
5615 #[test]
5616 fn test_get_for_version_if_supported_applies_test_overrides() {
5617 let before =
5618 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5619 .unwrap();
5620
5621 assert!(!before.enable_coin_reservation_obj_refs());
5622
5623 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5624 cfg.enable_coin_reservation_for_testing();
5625 cfg
5626 });
5627
5628 let after =
5629 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5630 .unwrap();
5631
5632 assert!(after.enable_coin_reservation_obj_refs());
5633 }
5634
5635 #[test]
5636 #[should_panic(expected = "unsupported version")]
5637 fn max_version_test() {
5638 let _ = ProtocolConfig::get_for_version_impl(
5641 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5642 Chain::Unknown,
5643 );
5644 }
5645
5646 #[test]
5647 fn lookup_by_string_test() {
5648 let prot: ProtocolConfig =
5649 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5650 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5652
5653 assert!(
5654 prot.lookup_attr("max_arguments".to_string())
5655 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5656 );
5657
5658 assert!(
5660 prot.lookup_attr("max_move_identifier_len".to_string())
5661 .is_none()
5662 );
5663
5664 let prot: ProtocolConfig =
5666 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5667 assert!(
5668 prot.lookup_attr("max_move_identifier_len".to_string())
5669 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5670 );
5671
5672 let prot: ProtocolConfig =
5673 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5674 assert!(
5676 prot.attr_map()
5677 .get("max_move_identifier_len")
5678 .unwrap()
5679 .is_none()
5680 );
5681 assert!(
5683 prot.attr_map().get("max_arguments").unwrap()
5684 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5685 );
5686
5687 let prot: ProtocolConfig =
5689 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5690 assert!(
5692 prot.feature_flags
5693 .lookup_attr("some random string".to_owned())
5694 .is_none()
5695 );
5696 assert!(
5697 !prot
5698 .feature_flags
5699 .attr_map()
5700 .contains_key("some random string")
5701 );
5702
5703 assert!(
5705 prot.feature_flags
5706 .lookup_attr("package_upgrades".to_owned())
5707 == Some(false)
5708 );
5709 assert!(
5710 prot.feature_flags
5711 .attr_map()
5712 .get("package_upgrades")
5713 .unwrap()
5714 == &false
5715 );
5716 let prot: ProtocolConfig =
5717 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5718 assert!(
5720 prot.feature_flags
5721 .lookup_attr("package_upgrades".to_owned())
5722 == Some(true)
5723 );
5724 assert!(
5725 prot.feature_flags
5726 .attr_map()
5727 .get("package_upgrades")
5728 .unwrap()
5729 == &true
5730 );
5731 }
5732
5733 #[test]
5734 fn limit_range_fn_test() {
5735 let low = 100u32;
5736 let high = 10000u64;
5737
5738 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5739 assert!(matches!(
5740 check_limit!(255u16, low, high),
5741 LimitThresholdCrossed::Soft(255u128, 100)
5742 ));
5743 assert!(matches!(
5749 check_limit!(2550000u64, low, high),
5750 LimitThresholdCrossed::Hard(2550000, 10000)
5751 ));
5752
5753 assert!(matches!(
5754 check_limit!(2550000u64, high, high),
5755 LimitThresholdCrossed::Hard(2550000, 10000)
5756 ));
5757
5758 assert!(matches!(
5759 check_limit!(1u8, high),
5760 LimitThresholdCrossed::None
5761 ));
5762
5763 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5764
5765 assert!(matches!(
5766 check_limit!(2550000u64, high),
5767 LimitThresholdCrossed::Hard(2550000, 10000)
5768 ));
5769 }
5770
5771 #[test]
5772 fn linkage_amendments_load() {
5773 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5774 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5775 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5776 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5777 }
5778
5779 #[test]
5780 fn render_scalar_fields_use_precision_safe_encoding() {
5781 use mysten_common::rpc_format::Unmetered;
5782
5783 let config = ProtocolConfig::get_for_max_version_UNSAFE();
5784 let rendered = config
5785 .render::<serde_json::Value>(&mut Unmetered)
5786 .expect("render should succeed");
5787
5788 let max_args = rendered
5789 .get("max_arguments")
5790 .expect("max_arguments set at max version");
5791 assert!(
5792 max_args.is_number(),
5793 "u32 should render as number, got {max_args:?}",
5794 );
5795
5796 let max_tx_size = rendered
5797 .get("max_tx_size_bytes")
5798 .expect("max_tx_size_bytes set at max version");
5799 assert!(
5800 max_tx_size.is_string(),
5801 "u64 should render as string, got {max_tx_size:?}",
5802 );
5803 }
5804
5805 #[test]
5806 fn render_includes_non_scalar_gasless_allowlist_as_json() {
5807 use mysten_common::rpc_format::Unmetered;
5808 use serde_json::json;
5809
5810 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5811 config.set_gasless_allowed_token_types_for_testing(vec![
5812 ("0xa::usdc::USDC".to_string(), 10_000),
5813 ("0xb::usdt::USDT".to_string(), 0),
5814 ]);
5815
5816 let rendered = config
5817 .render::<serde_json::Value>(&mut Unmetered)
5818 .expect("render should succeed under Unmetered budget");
5819 let allowlist = rendered
5820 .get("gasless_allowed_token_types")
5821 .expect("entry should be present after the testing setter");
5822
5823 assert_eq!(
5826 allowlist,
5827 &json!([["0xa::usdc::USDC", "10000"], ["0xb::usdt::USDT", "0"],]),
5828 );
5829 }
5830
5831 #[test]
5832 fn render_targets_prost_value_for_grpc() {
5833 use mysten_common::rpc_format::Unmetered;
5834 use prost_types::value::Kind;
5835
5836 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5837 config.set_gasless_allowed_token_types_for_testing(vec![(
5838 "0xa::usdc::USDC".to_string(),
5839 10_000,
5840 )]);
5841
5842 let rendered = config
5843 .render::<prost_types::Value>(&mut Unmetered)
5844 .expect("render to prost Value should succeed");
5845 let allowlist = rendered
5846 .get("gasless_allowed_token_types")
5847 .expect("entry should be present after the testing setter");
5848
5849 let Some(Kind::ListValue(outer)) = &allowlist.kind else {
5851 panic!(
5852 "expected ListValue at the top level, got {:?}",
5853 allowlist.kind
5854 );
5855 };
5856 assert_eq!(outer.values.len(), 1, "one allowlisted entry");
5857 let Some(Kind::ListValue(entry)) = &outer.values[0].kind else {
5858 panic!("expected each entry to be a ListValue");
5859 };
5860 assert_eq!(entry.values.len(), 2, "entry has (coin_type, amount)");
5861
5862 let Some(Kind::StringValue(coin_type)) = &entry.values[0].kind else {
5863 panic!("expected coin_type as StringValue");
5864 };
5865 assert_eq!(coin_type, "0xa::usdc::USDC");
5866
5867 let Some(Kind::StringValue(amount)) = &entry.values[1].kind else {
5869 panic!(
5870 "expected minimum_transfer_amount as StringValue (precision-safe u64); got {:?}",
5871 entry.values[1].kind,
5872 );
5873 };
5874 assert_eq!(amount, "10000");
5875 }
5876
5877 #[test]
5878 fn render_emits_null_for_unset_protocol_versions() {
5879 use mysten_common::rpc_format::Unmetered;
5880
5881 let config = ProtocolConfig::get_for_version(1.into(), Chain::Unknown);
5882 let rendered = config
5883 .render::<serde_json::Value>(&mut Unmetered)
5884 .expect("render should succeed");
5885 let entry = rendered
5889 .get("gasless_allowed_token_types")
5890 .expect("key should be present for every protocol version");
5891 assert!(
5892 entry.is_null(),
5893 "value should be null for pre-feature protocol version, got {entry:?}",
5894 );
5895 }
5896}