1use std::{
5 cell::RefCell,
6 collections::BTreeSet,
7 sync::atomic::{AtomicBool, Ordering},
8};
9
10use clap::*;
11use fastcrypto::encoding::{Base58, Encoding, Hex};
12use move_binary_format::{
13 binary_config::{BinaryConfig, TableConfig},
14 file_format_common::VERSION_1,
15};
16use move_vm_config::verifier::VerifierConfig;
17use mysten_common::in_integration_test;
18use serde::{Deserialize, Serialize};
19use serde_with::skip_serializing_none;
20use sui_protocol_config_macros::{
21 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
22};
23use tracing::{info, warn};
24
25const MIN_PROTOCOL_VERSION: u64 = 1;
27const MAX_PROTOCOL_VERSION: u64 = 116;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
309pub struct ProtocolVersion(u64);
310
311impl ProtocolVersion {
312 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
317
318 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
319
320 #[cfg(not(msim))]
321 pub const MAX_ALLOWED: Self = Self::MAX;
322
323 #[cfg(msim)]
325 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
326
327 pub fn new(v: u64) -> Self {
328 Self(v)
329 }
330
331 pub const fn as_u64(&self) -> u64 {
332 self.0
333 }
334
335 pub fn max() -> Self {
338 Self::MAX
339 }
340
341 pub fn prev(self) -> Self {
342 Self(self.0.checked_sub(1).unwrap())
343 }
344}
345
346impl From<u64> for ProtocolVersion {
347 fn from(v: u64) -> Self {
348 Self::new(v)
349 }
350}
351
352impl std::ops::Sub<u64> for ProtocolVersion {
353 type Output = Self;
354 fn sub(self, rhs: u64) -> Self::Output {
355 Self::new(self.0 - rhs)
356 }
357}
358
359impl std::ops::Add<u64> for ProtocolVersion {
360 type Output = Self;
361 fn add(self, rhs: u64) -> Self::Output {
362 Self::new(self.0 + rhs)
363 }
364}
365
366#[derive(
367 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
368)]
369pub enum Chain {
370 Mainnet,
371 Testnet,
372 #[default]
373 Unknown,
374}
375
376impl Chain {
377 pub fn as_str(self) -> &'static str {
378 match self {
379 Chain::Mainnet => "mainnet",
380 Chain::Testnet => "testnet",
381 Chain::Unknown => "unknown",
382 }
383 }
384}
385
386pub struct Error(pub String);
387
388#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
391struct FeatureFlags {
392 #[serde(skip_serializing_if = "is_false")]
395 package_upgrades: bool,
396 #[serde(skip_serializing_if = "is_false")]
399 commit_root_state_digest: bool,
400 #[serde(skip_serializing_if = "is_false")]
402 advance_epoch_start_time_in_safe_mode: bool,
403 #[serde(skip_serializing_if = "is_false")]
406 loaded_child_objects_fixed: bool,
407 #[serde(skip_serializing_if = "is_false")]
410 missing_type_is_compatibility_error: bool,
411 #[serde(skip_serializing_if = "is_false")]
414 scoring_decision_with_validity_cutoff: bool,
415
416 #[serde(skip_serializing_if = "is_false")]
419 consensus_order_end_of_epoch_last: bool,
420
421 #[serde(skip_serializing_if = "is_false")]
423 disallow_adding_abilities_on_upgrade: bool,
424 #[serde(skip_serializing_if = "is_false")]
426 disable_invariant_violation_check_in_swap_loc: bool,
427 #[serde(skip_serializing_if = "is_false")]
430 advance_to_highest_supported_protocol_version: bool,
431 #[serde(skip_serializing_if = "is_false")]
433 ban_entry_init: bool,
434 #[serde(skip_serializing_if = "is_false")]
436 package_digest_hash_module: bool,
437 #[serde(skip_serializing_if = "is_false")]
439 disallow_change_struct_type_params_on_upgrade: bool,
440 #[serde(skip_serializing_if = "is_false")]
442 no_extraneous_module_bytes: bool,
443 #[serde(skip_serializing_if = "is_false")]
445 narwhal_versioned_metadata: bool,
446
447 #[serde(skip_serializing_if = "is_false")]
449 zklogin_auth: bool,
450 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
452 consensus_transaction_ordering: ConsensusTransactionOrdering,
453
454 #[serde(skip_serializing_if = "is_false")]
462 simplified_unwrap_then_delete: bool,
463 #[serde(skip_serializing_if = "is_false")]
465 upgraded_multisig_supported: bool,
466 #[serde(skip_serializing_if = "is_false")]
468 txn_base_cost_as_multiplier: bool,
469
470 #[serde(skip_serializing_if = "is_false")]
472 shared_object_deletion: bool,
473
474 #[serde(skip_serializing_if = "is_false")]
476 narwhal_new_leader_election_schedule: bool,
477
478 #[serde(skip_serializing_if = "is_empty")]
480 zklogin_supported_providers: BTreeSet<String>,
481
482 #[serde(skip_serializing_if = "is_false")]
484 loaded_child_object_format: bool,
485
486 #[serde(skip_serializing_if = "is_false")]
487 enable_jwk_consensus_updates: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
490 end_of_epoch_transaction_supported: bool,
491
492 #[serde(skip_serializing_if = "is_false")]
495 simple_conservation_checks: bool,
496
497 #[serde(skip_serializing_if = "is_false")]
499 loaded_child_object_format_type: bool,
500
501 #[serde(skip_serializing_if = "is_false")]
503 receive_objects: bool,
504
505 #[serde(skip_serializing_if = "is_false")]
507 consensus_checkpoint_signature_key_includes_digest: bool,
508
509 #[serde(skip_serializing_if = "is_false")]
511 random_beacon: bool,
512
513 #[serde(skip_serializing_if = "is_false")]
515 bridge: bool,
516
517 #[serde(skip_serializing_if = "is_false")]
518 enable_effects_v2: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 narwhal_certificate_v2: bool,
523
524 #[serde(skip_serializing_if = "is_false")]
526 verify_legacy_zklogin_address: bool,
527
528 #[serde(skip_serializing_if = "is_false")]
530 throughput_aware_consensus_submission: bool,
531
532 #[serde(skip_serializing_if = "is_false")]
534 recompute_has_public_transfer_in_execution: bool,
535
536 #[serde(skip_serializing_if = "is_false")]
538 accept_zklogin_in_multisig: bool,
539
540 #[serde(skip_serializing_if = "is_false")]
542 accept_passkey_in_multisig: bool,
543
544 #[serde(skip_serializing_if = "is_false")]
546 validate_zklogin_public_identifier: bool,
547
548 #[serde(skip_serializing_if = "is_false")]
551 include_consensus_digest_in_prologue: bool,
552
553 #[serde(skip_serializing_if = "is_false")]
555 hardened_otw_check: bool,
556
557 #[serde(skip_serializing_if = "is_false")]
559 allow_receiving_object_id: bool,
560
561 #[serde(skip_serializing_if = "is_false")]
563 enable_poseidon: bool,
564
565 #[serde(skip_serializing_if = "is_false")]
567 enable_coin_deny_list: bool,
568
569 #[serde(skip_serializing_if = "is_false")]
571 enable_group_ops_native_functions: bool,
572
573 #[serde(skip_serializing_if = "is_false")]
575 enable_group_ops_native_function_msm: bool,
576
577 #[serde(skip_serializing_if = "is_false")]
579 enable_ristretto255_group_ops: bool,
580
581 #[serde(skip_serializing_if = "is_false")]
583 enable_nitro_attestation: bool,
584
585 #[serde(skip_serializing_if = "is_false")]
587 enable_nitro_attestation_upgraded_parsing: bool,
588
589 #[serde(skip_serializing_if = "is_false")]
591 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
592
593 #[serde(skip_serializing_if = "is_false")]
595 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
596
597 #[serde(skip_serializing_if = "is_false")]
599 reject_mutable_random_on_entry_functions: bool,
600
601 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
603 per_object_congestion_control_mode: PerObjectCongestionControlMode,
604
605 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
607 consensus_choice: ConsensusChoice,
608
609 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
611 consensus_network: ConsensusNetwork,
612
613 #[serde(skip_serializing_if = "is_false")]
615 correct_gas_payment_limit_check: bool,
616
617 #[serde(skip_serializing_if = "Option::is_none")]
619 zklogin_max_epoch_upper_bound_delta: Option<u64>,
620
621 #[serde(skip_serializing_if = "is_false")]
623 mysticeti_leader_scoring_and_schedule: bool,
624
625 #[serde(skip_serializing_if = "is_false")]
627 reshare_at_same_initial_version: bool,
628
629 #[serde(skip_serializing_if = "is_false")]
631 resolve_abort_locations_to_package_id: bool,
632
633 #[serde(skip_serializing_if = "is_false")]
637 mysticeti_use_committed_subdag_digest: bool,
638
639 #[serde(skip_serializing_if = "is_false")]
641 enable_vdf: bool,
642
643 #[serde(skip_serializing_if = "is_false")]
648 record_consensus_determined_version_assignments_in_prologue: bool,
649 #[serde(skip_serializing_if = "is_false")]
650 record_consensus_determined_version_assignments_in_prologue_v2: bool,
651
652 #[serde(skip_serializing_if = "is_false")]
654 fresh_vm_on_framework_upgrade: bool,
655
656 #[serde(skip_serializing_if = "is_false")]
664 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
665
666 #[serde(skip_serializing_if = "Option::is_none")]
668 mysticeti_num_leaders_per_round: Option<usize>,
669
670 #[serde(skip_serializing_if = "is_false")]
672 soft_bundle: bool,
673
674 #[serde(skip_serializing_if = "is_false")]
676 enable_coin_deny_list_v2: bool,
677
678 #[serde(skip_serializing_if = "is_false")]
680 passkey_auth: bool,
681
682 #[serde(skip_serializing_if = "is_false")]
684 authority_capabilities_v2: bool,
685
686 #[serde(skip_serializing_if = "is_false")]
688 rethrow_serialization_type_layout_errors: bool,
689
690 #[serde(skip_serializing_if = "is_false")]
692 consensus_distributed_vote_scoring_strategy: bool,
693
694 #[serde(skip_serializing_if = "is_false")]
696 consensus_round_prober: bool,
697
698 #[serde(skip_serializing_if = "is_false")]
700 validate_identifier_inputs: bool,
701
702 #[serde(skip_serializing_if = "is_false")]
704 disallow_self_identifier: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
708 mysticeti_fastpath: bool,
709
710 #[serde(skip_serializing_if = "is_false")]
714 disable_preconsensus_locking: bool,
715
716 #[serde(skip_serializing_if = "is_false")]
718 relocate_event_module: bool,
719
720 #[serde(skip_serializing_if = "is_false")]
722 uncompressed_g1_group_elements: bool,
723
724 #[serde(skip_serializing_if = "is_false")]
725 disallow_new_modules_in_deps_only_packages: bool,
726
727 #[serde(skip_serializing_if = "is_false")]
729 consensus_smart_ancestor_selection: bool,
730
731 #[serde(skip_serializing_if = "is_false")]
733 consensus_round_prober_probe_accepted_rounds: bool,
734
735 #[serde(skip_serializing_if = "is_false")]
737 native_charging_v2: bool,
738
739 #[serde(skip_serializing_if = "is_false")]
742 consensus_linearize_subdag_v2: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 convert_type_argument_error: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
750 variant_nodes: bool,
751
752 #[serde(skip_serializing_if = "is_false")]
754 consensus_zstd_compression: bool,
755
756 #[serde(skip_serializing_if = "is_false")]
758 minimize_child_object_mutations: bool,
759
760 #[serde(skip_serializing_if = "is_false")]
762 record_additional_state_digest_in_prologue: bool,
763
764 #[serde(skip_serializing_if = "is_false")]
766 move_native_context: bool,
767
768 #[serde(skip_serializing_if = "is_false")]
771 consensus_median_based_commit_timestamp: bool,
772
773 #[serde(skip_serializing_if = "is_false")]
776 normalize_ptb_arguments: bool,
777
778 #[serde(skip_serializing_if = "is_false")]
780 consensus_batched_block_sync: bool,
781
782 #[serde(skip_serializing_if = "is_false")]
784 enforce_checkpoint_timestamp_monotonicity: bool,
785
786 #[serde(skip_serializing_if = "is_false")]
788 max_ptb_value_size_v2: bool,
789
790 #[serde(skip_serializing_if = "is_false")]
792 resolve_type_input_ids_to_defining_id: bool,
793
794 #[serde(skip_serializing_if = "is_false")]
796 enable_party_transfer: bool,
797
798 #[serde(skip_serializing_if = "is_false")]
800 allow_unbounded_system_objects: bool,
801
802 #[serde(skip_serializing_if = "is_false")]
804 type_tags_in_object_runtime: bool,
805
806 #[serde(skip_serializing_if = "is_false")]
808 enable_accumulators: bool,
809
810 #[serde(skip_serializing_if = "is_false")]
812 enable_coin_reservation_obj_refs: bool,
813
814 #[serde(skip_serializing_if = "is_false")]
817 create_root_accumulator_object: bool,
818
819 #[serde(skip_serializing_if = "is_false")]
821 enable_authenticated_event_streams: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
825 enable_address_balance_gas_payments: bool,
826
827 #[serde(skip_serializing_if = "is_false")]
829 address_balance_gas_check_rgp_at_signing: bool,
830
831 #[serde(skip_serializing_if = "is_false")]
832 address_balance_gas_reject_gas_coin_arg: bool,
833
834 #[serde(skip_serializing_if = "is_false")]
836 enable_multi_epoch_transaction_expiration: bool,
837
838 #[serde(skip_serializing_if = "is_false")]
840 relax_valid_during_for_owned_inputs: bool,
841
842 #[serde(skip_serializing_if = "is_false")]
844 enable_ptb_execution_v2: bool,
845
846 #[serde(skip_serializing_if = "is_false")]
848 better_adapter_type_resolution_errors: bool,
849
850 #[serde(skip_serializing_if = "is_false")]
852 record_time_estimate_processed: bool,
853
854 #[serde(skip_serializing_if = "is_false")]
856 dependency_linkage_error: bool,
857
858 #[serde(skip_serializing_if = "is_false")]
860 additional_multisig_checks: bool,
861
862 #[serde(skip_serializing_if = "is_false")]
864 ignore_execution_time_observations_after_certs_closed: bool,
865
866 #[serde(skip_serializing_if = "is_false")]
870 debug_fatal_on_move_invariant_violation: bool,
871
872 #[serde(skip_serializing_if = "is_false")]
875 allow_private_accumulator_entrypoints: bool,
876
877 #[serde(skip_serializing_if = "is_false")]
879 additional_consensus_digest_indirect_state: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
883 check_for_init_during_upgrade: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
887 per_command_shared_object_transfer_rules: bool,
888
889 #[serde(skip_serializing_if = "is_false")]
891 include_checkpoint_artifacts_digest_in_summary: bool,
892
893 #[serde(skip_serializing_if = "is_false")]
895 use_mfp_txns_in_load_initial_object_debts: bool,
896
897 #[serde(skip_serializing_if = "is_false")]
899 cancel_for_failed_dkg_early: bool,
900
901 #[serde(skip_serializing_if = "is_false")]
903 enable_coin_registry: bool,
904
905 #[serde(skip_serializing_if = "is_false")]
907 abstract_size_in_object_runtime: bool,
908
909 #[serde(skip_serializing_if = "is_false")]
911 object_runtime_charge_cache_load_gas: bool,
912
913 #[serde(skip_serializing_if = "is_false")]
915 additional_borrow_checks: bool,
916
917 #[serde(skip_serializing_if = "is_false")]
919 use_new_commit_handler: bool,
920
921 #[serde(skip_serializing_if = "is_false")]
923 better_loader_errors: bool,
924
925 #[serde(skip_serializing_if = "is_false")]
927 generate_df_type_layouts: bool,
928
929 #[serde(skip_serializing_if = "is_false")]
931 allow_references_in_ptbs: bool,
932
933 #[serde(skip_serializing_if = "is_false")]
935 enable_display_registry: bool,
936
937 #[serde(skip_serializing_if = "is_false")]
939 private_generics_verifier_v2: bool,
940
941 #[serde(skip_serializing_if = "is_false")]
943 deprecate_global_storage_ops_during_deserialization: bool,
944
945 #[serde(skip_serializing_if = "is_false")]
948 enable_non_exclusive_writes: bool,
949
950 #[serde(skip_serializing_if = "is_false")]
952 deprecate_global_storage_ops: bool,
953
954 #[serde(skip_serializing_if = "is_false")]
956 consensus_skip_gced_accept_votes: bool,
957
958 #[serde(skip_serializing_if = "is_false")]
960 include_cancelled_randomness_txns_in_prologue: bool,
961
962 #[serde(skip_serializing_if = "is_false")]
964 address_aliases: bool,
965
966 #[serde(skip_serializing_if = "is_false")]
969 fix_checkpoint_signature_mapping: bool,
970
971 #[serde(skip_serializing_if = "is_false")]
973 enable_object_funds_withdraw: bool,
974
975 #[serde(skip_serializing_if = "is_false")]
977 consensus_skip_gced_blocks_in_direct_finalization: bool,
978
979 #[serde(skip_serializing_if = "is_false")]
981 gas_rounding_halve_digits: bool,
982
983 #[serde(skip_serializing_if = "is_false")]
985 flexible_tx_context_positions: bool,
986
987 #[serde(skip_serializing_if = "is_false")]
989 disable_entry_point_signature_check: bool,
990
991 #[serde(skip_serializing_if = "is_false")]
993 convert_withdrawal_compatibility_ptb_arguments: bool,
994
995 #[serde(skip_serializing_if = "is_false")]
997 restrict_hot_or_not_entry_functions: bool,
998
999 #[serde(skip_serializing_if = "is_false")]
1001 split_checkpoints_in_consensus_handler: bool,
1002
1003 #[serde(skip_serializing_if = "is_false")]
1005 consensus_always_accept_system_transactions: bool,
1006
1007 #[serde(skip_serializing_if = "is_false")]
1009 validator_metadata_verify_v2: bool,
1010
1011 #[serde(skip_serializing_if = "is_false")]
1014 defer_unpaid_amplification: bool,
1015
1016 #[serde(skip_serializing_if = "is_false")]
1017 randomize_checkpoint_tx_limit_in_tests: bool,
1018
1019 #[serde(skip_serializing_if = "is_false")]
1021 gasless_transaction_drop_safety: bool,
1022}
1023
1024fn is_false(b: &bool) -> bool {
1025 !b
1026}
1027
1028fn is_empty(b: &BTreeSet<String>) -> bool {
1029 b.is_empty()
1030}
1031
1032fn is_zero(val: &u64) -> bool {
1033 *val == 0
1034}
1035
1036#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1038pub enum ConsensusTransactionOrdering {
1039 #[default]
1041 None,
1042 ByGasPrice,
1044}
1045
1046impl ConsensusTransactionOrdering {
1047 pub fn is_none(&self) -> bool {
1048 matches!(self, ConsensusTransactionOrdering::None)
1049 }
1050}
1051
1052#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1053pub struct ExecutionTimeEstimateParams {
1054 pub target_utilization: u64,
1056 pub allowed_txn_cost_overage_burst_limit_us: u64,
1060
1061 pub randomness_scalar: u64,
1064
1065 pub max_estimate_us: u64,
1067
1068 pub stored_observations_num_included_checkpoints: u64,
1071
1072 pub stored_observations_limit: u64,
1074
1075 #[serde(skip_serializing_if = "is_zero")]
1078 pub stake_weighted_median_threshold: u64,
1079
1080 #[serde(skip_serializing_if = "is_false")]
1084 pub default_none_duration_for_new_keys: bool,
1085
1086 #[serde(skip_serializing_if = "Option::is_none")]
1088 pub observations_chunk_size: Option<u64>,
1089}
1090
1091#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1093pub enum PerObjectCongestionControlMode {
1094 #[default]
1095 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1101
1102impl PerObjectCongestionControlMode {
1103 pub fn is_none(&self) -> bool {
1104 matches!(self, PerObjectCongestionControlMode::None)
1105 }
1106}
1107
1108#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1110pub enum ConsensusChoice {
1111 #[default]
1112 Narwhal,
1113 SwapEachEpoch,
1114 Mysticeti,
1115}
1116
1117impl ConsensusChoice {
1118 pub fn is_narwhal(&self) -> bool {
1119 matches!(self, ConsensusChoice::Narwhal)
1120 }
1121}
1122
1123#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1125pub enum ConsensusNetwork {
1126 #[default]
1127 Anemo,
1128 Tonic,
1129}
1130
1131impl ConsensusNetwork {
1132 pub fn is_anemo(&self) -> bool {
1133 matches!(self, ConsensusNetwork::Anemo)
1134 }
1135}
1136
1137#[skip_serializing_none]
1169#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1170pub struct ProtocolConfig {
1171 pub version: ProtocolVersion,
1172
1173 feature_flags: FeatureFlags,
1174
1175 max_tx_size_bytes: Option<u64>,
1178
1179 max_input_objects: Option<u64>,
1181
1182 max_size_written_objects: Option<u64>,
1186 max_size_written_objects_system_tx: Option<u64>,
1189
1190 max_serialized_tx_effects_size_bytes: Option<u64>,
1192
1193 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1195
1196 max_gas_payment_objects: Option<u32>,
1198
1199 max_modules_in_publish: Option<u32>,
1201
1202 max_package_dependencies: Option<u32>,
1204
1205 max_arguments: Option<u32>,
1208
1209 max_type_arguments: Option<u32>,
1211
1212 max_type_argument_depth: Option<u32>,
1214
1215 max_pure_argument_size: Option<u32>,
1217
1218 max_programmable_tx_commands: Option<u32>,
1220
1221 move_binary_format_version: Option<u32>,
1224 min_move_binary_format_version: Option<u32>,
1225
1226 binary_module_handles: Option<u16>,
1228 binary_struct_handles: Option<u16>,
1229 binary_function_handles: Option<u16>,
1230 binary_function_instantiations: Option<u16>,
1231 binary_signatures: Option<u16>,
1232 binary_constant_pool: Option<u16>,
1233 binary_identifiers: Option<u16>,
1234 binary_address_identifiers: Option<u16>,
1235 binary_struct_defs: Option<u16>,
1236 binary_struct_def_instantiations: Option<u16>,
1237 binary_function_defs: Option<u16>,
1238 binary_field_handles: Option<u16>,
1239 binary_field_instantiations: Option<u16>,
1240 binary_friend_decls: Option<u16>,
1241 binary_enum_defs: Option<u16>,
1242 binary_enum_def_instantiations: Option<u16>,
1243 binary_variant_handles: Option<u16>,
1244 binary_variant_instantiation_handles: Option<u16>,
1245
1246 max_move_object_size: Option<u64>,
1248
1249 max_move_package_size: Option<u64>,
1252
1253 max_publish_or_upgrade_per_ptb: Option<u64>,
1255
1256 max_tx_gas: Option<u64>,
1258
1259 max_gas_price: Option<u64>,
1261
1262 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1265
1266 max_gas_computation_bucket: Option<u64>,
1268
1269 gas_rounding_step: Option<u64>,
1271
1272 max_loop_depth: Option<u64>,
1274
1275 max_generic_instantiation_length: Option<u64>,
1277
1278 max_function_parameters: Option<u64>,
1280
1281 max_basic_blocks: Option<u64>,
1283
1284 max_value_stack_size: Option<u64>,
1286
1287 max_type_nodes: Option<u64>,
1289
1290 max_push_size: Option<u64>,
1292
1293 max_struct_definitions: Option<u64>,
1295
1296 max_function_definitions: Option<u64>,
1298
1299 max_fields_in_struct: Option<u64>,
1301
1302 max_dependency_depth: Option<u64>,
1304
1305 max_num_event_emit: Option<u64>,
1307
1308 max_num_new_move_object_ids: Option<u64>,
1310
1311 max_num_new_move_object_ids_system_tx: Option<u64>,
1313
1314 max_num_deleted_move_object_ids: Option<u64>,
1316
1317 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1319
1320 max_num_transferred_move_object_ids: Option<u64>,
1322
1323 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1325
1326 max_event_emit_size: Option<u64>,
1328
1329 max_event_emit_size_total: Option<u64>,
1331
1332 max_move_vector_len: Option<u64>,
1334
1335 max_move_identifier_len: Option<u64>,
1337
1338 max_move_value_depth: Option<u64>,
1340
1341 max_move_enum_variants: Option<u64>,
1343
1344 max_back_edges_per_function: Option<u64>,
1346
1347 max_back_edges_per_module: Option<u64>,
1349
1350 max_verifier_meter_ticks_per_function: Option<u64>,
1352
1353 max_meter_ticks_per_module: Option<u64>,
1355
1356 max_meter_ticks_per_package: Option<u64>,
1358
1359 object_runtime_max_num_cached_objects: Option<u64>,
1363
1364 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1366
1367 object_runtime_max_num_store_entries: Option<u64>,
1369
1370 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1372
1373 base_tx_cost_fixed: Option<u64>,
1376
1377 package_publish_cost_fixed: Option<u64>,
1380
1381 base_tx_cost_per_byte: Option<u64>,
1384
1385 package_publish_cost_per_byte: Option<u64>,
1387
1388 obj_access_cost_read_per_byte: Option<u64>,
1390
1391 obj_access_cost_mutate_per_byte: Option<u64>,
1393
1394 obj_access_cost_delete_per_byte: Option<u64>,
1396
1397 obj_access_cost_verify_per_byte: Option<u64>,
1407
1408 max_type_to_layout_nodes: Option<u64>,
1410
1411 max_ptb_value_size: Option<u64>,
1413
1414 gas_model_version: Option<u64>,
1417
1418 obj_data_cost_refundable: Option<u64>,
1421
1422 obj_metadata_cost_non_refundable: Option<u64>,
1426
1427 storage_rebate_rate: Option<u64>,
1433
1434 storage_fund_reinvest_rate: Option<u64>,
1437
1438 reward_slashing_rate: Option<u64>,
1441
1442 storage_gas_price: Option<u64>,
1444
1445 accumulator_object_storage_cost: Option<u64>,
1447
1448 max_transactions_per_checkpoint: Option<u64>,
1453
1454 max_checkpoint_size_bytes: Option<u64>,
1458
1459 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1464
1465 address_from_bytes_cost_base: Option<u64>,
1470 address_to_u256_cost_base: Option<u64>,
1472 address_from_u256_cost_base: Option<u64>,
1474
1475 config_read_setting_impl_cost_base: Option<u64>,
1480 config_read_setting_impl_cost_per_byte: Option<u64>,
1481
1482 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1485 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1486 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1487 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1488 dynamic_field_add_child_object_cost_base: Option<u64>,
1490 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1491 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1492 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1493 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1495 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1496 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1497 dynamic_field_remove_child_object_cost_base: Option<u64>,
1499 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1500 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1501 dynamic_field_has_child_object_cost_base: Option<u64>,
1503 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1505 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1506 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1507
1508 event_emit_cost_base: Option<u64>,
1511 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1512 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1513 event_emit_output_cost_per_byte: Option<u64>,
1514 event_emit_auth_stream_cost: Option<u64>,
1515
1516 object_borrow_uid_cost_base: Option<u64>,
1519 object_delete_impl_cost_base: Option<u64>,
1521 object_record_new_uid_cost_base: Option<u64>,
1523
1524 transfer_transfer_internal_cost_base: Option<u64>,
1527 transfer_party_transfer_internal_cost_base: Option<u64>,
1529 transfer_freeze_object_cost_base: Option<u64>,
1531 transfer_share_object_cost_base: Option<u64>,
1533 transfer_receive_object_cost_base: Option<u64>,
1536
1537 tx_context_derive_id_cost_base: Option<u64>,
1540 tx_context_fresh_id_cost_base: Option<u64>,
1541 tx_context_sender_cost_base: Option<u64>,
1542 tx_context_epoch_cost_base: Option<u64>,
1543 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1544 tx_context_sponsor_cost_base: Option<u64>,
1545 tx_context_rgp_cost_base: Option<u64>,
1546 tx_context_gas_price_cost_base: Option<u64>,
1547 tx_context_gas_budget_cost_base: Option<u64>,
1548 tx_context_ids_created_cost_base: Option<u64>,
1549 tx_context_replace_cost_base: Option<u64>,
1550
1551 types_is_one_time_witness_cost_base: Option<u64>,
1554 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1555 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1556
1557 validator_validate_metadata_cost_base: Option<u64>,
1560 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1561
1562 crypto_invalid_arguments_cost: Option<u64>,
1564 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1566 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1567 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1568
1569 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1571 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1572 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1573
1574 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1576 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1577 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1578 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1579 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1580 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1581
1582 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1584
1585 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1587 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1588 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1589 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1590 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1591 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1592
1593 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1595 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1596 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1597 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1598 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1599 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1600
1601 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1603 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1604 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1605 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1606 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1607 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1608
1609 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1611 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1612 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1613
1614 ed25519_ed25519_verify_cost_base: Option<u64>,
1616 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1617 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1618
1619 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1621 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1622
1623 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1625 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1626 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1627 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1628 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1629
1630 hash_blake2b256_cost_base: Option<u64>,
1632 hash_blake2b256_data_cost_per_byte: Option<u64>,
1633 hash_blake2b256_data_cost_per_block: Option<u64>,
1634
1635 hash_keccak256_cost_base: Option<u64>,
1637 hash_keccak256_data_cost_per_byte: Option<u64>,
1638 hash_keccak256_data_cost_per_block: Option<u64>,
1639
1640 poseidon_bn254_cost_base: Option<u64>,
1642 poseidon_bn254_cost_per_block: Option<u64>,
1643
1644 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1646 group_ops_bls12381_decode_g1_cost: Option<u64>,
1647 group_ops_bls12381_decode_g2_cost: Option<u64>,
1648 group_ops_bls12381_decode_gt_cost: Option<u64>,
1649 group_ops_bls12381_scalar_add_cost: Option<u64>,
1650 group_ops_bls12381_g1_add_cost: Option<u64>,
1651 group_ops_bls12381_g2_add_cost: Option<u64>,
1652 group_ops_bls12381_gt_add_cost: Option<u64>,
1653 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1654 group_ops_bls12381_g1_sub_cost: Option<u64>,
1655 group_ops_bls12381_g2_sub_cost: Option<u64>,
1656 group_ops_bls12381_gt_sub_cost: Option<u64>,
1657 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1658 group_ops_bls12381_g1_mul_cost: Option<u64>,
1659 group_ops_bls12381_g2_mul_cost: Option<u64>,
1660 group_ops_bls12381_gt_mul_cost: Option<u64>,
1661 group_ops_bls12381_scalar_div_cost: Option<u64>,
1662 group_ops_bls12381_g1_div_cost: Option<u64>,
1663 group_ops_bls12381_g2_div_cost: Option<u64>,
1664 group_ops_bls12381_gt_div_cost: Option<u64>,
1665 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1666 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1667 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1668 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1669 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1670 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1671 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1672 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1673 group_ops_bls12381_msm_max_len: Option<u32>,
1674 group_ops_bls12381_pairing_cost: Option<u64>,
1675 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1676 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1677 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1678 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1679 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1680
1681 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1682 group_ops_ristretto_decode_point_cost: Option<u64>,
1683 group_ops_ristretto_scalar_add_cost: Option<u64>,
1684 group_ops_ristretto_point_add_cost: Option<u64>,
1685 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1686 group_ops_ristretto_point_sub_cost: Option<u64>,
1687 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1688 group_ops_ristretto_point_mul_cost: Option<u64>,
1689 group_ops_ristretto_scalar_div_cost: Option<u64>,
1690 group_ops_ristretto_point_div_cost: Option<u64>,
1691
1692 hmac_hmac_sha3_256_cost_base: Option<u64>,
1694 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1695 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1696
1697 check_zklogin_id_cost_base: Option<u64>,
1699 check_zklogin_issuer_cost_base: Option<u64>,
1701
1702 vdf_verify_vdf_cost: Option<u64>,
1703 vdf_hash_to_input_cost: Option<u64>,
1704
1705 nitro_attestation_parse_base_cost: Option<u64>,
1707 nitro_attestation_parse_cost_per_byte: Option<u64>,
1708 nitro_attestation_verify_base_cost: Option<u64>,
1709 nitro_attestation_verify_cost_per_cert: Option<u64>,
1710
1711 bcs_per_byte_serialized_cost: Option<u64>,
1713 bcs_legacy_min_output_size_cost: Option<u64>,
1714 bcs_failure_cost: Option<u64>,
1715
1716 hash_sha2_256_base_cost: Option<u64>,
1717 hash_sha2_256_per_byte_cost: Option<u64>,
1718 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1719 hash_sha3_256_base_cost: Option<u64>,
1720 hash_sha3_256_per_byte_cost: Option<u64>,
1721 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1722 type_name_get_base_cost: Option<u64>,
1723 type_name_get_per_byte_cost: Option<u64>,
1724 type_name_id_base_cost: Option<u64>,
1725
1726 string_check_utf8_base_cost: Option<u64>,
1727 string_check_utf8_per_byte_cost: Option<u64>,
1728 string_is_char_boundary_base_cost: Option<u64>,
1729 string_sub_string_base_cost: Option<u64>,
1730 string_sub_string_per_byte_cost: Option<u64>,
1731 string_index_of_base_cost: Option<u64>,
1732 string_index_of_per_byte_pattern_cost: Option<u64>,
1733 string_index_of_per_byte_searched_cost: Option<u64>,
1734
1735 vector_empty_base_cost: Option<u64>,
1736 vector_length_base_cost: Option<u64>,
1737 vector_push_back_base_cost: Option<u64>,
1738 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1739 vector_borrow_base_cost: Option<u64>,
1740 vector_pop_back_base_cost: Option<u64>,
1741 vector_destroy_empty_base_cost: Option<u64>,
1742 vector_swap_base_cost: Option<u64>,
1743 debug_print_base_cost: Option<u64>,
1744 debug_print_stack_trace_base_cost: Option<u64>,
1745
1746 execution_version: Option<u64>,
1755
1756 consensus_bad_nodes_stake_threshold: Option<u64>,
1760
1761 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1762 max_age_of_jwk_in_epochs: Option<u64>,
1766
1767 random_beacon_reduction_allowed_delta: Option<u16>,
1771
1772 random_beacon_reduction_lower_bound: Option<u32>,
1775
1776 random_beacon_dkg_timeout_round: Option<u32>,
1779
1780 random_beacon_min_round_interval_ms: Option<u64>,
1782
1783 random_beacon_dkg_version: Option<u64>,
1786
1787 consensus_max_transaction_size_bytes: Option<u64>,
1790 consensus_max_transactions_in_block_bytes: Option<u64>,
1792 consensus_max_num_transactions_in_block: Option<u64>,
1794
1795 consensus_voting_rounds: Option<u32>,
1797
1798 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1800
1801 max_deferral_rounds_for_congestion_control: Option<u64>,
1804
1805 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1807
1808 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1810
1811 min_checkpoint_interval_ms: Option<u64>,
1813
1814 checkpoint_summary_version_specific_data: Option<u64>,
1816
1817 max_soft_bundle_size: Option<u64>,
1819
1820 bridge_should_try_to_finalize_committee: Option<bool>,
1824
1825 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1831
1832 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1835
1836 consensus_gc_depth: Option<u32>,
1839
1840 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1842
1843 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1845
1846 sip_45_consensus_amplification_threshold: Option<u64>,
1849
1850 use_object_per_epoch_marker_table_v2: Option<bool>,
1853
1854 consensus_commit_rate_estimation_window_size: Option<u32>,
1856
1857 #[serde(skip_serializing_if = "Vec::is_empty")]
1861 aliased_addresses: Vec<AliasedAddress>,
1862
1863 translation_per_command_base_charge: Option<u64>,
1866
1867 translation_per_input_base_charge: Option<u64>,
1870
1871 translation_pure_input_per_byte_charge: Option<u64>,
1873
1874 translation_per_type_node_charge: Option<u64>,
1878
1879 translation_per_reference_node_charge: Option<u64>,
1882
1883 translation_per_linkage_entry_charge: Option<u64>,
1886
1887 max_updates_per_settlement_txn: Option<u32>,
1889}
1890
1891#[derive(Clone, Serialize, Deserialize, Debug)]
1893pub struct AliasedAddress {
1894 pub original: [u8; 32],
1896 pub aliased: [u8; 32],
1898 pub allowed_tx_digests: Vec<[u8; 32]>,
1900}
1901
1902impl ProtocolConfig {
1904 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1917 if self.feature_flags.package_upgrades {
1918 Ok(())
1919 } else {
1920 Err(Error(format!(
1921 "package upgrades are not supported at {:?}",
1922 self.version
1923 )))
1924 }
1925 }
1926
1927 pub fn allow_receiving_object_id(&self) -> bool {
1928 self.feature_flags.allow_receiving_object_id
1929 }
1930
1931 pub fn receiving_objects_supported(&self) -> bool {
1932 self.feature_flags.receive_objects
1933 }
1934
1935 pub fn package_upgrades_supported(&self) -> bool {
1936 self.feature_flags.package_upgrades
1937 }
1938
1939 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1940 self.feature_flags.commit_root_state_digest
1941 }
1942
1943 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1944 self.feature_flags.advance_epoch_start_time_in_safe_mode
1945 }
1946
1947 pub fn loaded_child_objects_fixed(&self) -> bool {
1948 self.feature_flags.loaded_child_objects_fixed
1949 }
1950
1951 pub fn missing_type_is_compatibility_error(&self) -> bool {
1952 self.feature_flags.missing_type_is_compatibility_error
1953 }
1954
1955 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1956 self.feature_flags.scoring_decision_with_validity_cutoff
1957 }
1958
1959 pub fn narwhal_versioned_metadata(&self) -> bool {
1960 self.feature_flags.narwhal_versioned_metadata
1961 }
1962
1963 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1964 self.feature_flags.consensus_order_end_of_epoch_last
1965 }
1966
1967 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1968 self.feature_flags.disallow_adding_abilities_on_upgrade
1969 }
1970
1971 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1972 self.feature_flags
1973 .disable_invariant_violation_check_in_swap_loc
1974 }
1975
1976 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1977 self.feature_flags
1978 .advance_to_highest_supported_protocol_version
1979 }
1980
1981 pub fn ban_entry_init(&self) -> bool {
1982 self.feature_flags.ban_entry_init
1983 }
1984
1985 pub fn package_digest_hash_module(&self) -> bool {
1986 self.feature_flags.package_digest_hash_module
1987 }
1988
1989 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1990 self.feature_flags
1991 .disallow_change_struct_type_params_on_upgrade
1992 }
1993
1994 pub fn no_extraneous_module_bytes(&self) -> bool {
1995 self.feature_flags.no_extraneous_module_bytes
1996 }
1997
1998 pub fn zklogin_auth(&self) -> bool {
1999 self.feature_flags.zklogin_auth
2000 }
2001
2002 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2003 &self.feature_flags.zklogin_supported_providers
2004 }
2005
2006 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2007 self.feature_flags.consensus_transaction_ordering
2008 }
2009
2010 pub fn simplified_unwrap_then_delete(&self) -> bool {
2011 self.feature_flags.simplified_unwrap_then_delete
2012 }
2013
2014 pub fn supports_upgraded_multisig(&self) -> bool {
2015 self.feature_flags.upgraded_multisig_supported
2016 }
2017
2018 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2019 self.feature_flags.txn_base_cost_as_multiplier
2020 }
2021
2022 pub fn shared_object_deletion(&self) -> bool {
2023 self.feature_flags.shared_object_deletion
2024 }
2025
2026 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2027 self.feature_flags.narwhal_new_leader_election_schedule
2028 }
2029
2030 pub fn loaded_child_object_format(&self) -> bool {
2031 self.feature_flags.loaded_child_object_format
2032 }
2033
2034 pub fn enable_jwk_consensus_updates(&self) -> bool {
2035 let ret = self.feature_flags.enable_jwk_consensus_updates;
2036 if ret {
2037 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2039 }
2040 ret
2041 }
2042
2043 pub fn simple_conservation_checks(&self) -> bool {
2044 self.feature_flags.simple_conservation_checks
2045 }
2046
2047 pub fn loaded_child_object_format_type(&self) -> bool {
2048 self.feature_flags.loaded_child_object_format_type
2049 }
2050
2051 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2052 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2053 if !ret {
2054 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2056 }
2057 ret
2058 }
2059
2060 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2061 self.feature_flags
2062 .recompute_has_public_transfer_in_execution
2063 }
2064
2065 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2067 self.enable_jwk_consensus_updates()
2068 }
2069
2070 pub fn random_beacon(&self) -> bool {
2071 self.feature_flags.random_beacon
2072 }
2073
2074 pub fn dkg_version(&self) -> u64 {
2075 self.random_beacon_dkg_version.unwrap_or(1)
2077 }
2078
2079 pub fn enable_bridge(&self) -> bool {
2080 let ret = self.feature_flags.bridge;
2081 if ret {
2082 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2084 }
2085 ret
2086 }
2087
2088 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2089 if !self.enable_bridge() {
2090 return false;
2091 }
2092 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2094 }
2095
2096 pub fn enable_effects_v2(&self) -> bool {
2097 self.feature_flags.enable_effects_v2
2098 }
2099
2100 pub fn narwhal_certificate_v2(&self) -> bool {
2101 self.feature_flags.narwhal_certificate_v2
2102 }
2103
2104 pub fn verify_legacy_zklogin_address(&self) -> bool {
2105 self.feature_flags.verify_legacy_zklogin_address
2106 }
2107
2108 pub fn accept_zklogin_in_multisig(&self) -> bool {
2109 self.feature_flags.accept_zklogin_in_multisig
2110 }
2111
2112 pub fn accept_passkey_in_multisig(&self) -> bool {
2113 self.feature_flags.accept_passkey_in_multisig
2114 }
2115
2116 pub fn validate_zklogin_public_identifier(&self) -> bool {
2117 self.feature_flags.validate_zklogin_public_identifier
2118 }
2119
2120 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2121 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2122 }
2123
2124 pub fn throughput_aware_consensus_submission(&self) -> bool {
2125 self.feature_flags.throughput_aware_consensus_submission
2126 }
2127
2128 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2129 self.feature_flags.include_consensus_digest_in_prologue
2130 }
2131
2132 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2133 self.feature_flags
2134 .record_consensus_determined_version_assignments_in_prologue
2135 }
2136
2137 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2138 self.feature_flags
2139 .record_additional_state_digest_in_prologue
2140 }
2141
2142 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2143 self.feature_flags
2144 .record_consensus_determined_version_assignments_in_prologue_v2
2145 }
2146
2147 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2148 self.feature_flags
2149 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2150 }
2151
2152 pub fn hardened_otw_check(&self) -> bool {
2153 self.feature_flags.hardened_otw_check
2154 }
2155
2156 pub fn enable_poseidon(&self) -> bool {
2157 self.feature_flags.enable_poseidon
2158 }
2159
2160 pub fn enable_coin_deny_list_v1(&self) -> bool {
2161 self.feature_flags.enable_coin_deny_list
2162 }
2163
2164 pub fn enable_accumulators(&self) -> bool {
2165 self.feature_flags.enable_accumulators
2166 }
2167
2168 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2169 self.feature_flags.enable_coin_reservation_obj_refs
2170 }
2171
2172 pub fn create_root_accumulator_object(&self) -> bool {
2173 self.feature_flags.create_root_accumulator_object
2174 }
2175
2176 pub fn enable_address_balance_gas_payments(&self) -> bool {
2177 self.feature_flags.enable_address_balance_gas_payments
2178 }
2179
2180 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2181 self.feature_flags.address_balance_gas_check_rgp_at_signing
2182 }
2183
2184 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2185 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2186 }
2187
2188 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2189 self.feature_flags.enable_multi_epoch_transaction_expiration
2190 }
2191
2192 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2193 self.feature_flags.relax_valid_during_for_owned_inputs
2194 }
2195
2196 pub fn enable_authenticated_event_streams(&self) -> bool {
2197 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2198 }
2199
2200 pub fn enable_non_exclusive_writes(&self) -> bool {
2201 self.feature_flags.enable_non_exclusive_writes
2202 }
2203
2204 pub fn enable_coin_registry(&self) -> bool {
2205 self.feature_flags.enable_coin_registry
2206 }
2207
2208 pub fn enable_display_registry(&self) -> bool {
2209 self.feature_flags.enable_display_registry
2210 }
2211
2212 pub fn enable_coin_deny_list_v2(&self) -> bool {
2213 self.feature_flags.enable_coin_deny_list_v2
2214 }
2215
2216 pub fn enable_group_ops_native_functions(&self) -> bool {
2217 self.feature_flags.enable_group_ops_native_functions
2218 }
2219
2220 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2221 self.feature_flags.enable_group_ops_native_function_msm
2222 }
2223
2224 pub fn enable_ristretto255_group_ops(&self) -> bool {
2225 self.feature_flags.enable_ristretto255_group_ops
2226 }
2227
2228 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2229 self.feature_flags.reject_mutable_random_on_entry_functions
2230 }
2231
2232 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2233 self.feature_flags.per_object_congestion_control_mode
2234 }
2235
2236 pub fn consensus_choice(&self) -> ConsensusChoice {
2237 self.feature_flags.consensus_choice
2238 }
2239
2240 pub fn consensus_network(&self) -> ConsensusNetwork {
2241 self.feature_flags.consensus_network
2242 }
2243
2244 pub fn correct_gas_payment_limit_check(&self) -> bool {
2245 self.feature_flags.correct_gas_payment_limit_check
2246 }
2247
2248 pub fn reshare_at_same_initial_version(&self) -> bool {
2249 self.feature_flags.reshare_at_same_initial_version
2250 }
2251
2252 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2253 self.feature_flags.resolve_abort_locations_to_package_id
2254 }
2255
2256 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2257 self.feature_flags.mysticeti_use_committed_subdag_digest
2258 }
2259
2260 pub fn enable_vdf(&self) -> bool {
2261 self.feature_flags.enable_vdf
2262 }
2263
2264 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2265 self.feature_flags.fresh_vm_on_framework_upgrade
2266 }
2267
2268 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2269 self.feature_flags.mysticeti_num_leaders_per_round
2270 }
2271
2272 pub fn soft_bundle(&self) -> bool {
2273 self.feature_flags.soft_bundle
2274 }
2275
2276 pub fn passkey_auth(&self) -> bool {
2277 self.feature_flags.passkey_auth
2278 }
2279
2280 pub fn authority_capabilities_v2(&self) -> bool {
2281 self.feature_flags.authority_capabilities_v2
2282 }
2283
2284 pub fn max_transaction_size_bytes(&self) -> u64 {
2285 self.consensus_max_transaction_size_bytes
2287 .unwrap_or(256 * 1024)
2288 }
2289
2290 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2291 if cfg!(msim) {
2292 256 * 1024
2293 } else {
2294 self.consensus_max_transactions_in_block_bytes
2295 .unwrap_or(512 * 1024)
2296 }
2297 }
2298
2299 pub fn max_num_transactions_in_block(&self) -> u64 {
2300 if cfg!(msim) {
2301 8
2302 } else {
2303 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2304 }
2305 }
2306
2307 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2308 self.feature_flags.rethrow_serialization_type_layout_errors
2309 }
2310
2311 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2312 self.feature_flags
2313 .consensus_distributed_vote_scoring_strategy
2314 }
2315
2316 pub fn consensus_round_prober(&self) -> bool {
2317 self.feature_flags.consensus_round_prober
2318 }
2319
2320 pub fn validate_identifier_inputs(&self) -> bool {
2321 self.feature_flags.validate_identifier_inputs
2322 }
2323
2324 pub fn gc_depth(&self) -> u32 {
2325 self.consensus_gc_depth.unwrap_or(0)
2326 }
2327
2328 pub fn mysticeti_fastpath(&self) -> bool {
2329 self.feature_flags.mysticeti_fastpath
2330 }
2331
2332 pub fn relocate_event_module(&self) -> bool {
2333 self.feature_flags.relocate_event_module
2334 }
2335
2336 pub fn uncompressed_g1_group_elements(&self) -> bool {
2337 self.feature_flags.uncompressed_g1_group_elements
2338 }
2339
2340 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2341 self.feature_flags
2342 .disallow_new_modules_in_deps_only_packages
2343 }
2344
2345 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2346 self.feature_flags.consensus_smart_ancestor_selection
2347 }
2348
2349 pub fn disable_preconsensus_locking(&self) -> bool {
2350 self.feature_flags.disable_preconsensus_locking
2351 }
2352
2353 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2354 self.feature_flags
2355 .consensus_round_prober_probe_accepted_rounds
2356 }
2357
2358 pub fn native_charging_v2(&self) -> bool {
2359 self.feature_flags.native_charging_v2
2360 }
2361
2362 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2363 let res = self.feature_flags.consensus_linearize_subdag_v2;
2364 assert!(
2365 !res || self.gc_depth() > 0,
2366 "The consensus linearize sub dag V2 requires GC to be enabled"
2367 );
2368 res
2369 }
2370
2371 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2372 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2373 assert!(
2374 !res || self.gc_depth() > 0,
2375 "The consensus median based commit timestamp requires GC to be enabled"
2376 );
2377 res
2378 }
2379
2380 pub fn consensus_batched_block_sync(&self) -> bool {
2381 self.feature_flags.consensus_batched_block_sync
2382 }
2383
2384 pub fn convert_type_argument_error(&self) -> bool {
2385 self.feature_flags.convert_type_argument_error
2386 }
2387
2388 pub fn variant_nodes(&self) -> bool {
2389 self.feature_flags.variant_nodes
2390 }
2391
2392 pub fn consensus_zstd_compression(&self) -> bool {
2393 self.feature_flags.consensus_zstd_compression
2394 }
2395
2396 pub fn enable_nitro_attestation(&self) -> bool {
2397 self.feature_flags.enable_nitro_attestation
2398 }
2399
2400 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2401 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2402 }
2403
2404 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2405 self.feature_flags
2406 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2407 }
2408
2409 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2410 self.feature_flags
2411 .enable_nitro_attestation_always_include_required_pcrs_parsing
2412 }
2413
2414 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2415 self.consensus_commit_rate_estimation_window_size
2416 .unwrap_or(0)
2417 }
2418
2419 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2420 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2424 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2426 window_size
2427 }
2428
2429 pub fn minimize_child_object_mutations(&self) -> bool {
2430 self.feature_flags.minimize_child_object_mutations
2431 }
2432
2433 pub fn move_native_context(&self) -> bool {
2434 self.feature_flags.move_native_context
2435 }
2436
2437 pub fn normalize_ptb_arguments(&self) -> bool {
2438 self.feature_flags.normalize_ptb_arguments
2439 }
2440
2441 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2442 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2443 }
2444
2445 pub fn max_ptb_value_size_v2(&self) -> bool {
2446 self.feature_flags.max_ptb_value_size_v2
2447 }
2448
2449 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2450 self.feature_flags.resolve_type_input_ids_to_defining_id
2451 }
2452
2453 pub fn enable_party_transfer(&self) -> bool {
2454 self.feature_flags.enable_party_transfer
2455 }
2456
2457 pub fn allow_unbounded_system_objects(&self) -> bool {
2458 self.feature_flags.allow_unbounded_system_objects
2459 }
2460
2461 pub fn type_tags_in_object_runtime(&self) -> bool {
2462 self.feature_flags.type_tags_in_object_runtime
2463 }
2464
2465 pub fn enable_ptb_execution_v2(&self) -> bool {
2466 self.feature_flags.enable_ptb_execution_v2
2467 }
2468
2469 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2470 self.feature_flags.better_adapter_type_resolution_errors
2471 }
2472
2473 pub fn record_time_estimate_processed(&self) -> bool {
2474 self.feature_flags.record_time_estimate_processed
2475 }
2476
2477 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2478 self.feature_flags
2479 .ignore_execution_time_observations_after_certs_closed
2480 }
2481
2482 pub fn dependency_linkage_error(&self) -> bool {
2483 self.feature_flags.dependency_linkage_error
2484 }
2485
2486 pub fn additional_multisig_checks(&self) -> bool {
2487 self.feature_flags.additional_multisig_checks
2488 }
2489
2490 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2491 self.feature_flags.debug_fatal_on_move_invariant_violation
2492 }
2493
2494 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2495 self.feature_flags.allow_private_accumulator_entrypoints
2496 }
2497
2498 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2499 self.feature_flags
2500 .additional_consensus_digest_indirect_state
2501 }
2502
2503 pub fn check_for_init_during_upgrade(&self) -> bool {
2504 self.feature_flags.check_for_init_during_upgrade
2505 }
2506
2507 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2508 self.feature_flags.per_command_shared_object_transfer_rules
2509 }
2510
2511 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2512 self.feature_flags
2513 .consensus_checkpoint_signature_key_includes_digest
2514 }
2515
2516 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2517 self.feature_flags
2518 .include_checkpoint_artifacts_digest_in_summary
2519 }
2520
2521 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2522 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2523 }
2524
2525 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2526 self.feature_flags.cancel_for_failed_dkg_early
2527 }
2528
2529 pub fn abstract_size_in_object_runtime(&self) -> bool {
2530 self.feature_flags.abstract_size_in_object_runtime
2531 }
2532
2533 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2534 self.feature_flags.object_runtime_charge_cache_load_gas
2535 }
2536
2537 pub fn additional_borrow_checks(&self) -> bool {
2538 self.feature_flags.additional_borrow_checks
2539 }
2540
2541 pub fn use_new_commit_handler(&self) -> bool {
2542 self.feature_flags.use_new_commit_handler
2543 }
2544
2545 pub fn better_loader_errors(&self) -> bool {
2546 self.feature_flags.better_loader_errors
2547 }
2548
2549 pub fn generate_df_type_layouts(&self) -> bool {
2550 self.feature_flags.generate_df_type_layouts
2551 }
2552
2553 pub fn allow_references_in_ptbs(&self) -> bool {
2554 self.feature_flags.allow_references_in_ptbs
2555 }
2556
2557 pub fn private_generics_verifier_v2(&self) -> bool {
2558 self.feature_flags.private_generics_verifier_v2
2559 }
2560
2561 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2562 self.feature_flags
2563 .deprecate_global_storage_ops_during_deserialization
2564 }
2565
2566 pub fn enable_observation_chunking(&self) -> bool {
2567 matches!(self.feature_flags.per_object_congestion_control_mode,
2568 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2569 if params.observations_chunk_size.is_some()
2570 )
2571 }
2572
2573 pub fn deprecate_global_storage_ops(&self) -> bool {
2574 self.feature_flags.deprecate_global_storage_ops
2575 }
2576
2577 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2578 self.feature_flags.consensus_skip_gced_accept_votes
2579 }
2580
2581 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2582 self.feature_flags
2583 .include_cancelled_randomness_txns_in_prologue
2584 }
2585
2586 pub fn address_aliases(&self) -> bool {
2587 let address_aliases = self.feature_flags.address_aliases;
2588 assert!(
2589 !address_aliases || self.mysticeti_fastpath(),
2590 "Address aliases requires Mysticeti fastpath to be enabled"
2591 );
2592 if address_aliases {
2593 assert!(
2594 self.feature_flags.disable_preconsensus_locking,
2595 "Address aliases requires CertifiedTransaction to be disabled"
2596 );
2597 }
2598 address_aliases
2599 }
2600
2601 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2602 self.feature_flags.fix_checkpoint_signature_mapping
2603 }
2604
2605 pub fn enable_object_funds_withdraw(&self) -> bool {
2606 self.feature_flags.enable_object_funds_withdraw
2607 }
2608
2609 pub fn gas_rounding_halve_digits(&self) -> bool {
2610 self.feature_flags.gas_rounding_halve_digits
2611 }
2612
2613 pub fn flexible_tx_context_positions(&self) -> bool {
2614 self.feature_flags.flexible_tx_context_positions
2615 }
2616
2617 pub fn disable_entry_point_signature_check(&self) -> bool {
2618 self.feature_flags.disable_entry_point_signature_check
2619 }
2620
2621 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2622 self.feature_flags
2623 .consensus_skip_gced_blocks_in_direct_finalization
2624 }
2625
2626 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2627 self.feature_flags
2628 .convert_withdrawal_compatibility_ptb_arguments
2629 }
2630
2631 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2632 self.feature_flags.restrict_hot_or_not_entry_functions
2633 }
2634
2635 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2636 self.feature_flags.split_checkpoints_in_consensus_handler
2637 }
2638
2639 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2640 self.feature_flags
2641 .consensus_always_accept_system_transactions
2642 }
2643
2644 pub fn validator_metadata_verify_v2(&self) -> bool {
2645 self.feature_flags.validator_metadata_verify_v2
2646 }
2647
2648 pub fn defer_unpaid_amplification(&self) -> bool {
2649 self.feature_flags.defer_unpaid_amplification
2650 }
2651
2652 pub fn gasless_transaction_drop_safety(&self) -> bool {
2653 self.feature_flags.gasless_transaction_drop_safety
2654 }
2655}
2656
2657#[cfg(not(msim))]
2658static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2659
2660#[cfg(msim)]
2662thread_local! {
2663 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2664}
2665
2666impl ProtocolConfig {
2668 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2670 assert!(
2672 version >= ProtocolVersion::MIN,
2673 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2674 version,
2675 ProtocolVersion::MIN.0,
2676 );
2677 assert!(
2678 version <= ProtocolVersion::MAX_ALLOWED,
2679 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2680 version,
2681 ProtocolVersion::MAX_ALLOWED.0,
2682 );
2683
2684 let mut ret = Self::get_for_version_impl(version, chain);
2685 ret.version = version;
2686
2687 ret = CONFIG_OVERRIDE.with(|ovr| {
2688 if let Some(override_fn) = &*ovr.borrow() {
2689 warn!(
2690 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2691 );
2692 override_fn(version, ret)
2693 } else {
2694 ret
2695 }
2696 });
2697
2698 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2699 warn!(
2700 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2701 );
2702 let overrides: ProtocolConfigOptional =
2703 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2704 .expect("failed to parse ProtocolConfig override env variables");
2705 overrides.apply_to(&mut ret);
2706 }
2707
2708 ret
2709 }
2710
2711 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2714 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2715 let mut ret = Self::get_for_version_impl(version, chain);
2716 ret.version = version;
2717 Some(ret)
2718 } else {
2719 None
2720 }
2721 }
2722
2723 #[cfg(not(msim))]
2724 pub fn poison_get_for_min_version() {
2725 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2726 }
2727
2728 #[cfg(not(msim))]
2729 fn load_poison_get_for_min_version() -> bool {
2730 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2731 }
2732
2733 #[cfg(msim)]
2734 pub fn poison_get_for_min_version() {
2735 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2736 }
2737
2738 #[cfg(msim)]
2739 fn load_poison_get_for_min_version() -> bool {
2740 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2741 }
2742
2743 pub fn get_for_min_version() -> Self {
2746 if Self::load_poison_get_for_min_version() {
2747 panic!("get_for_min_version called on validator");
2748 }
2749 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2750 }
2751
2752 #[allow(non_snake_case)]
2762 pub fn get_for_max_version_UNSAFE() -> Self {
2763 if Self::load_poison_get_for_min_version() {
2764 panic!("get_for_max_version_UNSAFE called on validator");
2765 }
2766 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2767 }
2768
2769 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2770 #[cfg(msim)]
2771 {
2772 if version == ProtocolVersion::MAX_ALLOWED {
2774 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2775 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2776 return config;
2777 }
2778 }
2779
2780 let mut cfg = Self {
2783 version,
2785
2786 feature_flags: Default::default(),
2788
2789 max_tx_size_bytes: Some(128 * 1024),
2790 max_input_objects: Some(2048),
2792 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2793 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2794 max_gas_payment_objects: Some(256),
2795 max_modules_in_publish: Some(128),
2796 max_package_dependencies: None,
2797 max_arguments: Some(512),
2798 max_type_arguments: Some(16),
2799 max_type_argument_depth: Some(16),
2800 max_pure_argument_size: Some(16 * 1024),
2801 max_programmable_tx_commands: Some(1024),
2802 move_binary_format_version: Some(6),
2803 min_move_binary_format_version: None,
2804 binary_module_handles: None,
2805 binary_struct_handles: None,
2806 binary_function_handles: None,
2807 binary_function_instantiations: None,
2808 binary_signatures: None,
2809 binary_constant_pool: None,
2810 binary_identifiers: None,
2811 binary_address_identifiers: None,
2812 binary_struct_defs: None,
2813 binary_struct_def_instantiations: None,
2814 binary_function_defs: None,
2815 binary_field_handles: None,
2816 binary_field_instantiations: None,
2817 binary_friend_decls: None,
2818 binary_enum_defs: None,
2819 binary_enum_def_instantiations: None,
2820 binary_variant_handles: None,
2821 binary_variant_instantiation_handles: None,
2822 max_move_object_size: Some(250 * 1024),
2823 max_move_package_size: Some(100 * 1024),
2824 max_publish_or_upgrade_per_ptb: None,
2825 max_tx_gas: Some(10_000_000_000),
2826 max_gas_price: Some(100_000),
2827 max_gas_price_rgp_factor_for_aborted_transactions: None,
2828 max_gas_computation_bucket: Some(5_000_000),
2829 max_loop_depth: Some(5),
2830 max_generic_instantiation_length: Some(32),
2831 max_function_parameters: Some(128),
2832 max_basic_blocks: Some(1024),
2833 max_value_stack_size: Some(1024),
2834 max_type_nodes: Some(256),
2835 max_push_size: Some(10000),
2836 max_struct_definitions: Some(200),
2837 max_function_definitions: Some(1000),
2838 max_fields_in_struct: Some(32),
2839 max_dependency_depth: Some(100),
2840 max_num_event_emit: Some(256),
2841 max_num_new_move_object_ids: Some(2048),
2842 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2843 max_num_deleted_move_object_ids: Some(2048),
2844 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2845 max_num_transferred_move_object_ids: Some(2048),
2846 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2847 max_event_emit_size: Some(250 * 1024),
2848 max_move_vector_len: Some(256 * 1024),
2849 max_type_to_layout_nodes: None,
2850 max_ptb_value_size: None,
2851
2852 max_back_edges_per_function: Some(10_000),
2853 max_back_edges_per_module: Some(10_000),
2854 max_verifier_meter_ticks_per_function: Some(6_000_000),
2855 max_meter_ticks_per_module: Some(6_000_000),
2856 max_meter_ticks_per_package: None,
2857
2858 object_runtime_max_num_cached_objects: Some(1000),
2859 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2860 object_runtime_max_num_store_entries: Some(1000),
2861 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2862 base_tx_cost_fixed: Some(110_000),
2863 package_publish_cost_fixed: Some(1_000),
2864 base_tx_cost_per_byte: Some(0),
2865 package_publish_cost_per_byte: Some(80),
2866 obj_access_cost_read_per_byte: Some(15),
2867 obj_access_cost_mutate_per_byte: Some(40),
2868 obj_access_cost_delete_per_byte: Some(40),
2869 obj_access_cost_verify_per_byte: Some(200),
2870 obj_data_cost_refundable: Some(100),
2871 obj_metadata_cost_non_refundable: Some(50),
2872 gas_model_version: Some(1),
2873 storage_rebate_rate: Some(9900),
2874 storage_fund_reinvest_rate: Some(500),
2875 reward_slashing_rate: Some(5000),
2876 storage_gas_price: Some(1),
2877 accumulator_object_storage_cost: None,
2878 max_transactions_per_checkpoint: Some(10_000),
2879 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2880
2881 buffer_stake_for_protocol_upgrade_bps: Some(0),
2884
2885 address_from_bytes_cost_base: Some(52),
2889 address_to_u256_cost_base: Some(52),
2891 address_from_u256_cost_base: Some(52),
2893
2894 config_read_setting_impl_cost_base: None,
2897 config_read_setting_impl_cost_per_byte: None,
2898
2899 dynamic_field_hash_type_and_key_cost_base: Some(100),
2902 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2903 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2904 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2905 dynamic_field_add_child_object_cost_base: Some(100),
2907 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2908 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2909 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2910 dynamic_field_borrow_child_object_cost_base: Some(100),
2912 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2913 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2914 dynamic_field_remove_child_object_cost_base: Some(100),
2916 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2917 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2918 dynamic_field_has_child_object_cost_base: Some(100),
2920 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2922 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2923 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2924
2925 event_emit_cost_base: Some(52),
2928 event_emit_value_size_derivation_cost_per_byte: Some(2),
2929 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2930 event_emit_output_cost_per_byte: Some(10),
2931 event_emit_auth_stream_cost: None,
2932
2933 object_borrow_uid_cost_base: Some(52),
2936 object_delete_impl_cost_base: Some(52),
2938 object_record_new_uid_cost_base: Some(52),
2940
2941 transfer_transfer_internal_cost_base: Some(52),
2944 transfer_party_transfer_internal_cost_base: None,
2946 transfer_freeze_object_cost_base: Some(52),
2948 transfer_share_object_cost_base: Some(52),
2950 transfer_receive_object_cost_base: None,
2951
2952 tx_context_derive_id_cost_base: Some(52),
2955 tx_context_fresh_id_cost_base: None,
2956 tx_context_sender_cost_base: None,
2957 tx_context_epoch_cost_base: None,
2958 tx_context_epoch_timestamp_ms_cost_base: None,
2959 tx_context_sponsor_cost_base: None,
2960 tx_context_rgp_cost_base: None,
2961 tx_context_gas_price_cost_base: None,
2962 tx_context_gas_budget_cost_base: None,
2963 tx_context_ids_created_cost_base: None,
2964 tx_context_replace_cost_base: None,
2965
2966 types_is_one_time_witness_cost_base: Some(52),
2969 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2970 types_is_one_time_witness_type_cost_per_byte: Some(2),
2971
2972 validator_validate_metadata_cost_base: Some(52),
2975 validator_validate_metadata_data_cost_per_byte: Some(2),
2976
2977 crypto_invalid_arguments_cost: Some(100),
2979 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2981 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2982 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2983
2984 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2986 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2987 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2988
2989 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2991 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2992 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2993 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2994 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2995 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2996
2997 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2999
3000 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3002 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3003 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3004 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3005 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3006 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3007
3008 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3010 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3011 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3012 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3013 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3014 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3015
3016 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3018 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3019 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3020 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3021 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3022 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3023
3024 ecvrf_ecvrf_verify_cost_base: Some(52),
3026 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3027 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3028
3029 ed25519_ed25519_verify_cost_base: Some(52),
3031 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3032 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3033
3034 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3036 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3037
3038 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3040 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3041 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3042 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3043 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3044
3045 hash_blake2b256_cost_base: Some(52),
3047 hash_blake2b256_data_cost_per_byte: Some(2),
3048 hash_blake2b256_data_cost_per_block: Some(2),
3049
3050 hash_keccak256_cost_base: Some(52),
3052 hash_keccak256_data_cost_per_byte: Some(2),
3053 hash_keccak256_data_cost_per_block: Some(2),
3054
3055 poseidon_bn254_cost_base: None,
3056 poseidon_bn254_cost_per_block: None,
3057
3058 hmac_hmac_sha3_256_cost_base: Some(52),
3060 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3061 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3062
3063 group_ops_bls12381_decode_scalar_cost: None,
3065 group_ops_bls12381_decode_g1_cost: None,
3066 group_ops_bls12381_decode_g2_cost: None,
3067 group_ops_bls12381_decode_gt_cost: None,
3068 group_ops_bls12381_scalar_add_cost: None,
3069 group_ops_bls12381_g1_add_cost: None,
3070 group_ops_bls12381_g2_add_cost: None,
3071 group_ops_bls12381_gt_add_cost: None,
3072 group_ops_bls12381_scalar_sub_cost: None,
3073 group_ops_bls12381_g1_sub_cost: None,
3074 group_ops_bls12381_g2_sub_cost: None,
3075 group_ops_bls12381_gt_sub_cost: None,
3076 group_ops_bls12381_scalar_mul_cost: None,
3077 group_ops_bls12381_g1_mul_cost: None,
3078 group_ops_bls12381_g2_mul_cost: None,
3079 group_ops_bls12381_gt_mul_cost: None,
3080 group_ops_bls12381_scalar_div_cost: None,
3081 group_ops_bls12381_g1_div_cost: None,
3082 group_ops_bls12381_g2_div_cost: None,
3083 group_ops_bls12381_gt_div_cost: None,
3084 group_ops_bls12381_g1_hash_to_base_cost: None,
3085 group_ops_bls12381_g2_hash_to_base_cost: None,
3086 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3087 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3088 group_ops_bls12381_g1_msm_base_cost: None,
3089 group_ops_bls12381_g2_msm_base_cost: None,
3090 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3091 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3092 group_ops_bls12381_msm_max_len: None,
3093 group_ops_bls12381_pairing_cost: None,
3094 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3095 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3096 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3097 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3098 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3099
3100 group_ops_ristretto_decode_scalar_cost: None,
3101 group_ops_ristretto_decode_point_cost: None,
3102 group_ops_ristretto_scalar_add_cost: None,
3103 group_ops_ristretto_point_add_cost: None,
3104 group_ops_ristretto_scalar_sub_cost: None,
3105 group_ops_ristretto_point_sub_cost: None,
3106 group_ops_ristretto_scalar_mul_cost: None,
3107 group_ops_ristretto_point_mul_cost: None,
3108 group_ops_ristretto_scalar_div_cost: None,
3109 group_ops_ristretto_point_div_cost: None,
3110
3111 check_zklogin_id_cost_base: None,
3113 check_zklogin_issuer_cost_base: None,
3115
3116 vdf_verify_vdf_cost: None,
3117 vdf_hash_to_input_cost: None,
3118
3119 nitro_attestation_parse_base_cost: None,
3121 nitro_attestation_parse_cost_per_byte: None,
3122 nitro_attestation_verify_base_cost: None,
3123 nitro_attestation_verify_cost_per_cert: None,
3124
3125 bcs_per_byte_serialized_cost: None,
3126 bcs_legacy_min_output_size_cost: None,
3127 bcs_failure_cost: None,
3128 hash_sha2_256_base_cost: None,
3129 hash_sha2_256_per_byte_cost: None,
3130 hash_sha2_256_legacy_min_input_len_cost: None,
3131 hash_sha3_256_base_cost: None,
3132 hash_sha3_256_per_byte_cost: None,
3133 hash_sha3_256_legacy_min_input_len_cost: None,
3134 type_name_get_base_cost: None,
3135 type_name_get_per_byte_cost: None,
3136 type_name_id_base_cost: None,
3137 string_check_utf8_base_cost: None,
3138 string_check_utf8_per_byte_cost: None,
3139 string_is_char_boundary_base_cost: None,
3140 string_sub_string_base_cost: None,
3141 string_sub_string_per_byte_cost: None,
3142 string_index_of_base_cost: None,
3143 string_index_of_per_byte_pattern_cost: None,
3144 string_index_of_per_byte_searched_cost: None,
3145 vector_empty_base_cost: None,
3146 vector_length_base_cost: None,
3147 vector_push_back_base_cost: None,
3148 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3149 vector_borrow_base_cost: None,
3150 vector_pop_back_base_cost: None,
3151 vector_destroy_empty_base_cost: None,
3152 vector_swap_base_cost: None,
3153 debug_print_base_cost: None,
3154 debug_print_stack_trace_base_cost: None,
3155
3156 max_size_written_objects: None,
3157 max_size_written_objects_system_tx: None,
3158
3159 max_move_identifier_len: None,
3166 max_move_value_depth: None,
3167 max_move_enum_variants: None,
3168
3169 gas_rounding_step: None,
3170
3171 execution_version: None,
3172
3173 max_event_emit_size_total: None,
3174
3175 consensus_bad_nodes_stake_threshold: None,
3176
3177 max_jwk_votes_per_validator_per_epoch: None,
3178
3179 max_age_of_jwk_in_epochs: None,
3180
3181 random_beacon_reduction_allowed_delta: None,
3182
3183 random_beacon_reduction_lower_bound: None,
3184
3185 random_beacon_dkg_timeout_round: None,
3186
3187 random_beacon_min_round_interval_ms: None,
3188
3189 random_beacon_dkg_version: None,
3190
3191 consensus_max_transaction_size_bytes: None,
3192
3193 consensus_max_transactions_in_block_bytes: None,
3194
3195 consensus_max_num_transactions_in_block: None,
3196
3197 consensus_voting_rounds: None,
3198
3199 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3200
3201 max_deferral_rounds_for_congestion_control: None,
3202
3203 max_txn_cost_overage_per_object_in_commit: None,
3204
3205 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3206
3207 min_checkpoint_interval_ms: None,
3208
3209 checkpoint_summary_version_specific_data: None,
3210
3211 max_soft_bundle_size: None,
3212
3213 bridge_should_try_to_finalize_committee: None,
3214
3215 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3216
3217 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3218
3219 consensus_gc_depth: None,
3220
3221 gas_budget_based_txn_cost_cap_factor: None,
3222
3223 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3224
3225 sip_45_consensus_amplification_threshold: None,
3226
3227 use_object_per_epoch_marker_table_v2: None,
3228
3229 consensus_commit_rate_estimation_window_size: None,
3230
3231 aliased_addresses: vec![],
3232
3233 translation_per_command_base_charge: None,
3234 translation_per_input_base_charge: None,
3235 translation_pure_input_per_byte_charge: None,
3236 translation_per_type_node_charge: None,
3237 translation_per_reference_node_charge: None,
3238 translation_per_linkage_entry_charge: None,
3239
3240 max_updates_per_settlement_txn: None,
3241 };
3244 for cur in 2..=version.0 {
3245 match cur {
3246 1 => unreachable!(),
3247 2 => {
3248 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3249 }
3250 3 => {
3251 cfg.gas_model_version = Some(2);
3253 cfg.max_tx_gas = Some(50_000_000_000);
3255 cfg.base_tx_cost_fixed = Some(2_000);
3257 cfg.storage_gas_price = Some(76);
3259 cfg.feature_flags.loaded_child_objects_fixed = true;
3260 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3263 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3266 cfg.feature_flags.package_upgrades = true;
3267 }
3268 4 => {
3273 cfg.reward_slashing_rate = Some(10000);
3275 cfg.gas_model_version = Some(3);
3277 }
3278 5 => {
3279 cfg.feature_flags.missing_type_is_compatibility_error = true;
3280 cfg.gas_model_version = Some(4);
3281 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3282 }
3286 6 => {
3287 cfg.gas_model_version = Some(5);
3288 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3289 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3290 }
3291 7 => {
3292 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3293 cfg.feature_flags
3294 .disable_invariant_violation_check_in_swap_loc = true;
3295 cfg.feature_flags.ban_entry_init = true;
3296 cfg.feature_flags.package_digest_hash_module = true;
3297 }
3298 8 => {
3299 cfg.feature_flags
3300 .disallow_change_struct_type_params_on_upgrade = true;
3301 }
3302 9 => {
3303 cfg.max_move_identifier_len = Some(128);
3305 cfg.feature_flags.no_extraneous_module_bytes = true;
3306 cfg.feature_flags
3307 .advance_to_highest_supported_protocol_version = true;
3308 }
3309 10 => {
3310 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3311 cfg.max_meter_ticks_per_module = Some(16_000_000);
3312 }
3313 11 => {
3314 cfg.max_move_value_depth = Some(128);
3315 }
3316 12 => {
3317 cfg.feature_flags.narwhal_versioned_metadata = true;
3318 if chain != Chain::Mainnet {
3319 cfg.feature_flags.commit_root_state_digest = true;
3320 }
3321
3322 if chain != Chain::Mainnet && chain != Chain::Testnet {
3323 cfg.feature_flags.zklogin_auth = true;
3324 }
3325 }
3326 13 => {}
3327 14 => {
3328 cfg.gas_rounding_step = Some(1_000);
3329 cfg.gas_model_version = Some(6);
3330 }
3331 15 => {
3332 cfg.feature_flags.consensus_transaction_ordering =
3333 ConsensusTransactionOrdering::ByGasPrice;
3334 }
3335 16 => {
3336 cfg.feature_flags.simplified_unwrap_then_delete = true;
3337 }
3338 17 => {
3339 cfg.feature_flags.upgraded_multisig_supported = true;
3340 }
3341 18 => {
3342 cfg.execution_version = Some(1);
3343 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3352 cfg.base_tx_cost_fixed = Some(1_000);
3354 }
3355 19 => {
3356 cfg.max_num_event_emit = Some(1024);
3357 cfg.max_event_emit_size_total = Some(
3360 256 * 250 * 1024, );
3362 }
3363 20 => {
3364 cfg.feature_flags.commit_root_state_digest = true;
3365
3366 if chain != Chain::Mainnet {
3367 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3368 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3369 }
3370 }
3371
3372 21 => {
3373 if chain != Chain::Mainnet {
3374 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3375 "Google".to_string(),
3376 "Facebook".to_string(),
3377 "Twitch".to_string(),
3378 ]);
3379 }
3380 }
3381 22 => {
3382 cfg.feature_flags.loaded_child_object_format = true;
3383 }
3384 23 => {
3385 cfg.feature_flags.loaded_child_object_format_type = true;
3386 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3387 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3393 }
3394 24 => {
3395 cfg.feature_flags.simple_conservation_checks = true;
3396 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3397
3398 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3399
3400 if chain != Chain::Mainnet {
3401 cfg.feature_flags.enable_jwk_consensus_updates = true;
3402 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3404 cfg.max_age_of_jwk_in_epochs = Some(1);
3405 }
3406 }
3407 25 => {
3408 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3410 "Google".to_string(),
3411 "Facebook".to_string(),
3412 "Twitch".to_string(),
3413 ]);
3414 cfg.feature_flags.zklogin_auth = true;
3415
3416 cfg.feature_flags.enable_jwk_consensus_updates = true;
3418 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3419 cfg.max_age_of_jwk_in_epochs = Some(1);
3420 }
3421 26 => {
3422 cfg.gas_model_version = Some(7);
3423 if chain != Chain::Mainnet && chain != Chain::Testnet {
3425 cfg.transfer_receive_object_cost_base = Some(52);
3426 cfg.feature_flags.receive_objects = true;
3427 }
3428 }
3429 27 => {
3430 cfg.gas_model_version = Some(8);
3431 }
3432 28 => {
3433 cfg.check_zklogin_id_cost_base = Some(200);
3435 cfg.check_zklogin_issuer_cost_base = Some(200);
3437
3438 if chain != Chain::Mainnet && chain != Chain::Testnet {
3440 cfg.feature_flags.enable_effects_v2 = true;
3441 }
3442 }
3443 29 => {
3444 cfg.feature_flags.verify_legacy_zklogin_address = true;
3445 }
3446 30 => {
3447 if chain != Chain::Mainnet {
3449 cfg.feature_flags.narwhal_certificate_v2 = true;
3450 }
3451
3452 cfg.random_beacon_reduction_allowed_delta = Some(800);
3453 if chain != Chain::Mainnet {
3455 cfg.feature_flags.enable_effects_v2 = true;
3456 }
3457
3458 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3462
3463 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3464 }
3465 31 => {
3466 cfg.execution_version = Some(2);
3467 if chain != Chain::Mainnet && chain != Chain::Testnet {
3469 cfg.feature_flags.shared_object_deletion = true;
3470 }
3471 }
3472 32 => {
3473 if chain != Chain::Mainnet {
3475 cfg.feature_flags.accept_zklogin_in_multisig = true;
3476 }
3477 if chain != Chain::Mainnet {
3479 cfg.transfer_receive_object_cost_base = Some(52);
3480 cfg.feature_flags.receive_objects = true;
3481 }
3482 if chain != Chain::Mainnet && chain != Chain::Testnet {
3484 cfg.feature_flags.random_beacon = true;
3485 cfg.random_beacon_reduction_lower_bound = Some(1600);
3486 cfg.random_beacon_dkg_timeout_round = Some(3000);
3487 cfg.random_beacon_min_round_interval_ms = Some(150);
3488 }
3489 if chain != Chain::Testnet && chain != Chain::Mainnet {
3491 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3492 }
3493
3494 cfg.feature_flags.narwhal_certificate_v2 = true;
3496 }
3497 33 => {
3498 cfg.feature_flags.hardened_otw_check = true;
3499 cfg.feature_flags.allow_receiving_object_id = true;
3500
3501 cfg.transfer_receive_object_cost_base = Some(52);
3503 cfg.feature_flags.receive_objects = true;
3504
3505 if chain != Chain::Mainnet {
3507 cfg.feature_flags.shared_object_deletion = true;
3508 }
3509
3510 cfg.feature_flags.enable_effects_v2 = true;
3511 }
3512 34 => {}
3513 35 => {
3514 if chain != Chain::Mainnet && chain != Chain::Testnet {
3516 cfg.feature_flags.enable_poseidon = true;
3517 cfg.poseidon_bn254_cost_base = Some(260);
3518 cfg.poseidon_bn254_cost_per_block = Some(10);
3519 }
3520
3521 cfg.feature_flags.enable_coin_deny_list = true;
3522 }
3523 36 => {
3524 if chain != Chain::Mainnet && chain != Chain::Testnet {
3526 cfg.feature_flags.enable_group_ops_native_functions = true;
3527 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3528 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3530 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3531 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3532 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3533 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3534 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3535 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3536 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3537 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3538 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3539 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3540 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3541 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3542 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3543 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3544 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3545 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3546 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3547 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3548 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3549 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3550 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3551 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3552 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3553 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3554 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3555 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3556 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3557 cfg.group_ops_bls12381_msm_max_len = Some(32);
3558 cfg.group_ops_bls12381_pairing_cost = Some(52);
3559 }
3560 cfg.feature_flags.shared_object_deletion = true;
3562
3563 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3565 }
3567 37 => {
3568 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3569
3570 if chain != Chain::Mainnet {
3572 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3573 }
3574 }
3575 38 => {
3576 cfg.binary_module_handles = Some(100);
3577 cfg.binary_struct_handles = Some(300);
3578 cfg.binary_function_handles = Some(1500);
3579 cfg.binary_function_instantiations = Some(750);
3580 cfg.binary_signatures = Some(1000);
3581 cfg.binary_constant_pool = Some(4000);
3585 cfg.binary_identifiers = Some(10000);
3586 cfg.binary_address_identifiers = Some(100);
3587 cfg.binary_struct_defs = Some(200);
3588 cfg.binary_struct_def_instantiations = Some(100);
3589 cfg.binary_function_defs = Some(1000);
3590 cfg.binary_field_handles = Some(500);
3591 cfg.binary_field_instantiations = Some(250);
3592 cfg.binary_friend_decls = Some(100);
3593 cfg.max_package_dependencies = Some(32);
3595 cfg.max_modules_in_publish = Some(64);
3596 cfg.execution_version = Some(3);
3598 }
3599 39 => {
3600 }
3602 40 => {}
3603 41 => {
3604 cfg.feature_flags.enable_group_ops_native_functions = true;
3606 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3608 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3609 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3610 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3611 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3612 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3613 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3614 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3615 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3616 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3617 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3618 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3619 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3620 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3621 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3622 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3623 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3624 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3625 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3626 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3627 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3628 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3629 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3630 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3631 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3632 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3633 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3634 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3635 cfg.group_ops_bls12381_msm_max_len = Some(32);
3636 cfg.group_ops_bls12381_pairing_cost = Some(52);
3637 }
3638 42 => {}
3639 43 => {
3640 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3641 cfg.max_meter_ticks_per_package = Some(16_000_000);
3642 }
3643 44 => {
3644 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3646 if chain != Chain::Mainnet {
3648 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3649 }
3650 }
3651 45 => {
3652 if chain != Chain::Testnet && chain != Chain::Mainnet {
3654 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3655 }
3656
3657 if chain != Chain::Mainnet {
3658 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3660 }
3661 cfg.min_move_binary_format_version = Some(6);
3662 cfg.feature_flags.accept_zklogin_in_multisig = true;
3663
3664 if chain != Chain::Mainnet && chain != Chain::Testnet {
3668 cfg.feature_flags.bridge = true;
3669 }
3670 }
3671 46 => {
3672 if chain != Chain::Mainnet {
3674 cfg.feature_flags.bridge = true;
3675 }
3676
3677 cfg.feature_flags.reshare_at_same_initial_version = true;
3679 }
3680 47 => {}
3681 48 => {
3682 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3684
3685 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3687
3688 if chain != Chain::Mainnet {
3690 cfg.feature_flags.random_beacon = true;
3691 cfg.random_beacon_reduction_lower_bound = Some(1600);
3692 cfg.random_beacon_dkg_timeout_round = Some(3000);
3693 cfg.random_beacon_min_round_interval_ms = Some(200);
3694 }
3695
3696 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3698 }
3699 49 => {
3700 if chain != Chain::Testnet && chain != Chain::Mainnet {
3701 cfg.move_binary_format_version = Some(7);
3702 }
3703
3704 if chain != Chain::Mainnet && chain != Chain::Testnet {
3706 cfg.feature_flags.enable_vdf = true;
3707 cfg.vdf_verify_vdf_cost = Some(1500);
3710 cfg.vdf_hash_to_input_cost = Some(100);
3711 }
3712
3713 if chain != Chain::Testnet && chain != Chain::Mainnet {
3715 cfg.feature_flags
3716 .record_consensus_determined_version_assignments_in_prologue = true;
3717 }
3718
3719 if chain != Chain::Mainnet {
3721 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3722 }
3723
3724 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3726 }
3727 50 => {
3728 if chain != Chain::Mainnet {
3730 cfg.checkpoint_summary_version_specific_data = Some(1);
3731 cfg.min_checkpoint_interval_ms = Some(200);
3732 }
3733
3734 if chain != Chain::Testnet && chain != Chain::Mainnet {
3736 cfg.feature_flags
3737 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3738 }
3739
3740 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3741
3742 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3744 }
3745 51 => {
3746 cfg.random_beacon_dkg_version = Some(1);
3747
3748 if chain != Chain::Testnet && chain != Chain::Mainnet {
3749 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3750 }
3751 }
3752 52 => {
3753 if chain != Chain::Mainnet {
3754 cfg.feature_flags.soft_bundle = true;
3755 cfg.max_soft_bundle_size = Some(5);
3756 }
3757
3758 cfg.config_read_setting_impl_cost_base = Some(100);
3759 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3760
3761 if chain != Chain::Testnet && chain != Chain::Mainnet {
3763 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3764 cfg.feature_flags.per_object_congestion_control_mode =
3765 PerObjectCongestionControlMode::TotalTxCount;
3766 }
3767
3768 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3770
3771 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3773
3774 cfg.checkpoint_summary_version_specific_data = Some(1);
3776 cfg.min_checkpoint_interval_ms = Some(200);
3777
3778 if chain != Chain::Mainnet {
3780 cfg.feature_flags
3781 .record_consensus_determined_version_assignments_in_prologue = true;
3782 cfg.feature_flags
3783 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3784 }
3785 if chain != Chain::Mainnet {
3787 cfg.move_binary_format_version = Some(7);
3788 }
3789
3790 if chain != Chain::Testnet && chain != Chain::Mainnet {
3791 cfg.feature_flags.passkey_auth = true;
3792 }
3793 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3794 }
3795 53 => {
3796 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3798
3799 cfg.feature_flags
3801 .record_consensus_determined_version_assignments_in_prologue = true;
3802 cfg.feature_flags
3803 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3804
3805 if chain == Chain::Unknown {
3806 cfg.feature_flags.authority_capabilities_v2 = true;
3807 }
3808
3809 if chain != Chain::Mainnet {
3811 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3812 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3813 cfg.feature_flags.per_object_congestion_control_mode =
3814 PerObjectCongestionControlMode::TotalTxCount;
3815 }
3816
3817 cfg.bcs_per_byte_serialized_cost = Some(2);
3819 cfg.bcs_legacy_min_output_size_cost = Some(1);
3820 cfg.bcs_failure_cost = Some(52);
3821 cfg.debug_print_base_cost = Some(52);
3822 cfg.debug_print_stack_trace_base_cost = Some(52);
3823 cfg.hash_sha2_256_base_cost = Some(52);
3824 cfg.hash_sha2_256_per_byte_cost = Some(2);
3825 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3826 cfg.hash_sha3_256_base_cost = Some(52);
3827 cfg.hash_sha3_256_per_byte_cost = Some(2);
3828 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3829 cfg.type_name_get_base_cost = Some(52);
3830 cfg.type_name_get_per_byte_cost = Some(2);
3831 cfg.string_check_utf8_base_cost = Some(52);
3832 cfg.string_check_utf8_per_byte_cost = Some(2);
3833 cfg.string_is_char_boundary_base_cost = Some(52);
3834 cfg.string_sub_string_base_cost = Some(52);
3835 cfg.string_sub_string_per_byte_cost = Some(2);
3836 cfg.string_index_of_base_cost = Some(52);
3837 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3838 cfg.string_index_of_per_byte_searched_cost = Some(2);
3839 cfg.vector_empty_base_cost = Some(52);
3840 cfg.vector_length_base_cost = Some(52);
3841 cfg.vector_push_back_base_cost = Some(52);
3842 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3843 cfg.vector_borrow_base_cost = Some(52);
3844 cfg.vector_pop_back_base_cost = Some(52);
3845 cfg.vector_destroy_empty_base_cost = Some(52);
3846 cfg.vector_swap_base_cost = Some(52);
3847 }
3848 54 => {
3849 cfg.feature_flags.random_beacon = true;
3851 cfg.random_beacon_reduction_lower_bound = Some(1000);
3852 cfg.random_beacon_dkg_timeout_round = Some(3000);
3853 cfg.random_beacon_min_round_interval_ms = Some(500);
3854
3855 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3857 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3858 cfg.feature_flags.per_object_congestion_control_mode =
3859 PerObjectCongestionControlMode::TotalTxCount;
3860
3861 cfg.feature_flags.soft_bundle = true;
3863 cfg.max_soft_bundle_size = Some(5);
3864 }
3865 55 => {
3866 cfg.move_binary_format_version = Some(7);
3868
3869 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3871 cfg.consensus_max_num_transactions_in_block = Some(512);
3874
3875 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3876 }
3877 56 => {
3878 if chain == Chain::Mainnet {
3879 cfg.feature_flags.bridge = true;
3880 }
3881 }
3882 57 => {
3883 cfg.random_beacon_reduction_lower_bound = Some(800);
3885 }
3886 58 => {
3887 if chain == Chain::Mainnet {
3888 cfg.bridge_should_try_to_finalize_committee = Some(true);
3889 }
3890
3891 if chain != Chain::Mainnet && chain != Chain::Testnet {
3892 cfg.feature_flags
3894 .consensus_distributed_vote_scoring_strategy = true;
3895 }
3896 }
3897 59 => {
3898 cfg.feature_flags.consensus_round_prober = true;
3900 }
3901 60 => {
3902 cfg.max_type_to_layout_nodes = Some(512);
3903 cfg.feature_flags.validate_identifier_inputs = true;
3904 }
3905 61 => {
3906 if chain != Chain::Mainnet {
3907 cfg.feature_flags
3909 .consensus_distributed_vote_scoring_strategy = true;
3910 }
3911 cfg.random_beacon_reduction_lower_bound = Some(700);
3913
3914 if chain != Chain::Mainnet && chain != Chain::Testnet {
3915 cfg.feature_flags.mysticeti_fastpath = true;
3917 }
3918 }
3919 62 => {
3920 cfg.feature_flags.relocate_event_module = true;
3921 }
3922 63 => {
3923 cfg.feature_flags.per_object_congestion_control_mode =
3924 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3925 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3926 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3927 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3928 }
3929 64 => {
3930 cfg.feature_flags.per_object_congestion_control_mode =
3931 PerObjectCongestionControlMode::TotalTxCount;
3932 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3933 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3934 }
3935 65 => {
3936 cfg.feature_flags
3938 .consensus_distributed_vote_scoring_strategy = true;
3939 }
3940 66 => {
3941 if chain == Chain::Mainnet {
3942 cfg.feature_flags
3944 .consensus_distributed_vote_scoring_strategy = false;
3945 }
3946 }
3947 67 => {
3948 cfg.feature_flags
3950 .consensus_distributed_vote_scoring_strategy = true;
3951 }
3952 68 => {
3953 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3954 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3955 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3956 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3957 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3958
3959 if chain != Chain::Mainnet && chain != Chain::Testnet {
3960 cfg.feature_flags.uncompressed_g1_group_elements = true;
3961 }
3962
3963 cfg.feature_flags.per_object_congestion_control_mode =
3964 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3965 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3966 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3967 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3968 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3970 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3971
3972 cfg.random_beacon_reduction_lower_bound = Some(500);
3974
3975 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3976 }
3977 69 => {
3978 cfg.consensus_voting_rounds = Some(40);
3980
3981 if chain != Chain::Mainnet && chain != Chain::Testnet {
3982 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3984 }
3985
3986 if chain != Chain::Mainnet {
3987 cfg.feature_flags.uncompressed_g1_group_elements = true;
3988 }
3989 }
3990 70 => {
3991 if chain != Chain::Mainnet {
3992 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3994 cfg.feature_flags
3996 .consensus_round_prober_probe_accepted_rounds = true;
3997 }
3998
3999 cfg.poseidon_bn254_cost_per_block = Some(388);
4000
4001 cfg.gas_model_version = Some(9);
4002 cfg.feature_flags.native_charging_v2 = true;
4003 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4004 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4005 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4006 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4007 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4008 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4009 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4010 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4011
4012 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4014 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4015 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4016 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4017
4018 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4019 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4020 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4021 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4022 Some(8213);
4023 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4024 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4025 Some(9484);
4026
4027 cfg.hash_keccak256_cost_base = Some(10);
4028 cfg.hash_blake2b256_cost_base = Some(10);
4029
4030 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4032 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4033 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4034 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4035
4036 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4037 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4038 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4039 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4040
4041 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4042 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4043 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4044 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4045
4046 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4047 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4048 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4049 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4050
4051 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4052 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4053 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4054 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4055
4056 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4057 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4058
4059 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4060 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4061 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4062 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4063
4064 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4065 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4066 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4067 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4068
4069 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4070 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4071
4072 cfg.validator_validate_metadata_cost_base = Some(20000);
4073 }
4074 71 => {
4075 cfg.sip_45_consensus_amplification_threshold = Some(5);
4076
4077 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4079 }
4080 72 => {
4081 cfg.feature_flags.convert_type_argument_error = true;
4082
4083 cfg.max_tx_gas = Some(50_000_000_000_000);
4086 cfg.max_gas_price = Some(50_000_000_000);
4088
4089 cfg.feature_flags.variant_nodes = true;
4090 }
4091 73 => {
4092 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4094
4095 if chain != Chain::Mainnet && chain != Chain::Testnet {
4096 cfg.consensus_gc_depth = Some(60);
4099 }
4100
4101 if chain != Chain::Mainnet {
4102 cfg.feature_flags.consensus_zstd_compression = true;
4104 }
4105
4106 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4108 cfg.feature_flags
4110 .consensus_round_prober_probe_accepted_rounds = true;
4111
4112 cfg.feature_flags.per_object_congestion_control_mode =
4114 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4115 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4116 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4117 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4118 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4120 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4121 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4122 }
4123 74 => {
4124 if chain != Chain::Mainnet && chain != Chain::Testnet {
4126 cfg.feature_flags.enable_nitro_attestation = true;
4127 }
4128 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4129 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4130 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4131 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4132
4133 cfg.feature_flags.consensus_zstd_compression = true;
4135
4136 if chain != Chain::Mainnet && chain != Chain::Testnet {
4137 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4138 }
4139 }
4140 75 => {
4141 if chain != Chain::Mainnet {
4142 cfg.feature_flags.passkey_auth = true;
4143 }
4144 }
4145 76 => {
4146 if chain != Chain::Mainnet && chain != Chain::Testnet {
4147 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4148 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4149 }
4150 cfg.feature_flags.minimize_child_object_mutations = true;
4151
4152 if chain != Chain::Mainnet {
4153 cfg.feature_flags.accept_passkey_in_multisig = true;
4154 }
4155 }
4156 77 => {
4157 cfg.feature_flags.uncompressed_g1_group_elements = true;
4158
4159 if chain != Chain::Mainnet {
4160 cfg.consensus_gc_depth = Some(60);
4161 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4162 }
4163 }
4164 78 => {
4165 cfg.feature_flags.move_native_context = true;
4166 cfg.tx_context_fresh_id_cost_base = Some(52);
4167 cfg.tx_context_sender_cost_base = Some(30);
4168 cfg.tx_context_epoch_cost_base = Some(30);
4169 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4170 cfg.tx_context_sponsor_cost_base = Some(30);
4171 cfg.tx_context_gas_price_cost_base = Some(30);
4172 cfg.tx_context_gas_budget_cost_base = Some(30);
4173 cfg.tx_context_ids_created_cost_base = Some(30);
4174 cfg.tx_context_replace_cost_base = Some(30);
4175 cfg.gas_model_version = Some(10);
4176
4177 if chain != Chain::Mainnet {
4178 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4179 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4180
4181 cfg.feature_flags.per_object_congestion_control_mode =
4183 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4184 ExecutionTimeEstimateParams {
4185 target_utilization: 30,
4186 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4188 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4190 stored_observations_limit: u64::MAX,
4191 stake_weighted_median_threshold: 0,
4192 default_none_duration_for_new_keys: false,
4193 observations_chunk_size: None,
4194 },
4195 );
4196 }
4197 }
4198 79 => {
4199 if chain != Chain::Mainnet {
4200 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4201
4202 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4205
4206 cfg.feature_flags.consensus_batched_block_sync = true;
4207
4208 cfg.feature_flags.enable_nitro_attestation = true
4210 }
4211 cfg.feature_flags.normalize_ptb_arguments = true;
4212
4213 cfg.consensus_gc_depth = Some(60);
4214 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4215 }
4216 80 => {
4217 cfg.max_ptb_value_size = Some(1024 * 1024);
4218 }
4219 81 => {
4220 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4221 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4222 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4223 }
4224 82 => {
4225 cfg.feature_flags.max_ptb_value_size_v2 = true;
4226 }
4227 83 => {
4228 if chain == Chain::Mainnet {
4229 let aliased: [u8; 32] = Hex::decode(
4231 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4232 )
4233 .unwrap()
4234 .try_into()
4235 .unwrap();
4236
4237 cfg.aliased_addresses.push(AliasedAddress {
4239 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4240 aliased,
4241 allowed_tx_digests: vec![
4242 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4243 ],
4244 });
4245
4246 cfg.aliased_addresses.push(AliasedAddress {
4247 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4248 aliased,
4249 allowed_tx_digests: vec![
4250 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4251 ],
4252 });
4253 }
4254
4255 if chain != Chain::Mainnet {
4258 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4259 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4260
4261 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4263 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4264 cfg.feature_flags.per_object_congestion_control_mode =
4265 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4266 ExecutionTimeEstimateParams {
4267 target_utilization: 30,
4268 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4270 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4272 stored_observations_limit: u64::MAX,
4273 stake_weighted_median_threshold: 0,
4274 default_none_duration_for_new_keys: false,
4275 observations_chunk_size: None,
4276 },
4277 );
4278
4279 cfg.feature_flags.consensus_batched_block_sync = true;
4281
4282 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4285 cfg.feature_flags.enable_nitro_attestation = true;
4286 }
4287 }
4288 84 => {
4289 if chain == Chain::Mainnet {
4290 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4291 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4292
4293 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4295 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4296 cfg.feature_flags.per_object_congestion_control_mode =
4297 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4298 ExecutionTimeEstimateParams {
4299 target_utilization: 30,
4300 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4302 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4304 stored_observations_limit: u64::MAX,
4305 stake_weighted_median_threshold: 0,
4306 default_none_duration_for_new_keys: false,
4307 observations_chunk_size: None,
4308 },
4309 );
4310
4311 cfg.feature_flags.consensus_batched_block_sync = true;
4313
4314 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4317 cfg.feature_flags.enable_nitro_attestation = true;
4318 }
4319
4320 cfg.feature_flags.per_object_congestion_control_mode =
4322 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4323 ExecutionTimeEstimateParams {
4324 target_utilization: 30,
4325 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4327 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4329 stored_observations_limit: 20,
4330 stake_weighted_median_threshold: 0,
4331 default_none_duration_for_new_keys: false,
4332 observations_chunk_size: None,
4333 },
4334 );
4335 cfg.feature_flags.allow_unbounded_system_objects = true;
4336 }
4337 85 => {
4338 if chain != Chain::Mainnet && chain != Chain::Testnet {
4339 cfg.feature_flags.enable_party_transfer = true;
4340 }
4341
4342 cfg.feature_flags
4343 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4344 cfg.feature_flags.disallow_self_identifier = true;
4345 cfg.feature_flags.per_object_congestion_control_mode =
4346 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4347 ExecutionTimeEstimateParams {
4348 target_utilization: 50,
4349 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4351 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4353 stored_observations_limit: 20,
4354 stake_weighted_median_threshold: 0,
4355 default_none_duration_for_new_keys: false,
4356 observations_chunk_size: None,
4357 },
4358 );
4359 }
4360 86 => {
4361 cfg.feature_flags.type_tags_in_object_runtime = true;
4362 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4363
4364 cfg.feature_flags.per_object_congestion_control_mode =
4366 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4367 ExecutionTimeEstimateParams {
4368 target_utilization: 50,
4369 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4371 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4373 stored_observations_limit: 20,
4374 stake_weighted_median_threshold: 3334,
4375 default_none_duration_for_new_keys: false,
4376 observations_chunk_size: None,
4377 },
4378 );
4379 if chain != Chain::Mainnet {
4381 cfg.feature_flags.enable_party_transfer = true;
4382 }
4383 }
4384 87 => {
4385 if chain == Chain::Mainnet {
4386 cfg.feature_flags.record_time_estimate_processed = true;
4387 }
4388 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4389 }
4390 88 => {
4391 cfg.feature_flags.record_time_estimate_processed = true;
4392 cfg.tx_context_rgp_cost_base = Some(30);
4393 cfg.feature_flags
4394 .ignore_execution_time_observations_after_certs_closed = true;
4395
4396 cfg.feature_flags.per_object_congestion_control_mode =
4399 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4400 ExecutionTimeEstimateParams {
4401 target_utilization: 50,
4402 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4404 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4406 stored_observations_limit: 20,
4407 stake_weighted_median_threshold: 3334,
4408 default_none_duration_for_new_keys: true,
4409 observations_chunk_size: None,
4410 },
4411 );
4412 }
4413 89 => {
4414 cfg.feature_flags.dependency_linkage_error = true;
4415 cfg.feature_flags.additional_multisig_checks = true;
4416 }
4417 90 => {
4418 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4420 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4421 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4422 cfg.feature_flags.accept_passkey_in_multisig = true;
4423 cfg.feature_flags.passkey_auth = true;
4424 cfg.feature_flags.check_for_init_during_upgrade = true;
4425
4426 if chain != Chain::Mainnet {
4428 cfg.feature_flags.mysticeti_fastpath = true;
4429 }
4430 }
4431 91 => {
4432 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4433 }
4434 92 => {
4435 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4436 }
4437 93 => {
4438 cfg.feature_flags
4439 .consensus_checkpoint_signature_key_includes_digest = true;
4440 }
4441 94 => {
4442 cfg.feature_flags.per_object_congestion_control_mode =
4444 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4445 ExecutionTimeEstimateParams {
4446 target_utilization: 50,
4447 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4449 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4451 stored_observations_limit: 18,
4452 stake_weighted_median_threshold: 3334,
4453 default_none_duration_for_new_keys: true,
4454 observations_chunk_size: None,
4455 },
4456 );
4457
4458 cfg.feature_flags.enable_party_transfer = true;
4460 }
4461 95 => {
4462 cfg.type_name_id_base_cost = Some(52);
4463
4464 cfg.max_transactions_per_checkpoint = Some(20_000);
4466 }
4467 96 => {
4468 if chain != Chain::Mainnet && chain != Chain::Testnet {
4470 cfg.feature_flags
4471 .include_checkpoint_artifacts_digest_in_summary = true;
4472 }
4473 cfg.feature_flags.correct_gas_payment_limit_check = true;
4474 cfg.feature_flags.authority_capabilities_v2 = true;
4475 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4476 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4477 cfg.feature_flags.enable_coin_registry = true;
4478
4479 cfg.feature_flags.mysticeti_fastpath = true;
4481 }
4482 97 => {
4483 cfg.feature_flags.additional_borrow_checks = true;
4484 }
4485 98 => {
4486 cfg.event_emit_auth_stream_cost = Some(52);
4487 cfg.feature_flags.better_loader_errors = true;
4488 cfg.feature_flags.generate_df_type_layouts = true;
4489 }
4490 99 => {
4491 cfg.feature_flags.use_new_commit_handler = true;
4492 }
4493 100 => {
4494 cfg.feature_flags.private_generics_verifier_v2 = true;
4495 }
4496 101 => {
4497 cfg.feature_flags.create_root_accumulator_object = true;
4498 cfg.max_updates_per_settlement_txn = Some(100);
4499 if chain != Chain::Mainnet {
4500 cfg.feature_flags.enable_poseidon = true;
4501 }
4502 }
4503 102 => {
4504 cfg.feature_flags.per_object_congestion_control_mode =
4508 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4509 ExecutionTimeEstimateParams {
4510 target_utilization: 50,
4511 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4513 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4515 stored_observations_limit: 180,
4516 stake_weighted_median_threshold: 3334,
4517 default_none_duration_for_new_keys: true,
4518 observations_chunk_size: Some(18),
4519 },
4520 );
4521 cfg.feature_flags.deprecate_global_storage_ops = true;
4522 }
4523 103 => {}
4524 104 => {
4525 cfg.translation_per_command_base_charge = Some(1);
4526 cfg.translation_per_input_base_charge = Some(1);
4527 cfg.translation_pure_input_per_byte_charge = Some(1);
4528 cfg.translation_per_type_node_charge = Some(1);
4529 cfg.translation_per_reference_node_charge = Some(1);
4530 cfg.translation_per_linkage_entry_charge = Some(10);
4531 cfg.gas_model_version = Some(11);
4532 cfg.feature_flags.abstract_size_in_object_runtime = true;
4533 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4534 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4535 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4536 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4537 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4538 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4539 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4540 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4541 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4542 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4543 cfg.feature_flags.enable_ptb_execution_v2 = true;
4544
4545 cfg.poseidon_bn254_cost_base = Some(260);
4546
4547 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4548
4549 if chain != Chain::Mainnet {
4550 cfg.feature_flags
4551 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4552 }
4553
4554 cfg.feature_flags
4555 .include_cancelled_randomness_txns_in_prologue = true;
4556 }
4557 105 => {
4558 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4559 cfg.feature_flags.disable_preconsensus_locking = true;
4560
4561 if chain != Chain::Mainnet {
4562 cfg.feature_flags
4563 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4564 }
4565 }
4566 106 => {
4567 cfg.accumulator_object_storage_cost = Some(7600);
4569
4570 if chain != Chain::Mainnet && chain != Chain::Testnet {
4571 cfg.feature_flags.enable_accumulators = true;
4572 cfg.feature_flags.enable_address_balance_gas_payments = true;
4573 cfg.feature_flags.enable_authenticated_event_streams = true;
4574 cfg.feature_flags.enable_object_funds_withdraw = true;
4575 }
4576 }
4577 107 => {
4578 cfg.feature_flags
4579 .consensus_skip_gced_blocks_in_direct_finalization = true;
4580
4581 if in_integration_test() {
4583 cfg.consensus_gc_depth = Some(6);
4584 cfg.consensus_max_num_transactions_in_block = Some(8);
4585 }
4586 }
4587 108 => {
4588 cfg.feature_flags.gas_rounding_halve_digits = true;
4589 cfg.feature_flags.flexible_tx_context_positions = true;
4590 cfg.feature_flags.disable_entry_point_signature_check = true;
4591
4592 if chain != Chain::Mainnet {
4593 cfg.feature_flags.address_aliases = true;
4594
4595 cfg.feature_flags.enable_accumulators = true;
4596 cfg.feature_flags.enable_address_balance_gas_payments = true;
4597 }
4598
4599 cfg.feature_flags.enable_poseidon = true;
4600 }
4601 109 => {
4602 cfg.binary_variant_handles = Some(1024);
4603 cfg.binary_variant_instantiation_handles = Some(1024);
4604 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4605 }
4606 110 => {
4607 cfg.feature_flags
4608 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4609 cfg.feature_flags
4610 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4611 if chain != Chain::Mainnet && chain != Chain::Testnet {
4612 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4613 }
4614 cfg.feature_flags.validate_zklogin_public_identifier = true;
4615 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4616 cfg.feature_flags
4617 .consensus_always_accept_system_transactions = true;
4618 if chain != Chain::Mainnet {
4619 cfg.feature_flags.enable_object_funds_withdraw = true;
4620 }
4621 }
4622 111 => {
4623 cfg.feature_flags.validator_metadata_verify_v2 = true;
4624 }
4625 112 => {
4626 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4627 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4628 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4629 cfg.group_ops_ristretto_point_add_cost = Some(500);
4630 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4631 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4632 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4633 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4634 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4635 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4636
4637 if chain != Chain::Mainnet && chain != Chain::Testnet {
4638 cfg.feature_flags.enable_ristretto255_group_ops = true;
4639 }
4640 }
4641 113 => {
4642 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4643 if chain != Chain::Mainnet && chain != Chain::Testnet {
4644 cfg.feature_flags.defer_unpaid_amplification = true;
4645 }
4646 }
4647 114 => {
4648 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4649 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4650 if chain != Chain::Mainnet {
4651 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4652 cfg.feature_flags.enable_authenticated_event_streams = true;
4653 cfg.feature_flags
4654 .include_checkpoint_artifacts_digest_in_summary = true;
4655 }
4656 }
4657 115 => {
4658 cfg.feature_flags.gasless_transaction_drop_safety = true;
4659 cfg.feature_flags.address_aliases = true;
4660 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4661 cfg.feature_flags.defer_unpaid_amplification = false;
4663 }
4664 116 => {
4665 cfg.feature_flags.enable_display_registry = true;
4666 }
4667 _ => panic!("unsupported version {:?}", version),
4678 }
4679 }
4680
4681 cfg
4682 }
4683
4684 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4685 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4686 || !self.feature_flags.split_checkpoints_in_consensus_handler
4687 {
4688 return;
4689 }
4690
4691 if !mysten_common::in_test_configuration() {
4692 return;
4693 }
4694
4695 use rand::{Rng, SeedableRng, rngs::StdRng};
4696 let mut rng = StdRng::from_seed(*seed);
4697 let max_txns = rng.gen_range(10..=100u64);
4698 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4699 self.max_transactions_per_checkpoint = Some(max_txns);
4700 }
4701
4702 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4708 let (
4709 max_back_edges_per_function,
4710 max_back_edges_per_module,
4711 sanity_check_with_regex_reference_safety,
4712 ) = if let Some((
4713 max_back_edges_per_function,
4714 max_back_edges_per_module,
4715 sanity_check_with_regex_reference_safety,
4716 )) = signing_limits
4717 {
4718 (
4719 Some(max_back_edges_per_function),
4720 Some(max_back_edges_per_module),
4721 Some(sanity_check_with_regex_reference_safety),
4722 )
4723 } else {
4724 (None, None, None)
4725 };
4726
4727 let additional_borrow_checks = if signing_limits.is_some() {
4728 true
4730 } else {
4731 self.additional_borrow_checks()
4732 };
4733 let deprecate_global_storage_ops = if signing_limits.is_some() {
4734 true
4736 } else {
4737 self.deprecate_global_storage_ops()
4738 };
4739
4740 VerifierConfig {
4741 max_loop_depth: Some(self.max_loop_depth() as usize),
4742 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4743 max_function_parameters: Some(self.max_function_parameters() as usize),
4744 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4745 max_value_stack_size: self.max_value_stack_size() as usize,
4746 max_type_nodes: Some(self.max_type_nodes() as usize),
4747 max_push_size: Some(self.max_push_size() as usize),
4748 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4749 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4750 max_function_definitions: Some(self.max_function_definitions() as usize),
4751 max_data_definitions: Some(self.max_struct_definitions() as usize),
4752 max_constant_vector_len: Some(self.max_move_vector_len()),
4753 max_back_edges_per_function,
4754 max_back_edges_per_module,
4755 max_basic_blocks_in_script: None,
4756 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4758 allow_receiving_object_id: self.allow_receiving_object_id(),
4759 reject_mutable_random_on_entry_functions: self
4760 .reject_mutable_random_on_entry_functions(),
4761 bytecode_version: self.move_binary_format_version(),
4762 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4763 additional_borrow_checks,
4764 better_loader_errors: self.better_loader_errors(),
4765 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4766 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4767 .map(|limit| limit as u128),
4768 deprecate_global_storage_ops,
4769 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4770 switch_to_regex_reference_safety: false,
4771 }
4772 }
4773
4774 pub fn binary_config(
4775 &self,
4776 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4777 ) -> BinaryConfig {
4778 let deprecate_global_storage_ops =
4779 override_deprecate_global_storage_ops_during_deserialization
4780 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4781 BinaryConfig::new(
4782 self.move_binary_format_version(),
4783 self.min_move_binary_format_version_as_option()
4784 .unwrap_or(VERSION_1),
4785 self.no_extraneous_module_bytes(),
4786 deprecate_global_storage_ops,
4787 TableConfig {
4788 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4789 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4790 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4791 function_instantiations: self
4792 .binary_function_instantiations_as_option()
4793 .unwrap_or(u16::MAX),
4794 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4795 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4796 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4797 address_identifiers: self
4798 .binary_address_identifiers_as_option()
4799 .unwrap_or(u16::MAX),
4800 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4801 struct_def_instantiations: self
4802 .binary_struct_def_instantiations_as_option()
4803 .unwrap_or(u16::MAX),
4804 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4805 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4806 field_instantiations: self
4807 .binary_field_instantiations_as_option()
4808 .unwrap_or(u16::MAX),
4809 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4810 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4811 enum_def_instantiations: self
4812 .binary_enum_def_instantiations_as_option()
4813 .unwrap_or(u16::MAX),
4814 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4815 variant_instantiation_handles: self
4816 .binary_variant_instantiation_handles_as_option()
4817 .unwrap_or(u16::MAX),
4818 },
4819 )
4820 }
4821
4822 pub fn apply_overrides_for_testing(
4826 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4827 ) -> OverrideGuard {
4828 CONFIG_OVERRIDE.with(|ovr| {
4829 let mut cur = ovr.borrow_mut();
4830 assert!(cur.is_none(), "config override already present");
4831 *cur = Some(Box::new(override_fn));
4832 OverrideGuard
4833 })
4834 }
4835}
4836
4837impl ProtocolConfig {
4841 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4842 self.feature_flags
4843 .advance_to_highest_supported_protocol_version = val
4844 }
4845 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4846 self.feature_flags.commit_root_state_digest = val
4847 }
4848 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4849 self.feature_flags.zklogin_auth = val
4850 }
4851 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4852 self.feature_flags.enable_jwk_consensus_updates = val
4853 }
4854 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4855 self.feature_flags.random_beacon = val
4856 }
4857
4858 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4859 self.feature_flags.upgraded_multisig_supported = val
4860 }
4861 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4862 self.feature_flags.accept_zklogin_in_multisig = val
4863 }
4864
4865 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4866 self.feature_flags.shared_object_deletion = val;
4867 }
4868
4869 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4870 self.feature_flags.narwhal_new_leader_election_schedule = val;
4871 }
4872
4873 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4874 self.feature_flags.receive_objects = val
4875 }
4876 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4877 self.feature_flags.narwhal_certificate_v2 = val
4878 }
4879 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4880 self.feature_flags.verify_legacy_zklogin_address = val
4881 }
4882
4883 pub fn set_per_object_congestion_control_mode_for_testing(
4884 &mut self,
4885 val: PerObjectCongestionControlMode,
4886 ) {
4887 self.feature_flags.per_object_congestion_control_mode = val;
4888 }
4889
4890 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4891 self.feature_flags.consensus_choice = val;
4892 }
4893
4894 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4895 self.feature_flags.consensus_network = val;
4896 }
4897
4898 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4899 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4900 }
4901
4902 pub fn set_disable_bridge_for_testing(&mut self) {
4903 self.feature_flags.bridge = false
4904 }
4905
4906 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4907 self.feature_flags.mysticeti_num_leaders_per_round = val;
4908 }
4909
4910 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4911 self.feature_flags.soft_bundle = val;
4912 }
4913
4914 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4915 self.feature_flags.passkey_auth = val
4916 }
4917
4918 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4919 self.feature_flags.enable_party_transfer = val
4920 }
4921
4922 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4923 self.feature_flags
4924 .consensus_distributed_vote_scoring_strategy = val;
4925 }
4926
4927 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4928 self.feature_flags.consensus_round_prober = val;
4929 }
4930
4931 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4932 self.feature_flags
4933 .disallow_new_modules_in_deps_only_packages = val;
4934 }
4935
4936 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4937 self.feature_flags.correct_gas_payment_limit_check = val;
4938 }
4939
4940 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4941 self.feature_flags.address_aliases = val;
4942 }
4943
4944 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4945 self.feature_flags
4946 .consensus_round_prober_probe_accepted_rounds = val;
4947 }
4948
4949 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4950 self.feature_flags.mysticeti_fastpath = val;
4951 }
4952
4953 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4954 self.feature_flags.accept_passkey_in_multisig = val;
4955 }
4956
4957 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4958 self.feature_flags.consensus_batched_block_sync = val;
4959 }
4960
4961 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4962 self.feature_flags.record_time_estimate_processed = val;
4963 }
4964
4965 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4966 &mut self,
4967 val: bool,
4968 ) {
4969 self.feature_flags
4970 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4971 }
4972
4973 pub fn enable_accumulators_for_testing(&mut self) {
4974 self.feature_flags.enable_accumulators = true;
4975 }
4976
4977 pub fn disable_accumulators_for_testing(&mut self) {
4978 self.feature_flags.enable_accumulators = false;
4979 self.feature_flags.enable_address_balance_gas_payments = false;
4980 }
4981
4982 pub fn enable_coin_reservation_for_testing(&mut self) {
4983 self.feature_flags.enable_coin_reservation_obj_refs = true;
4984 }
4985
4986 pub fn create_root_accumulator_object_for_testing(&mut self) {
4987 self.feature_flags.create_root_accumulator_object = true;
4988 }
4989
4990 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
4991 self.feature_flags.create_root_accumulator_object = false;
4992 }
4993
4994 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
4995 self.feature_flags.enable_accumulators = true;
4996 self.feature_flags.allow_private_accumulator_entrypoints = true;
4997 self.feature_flags.enable_address_balance_gas_payments = true;
4998 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4999 self.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
5000 }
5001
5002 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5003 self.feature_flags.enable_address_balance_gas_payments = false;
5004 }
5005
5006 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5007 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5008 }
5009
5010 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5011 self.enable_accumulators_for_testing();
5012 self.feature_flags.enable_authenticated_event_streams = true;
5013 self.feature_flags
5014 .include_checkpoint_artifacts_digest_in_summary = true;
5015 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5016 }
5017
5018 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5019 self.feature_flags.enable_authenticated_event_streams = false;
5020 }
5021
5022 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5023 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5024 }
5025
5026 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5027 self.feature_flags.enable_non_exclusive_writes = true;
5028 }
5029
5030 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5031 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5032 }
5033
5034 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5035 &mut self,
5036 val: bool,
5037 ) {
5038 self.feature_flags
5039 .ignore_execution_time_observations_after_certs_closed = val;
5040 }
5041
5042 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5043 &mut self,
5044 val: bool,
5045 ) {
5046 self.feature_flags
5047 .consensus_checkpoint_signature_key_includes_digest = val;
5048 }
5049
5050 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5051 self.feature_flags.cancel_for_failed_dkg_early = val;
5052 }
5053
5054 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5055 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5056 }
5057
5058 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5059 self.feature_flags.authority_capabilities_v2 = val;
5060 }
5061
5062 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5063 self.feature_flags.allow_references_in_ptbs = true;
5064 }
5065
5066 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5067 self.feature_flags.consensus_skip_gced_accept_votes = val;
5068 }
5069
5070 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5071 self.feature_flags.enable_object_funds_withdraw = val;
5072 }
5073
5074 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5075 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5076 }
5077}
5078
5079type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5080
5081thread_local! {
5082 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5083}
5084
5085#[must_use]
5086pub struct OverrideGuard;
5087
5088impl Drop for OverrideGuard {
5089 fn drop(&mut self) {
5090 info!("restoring override fn");
5091 CONFIG_OVERRIDE.with(|ovr| {
5092 *ovr.borrow_mut() = None;
5093 });
5094 }
5095}
5096
5097#[derive(PartialEq, Eq)]
5100pub enum LimitThresholdCrossed {
5101 None,
5102 Soft(u128, u128),
5103 Hard(u128, u128),
5104}
5105
5106pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5109 x: T,
5110 soft_limit: U,
5111 hard_limit: V,
5112) -> LimitThresholdCrossed {
5113 let x: V = x.into();
5114 let soft_limit: V = soft_limit.into();
5115
5116 debug_assert!(soft_limit <= hard_limit);
5117
5118 if x >= hard_limit {
5121 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5122 } else if x < soft_limit {
5123 LimitThresholdCrossed::None
5124 } else {
5125 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5126 }
5127}
5128
5129#[macro_export]
5130macro_rules! check_limit {
5131 ($x:expr, $hard:expr) => {
5132 check_limit!($x, $hard, $hard)
5133 };
5134 ($x:expr, $soft:expr, $hard:expr) => {
5135 check_limit_in_range($x as u64, $soft, $hard)
5136 };
5137}
5138
5139#[macro_export]
5143macro_rules! check_limit_by_meter {
5144 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5145 let (h, metered_str) = if $is_metered {
5147 ($metered_limit, "metered")
5148 } else {
5149 ($unmetered_hard_limit, "unmetered")
5151 };
5152 use sui_protocol_config::check_limit_in_range;
5153 let result = check_limit_in_range($x as u64, $metered_limit, h);
5154 match result {
5155 LimitThresholdCrossed::None => {}
5156 LimitThresholdCrossed::Soft(_, _) => {
5157 $metric.with_label_values(&[metered_str, "soft"]).inc();
5158 }
5159 LimitThresholdCrossed::Hard(_, _) => {
5160 $metric.with_label_values(&[metered_str, "hard"]).inc();
5161 }
5162 };
5163 result
5164 }};
5165}
5166#[cfg(all(test, not(msim)))]
5167mod test {
5168 use insta::assert_yaml_snapshot;
5169
5170 use super::*;
5171
5172 #[test]
5173 fn snapshot_tests() {
5174 println!("\n============================================================================");
5175 println!("! !");
5176 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5177 println!("! !");
5178 println!("============================================================================\n");
5179 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5180 let chain_str = match chain_id {
5184 Chain::Unknown => "".to_string(),
5185 _ => format!("{:?}_", chain_id),
5186 };
5187 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5188 let cur = ProtocolVersion::new(i);
5189 assert_yaml_snapshot!(
5190 format!("{}version_{}", chain_str, cur.as_u64()),
5191 ProtocolConfig::get_for_version(cur, *chain_id)
5192 );
5193 }
5194 }
5195 }
5196
5197 #[test]
5198 fn test_getters() {
5199 let prot: ProtocolConfig =
5200 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5201 assert_eq!(
5202 prot.max_arguments(),
5203 prot.max_arguments_as_option().unwrap()
5204 );
5205 }
5206
5207 #[test]
5208 fn test_setters() {
5209 let mut prot: ProtocolConfig =
5210 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5211 prot.set_max_arguments_for_testing(123);
5212 assert_eq!(prot.max_arguments(), 123);
5213
5214 prot.set_max_arguments_from_str_for_testing("321".to_string());
5215 assert_eq!(prot.max_arguments(), 321);
5216
5217 prot.disable_max_arguments_for_testing();
5218 assert_eq!(prot.max_arguments_as_option(), None);
5219
5220 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5221 assert_eq!(prot.max_arguments(), 456);
5222 }
5223
5224 #[test]
5225 #[should_panic(expected = "unsupported version")]
5226 fn max_version_test() {
5227 let _ = ProtocolConfig::get_for_version_impl(
5230 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5231 Chain::Unknown,
5232 );
5233 }
5234
5235 #[test]
5236 fn lookup_by_string_test() {
5237 let prot: ProtocolConfig =
5238 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5239 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5241
5242 assert!(
5243 prot.lookup_attr("max_arguments".to_string())
5244 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5245 );
5246
5247 assert!(
5249 prot.lookup_attr("max_move_identifier_len".to_string())
5250 .is_none()
5251 );
5252
5253 let prot: ProtocolConfig =
5255 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5256 assert!(
5257 prot.lookup_attr("max_move_identifier_len".to_string())
5258 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5259 );
5260
5261 let prot: ProtocolConfig =
5262 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5263 assert!(
5265 prot.attr_map()
5266 .get("max_move_identifier_len")
5267 .unwrap()
5268 .is_none()
5269 );
5270 assert!(
5272 prot.attr_map().get("max_arguments").unwrap()
5273 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5274 );
5275
5276 let prot: ProtocolConfig =
5278 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5279 assert!(
5281 prot.feature_flags
5282 .lookup_attr("some random string".to_owned())
5283 .is_none()
5284 );
5285 assert!(
5286 !prot
5287 .feature_flags
5288 .attr_map()
5289 .contains_key("some random string")
5290 );
5291
5292 assert!(
5294 prot.feature_flags
5295 .lookup_attr("package_upgrades".to_owned())
5296 == Some(false)
5297 );
5298 assert!(
5299 prot.feature_flags
5300 .attr_map()
5301 .get("package_upgrades")
5302 .unwrap()
5303 == &false
5304 );
5305 let prot: ProtocolConfig =
5306 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5307 assert!(
5309 prot.feature_flags
5310 .lookup_attr("package_upgrades".to_owned())
5311 == Some(true)
5312 );
5313 assert!(
5314 prot.feature_flags
5315 .attr_map()
5316 .get("package_upgrades")
5317 .unwrap()
5318 == &true
5319 );
5320 }
5321
5322 #[test]
5323 fn limit_range_fn_test() {
5324 let low = 100u32;
5325 let high = 10000u64;
5326
5327 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5328 assert!(matches!(
5329 check_limit!(255u16, low, high),
5330 LimitThresholdCrossed::Soft(255u128, 100)
5331 ));
5332 assert!(matches!(
5338 check_limit!(2550000u64, low, high),
5339 LimitThresholdCrossed::Hard(2550000, 10000)
5340 ));
5341
5342 assert!(matches!(
5343 check_limit!(2550000u64, high, high),
5344 LimitThresholdCrossed::Hard(2550000, 10000)
5345 ));
5346
5347 assert!(matches!(
5348 check_limit!(1u8, high),
5349 LimitThresholdCrossed::None
5350 ));
5351
5352 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5353
5354 assert!(matches!(
5355 check_limit!(2550000u64, high),
5356 LimitThresholdCrossed::Hard(2550000, 10000)
5357 ));
5358 }
5359}