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, TableConfig},
18 file_format_common::VERSION_1,
19};
20use move_core_types::account_address::AccountAddress;
21use move_vm_config::verifier::VerifierConfig;
22use mysten_common::in_integration_test;
23use serde::{Deserialize, Serialize};
24use serde_with::skip_serializing_none;
25use sui_protocol_config_macros::{
26 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
27};
28use tracing::{info, warn};
29
30pub mod reachability;
31
32#[doc(hidden)]
35pub use antithesis_sdk::linkme;
36#[doc(hidden)]
37pub use mysten_common::assert_reachable_simtest;
38
39const MIN_PROTOCOL_VERSION: u64 = 1;
41const MAX_PROTOCOL_VERSION: u64 = 141;
42
43const TESTNET_USDC: &str =
44 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
45
46const MAINNET_USDC: &str =
47 "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
48const MAINNET_USDSUI: &str =
49 "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
50const MAINNET_SUI_USDE: &str =
51 "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
52const MAINNET_USDY: &str =
53 "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY";
54const MAINNET_FDUSD: &str =
55 "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD";
56const MAINNET_AUSD: &str =
57 "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD";
58const MAINNET_USDB: &str =
59 "0xe14726c336e81b32328e92afc37345d159f5b550b09fa92bd43640cfdd0a0cfd::usdb::USDB";
60
61#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
436pub struct ProtocolVersion(u64);
437
438impl ProtocolVersion {
439 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
444
445 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
446
447 #[cfg(not(msim))]
448 pub const MAX_ALLOWED: Self = Self::MAX;
449
450 #[cfg(msim)]
452 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
453
454 pub fn new(v: u64) -> Self {
455 Self(v)
456 }
457
458 pub const fn as_u64(&self) -> u64 {
459 self.0
460 }
461
462 pub fn max() -> Self {
465 Self::MAX
466 }
467
468 pub fn prev(self) -> Self {
469 Self(self.0.checked_sub(1).unwrap())
470 }
471}
472
473impl From<u64> for ProtocolVersion {
474 fn from(v: u64) -> Self {
475 Self::new(v)
476 }
477}
478
479impl std::ops::Sub<u64> for ProtocolVersion {
480 type Output = Self;
481 fn sub(self, rhs: u64) -> Self::Output {
482 Self::new(self.0 - rhs)
483 }
484}
485
486impl std::ops::Add<u64> for ProtocolVersion {
487 type Output = Self;
488 fn add(self, rhs: u64) -> Self::Output {
489 Self::new(self.0 + rhs)
490 }
491}
492
493#[derive(
494 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
495)]
496pub enum Chain {
497 Mainnet,
498 Testnet,
499 #[default]
500 Unknown,
501}
502
503impl Chain {
504 pub fn as_str(self) -> &'static str {
505 match self {
506 Chain::Mainnet => "mainnet",
507 Chain::Testnet => "testnet",
508 Chain::Unknown => "unknown",
509 }
510 }
511}
512
513pub struct Error(pub String);
514
515#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
518struct FeatureFlags {
519 #[serde(skip_serializing_if = "is_false")]
522 package_upgrades: bool,
523 #[serde(skip_serializing_if = "is_false")]
526 commit_root_state_digest: bool,
527 #[serde(skip_serializing_if = "is_false")]
529 advance_epoch_start_time_in_safe_mode: bool,
530 #[serde(skip_serializing_if = "is_false")]
533 loaded_child_objects_fixed: bool,
534 #[serde(skip_serializing_if = "is_false")]
537 missing_type_is_compatibility_error: bool,
538 #[serde(skip_serializing_if = "is_false")]
541 scoring_decision_with_validity_cutoff: bool,
542
543 #[serde(skip_serializing_if = "is_false")]
546 consensus_order_end_of_epoch_last: bool,
547
548 #[serde(skip_serializing_if = "is_false")]
552 consensus_slim_block_propagation: bool,
553
554 #[serde(skip_serializing_if = "is_false")]
556 disallow_adding_abilities_on_upgrade: bool,
557 #[serde(skip_serializing_if = "is_false")]
559 disable_invariant_violation_check_in_swap_loc: bool,
560 #[serde(skip_serializing_if = "is_false")]
563 advance_to_highest_supported_protocol_version: bool,
564 #[serde(skip_serializing_if = "is_false")]
566 ban_entry_init: bool,
567 #[serde(skip_serializing_if = "is_false")]
569 package_digest_hash_module: bool,
570 #[serde(skip_serializing_if = "is_false")]
572 disallow_change_struct_type_params_on_upgrade: bool,
573 #[serde(skip_serializing_if = "is_false")]
575 no_extraneous_module_bytes: bool,
576 #[serde(skip_serializing_if = "is_false")]
578 narwhal_versioned_metadata: bool,
579
580 #[serde(skip_serializing_if = "is_false")]
582 zklogin_auth: bool,
583 #[serde(skip_serializing_if = "is_zero")]
586 zklogin_circuit_mode: u64,
587 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
589 consensus_transaction_ordering: ConsensusTransactionOrdering,
590
591 #[serde(skip_serializing_if = "is_false")]
599 simplified_unwrap_then_delete: bool,
600 #[serde(skip_serializing_if = "is_false")]
602 upgraded_multisig_supported: bool,
603 #[serde(skip_serializing_if = "is_false")]
605 txn_base_cost_as_multiplier: bool,
606
607 #[serde(skip_serializing_if = "is_false")]
609 shared_object_deletion: bool,
610
611 #[serde(skip_serializing_if = "is_false")]
613 narwhal_new_leader_election_schedule: bool,
614
615 #[serde(skip_serializing_if = "is_empty")]
617 zklogin_supported_providers: BTreeSet<String>,
618
619 #[serde(skip_serializing_if = "is_false")]
621 loaded_child_object_format: bool,
622
623 #[serde(skip_serializing_if = "is_false")]
624 #[skip_protocol_config_accessor]
625 enable_jwk_consensus_updates: bool,
626
627 #[serde(skip_serializing_if = "is_false")]
628 #[skip_protocol_config_accessor]
629 end_of_epoch_transaction_supported: bool,
630
631 #[serde(skip_serializing_if = "is_false")]
634 simple_conservation_checks: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
638 loaded_child_object_format_type: bool,
639
640 #[serde(skip_serializing_if = "is_false")]
642 receive_objects: bool,
643
644 #[serde(skip_serializing_if = "is_false")]
646 consensus_checkpoint_signature_key_includes_digest: bool,
647
648 #[serde(skip_serializing_if = "is_false")]
650 random_beacon: bool,
651
652 #[serde(skip_serializing_if = "is_false")]
654 #[skip_protocol_config_accessor]
655 bridge: bool,
656
657 #[serde(skip_serializing_if = "is_false")]
658 enable_effects_v2: bool,
659
660 #[serde(skip_serializing_if = "is_false")]
662 narwhal_certificate_v2: bool,
663
664 #[serde(skip_serializing_if = "is_false")]
666 verify_legacy_zklogin_address: bool,
667
668 #[serde(skip_serializing_if = "is_false")]
670 throughput_aware_consensus_submission: bool,
671
672 #[serde(skip_serializing_if = "is_false")]
674 recompute_has_public_transfer_in_execution: bool,
675
676 #[serde(skip_serializing_if = "is_false")]
678 accept_zklogin_in_multisig: bool,
679
680 #[serde(skip_serializing_if = "is_false")]
682 accept_passkey_in_multisig: bool,
683
684 #[serde(skip_serializing_if = "is_false")]
686 validate_zklogin_public_identifier: bool,
687
688 #[serde(skip_serializing_if = "is_false")]
691 include_consensus_digest_in_prologue: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
695 hardened_otw_check: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
699 allow_receiving_object_id: bool,
700
701 #[serde(skip_serializing_if = "is_false")]
703 enable_poseidon: bool,
704
705 #[serde(skip_serializing_if = "is_false")]
707 enable_coin_deny_list: bool,
708
709 #[serde(skip_serializing_if = "is_false")]
711 enable_group_ops_native_functions: bool,
712
713 #[serde(skip_serializing_if = "is_false")]
715 enable_group_ops_native_function_msm: bool,
716
717 #[serde(skip_serializing_if = "is_false")]
719 enable_ristretto255_group_ops: bool,
720
721 #[serde(skip_serializing_if = "is_false")]
723 enable_verify_bulletproofs_ristretto255: bool,
724
725 #[serde(skip_serializing_if = "is_false")]
727 enable_nitro_attestation: bool,
728
729 #[serde(skip_serializing_if = "is_false")]
731 enable_nitro_attestation_upgraded_parsing: bool,
732
733 #[serde(skip_serializing_if = "is_false")]
735 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
736
737 #[serde(skip_serializing_if = "is_false")]
739 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
740
741 #[serde(skip_serializing_if = "is_false")]
743 reject_mutable_random_on_entry_functions: bool,
744
745 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
747 per_object_congestion_control_mode: PerObjectCongestionControlMode,
748
749 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
751 consensus_choice: ConsensusChoice,
752
753 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
755 consensus_network: ConsensusNetwork,
756
757 #[serde(skip_serializing_if = "is_false")]
759 correct_gas_payment_limit_check: bool,
760
761 #[serde(skip_serializing_if = "Option::is_none")]
763 zklogin_max_epoch_upper_bound_delta: Option<u64>,
764
765 #[serde(skip_serializing_if = "is_false")]
767 mysticeti_leader_scoring_and_schedule: bool,
768
769 #[serde(skip_serializing_if = "is_false")]
771 reshare_at_same_initial_version: bool,
772
773 #[serde(skip_serializing_if = "is_false")]
775 resolve_abort_locations_to_package_id: bool,
776
777 #[serde(skip_serializing_if = "is_false")]
781 mysticeti_use_committed_subdag_digest: bool,
782
783 #[serde(skip_serializing_if = "is_false")]
785 enable_vdf: bool,
786
787 #[serde(skip_serializing_if = "is_false")]
791 record_consensus_determined_version_assignments_in_prologue: bool,
792 #[serde(skip_serializing_if = "is_false")]
795 record_consensus_determined_version_assignments_in_prologue_v2: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
799 fresh_vm_on_framework_upgrade: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
809 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
810
811 #[serde(skip_serializing_if = "Option::is_none")]
813 mysticeti_num_leaders_per_round: Option<usize>,
814
815 #[serde(skip_serializing_if = "is_false")]
817 soft_bundle: bool,
818
819 #[serde(skip_serializing_if = "is_false")]
821 enable_coin_deny_list_v2: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
825 passkey_auth: bool,
826
827 #[serde(skip_serializing_if = "is_false")]
830 mldsa65_auth: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
834 secp256r1_ecrecover_checks_x_below_p: bool,
835
836 #[serde(skip_serializing_if = "is_false")]
838 authority_capabilities_v2: bool,
839
840 #[serde(skip_serializing_if = "is_false")]
842 rethrow_serialization_type_layout_errors: bool,
843
844 #[serde(skip_serializing_if = "is_false")]
846 consensus_distributed_vote_scoring_strategy: bool,
847
848 #[serde(skip_serializing_if = "is_false")]
850 consensus_round_prober: bool,
851
852 #[serde(skip_serializing_if = "is_false")]
854 validate_identifier_inputs: bool,
855
856 #[serde(skip_serializing_if = "is_false")]
858 disallow_self_identifier: bool,
859
860 #[serde(skip_serializing_if = "is_false")]
862 mysticeti_fastpath: bool,
863
864 #[serde(skip_serializing_if = "is_false")]
868 disable_preconsensus_locking: bool,
869
870 #[serde(skip_serializing_if = "is_false")]
872 relocate_event_module: bool,
873
874 #[serde(skip_serializing_if = "is_false")]
876 uncompressed_g1_group_elements: bool,
877
878 #[serde(skip_serializing_if = "is_false")]
879 disallow_new_modules_in_deps_only_packages: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
883 consensus_smart_ancestor_selection: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
887 consensus_round_prober_probe_accepted_rounds: bool,
888
889 #[serde(skip_serializing_if = "is_false")]
891 native_charging_v2: bool,
892
893 #[serde(skip_serializing_if = "is_false")]
896 #[skip_protocol_config_accessor]
897 consensus_linearize_subdag_v2: bool,
898
899 #[serde(skip_serializing_if = "is_false")]
901 convert_type_argument_error: bool,
902
903 #[serde(skip_serializing_if = "is_false")]
905 variant_nodes: bool,
906
907 #[serde(skip_serializing_if = "is_false")]
909 consensus_zstd_compression: bool,
910
911 #[serde(skip_serializing_if = "is_false")]
913 minimize_child_object_mutations: bool,
914
915 #[serde(skip_serializing_if = "is_false")]
918 record_additional_state_digest_in_prologue: bool,
919
920 #[serde(skip_serializing_if = "is_false")]
922 move_native_context: bool,
923
924 #[serde(skip_serializing_if = "is_false")]
927 #[skip_protocol_config_accessor]
928 consensus_median_based_commit_timestamp: bool,
929
930 #[serde(skip_serializing_if = "is_false")]
933 normalize_ptb_arguments: bool,
934
935 #[serde(skip_serializing_if = "is_false")]
937 consensus_batched_block_sync: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 enforce_checkpoint_timestamp_monotonicity: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 max_ptb_value_size_v2: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 resolve_type_input_ids_to_defining_id: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 enable_party_transfer: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 allow_unbounded_system_objects: bool,
958
959 #[serde(skip_serializing_if = "is_false")]
961 type_tags_in_object_runtime: bool,
962
963 #[serde(skip_serializing_if = "is_false")]
965 enable_accumulators: bool,
966
967 #[serde(skip_serializing_if = "is_false")]
969 #[skip_protocol_config_accessor]
970 enable_coin_reservation_obj_refs: bool,
971
972 #[serde(skip_serializing_if = "is_false")]
975 create_root_accumulator_object: bool,
976
977 #[serde(skip_serializing_if = "is_false")]
979 #[skip_protocol_config_accessor]
980 enable_authenticated_event_streams: bool,
981
982 #[serde(skip_serializing_if = "is_false")]
984 enable_address_balance_gas_payments: bool,
985
986 #[serde(skip_serializing_if = "is_false")]
988 address_balance_gas_check_rgp_at_signing: bool,
989
990 #[serde(skip_serializing_if = "is_false")]
991 address_balance_gas_reject_gas_coin_arg: bool,
992
993 #[serde(skip_serializing_if = "is_false")]
995 enable_multi_epoch_transaction_expiration: bool,
996
997 #[serde(skip_serializing_if = "is_false")]
999 relax_valid_during_for_owned_inputs: bool,
1000
1001 #[serde(skip_serializing_if = "is_false")]
1003 enable_ptb_execution_v2: bool,
1004
1005 #[serde(skip_serializing_if = "is_false")]
1007 better_adapter_type_resolution_errors: bool,
1008
1009 #[serde(skip_serializing_if = "is_false")]
1011 record_time_estimate_processed: bool,
1012
1013 #[serde(skip_serializing_if = "is_false")]
1015 dependency_linkage_error: bool,
1016
1017 #[serde(skip_serializing_if = "is_false")]
1019 additional_multisig_checks: bool,
1020
1021 #[serde(skip_serializing_if = "is_false")]
1023 ignore_execution_time_observations_after_certs_closed: bool,
1024
1025 #[serde(skip_serializing_if = "is_false")]
1029 debug_fatal_on_move_invariant_violation: bool,
1030
1031 #[serde(skip_serializing_if = "is_false")]
1034 allow_private_accumulator_entrypoints: bool,
1035
1036 #[serde(skip_serializing_if = "is_false")]
1039 additional_consensus_digest_indirect_state: bool,
1040
1041 #[serde(skip_serializing_if = "is_false")]
1043 check_for_init_during_upgrade: bool,
1044
1045 #[serde(skip_serializing_if = "is_false")]
1047 enable_init_on_upgrade: bool,
1048
1049 #[serde(skip_serializing_if = "is_false")]
1051 enable_order_independent_upgrade_init_linkage: bool,
1052
1053 #[serde(skip_serializing_if = "is_false")]
1056 harden_linkage_consistency: bool,
1057
1058 #[serde(skip_serializing_if = "is_false")]
1060 per_command_shared_object_transfer_rules: bool,
1061
1062 #[serde(skip_serializing_if = "is_false")]
1064 validate_ptb_argument_indices: bool,
1065
1066 #[serde(skip_serializing_if = "is_false")]
1068 include_checkpoint_artifacts_digest_in_summary: bool,
1069
1070 #[serde(skip_serializing_if = "is_false")]
1072 use_mfp_txns_in_load_initial_object_debts: bool,
1073
1074 #[serde(skip_serializing_if = "is_false")]
1076 cancel_for_failed_dkg_early: bool,
1077
1078 #[serde(skip_serializing_if = "is_false")]
1080 always_advance_dkg_to_resolution: bool,
1081
1082 #[serde(skip_serializing_if = "is_false")]
1084 allow_dkg_completion_after_timeout: bool,
1085
1086 #[serde(skip_serializing_if = "is_false")]
1088 enable_coin_registry: bool,
1089
1090 #[serde(skip_serializing_if = "is_false")]
1092 abstract_size_in_object_runtime: bool,
1093
1094 #[serde(skip_serializing_if = "is_false")]
1096 object_runtime_charge_cache_load_gas: bool,
1097
1098 #[serde(skip_serializing_if = "is_false")]
1100 additional_borrow_checks: bool,
1101
1102 #[serde(skip_serializing_if = "is_false")]
1104 use_new_commit_handler: bool,
1105
1106 #[serde(skip_serializing_if = "is_false")]
1108 better_loader_errors: bool,
1109
1110 #[serde(skip_serializing_if = "is_false")]
1112 generate_df_type_layouts: bool,
1113
1114 #[serde(skip_serializing_if = "is_false")]
1116 allow_references_in_ptbs: bool,
1117
1118 #[serde(skip_serializing_if = "is_false")]
1125 framework_tx_context_mut_restrictions: bool,
1126
1127 #[serde(skip_serializing_if = "is_false")]
1129 include_function_signatures_in_instantiation_limits: bool,
1130
1131 #[serde(skip_serializing_if = "is_false")]
1136 ptb_tx_context_restrictions: bool,
1137
1138 #[serde(skip_serializing_if = "is_false")]
1140 enable_display_registry: bool,
1141
1142 #[serde(skip_serializing_if = "is_false")]
1144 private_generics_verifier_v2: bool,
1145
1146 #[serde(skip_serializing_if = "is_false")]
1148 deprecate_global_storage_ops_during_deserialization: bool,
1149
1150 #[serde(skip_serializing_if = "is_false")]
1153 enable_non_exclusive_writes: bool,
1154
1155 #[serde(skip_serializing_if = "is_false")]
1157 deprecate_global_storage_ops: bool,
1158
1159 #[serde(skip_serializing_if = "is_false")]
1161 normalize_depth_formula: bool,
1162
1163 #[serde(skip_serializing_if = "is_false")]
1166 charge_ld_const_abstract_size: bool,
1167
1168 #[serde(skip_serializing_if = "is_false")]
1170 consensus_skip_gced_accept_votes: bool,
1171
1172 #[serde(skip_serializing_if = "is_false")]
1175 include_cancelled_randomness_txns_in_prologue: bool,
1176
1177 #[serde(skip_serializing_if = "is_false")]
1179 #[skip_protocol_config_accessor]
1180 address_aliases: bool,
1181
1182 #[serde(skip_serializing_if = "is_false")]
1184 create_forwarding_address_registry: bool,
1185
1186 #[serde(skip_serializing_if = "is_false")]
1188 enable_forwarding_addresses: bool,
1189
1190 #[serde(skip_serializing_if = "is_false")]
1193 fix_checkpoint_signature_mapping: bool,
1194
1195 #[serde(skip_serializing_if = "is_false")]
1197 enable_object_funds_withdraw: bool,
1198
1199 #[serde(skip_serializing_if = "is_false")]
1202 record_net_unsettled_object_withdraws: bool,
1203
1204 #[serde(skip_serializing_if = "is_false")]
1206 consensus_skip_gced_blocks_in_direct_finalization: bool,
1207
1208 #[serde(skip_serializing_if = "is_false")]
1210 gas_rounding_halve_digits: bool,
1211
1212 #[serde(skip_serializing_if = "is_false")]
1214 flexible_tx_context_positions: bool,
1215
1216 #[serde(skip_serializing_if = "is_false")]
1218 disable_entry_point_signature_check: bool,
1219
1220 #[serde(skip_serializing_if = "is_false")]
1222 convert_withdrawal_compatibility_ptb_arguments: bool,
1223
1224 #[serde(skip_serializing_if = "is_false")]
1226 restrict_hot_or_not_entry_functions: bool,
1227
1228 #[serde(skip_serializing_if = "is_false")]
1230 split_checkpoints_in_consensus_handler: bool,
1231
1232 #[serde(skip_serializing_if = "is_false")]
1234 consensus_always_accept_system_transactions: bool,
1235
1236 #[serde(skip_serializing_if = "is_false")]
1238 validator_metadata_verify_v2: bool,
1239
1240 #[serde(skip_serializing_if = "is_false")]
1243 defer_unpaid_amplification: bool,
1244
1245 #[serde(skip_serializing_if = "is_false")]
1248 defer_owned_object_double_spend: bool,
1249
1250 #[serde(skip_serializing_if = "is_false")]
1253 allowed_proposers: bool,
1254
1255 #[serde(skip_serializing_if = "is_false")]
1261 #[skip_protocol_config_accessor]
1262 staggered_submission_signal: bool,
1263
1264 #[serde(skip_serializing_if = "is_false")]
1265 randomize_checkpoint_tx_limit_in_tests: bool,
1266
1267 #[serde(skip_serializing_if = "is_false")]
1269 gasless_transaction_drop_safety: bool,
1270
1271 #[serde(skip_serializing_if = "is_false")]
1274 merge_randomness_into_checkpoint: bool,
1275
1276 #[serde(skip_serializing_if = "is_false")]
1278 use_coin_party_owner: bool,
1279
1280 #[serde(skip_serializing_if = "is_false")]
1281 enable_gasless: bool,
1282
1283 #[serde(skip_serializing_if = "is_false")]
1284 gasless_verify_remaining_balance: bool,
1285
1286 #[serde(skip_serializing_if = "is_false")]
1287 disallow_jump_orphans: bool,
1288
1289 #[serde(skip_serializing_if = "is_false")]
1291 early_return_receive_object_mismatched_type: bool,
1292
1293 #[serde(skip_serializing_if = "is_false")]
1298 timestamp_based_epoch_close: bool,
1299
1300 #[serde(skip_serializing_if = "is_false")]
1303 limit_groth16_pvk_inputs: bool,
1304
1305 #[serde(skip_serializing_if = "is_false")]
1309 check_groth16_pvk_length: bool,
1310
1311 #[serde(skip_serializing_if = "is_false")]
1316 enforce_address_balance_change_invariant: bool,
1317
1318 #[serde(skip_serializing_if = "is_false")]
1320 share_transaction_deny_config_in_consensus: bool,
1321
1322 #[serde(skip_serializing_if = "is_false")]
1324 granular_post_execution_checks: bool,
1325
1326 #[serde(skip_serializing_if = "is_false")]
1328 early_exit_on_iffw: bool,
1329
1330 #[serde(skip_serializing_if = "is_false")]
1332 enable_unified_linkage: bool,
1333
1334 #[serde(skip_serializing_if = "is_false")]
1337 #[skip_protocol_config_accessor]
1338 enable_allowances: bool,
1339
1340 #[serde(skip_serializing_if = "is_false")]
1342 fix_ptb_generated_reads: bool,
1343
1344 #[serde(skip_serializing_if = "is_false")]
1345 check_object_funds_withdraw_in_execution: bool,
1346 #[serde(skip_serializing_if = "is_false")]
1348 memory_safety_invariant_check_v2: bool,
1349
1350 #[serde(skip_serializing_if = "is_false")]
1352 disable_effects_tx_dependencies: bool,
1353
1354 #[serde(skip_serializing_if = "is_false")]
1358 merge_colliding_deferrals: bool,
1359
1360 #[serde(skip_serializing_if = "is_false")]
1364 shuffle_consensus_commit_blocks: bool,
1365
1366 #[serde(skip_serializing_if = "is_false")]
1369 disable_id_leak_verifier: bool,
1370}
1371
1372fn is_false(b: &bool) -> bool {
1373 !b
1374}
1375
1376fn is_empty(b: &BTreeSet<String>) -> bool {
1377 b.is_empty()
1378}
1379
1380fn is_zero(val: &u64) -> bool {
1381 *val == 0
1382}
1383
1384#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1386pub enum ConsensusTransactionOrdering {
1387 #[default]
1389 None,
1390 ByGasPrice,
1392}
1393
1394impl ConsensusTransactionOrdering {
1395 pub fn is_none(&self) -> bool {
1396 matches!(self, ConsensusTransactionOrdering::None)
1397 }
1398}
1399
1400#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1401pub struct ExecutionTimeEstimateParams {
1402 pub target_utilization: u64,
1404 pub allowed_txn_cost_overage_burst_limit_us: u64,
1408
1409 pub randomness_scalar: u64,
1412
1413 pub max_estimate_us: u64,
1415
1416 pub stored_observations_num_included_checkpoints: u64,
1419
1420 pub stored_observations_limit: u64,
1422
1423 #[serde(skip_serializing_if = "is_zero")]
1426 pub stake_weighted_median_threshold: u64,
1427
1428 #[serde(skip_serializing_if = "is_false")]
1432 pub default_none_duration_for_new_keys: bool,
1433
1434 #[serde(skip_serializing_if = "Option::is_none")]
1436 pub observations_chunk_size: Option<u64>,
1437}
1438
1439#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1441pub enum PerObjectCongestionControlMode {
1442 #[default]
1443 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1449
1450impl PerObjectCongestionControlMode {
1451 pub fn is_none(&self) -> bool {
1452 matches!(self, PerObjectCongestionControlMode::None)
1453 }
1454}
1455
1456#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1458pub enum ConsensusChoice {
1459 #[default]
1460 Narwhal,
1461 SwapEachEpoch,
1462 Mysticeti,
1463}
1464
1465impl ConsensusChoice {
1466 pub fn is_narwhal(&self) -> bool {
1467 matches!(self, ConsensusChoice::Narwhal)
1468 }
1469}
1470
1471#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1473pub enum ConsensusNetwork {
1474 #[default]
1475 Anemo,
1476 Tonic,
1477}
1478
1479impl ConsensusNetwork {
1480 pub fn is_anemo(&self) -> bool {
1481 matches!(self, ConsensusNetwork::Anemo)
1482 }
1483}
1484
1485#[skip_serializing_none]
1517#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1518pub struct ProtocolConfig {
1519 pub version: ProtocolVersion,
1520
1521 #[serde(skip)]
1526 chain: Chain,
1527
1528 feature_flags: FeatureFlags,
1529
1530 max_tx_size_bytes: Option<u64>,
1533
1534 max_input_objects: Option<u64>,
1536
1537 max_size_written_objects: Option<u64>,
1541 max_size_written_objects_system_tx: Option<u64>,
1544
1545 max_serialized_tx_effects_size_bytes: Option<u64>,
1547
1548 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1550
1551 max_gas_payment_objects: Option<u32>,
1553
1554 max_modules_in_publish: Option<u32>,
1556
1557 max_package_dependencies: Option<u32>,
1559
1560 max_arguments: Option<u32>,
1563
1564 max_type_arguments: Option<u32>,
1566
1567 max_type_argument_depth: Option<u32>,
1569
1570 max_pure_argument_size: Option<u32>,
1572
1573 max_programmable_tx_commands: Option<u32>,
1575
1576 move_binary_format_version: Option<u32>,
1579 min_move_binary_format_version: Option<u32>,
1580
1581 binary_module_handles: Option<u16>,
1583 binary_struct_handles: Option<u16>,
1584 binary_function_handles: Option<u16>,
1585 binary_function_instantiations: Option<u16>,
1586 binary_signatures: Option<u16>,
1587 binary_constant_pool: Option<u16>,
1588 binary_identifiers: Option<u16>,
1589 binary_address_identifiers: Option<u16>,
1590 binary_struct_defs: Option<u16>,
1591 binary_struct_def_instantiations: Option<u16>,
1592 binary_function_defs: Option<u16>,
1593 binary_field_handles: Option<u16>,
1594 binary_field_instantiations: Option<u16>,
1595 binary_friend_decls: Option<u16>,
1596 binary_enum_defs: Option<u16>,
1597 binary_enum_def_instantiations: Option<u16>,
1598 binary_variant_handles: Option<u16>,
1599 binary_variant_instantiation_handles: Option<u16>,
1600
1601 max_move_object_size: Option<u64>,
1603
1604 max_move_package_size: Option<u64>,
1607
1608 max_publish_or_upgrade_per_ptb: Option<u64>,
1610
1611 max_tx_gas: Option<u64>,
1613
1614 max_gas_price: Option<u64>,
1616
1617 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1620
1621 max_gas_computation_bucket: Option<u64>,
1623
1624 gas_rounding_step: Option<u64>,
1626
1627 max_loop_depth: Option<u64>,
1629
1630 max_generic_instantiation_length: Option<u64>,
1632
1633 max_function_parameters: Option<u64>,
1635
1636 max_basic_blocks: Option<u64>,
1638
1639 max_value_stack_size: Option<u64>,
1641
1642 max_type_nodes: Option<u64>,
1644
1645 max_generic_instantiation_type_nodes_per_function: Option<u64>,
1647
1648 max_generic_instantiation_type_nodes_per_module: Option<u64>,
1650
1651 max_accumulator_type_nodes: Option<u64>,
1653
1654 max_push_size: Option<u64>,
1656
1657 max_struct_definitions: Option<u64>,
1659
1660 max_function_definitions: Option<u64>,
1662
1663 max_fields_in_struct: Option<u64>,
1665
1666 max_dependency_depth: Option<u64>,
1668
1669 max_num_event_emit: Option<u64>,
1671
1672 max_num_new_move_object_ids: Option<u64>,
1674
1675 max_num_new_move_object_ids_system_tx: Option<u64>,
1677
1678 max_num_deleted_move_object_ids: Option<u64>,
1680
1681 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1683
1684 max_num_transferred_move_object_ids: Option<u64>,
1686
1687 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1689
1690 max_event_emit_size: Option<u64>,
1692
1693 max_event_emit_size_total: Option<u64>,
1695
1696 max_move_vector_len: Option<u64>,
1698
1699 max_move_identifier_len: Option<u64>,
1701
1702 max_move_value_depth: Option<u64>,
1704
1705 package_arena_size_in_bytes: Option<u64>,
1708
1709 max_move_enum_variants: Option<u64>,
1711
1712 max_back_edges_per_function: Option<u64>,
1714
1715 max_back_edges_per_module: Option<u64>,
1717
1718 max_verifier_meter_ticks_per_function: Option<u64>,
1720
1721 max_meter_ticks_per_module: Option<u64>,
1723
1724 max_meter_ticks_per_package: Option<u64>,
1726
1727 object_runtime_max_num_cached_objects: Option<u64>,
1731
1732 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1734
1735 object_runtime_max_num_store_entries: Option<u64>,
1737
1738 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1740
1741 base_tx_cost_fixed: Option<u64>,
1744
1745 package_publish_cost_fixed: Option<u64>,
1748
1749 base_tx_cost_per_byte: Option<u64>,
1752
1753 package_publish_cost_per_byte: Option<u64>,
1755
1756 obj_access_cost_read_per_byte: Option<u64>,
1758
1759 obj_access_cost_read_per_package_kb: Option<u64>,
1762
1763 obj_access_cost_mutate_per_byte: Option<u64>,
1765
1766 obj_access_cost_delete_per_byte: Option<u64>,
1768
1769 obj_access_cost_verify_per_byte: Option<u64>,
1779
1780 max_type_to_layout_nodes: Option<u64>,
1782
1783 max_ptb_value_size: Option<u64>,
1785
1786 gas_model_version: Option<u64>,
1789
1790 obj_data_cost_refundable: Option<u64>,
1793
1794 obj_metadata_cost_non_refundable: Option<u64>,
1798
1799 storage_rebate_rate: Option<u64>,
1805
1806 storage_fund_reinvest_rate: Option<u64>,
1809
1810 reward_slashing_rate: Option<u64>,
1813
1814 storage_gas_price: Option<u64>,
1816
1817 accumulator_object_storage_cost: Option<u64>,
1819
1820 max_transactions_per_checkpoint: Option<u64>,
1825
1826 max_checkpoint_size_bytes: Option<u64>,
1830
1831 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1836
1837 address_from_bytes_cost_base: Option<u64>,
1842 address_to_u256_cost_base: Option<u64>,
1844 address_from_u256_cost_base: Option<u64>,
1846
1847 config_read_setting_impl_cost_base: Option<u64>,
1852 config_read_setting_impl_cost_per_byte: Option<u64>,
1853
1854 package_original_package_id_impl_cost_base: Option<u64>,
1855 package_original_package_id_impl_cost_per_byte: Option<u64>,
1856
1857 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1860 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1861 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1862 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1863 dynamic_field_add_child_object_cost_base: Option<u64>,
1865 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1866 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1867 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1868 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1870 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1871 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1872 dynamic_field_remove_child_object_cost_base: Option<u64>,
1874 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1875 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1876 dynamic_field_has_child_object_cost_base: Option<u64>,
1878 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1880 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1881 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1882
1883 scratch_add_cost_base: Option<u64>,
1886 scratch_read_cost_base: Option<u64>,
1888 scratch_read_value_cost: Option<u64>,
1889 scratch_remove_cost_base: Option<u64>,
1891 scratch_exists_cost_base: Option<u64>,
1893 scratch_exists_with_type_cost_base: Option<u64>,
1895 scratch_exists_with_type_type_cost: Option<u64>,
1896 max_scratch_pad_size: Option<u64>,
1898
1899 event_emit_cost_base: Option<u64>,
1902 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1903 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1904 event_emit_output_cost_per_byte: Option<u64>,
1905 event_emit_auth_stream_cost: Option<u64>,
1906
1907 reserve_object_funds_for_withdrawal_cost_base: Option<u64>,
1910 reserve_object_funds_for_withdrawal_cold_read_cost: Option<u64>,
1912
1913 object_borrow_uid_cost_base: Option<u64>,
1916 object_delete_impl_cost_base: Option<u64>,
1918 object_record_new_uid_cost_base: Option<u64>,
1920 object_record_new_uid_from_hash_cost_base: Option<u64>,
1923 object_is_shared_input_cost_base: Option<u64>,
1925
1926 transfer_transfer_internal_cost_base: Option<u64>,
1929 transfer_party_transfer_internal_cost_base: Option<u64>,
1931 transfer_freeze_object_cost_base: Option<u64>,
1933 transfer_share_object_cost_base: Option<u64>,
1935 transfer_receive_object_cost_base: Option<u64>,
1938 transfer_receive_object_cost_per_byte: Option<u64>,
1939 transfer_receive_object_type_cost_per_byte: Option<u64>,
1940
1941 tx_context_derive_id_cost_base: Option<u64>,
1944 tx_context_fresh_id_cost_base: Option<u64>,
1945 tx_context_sender_cost_base: Option<u64>,
1946 tx_context_epoch_cost_base: Option<u64>,
1947 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1948 tx_context_sponsor_cost_base: Option<u64>,
1949 tx_context_rgp_cost_base: Option<u64>,
1950 tx_context_gas_price_cost_base: Option<u64>,
1951 tx_context_gas_budget_cost_base: Option<u64>,
1952 tx_context_ids_created_cost_base: Option<u64>,
1953 tx_context_replace_cost_base: Option<u64>,
1954
1955 clock_borrow_cost_base: Option<u64>,
1958
1959 types_is_one_time_witness_cost_base: Option<u64>,
1962 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1963 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1964
1965 validator_validate_metadata_cost_base: Option<u64>,
1968 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1969
1970 crypto_invalid_arguments_cost: Option<u64>,
1972 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1974 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1975 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1976
1977 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1979 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1980 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1981
1982 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1984 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1985 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1986 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1987 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1988 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1989
1990 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1992
1993 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1995 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1996 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1997 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1998 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1999 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
2000
2001 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
2003 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
2004 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
2005 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
2006 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
2007 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
2008
2009 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
2011 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
2012 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
2013 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
2014 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
2015 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
2016
2017 ecvrf_ecvrf_verify_cost_base: Option<u64>,
2019 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
2020 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
2021
2022 ed25519_ed25519_verify_cost_base: Option<u64>,
2024 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
2025 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
2026
2027 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
2029 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
2030
2031 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
2033 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
2034 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
2035 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
2036 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
2037
2038 hash_blake2b256_cost_base: Option<u64>,
2040 hash_blake2b256_data_cost_per_byte: Option<u64>,
2041 hash_blake2b256_data_cost_per_block: Option<u64>,
2042
2043 hash_keccak256_cost_base: Option<u64>,
2045 hash_keccak256_data_cost_per_byte: Option<u64>,
2046 hash_keccak256_data_cost_per_block: Option<u64>,
2047
2048 poseidon_bn254_cost_base: Option<u64>,
2050 poseidon_bn254_cost_per_block: Option<u64>,
2051
2052 group_ops_bls12381_decode_scalar_cost: Option<u64>,
2054 group_ops_bls12381_decode_g1_cost: Option<u64>,
2055 group_ops_bls12381_decode_g2_cost: Option<u64>,
2056 group_ops_bls12381_decode_gt_cost: Option<u64>,
2057 group_ops_bls12381_scalar_add_cost: Option<u64>,
2058 group_ops_bls12381_g1_add_cost: Option<u64>,
2059 group_ops_bls12381_g2_add_cost: Option<u64>,
2060 group_ops_bls12381_gt_add_cost: Option<u64>,
2061 group_ops_bls12381_scalar_sub_cost: Option<u64>,
2062 group_ops_bls12381_g1_sub_cost: Option<u64>,
2063 group_ops_bls12381_g2_sub_cost: Option<u64>,
2064 group_ops_bls12381_gt_sub_cost: Option<u64>,
2065 group_ops_bls12381_scalar_mul_cost: Option<u64>,
2066 group_ops_bls12381_g1_mul_cost: Option<u64>,
2067 group_ops_bls12381_g2_mul_cost: Option<u64>,
2068 group_ops_bls12381_gt_mul_cost: Option<u64>,
2069 group_ops_bls12381_scalar_div_cost: Option<u64>,
2070 group_ops_bls12381_g1_div_cost: Option<u64>,
2071 group_ops_bls12381_g2_div_cost: Option<u64>,
2072 group_ops_bls12381_gt_div_cost: Option<u64>,
2073 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
2074 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
2075 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
2076 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
2077 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
2078 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
2079 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
2080 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
2081 group_ops_bls12381_msm_max_len: Option<u32>,
2082 group_ops_bls12381_pairing_cost: Option<u64>,
2083 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
2084 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
2085 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
2086 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
2087 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
2088
2089 group_ops_ristretto_decode_scalar_cost: Option<u64>,
2090 group_ops_ristretto_decode_point_cost: Option<u64>,
2091 group_ops_ristretto_scalar_add_cost: Option<u64>,
2092 group_ops_ristretto_point_add_cost: Option<u64>,
2093 group_ops_ristretto_scalar_sub_cost: Option<u64>,
2094 group_ops_ristretto_point_sub_cost: Option<u64>,
2095 group_ops_ristretto_scalar_mul_cost: Option<u64>,
2096 group_ops_ristretto_point_mul_cost: Option<u64>,
2097 group_ops_ristretto_scalar_div_cost: Option<u64>,
2098 group_ops_ristretto_point_div_cost: Option<u64>,
2099
2100 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
2101 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
2102 max_bulletproofs_total_bits: Option<u64>,
2105
2106 hmac_hmac_sha3_256_cost_base: Option<u64>,
2108 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
2109 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
2110
2111 check_zklogin_id_cost_base: Option<u64>,
2113 check_zklogin_issuer_cost_base: Option<u64>,
2115
2116 vdf_verify_vdf_cost: Option<u64>,
2117 vdf_hash_to_input_cost: Option<u64>,
2118
2119 nitro_attestation_parse_base_cost: Option<u64>,
2121 nitro_attestation_parse_cost_per_byte: Option<u64>,
2122 nitro_attestation_verify_base_cost: Option<u64>,
2123 nitro_attestation_verify_cost_per_cert: Option<u64>,
2124
2125 bcs_per_byte_serialized_cost: Option<u64>,
2127 bcs_legacy_min_output_size_cost: Option<u64>,
2128 bcs_failure_cost: Option<u64>,
2129
2130 hash_sha2_256_base_cost: Option<u64>,
2131 hash_sha2_256_per_byte_cost: Option<u64>,
2132 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
2133 hash_sha3_256_base_cost: Option<u64>,
2134 hash_sha3_256_per_byte_cost: Option<u64>,
2135 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
2136 type_name_get_base_cost: Option<u64>,
2137 type_name_get_per_byte_cost: Option<u64>,
2138 type_name_id_base_cost: Option<u64>,
2139
2140 string_check_utf8_base_cost: Option<u64>,
2141 string_check_utf8_per_byte_cost: Option<u64>,
2142 string_is_char_boundary_base_cost: Option<u64>,
2143 string_sub_string_base_cost: Option<u64>,
2144 string_sub_string_per_byte_cost: Option<u64>,
2145 string_index_of_base_cost: Option<u64>,
2146 string_index_of_per_byte_pattern_cost: Option<u64>,
2147 string_index_of_per_byte_searched_cost: Option<u64>,
2148
2149 vector_empty_base_cost: Option<u64>,
2150 vector_length_base_cost: Option<u64>,
2151 vector_push_back_base_cost: Option<u64>,
2152 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
2153 vector_borrow_base_cost: Option<u64>,
2154 vector_pop_back_base_cost: Option<u64>,
2155 vector_destroy_empty_base_cost: Option<u64>,
2156 vector_swap_base_cost: Option<u64>,
2157 vector_reverse_base_cost: Option<u64>,
2158 vector_reverse_per_elem_cost: Option<u64>,
2159 vector_keep_range_base_cost: Option<u64>,
2160 vector_keep_range_per_dropped_elem_cost: Option<u64>,
2161 vector_keep_range_per_moved_elem_cost: Option<u64>,
2162 vector_copy_range_base_cost: Option<u64>,
2163 vector_replace_range_base_cost: Option<u64>,
2164 vector_replace_range_per_elem_cost: Option<u64>,
2165 debug_print_base_cost: Option<u64>,
2166 debug_print_stack_trace_base_cost: Option<u64>,
2167
2168 #[custom_setter]
2178 execution_version: Option<u64>,
2179
2180 consensus_bad_nodes_stake_threshold: Option<u64>,
2184
2185 max_jwk_votes_per_validator_per_epoch: Option<u64>,
2186 max_age_of_jwk_in_epochs: Option<u64>,
2190
2191 random_beacon_reduction_allowed_delta: Option<u16>,
2195
2196 random_beacon_reduction_lower_bound: Option<u32>,
2199
2200 random_beacon_dkg_timeout_round: Option<u32>,
2203
2204 random_beacon_min_round_interval_ms: Option<u64>,
2206
2207 random_beacon_dkg_version: Option<u64>,
2210
2211 consensus_max_transaction_size_bytes: Option<u64>,
2214 consensus_max_transactions_in_block_bytes: Option<u64>,
2216 consensus_max_num_transactions_in_block: Option<u64>,
2218
2219 consensus_voting_rounds: Option<u32>,
2221
2222 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
2224
2225 max_deferral_rounds_for_congestion_control: Option<u64>,
2228
2229 epoch_close_deadline_ms: Option<u64>,
2234
2235 max_txn_cost_overage_per_object_in_commit: Option<u64>,
2237
2238 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
2240
2241 min_checkpoint_interval_ms: Option<u64>,
2243
2244 checkpoint_summary_version_specific_data: Option<u64>,
2246
2247 max_soft_bundle_size: Option<u64>,
2249
2250 bridge_should_try_to_finalize_committee: Option<bool>,
2254
2255 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2261
2262 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
2265
2266 consensus_gc_depth: Option<u32>,
2269
2270 gas_budget_based_txn_cost_cap_factor: Option<u64>,
2272
2273 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
2275
2276 sip_45_consensus_amplification_threshold: Option<u64>,
2279
2280 staggered_submission_signal_window_commits: Option<u64>,
2283 staggered_submission_signal_min_excess_copies_per_commit: Option<u64>,
2285 staggered_submission_signal_exit_dwell_commits: Option<u64>,
2288 staggered_submission_signal_band1_enter_ratio_bps: Option<u64>,
2291 staggered_submission_signal_band1_exit_ratio_bps: Option<u64>,
2292 staggered_submission_signal_band2_enter_ratio_bps: Option<u64>,
2293 staggered_submission_signal_band2_exit_ratio_bps: Option<u64>,
2294
2295 use_object_per_epoch_marker_table_v2: Option<bool>,
2298
2299 consensus_commit_rate_estimation_window_size: Option<u32>,
2301
2302 #[serde(skip_serializing_if = "Vec::is_empty")]
2306 aliased_addresses: Vec<AliasedAddress>,
2307
2308 translation_per_command_base_charge: Option<u64>,
2311
2312 translation_per_input_base_charge: Option<u64>,
2315
2316 translation_pure_input_per_byte_charge: Option<u64>,
2318
2319 translation_per_type_node_charge: Option<u64>,
2323
2324 translation_per_reference_node_charge: Option<u64>,
2327
2328 translation_per_linkage_entry_charge: Option<u64>,
2331
2332 max_updates_per_settlement_txn: Option<u32>,
2334
2335 gasless_max_computation_units: Option<u64>,
2337
2338 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
2340
2341 gasless_max_unused_inputs: Option<u64>,
2345
2346 gasless_max_pure_input_bytes: Option<u64>,
2349
2350 gasless_max_tps: Option<u64>,
2352
2353 #[serde(skip_serializing_if = "Option::is_none")]
2354 #[skip_accessor]
2355 include_special_package_amendments: Option<Arc<Amendments>>,
2356
2357 gasless_max_tx_size_bytes: Option<u64>,
2360
2361 translation_per_live_reference_charge: Option<u64>,
2364
2365 max_ptb_live_references: Option<u64>,
2368
2369 max_ptb_returned_references: Option<u64>,
2372
2373 max_ptb_total_returned_references: Option<u64>,
2376}
2377
2378#[derive(Clone, Serialize, Deserialize, Debug)]
2380pub struct AliasedAddress {
2381 pub original: [u8; 32],
2383 pub aliased: [u8; 32],
2385 pub allowed_tx_digests: Vec<[u8; 32]>,
2387}
2388
2389impl ProtocolConfig {
2391 pub fn chain(&self) -> Chain {
2393 self.chain
2394 }
2395
2396 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2409 if self.feature_flags.package_upgrades {
2410 Ok(())
2411 } else {
2412 Err(Error(format!(
2413 "package upgrades are not supported at {:?}",
2414 self.version
2415 )))
2416 }
2417 }
2418
2419 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2420 &self.feature_flags.zklogin_supported_providers
2421 }
2422
2423 pub fn zklogin_circuit_mode(&self) -> u64 {
2426 self.feature_flags.zklogin_circuit_mode
2427 }
2428
2429 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2430 self.feature_flags.consensus_transaction_ordering
2431 }
2432
2433 pub fn enable_jwk_consensus_updates(&self) -> bool {
2434 let ret = self.feature_flags.enable_jwk_consensus_updates;
2435 if ret {
2436 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2438 }
2439 ret
2440 }
2441
2442 pub fn staggered_submission_signal(&self) -> bool {
2443 let ret = self.feature_flags.staggered_submission_signal;
2444 if ret {
2445 assert!(self.feature_flags.allowed_proposers);
2448 }
2449 ret
2450 }
2451
2452 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2453 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2454 if !ret {
2455 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2457 }
2458 ret
2459 }
2460
2461 pub fn dkg_version(&self) -> u64 {
2462 self.random_beacon_dkg_version.unwrap_or(1)
2464 }
2465
2466 pub fn bridge(&self) -> bool {
2467 let ret = self.feature_flags.bridge;
2468 if ret {
2469 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2471 }
2472 ret
2473 }
2474
2475 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2476 if !self.bridge() {
2477 return false;
2478 }
2479 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2481 }
2482
2483 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2484 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2485 }
2486
2487 pub fn enable_allowances(&self) -> bool {
2488 self.feature_flags.enable_allowances && self.enable_accumulators()
2489 }
2490
2491 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2492 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2493 }
2494
2495 pub fn enable_authenticated_event_streams(&self) -> bool {
2496 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2497 }
2498
2499 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2500 self.feature_flags.per_object_congestion_control_mode
2501 }
2502
2503 pub fn consensus_choice(&self) -> ConsensusChoice {
2504 self.feature_flags.consensus_choice
2505 }
2506
2507 pub fn consensus_network(&self) -> ConsensusNetwork {
2508 self.feature_flags.consensus_network
2509 }
2510
2511 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2512 self.feature_flags.mysticeti_num_leaders_per_round
2513 }
2514
2515 pub fn max_transaction_size_bytes(&self) -> u64 {
2516 self.consensus_max_transaction_size_bytes
2518 .unwrap_or(256 * 1024)
2519 }
2520
2521 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2522 if cfg!(msim) {
2523 256 * 1024
2524 } else {
2525 self.consensus_max_transactions_in_block_bytes
2526 .unwrap_or(512 * 1024)
2527 }
2528 }
2529
2530 pub fn max_num_transactions_in_block(&self) -> u64 {
2531 if cfg!(msim) {
2532 8
2533 } else {
2534 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2535 }
2536 }
2537
2538 pub fn gc_depth(&self) -> u32 {
2539 self.consensus_gc_depth.unwrap_or(0)
2540 }
2541
2542 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2543 let res = self.feature_flags.consensus_linearize_subdag_v2;
2544 assert!(
2545 !res || self.gc_depth() > 0,
2546 "The consensus linearize sub dag V2 requires GC to be enabled"
2547 );
2548 res
2549 }
2550
2551 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2552 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2553 assert!(
2554 !res || self.gc_depth() > 0,
2555 "The consensus median based commit timestamp requires GC to be enabled"
2556 );
2557 res
2558 }
2559
2560 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2561 self.consensus_commit_rate_estimation_window_size
2562 .unwrap_or(0)
2563 }
2564
2565 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2566 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2570 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2572 window_size
2573 }
2574
2575 pub fn address_aliases(&self) -> bool {
2576 let address_aliases = self.feature_flags.address_aliases;
2577 assert!(
2578 !address_aliases || self.mysticeti_fastpath(),
2579 "Address aliases requires Mysticeti fastpath to be enabled"
2580 );
2581 if address_aliases {
2582 assert!(
2583 self.feature_flags.disable_preconsensus_locking,
2584 "Address aliases requires CertifiedTransaction to be disabled"
2585 );
2586 }
2587 address_aliases
2588 }
2589
2590 pub fn new_vm_enabled(&self) -> bool {
2591 self.execution_version.is_some_and(|v| v >= 4)
2592 }
2593
2594 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2595 debug_assert!(self.gasless_allowed_token_types.is_some());
2596 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2597 }
2598
2599 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2600 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2601 }
2602
2603 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2604 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2605 }
2606
2607 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2608 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2609 }
2610
2611 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2612 &self.include_special_package_amendments
2613 }
2614}
2615
2616static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2617
2618impl ProtocolConfig {
2620 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2622 assert!(
2624 version >= ProtocolVersion::MIN,
2625 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2626 version,
2627 ProtocolVersion::MIN.0,
2628 );
2629 assert!(
2630 version <= ProtocolVersion::MAX_ALLOWED,
2631 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2632 version,
2633 ProtocolVersion::MAX_ALLOWED.0,
2634 );
2635
2636 let mut ret = Self::get_for_version_impl(version, chain);
2637 ret.version = version;
2638 ret.chain = chain;
2639
2640 ret = Self::apply_config_override(version, ret);
2641
2642 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2643 warn!(
2644 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2645 );
2646 let overrides: ProtocolConfigOptional =
2647 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2648 .expect("failed to parse ProtocolConfig override env variables");
2649 overrides.apply_to(&mut ret);
2650 }
2651
2652 ret
2653 }
2654
2655 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2658 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2659 let mut ret = Self::get_for_version_impl(version, chain);
2660 ret.version = version;
2661 ret.chain = chain;
2662 ret = Self::apply_config_override(version, ret);
2663 Some(ret)
2664 } else {
2665 None
2666 }
2667 }
2668
2669 pub fn poison_get_for_min_version() {
2670 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2671 }
2672
2673 fn load_poison_get_for_min_version() -> bool {
2674 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2675 }
2676
2677 pub fn get_for_min_version() -> Self {
2680 if Self::load_poison_get_for_min_version() {
2681 panic!("get_for_min_version called on validator");
2682 }
2683 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2684 }
2685
2686 #[allow(non_snake_case)]
2696 pub fn get_for_max_version_UNSAFE() -> Self {
2697 if Self::load_poison_get_for_min_version() {
2698 panic!("get_for_max_version_UNSAFE called on validator");
2699 }
2700 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2701 }
2702
2703 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2704 #[cfg(msim)]
2705 {
2706 if version == ProtocolVersion::MAX_ALLOWED {
2708 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2709 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2710 return config;
2711 }
2712 }
2713
2714 let mut cfg = Self {
2717 version,
2719 chain,
2720
2721 feature_flags: Default::default(),
2723
2724 max_tx_size_bytes: Some(128 * 1024),
2725 max_input_objects: Some(2048),
2727 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2728 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2729 max_gas_payment_objects: Some(256),
2730 max_modules_in_publish: Some(128),
2731 max_package_dependencies: None,
2732 max_arguments: Some(512),
2733 max_type_arguments: Some(16),
2734 max_type_argument_depth: Some(16),
2735 max_pure_argument_size: Some(16 * 1024),
2736 max_programmable_tx_commands: Some(1024),
2737 move_binary_format_version: Some(6),
2738 min_move_binary_format_version: None,
2739 binary_module_handles: None,
2740 binary_struct_handles: None,
2741 binary_function_handles: None,
2742 binary_function_instantiations: None,
2743 binary_signatures: None,
2744 binary_constant_pool: None,
2745 binary_identifiers: None,
2746 binary_address_identifiers: None,
2747 binary_struct_defs: None,
2748 binary_struct_def_instantiations: None,
2749 binary_function_defs: None,
2750 binary_field_handles: None,
2751 binary_field_instantiations: None,
2752 binary_friend_decls: None,
2753 binary_enum_defs: None,
2754 binary_enum_def_instantiations: None,
2755 binary_variant_handles: None,
2756 binary_variant_instantiation_handles: None,
2757 max_move_object_size: Some(250 * 1024),
2758 max_move_package_size: Some(100 * 1024),
2759 max_publish_or_upgrade_per_ptb: None,
2760 max_tx_gas: Some(10_000_000_000),
2761 max_gas_price: Some(100_000),
2762 max_gas_price_rgp_factor_for_aborted_transactions: None,
2763 max_gas_computation_bucket: Some(5_000_000),
2764 max_loop_depth: Some(5),
2765 max_generic_instantiation_length: Some(32),
2766 max_function_parameters: Some(128),
2767 max_basic_blocks: Some(1024),
2768 max_value_stack_size: Some(1024),
2769 max_type_nodes: Some(256),
2770 max_generic_instantiation_type_nodes_per_function: None,
2771 max_generic_instantiation_type_nodes_per_module: None,
2772 max_accumulator_type_nodes: None,
2773 max_push_size: Some(10000),
2774 max_struct_definitions: Some(200),
2775 max_function_definitions: Some(1000),
2776 max_fields_in_struct: Some(32),
2777 max_dependency_depth: Some(100),
2778 max_num_event_emit: Some(256),
2779 max_num_new_move_object_ids: Some(2048),
2780 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2781 max_num_deleted_move_object_ids: Some(2048),
2782 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2783 max_num_transferred_move_object_ids: Some(2048),
2784 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2785 max_event_emit_size: Some(250 * 1024),
2786 max_move_vector_len: Some(256 * 1024),
2787 max_type_to_layout_nodes: None,
2788 max_ptb_value_size: None,
2789
2790 max_back_edges_per_function: Some(10_000),
2791 max_back_edges_per_module: Some(10_000),
2792 max_verifier_meter_ticks_per_function: Some(6_000_000),
2793 max_meter_ticks_per_module: Some(6_000_000),
2794 max_meter_ticks_per_package: None,
2795
2796 object_runtime_max_num_cached_objects: Some(1000),
2797 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2798 object_runtime_max_num_store_entries: Some(1000),
2799 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2800 base_tx_cost_fixed: Some(110_000),
2801 package_publish_cost_fixed: Some(1_000),
2802 base_tx_cost_per_byte: Some(0),
2803 package_publish_cost_per_byte: Some(80),
2804 obj_access_cost_read_per_byte: Some(15),
2805 obj_access_cost_read_per_package_kb: None,
2806 obj_access_cost_mutate_per_byte: Some(40),
2807 obj_access_cost_delete_per_byte: Some(40),
2808 obj_access_cost_verify_per_byte: Some(200),
2809 obj_data_cost_refundable: Some(100),
2810 obj_metadata_cost_non_refundable: Some(50),
2811 gas_model_version: Some(1),
2812 storage_rebate_rate: Some(9900),
2813 storage_fund_reinvest_rate: Some(500),
2814 reward_slashing_rate: Some(5000),
2815 storage_gas_price: Some(1),
2816 accumulator_object_storage_cost: None,
2817 max_transactions_per_checkpoint: Some(10_000),
2818 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2819
2820 buffer_stake_for_protocol_upgrade_bps: Some(0),
2823
2824 address_from_bytes_cost_base: Some(52),
2828 address_to_u256_cost_base: Some(52),
2830 address_from_u256_cost_base: Some(52),
2832
2833 config_read_setting_impl_cost_base: None,
2836 config_read_setting_impl_cost_per_byte: None,
2837
2838 package_original_package_id_impl_cost_base: None,
2839 package_original_package_id_impl_cost_per_byte: None,
2840
2841 dynamic_field_hash_type_and_key_cost_base: Some(100),
2844 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2845 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2846 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2847 dynamic_field_add_child_object_cost_base: Some(100),
2849 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2850 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2851 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2852 dynamic_field_borrow_child_object_cost_base: Some(100),
2854 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2855 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2856 dynamic_field_remove_child_object_cost_base: Some(100),
2858 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2859 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2860 dynamic_field_has_child_object_cost_base: Some(100),
2862 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2864 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2865 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2866
2867 scratch_add_cost_base: None,
2869 scratch_read_cost_base: None,
2870 scratch_read_value_cost: None,
2871 scratch_remove_cost_base: None,
2872 scratch_exists_cost_base: None,
2873 scratch_exists_with_type_cost_base: None,
2874 scratch_exists_with_type_type_cost: None,
2875 max_scratch_pad_size: None,
2876
2877 event_emit_cost_base: Some(52),
2880 event_emit_value_size_derivation_cost_per_byte: Some(2),
2881 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2882 event_emit_output_cost_per_byte: Some(10),
2883 event_emit_auth_stream_cost: None,
2884
2885 reserve_object_funds_for_withdrawal_cost_base: None,
2887 reserve_object_funds_for_withdrawal_cold_read_cost: None,
2888
2889 object_borrow_uid_cost_base: Some(52),
2892 object_delete_impl_cost_base: Some(52),
2894 object_record_new_uid_cost_base: Some(52),
2896 object_record_new_uid_from_hash_cost_base: None,
2899 object_is_shared_input_cost_base: None,
2902
2903 transfer_transfer_internal_cost_base: Some(52),
2906 transfer_party_transfer_internal_cost_base: None,
2908 transfer_freeze_object_cost_base: Some(52),
2910 transfer_share_object_cost_base: Some(52),
2912 transfer_receive_object_cost_base: None,
2913 transfer_receive_object_type_cost_per_byte: None,
2914 transfer_receive_object_cost_per_byte: None,
2915
2916 tx_context_derive_id_cost_base: Some(52),
2919 tx_context_fresh_id_cost_base: None,
2920 tx_context_sender_cost_base: None,
2921 tx_context_epoch_cost_base: None,
2922 tx_context_epoch_timestamp_ms_cost_base: None,
2923 tx_context_sponsor_cost_base: None,
2924 tx_context_rgp_cost_base: None,
2925 tx_context_gas_price_cost_base: None,
2926 tx_context_gas_budget_cost_base: None,
2927 tx_context_ids_created_cost_base: None,
2928 tx_context_replace_cost_base: None,
2929
2930 clock_borrow_cost_base: None,
2932
2933 types_is_one_time_witness_cost_base: Some(52),
2936 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2937 types_is_one_time_witness_type_cost_per_byte: Some(2),
2938
2939 validator_validate_metadata_cost_base: Some(52),
2942 validator_validate_metadata_data_cost_per_byte: Some(2),
2943
2944 crypto_invalid_arguments_cost: Some(100),
2946 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2948 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2949 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2950
2951 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2953 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2954 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2955
2956 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2958 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2959 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2960 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2961 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2962 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2963
2964 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2966
2967 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2969 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2970 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2971 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2972 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2973 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2974
2975 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2977 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2978 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2979 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
2980 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2981 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
2982
2983 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
2985 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
2986 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
2987 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
2988 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
2989 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
2990
2991 ecvrf_ecvrf_verify_cost_base: Some(52),
2993 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
2994 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
2995
2996 ed25519_ed25519_verify_cost_base: Some(52),
2998 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
2999 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3000
3001 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3003 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3004
3005 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3007 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3008 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3009 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3010 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3011
3012 hash_blake2b256_cost_base: Some(52),
3014 hash_blake2b256_data_cost_per_byte: Some(2),
3015 hash_blake2b256_data_cost_per_block: Some(2),
3016
3017 hash_keccak256_cost_base: Some(52),
3019 hash_keccak256_data_cost_per_byte: Some(2),
3020 hash_keccak256_data_cost_per_block: Some(2),
3021
3022 poseidon_bn254_cost_base: None,
3023 poseidon_bn254_cost_per_block: None,
3024
3025 hmac_hmac_sha3_256_cost_base: Some(52),
3027 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3028 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3029
3030 group_ops_bls12381_decode_scalar_cost: None,
3032 group_ops_bls12381_decode_g1_cost: None,
3033 group_ops_bls12381_decode_g2_cost: None,
3034 group_ops_bls12381_decode_gt_cost: None,
3035 group_ops_bls12381_scalar_add_cost: None,
3036 group_ops_bls12381_g1_add_cost: None,
3037 group_ops_bls12381_g2_add_cost: None,
3038 group_ops_bls12381_gt_add_cost: None,
3039 group_ops_bls12381_scalar_sub_cost: None,
3040 group_ops_bls12381_g1_sub_cost: None,
3041 group_ops_bls12381_g2_sub_cost: None,
3042 group_ops_bls12381_gt_sub_cost: None,
3043 group_ops_bls12381_scalar_mul_cost: None,
3044 group_ops_bls12381_g1_mul_cost: None,
3045 group_ops_bls12381_g2_mul_cost: None,
3046 group_ops_bls12381_gt_mul_cost: None,
3047 group_ops_bls12381_scalar_div_cost: None,
3048 group_ops_bls12381_g1_div_cost: None,
3049 group_ops_bls12381_g2_div_cost: None,
3050 group_ops_bls12381_gt_div_cost: None,
3051 group_ops_bls12381_g1_hash_to_base_cost: None,
3052 group_ops_bls12381_g2_hash_to_base_cost: None,
3053 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3054 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3055 group_ops_bls12381_g1_msm_base_cost: None,
3056 group_ops_bls12381_g2_msm_base_cost: None,
3057 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3058 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3059 group_ops_bls12381_msm_max_len: None,
3060 group_ops_bls12381_pairing_cost: None,
3061 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3062 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3063 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3064 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3065 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3066
3067 group_ops_ristretto_decode_scalar_cost: None,
3068 group_ops_ristretto_decode_point_cost: None,
3069 group_ops_ristretto_scalar_add_cost: None,
3070 group_ops_ristretto_point_add_cost: None,
3071 group_ops_ristretto_scalar_sub_cost: None,
3072 group_ops_ristretto_point_sub_cost: None,
3073 group_ops_ristretto_scalar_mul_cost: None,
3074 group_ops_ristretto_point_mul_cost: None,
3075 group_ops_ristretto_scalar_div_cost: None,
3076 group_ops_ristretto_point_div_cost: None,
3077
3078 verify_bulletproofs_ristretto255_base_cost: None,
3079 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3080 max_bulletproofs_total_bits: None,
3081
3082 check_zklogin_id_cost_base: None,
3084 check_zklogin_issuer_cost_base: None,
3086
3087 vdf_verify_vdf_cost: None,
3088 vdf_hash_to_input_cost: None,
3089
3090 nitro_attestation_parse_base_cost: None,
3092 nitro_attestation_parse_cost_per_byte: None,
3093 nitro_attestation_verify_base_cost: None,
3094 nitro_attestation_verify_cost_per_cert: None,
3095
3096 bcs_per_byte_serialized_cost: None,
3097 bcs_legacy_min_output_size_cost: None,
3098 bcs_failure_cost: None,
3099 hash_sha2_256_base_cost: None,
3100 hash_sha2_256_per_byte_cost: None,
3101 hash_sha2_256_legacy_min_input_len_cost: None,
3102 hash_sha3_256_base_cost: None,
3103 hash_sha3_256_per_byte_cost: None,
3104 hash_sha3_256_legacy_min_input_len_cost: None,
3105 type_name_get_base_cost: None,
3106 type_name_get_per_byte_cost: None,
3107 type_name_id_base_cost: None,
3108 string_check_utf8_base_cost: None,
3109 string_check_utf8_per_byte_cost: None,
3110 string_is_char_boundary_base_cost: None,
3111 string_sub_string_base_cost: None,
3112 string_sub_string_per_byte_cost: None,
3113 string_index_of_base_cost: None,
3114 string_index_of_per_byte_pattern_cost: None,
3115 string_index_of_per_byte_searched_cost: None,
3116 vector_empty_base_cost: None,
3117 vector_length_base_cost: None,
3118 vector_push_back_base_cost: None,
3119 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3120 vector_borrow_base_cost: None,
3121 vector_pop_back_base_cost: None,
3122 vector_destroy_empty_base_cost: None,
3123 vector_swap_base_cost: None,
3124 vector_reverse_base_cost: None,
3125 vector_reverse_per_elem_cost: None,
3126 vector_keep_range_base_cost: None,
3127 vector_keep_range_per_dropped_elem_cost: None,
3128 vector_keep_range_per_moved_elem_cost: None,
3129 vector_copy_range_base_cost: None,
3130 vector_replace_range_base_cost: None,
3131 vector_replace_range_per_elem_cost: None,
3132 debug_print_base_cost: None,
3133 debug_print_stack_trace_base_cost: None,
3134
3135 max_size_written_objects: None,
3136 max_size_written_objects_system_tx: None,
3137
3138 max_move_identifier_len: None,
3145 max_move_value_depth: None,
3146 package_arena_size_in_bytes: None,
3147 max_move_enum_variants: None,
3148
3149 gas_rounding_step: None,
3150
3151 execution_version: None,
3152
3153 max_event_emit_size_total: None,
3154
3155 consensus_bad_nodes_stake_threshold: None,
3156
3157 max_jwk_votes_per_validator_per_epoch: None,
3158
3159 max_age_of_jwk_in_epochs: None,
3160
3161 random_beacon_reduction_allowed_delta: None,
3162
3163 random_beacon_reduction_lower_bound: None,
3164
3165 random_beacon_dkg_timeout_round: None,
3166
3167 random_beacon_min_round_interval_ms: None,
3168
3169 random_beacon_dkg_version: None,
3170
3171 consensus_max_transaction_size_bytes: None,
3172
3173 consensus_max_transactions_in_block_bytes: None,
3174
3175 consensus_max_num_transactions_in_block: None,
3176
3177 consensus_voting_rounds: None,
3178
3179 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3180
3181 max_deferral_rounds_for_congestion_control: None,
3182
3183 epoch_close_deadline_ms: None,
3184
3185 max_txn_cost_overage_per_object_in_commit: None,
3186
3187 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3188
3189 min_checkpoint_interval_ms: None,
3190
3191 checkpoint_summary_version_specific_data: None,
3192
3193 max_soft_bundle_size: None,
3194
3195 bridge_should_try_to_finalize_committee: None,
3196
3197 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3198
3199 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3200
3201 consensus_gc_depth: None,
3202
3203 gas_budget_based_txn_cost_cap_factor: None,
3204
3205 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3206
3207 sip_45_consensus_amplification_threshold: None,
3208 staggered_submission_signal_window_commits: None,
3209 staggered_submission_signal_min_excess_copies_per_commit: None,
3210 staggered_submission_signal_exit_dwell_commits: None,
3211 staggered_submission_signal_band1_enter_ratio_bps: None,
3212 staggered_submission_signal_band1_exit_ratio_bps: None,
3213 staggered_submission_signal_band2_enter_ratio_bps: None,
3214 staggered_submission_signal_band2_exit_ratio_bps: None,
3215
3216 use_object_per_epoch_marker_table_v2: None,
3217
3218 consensus_commit_rate_estimation_window_size: None,
3219
3220 aliased_addresses: vec![],
3221
3222 translation_per_command_base_charge: None,
3223 translation_per_input_base_charge: None,
3224 translation_pure_input_per_byte_charge: None,
3225 translation_per_type_node_charge: None,
3226 translation_per_reference_node_charge: None,
3227 translation_per_linkage_entry_charge: None,
3228 translation_per_live_reference_charge: None,
3229 max_ptb_live_references: None,
3230 max_ptb_returned_references: None,
3231 max_ptb_total_returned_references: None,
3232
3233 max_updates_per_settlement_txn: None,
3234
3235 gasless_max_computation_units: None,
3236 gasless_allowed_token_types: None,
3237 gasless_max_unused_inputs: None,
3238 gasless_max_pure_input_bytes: None,
3239 gasless_max_tps: None,
3240 include_special_package_amendments: None,
3241 gasless_max_tx_size_bytes: None,
3242 };
3245 for cur in 2..=version.0 {
3246 match cur {
3247 1 => unreachable!(),
3248 2 => {
3249 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3250 }
3251 3 => {
3252 cfg.gas_model_version = Some(2);
3254 cfg.max_tx_gas = Some(50_000_000_000);
3256 cfg.base_tx_cost_fixed = Some(2_000);
3258 cfg.storage_gas_price = Some(76);
3260 cfg.feature_flags.loaded_child_objects_fixed = true;
3261 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3264 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3267 cfg.feature_flags.package_upgrades = true;
3268 }
3269 4 => {
3274 cfg.reward_slashing_rate = Some(10000);
3276 cfg.gas_model_version = Some(3);
3278 }
3279 5 => {
3280 cfg.feature_flags.missing_type_is_compatibility_error = true;
3281 cfg.gas_model_version = Some(4);
3282 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3283 }
3287 6 => {
3288 cfg.gas_model_version = Some(5);
3289 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3290 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3291 }
3292 7 => {
3293 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3294 cfg.feature_flags
3295 .disable_invariant_violation_check_in_swap_loc = true;
3296 cfg.feature_flags.ban_entry_init = true;
3297 cfg.feature_flags.package_digest_hash_module = true;
3298 }
3299 8 => {
3300 cfg.feature_flags
3301 .disallow_change_struct_type_params_on_upgrade = true;
3302 }
3303 9 => {
3304 cfg.max_move_identifier_len = Some(128);
3306 cfg.feature_flags.no_extraneous_module_bytes = true;
3307 cfg.feature_flags
3308 .advance_to_highest_supported_protocol_version = true;
3309 }
3310 10 => {
3311 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3312 cfg.max_meter_ticks_per_module = Some(16_000_000);
3313 }
3314 11 => {
3315 cfg.max_move_value_depth = Some(128);
3316 }
3317 12 => {
3318 cfg.feature_flags.narwhal_versioned_metadata = true;
3319 if chain != Chain::Mainnet {
3320 cfg.feature_flags.commit_root_state_digest = true;
3321 }
3322
3323 if chain != Chain::Mainnet && chain != Chain::Testnet {
3324 cfg.feature_flags.zklogin_auth = true;
3325 }
3326 }
3327 13 => {}
3328 14 => {
3329 cfg.gas_rounding_step = Some(1_000);
3330 cfg.gas_model_version = Some(6);
3331 }
3332 15 => {
3333 cfg.feature_flags.consensus_transaction_ordering =
3334 ConsensusTransactionOrdering::ByGasPrice;
3335 }
3336 16 => {
3337 cfg.feature_flags.simplified_unwrap_then_delete = true;
3338 }
3339 17 => {
3340 cfg.feature_flags.upgraded_multisig_supported = true;
3341 }
3342 18 => {
3343 cfg.execution_version = Some(1);
3344 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3353 cfg.base_tx_cost_fixed = Some(1_000);
3355 }
3356 19 => {
3357 cfg.max_num_event_emit = Some(1024);
3358 cfg.max_event_emit_size_total = Some(
3361 256 * 250 * 1024, );
3363 }
3364 20 => {
3365 cfg.feature_flags.commit_root_state_digest = true;
3366
3367 if chain != Chain::Mainnet {
3368 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3369 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3370 }
3371 }
3372
3373 21 => {
3374 if chain != Chain::Mainnet {
3375 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3376 "Google".to_string(),
3377 "Facebook".to_string(),
3378 "Twitch".to_string(),
3379 ]);
3380 }
3381 }
3382 22 => {
3383 cfg.feature_flags.loaded_child_object_format = true;
3384 }
3385 23 => {
3386 cfg.feature_flags.loaded_child_object_format_type = true;
3387 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3388 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3394 }
3395 24 => {
3396 cfg.feature_flags.simple_conservation_checks = true;
3397 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3398
3399 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3400
3401 if chain != Chain::Mainnet {
3402 cfg.feature_flags.enable_jwk_consensus_updates = true;
3403 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3405 cfg.max_age_of_jwk_in_epochs = Some(1);
3406 }
3407 }
3408 25 => {
3409 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3411 "Google".to_string(),
3412 "Facebook".to_string(),
3413 "Twitch".to_string(),
3414 ]);
3415 cfg.feature_flags.zklogin_auth = true;
3416
3417 cfg.feature_flags.enable_jwk_consensus_updates = true;
3419 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3420 cfg.max_age_of_jwk_in_epochs = Some(1);
3421 }
3422 26 => {
3423 cfg.gas_model_version = Some(7);
3424 if chain != Chain::Mainnet && chain != Chain::Testnet {
3426 cfg.transfer_receive_object_cost_base = Some(52);
3427 cfg.feature_flags.receive_objects = true;
3428 }
3429 }
3430 27 => {
3431 cfg.gas_model_version = Some(8);
3432 }
3433 28 => {
3434 cfg.check_zklogin_id_cost_base = Some(200);
3436 cfg.check_zklogin_issuer_cost_base = Some(200);
3438
3439 if chain != Chain::Mainnet && chain != Chain::Testnet {
3441 cfg.feature_flags.enable_effects_v2 = true;
3442 }
3443 }
3444 29 => {
3445 cfg.feature_flags.verify_legacy_zklogin_address = true;
3446 }
3447 30 => {
3448 if chain != Chain::Mainnet {
3450 cfg.feature_flags.narwhal_certificate_v2 = true;
3451 }
3452
3453 cfg.random_beacon_reduction_allowed_delta = Some(800);
3454 if chain != Chain::Mainnet {
3456 cfg.feature_flags.enable_effects_v2 = true;
3457 }
3458
3459 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3463
3464 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3465 }
3466 31 => {
3467 cfg.execution_version = Some(2);
3468 if chain != Chain::Mainnet && chain != Chain::Testnet {
3470 cfg.feature_flags.shared_object_deletion = true;
3471 }
3472 }
3473 32 => {
3474 if chain != Chain::Mainnet {
3476 cfg.feature_flags.accept_zklogin_in_multisig = true;
3477 }
3478 if chain != Chain::Mainnet {
3480 cfg.transfer_receive_object_cost_base = Some(52);
3481 cfg.feature_flags.receive_objects = true;
3482 }
3483 if chain != Chain::Mainnet && chain != Chain::Testnet {
3485 cfg.feature_flags.random_beacon = true;
3486 cfg.random_beacon_reduction_lower_bound = Some(1600);
3487 cfg.random_beacon_dkg_timeout_round = Some(3000);
3488 cfg.random_beacon_min_round_interval_ms = Some(150);
3489 }
3490 if chain != Chain::Testnet && chain != Chain::Mainnet {
3492 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3493 }
3494
3495 cfg.feature_flags.narwhal_certificate_v2 = true;
3497 }
3498 33 => {
3499 cfg.feature_flags.hardened_otw_check = true;
3500 cfg.feature_flags.allow_receiving_object_id = true;
3501
3502 cfg.transfer_receive_object_cost_base = Some(52);
3504 cfg.feature_flags.receive_objects = true;
3505
3506 if chain != Chain::Mainnet {
3508 cfg.feature_flags.shared_object_deletion = true;
3509 }
3510
3511 cfg.feature_flags.enable_effects_v2 = true;
3512 }
3513 34 => {}
3514 35 => {
3515 if chain != Chain::Mainnet && chain != Chain::Testnet {
3517 cfg.feature_flags.enable_poseidon = true;
3518 cfg.poseidon_bn254_cost_base = Some(260);
3519 cfg.poseidon_bn254_cost_per_block = Some(10);
3520 }
3521
3522 cfg.feature_flags.enable_coin_deny_list = true;
3523 }
3524 36 => {
3525 if chain != Chain::Mainnet && chain != Chain::Testnet {
3527 cfg.feature_flags.enable_group_ops_native_functions = true;
3528 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3529 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3531 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3532 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3533 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3534 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3535 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3536 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3537 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3538 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3539 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3540 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3541 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3542 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3543 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3544 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3545 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3546 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3547 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3548 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3549 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3550 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3551 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3552 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3553 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3554 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3555 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3556 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3557 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3558 cfg.group_ops_bls12381_msm_max_len = Some(32);
3559 cfg.group_ops_bls12381_pairing_cost = Some(52);
3560 }
3561 cfg.feature_flags.shared_object_deletion = true;
3563
3564 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3566 }
3568 37 => {
3569 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3570
3571 if chain != Chain::Mainnet {
3573 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3574 }
3575 }
3576 38 => {
3577 cfg.binary_module_handles = Some(100);
3578 cfg.binary_struct_handles = Some(300);
3579 cfg.binary_function_handles = Some(1500);
3580 cfg.binary_function_instantiations = Some(750);
3581 cfg.binary_signatures = Some(1000);
3582 cfg.binary_constant_pool = Some(4000);
3586 cfg.binary_identifiers = Some(10000);
3587 cfg.binary_address_identifiers = Some(100);
3588 cfg.binary_struct_defs = Some(200);
3589 cfg.binary_struct_def_instantiations = Some(100);
3590 cfg.binary_function_defs = Some(1000);
3591 cfg.binary_field_handles = Some(500);
3592 cfg.binary_field_instantiations = Some(250);
3593 cfg.binary_friend_decls = Some(100);
3594 cfg.max_package_dependencies = Some(32);
3596 cfg.max_modules_in_publish = Some(64);
3597 cfg.execution_version = Some(3);
3599 }
3600 39 => {
3601 }
3603 40 => {}
3604 41 => {
3605 cfg.feature_flags.enable_group_ops_native_functions = true;
3607 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3609 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3610 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3611 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3612 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3613 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3614 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3615 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3616 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3617 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3618 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3619 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3620 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3621 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3622 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3623 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3624 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3625 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3626 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3627 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3628 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3629 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3630 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3631 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3632 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3633 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3634 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3635 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3636 cfg.group_ops_bls12381_msm_max_len = Some(32);
3637 cfg.group_ops_bls12381_pairing_cost = Some(52);
3638 }
3639 42 => {}
3640 43 => {
3641 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3642 cfg.max_meter_ticks_per_package = Some(16_000_000);
3643 }
3644 44 => {
3645 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3647 if chain != Chain::Mainnet {
3649 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3650 }
3651 }
3652 45 => {
3653 if chain != Chain::Testnet && chain != Chain::Mainnet {
3655 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3656 }
3657
3658 if chain != Chain::Mainnet {
3659 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3661 }
3662 cfg.min_move_binary_format_version = Some(6);
3663 cfg.feature_flags.accept_zklogin_in_multisig = true;
3664
3665 if chain != Chain::Mainnet && chain != Chain::Testnet {
3669 cfg.feature_flags.bridge = true;
3670 }
3671 }
3672 46 => {
3673 if chain != Chain::Mainnet {
3675 cfg.feature_flags.bridge = true;
3676 }
3677
3678 cfg.feature_flags.reshare_at_same_initial_version = true;
3680 }
3681 47 => {}
3682 48 => {
3683 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3685
3686 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3688
3689 if chain != Chain::Mainnet {
3691 cfg.feature_flags.random_beacon = true;
3692 cfg.random_beacon_reduction_lower_bound = Some(1600);
3693 cfg.random_beacon_dkg_timeout_round = Some(3000);
3694 cfg.random_beacon_min_round_interval_ms = Some(200);
3695 }
3696
3697 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3699 }
3700 49 => {
3701 if chain != Chain::Testnet && chain != Chain::Mainnet {
3702 cfg.move_binary_format_version = Some(7);
3703 }
3704
3705 if chain != Chain::Mainnet && chain != Chain::Testnet {
3707 cfg.feature_flags.enable_vdf = true;
3708 cfg.vdf_verify_vdf_cost = Some(1500);
3711 cfg.vdf_hash_to_input_cost = Some(100);
3712 }
3713
3714 if chain != Chain::Testnet && chain != Chain::Mainnet {
3716 cfg.feature_flags
3717 .record_consensus_determined_version_assignments_in_prologue = true;
3718 }
3719
3720 if chain != Chain::Mainnet {
3722 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3723 }
3724
3725 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3727 }
3728 50 => {
3729 if chain != Chain::Mainnet {
3731 cfg.checkpoint_summary_version_specific_data = Some(1);
3732 cfg.min_checkpoint_interval_ms = Some(200);
3733 }
3734
3735 if chain != Chain::Testnet && chain != Chain::Mainnet {
3737 cfg.feature_flags
3738 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3739 }
3740
3741 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3742
3743 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3745 }
3746 51 => {
3747 cfg.random_beacon_dkg_version = Some(1);
3748
3749 if chain != Chain::Testnet && chain != Chain::Mainnet {
3750 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3751 }
3752 }
3753 52 => {
3754 if chain != Chain::Mainnet {
3755 cfg.feature_flags.soft_bundle = true;
3756 cfg.max_soft_bundle_size = Some(5);
3757 }
3758
3759 cfg.config_read_setting_impl_cost_base = Some(100);
3760 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3761
3762 if chain != Chain::Testnet && chain != Chain::Mainnet {
3764 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3765 cfg.feature_flags.per_object_congestion_control_mode =
3766 PerObjectCongestionControlMode::TotalTxCount;
3767 }
3768
3769 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3771
3772 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3774
3775 cfg.checkpoint_summary_version_specific_data = Some(1);
3777 cfg.min_checkpoint_interval_ms = Some(200);
3778
3779 if chain != Chain::Mainnet {
3781 cfg.feature_flags
3782 .record_consensus_determined_version_assignments_in_prologue = true;
3783 cfg.feature_flags
3784 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3785 }
3786 if chain != Chain::Mainnet {
3788 cfg.move_binary_format_version = Some(7);
3789 }
3790
3791 if chain != Chain::Testnet && chain != Chain::Mainnet {
3792 cfg.feature_flags.passkey_auth = true;
3793 }
3794 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3795 }
3796 53 => {
3797 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3799
3800 cfg.feature_flags
3802 .record_consensus_determined_version_assignments_in_prologue = true;
3803 cfg.feature_flags
3804 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3805
3806 if chain == Chain::Unknown {
3807 cfg.feature_flags.authority_capabilities_v2 = true;
3808 }
3809
3810 if chain != Chain::Mainnet {
3812 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3813 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3814 cfg.feature_flags.per_object_congestion_control_mode =
3815 PerObjectCongestionControlMode::TotalTxCount;
3816 }
3817
3818 cfg.bcs_per_byte_serialized_cost = Some(2);
3820 cfg.bcs_legacy_min_output_size_cost = Some(1);
3821 cfg.bcs_failure_cost = Some(52);
3822 cfg.debug_print_base_cost = Some(52);
3823 cfg.debug_print_stack_trace_base_cost = Some(52);
3824 cfg.hash_sha2_256_base_cost = Some(52);
3825 cfg.hash_sha2_256_per_byte_cost = Some(2);
3826 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3827 cfg.hash_sha3_256_base_cost = Some(52);
3828 cfg.hash_sha3_256_per_byte_cost = Some(2);
3829 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3830 cfg.type_name_get_base_cost = Some(52);
3831 cfg.type_name_get_per_byte_cost = Some(2);
3832 cfg.string_check_utf8_base_cost = Some(52);
3833 cfg.string_check_utf8_per_byte_cost = Some(2);
3834 cfg.string_is_char_boundary_base_cost = Some(52);
3835 cfg.string_sub_string_base_cost = Some(52);
3836 cfg.string_sub_string_per_byte_cost = Some(2);
3837 cfg.string_index_of_base_cost = Some(52);
3838 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3839 cfg.string_index_of_per_byte_searched_cost = Some(2);
3840 cfg.vector_empty_base_cost = Some(52);
3841 cfg.vector_length_base_cost = Some(52);
3842 cfg.vector_push_back_base_cost = Some(52);
3843 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3844 cfg.vector_borrow_base_cost = Some(52);
3845 cfg.vector_pop_back_base_cost = Some(52);
3846 cfg.vector_destroy_empty_base_cost = Some(52);
3847 cfg.vector_swap_base_cost = Some(52);
3848 }
3849 54 => {
3850 cfg.feature_flags.random_beacon = true;
3852 cfg.random_beacon_reduction_lower_bound = Some(1000);
3853 cfg.random_beacon_dkg_timeout_round = Some(3000);
3854 cfg.random_beacon_min_round_interval_ms = Some(500);
3855
3856 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3858 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3859 cfg.feature_flags.per_object_congestion_control_mode =
3860 PerObjectCongestionControlMode::TotalTxCount;
3861
3862 cfg.feature_flags.soft_bundle = true;
3864 cfg.max_soft_bundle_size = Some(5);
3865 }
3866 55 => {
3867 cfg.move_binary_format_version = Some(7);
3869
3870 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3872 cfg.consensus_max_num_transactions_in_block = Some(512);
3875
3876 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3877 }
3878 56 => {
3879 if chain == Chain::Mainnet {
3880 cfg.feature_flags.bridge = true;
3881 }
3882 }
3883 57 => {
3884 cfg.random_beacon_reduction_lower_bound = Some(800);
3886 }
3887 58 => {
3888 if chain == Chain::Mainnet {
3889 cfg.bridge_should_try_to_finalize_committee = Some(true);
3890 }
3891
3892 if chain != Chain::Mainnet && chain != Chain::Testnet {
3893 cfg.feature_flags
3895 .consensus_distributed_vote_scoring_strategy = true;
3896 }
3897 }
3898 59 => {
3899 cfg.feature_flags.consensus_round_prober = true;
3901 }
3902 60 => {
3903 cfg.max_type_to_layout_nodes = Some(512);
3904 cfg.feature_flags.validate_identifier_inputs = true;
3905 }
3906 61 => {
3907 if chain != Chain::Mainnet {
3908 cfg.feature_flags
3910 .consensus_distributed_vote_scoring_strategy = true;
3911 }
3912 cfg.random_beacon_reduction_lower_bound = Some(700);
3914
3915 if chain != Chain::Mainnet && chain != Chain::Testnet {
3916 cfg.feature_flags.mysticeti_fastpath = true;
3918 }
3919 }
3920 62 => {
3921 cfg.feature_flags.relocate_event_module = true;
3922 }
3923 63 => {
3924 cfg.feature_flags.per_object_congestion_control_mode =
3925 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3926 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3927 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3928 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3929 }
3930 64 => {
3931 cfg.feature_flags.per_object_congestion_control_mode =
3932 PerObjectCongestionControlMode::TotalTxCount;
3933 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3934 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3935 }
3936 65 => {
3937 cfg.feature_flags
3939 .consensus_distributed_vote_scoring_strategy = true;
3940 }
3941 66 => {
3942 if chain == Chain::Mainnet {
3943 cfg.feature_flags
3945 .consensus_distributed_vote_scoring_strategy = false;
3946 }
3947 }
3948 67 => {
3949 cfg.feature_flags
3951 .consensus_distributed_vote_scoring_strategy = true;
3952 }
3953 68 => {
3954 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3955 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3956 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3957 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3958 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3959
3960 if chain != Chain::Mainnet && chain != Chain::Testnet {
3961 cfg.feature_flags.uncompressed_g1_group_elements = true;
3962 }
3963
3964 cfg.feature_flags.per_object_congestion_control_mode =
3965 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3966 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3967 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3968 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3969 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3971 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3972
3973 cfg.random_beacon_reduction_lower_bound = Some(500);
3975
3976 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3977 }
3978 69 => {
3979 cfg.consensus_voting_rounds = Some(40);
3981
3982 if chain != Chain::Mainnet && chain != Chain::Testnet {
3983 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3985 }
3986
3987 if chain != Chain::Mainnet {
3988 cfg.feature_flags.uncompressed_g1_group_elements = true;
3989 }
3990 }
3991 70 => {
3992 if chain != Chain::Mainnet {
3993 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3995 cfg.feature_flags
3997 .consensus_round_prober_probe_accepted_rounds = true;
3998 }
3999
4000 cfg.poseidon_bn254_cost_per_block = Some(388);
4001
4002 cfg.gas_model_version = Some(9);
4003 cfg.feature_flags.native_charging_v2 = true;
4004 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4005 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4006 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4007 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4008 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4009 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4010 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4011 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4012
4013 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4015 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4016 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4017 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4018
4019 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4020 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4021 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4022 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4023 Some(8213);
4024 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4025 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4026 Some(9484);
4027
4028 cfg.hash_keccak256_cost_base = Some(10);
4029 cfg.hash_blake2b256_cost_base = Some(10);
4030
4031 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4033 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4034 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4035 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4036
4037 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4038 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4039 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4040 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4041
4042 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4043 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4044 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4045 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4046
4047 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4048 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4049 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4050 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4051
4052 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4053 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4054 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4055 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4056
4057 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4058 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4059
4060 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4061 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4062 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4063 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4064
4065 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4066 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4067 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4068 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4069
4070 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4071 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4072
4073 cfg.validator_validate_metadata_cost_base = Some(20000);
4074 }
4075 71 => {
4076 cfg.sip_45_consensus_amplification_threshold = Some(5);
4077
4078 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4080 }
4081 72 => {
4082 cfg.feature_flags.convert_type_argument_error = true;
4083
4084 cfg.max_tx_gas = Some(50_000_000_000_000);
4087 cfg.max_gas_price = Some(50_000_000_000);
4089
4090 cfg.feature_flags.variant_nodes = true;
4091 }
4092 73 => {
4093 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4095
4096 if chain != Chain::Mainnet && chain != Chain::Testnet {
4097 cfg.consensus_gc_depth = Some(60);
4100 }
4101
4102 if chain != Chain::Mainnet {
4103 cfg.feature_flags.consensus_zstd_compression = true;
4105 }
4106
4107 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4109 cfg.feature_flags
4111 .consensus_round_prober_probe_accepted_rounds = true;
4112
4113 cfg.feature_flags.per_object_congestion_control_mode =
4115 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4116 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4117 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4118 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4119 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4121 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4122 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4123 }
4124 74 => {
4125 if chain != Chain::Mainnet && chain != Chain::Testnet {
4127 cfg.feature_flags.enable_nitro_attestation = true;
4128 }
4129 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4130 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4131 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4132 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4133
4134 cfg.feature_flags.consensus_zstd_compression = true;
4136
4137 if chain != Chain::Mainnet && chain != Chain::Testnet {
4138 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4139 }
4140 }
4141 75 => {
4142 if chain != Chain::Mainnet {
4143 cfg.feature_flags.passkey_auth = true;
4144 }
4145 }
4146 76 => {
4147 if chain != Chain::Mainnet && chain != Chain::Testnet {
4148 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4149 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4150 }
4151 cfg.feature_flags.minimize_child_object_mutations = true;
4152
4153 if chain != Chain::Mainnet {
4154 cfg.feature_flags.accept_passkey_in_multisig = true;
4155 }
4156 }
4157 77 => {
4158 cfg.feature_flags.uncompressed_g1_group_elements = true;
4159
4160 if chain != Chain::Mainnet {
4161 cfg.consensus_gc_depth = Some(60);
4162 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4163 }
4164 }
4165 78 => {
4166 cfg.feature_flags.move_native_context = true;
4167 cfg.tx_context_fresh_id_cost_base = Some(52);
4168 cfg.tx_context_sender_cost_base = Some(30);
4169 cfg.tx_context_epoch_cost_base = Some(30);
4170 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4171 cfg.tx_context_sponsor_cost_base = Some(30);
4172 cfg.tx_context_gas_price_cost_base = Some(30);
4173 cfg.tx_context_gas_budget_cost_base = Some(30);
4174 cfg.tx_context_ids_created_cost_base = Some(30);
4175 cfg.tx_context_replace_cost_base = Some(30);
4176 cfg.gas_model_version = Some(10);
4177
4178 if chain != Chain::Mainnet {
4179 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4180 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4181
4182 cfg.feature_flags.per_object_congestion_control_mode =
4184 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4185 ExecutionTimeEstimateParams {
4186 target_utilization: 30,
4187 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4189 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4191 stored_observations_limit: u64::MAX,
4192 stake_weighted_median_threshold: 0,
4193 default_none_duration_for_new_keys: false,
4194 observations_chunk_size: None,
4195 },
4196 );
4197 }
4198 }
4199 79 => {
4200 if chain != Chain::Mainnet {
4201 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4202
4203 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4206
4207 cfg.feature_flags.consensus_batched_block_sync = true;
4208
4209 cfg.feature_flags.enable_nitro_attestation = true
4211 }
4212 cfg.feature_flags.normalize_ptb_arguments = true;
4213
4214 cfg.consensus_gc_depth = Some(60);
4215 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4216 }
4217 80 => {
4218 cfg.max_ptb_value_size = Some(1024 * 1024);
4219 }
4220 81 => {
4221 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4222 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4223 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4224 }
4225 82 => {
4226 cfg.feature_flags.max_ptb_value_size_v2 = true;
4227 }
4228 83 => {
4229 if chain == Chain::Mainnet {
4230 let aliased: [u8; 32] = Hex::decode(
4232 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4233 )
4234 .unwrap()
4235 .try_into()
4236 .unwrap();
4237
4238 cfg.aliased_addresses.push(AliasedAddress {
4240 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4241 aliased,
4242 allowed_tx_digests: vec![
4243 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4244 ],
4245 });
4246
4247 cfg.aliased_addresses.push(AliasedAddress {
4248 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4249 aliased,
4250 allowed_tx_digests: vec![
4251 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4252 ],
4253 });
4254 }
4255
4256 if chain != Chain::Mainnet {
4259 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4260 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4261
4262 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4264 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4265 cfg.feature_flags.per_object_congestion_control_mode =
4266 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4267 ExecutionTimeEstimateParams {
4268 target_utilization: 30,
4269 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4271 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4273 stored_observations_limit: u64::MAX,
4274 stake_weighted_median_threshold: 0,
4275 default_none_duration_for_new_keys: false,
4276 observations_chunk_size: None,
4277 },
4278 );
4279
4280 cfg.feature_flags.consensus_batched_block_sync = true;
4282
4283 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4286 cfg.feature_flags.enable_nitro_attestation = true;
4287 }
4288 }
4289 84 => {
4290 if chain == Chain::Mainnet {
4291 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4292 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4293
4294 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4296 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4297 cfg.feature_flags.per_object_congestion_control_mode =
4298 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4299 ExecutionTimeEstimateParams {
4300 target_utilization: 30,
4301 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4303 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4305 stored_observations_limit: u64::MAX,
4306 stake_weighted_median_threshold: 0,
4307 default_none_duration_for_new_keys: false,
4308 observations_chunk_size: None,
4309 },
4310 );
4311
4312 cfg.feature_flags.consensus_batched_block_sync = true;
4314
4315 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4318 cfg.feature_flags.enable_nitro_attestation = true;
4319 }
4320
4321 cfg.feature_flags.per_object_congestion_control_mode =
4323 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4324 ExecutionTimeEstimateParams {
4325 target_utilization: 30,
4326 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4328 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4330 stored_observations_limit: 20,
4331 stake_weighted_median_threshold: 0,
4332 default_none_duration_for_new_keys: false,
4333 observations_chunk_size: None,
4334 },
4335 );
4336 cfg.feature_flags.allow_unbounded_system_objects = true;
4337 }
4338 85 => {
4339 if chain != Chain::Mainnet && chain != Chain::Testnet {
4340 cfg.feature_flags.enable_party_transfer = true;
4341 }
4342
4343 cfg.feature_flags
4344 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4345 cfg.feature_flags.disallow_self_identifier = true;
4346 cfg.feature_flags.per_object_congestion_control_mode =
4347 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4348 ExecutionTimeEstimateParams {
4349 target_utilization: 50,
4350 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4352 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4354 stored_observations_limit: 20,
4355 stake_weighted_median_threshold: 0,
4356 default_none_duration_for_new_keys: false,
4357 observations_chunk_size: None,
4358 },
4359 );
4360 }
4361 86 => {
4362 cfg.feature_flags.type_tags_in_object_runtime = true;
4363 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4364
4365 cfg.feature_flags.per_object_congestion_control_mode =
4367 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4368 ExecutionTimeEstimateParams {
4369 target_utilization: 50,
4370 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4372 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4374 stored_observations_limit: 20,
4375 stake_weighted_median_threshold: 3334,
4376 default_none_duration_for_new_keys: false,
4377 observations_chunk_size: None,
4378 },
4379 );
4380 if chain != Chain::Mainnet {
4382 cfg.feature_flags.enable_party_transfer = true;
4383 }
4384 }
4385 87 => {
4386 if chain == Chain::Mainnet {
4387 cfg.feature_flags.record_time_estimate_processed = true;
4388 }
4389 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4390 }
4391 88 => {
4392 cfg.feature_flags.record_time_estimate_processed = true;
4393 cfg.tx_context_rgp_cost_base = Some(30);
4394 cfg.feature_flags
4395 .ignore_execution_time_observations_after_certs_closed = true;
4396
4397 cfg.feature_flags.per_object_congestion_control_mode =
4400 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4401 ExecutionTimeEstimateParams {
4402 target_utilization: 50,
4403 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4405 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4407 stored_observations_limit: 20,
4408 stake_weighted_median_threshold: 3334,
4409 default_none_duration_for_new_keys: true,
4410 observations_chunk_size: None,
4411 },
4412 );
4413 }
4414 89 => {
4415 cfg.feature_flags.dependency_linkage_error = true;
4416 cfg.feature_flags.additional_multisig_checks = true;
4417 }
4418 90 => {
4419 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4421 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4422 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4423 cfg.feature_flags.accept_passkey_in_multisig = true;
4424 cfg.feature_flags.passkey_auth = true;
4425 cfg.feature_flags.check_for_init_during_upgrade = true;
4426
4427 if chain != Chain::Mainnet {
4429 cfg.feature_flags.mysticeti_fastpath = true;
4430 }
4431 }
4432 91 => {
4433 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4434 }
4435 92 => {
4436 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4437 }
4438 93 => {
4439 cfg.feature_flags
4440 .consensus_checkpoint_signature_key_includes_digest = true;
4441 }
4442 94 => {
4443 cfg.feature_flags.per_object_congestion_control_mode =
4445 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4446 ExecutionTimeEstimateParams {
4447 target_utilization: 50,
4448 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4450 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4452 stored_observations_limit: 18,
4453 stake_weighted_median_threshold: 3334,
4454 default_none_duration_for_new_keys: true,
4455 observations_chunk_size: None,
4456 },
4457 );
4458
4459 cfg.feature_flags.enable_party_transfer = true;
4461 }
4462 95 => {
4463 cfg.type_name_id_base_cost = Some(52);
4464
4465 cfg.max_transactions_per_checkpoint = Some(20_000);
4467 }
4468 96 => {
4469 if chain != Chain::Mainnet && chain != Chain::Testnet {
4471 cfg.feature_flags
4472 .include_checkpoint_artifacts_digest_in_summary = true;
4473 }
4474 cfg.feature_flags.correct_gas_payment_limit_check = true;
4475 cfg.feature_flags.authority_capabilities_v2 = true;
4476 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4477 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4478 cfg.feature_flags.enable_coin_registry = true;
4479
4480 cfg.feature_flags.mysticeti_fastpath = true;
4482 }
4483 97 => {
4484 cfg.feature_flags.additional_borrow_checks = true;
4485 }
4486 98 => {
4487 cfg.event_emit_auth_stream_cost = Some(52);
4488 cfg.feature_flags.better_loader_errors = true;
4489 cfg.feature_flags.generate_df_type_layouts = true;
4490 }
4491 99 => {
4492 cfg.feature_flags.use_new_commit_handler = true;
4493 }
4494 100 => {
4495 cfg.feature_flags.private_generics_verifier_v2 = true;
4496 }
4497 101 => {
4498 cfg.feature_flags.create_root_accumulator_object = true;
4499 cfg.max_updates_per_settlement_txn = Some(100);
4500 if chain != Chain::Mainnet {
4501 cfg.feature_flags.enable_poseidon = true;
4502 }
4503 }
4504 102 => {
4505 cfg.feature_flags.per_object_congestion_control_mode =
4509 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4510 ExecutionTimeEstimateParams {
4511 target_utilization: 50,
4512 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4514 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4516 stored_observations_limit: 180,
4517 stake_weighted_median_threshold: 3334,
4518 default_none_duration_for_new_keys: true,
4519 observations_chunk_size: Some(18),
4520 },
4521 );
4522 cfg.feature_flags.deprecate_global_storage_ops = true;
4523 }
4524 103 => {}
4525 104 => {
4526 cfg.translation_per_command_base_charge = Some(1);
4527 cfg.translation_per_input_base_charge = Some(1);
4528 cfg.translation_pure_input_per_byte_charge = Some(1);
4529 cfg.translation_per_type_node_charge = Some(1);
4530 cfg.translation_per_reference_node_charge = Some(1);
4531 cfg.translation_per_linkage_entry_charge = Some(10);
4532 cfg.gas_model_version = Some(11);
4533 cfg.feature_flags.abstract_size_in_object_runtime = true;
4534 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4535 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4536 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4537 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4538 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4539 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4540 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4541 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4542 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4543 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4544 cfg.feature_flags.enable_ptb_execution_v2 = true;
4545
4546 cfg.poseidon_bn254_cost_base = Some(260);
4547
4548 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4549
4550 if chain != Chain::Mainnet {
4551 cfg.feature_flags
4552 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4553 }
4554
4555 cfg.feature_flags
4556 .include_cancelled_randomness_txns_in_prologue = true;
4557 }
4558 105 => {
4559 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4560 cfg.feature_flags.disable_preconsensus_locking = true;
4561
4562 if chain != Chain::Mainnet {
4563 cfg.feature_flags
4564 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4565 }
4566 }
4567 106 => {
4568 cfg.accumulator_object_storage_cost = Some(7600);
4570
4571 if chain != Chain::Mainnet && chain != Chain::Testnet {
4572 cfg.feature_flags.enable_accumulators = true;
4573 cfg.feature_flags.enable_address_balance_gas_payments = true;
4574 cfg.feature_flags.enable_authenticated_event_streams = true;
4575 cfg.feature_flags.enable_object_funds_withdraw = true;
4576 }
4577 }
4578 107 => {
4579 cfg.feature_flags
4580 .consensus_skip_gced_blocks_in_direct_finalization = true;
4581
4582 if in_integration_test() {
4584 cfg.consensus_gc_depth = Some(6);
4585 cfg.consensus_max_num_transactions_in_block = Some(8);
4586 }
4587 }
4588 108 => {
4589 cfg.feature_flags.gas_rounding_halve_digits = true;
4590 cfg.feature_flags.flexible_tx_context_positions = true;
4591 cfg.feature_flags.disable_entry_point_signature_check = true;
4592
4593 if chain != Chain::Mainnet {
4594 cfg.feature_flags.address_aliases = true;
4595
4596 cfg.feature_flags.enable_accumulators = true;
4597 cfg.feature_flags.enable_address_balance_gas_payments = true;
4598 }
4599
4600 cfg.feature_flags.enable_poseidon = true;
4601 }
4602 109 => {
4603 cfg.binary_variant_handles = Some(1024);
4604 cfg.binary_variant_instantiation_handles = Some(1024);
4605 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4606 }
4607 110 => {
4608 cfg.feature_flags
4609 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4610 cfg.feature_flags
4611 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4612 if chain != Chain::Mainnet && chain != Chain::Testnet {
4613 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4614 }
4615 cfg.feature_flags.validate_zklogin_public_identifier = true;
4616 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4617 cfg.feature_flags
4618 .consensus_always_accept_system_transactions = true;
4619 if chain != Chain::Mainnet {
4620 cfg.feature_flags.enable_object_funds_withdraw = true;
4621 }
4622 }
4623 111 => {
4624 cfg.feature_flags.validator_metadata_verify_v2 = true;
4625 }
4626 112 => {
4627 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4628 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4629 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4630 cfg.group_ops_ristretto_point_add_cost = Some(500);
4631 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4632 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4633 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4634 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4635 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4636 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4637
4638 if chain != Chain::Mainnet && chain != Chain::Testnet {
4639 cfg.feature_flags.enable_ristretto255_group_ops = true;
4640 }
4641 }
4642 113 => {
4643 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4644 if chain != Chain::Mainnet && chain != Chain::Testnet {
4645 cfg.feature_flags.defer_unpaid_amplification = true;
4646 }
4647 }
4648 114 => {
4649 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4650 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4651 if chain != Chain::Mainnet {
4652 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4653 cfg.feature_flags.enable_authenticated_event_streams = true;
4654 cfg.feature_flags
4655 .include_checkpoint_artifacts_digest_in_summary = true;
4656 }
4657 }
4658 115 => {
4659 cfg.feature_flags.normalize_depth_formula = true;
4660 }
4661 116 => {
4662 cfg.feature_flags.gasless_transaction_drop_safety = true;
4663 cfg.feature_flags.address_aliases = true;
4664 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4665 cfg.feature_flags.defer_unpaid_amplification = false;
4667 cfg.feature_flags.enable_display_registry = true;
4668 }
4669 117 => {}
4670 118 => {
4671 cfg.feature_flags.use_coin_party_owner = true;
4672 }
4673 119 => {
4674 cfg.execution_version = Some(4);
4676 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4677 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4678 if chain != Chain::Mainnet {
4679 cfg.feature_flags.enable_gasless = true;
4680 cfg.gasless_max_computation_units = Some(50_000);
4681 cfg.gasless_allowed_token_types = Some(vec![]);
4682 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4683 cfg.feature_flags
4684 .convert_withdrawal_compatibility_ptb_arguments = true;
4685 }
4686 cfg.gasless_max_unused_inputs = Some(1);
4687 cfg.gasless_max_pure_input_bytes = Some(32);
4688 if chain == Chain::Testnet {
4689 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4690 }
4691 cfg.transfer_receive_object_cost_per_byte = Some(1);
4692 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4693 }
4694 120 => {
4695 cfg.feature_flags.disallow_jump_orphans = true;
4696 }
4697 121 => {
4698 if chain != Chain::Mainnet {
4700 cfg.feature_flags.defer_unpaid_amplification = true;
4701 cfg.gasless_max_tps = Some(50);
4702 }
4703 cfg.feature_flags
4704 .early_return_receive_object_mismatched_type = true;
4705 }
4706 122 => {
4707 cfg.feature_flags.defer_unpaid_amplification = true;
4709 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4711 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4712 if chain != Chain::Mainnet && chain != Chain::Testnet {
4713 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4714 }
4715 cfg.feature_flags.gasless_verify_remaining_balance = true;
4716 cfg.include_special_package_amendments = match chain {
4717 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4718 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4719 Chain::Unknown => None,
4720 };
4721 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4722 cfg.gasless_max_tps = Some(300);
4723 cfg.gasless_max_computation_units = Some(5_000);
4724 }
4725 123 => {
4726 cfg.gas_model_version = Some(13);
4727 }
4728 124 => {
4729 if chain != Chain::Mainnet && chain != Chain::Testnet {
4730 cfg.feature_flags.timestamp_based_epoch_close = true;
4731 }
4732 cfg.gas_model_version = Some(14);
4733 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4734
4735 cfg.feature_flags.enable_accumulators = true;
4741 cfg.feature_flags.enable_address_balance_gas_payments = true;
4742 cfg.feature_flags.enable_authenticated_event_streams = true;
4743 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4744 cfg.feature_flags.enable_object_funds_withdraw = true;
4745 cfg.feature_flags
4746 .convert_withdrawal_compatibility_ptb_arguments = true;
4747 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4748 cfg.feature_flags
4749 .include_checkpoint_artifacts_digest_in_summary = true;
4750 cfg.feature_flags.enable_gasless = true;
4751
4752 if chain == Chain::Mainnet {
4757 cfg.gasless_allowed_token_types = Some(vec![
4758 (MAINNET_USDC.to_string(), 10_000),
4759 (MAINNET_USDSUI.to_string(), 10_000),
4760 (MAINNET_SUI_USDE.to_string(), 10_000),
4761 (MAINNET_USDY.to_string(), 10_000),
4762 (MAINNET_FDUSD.to_string(), 10_000),
4763 (MAINNET_AUSD.to_string(), 10_000),
4764 (MAINNET_USDB.to_string(), 10_000),
4765 ]);
4766 }
4767 }
4768 125 => {
4769 cfg.feature_flags.granular_post_execution_checks = true;
4770 if chain != Chain::Mainnet {
4771 cfg.feature_flags.timestamp_based_epoch_close = true;
4772 }
4773 }
4774 126 => {
4775 cfg.feature_flags.early_exit_on_iffw = true;
4776 }
4777 127 => {
4778 cfg.feature_flags.always_advance_dkg_to_resolution = true;
4779
4780 cfg.verify_bulletproofs_ristretto255_base_cost = Some(23866);
4781 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(1324);
4782 cfg.group_ops_ristretto_decode_scalar_cost = Some(5);
4783 cfg.group_ops_ristretto_decode_point_cost = Some(216);
4784 cfg.group_ops_ristretto_scalar_add_cost = Some(2);
4785 cfg.group_ops_ristretto_point_add_cost = Some(8);
4786 cfg.group_ops_ristretto_scalar_sub_cost = Some(2);
4787 cfg.group_ops_ristretto_point_sub_cost = Some(8);
4788 cfg.group_ops_ristretto_scalar_mul_cost = Some(5);
4789 cfg.group_ops_ristretto_point_mul_cost = Some(1763);
4790 cfg.group_ops_ristretto_scalar_div_cost = Some(557);
4791 cfg.group_ops_ristretto_point_div_cost = Some(2244);
4792
4793 if chain != Chain::Mainnet {
4794 cfg.feature_flags.enable_ristretto255_group_ops = true;
4795 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4796 }
4797
4798 cfg.feature_flags.timestamp_based_epoch_close = true;
4799 }
4800 128 => {
4801 cfg.max_generic_instantiation_type_nodes_per_function = Some(10_000);
4802 cfg.max_generic_instantiation_type_nodes_per_module = Some(500_000);
4803 cfg.binary_enum_defs = Some(200);
4804 cfg.binary_enum_def_instantiations = Some(100);
4805 }
4806 129 => {
4807 cfg.feature_flags.enable_unified_linkage = true;
4808 }
4809 130 => {
4810 cfg.feature_flags.record_net_unsettled_object_withdraws = true;
4811 cfg.feature_flags.enable_init_on_upgrade = true;
4812 cfg.epoch_close_deadline_ms = Some(120_000);
4813 cfg.scratch_add_cost_base = Some(13);
4814 cfg.scratch_read_cost_base = Some(13);
4815 cfg.scratch_read_value_cost = Some(1);
4816 cfg.scratch_remove_cost_base = Some(13);
4817 cfg.scratch_exists_cost_base = Some(13);
4818 cfg.scratch_exists_with_type_cost_base = Some(13);
4819 cfg.scratch_exists_with_type_type_cost = Some(1);
4820 let max_commands = cfg.max_programmable_tx_commands() as u64;
4821 cfg.max_scratch_pad_size = Some(16 * max_commands);
4822 if chain != Chain::Mainnet && chain != Chain::Testnet {
4824 cfg.feature_flags.zklogin_circuit_mode = 1;
4825 }
4826 }
4827 131 => {
4828 cfg.feature_flags.share_transaction_deny_config_in_consensus = true;
4829 cfg.feature_flags.framework_tx_context_mut_restrictions = true;
4830 }
4831 132 => {
4832 if chain != Chain::Mainnet && chain != Chain::Testnet {
4833 cfg.feature_flags.defer_owned_object_double_spend = true;
4834 cfg.feature_flags.create_forwarding_address_registry = true;
4835 }
4836 cfg.object_record_new_uid_from_hash_cost_base = Some(1);
4837 cfg.feature_flags
4838 .enable_order_independent_upgrade_init_linkage = true;
4839 }
4840 133 => {
4841 cfg.feature_flags
4842 .include_function_signatures_in_instantiation_limits = true;
4843 cfg.max_accumulator_type_nodes = Some(16);
4844 }
4845 134 => {
4846 if chain != Chain::Mainnet {
4853 cfg.package_original_package_id_impl_cost_base = Some(52);
4854 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4855 cfg.package_original_package_id_impl_cost_per_byte =
4856 Some(package_read_cost_per_byte);
4857
4858 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4859 cfg.consensus_max_num_transactions_in_block = Some(128);
4860 }
4861
4862 if chain == Chain::Mainnet {
4863 cfg.feature_flags.defer_unpaid_amplification = false;
4864 }
4865 }
4866 135 => {
4867 cfg.package_original_package_id_impl_cost_base = Some(52);
4870 let package_read_cost_per_byte = cfg.obj_access_cost_read_per_byte();
4871 cfg.package_original_package_id_impl_cost_per_byte =
4872 Some(package_read_cost_per_byte);
4873
4874 cfg.consensus_max_transactions_in_block_bytes = Some(288 * 1024);
4875 cfg.consensus_max_num_transactions_in_block = Some(128);
4876
4877 cfg.feature_flags.defer_unpaid_amplification = false;
4878 }
4879 136 => {
4880 cfg.feature_flags.ptb_tx_context_restrictions = true;
4881
4882 cfg.translation_per_live_reference_charge = Some(1);
4883 cfg.max_ptb_live_references = Some(64);
4884 cfg.max_ptb_returned_references = Some(16);
4885 cfg.max_ptb_total_returned_references = Some(256);
4886
4887 if chain != Chain::Mainnet && chain != Chain::Testnet {
4888 cfg.feature_flags.allowed_proposers = true;
4889 }
4890 cfg.feature_flags.harden_linkage_consistency = true;
4891
4892 cfg.package_arena_size_in_bytes = Some(10_000_000);
4893 }
4894 137 => {
4895 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(621);
4896 cfg.max_bulletproofs_total_bits = Some(1024);
4897
4898 if chain != Chain::Mainnet {
4899 cfg.feature_flags.enable_allowances = true;
4900 }
4901 cfg.feature_flags.fix_ptb_generated_reads = true;
4902 cfg.feature_flags.charge_ld_const_abstract_size = true;
4903 if chain != Chain::Mainnet && chain != Chain::Testnet {
4904 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4905 }
4906 cfg.reserve_object_funds_for_withdrawal_cost_base = Some(52);
4907 cfg.reserve_object_funds_for_withdrawal_cold_read_cost = Some(184);
4910
4911 cfg.feature_flags.allowed_proposers = true;
4912
4913 cfg.feature_flags.validate_ptb_argument_indices = true;
4914 cfg.feature_flags.memory_safety_invariant_check_v2 = true;
4915 }
4916 138 => {
4917 cfg.gas_model_version = Some(15);
4918 cfg.feature_flags.enable_allowances = true;
4919 if chain != Chain::Mainnet {
4920 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4921 cfg.feature_flags.disable_effects_tx_dependencies = true;
4922 }
4923 cfg.feature_flags.merge_colliding_deferrals = true;
4924 if chain == Chain::Mainnet {
4926 cfg.storage_rebate_rate = Some(9999);
4927 }
4928 }
4929 139 => {
4930 if chain != Chain::Mainnet && chain != Chain::Testnet {
4931 cfg.feature_flags.enable_forwarding_addresses = true;
4932 cfg.feature_flags.mldsa65_auth = true;
4933 }
4934 cfg.storage_rebate_rate = Some(9999);
4935 if chain != Chain::Mainnet {
4936 cfg.feature_flags.allow_dkg_completion_after_timeout = true;
4937 }
4938 cfg.obj_access_cost_read_per_package_kb = Some(154);
4940 }
4941 140 => {
4942 cfg.staggered_submission_signal_window_commits = Some(300);
4945 cfg.staggered_submission_signal_min_excess_copies_per_commit = Some(2);
4946 cfg.staggered_submission_signal_exit_dwell_commits = Some(6000);
4947 cfg.staggered_submission_signal_band1_enter_ratio_bps = Some(1000);
4948 cfg.staggered_submission_signal_band1_exit_ratio_bps = Some(500);
4949 cfg.staggered_submission_signal_band2_enter_ratio_bps = Some(5000);
4950 cfg.staggered_submission_signal_band2_exit_ratio_bps = Some(2500);
4951
4952 cfg.vector_reverse_base_cost = Some(52);
4953 cfg.vector_reverse_per_elem_cost = Some(8);
4954 cfg.vector_keep_range_base_cost = Some(52);
4955 cfg.vector_keep_range_per_dropped_elem_cost = Some(1);
4956 cfg.vector_keep_range_per_moved_elem_cost = Some(8);
4957 cfg.vector_copy_range_base_cost = Some(52);
4958 cfg.vector_replace_range_base_cost = Some(52);
4959 cfg.vector_replace_range_per_elem_cost = Some(8);
4960
4961 if chain != Chain::Mainnet && chain != Chain::Testnet {
4962 cfg.feature_flags.shuffle_consensus_commit_blocks = true;
4963 }
4964
4965 cfg.feature_flags.allow_references_in_ptbs = true;
4966 cfg.feature_flags.disable_id_leak_verifier = true;
4967 cfg.feature_flags.check_object_funds_withdraw_in_execution = true;
4968 cfg.feature_flags.disable_effects_tx_dependencies = true;
4969 }
4970 141 => {
4971 cfg.clock_borrow_cost_base = Some(52);
4972 cfg.feature_flags.check_groth16_pvk_length = true;
4973 cfg.object_is_shared_input_cost_base = Some(52);
4974 cfg.feature_flags.secp256r1_ecrecover_checks_x_below_p = true;
4975 }
4976 _ => panic!("unsupported version {:?}", version),
4987 }
4988 }
4989
4990 cfg
4991 }
4992
4993 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4994 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4995 || !self.feature_flags.split_checkpoints_in_consensus_handler
4996 {
4997 return;
4998 }
4999
5000 if !mysten_common::in_test_configuration() {
5001 return;
5002 }
5003
5004 use rand::{Rng, SeedableRng, rngs::StdRng};
5005 let mut rng = StdRng::from_seed(*seed);
5006 let max_txns = rng.gen_range(10..=100u64);
5007 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
5008 self.max_transactions_per_checkpoint = Some(max_txns);
5009 }
5010
5011 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
5017 let (
5018 max_back_edges_per_function,
5019 max_back_edges_per_module,
5020 sanity_check_with_regex_reference_safety,
5021 ) = if let Some((
5022 max_back_edges_per_function,
5023 max_back_edges_per_module,
5024 sanity_check_with_regex_reference_safety,
5025 )) = signing_limits
5026 {
5027 (
5028 Some(max_back_edges_per_function),
5029 Some(max_back_edges_per_module),
5030 Some(sanity_check_with_regex_reference_safety),
5031 )
5032 } else {
5033 (None, None, None)
5034 };
5035
5036 let additional_borrow_checks = if signing_limits.is_some() {
5037 true
5039 } else {
5040 self.additional_borrow_checks()
5041 };
5042 let deprecate_global_storage_ops = if signing_limits.is_some() {
5043 true
5045 } else {
5046 self.deprecate_global_storage_ops()
5047 };
5048
5049 VerifierConfig {
5050 max_loop_depth: Some(self.max_loop_depth() as usize),
5051 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5052 max_function_parameters: Some(self.max_function_parameters() as usize),
5053 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5054 max_value_stack_size: self.max_value_stack_size() as usize,
5055 max_type_nodes: Some(self.max_type_nodes() as usize),
5056 max_generic_instantiation_type_nodes_per_function: self
5057 .max_generic_instantiation_type_nodes_per_function_as_option()
5058 .map(|v| v as usize),
5059 max_generic_instantiation_type_nodes_per_module: self
5060 .max_generic_instantiation_type_nodes_per_module_as_option()
5061 .map(|v| v as usize),
5062 include_function_signatures_in_instantiation_limits: self
5063 .include_function_signatures_in_instantiation_limits(),
5064 max_push_size: Some(self.max_push_size() as usize),
5065 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5066 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5067 max_function_definitions: Some(self.max_function_definitions() as usize),
5068 max_data_definitions: Some(self.max_struct_definitions() as usize),
5069 max_constant_vector_len: Some(self.max_move_vector_len()),
5070 max_back_edges_per_function,
5071 max_back_edges_per_module,
5072 max_basic_blocks_in_script: None,
5073 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5075 allow_receiving_object_id: self.allow_receiving_object_id(),
5076 reject_mutable_random_on_entry_functions: self
5077 .reject_mutable_random_on_entry_functions(),
5078 bytecode_version: self.move_binary_format_version(),
5079 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5080 additional_borrow_checks,
5081 better_loader_errors: self.better_loader_errors(),
5082 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5083 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5084 .map(|limit| limit as u128),
5085 deprecate_global_storage_ops,
5086 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5087 disable_id_leak_verifier: self.disable_id_leak_verifier(),
5088 switch_to_regex_reference_safety: false,
5089 framework_tx_context_mut_restrictions: self.framework_tx_context_mut_restrictions(),
5090 disallow_jump_orphans: self.disallow_jump_orphans(),
5091 }
5092 }
5093
5094 pub fn binary_config(
5095 &self,
5096 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5097 ) -> BinaryConfig {
5098 let deprecate_global_storage_ops =
5099 override_deprecate_global_storage_ops_during_deserialization
5100 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5101 BinaryConfig::new(
5102 self.move_binary_format_version(),
5103 self.min_move_binary_format_version_as_option()
5104 .unwrap_or(VERSION_1),
5105 self.no_extraneous_module_bytes(),
5106 deprecate_global_storage_ops,
5107 TableConfig {
5108 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5109 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5110 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5111 function_instantiations: self
5112 .binary_function_instantiations_as_option()
5113 .unwrap_or(u16::MAX),
5114 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5115 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5116 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5117 address_identifiers: self
5118 .binary_address_identifiers_as_option()
5119 .unwrap_or(u16::MAX),
5120 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5121 struct_def_instantiations: self
5122 .binary_struct_def_instantiations_as_option()
5123 .unwrap_or(u16::MAX),
5124 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5125 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5126 field_instantiations: self
5127 .binary_field_instantiations_as_option()
5128 .unwrap_or(u16::MAX),
5129 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5130 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5131 enum_def_instantiations: self
5132 .binary_enum_def_instantiations_as_option()
5133 .unwrap_or(u16::MAX),
5134 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5135 variant_instantiation_handles: self
5136 .binary_variant_instantiation_handles_as_option()
5137 .unwrap_or(u16::MAX),
5138 },
5139 )
5140 }
5141
5142 pub fn apply_overrides_for_testing(
5146 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5147 ) -> OverrideGuard {
5148 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5149 assert!(cur.is_none(), "config override already present");
5150 *cur = Some(Box::new(override_fn));
5151 OverrideGuard
5152 }
5153
5154 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5155 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5156 warn!(
5157 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5158 );
5159 ret = override_fn(version, ret);
5160 }
5161 ret
5162 }
5163}
5164
5165impl ProtocolConfig {
5169 pub fn set_execution_version_for_testing(&mut self, val: u64) {
5173 let current = self.execution_version.unwrap_or(0);
5174 assert!(
5175 val >= current,
5176 "cannot downgrade execution_version from {current} to {val}: running an old \
5177 executor against a newer protocol config/framework is unsupported. To test \
5178 frozen executor behavior, start from the last protocol version of that executor \
5179 instead, so genesis loads the matching framework snapshot (see \
5180 test_address_balance_gas_v3_accumulator_sign)."
5181 );
5182 self.execution_version = Some(val);
5183 }
5184
5185 pub fn set_zklogin_circuit_mode_for_testing(&mut self, val: u64) {
5188 self.feature_flags.zklogin_circuit_mode = val
5189 }
5190
5191 pub fn set_per_object_congestion_control_mode_for_testing(
5192 &mut self,
5193 val: PerObjectCongestionControlMode,
5194 ) {
5195 self.feature_flags.per_object_congestion_control_mode = val;
5196 }
5197
5198 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5199 self.feature_flags.consensus_choice = val;
5200 }
5201
5202 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5203 self.feature_flags.consensus_network = val;
5204 }
5205
5206 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5207 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5208 }
5209
5210 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5211 self.feature_flags.mysticeti_num_leaders_per_round = val;
5212 }
5213
5214 pub fn disable_accumulators_for_testing(&mut self) {
5215 self.feature_flags.enable_accumulators = false;
5216 self.feature_flags.enable_address_balance_gas_payments = false;
5217 }
5218
5219 pub fn enable_coin_reservation_for_testing(&mut self) {
5220 self.feature_flags.enable_coin_reservation_obj_refs = true;
5221 self.feature_flags
5222 .convert_withdrawal_compatibility_ptb_arguments = true;
5223 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5226 }
5227
5228 pub fn disable_coin_reservation_for_testing(&mut self) {
5229 self.feature_flags.enable_coin_reservation_obj_refs = false;
5230 self.feature_flags
5231 .convert_withdrawal_compatibility_ptb_arguments = false;
5232 }
5233
5234 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5235 self.feature_flags.enable_accumulators = true;
5236 self.feature_flags.allow_private_accumulator_entrypoints = true;
5237 self.feature_flags.enable_address_balance_gas_payments = true;
5238 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5239 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5240 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5241 }
5242
5243 pub fn enable_gasless_for_testing(&mut self) {
5244 self.enable_address_balance_gas_payments_for_testing();
5245 self.feature_flags.enable_gasless = true;
5246 self.feature_flags.gasless_verify_remaining_balance = true;
5247 self.gasless_max_computation_units = Some(5_000);
5248 self.gasless_allowed_token_types = Some(vec![]);
5249 self.gasless_max_tps = Some(1000);
5250 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5251 }
5252
5253 pub fn disable_gasless_for_testing(&mut self) {
5254 self.feature_flags.enable_gasless = false;
5255 self.gasless_max_computation_units = None;
5256 self.gasless_allowed_token_types = None;
5257 }
5258
5259 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5260 self.feature_flags.enable_accumulators = true;
5261 self.feature_flags.enable_authenticated_event_streams = true;
5262 self.feature_flags
5263 .include_checkpoint_artifacts_digest_in_summary = true;
5264 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5265 }
5266}
5267
5268type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5269
5270static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5271
5272#[must_use]
5273pub struct OverrideGuard;
5274
5275impl Drop for OverrideGuard {
5276 fn drop(&mut self) {
5277 info!("restoring override fn");
5278 *CONFIG_OVERRIDE.lock().unwrap() = None;
5279 }
5280}
5281
5282#[derive(PartialEq, Eq)]
5285pub enum LimitThresholdCrossed {
5286 None,
5287 Soft(u128, u128),
5288 Hard(u128, u128),
5289}
5290
5291pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5294 x: T,
5295 soft_limit: U,
5296 hard_limit: V,
5297) -> LimitThresholdCrossed {
5298 let x: V = x.into();
5299 let soft_limit: V = soft_limit.into();
5300
5301 debug_assert!(soft_limit <= hard_limit);
5302
5303 if x >= hard_limit {
5306 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5307 } else if x < soft_limit {
5308 LimitThresholdCrossed::None
5309 } else {
5310 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5311 }
5312}
5313
5314#[macro_export]
5315macro_rules! check_limit {
5316 ($x:expr, $hard:expr) => {
5317 check_limit!($x, $hard, $hard)
5318 };
5319 ($x:expr, $soft:expr, $hard:expr) => {
5320 check_limit_in_range($x as u64, $soft, $hard)
5321 };
5322}
5323
5324#[macro_export]
5328macro_rules! check_limit_by_meter {
5329 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5330 let (h, metered_str) = if $is_metered {
5332 ($metered_limit, "metered")
5333 } else {
5334 ($unmetered_hard_limit, "unmetered")
5336 };
5337 use sui_protocol_config::check_limit_in_range;
5338 let result = check_limit_in_range($x as u64, $metered_limit, h);
5339 match result {
5340 LimitThresholdCrossed::None => {}
5341 LimitThresholdCrossed::Soft(_, _) => {
5342 $metric.with_label_values(&[metered_str, "soft"]).inc();
5343 }
5344 LimitThresholdCrossed::Hard(_, _) => {
5345 $metric.with_label_values(&[metered_str, "hard"]).inc();
5346 }
5347 };
5348 result
5349 }};
5350}
5351
5352pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5355
5356static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5357 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5358
5359static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5360 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5361
5362fn parse_amendments(json: &str) -> Arc<Amendments> {
5363 #[derive(serde::Deserialize)]
5364 struct AmendmentEntry {
5365 root: String,
5366 deps: Vec<DepEntry>,
5367 }
5368
5369 #[derive(serde::Deserialize)]
5370 struct DepEntry {
5371 original_id: String,
5372 version_id: String,
5373 }
5374
5375 let entries: Vec<AmendmentEntry> =
5376 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5377 let mut amendments = BTreeMap::new();
5378 for entry in entries {
5379 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5380 let mut dep_ids = BTreeMap::new();
5381 for dep in entry.deps {
5382 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5383 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5384 assert!(
5385 dep_ids.insert(orig_id, upgraded_id).is_none(),
5386 "Duplicate original ID in amendments table"
5387 );
5388 }
5389 assert!(
5390 amendments.insert(root_id, dep_ids).is_none(),
5391 "Duplicate root ID in amendments table"
5392 );
5393 }
5394 Arc::new(amendments)
5395}
5396
5397#[cfg(all(test, not(msim)))]
5398mod test {
5399 use insta::assert_yaml_snapshot;
5400
5401 use super::*;
5402
5403 #[test]
5404 fn snapshot_tests() {
5405 println!("\n============================================================================");
5406 println!("! !");
5407 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5408 println!("! !");
5409 println!("============================================================================\n");
5410 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5411 let chain_str = match chain_id {
5415 Chain::Unknown => "".to_string(),
5416 _ => format!("{:?}_", chain_id),
5417 };
5418 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5419 let cur = ProtocolVersion::new(i);
5420 assert_yaml_snapshot!(
5421 format!("{}version_{}", chain_str, cur.as_u64()),
5422 ProtocolConfig::get_for_version(cur, *chain_id)
5423 );
5424 }
5425 }
5426 }
5427
5428 #[test]
5429 fn test_getters() {
5430 let prot: ProtocolConfig =
5431 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5432 assert_eq!(
5433 prot.max_arguments(),
5434 prot.max_arguments_as_option().unwrap()
5435 );
5436 }
5437
5438 #[test]
5439 fn vector_bulk_native_gas_costs_start_at_version_140() {
5440 for chain in [Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5441 let before = ProtocolConfig::get_for_version(ProtocolVersion::new(139), chain);
5442 assert_eq!(before.vector_reverse_base_cost_as_option(), None);
5443 assert_eq!(before.vector_reverse_per_elem_cost_as_option(), None);
5444 assert_eq!(before.vector_keep_range_base_cost_as_option(), None);
5445 assert_eq!(
5446 before.vector_keep_range_per_dropped_elem_cost_as_option(),
5447 None
5448 );
5449 assert_eq!(
5450 before.vector_keep_range_per_moved_elem_cost_as_option(),
5451 None
5452 );
5453 assert_eq!(before.vector_copy_range_base_cost_as_option(), None);
5454 assert_eq!(before.vector_replace_range_base_cost_as_option(), None);
5455 assert_eq!(before.vector_replace_range_per_elem_cost_as_option(), None);
5456
5457 let active = ProtocolConfig::get_for_version(ProtocolVersion::new(140), chain);
5458 assert_eq!(active.vector_reverse_base_cost_as_option(), Some(52));
5459 assert_eq!(active.vector_reverse_per_elem_cost_as_option(), Some(8));
5460 assert_eq!(active.vector_keep_range_base_cost_as_option(), Some(52));
5461 assert_eq!(
5462 active.vector_keep_range_per_dropped_elem_cost_as_option(),
5463 Some(1)
5464 );
5465 assert_eq!(
5466 active.vector_keep_range_per_moved_elem_cost_as_option(),
5467 Some(8)
5468 );
5469 assert_eq!(active.vector_copy_range_base_cost_as_option(), Some(52));
5470 assert_eq!(active.vector_replace_range_base_cost_as_option(), Some(52));
5471 assert_eq!(
5472 active.vector_replace_range_per_elem_cost_as_option(),
5473 Some(8)
5474 );
5475 }
5476 }
5477
5478 #[test]
5479 fn test_setters() {
5480 let mut prot: ProtocolConfig =
5481 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5482 prot.set_max_arguments_for_testing(123);
5483 assert_eq!(prot.max_arguments(), 123);
5484
5485 prot.set_max_arguments_from_str_for_testing("321".to_string());
5486 assert_eq!(prot.max_arguments(), 321);
5487
5488 prot.disable_max_arguments_for_testing();
5489 assert_eq!(prot.max_arguments_as_option(), None);
5490
5491 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5492 assert_eq!(prot.max_arguments(), 456);
5493 }
5494
5495 #[test]
5496 fn test_execution_version_setter_allows_upgrade() {
5497 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5498 let current = prot.execution_version();
5499 prot.set_execution_version_for_testing(current);
5500 prot.set_execution_version_for_testing(current + 1);
5501 assert_eq!(prot.execution_version(), current + 1);
5502 }
5503
5504 #[test]
5505 #[should_panic(expected = "cannot downgrade execution_version")]
5506 fn test_execution_version_setter_panics_on_downgrade() {
5507 let mut prot = ProtocolConfig::get_for_max_version_UNSAFE();
5508 let current = prot.execution_version();
5509 prot.set_execution_version_for_testing(current - 1);
5510 }
5511
5512 #[test]
5513 fn test_feature_flag_setter_by_string() {
5514 let mut prot: ProtocolConfig =
5515 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5516 assert!(!prot.zklogin_auth());
5517 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), true);
5518 assert!(prot.zklogin_auth());
5519 prot.set_feature_flag_for_testing("zklogin_auth".to_string(), false);
5520 assert!(!prot.zklogin_auth());
5521 }
5522
5523 #[test]
5524 #[should_panic(expected = "unknown feature flag")]
5525 fn test_feature_flag_setter_unknown_flag() {
5526 let mut prot: ProtocolConfig =
5527 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5528 prot.set_feature_flag_for_testing("some random string".to_string(), true);
5529 }
5530
5531 #[test]
5532 fn test_get_for_version_if_supported_applies_test_overrides() {
5533 let before =
5534 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5535 .unwrap();
5536
5537 assert!(!before.enable_coin_reservation_obj_refs());
5538
5539 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5540 cfg.enable_coin_reservation_for_testing();
5541 cfg
5542 });
5543
5544 let after =
5545 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5546 .unwrap();
5547
5548 assert!(after.enable_coin_reservation_obj_refs());
5549 }
5550
5551 #[test]
5552 #[should_panic(expected = "unsupported version")]
5553 fn max_version_test() {
5554 let _ = ProtocolConfig::get_for_version_impl(
5557 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5558 Chain::Unknown,
5559 );
5560 }
5561
5562 #[test]
5563 fn lookup_by_string_test() {
5564 let prot: ProtocolConfig =
5565 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5566 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5568
5569 assert!(
5570 prot.lookup_attr("max_arguments".to_string())
5571 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5572 );
5573
5574 assert!(
5576 prot.lookup_attr("max_move_identifier_len".to_string())
5577 .is_none()
5578 );
5579
5580 let prot: ProtocolConfig =
5582 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5583 assert!(
5584 prot.lookup_attr("max_move_identifier_len".to_string())
5585 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5586 );
5587
5588 let prot: ProtocolConfig =
5589 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5590 assert!(
5592 prot.attr_map()
5593 .get("max_move_identifier_len")
5594 .unwrap()
5595 .is_none()
5596 );
5597 assert!(
5599 prot.attr_map().get("max_arguments").unwrap()
5600 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5601 );
5602
5603 let prot: ProtocolConfig =
5605 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5606 assert!(
5608 prot.feature_flags
5609 .lookup_attr("some random string".to_owned())
5610 .is_none()
5611 );
5612 assert!(
5613 !prot
5614 .feature_flags
5615 .attr_map()
5616 .contains_key("some random string")
5617 );
5618
5619 assert!(
5621 prot.feature_flags
5622 .lookup_attr("package_upgrades".to_owned())
5623 == Some(false)
5624 );
5625 assert!(
5626 prot.feature_flags
5627 .attr_map()
5628 .get("package_upgrades")
5629 .unwrap()
5630 == &false
5631 );
5632 let prot: ProtocolConfig =
5633 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5634 assert!(
5636 prot.feature_flags
5637 .lookup_attr("package_upgrades".to_owned())
5638 == Some(true)
5639 );
5640 assert!(
5641 prot.feature_flags
5642 .attr_map()
5643 .get("package_upgrades")
5644 .unwrap()
5645 == &true
5646 );
5647 }
5648
5649 #[test]
5650 fn limit_range_fn_test() {
5651 let low = 100u32;
5652 let high = 10000u64;
5653
5654 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5655 assert!(matches!(
5656 check_limit!(255u16, low, high),
5657 LimitThresholdCrossed::Soft(255u128, 100)
5658 ));
5659 assert!(matches!(
5665 check_limit!(2550000u64, low, high),
5666 LimitThresholdCrossed::Hard(2550000, 10000)
5667 ));
5668
5669 assert!(matches!(
5670 check_limit!(2550000u64, high, high),
5671 LimitThresholdCrossed::Hard(2550000, 10000)
5672 ));
5673
5674 assert!(matches!(
5675 check_limit!(1u8, high),
5676 LimitThresholdCrossed::None
5677 ));
5678
5679 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5680
5681 assert!(matches!(
5682 check_limit!(2550000u64, high),
5683 LimitThresholdCrossed::Hard(2550000, 10000)
5684 ));
5685 }
5686
5687 #[test]
5688 fn linkage_amendments_load() {
5689 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5690 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5691 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5692 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5693 }
5694
5695 #[test]
5696 fn render_scalar_fields_use_precision_safe_encoding() {
5697 use mysten_common::rpc_format::Unmetered;
5698
5699 let config = ProtocolConfig::get_for_max_version_UNSAFE();
5700 let rendered = config
5701 .render::<serde_json::Value>(&mut Unmetered)
5702 .expect("render should succeed");
5703
5704 let max_args = rendered
5705 .get("max_arguments")
5706 .expect("max_arguments set at max version");
5707 assert!(
5708 max_args.is_number(),
5709 "u32 should render as number, got {max_args:?}",
5710 );
5711
5712 let max_tx_size = rendered
5713 .get("max_tx_size_bytes")
5714 .expect("max_tx_size_bytes set at max version");
5715 assert!(
5716 max_tx_size.is_string(),
5717 "u64 should render as string, got {max_tx_size:?}",
5718 );
5719 }
5720
5721 #[test]
5722 fn render_includes_non_scalar_gasless_allowlist_as_json() {
5723 use mysten_common::rpc_format::Unmetered;
5724 use serde_json::json;
5725
5726 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5727 config.set_gasless_allowed_token_types_for_testing(vec![
5728 ("0xa::usdc::USDC".to_string(), 10_000),
5729 ("0xb::usdt::USDT".to_string(), 0),
5730 ]);
5731
5732 let rendered = config
5733 .render::<serde_json::Value>(&mut Unmetered)
5734 .expect("render should succeed under Unmetered budget");
5735 let allowlist = rendered
5736 .get("gasless_allowed_token_types")
5737 .expect("entry should be present after the testing setter");
5738
5739 assert_eq!(
5742 allowlist,
5743 &json!([["0xa::usdc::USDC", "10000"], ["0xb::usdt::USDT", "0"],]),
5744 );
5745 }
5746
5747 #[test]
5748 fn render_targets_prost_value_for_grpc() {
5749 use mysten_common::rpc_format::Unmetered;
5750 use prost_types::value::Kind;
5751
5752 let mut config = ProtocolConfig::get_for_max_version_UNSAFE();
5753 config.set_gasless_allowed_token_types_for_testing(vec![(
5754 "0xa::usdc::USDC".to_string(),
5755 10_000,
5756 )]);
5757
5758 let rendered = config
5759 .render::<prost_types::Value>(&mut Unmetered)
5760 .expect("render to prost Value should succeed");
5761 let allowlist = rendered
5762 .get("gasless_allowed_token_types")
5763 .expect("entry should be present after the testing setter");
5764
5765 let Some(Kind::ListValue(outer)) = &allowlist.kind else {
5767 panic!(
5768 "expected ListValue at the top level, got {:?}",
5769 allowlist.kind
5770 );
5771 };
5772 assert_eq!(outer.values.len(), 1, "one allowlisted entry");
5773 let Some(Kind::ListValue(entry)) = &outer.values[0].kind else {
5774 panic!("expected each entry to be a ListValue");
5775 };
5776 assert_eq!(entry.values.len(), 2, "entry has (coin_type, amount)");
5777
5778 let Some(Kind::StringValue(coin_type)) = &entry.values[0].kind else {
5779 panic!("expected coin_type as StringValue");
5780 };
5781 assert_eq!(coin_type, "0xa::usdc::USDC");
5782
5783 let Some(Kind::StringValue(amount)) = &entry.values[1].kind else {
5785 panic!(
5786 "expected minimum_transfer_amount as StringValue (precision-safe u64); got {:?}",
5787 entry.values[1].kind,
5788 );
5789 };
5790 assert_eq!(amount, "10000");
5791 }
5792
5793 #[test]
5794 fn render_emits_null_for_unset_protocol_versions() {
5795 use mysten_common::rpc_format::Unmetered;
5796
5797 let config = ProtocolConfig::get_for_version(1.into(), Chain::Unknown);
5798 let rendered = config
5799 .render::<serde_json::Value>(&mut Unmetered)
5800 .expect("render should succeed");
5801 let entry = rendered
5805 .get("gasless_allowed_token_types")
5806 .expect("key should be present for every protocol version");
5807 assert!(
5808 entry.is_null(),
5809 "value should be null for pre-feature protocol version, got {entry:?}",
5810 );
5811 }
5812}