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 = 119;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
312pub struct ProtocolVersion(u64);
313
314impl ProtocolVersion {
315 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
320
321 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
322
323 #[cfg(not(msim))]
324 pub const MAX_ALLOWED: Self = Self::MAX;
325
326 #[cfg(msim)]
328 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
329
330 pub fn new(v: u64) -> Self {
331 Self(v)
332 }
333
334 pub const fn as_u64(&self) -> u64 {
335 self.0
336 }
337
338 pub fn max() -> Self {
341 Self::MAX
342 }
343
344 pub fn prev(self) -> Self {
345 Self(self.0.checked_sub(1).unwrap())
346 }
347}
348
349impl From<u64> for ProtocolVersion {
350 fn from(v: u64) -> Self {
351 Self::new(v)
352 }
353}
354
355impl std::ops::Sub<u64> for ProtocolVersion {
356 type Output = Self;
357 fn sub(self, rhs: u64) -> Self::Output {
358 Self::new(self.0 - rhs)
359 }
360}
361
362impl std::ops::Add<u64> for ProtocolVersion {
363 type Output = Self;
364 fn add(self, rhs: u64) -> Self::Output {
365 Self::new(self.0 + rhs)
366 }
367}
368
369#[derive(
370 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
371)]
372pub enum Chain {
373 Mainnet,
374 Testnet,
375 #[default]
376 Unknown,
377}
378
379impl Chain {
380 pub fn as_str(self) -> &'static str {
381 match self {
382 Chain::Mainnet => "mainnet",
383 Chain::Testnet => "testnet",
384 Chain::Unknown => "unknown",
385 }
386 }
387}
388
389pub struct Error(pub String);
390
391#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
394struct FeatureFlags {
395 #[serde(skip_serializing_if = "is_false")]
398 package_upgrades: bool,
399 #[serde(skip_serializing_if = "is_false")]
402 commit_root_state_digest: bool,
403 #[serde(skip_serializing_if = "is_false")]
405 advance_epoch_start_time_in_safe_mode: bool,
406 #[serde(skip_serializing_if = "is_false")]
409 loaded_child_objects_fixed: bool,
410 #[serde(skip_serializing_if = "is_false")]
413 missing_type_is_compatibility_error: bool,
414 #[serde(skip_serializing_if = "is_false")]
417 scoring_decision_with_validity_cutoff: bool,
418
419 #[serde(skip_serializing_if = "is_false")]
422 consensus_order_end_of_epoch_last: bool,
423
424 #[serde(skip_serializing_if = "is_false")]
426 disallow_adding_abilities_on_upgrade: bool,
427 #[serde(skip_serializing_if = "is_false")]
429 disable_invariant_violation_check_in_swap_loc: bool,
430 #[serde(skip_serializing_if = "is_false")]
433 advance_to_highest_supported_protocol_version: bool,
434 #[serde(skip_serializing_if = "is_false")]
436 ban_entry_init: bool,
437 #[serde(skip_serializing_if = "is_false")]
439 package_digest_hash_module: bool,
440 #[serde(skip_serializing_if = "is_false")]
442 disallow_change_struct_type_params_on_upgrade: bool,
443 #[serde(skip_serializing_if = "is_false")]
445 no_extraneous_module_bytes: bool,
446 #[serde(skip_serializing_if = "is_false")]
448 narwhal_versioned_metadata: bool,
449
450 #[serde(skip_serializing_if = "is_false")]
452 zklogin_auth: bool,
453 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
455 consensus_transaction_ordering: ConsensusTransactionOrdering,
456
457 #[serde(skip_serializing_if = "is_false")]
465 simplified_unwrap_then_delete: bool,
466 #[serde(skip_serializing_if = "is_false")]
468 upgraded_multisig_supported: bool,
469 #[serde(skip_serializing_if = "is_false")]
471 txn_base_cost_as_multiplier: bool,
472
473 #[serde(skip_serializing_if = "is_false")]
475 shared_object_deletion: bool,
476
477 #[serde(skip_serializing_if = "is_false")]
479 narwhal_new_leader_election_schedule: bool,
480
481 #[serde(skip_serializing_if = "is_empty")]
483 zklogin_supported_providers: BTreeSet<String>,
484
485 #[serde(skip_serializing_if = "is_false")]
487 loaded_child_object_format: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
490 enable_jwk_consensus_updates: bool,
491
492 #[serde(skip_serializing_if = "is_false")]
493 end_of_epoch_transaction_supported: bool,
494
495 #[serde(skip_serializing_if = "is_false")]
498 simple_conservation_checks: bool,
499
500 #[serde(skip_serializing_if = "is_false")]
502 loaded_child_object_format_type: bool,
503
504 #[serde(skip_serializing_if = "is_false")]
506 receive_objects: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
510 consensus_checkpoint_signature_key_includes_digest: bool,
511
512 #[serde(skip_serializing_if = "is_false")]
514 random_beacon: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 bridge: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
521 enable_effects_v2: bool,
522
523 #[serde(skip_serializing_if = "is_false")]
525 narwhal_certificate_v2: bool,
526
527 #[serde(skip_serializing_if = "is_false")]
529 verify_legacy_zklogin_address: bool,
530
531 #[serde(skip_serializing_if = "is_false")]
533 throughput_aware_consensus_submission: bool,
534
535 #[serde(skip_serializing_if = "is_false")]
537 recompute_has_public_transfer_in_execution: bool,
538
539 #[serde(skip_serializing_if = "is_false")]
541 accept_zklogin_in_multisig: bool,
542
543 #[serde(skip_serializing_if = "is_false")]
545 accept_passkey_in_multisig: bool,
546
547 #[serde(skip_serializing_if = "is_false")]
549 validate_zklogin_public_identifier: bool,
550
551 #[serde(skip_serializing_if = "is_false")]
554 include_consensus_digest_in_prologue: bool,
555
556 #[serde(skip_serializing_if = "is_false")]
558 hardened_otw_check: bool,
559
560 #[serde(skip_serializing_if = "is_false")]
562 allow_receiving_object_id: bool,
563
564 #[serde(skip_serializing_if = "is_false")]
566 enable_poseidon: bool,
567
568 #[serde(skip_serializing_if = "is_false")]
570 enable_coin_deny_list: bool,
571
572 #[serde(skip_serializing_if = "is_false")]
574 enable_group_ops_native_functions: bool,
575
576 #[serde(skip_serializing_if = "is_false")]
578 enable_group_ops_native_function_msm: bool,
579
580 #[serde(skip_serializing_if = "is_false")]
582 enable_ristretto255_group_ops: bool,
583
584 #[serde(skip_serializing_if = "is_false")]
586 enable_nitro_attestation: bool,
587
588 #[serde(skip_serializing_if = "is_false")]
590 enable_nitro_attestation_upgraded_parsing: bool,
591
592 #[serde(skip_serializing_if = "is_false")]
594 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
595
596 #[serde(skip_serializing_if = "is_false")]
598 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
599
600 #[serde(skip_serializing_if = "is_false")]
602 reject_mutable_random_on_entry_functions: bool,
603
604 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
606 per_object_congestion_control_mode: PerObjectCongestionControlMode,
607
608 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
610 consensus_choice: ConsensusChoice,
611
612 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
614 consensus_network: ConsensusNetwork,
615
616 #[serde(skip_serializing_if = "is_false")]
618 correct_gas_payment_limit_check: bool,
619
620 #[serde(skip_serializing_if = "Option::is_none")]
622 zklogin_max_epoch_upper_bound_delta: Option<u64>,
623
624 #[serde(skip_serializing_if = "is_false")]
626 mysticeti_leader_scoring_and_schedule: bool,
627
628 #[serde(skip_serializing_if = "is_false")]
630 reshare_at_same_initial_version: bool,
631
632 #[serde(skip_serializing_if = "is_false")]
634 resolve_abort_locations_to_package_id: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
640 mysticeti_use_committed_subdag_digest: bool,
641
642 #[serde(skip_serializing_if = "is_false")]
644 enable_vdf: bool,
645
646 #[serde(skip_serializing_if = "is_false")]
651 record_consensus_determined_version_assignments_in_prologue: bool,
652 #[serde(skip_serializing_if = "is_false")]
653 record_consensus_determined_version_assignments_in_prologue_v2: bool,
654
655 #[serde(skip_serializing_if = "is_false")]
657 fresh_vm_on_framework_upgrade: bool,
658
659 #[serde(skip_serializing_if = "is_false")]
667 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
668
669 #[serde(skip_serializing_if = "Option::is_none")]
671 mysticeti_num_leaders_per_round: Option<usize>,
672
673 #[serde(skip_serializing_if = "is_false")]
675 soft_bundle: bool,
676
677 #[serde(skip_serializing_if = "is_false")]
679 enable_coin_deny_list_v2: bool,
680
681 #[serde(skip_serializing_if = "is_false")]
683 passkey_auth: bool,
684
685 #[serde(skip_serializing_if = "is_false")]
687 authority_capabilities_v2: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 rethrow_serialization_type_layout_errors: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
695 consensus_distributed_vote_scoring_strategy: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
699 consensus_round_prober: bool,
700
701 #[serde(skip_serializing_if = "is_false")]
703 validate_identifier_inputs: bool,
704
705 #[serde(skip_serializing_if = "is_false")]
707 disallow_self_identifier: bool,
708
709 #[serde(skip_serializing_if = "is_false")]
711 mysticeti_fastpath: bool,
712
713 #[serde(skip_serializing_if = "is_false")]
717 disable_preconsensus_locking: bool,
718
719 #[serde(skip_serializing_if = "is_false")]
721 relocate_event_module: bool,
722
723 #[serde(skip_serializing_if = "is_false")]
725 uncompressed_g1_group_elements: bool,
726
727 #[serde(skip_serializing_if = "is_false")]
728 disallow_new_modules_in_deps_only_packages: bool,
729
730 #[serde(skip_serializing_if = "is_false")]
732 consensus_smart_ancestor_selection: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
736 consensus_round_prober_probe_accepted_rounds: bool,
737
738 #[serde(skip_serializing_if = "is_false")]
740 native_charging_v2: bool,
741
742 #[serde(skip_serializing_if = "is_false")]
745 consensus_linearize_subdag_v2: bool,
746
747 #[serde(skip_serializing_if = "is_false")]
749 convert_type_argument_error: bool,
750
751 #[serde(skip_serializing_if = "is_false")]
753 variant_nodes: bool,
754
755 #[serde(skip_serializing_if = "is_false")]
757 consensus_zstd_compression: bool,
758
759 #[serde(skip_serializing_if = "is_false")]
761 minimize_child_object_mutations: bool,
762
763 #[serde(skip_serializing_if = "is_false")]
765 record_additional_state_digest_in_prologue: bool,
766
767 #[serde(skip_serializing_if = "is_false")]
769 move_native_context: bool,
770
771 #[serde(skip_serializing_if = "is_false")]
774 consensus_median_based_commit_timestamp: bool,
775
776 #[serde(skip_serializing_if = "is_false")]
779 normalize_ptb_arguments: bool,
780
781 #[serde(skip_serializing_if = "is_false")]
783 consensus_batched_block_sync: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 enforce_checkpoint_timestamp_monotonicity: bool,
788
789 #[serde(skip_serializing_if = "is_false")]
791 max_ptb_value_size_v2: bool,
792
793 #[serde(skip_serializing_if = "is_false")]
795 resolve_type_input_ids_to_defining_id: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
799 enable_party_transfer: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
803 allow_unbounded_system_objects: bool,
804
805 #[serde(skip_serializing_if = "is_false")]
807 type_tags_in_object_runtime: bool,
808
809 #[serde(skip_serializing_if = "is_false")]
811 enable_accumulators: bool,
812
813 #[serde(skip_serializing_if = "is_false")]
815 enable_coin_reservation_obj_refs: bool,
816
817 #[serde(skip_serializing_if = "is_false")]
820 create_root_accumulator_object: bool,
821
822 #[serde(skip_serializing_if = "is_false")]
824 enable_authenticated_event_streams: bool,
825
826 #[serde(skip_serializing_if = "is_false")]
828 enable_address_balance_gas_payments: bool,
829
830 #[serde(skip_serializing_if = "is_false")]
832 address_balance_gas_check_rgp_at_signing: bool,
833
834 #[serde(skip_serializing_if = "is_false")]
835 address_balance_gas_reject_gas_coin_arg: bool,
836
837 #[serde(skip_serializing_if = "is_false")]
839 enable_multi_epoch_transaction_expiration: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 relax_valid_during_for_owned_inputs: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
847 enable_ptb_execution_v2: bool,
848
849 #[serde(skip_serializing_if = "is_false")]
851 better_adapter_type_resolution_errors: bool,
852
853 #[serde(skip_serializing_if = "is_false")]
855 record_time_estimate_processed: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 dependency_linkage_error: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 additional_multisig_checks: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
867 ignore_execution_time_observations_after_certs_closed: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
873 debug_fatal_on_move_invariant_violation: bool,
874
875 #[serde(skip_serializing_if = "is_false")]
878 allow_private_accumulator_entrypoints: bool,
879
880 #[serde(skip_serializing_if = "is_false")]
882 additional_consensus_digest_indirect_state: bool,
883
884 #[serde(skip_serializing_if = "is_false")]
886 check_for_init_during_upgrade: bool,
887
888 #[serde(skip_serializing_if = "is_false")]
890 per_command_shared_object_transfer_rules: bool,
891
892 #[serde(skip_serializing_if = "is_false")]
894 include_checkpoint_artifacts_digest_in_summary: bool,
895
896 #[serde(skip_serializing_if = "is_false")]
898 use_mfp_txns_in_load_initial_object_debts: bool,
899
900 #[serde(skip_serializing_if = "is_false")]
902 cancel_for_failed_dkg_early: bool,
903
904 #[serde(skip_serializing_if = "is_false")]
906 enable_coin_registry: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 abstract_size_in_object_runtime: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 object_runtime_charge_cache_load_gas: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
918 additional_borrow_checks: bool,
919
920 #[serde(skip_serializing_if = "is_false")]
922 use_new_commit_handler: bool,
923
924 #[serde(skip_serializing_if = "is_false")]
926 better_loader_errors: bool,
927
928 #[serde(skip_serializing_if = "is_false")]
930 generate_df_type_layouts: bool,
931
932 #[serde(skip_serializing_if = "is_false")]
934 allow_references_in_ptbs: bool,
935
936 #[serde(skip_serializing_if = "is_false")]
938 enable_display_registry: bool,
939
940 #[serde(skip_serializing_if = "is_false")]
942 private_generics_verifier_v2: bool,
943
944 #[serde(skip_serializing_if = "is_false")]
946 deprecate_global_storage_ops_during_deserialization: bool,
947
948 #[serde(skip_serializing_if = "is_false")]
951 enable_non_exclusive_writes: bool,
952
953 #[serde(skip_serializing_if = "is_false")]
955 deprecate_global_storage_ops: bool,
956
957 #[serde(skip_serializing_if = "is_false")]
959 normalize_depth_formula: bool,
960
961 #[serde(skip_serializing_if = "is_false")]
963 consensus_skip_gced_accept_votes: bool,
964
965 #[serde(skip_serializing_if = "is_false")]
967 include_cancelled_randomness_txns_in_prologue: bool,
968
969 #[serde(skip_serializing_if = "is_false")]
971 address_aliases: bool,
972
973 #[serde(skip_serializing_if = "is_false")]
976 fix_checkpoint_signature_mapping: bool,
977
978 #[serde(skip_serializing_if = "is_false")]
980 enable_object_funds_withdraw: bool,
981
982 #[serde(skip_serializing_if = "is_false")]
984 consensus_skip_gced_blocks_in_direct_finalization: bool,
985
986 #[serde(skip_serializing_if = "is_false")]
988 gas_rounding_halve_digits: bool,
989
990 #[serde(skip_serializing_if = "is_false")]
992 flexible_tx_context_positions: bool,
993
994 #[serde(skip_serializing_if = "is_false")]
996 disable_entry_point_signature_check: bool,
997
998 #[serde(skip_serializing_if = "is_false")]
1000 convert_withdrawal_compatibility_ptb_arguments: bool,
1001
1002 #[serde(skip_serializing_if = "is_false")]
1004 restrict_hot_or_not_entry_functions: bool,
1005
1006 #[serde(skip_serializing_if = "is_false")]
1008 split_checkpoints_in_consensus_handler: bool,
1009
1010 #[serde(skip_serializing_if = "is_false")]
1012 consensus_always_accept_system_transactions: bool,
1013
1014 #[serde(skip_serializing_if = "is_false")]
1016 validator_metadata_verify_v2: bool,
1017
1018 #[serde(skip_serializing_if = "is_false")]
1021 defer_unpaid_amplification: bool,
1022
1023 #[serde(skip_serializing_if = "is_false")]
1024 randomize_checkpoint_tx_limit_in_tests: bool,
1025
1026 #[serde(skip_serializing_if = "is_false")]
1028 gasless_transaction_drop_safety: bool,
1029
1030 #[serde(skip_serializing_if = "is_false")]
1032 merge_randomness_into_checkpoint: bool,
1033}
1034
1035fn is_false(b: &bool) -> bool {
1036 !b
1037}
1038
1039fn is_empty(b: &BTreeSet<String>) -> bool {
1040 b.is_empty()
1041}
1042
1043fn is_zero(val: &u64) -> bool {
1044 *val == 0
1045}
1046
1047#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1049pub enum ConsensusTransactionOrdering {
1050 #[default]
1052 None,
1053 ByGasPrice,
1055}
1056
1057impl ConsensusTransactionOrdering {
1058 pub fn is_none(&self) -> bool {
1059 matches!(self, ConsensusTransactionOrdering::None)
1060 }
1061}
1062
1063#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1064pub struct ExecutionTimeEstimateParams {
1065 pub target_utilization: u64,
1067 pub allowed_txn_cost_overage_burst_limit_us: u64,
1071
1072 pub randomness_scalar: u64,
1075
1076 pub max_estimate_us: u64,
1078
1079 pub stored_observations_num_included_checkpoints: u64,
1082
1083 pub stored_observations_limit: u64,
1085
1086 #[serde(skip_serializing_if = "is_zero")]
1089 pub stake_weighted_median_threshold: u64,
1090
1091 #[serde(skip_serializing_if = "is_false")]
1095 pub default_none_duration_for_new_keys: bool,
1096
1097 #[serde(skip_serializing_if = "Option::is_none")]
1099 pub observations_chunk_size: Option<u64>,
1100}
1101
1102#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1104pub enum PerObjectCongestionControlMode {
1105 #[default]
1106 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1112
1113impl PerObjectCongestionControlMode {
1114 pub fn is_none(&self) -> bool {
1115 matches!(self, PerObjectCongestionControlMode::None)
1116 }
1117}
1118
1119#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1121pub enum ConsensusChoice {
1122 #[default]
1123 Narwhal,
1124 SwapEachEpoch,
1125 Mysticeti,
1126}
1127
1128impl ConsensusChoice {
1129 pub fn is_narwhal(&self) -> bool {
1130 matches!(self, ConsensusChoice::Narwhal)
1131 }
1132}
1133
1134#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1136pub enum ConsensusNetwork {
1137 #[default]
1138 Anemo,
1139 Tonic,
1140}
1141
1142impl ConsensusNetwork {
1143 pub fn is_anemo(&self) -> bool {
1144 matches!(self, ConsensusNetwork::Anemo)
1145 }
1146}
1147
1148#[skip_serializing_none]
1180#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1181pub struct ProtocolConfig {
1182 pub version: ProtocolVersion,
1183
1184 feature_flags: FeatureFlags,
1185
1186 max_tx_size_bytes: Option<u64>,
1189
1190 max_input_objects: Option<u64>,
1192
1193 max_size_written_objects: Option<u64>,
1197 max_size_written_objects_system_tx: Option<u64>,
1200
1201 max_serialized_tx_effects_size_bytes: Option<u64>,
1203
1204 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1206
1207 max_gas_payment_objects: Option<u32>,
1209
1210 max_modules_in_publish: Option<u32>,
1212
1213 max_package_dependencies: Option<u32>,
1215
1216 max_arguments: Option<u32>,
1219
1220 max_type_arguments: Option<u32>,
1222
1223 max_type_argument_depth: Option<u32>,
1225
1226 max_pure_argument_size: Option<u32>,
1228
1229 max_programmable_tx_commands: Option<u32>,
1231
1232 move_binary_format_version: Option<u32>,
1235 min_move_binary_format_version: Option<u32>,
1236
1237 binary_module_handles: Option<u16>,
1239 binary_struct_handles: Option<u16>,
1240 binary_function_handles: Option<u16>,
1241 binary_function_instantiations: Option<u16>,
1242 binary_signatures: Option<u16>,
1243 binary_constant_pool: Option<u16>,
1244 binary_identifiers: Option<u16>,
1245 binary_address_identifiers: Option<u16>,
1246 binary_struct_defs: Option<u16>,
1247 binary_struct_def_instantiations: Option<u16>,
1248 binary_function_defs: Option<u16>,
1249 binary_field_handles: Option<u16>,
1250 binary_field_instantiations: Option<u16>,
1251 binary_friend_decls: Option<u16>,
1252 binary_enum_defs: Option<u16>,
1253 binary_enum_def_instantiations: Option<u16>,
1254 binary_variant_handles: Option<u16>,
1255 binary_variant_instantiation_handles: Option<u16>,
1256
1257 max_move_object_size: Option<u64>,
1259
1260 max_move_package_size: Option<u64>,
1263
1264 max_publish_or_upgrade_per_ptb: Option<u64>,
1266
1267 max_tx_gas: Option<u64>,
1269
1270 max_gas_price: Option<u64>,
1272
1273 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1276
1277 max_gas_computation_bucket: Option<u64>,
1279
1280 gas_rounding_step: Option<u64>,
1282
1283 max_loop_depth: Option<u64>,
1285
1286 max_generic_instantiation_length: Option<u64>,
1288
1289 max_function_parameters: Option<u64>,
1291
1292 max_basic_blocks: Option<u64>,
1294
1295 max_value_stack_size: Option<u64>,
1297
1298 max_type_nodes: Option<u64>,
1300
1301 max_push_size: Option<u64>,
1303
1304 max_struct_definitions: Option<u64>,
1306
1307 max_function_definitions: Option<u64>,
1309
1310 max_fields_in_struct: Option<u64>,
1312
1313 max_dependency_depth: Option<u64>,
1315
1316 max_num_event_emit: Option<u64>,
1318
1319 max_num_new_move_object_ids: Option<u64>,
1321
1322 max_num_new_move_object_ids_system_tx: Option<u64>,
1324
1325 max_num_deleted_move_object_ids: Option<u64>,
1327
1328 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1330
1331 max_num_transferred_move_object_ids: Option<u64>,
1333
1334 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1336
1337 max_event_emit_size: Option<u64>,
1339
1340 max_event_emit_size_total: Option<u64>,
1342
1343 max_move_vector_len: Option<u64>,
1345
1346 max_move_identifier_len: Option<u64>,
1348
1349 max_move_value_depth: Option<u64>,
1351
1352 max_move_enum_variants: Option<u64>,
1354
1355 max_back_edges_per_function: Option<u64>,
1357
1358 max_back_edges_per_module: Option<u64>,
1360
1361 max_verifier_meter_ticks_per_function: Option<u64>,
1363
1364 max_meter_ticks_per_module: Option<u64>,
1366
1367 max_meter_ticks_per_package: Option<u64>,
1369
1370 object_runtime_max_num_cached_objects: Option<u64>,
1374
1375 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1377
1378 object_runtime_max_num_store_entries: Option<u64>,
1380
1381 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1383
1384 base_tx_cost_fixed: Option<u64>,
1387
1388 package_publish_cost_fixed: Option<u64>,
1391
1392 base_tx_cost_per_byte: Option<u64>,
1395
1396 package_publish_cost_per_byte: Option<u64>,
1398
1399 obj_access_cost_read_per_byte: Option<u64>,
1401
1402 obj_access_cost_mutate_per_byte: Option<u64>,
1404
1405 obj_access_cost_delete_per_byte: Option<u64>,
1407
1408 obj_access_cost_verify_per_byte: Option<u64>,
1418
1419 max_type_to_layout_nodes: Option<u64>,
1421
1422 max_ptb_value_size: Option<u64>,
1424
1425 gas_model_version: Option<u64>,
1428
1429 obj_data_cost_refundable: Option<u64>,
1432
1433 obj_metadata_cost_non_refundable: Option<u64>,
1437
1438 storage_rebate_rate: Option<u64>,
1444
1445 storage_fund_reinvest_rate: Option<u64>,
1448
1449 reward_slashing_rate: Option<u64>,
1452
1453 storage_gas_price: Option<u64>,
1455
1456 accumulator_object_storage_cost: Option<u64>,
1458
1459 max_transactions_per_checkpoint: Option<u64>,
1464
1465 max_checkpoint_size_bytes: Option<u64>,
1469
1470 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1475
1476 address_from_bytes_cost_base: Option<u64>,
1481 address_to_u256_cost_base: Option<u64>,
1483 address_from_u256_cost_base: Option<u64>,
1485
1486 config_read_setting_impl_cost_base: Option<u64>,
1491 config_read_setting_impl_cost_per_byte: Option<u64>,
1492
1493 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1496 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1497 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1498 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1499 dynamic_field_add_child_object_cost_base: Option<u64>,
1501 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1502 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1503 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1504 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1506 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1507 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1508 dynamic_field_remove_child_object_cost_base: Option<u64>,
1510 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1511 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1512 dynamic_field_has_child_object_cost_base: Option<u64>,
1514 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1516 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1517 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1518
1519 event_emit_cost_base: Option<u64>,
1522 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1523 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1524 event_emit_output_cost_per_byte: Option<u64>,
1525 event_emit_auth_stream_cost: Option<u64>,
1526
1527 object_borrow_uid_cost_base: Option<u64>,
1530 object_delete_impl_cost_base: Option<u64>,
1532 object_record_new_uid_cost_base: Option<u64>,
1534
1535 transfer_transfer_internal_cost_base: Option<u64>,
1538 transfer_party_transfer_internal_cost_base: Option<u64>,
1540 transfer_freeze_object_cost_base: Option<u64>,
1542 transfer_share_object_cost_base: Option<u64>,
1544 transfer_receive_object_cost_base: Option<u64>,
1547
1548 tx_context_derive_id_cost_base: Option<u64>,
1551 tx_context_fresh_id_cost_base: Option<u64>,
1552 tx_context_sender_cost_base: Option<u64>,
1553 tx_context_epoch_cost_base: Option<u64>,
1554 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1555 tx_context_sponsor_cost_base: Option<u64>,
1556 tx_context_rgp_cost_base: Option<u64>,
1557 tx_context_gas_price_cost_base: Option<u64>,
1558 tx_context_gas_budget_cost_base: Option<u64>,
1559 tx_context_ids_created_cost_base: Option<u64>,
1560 tx_context_replace_cost_base: Option<u64>,
1561
1562 types_is_one_time_witness_cost_base: Option<u64>,
1565 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1566 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1567
1568 validator_validate_metadata_cost_base: Option<u64>,
1571 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1572
1573 crypto_invalid_arguments_cost: Option<u64>,
1575 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1577 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1578 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1579
1580 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1582 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1583 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1584
1585 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1587 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1588 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1589 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1590 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1591 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1592
1593 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1595
1596 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1598 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1599 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1600 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1601 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1602 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1603
1604 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1606 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1607 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1608 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1609 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1610 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1611
1612 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1614 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1615 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1616 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1617 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1618 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1619
1620 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1622 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1623 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1624
1625 ed25519_ed25519_verify_cost_base: Option<u64>,
1627 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1628 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1629
1630 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1632 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1633
1634 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1636 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1637 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1638 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1639 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1640
1641 hash_blake2b256_cost_base: Option<u64>,
1643 hash_blake2b256_data_cost_per_byte: Option<u64>,
1644 hash_blake2b256_data_cost_per_block: Option<u64>,
1645
1646 hash_keccak256_cost_base: Option<u64>,
1648 hash_keccak256_data_cost_per_byte: Option<u64>,
1649 hash_keccak256_data_cost_per_block: Option<u64>,
1650
1651 poseidon_bn254_cost_base: Option<u64>,
1653 poseidon_bn254_cost_per_block: Option<u64>,
1654
1655 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1657 group_ops_bls12381_decode_g1_cost: Option<u64>,
1658 group_ops_bls12381_decode_g2_cost: Option<u64>,
1659 group_ops_bls12381_decode_gt_cost: Option<u64>,
1660 group_ops_bls12381_scalar_add_cost: Option<u64>,
1661 group_ops_bls12381_g1_add_cost: Option<u64>,
1662 group_ops_bls12381_g2_add_cost: Option<u64>,
1663 group_ops_bls12381_gt_add_cost: Option<u64>,
1664 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1665 group_ops_bls12381_g1_sub_cost: Option<u64>,
1666 group_ops_bls12381_g2_sub_cost: Option<u64>,
1667 group_ops_bls12381_gt_sub_cost: Option<u64>,
1668 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1669 group_ops_bls12381_g1_mul_cost: Option<u64>,
1670 group_ops_bls12381_g2_mul_cost: Option<u64>,
1671 group_ops_bls12381_gt_mul_cost: Option<u64>,
1672 group_ops_bls12381_scalar_div_cost: Option<u64>,
1673 group_ops_bls12381_g1_div_cost: Option<u64>,
1674 group_ops_bls12381_g2_div_cost: Option<u64>,
1675 group_ops_bls12381_gt_div_cost: Option<u64>,
1676 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1677 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1678 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1679 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1680 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1681 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1682 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1683 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1684 group_ops_bls12381_msm_max_len: Option<u32>,
1685 group_ops_bls12381_pairing_cost: Option<u64>,
1686 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1687 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1688 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1689 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1690 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1691
1692 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1693 group_ops_ristretto_decode_point_cost: Option<u64>,
1694 group_ops_ristretto_scalar_add_cost: Option<u64>,
1695 group_ops_ristretto_point_add_cost: Option<u64>,
1696 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1697 group_ops_ristretto_point_sub_cost: Option<u64>,
1698 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1699 group_ops_ristretto_point_mul_cost: Option<u64>,
1700 group_ops_ristretto_scalar_div_cost: Option<u64>,
1701 group_ops_ristretto_point_div_cost: Option<u64>,
1702
1703 hmac_hmac_sha3_256_cost_base: Option<u64>,
1705 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1706 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1707
1708 check_zklogin_id_cost_base: Option<u64>,
1710 check_zklogin_issuer_cost_base: Option<u64>,
1712
1713 vdf_verify_vdf_cost: Option<u64>,
1714 vdf_hash_to_input_cost: Option<u64>,
1715
1716 nitro_attestation_parse_base_cost: Option<u64>,
1718 nitro_attestation_parse_cost_per_byte: Option<u64>,
1719 nitro_attestation_verify_base_cost: Option<u64>,
1720 nitro_attestation_verify_cost_per_cert: Option<u64>,
1721
1722 bcs_per_byte_serialized_cost: Option<u64>,
1724 bcs_legacy_min_output_size_cost: Option<u64>,
1725 bcs_failure_cost: Option<u64>,
1726
1727 hash_sha2_256_base_cost: Option<u64>,
1728 hash_sha2_256_per_byte_cost: Option<u64>,
1729 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1730 hash_sha3_256_base_cost: Option<u64>,
1731 hash_sha3_256_per_byte_cost: Option<u64>,
1732 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1733 type_name_get_base_cost: Option<u64>,
1734 type_name_get_per_byte_cost: Option<u64>,
1735 type_name_id_base_cost: Option<u64>,
1736
1737 string_check_utf8_base_cost: Option<u64>,
1738 string_check_utf8_per_byte_cost: Option<u64>,
1739 string_is_char_boundary_base_cost: Option<u64>,
1740 string_sub_string_base_cost: Option<u64>,
1741 string_sub_string_per_byte_cost: Option<u64>,
1742 string_index_of_base_cost: Option<u64>,
1743 string_index_of_per_byte_pattern_cost: Option<u64>,
1744 string_index_of_per_byte_searched_cost: Option<u64>,
1745
1746 vector_empty_base_cost: Option<u64>,
1747 vector_length_base_cost: Option<u64>,
1748 vector_push_back_base_cost: Option<u64>,
1749 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1750 vector_borrow_base_cost: Option<u64>,
1751 vector_pop_back_base_cost: Option<u64>,
1752 vector_destroy_empty_base_cost: Option<u64>,
1753 vector_swap_base_cost: Option<u64>,
1754 debug_print_base_cost: Option<u64>,
1755 debug_print_stack_trace_base_cost: Option<u64>,
1756
1757 execution_version: Option<u64>,
1766
1767 consensus_bad_nodes_stake_threshold: Option<u64>,
1771
1772 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1773 max_age_of_jwk_in_epochs: Option<u64>,
1777
1778 random_beacon_reduction_allowed_delta: Option<u16>,
1782
1783 random_beacon_reduction_lower_bound: Option<u32>,
1786
1787 random_beacon_dkg_timeout_round: Option<u32>,
1790
1791 random_beacon_min_round_interval_ms: Option<u64>,
1793
1794 random_beacon_dkg_version: Option<u64>,
1797
1798 consensus_max_transaction_size_bytes: Option<u64>,
1801 consensus_max_transactions_in_block_bytes: Option<u64>,
1803 consensus_max_num_transactions_in_block: Option<u64>,
1805
1806 consensus_voting_rounds: Option<u32>,
1808
1809 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1811
1812 max_deferral_rounds_for_congestion_control: Option<u64>,
1815
1816 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1818
1819 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1821
1822 min_checkpoint_interval_ms: Option<u64>,
1824
1825 checkpoint_summary_version_specific_data: Option<u64>,
1827
1828 max_soft_bundle_size: Option<u64>,
1830
1831 bridge_should_try_to_finalize_committee: Option<bool>,
1835
1836 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1842
1843 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1846
1847 consensus_gc_depth: Option<u32>,
1850
1851 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1853
1854 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1856
1857 sip_45_consensus_amplification_threshold: Option<u64>,
1860
1861 use_object_per_epoch_marker_table_v2: Option<bool>,
1864
1865 consensus_commit_rate_estimation_window_size: Option<u32>,
1867
1868 #[serde(skip_serializing_if = "Vec::is_empty")]
1872 aliased_addresses: Vec<AliasedAddress>,
1873
1874 translation_per_command_base_charge: Option<u64>,
1877
1878 translation_per_input_base_charge: Option<u64>,
1881
1882 translation_pure_input_per_byte_charge: Option<u64>,
1884
1885 translation_per_type_node_charge: Option<u64>,
1889
1890 translation_per_reference_node_charge: Option<u64>,
1893
1894 translation_per_linkage_entry_charge: Option<u64>,
1897
1898 max_updates_per_settlement_txn: Option<u32>,
1900}
1901
1902#[derive(Clone, Serialize, Deserialize, Debug)]
1904pub struct AliasedAddress {
1905 pub original: [u8; 32],
1907 pub aliased: [u8; 32],
1909 pub allowed_tx_digests: Vec<[u8; 32]>,
1911}
1912
1913impl ProtocolConfig {
1915 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1928 if self.feature_flags.package_upgrades {
1929 Ok(())
1930 } else {
1931 Err(Error(format!(
1932 "package upgrades are not supported at {:?}",
1933 self.version
1934 )))
1935 }
1936 }
1937
1938 pub fn allow_receiving_object_id(&self) -> bool {
1939 self.feature_flags.allow_receiving_object_id
1940 }
1941
1942 pub fn receiving_objects_supported(&self) -> bool {
1943 self.feature_flags.receive_objects
1944 }
1945
1946 pub fn package_upgrades_supported(&self) -> bool {
1947 self.feature_flags.package_upgrades
1948 }
1949
1950 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1951 self.feature_flags.commit_root_state_digest
1952 }
1953
1954 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1955 self.feature_flags.advance_epoch_start_time_in_safe_mode
1956 }
1957
1958 pub fn loaded_child_objects_fixed(&self) -> bool {
1959 self.feature_flags.loaded_child_objects_fixed
1960 }
1961
1962 pub fn missing_type_is_compatibility_error(&self) -> bool {
1963 self.feature_flags.missing_type_is_compatibility_error
1964 }
1965
1966 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1967 self.feature_flags.scoring_decision_with_validity_cutoff
1968 }
1969
1970 pub fn narwhal_versioned_metadata(&self) -> bool {
1971 self.feature_flags.narwhal_versioned_metadata
1972 }
1973
1974 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1975 self.feature_flags.consensus_order_end_of_epoch_last
1976 }
1977
1978 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1979 self.feature_flags.disallow_adding_abilities_on_upgrade
1980 }
1981
1982 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1983 self.feature_flags
1984 .disable_invariant_violation_check_in_swap_loc
1985 }
1986
1987 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1988 self.feature_flags
1989 .advance_to_highest_supported_protocol_version
1990 }
1991
1992 pub fn ban_entry_init(&self) -> bool {
1993 self.feature_flags.ban_entry_init
1994 }
1995
1996 pub fn package_digest_hash_module(&self) -> bool {
1997 self.feature_flags.package_digest_hash_module
1998 }
1999
2000 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2001 self.feature_flags
2002 .disallow_change_struct_type_params_on_upgrade
2003 }
2004
2005 pub fn no_extraneous_module_bytes(&self) -> bool {
2006 self.feature_flags.no_extraneous_module_bytes
2007 }
2008
2009 pub fn zklogin_auth(&self) -> bool {
2010 self.feature_flags.zklogin_auth
2011 }
2012
2013 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2014 &self.feature_flags.zklogin_supported_providers
2015 }
2016
2017 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2018 self.feature_flags.consensus_transaction_ordering
2019 }
2020
2021 pub fn simplified_unwrap_then_delete(&self) -> bool {
2022 self.feature_flags.simplified_unwrap_then_delete
2023 }
2024
2025 pub fn supports_upgraded_multisig(&self) -> bool {
2026 self.feature_flags.upgraded_multisig_supported
2027 }
2028
2029 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2030 self.feature_flags.txn_base_cost_as_multiplier
2031 }
2032
2033 pub fn shared_object_deletion(&self) -> bool {
2034 self.feature_flags.shared_object_deletion
2035 }
2036
2037 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2038 self.feature_flags.narwhal_new_leader_election_schedule
2039 }
2040
2041 pub fn loaded_child_object_format(&self) -> bool {
2042 self.feature_flags.loaded_child_object_format
2043 }
2044
2045 pub fn enable_jwk_consensus_updates(&self) -> bool {
2046 let ret = self.feature_flags.enable_jwk_consensus_updates;
2047 if ret {
2048 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2050 }
2051 ret
2052 }
2053
2054 pub fn simple_conservation_checks(&self) -> bool {
2055 self.feature_flags.simple_conservation_checks
2056 }
2057
2058 pub fn loaded_child_object_format_type(&self) -> bool {
2059 self.feature_flags.loaded_child_object_format_type
2060 }
2061
2062 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2063 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2064 if !ret {
2065 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2067 }
2068 ret
2069 }
2070
2071 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2072 self.feature_flags
2073 .recompute_has_public_transfer_in_execution
2074 }
2075
2076 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2078 self.enable_jwk_consensus_updates()
2079 }
2080
2081 pub fn random_beacon(&self) -> bool {
2082 self.feature_flags.random_beacon
2083 }
2084
2085 pub fn dkg_version(&self) -> u64 {
2086 self.random_beacon_dkg_version.unwrap_or(1)
2088 }
2089
2090 pub fn enable_bridge(&self) -> bool {
2091 let ret = self.feature_flags.bridge;
2092 if ret {
2093 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2095 }
2096 ret
2097 }
2098
2099 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2100 if !self.enable_bridge() {
2101 return false;
2102 }
2103 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2105 }
2106
2107 pub fn enable_effects_v2(&self) -> bool {
2108 self.feature_flags.enable_effects_v2
2109 }
2110
2111 pub fn narwhal_certificate_v2(&self) -> bool {
2112 self.feature_flags.narwhal_certificate_v2
2113 }
2114
2115 pub fn verify_legacy_zklogin_address(&self) -> bool {
2116 self.feature_flags.verify_legacy_zklogin_address
2117 }
2118
2119 pub fn accept_zklogin_in_multisig(&self) -> bool {
2120 self.feature_flags.accept_zklogin_in_multisig
2121 }
2122
2123 pub fn accept_passkey_in_multisig(&self) -> bool {
2124 self.feature_flags.accept_passkey_in_multisig
2125 }
2126
2127 pub fn validate_zklogin_public_identifier(&self) -> bool {
2128 self.feature_flags.validate_zklogin_public_identifier
2129 }
2130
2131 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2132 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2133 }
2134
2135 pub fn throughput_aware_consensus_submission(&self) -> bool {
2136 self.feature_flags.throughput_aware_consensus_submission
2137 }
2138
2139 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2140 self.feature_flags.include_consensus_digest_in_prologue
2141 }
2142
2143 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2144 self.feature_flags
2145 .record_consensus_determined_version_assignments_in_prologue
2146 }
2147
2148 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2149 self.feature_flags
2150 .record_additional_state_digest_in_prologue
2151 }
2152
2153 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2154 self.feature_flags
2155 .record_consensus_determined_version_assignments_in_prologue_v2
2156 }
2157
2158 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2159 self.feature_flags
2160 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2161 }
2162
2163 pub fn hardened_otw_check(&self) -> bool {
2164 self.feature_flags.hardened_otw_check
2165 }
2166
2167 pub fn enable_poseidon(&self) -> bool {
2168 self.feature_flags.enable_poseidon
2169 }
2170
2171 pub fn enable_coin_deny_list_v1(&self) -> bool {
2172 self.feature_flags.enable_coin_deny_list
2173 }
2174
2175 pub fn enable_accumulators(&self) -> bool {
2176 self.feature_flags.enable_accumulators
2177 }
2178
2179 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2180 self.feature_flags.enable_coin_reservation_obj_refs
2181 }
2182
2183 pub fn create_root_accumulator_object(&self) -> bool {
2184 self.feature_flags.create_root_accumulator_object
2185 }
2186
2187 pub fn enable_address_balance_gas_payments(&self) -> bool {
2188 self.feature_flags.enable_address_balance_gas_payments
2189 }
2190
2191 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2192 self.feature_flags.address_balance_gas_check_rgp_at_signing
2193 }
2194
2195 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2196 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2197 }
2198
2199 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2200 self.feature_flags.enable_multi_epoch_transaction_expiration
2201 }
2202
2203 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2204 self.feature_flags.relax_valid_during_for_owned_inputs
2205 }
2206
2207 pub fn enable_authenticated_event_streams(&self) -> bool {
2208 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2209 }
2210
2211 pub fn enable_non_exclusive_writes(&self) -> bool {
2212 self.feature_flags.enable_non_exclusive_writes
2213 }
2214
2215 pub fn enable_coin_registry(&self) -> bool {
2216 self.feature_flags.enable_coin_registry
2217 }
2218
2219 pub fn enable_display_registry(&self) -> bool {
2220 self.feature_flags.enable_display_registry
2221 }
2222
2223 pub fn enable_coin_deny_list_v2(&self) -> bool {
2224 self.feature_flags.enable_coin_deny_list_v2
2225 }
2226
2227 pub fn enable_group_ops_native_functions(&self) -> bool {
2228 self.feature_flags.enable_group_ops_native_functions
2229 }
2230
2231 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2232 self.feature_flags.enable_group_ops_native_function_msm
2233 }
2234
2235 pub fn enable_ristretto255_group_ops(&self) -> bool {
2236 self.feature_flags.enable_ristretto255_group_ops
2237 }
2238
2239 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2240 self.feature_flags.reject_mutable_random_on_entry_functions
2241 }
2242
2243 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2244 self.feature_flags.per_object_congestion_control_mode
2245 }
2246
2247 pub fn consensus_choice(&self) -> ConsensusChoice {
2248 self.feature_flags.consensus_choice
2249 }
2250
2251 pub fn consensus_network(&self) -> ConsensusNetwork {
2252 self.feature_flags.consensus_network
2253 }
2254
2255 pub fn correct_gas_payment_limit_check(&self) -> bool {
2256 self.feature_flags.correct_gas_payment_limit_check
2257 }
2258
2259 pub fn reshare_at_same_initial_version(&self) -> bool {
2260 self.feature_flags.reshare_at_same_initial_version
2261 }
2262
2263 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2264 self.feature_flags.resolve_abort_locations_to_package_id
2265 }
2266
2267 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2268 self.feature_flags.mysticeti_use_committed_subdag_digest
2269 }
2270
2271 pub fn enable_vdf(&self) -> bool {
2272 self.feature_flags.enable_vdf
2273 }
2274
2275 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2276 self.feature_flags.fresh_vm_on_framework_upgrade
2277 }
2278
2279 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2280 self.feature_flags.mysticeti_num_leaders_per_round
2281 }
2282
2283 pub fn soft_bundle(&self) -> bool {
2284 self.feature_flags.soft_bundle
2285 }
2286
2287 pub fn passkey_auth(&self) -> bool {
2288 self.feature_flags.passkey_auth
2289 }
2290
2291 pub fn authority_capabilities_v2(&self) -> bool {
2292 self.feature_flags.authority_capabilities_v2
2293 }
2294
2295 pub fn max_transaction_size_bytes(&self) -> u64 {
2296 self.consensus_max_transaction_size_bytes
2298 .unwrap_or(256 * 1024)
2299 }
2300
2301 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2302 if cfg!(msim) {
2303 256 * 1024
2304 } else {
2305 self.consensus_max_transactions_in_block_bytes
2306 .unwrap_or(512 * 1024)
2307 }
2308 }
2309
2310 pub fn max_num_transactions_in_block(&self) -> u64 {
2311 if cfg!(msim) {
2312 8
2313 } else {
2314 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2315 }
2316 }
2317
2318 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2319 self.feature_flags.rethrow_serialization_type_layout_errors
2320 }
2321
2322 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2323 self.feature_flags
2324 .consensus_distributed_vote_scoring_strategy
2325 }
2326
2327 pub fn consensus_round_prober(&self) -> bool {
2328 self.feature_flags.consensus_round_prober
2329 }
2330
2331 pub fn validate_identifier_inputs(&self) -> bool {
2332 self.feature_flags.validate_identifier_inputs
2333 }
2334
2335 pub fn gc_depth(&self) -> u32 {
2336 self.consensus_gc_depth.unwrap_or(0)
2337 }
2338
2339 pub fn mysticeti_fastpath(&self) -> bool {
2340 self.feature_flags.mysticeti_fastpath
2341 }
2342
2343 pub fn relocate_event_module(&self) -> bool {
2344 self.feature_flags.relocate_event_module
2345 }
2346
2347 pub fn uncompressed_g1_group_elements(&self) -> bool {
2348 self.feature_flags.uncompressed_g1_group_elements
2349 }
2350
2351 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2352 self.feature_flags
2353 .disallow_new_modules_in_deps_only_packages
2354 }
2355
2356 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2357 self.feature_flags.consensus_smart_ancestor_selection
2358 }
2359
2360 pub fn disable_preconsensus_locking(&self) -> bool {
2361 self.feature_flags.disable_preconsensus_locking
2362 }
2363
2364 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2365 self.feature_flags
2366 .consensus_round_prober_probe_accepted_rounds
2367 }
2368
2369 pub fn native_charging_v2(&self) -> bool {
2370 self.feature_flags.native_charging_v2
2371 }
2372
2373 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2374 let res = self.feature_flags.consensus_linearize_subdag_v2;
2375 assert!(
2376 !res || self.gc_depth() > 0,
2377 "The consensus linearize sub dag V2 requires GC to be enabled"
2378 );
2379 res
2380 }
2381
2382 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2383 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2384 assert!(
2385 !res || self.gc_depth() > 0,
2386 "The consensus median based commit timestamp requires GC to be enabled"
2387 );
2388 res
2389 }
2390
2391 pub fn consensus_batched_block_sync(&self) -> bool {
2392 self.feature_flags.consensus_batched_block_sync
2393 }
2394
2395 pub fn convert_type_argument_error(&self) -> bool {
2396 self.feature_flags.convert_type_argument_error
2397 }
2398
2399 pub fn variant_nodes(&self) -> bool {
2400 self.feature_flags.variant_nodes
2401 }
2402
2403 pub fn consensus_zstd_compression(&self) -> bool {
2404 self.feature_flags.consensus_zstd_compression
2405 }
2406
2407 pub fn enable_nitro_attestation(&self) -> bool {
2408 self.feature_flags.enable_nitro_attestation
2409 }
2410
2411 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2412 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2413 }
2414
2415 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2416 self.feature_flags
2417 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2418 }
2419
2420 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2421 self.feature_flags
2422 .enable_nitro_attestation_always_include_required_pcrs_parsing
2423 }
2424
2425 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2426 self.consensus_commit_rate_estimation_window_size
2427 .unwrap_or(0)
2428 }
2429
2430 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2431 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2435 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2437 window_size
2438 }
2439
2440 pub fn minimize_child_object_mutations(&self) -> bool {
2441 self.feature_flags.minimize_child_object_mutations
2442 }
2443
2444 pub fn move_native_context(&self) -> bool {
2445 self.feature_flags.move_native_context
2446 }
2447
2448 pub fn normalize_ptb_arguments(&self) -> bool {
2449 self.feature_flags.normalize_ptb_arguments
2450 }
2451
2452 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2453 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2454 }
2455
2456 pub fn max_ptb_value_size_v2(&self) -> bool {
2457 self.feature_flags.max_ptb_value_size_v2
2458 }
2459
2460 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2461 self.feature_flags.resolve_type_input_ids_to_defining_id
2462 }
2463
2464 pub fn enable_party_transfer(&self) -> bool {
2465 self.feature_flags.enable_party_transfer
2466 }
2467
2468 pub fn allow_unbounded_system_objects(&self) -> bool {
2469 self.feature_flags.allow_unbounded_system_objects
2470 }
2471
2472 pub fn type_tags_in_object_runtime(&self) -> bool {
2473 self.feature_flags.type_tags_in_object_runtime
2474 }
2475
2476 pub fn enable_ptb_execution_v2(&self) -> bool {
2477 self.feature_flags.enable_ptb_execution_v2
2478 }
2479
2480 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2481 self.feature_flags.better_adapter_type_resolution_errors
2482 }
2483
2484 pub fn record_time_estimate_processed(&self) -> bool {
2485 self.feature_flags.record_time_estimate_processed
2486 }
2487
2488 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2489 self.feature_flags
2490 .ignore_execution_time_observations_after_certs_closed
2491 }
2492
2493 pub fn dependency_linkage_error(&self) -> bool {
2494 self.feature_flags.dependency_linkage_error
2495 }
2496
2497 pub fn additional_multisig_checks(&self) -> bool {
2498 self.feature_flags.additional_multisig_checks
2499 }
2500
2501 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2502 self.feature_flags.debug_fatal_on_move_invariant_violation
2503 }
2504
2505 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2506 self.feature_flags.allow_private_accumulator_entrypoints
2507 }
2508
2509 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2510 self.feature_flags
2511 .additional_consensus_digest_indirect_state
2512 }
2513
2514 pub fn check_for_init_during_upgrade(&self) -> bool {
2515 self.feature_flags.check_for_init_during_upgrade
2516 }
2517
2518 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2519 self.feature_flags.per_command_shared_object_transfer_rules
2520 }
2521
2522 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2523 self.feature_flags
2524 .consensus_checkpoint_signature_key_includes_digest
2525 }
2526
2527 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2528 self.feature_flags
2529 .include_checkpoint_artifacts_digest_in_summary
2530 }
2531
2532 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2533 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2534 }
2535
2536 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2537 self.feature_flags.cancel_for_failed_dkg_early
2538 }
2539
2540 pub fn abstract_size_in_object_runtime(&self) -> bool {
2541 self.feature_flags.abstract_size_in_object_runtime
2542 }
2543
2544 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2545 self.feature_flags.object_runtime_charge_cache_load_gas
2546 }
2547
2548 pub fn additional_borrow_checks(&self) -> bool {
2549 self.feature_flags.additional_borrow_checks
2550 }
2551
2552 pub fn use_new_commit_handler(&self) -> bool {
2553 self.feature_flags.use_new_commit_handler
2554 }
2555
2556 pub fn better_loader_errors(&self) -> bool {
2557 self.feature_flags.better_loader_errors
2558 }
2559
2560 pub fn generate_df_type_layouts(&self) -> bool {
2561 self.feature_flags.generate_df_type_layouts
2562 }
2563
2564 pub fn allow_references_in_ptbs(&self) -> bool {
2565 self.feature_flags.allow_references_in_ptbs
2566 }
2567
2568 pub fn private_generics_verifier_v2(&self) -> bool {
2569 self.feature_flags.private_generics_verifier_v2
2570 }
2571
2572 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2573 self.feature_flags
2574 .deprecate_global_storage_ops_during_deserialization
2575 }
2576
2577 pub fn enable_observation_chunking(&self) -> bool {
2578 matches!(self.feature_flags.per_object_congestion_control_mode,
2579 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2580 if params.observations_chunk_size.is_some()
2581 )
2582 }
2583
2584 pub fn deprecate_global_storage_ops(&self) -> bool {
2585 self.feature_flags.deprecate_global_storage_ops
2586 }
2587
2588 pub fn normalize_depth_formula(&self) -> bool {
2589 self.feature_flags.normalize_depth_formula
2590 }
2591
2592 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2593 self.feature_flags.consensus_skip_gced_accept_votes
2594 }
2595
2596 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2597 self.feature_flags
2598 .include_cancelled_randomness_txns_in_prologue
2599 }
2600
2601 pub fn address_aliases(&self) -> bool {
2602 let address_aliases = self.feature_flags.address_aliases;
2603 assert!(
2604 !address_aliases || self.mysticeti_fastpath(),
2605 "Address aliases requires Mysticeti fastpath to be enabled"
2606 );
2607 if address_aliases {
2608 assert!(
2609 self.feature_flags.disable_preconsensus_locking,
2610 "Address aliases requires CertifiedTransaction to be disabled"
2611 );
2612 }
2613 address_aliases
2614 }
2615
2616 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2617 self.feature_flags.fix_checkpoint_signature_mapping
2618 }
2619
2620 pub fn enable_object_funds_withdraw(&self) -> bool {
2621 self.feature_flags.enable_object_funds_withdraw
2622 }
2623
2624 pub fn gas_rounding_halve_digits(&self) -> bool {
2625 self.feature_flags.gas_rounding_halve_digits
2626 }
2627
2628 pub fn flexible_tx_context_positions(&self) -> bool {
2629 self.feature_flags.flexible_tx_context_positions
2630 }
2631
2632 pub fn disable_entry_point_signature_check(&self) -> bool {
2633 self.feature_flags.disable_entry_point_signature_check
2634 }
2635
2636 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2637 self.feature_flags
2638 .consensus_skip_gced_blocks_in_direct_finalization
2639 }
2640
2641 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2642 self.feature_flags
2643 .convert_withdrawal_compatibility_ptb_arguments
2644 }
2645
2646 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2647 self.feature_flags.restrict_hot_or_not_entry_functions
2648 }
2649
2650 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2651 self.feature_flags.split_checkpoints_in_consensus_handler
2652 }
2653
2654 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2655 self.feature_flags
2656 .consensus_always_accept_system_transactions
2657 }
2658
2659 pub fn validator_metadata_verify_v2(&self) -> bool {
2660 self.feature_flags.validator_metadata_verify_v2
2661 }
2662
2663 pub fn defer_unpaid_amplification(&self) -> bool {
2664 self.feature_flags.defer_unpaid_amplification
2665 }
2666
2667 pub fn gasless_transaction_drop_safety(&self) -> bool {
2668 self.feature_flags.gasless_transaction_drop_safety
2669 }
2670
2671 pub fn new_vm_enabled(&self) -> bool {
2672 self.execution_version.is_some_and(|v| v >= 4)
2673 }
2674
2675 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2676 self.feature_flags.merge_randomness_into_checkpoint
2677 }
2678}
2679
2680#[cfg(not(msim))]
2681static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2682
2683#[cfg(msim)]
2685thread_local! {
2686 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2687}
2688
2689impl ProtocolConfig {
2691 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2693 assert!(
2695 version >= ProtocolVersion::MIN,
2696 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2697 version,
2698 ProtocolVersion::MIN.0,
2699 );
2700 assert!(
2701 version <= ProtocolVersion::MAX_ALLOWED,
2702 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2703 version,
2704 ProtocolVersion::MAX_ALLOWED.0,
2705 );
2706
2707 let mut ret = Self::get_for_version_impl(version, chain);
2708 ret.version = version;
2709
2710 ret = CONFIG_OVERRIDE.with(|ovr| {
2711 if let Some(override_fn) = &*ovr.borrow() {
2712 warn!(
2713 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2714 );
2715 override_fn(version, ret)
2716 } else {
2717 ret
2718 }
2719 });
2720
2721 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2722 warn!(
2723 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2724 );
2725 let overrides: ProtocolConfigOptional =
2726 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2727 .expect("failed to parse ProtocolConfig override env variables");
2728 overrides.apply_to(&mut ret);
2729 }
2730
2731 ret
2732 }
2733
2734 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2737 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2738 let mut ret = Self::get_for_version_impl(version, chain);
2739 ret.version = version;
2740 Some(ret)
2741 } else {
2742 None
2743 }
2744 }
2745
2746 #[cfg(not(msim))]
2747 pub fn poison_get_for_min_version() {
2748 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2749 }
2750
2751 #[cfg(not(msim))]
2752 fn load_poison_get_for_min_version() -> bool {
2753 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2754 }
2755
2756 #[cfg(msim)]
2757 pub fn poison_get_for_min_version() {
2758 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2759 }
2760
2761 #[cfg(msim)]
2762 fn load_poison_get_for_min_version() -> bool {
2763 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2764 }
2765
2766 pub fn get_for_min_version() -> Self {
2769 if Self::load_poison_get_for_min_version() {
2770 panic!("get_for_min_version called on validator");
2771 }
2772 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2773 }
2774
2775 #[allow(non_snake_case)]
2785 pub fn get_for_max_version_UNSAFE() -> Self {
2786 if Self::load_poison_get_for_min_version() {
2787 panic!("get_for_max_version_UNSAFE called on validator");
2788 }
2789 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2790 }
2791
2792 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2793 #[cfg(msim)]
2794 {
2795 if version == ProtocolVersion::MAX_ALLOWED {
2797 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2798 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2799 return config;
2800 }
2801 }
2802
2803 let mut cfg = Self {
2806 version,
2808
2809 feature_flags: Default::default(),
2811
2812 max_tx_size_bytes: Some(128 * 1024),
2813 max_input_objects: Some(2048),
2815 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2816 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2817 max_gas_payment_objects: Some(256),
2818 max_modules_in_publish: Some(128),
2819 max_package_dependencies: None,
2820 max_arguments: Some(512),
2821 max_type_arguments: Some(16),
2822 max_type_argument_depth: Some(16),
2823 max_pure_argument_size: Some(16 * 1024),
2824 max_programmable_tx_commands: Some(1024),
2825 move_binary_format_version: Some(6),
2826 min_move_binary_format_version: None,
2827 binary_module_handles: None,
2828 binary_struct_handles: None,
2829 binary_function_handles: None,
2830 binary_function_instantiations: None,
2831 binary_signatures: None,
2832 binary_constant_pool: None,
2833 binary_identifiers: None,
2834 binary_address_identifiers: None,
2835 binary_struct_defs: None,
2836 binary_struct_def_instantiations: None,
2837 binary_function_defs: None,
2838 binary_field_handles: None,
2839 binary_field_instantiations: None,
2840 binary_friend_decls: None,
2841 binary_enum_defs: None,
2842 binary_enum_def_instantiations: None,
2843 binary_variant_handles: None,
2844 binary_variant_instantiation_handles: None,
2845 max_move_object_size: Some(250 * 1024),
2846 max_move_package_size: Some(100 * 1024),
2847 max_publish_or_upgrade_per_ptb: None,
2848 max_tx_gas: Some(10_000_000_000),
2849 max_gas_price: Some(100_000),
2850 max_gas_price_rgp_factor_for_aborted_transactions: None,
2851 max_gas_computation_bucket: Some(5_000_000),
2852 max_loop_depth: Some(5),
2853 max_generic_instantiation_length: Some(32),
2854 max_function_parameters: Some(128),
2855 max_basic_blocks: Some(1024),
2856 max_value_stack_size: Some(1024),
2857 max_type_nodes: Some(256),
2858 max_push_size: Some(10000),
2859 max_struct_definitions: Some(200),
2860 max_function_definitions: Some(1000),
2861 max_fields_in_struct: Some(32),
2862 max_dependency_depth: Some(100),
2863 max_num_event_emit: Some(256),
2864 max_num_new_move_object_ids: Some(2048),
2865 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2866 max_num_deleted_move_object_ids: Some(2048),
2867 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2868 max_num_transferred_move_object_ids: Some(2048),
2869 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2870 max_event_emit_size: Some(250 * 1024),
2871 max_move_vector_len: Some(256 * 1024),
2872 max_type_to_layout_nodes: None,
2873 max_ptb_value_size: None,
2874
2875 max_back_edges_per_function: Some(10_000),
2876 max_back_edges_per_module: Some(10_000),
2877 max_verifier_meter_ticks_per_function: Some(6_000_000),
2878 max_meter_ticks_per_module: Some(6_000_000),
2879 max_meter_ticks_per_package: None,
2880
2881 object_runtime_max_num_cached_objects: Some(1000),
2882 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2883 object_runtime_max_num_store_entries: Some(1000),
2884 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2885 base_tx_cost_fixed: Some(110_000),
2886 package_publish_cost_fixed: Some(1_000),
2887 base_tx_cost_per_byte: Some(0),
2888 package_publish_cost_per_byte: Some(80),
2889 obj_access_cost_read_per_byte: Some(15),
2890 obj_access_cost_mutate_per_byte: Some(40),
2891 obj_access_cost_delete_per_byte: Some(40),
2892 obj_access_cost_verify_per_byte: Some(200),
2893 obj_data_cost_refundable: Some(100),
2894 obj_metadata_cost_non_refundable: Some(50),
2895 gas_model_version: Some(1),
2896 storage_rebate_rate: Some(9900),
2897 storage_fund_reinvest_rate: Some(500),
2898 reward_slashing_rate: Some(5000),
2899 storage_gas_price: Some(1),
2900 accumulator_object_storage_cost: None,
2901 max_transactions_per_checkpoint: Some(10_000),
2902 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2903
2904 buffer_stake_for_protocol_upgrade_bps: Some(0),
2907
2908 address_from_bytes_cost_base: Some(52),
2912 address_to_u256_cost_base: Some(52),
2914 address_from_u256_cost_base: Some(52),
2916
2917 config_read_setting_impl_cost_base: None,
2920 config_read_setting_impl_cost_per_byte: None,
2921
2922 dynamic_field_hash_type_and_key_cost_base: Some(100),
2925 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2926 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2927 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2928 dynamic_field_add_child_object_cost_base: Some(100),
2930 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2931 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2932 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2933 dynamic_field_borrow_child_object_cost_base: Some(100),
2935 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2936 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2937 dynamic_field_remove_child_object_cost_base: Some(100),
2939 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2940 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2941 dynamic_field_has_child_object_cost_base: Some(100),
2943 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2945 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2946 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2947
2948 event_emit_cost_base: Some(52),
2951 event_emit_value_size_derivation_cost_per_byte: Some(2),
2952 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2953 event_emit_output_cost_per_byte: Some(10),
2954 event_emit_auth_stream_cost: None,
2955
2956 object_borrow_uid_cost_base: Some(52),
2959 object_delete_impl_cost_base: Some(52),
2961 object_record_new_uid_cost_base: Some(52),
2963
2964 transfer_transfer_internal_cost_base: Some(52),
2967 transfer_party_transfer_internal_cost_base: None,
2969 transfer_freeze_object_cost_base: Some(52),
2971 transfer_share_object_cost_base: Some(52),
2973 transfer_receive_object_cost_base: None,
2974
2975 tx_context_derive_id_cost_base: Some(52),
2978 tx_context_fresh_id_cost_base: None,
2979 tx_context_sender_cost_base: None,
2980 tx_context_epoch_cost_base: None,
2981 tx_context_epoch_timestamp_ms_cost_base: None,
2982 tx_context_sponsor_cost_base: None,
2983 tx_context_rgp_cost_base: None,
2984 tx_context_gas_price_cost_base: None,
2985 tx_context_gas_budget_cost_base: None,
2986 tx_context_ids_created_cost_base: None,
2987 tx_context_replace_cost_base: None,
2988
2989 types_is_one_time_witness_cost_base: Some(52),
2992 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2993 types_is_one_time_witness_type_cost_per_byte: Some(2),
2994
2995 validator_validate_metadata_cost_base: Some(52),
2998 validator_validate_metadata_data_cost_per_byte: Some(2),
2999
3000 crypto_invalid_arguments_cost: Some(100),
3002 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3004 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3005 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3006
3007 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3009 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3010 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3011
3012 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3014 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3015 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3016 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3017 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3018 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3019
3020 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3022
3023 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3025 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3026 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3027 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3028 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3029 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3030
3031 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3033 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3034 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3035 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3036 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3037 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3038
3039 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3041 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3042 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3043 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3044 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3045 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3046
3047 ecvrf_ecvrf_verify_cost_base: Some(52),
3049 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3050 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3051
3052 ed25519_ed25519_verify_cost_base: Some(52),
3054 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3055 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3056
3057 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3059 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3060
3061 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3063 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3064 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3065 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3066 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3067
3068 hash_blake2b256_cost_base: Some(52),
3070 hash_blake2b256_data_cost_per_byte: Some(2),
3071 hash_blake2b256_data_cost_per_block: Some(2),
3072
3073 hash_keccak256_cost_base: Some(52),
3075 hash_keccak256_data_cost_per_byte: Some(2),
3076 hash_keccak256_data_cost_per_block: Some(2),
3077
3078 poseidon_bn254_cost_base: None,
3079 poseidon_bn254_cost_per_block: None,
3080
3081 hmac_hmac_sha3_256_cost_base: Some(52),
3083 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3084 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3085
3086 group_ops_bls12381_decode_scalar_cost: None,
3088 group_ops_bls12381_decode_g1_cost: None,
3089 group_ops_bls12381_decode_g2_cost: None,
3090 group_ops_bls12381_decode_gt_cost: None,
3091 group_ops_bls12381_scalar_add_cost: None,
3092 group_ops_bls12381_g1_add_cost: None,
3093 group_ops_bls12381_g2_add_cost: None,
3094 group_ops_bls12381_gt_add_cost: None,
3095 group_ops_bls12381_scalar_sub_cost: None,
3096 group_ops_bls12381_g1_sub_cost: None,
3097 group_ops_bls12381_g2_sub_cost: None,
3098 group_ops_bls12381_gt_sub_cost: None,
3099 group_ops_bls12381_scalar_mul_cost: None,
3100 group_ops_bls12381_g1_mul_cost: None,
3101 group_ops_bls12381_g2_mul_cost: None,
3102 group_ops_bls12381_gt_mul_cost: None,
3103 group_ops_bls12381_scalar_div_cost: None,
3104 group_ops_bls12381_g1_div_cost: None,
3105 group_ops_bls12381_g2_div_cost: None,
3106 group_ops_bls12381_gt_div_cost: None,
3107 group_ops_bls12381_g1_hash_to_base_cost: None,
3108 group_ops_bls12381_g2_hash_to_base_cost: None,
3109 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3110 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3111 group_ops_bls12381_g1_msm_base_cost: None,
3112 group_ops_bls12381_g2_msm_base_cost: None,
3113 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3114 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3115 group_ops_bls12381_msm_max_len: None,
3116 group_ops_bls12381_pairing_cost: None,
3117 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3118 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3119 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3120 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3121 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3122
3123 group_ops_ristretto_decode_scalar_cost: None,
3124 group_ops_ristretto_decode_point_cost: None,
3125 group_ops_ristretto_scalar_add_cost: None,
3126 group_ops_ristretto_point_add_cost: None,
3127 group_ops_ristretto_scalar_sub_cost: None,
3128 group_ops_ristretto_point_sub_cost: None,
3129 group_ops_ristretto_scalar_mul_cost: None,
3130 group_ops_ristretto_point_mul_cost: None,
3131 group_ops_ristretto_scalar_div_cost: None,
3132 group_ops_ristretto_point_div_cost: None,
3133
3134 check_zklogin_id_cost_base: None,
3136 check_zklogin_issuer_cost_base: None,
3138
3139 vdf_verify_vdf_cost: None,
3140 vdf_hash_to_input_cost: None,
3141
3142 nitro_attestation_parse_base_cost: None,
3144 nitro_attestation_parse_cost_per_byte: None,
3145 nitro_attestation_verify_base_cost: None,
3146 nitro_attestation_verify_cost_per_cert: None,
3147
3148 bcs_per_byte_serialized_cost: None,
3149 bcs_legacy_min_output_size_cost: None,
3150 bcs_failure_cost: None,
3151 hash_sha2_256_base_cost: None,
3152 hash_sha2_256_per_byte_cost: None,
3153 hash_sha2_256_legacy_min_input_len_cost: None,
3154 hash_sha3_256_base_cost: None,
3155 hash_sha3_256_per_byte_cost: None,
3156 hash_sha3_256_legacy_min_input_len_cost: None,
3157 type_name_get_base_cost: None,
3158 type_name_get_per_byte_cost: None,
3159 type_name_id_base_cost: None,
3160 string_check_utf8_base_cost: None,
3161 string_check_utf8_per_byte_cost: None,
3162 string_is_char_boundary_base_cost: None,
3163 string_sub_string_base_cost: None,
3164 string_sub_string_per_byte_cost: None,
3165 string_index_of_base_cost: None,
3166 string_index_of_per_byte_pattern_cost: None,
3167 string_index_of_per_byte_searched_cost: None,
3168 vector_empty_base_cost: None,
3169 vector_length_base_cost: None,
3170 vector_push_back_base_cost: None,
3171 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3172 vector_borrow_base_cost: None,
3173 vector_pop_back_base_cost: None,
3174 vector_destroy_empty_base_cost: None,
3175 vector_swap_base_cost: None,
3176 debug_print_base_cost: None,
3177 debug_print_stack_trace_base_cost: None,
3178
3179 max_size_written_objects: None,
3180 max_size_written_objects_system_tx: None,
3181
3182 max_move_identifier_len: None,
3189 max_move_value_depth: None,
3190 max_move_enum_variants: None,
3191
3192 gas_rounding_step: None,
3193
3194 execution_version: None,
3195
3196 max_event_emit_size_total: None,
3197
3198 consensus_bad_nodes_stake_threshold: None,
3199
3200 max_jwk_votes_per_validator_per_epoch: None,
3201
3202 max_age_of_jwk_in_epochs: None,
3203
3204 random_beacon_reduction_allowed_delta: None,
3205
3206 random_beacon_reduction_lower_bound: None,
3207
3208 random_beacon_dkg_timeout_round: None,
3209
3210 random_beacon_min_round_interval_ms: None,
3211
3212 random_beacon_dkg_version: None,
3213
3214 consensus_max_transaction_size_bytes: None,
3215
3216 consensus_max_transactions_in_block_bytes: None,
3217
3218 consensus_max_num_transactions_in_block: None,
3219
3220 consensus_voting_rounds: None,
3221
3222 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3223
3224 max_deferral_rounds_for_congestion_control: None,
3225
3226 max_txn_cost_overage_per_object_in_commit: None,
3227
3228 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3229
3230 min_checkpoint_interval_ms: None,
3231
3232 checkpoint_summary_version_specific_data: None,
3233
3234 max_soft_bundle_size: None,
3235
3236 bridge_should_try_to_finalize_committee: None,
3237
3238 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3239
3240 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3241
3242 consensus_gc_depth: None,
3243
3244 gas_budget_based_txn_cost_cap_factor: None,
3245
3246 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3247
3248 sip_45_consensus_amplification_threshold: None,
3249
3250 use_object_per_epoch_marker_table_v2: None,
3251
3252 consensus_commit_rate_estimation_window_size: None,
3253
3254 aliased_addresses: vec![],
3255
3256 translation_per_command_base_charge: None,
3257 translation_per_input_base_charge: None,
3258 translation_pure_input_per_byte_charge: None,
3259 translation_per_type_node_charge: None,
3260 translation_per_reference_node_charge: None,
3261 translation_per_linkage_entry_charge: None,
3262
3263 max_updates_per_settlement_txn: None,
3264 };
3267 for cur in 2..=version.0 {
3268 match cur {
3269 1 => unreachable!(),
3270 2 => {
3271 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3272 }
3273 3 => {
3274 cfg.gas_model_version = Some(2);
3276 cfg.max_tx_gas = Some(50_000_000_000);
3278 cfg.base_tx_cost_fixed = Some(2_000);
3280 cfg.storage_gas_price = Some(76);
3282 cfg.feature_flags.loaded_child_objects_fixed = true;
3283 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3286 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3289 cfg.feature_flags.package_upgrades = true;
3290 }
3291 4 => {
3296 cfg.reward_slashing_rate = Some(10000);
3298 cfg.gas_model_version = Some(3);
3300 }
3301 5 => {
3302 cfg.feature_flags.missing_type_is_compatibility_error = true;
3303 cfg.gas_model_version = Some(4);
3304 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3305 }
3309 6 => {
3310 cfg.gas_model_version = Some(5);
3311 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3312 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3313 }
3314 7 => {
3315 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3316 cfg.feature_flags
3317 .disable_invariant_violation_check_in_swap_loc = true;
3318 cfg.feature_flags.ban_entry_init = true;
3319 cfg.feature_flags.package_digest_hash_module = true;
3320 }
3321 8 => {
3322 cfg.feature_flags
3323 .disallow_change_struct_type_params_on_upgrade = true;
3324 }
3325 9 => {
3326 cfg.max_move_identifier_len = Some(128);
3328 cfg.feature_flags.no_extraneous_module_bytes = true;
3329 cfg.feature_flags
3330 .advance_to_highest_supported_protocol_version = true;
3331 }
3332 10 => {
3333 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3334 cfg.max_meter_ticks_per_module = Some(16_000_000);
3335 }
3336 11 => {
3337 cfg.max_move_value_depth = Some(128);
3338 }
3339 12 => {
3340 cfg.feature_flags.narwhal_versioned_metadata = true;
3341 if chain != Chain::Mainnet {
3342 cfg.feature_flags.commit_root_state_digest = true;
3343 }
3344
3345 if chain != Chain::Mainnet && chain != Chain::Testnet {
3346 cfg.feature_flags.zklogin_auth = true;
3347 }
3348 }
3349 13 => {}
3350 14 => {
3351 cfg.gas_rounding_step = Some(1_000);
3352 cfg.gas_model_version = Some(6);
3353 }
3354 15 => {
3355 cfg.feature_flags.consensus_transaction_ordering =
3356 ConsensusTransactionOrdering::ByGasPrice;
3357 }
3358 16 => {
3359 cfg.feature_flags.simplified_unwrap_then_delete = true;
3360 }
3361 17 => {
3362 cfg.feature_flags.upgraded_multisig_supported = true;
3363 }
3364 18 => {
3365 cfg.execution_version = Some(1);
3366 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3375 cfg.base_tx_cost_fixed = Some(1_000);
3377 }
3378 19 => {
3379 cfg.max_num_event_emit = Some(1024);
3380 cfg.max_event_emit_size_total = Some(
3383 256 * 250 * 1024, );
3385 }
3386 20 => {
3387 cfg.feature_flags.commit_root_state_digest = true;
3388
3389 if chain != Chain::Mainnet {
3390 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3391 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3392 }
3393 }
3394
3395 21 => {
3396 if chain != Chain::Mainnet {
3397 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3398 "Google".to_string(),
3399 "Facebook".to_string(),
3400 "Twitch".to_string(),
3401 ]);
3402 }
3403 }
3404 22 => {
3405 cfg.feature_flags.loaded_child_object_format = true;
3406 }
3407 23 => {
3408 cfg.feature_flags.loaded_child_object_format_type = true;
3409 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3410 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3416 }
3417 24 => {
3418 cfg.feature_flags.simple_conservation_checks = true;
3419 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3420
3421 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3422
3423 if chain != Chain::Mainnet {
3424 cfg.feature_flags.enable_jwk_consensus_updates = true;
3425 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3427 cfg.max_age_of_jwk_in_epochs = Some(1);
3428 }
3429 }
3430 25 => {
3431 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3433 "Google".to_string(),
3434 "Facebook".to_string(),
3435 "Twitch".to_string(),
3436 ]);
3437 cfg.feature_flags.zklogin_auth = true;
3438
3439 cfg.feature_flags.enable_jwk_consensus_updates = true;
3441 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3442 cfg.max_age_of_jwk_in_epochs = Some(1);
3443 }
3444 26 => {
3445 cfg.gas_model_version = Some(7);
3446 if chain != Chain::Mainnet && chain != Chain::Testnet {
3448 cfg.transfer_receive_object_cost_base = Some(52);
3449 cfg.feature_flags.receive_objects = true;
3450 }
3451 }
3452 27 => {
3453 cfg.gas_model_version = Some(8);
3454 }
3455 28 => {
3456 cfg.check_zklogin_id_cost_base = Some(200);
3458 cfg.check_zklogin_issuer_cost_base = Some(200);
3460
3461 if chain != Chain::Mainnet && chain != Chain::Testnet {
3463 cfg.feature_flags.enable_effects_v2 = true;
3464 }
3465 }
3466 29 => {
3467 cfg.feature_flags.verify_legacy_zklogin_address = true;
3468 }
3469 30 => {
3470 if chain != Chain::Mainnet {
3472 cfg.feature_flags.narwhal_certificate_v2 = true;
3473 }
3474
3475 cfg.random_beacon_reduction_allowed_delta = Some(800);
3476 if chain != Chain::Mainnet {
3478 cfg.feature_flags.enable_effects_v2 = true;
3479 }
3480
3481 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3485
3486 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3487 }
3488 31 => {
3489 cfg.execution_version = Some(2);
3490 if chain != Chain::Mainnet && chain != Chain::Testnet {
3492 cfg.feature_flags.shared_object_deletion = true;
3493 }
3494 }
3495 32 => {
3496 if chain != Chain::Mainnet {
3498 cfg.feature_flags.accept_zklogin_in_multisig = true;
3499 }
3500 if chain != Chain::Mainnet {
3502 cfg.transfer_receive_object_cost_base = Some(52);
3503 cfg.feature_flags.receive_objects = true;
3504 }
3505 if chain != Chain::Mainnet && chain != Chain::Testnet {
3507 cfg.feature_flags.random_beacon = true;
3508 cfg.random_beacon_reduction_lower_bound = Some(1600);
3509 cfg.random_beacon_dkg_timeout_round = Some(3000);
3510 cfg.random_beacon_min_round_interval_ms = Some(150);
3511 }
3512 if chain != Chain::Testnet && chain != Chain::Mainnet {
3514 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3515 }
3516
3517 cfg.feature_flags.narwhal_certificate_v2 = true;
3519 }
3520 33 => {
3521 cfg.feature_flags.hardened_otw_check = true;
3522 cfg.feature_flags.allow_receiving_object_id = true;
3523
3524 cfg.transfer_receive_object_cost_base = Some(52);
3526 cfg.feature_flags.receive_objects = true;
3527
3528 if chain != Chain::Mainnet {
3530 cfg.feature_flags.shared_object_deletion = true;
3531 }
3532
3533 cfg.feature_flags.enable_effects_v2 = true;
3534 }
3535 34 => {}
3536 35 => {
3537 if chain != Chain::Mainnet && chain != Chain::Testnet {
3539 cfg.feature_flags.enable_poseidon = true;
3540 cfg.poseidon_bn254_cost_base = Some(260);
3541 cfg.poseidon_bn254_cost_per_block = Some(10);
3542 }
3543
3544 cfg.feature_flags.enable_coin_deny_list = true;
3545 }
3546 36 => {
3547 if chain != Chain::Mainnet && chain != Chain::Testnet {
3549 cfg.feature_flags.enable_group_ops_native_functions = true;
3550 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3551 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3553 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3554 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3555 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3556 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3557 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3558 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3559 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3560 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3561 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3562 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3563 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3564 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3565 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3566 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3567 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3568 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3569 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3570 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3571 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3572 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3573 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3574 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3575 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3576 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3577 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3578 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3579 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3580 cfg.group_ops_bls12381_msm_max_len = Some(32);
3581 cfg.group_ops_bls12381_pairing_cost = Some(52);
3582 }
3583 cfg.feature_flags.shared_object_deletion = true;
3585
3586 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3588 }
3590 37 => {
3591 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3592
3593 if chain != Chain::Mainnet {
3595 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3596 }
3597 }
3598 38 => {
3599 cfg.binary_module_handles = Some(100);
3600 cfg.binary_struct_handles = Some(300);
3601 cfg.binary_function_handles = Some(1500);
3602 cfg.binary_function_instantiations = Some(750);
3603 cfg.binary_signatures = Some(1000);
3604 cfg.binary_constant_pool = Some(4000);
3608 cfg.binary_identifiers = Some(10000);
3609 cfg.binary_address_identifiers = Some(100);
3610 cfg.binary_struct_defs = Some(200);
3611 cfg.binary_struct_def_instantiations = Some(100);
3612 cfg.binary_function_defs = Some(1000);
3613 cfg.binary_field_handles = Some(500);
3614 cfg.binary_field_instantiations = Some(250);
3615 cfg.binary_friend_decls = Some(100);
3616 cfg.max_package_dependencies = Some(32);
3618 cfg.max_modules_in_publish = Some(64);
3619 cfg.execution_version = Some(3);
3621 }
3622 39 => {
3623 }
3625 40 => {}
3626 41 => {
3627 cfg.feature_flags.enable_group_ops_native_functions = true;
3629 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3631 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3632 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3633 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3634 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3635 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3636 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3637 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3638 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3639 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3640 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3641 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3642 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3643 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3644 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3645 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3646 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3647 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3648 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3649 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3650 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3651 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3652 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3653 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3654 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3655 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3656 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3657 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3658 cfg.group_ops_bls12381_msm_max_len = Some(32);
3659 cfg.group_ops_bls12381_pairing_cost = Some(52);
3660 }
3661 42 => {}
3662 43 => {
3663 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3664 cfg.max_meter_ticks_per_package = Some(16_000_000);
3665 }
3666 44 => {
3667 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3669 if chain != Chain::Mainnet {
3671 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3672 }
3673 }
3674 45 => {
3675 if chain != Chain::Testnet && chain != Chain::Mainnet {
3677 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3678 }
3679
3680 if chain != Chain::Mainnet {
3681 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3683 }
3684 cfg.min_move_binary_format_version = Some(6);
3685 cfg.feature_flags.accept_zklogin_in_multisig = true;
3686
3687 if chain != Chain::Mainnet && chain != Chain::Testnet {
3691 cfg.feature_flags.bridge = true;
3692 }
3693 }
3694 46 => {
3695 if chain != Chain::Mainnet {
3697 cfg.feature_flags.bridge = true;
3698 }
3699
3700 cfg.feature_flags.reshare_at_same_initial_version = true;
3702 }
3703 47 => {}
3704 48 => {
3705 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3707
3708 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3710
3711 if chain != Chain::Mainnet {
3713 cfg.feature_flags.random_beacon = true;
3714 cfg.random_beacon_reduction_lower_bound = Some(1600);
3715 cfg.random_beacon_dkg_timeout_round = Some(3000);
3716 cfg.random_beacon_min_round_interval_ms = Some(200);
3717 }
3718
3719 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3721 }
3722 49 => {
3723 if chain != Chain::Testnet && chain != Chain::Mainnet {
3724 cfg.move_binary_format_version = Some(7);
3725 }
3726
3727 if chain != Chain::Mainnet && chain != Chain::Testnet {
3729 cfg.feature_flags.enable_vdf = true;
3730 cfg.vdf_verify_vdf_cost = Some(1500);
3733 cfg.vdf_hash_to_input_cost = Some(100);
3734 }
3735
3736 if chain != Chain::Testnet && chain != Chain::Mainnet {
3738 cfg.feature_flags
3739 .record_consensus_determined_version_assignments_in_prologue = true;
3740 }
3741
3742 if chain != Chain::Mainnet {
3744 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3745 }
3746
3747 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3749 }
3750 50 => {
3751 if chain != Chain::Mainnet {
3753 cfg.checkpoint_summary_version_specific_data = Some(1);
3754 cfg.min_checkpoint_interval_ms = Some(200);
3755 }
3756
3757 if chain != Chain::Testnet && chain != Chain::Mainnet {
3759 cfg.feature_flags
3760 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3761 }
3762
3763 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3764
3765 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3767 }
3768 51 => {
3769 cfg.random_beacon_dkg_version = Some(1);
3770
3771 if chain != Chain::Testnet && chain != Chain::Mainnet {
3772 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3773 }
3774 }
3775 52 => {
3776 if chain != Chain::Mainnet {
3777 cfg.feature_flags.soft_bundle = true;
3778 cfg.max_soft_bundle_size = Some(5);
3779 }
3780
3781 cfg.config_read_setting_impl_cost_base = Some(100);
3782 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3783
3784 if chain != Chain::Testnet && chain != Chain::Mainnet {
3786 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3787 cfg.feature_flags.per_object_congestion_control_mode =
3788 PerObjectCongestionControlMode::TotalTxCount;
3789 }
3790
3791 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3793
3794 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3796
3797 cfg.checkpoint_summary_version_specific_data = Some(1);
3799 cfg.min_checkpoint_interval_ms = Some(200);
3800
3801 if chain != Chain::Mainnet {
3803 cfg.feature_flags
3804 .record_consensus_determined_version_assignments_in_prologue = true;
3805 cfg.feature_flags
3806 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3807 }
3808 if chain != Chain::Mainnet {
3810 cfg.move_binary_format_version = Some(7);
3811 }
3812
3813 if chain != Chain::Testnet && chain != Chain::Mainnet {
3814 cfg.feature_flags.passkey_auth = true;
3815 }
3816 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3817 }
3818 53 => {
3819 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3821
3822 cfg.feature_flags
3824 .record_consensus_determined_version_assignments_in_prologue = true;
3825 cfg.feature_flags
3826 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3827
3828 if chain == Chain::Unknown {
3829 cfg.feature_flags.authority_capabilities_v2 = true;
3830 }
3831
3832 if chain != Chain::Mainnet {
3834 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3835 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3836 cfg.feature_flags.per_object_congestion_control_mode =
3837 PerObjectCongestionControlMode::TotalTxCount;
3838 }
3839
3840 cfg.bcs_per_byte_serialized_cost = Some(2);
3842 cfg.bcs_legacy_min_output_size_cost = Some(1);
3843 cfg.bcs_failure_cost = Some(52);
3844 cfg.debug_print_base_cost = Some(52);
3845 cfg.debug_print_stack_trace_base_cost = Some(52);
3846 cfg.hash_sha2_256_base_cost = Some(52);
3847 cfg.hash_sha2_256_per_byte_cost = Some(2);
3848 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3849 cfg.hash_sha3_256_base_cost = Some(52);
3850 cfg.hash_sha3_256_per_byte_cost = Some(2);
3851 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3852 cfg.type_name_get_base_cost = Some(52);
3853 cfg.type_name_get_per_byte_cost = Some(2);
3854 cfg.string_check_utf8_base_cost = Some(52);
3855 cfg.string_check_utf8_per_byte_cost = Some(2);
3856 cfg.string_is_char_boundary_base_cost = Some(52);
3857 cfg.string_sub_string_base_cost = Some(52);
3858 cfg.string_sub_string_per_byte_cost = Some(2);
3859 cfg.string_index_of_base_cost = Some(52);
3860 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3861 cfg.string_index_of_per_byte_searched_cost = Some(2);
3862 cfg.vector_empty_base_cost = Some(52);
3863 cfg.vector_length_base_cost = Some(52);
3864 cfg.vector_push_back_base_cost = Some(52);
3865 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3866 cfg.vector_borrow_base_cost = Some(52);
3867 cfg.vector_pop_back_base_cost = Some(52);
3868 cfg.vector_destroy_empty_base_cost = Some(52);
3869 cfg.vector_swap_base_cost = Some(52);
3870 }
3871 54 => {
3872 cfg.feature_flags.random_beacon = true;
3874 cfg.random_beacon_reduction_lower_bound = Some(1000);
3875 cfg.random_beacon_dkg_timeout_round = Some(3000);
3876 cfg.random_beacon_min_round_interval_ms = Some(500);
3877
3878 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3880 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3881 cfg.feature_flags.per_object_congestion_control_mode =
3882 PerObjectCongestionControlMode::TotalTxCount;
3883
3884 cfg.feature_flags.soft_bundle = true;
3886 cfg.max_soft_bundle_size = Some(5);
3887 }
3888 55 => {
3889 cfg.move_binary_format_version = Some(7);
3891
3892 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3894 cfg.consensus_max_num_transactions_in_block = Some(512);
3897
3898 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3899 }
3900 56 => {
3901 if chain == Chain::Mainnet {
3902 cfg.feature_flags.bridge = true;
3903 }
3904 }
3905 57 => {
3906 cfg.random_beacon_reduction_lower_bound = Some(800);
3908 }
3909 58 => {
3910 if chain == Chain::Mainnet {
3911 cfg.bridge_should_try_to_finalize_committee = Some(true);
3912 }
3913
3914 if chain != Chain::Mainnet && chain != Chain::Testnet {
3915 cfg.feature_flags
3917 .consensus_distributed_vote_scoring_strategy = true;
3918 }
3919 }
3920 59 => {
3921 cfg.feature_flags.consensus_round_prober = true;
3923 }
3924 60 => {
3925 cfg.max_type_to_layout_nodes = Some(512);
3926 cfg.feature_flags.validate_identifier_inputs = true;
3927 }
3928 61 => {
3929 if chain != Chain::Mainnet {
3930 cfg.feature_flags
3932 .consensus_distributed_vote_scoring_strategy = true;
3933 }
3934 cfg.random_beacon_reduction_lower_bound = Some(700);
3936
3937 if chain != Chain::Mainnet && chain != Chain::Testnet {
3938 cfg.feature_flags.mysticeti_fastpath = true;
3940 }
3941 }
3942 62 => {
3943 cfg.feature_flags.relocate_event_module = true;
3944 }
3945 63 => {
3946 cfg.feature_flags.per_object_congestion_control_mode =
3947 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3948 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3949 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3950 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3951 }
3952 64 => {
3953 cfg.feature_flags.per_object_congestion_control_mode =
3954 PerObjectCongestionControlMode::TotalTxCount;
3955 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3956 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3957 }
3958 65 => {
3959 cfg.feature_flags
3961 .consensus_distributed_vote_scoring_strategy = true;
3962 }
3963 66 => {
3964 if chain == Chain::Mainnet {
3965 cfg.feature_flags
3967 .consensus_distributed_vote_scoring_strategy = false;
3968 }
3969 }
3970 67 => {
3971 cfg.feature_flags
3973 .consensus_distributed_vote_scoring_strategy = true;
3974 }
3975 68 => {
3976 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3977 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3978 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3979 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3980 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3981
3982 if chain != Chain::Mainnet && chain != Chain::Testnet {
3983 cfg.feature_flags.uncompressed_g1_group_elements = true;
3984 }
3985
3986 cfg.feature_flags.per_object_congestion_control_mode =
3987 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3988 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3989 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3990 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3991 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3993 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3994
3995 cfg.random_beacon_reduction_lower_bound = Some(500);
3997
3998 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3999 }
4000 69 => {
4001 cfg.consensus_voting_rounds = Some(40);
4003
4004 if chain != Chain::Mainnet && chain != Chain::Testnet {
4005 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4007 }
4008
4009 if chain != Chain::Mainnet {
4010 cfg.feature_flags.uncompressed_g1_group_elements = true;
4011 }
4012 }
4013 70 => {
4014 if chain != Chain::Mainnet {
4015 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4017 cfg.feature_flags
4019 .consensus_round_prober_probe_accepted_rounds = true;
4020 }
4021
4022 cfg.poseidon_bn254_cost_per_block = Some(388);
4023
4024 cfg.gas_model_version = Some(9);
4025 cfg.feature_flags.native_charging_v2 = true;
4026 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4027 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4028 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4029 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4030 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4031 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4032 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4033 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4034
4035 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4037 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4038 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4039 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4040
4041 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4042 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4043 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4044 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4045 Some(8213);
4046 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4047 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4048 Some(9484);
4049
4050 cfg.hash_keccak256_cost_base = Some(10);
4051 cfg.hash_blake2b256_cost_base = Some(10);
4052
4053 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4055 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4056 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4057 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4058
4059 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4060 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4061 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4062 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4063
4064 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4065 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4066 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4067 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4068
4069 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4070 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4071 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4072 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4073
4074 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4075 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4076 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4077 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4078
4079 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4080 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4081
4082 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4083 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4084 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4085 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4086
4087 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4088 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4089 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4090 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4091
4092 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4093 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4094
4095 cfg.validator_validate_metadata_cost_base = Some(20000);
4096 }
4097 71 => {
4098 cfg.sip_45_consensus_amplification_threshold = Some(5);
4099
4100 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4102 }
4103 72 => {
4104 cfg.feature_flags.convert_type_argument_error = true;
4105
4106 cfg.max_tx_gas = Some(50_000_000_000_000);
4109 cfg.max_gas_price = Some(50_000_000_000);
4111
4112 cfg.feature_flags.variant_nodes = true;
4113 }
4114 73 => {
4115 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4117
4118 if chain != Chain::Mainnet && chain != Chain::Testnet {
4119 cfg.consensus_gc_depth = Some(60);
4122 }
4123
4124 if chain != Chain::Mainnet {
4125 cfg.feature_flags.consensus_zstd_compression = true;
4127 }
4128
4129 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4131 cfg.feature_flags
4133 .consensus_round_prober_probe_accepted_rounds = true;
4134
4135 cfg.feature_flags.per_object_congestion_control_mode =
4137 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4138 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4139 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4140 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4141 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4143 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4144 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4145 }
4146 74 => {
4147 if chain != Chain::Mainnet && chain != Chain::Testnet {
4149 cfg.feature_flags.enable_nitro_attestation = true;
4150 }
4151 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4152 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4153 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4154 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4155
4156 cfg.feature_flags.consensus_zstd_compression = true;
4158
4159 if chain != Chain::Mainnet && chain != Chain::Testnet {
4160 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4161 }
4162 }
4163 75 => {
4164 if chain != Chain::Mainnet {
4165 cfg.feature_flags.passkey_auth = true;
4166 }
4167 }
4168 76 => {
4169 if chain != Chain::Mainnet && chain != Chain::Testnet {
4170 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4171 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4172 }
4173 cfg.feature_flags.minimize_child_object_mutations = true;
4174
4175 if chain != Chain::Mainnet {
4176 cfg.feature_flags.accept_passkey_in_multisig = true;
4177 }
4178 }
4179 77 => {
4180 cfg.feature_flags.uncompressed_g1_group_elements = true;
4181
4182 if chain != Chain::Mainnet {
4183 cfg.consensus_gc_depth = Some(60);
4184 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4185 }
4186 }
4187 78 => {
4188 cfg.feature_flags.move_native_context = true;
4189 cfg.tx_context_fresh_id_cost_base = Some(52);
4190 cfg.tx_context_sender_cost_base = Some(30);
4191 cfg.tx_context_epoch_cost_base = Some(30);
4192 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4193 cfg.tx_context_sponsor_cost_base = Some(30);
4194 cfg.tx_context_gas_price_cost_base = Some(30);
4195 cfg.tx_context_gas_budget_cost_base = Some(30);
4196 cfg.tx_context_ids_created_cost_base = Some(30);
4197 cfg.tx_context_replace_cost_base = Some(30);
4198 cfg.gas_model_version = Some(10);
4199
4200 if chain != Chain::Mainnet {
4201 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4202 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4203
4204 cfg.feature_flags.per_object_congestion_control_mode =
4206 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4207 ExecutionTimeEstimateParams {
4208 target_utilization: 30,
4209 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4211 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4213 stored_observations_limit: u64::MAX,
4214 stake_weighted_median_threshold: 0,
4215 default_none_duration_for_new_keys: false,
4216 observations_chunk_size: None,
4217 },
4218 );
4219 }
4220 }
4221 79 => {
4222 if chain != Chain::Mainnet {
4223 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4224
4225 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4228
4229 cfg.feature_flags.consensus_batched_block_sync = true;
4230
4231 cfg.feature_flags.enable_nitro_attestation = true
4233 }
4234 cfg.feature_flags.normalize_ptb_arguments = true;
4235
4236 cfg.consensus_gc_depth = Some(60);
4237 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4238 }
4239 80 => {
4240 cfg.max_ptb_value_size = Some(1024 * 1024);
4241 }
4242 81 => {
4243 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4244 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4245 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4246 }
4247 82 => {
4248 cfg.feature_flags.max_ptb_value_size_v2 = true;
4249 }
4250 83 => {
4251 if chain == Chain::Mainnet {
4252 let aliased: [u8; 32] = Hex::decode(
4254 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4255 )
4256 .unwrap()
4257 .try_into()
4258 .unwrap();
4259
4260 cfg.aliased_addresses.push(AliasedAddress {
4262 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4263 aliased,
4264 allowed_tx_digests: vec![
4265 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4266 ],
4267 });
4268
4269 cfg.aliased_addresses.push(AliasedAddress {
4270 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4271 aliased,
4272 allowed_tx_digests: vec![
4273 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4274 ],
4275 });
4276 }
4277
4278 if chain != Chain::Mainnet {
4281 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4282 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4283
4284 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4286 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4287 cfg.feature_flags.per_object_congestion_control_mode =
4288 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4289 ExecutionTimeEstimateParams {
4290 target_utilization: 30,
4291 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4293 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4295 stored_observations_limit: u64::MAX,
4296 stake_weighted_median_threshold: 0,
4297 default_none_duration_for_new_keys: false,
4298 observations_chunk_size: None,
4299 },
4300 );
4301
4302 cfg.feature_flags.consensus_batched_block_sync = true;
4304
4305 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4308 cfg.feature_flags.enable_nitro_attestation = true;
4309 }
4310 }
4311 84 => {
4312 if chain == Chain::Mainnet {
4313 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4314 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4315
4316 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4318 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4319 cfg.feature_flags.per_object_congestion_control_mode =
4320 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4321 ExecutionTimeEstimateParams {
4322 target_utilization: 30,
4323 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4325 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4327 stored_observations_limit: u64::MAX,
4328 stake_weighted_median_threshold: 0,
4329 default_none_duration_for_new_keys: false,
4330 observations_chunk_size: None,
4331 },
4332 );
4333
4334 cfg.feature_flags.consensus_batched_block_sync = true;
4336
4337 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4340 cfg.feature_flags.enable_nitro_attestation = true;
4341 }
4342
4343 cfg.feature_flags.per_object_congestion_control_mode =
4345 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4346 ExecutionTimeEstimateParams {
4347 target_utilization: 30,
4348 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4350 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4352 stored_observations_limit: 20,
4353 stake_weighted_median_threshold: 0,
4354 default_none_duration_for_new_keys: false,
4355 observations_chunk_size: None,
4356 },
4357 );
4358 cfg.feature_flags.allow_unbounded_system_objects = true;
4359 }
4360 85 => {
4361 if chain != Chain::Mainnet && chain != Chain::Testnet {
4362 cfg.feature_flags.enable_party_transfer = true;
4363 }
4364
4365 cfg.feature_flags
4366 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4367 cfg.feature_flags.disallow_self_identifier = true;
4368 cfg.feature_flags.per_object_congestion_control_mode =
4369 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4370 ExecutionTimeEstimateParams {
4371 target_utilization: 50,
4372 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4374 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4376 stored_observations_limit: 20,
4377 stake_weighted_median_threshold: 0,
4378 default_none_duration_for_new_keys: false,
4379 observations_chunk_size: None,
4380 },
4381 );
4382 }
4383 86 => {
4384 cfg.feature_flags.type_tags_in_object_runtime = true;
4385 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4386
4387 cfg.feature_flags.per_object_congestion_control_mode =
4389 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4390 ExecutionTimeEstimateParams {
4391 target_utilization: 50,
4392 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4394 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4396 stored_observations_limit: 20,
4397 stake_weighted_median_threshold: 3334,
4398 default_none_duration_for_new_keys: false,
4399 observations_chunk_size: None,
4400 },
4401 );
4402 if chain != Chain::Mainnet {
4404 cfg.feature_flags.enable_party_transfer = true;
4405 }
4406 }
4407 87 => {
4408 if chain == Chain::Mainnet {
4409 cfg.feature_flags.record_time_estimate_processed = true;
4410 }
4411 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4412 }
4413 88 => {
4414 cfg.feature_flags.record_time_estimate_processed = true;
4415 cfg.tx_context_rgp_cost_base = Some(30);
4416 cfg.feature_flags
4417 .ignore_execution_time_observations_after_certs_closed = true;
4418
4419 cfg.feature_flags.per_object_congestion_control_mode =
4422 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4423 ExecutionTimeEstimateParams {
4424 target_utilization: 50,
4425 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4427 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4429 stored_observations_limit: 20,
4430 stake_weighted_median_threshold: 3334,
4431 default_none_duration_for_new_keys: true,
4432 observations_chunk_size: None,
4433 },
4434 );
4435 }
4436 89 => {
4437 cfg.feature_flags.dependency_linkage_error = true;
4438 cfg.feature_flags.additional_multisig_checks = true;
4439 }
4440 90 => {
4441 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4443 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4444 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4445 cfg.feature_flags.accept_passkey_in_multisig = true;
4446 cfg.feature_flags.passkey_auth = true;
4447 cfg.feature_flags.check_for_init_during_upgrade = true;
4448
4449 if chain != Chain::Mainnet {
4451 cfg.feature_flags.mysticeti_fastpath = true;
4452 }
4453 }
4454 91 => {
4455 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4456 }
4457 92 => {
4458 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4459 }
4460 93 => {
4461 cfg.feature_flags
4462 .consensus_checkpoint_signature_key_includes_digest = true;
4463 }
4464 94 => {
4465 cfg.feature_flags.per_object_congestion_control_mode =
4467 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4468 ExecutionTimeEstimateParams {
4469 target_utilization: 50,
4470 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4472 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4474 stored_observations_limit: 18,
4475 stake_weighted_median_threshold: 3334,
4476 default_none_duration_for_new_keys: true,
4477 observations_chunk_size: None,
4478 },
4479 );
4480
4481 cfg.feature_flags.enable_party_transfer = true;
4483 }
4484 95 => {
4485 cfg.type_name_id_base_cost = Some(52);
4486
4487 cfg.max_transactions_per_checkpoint = Some(20_000);
4489 }
4490 96 => {
4491 if chain != Chain::Mainnet && chain != Chain::Testnet {
4493 cfg.feature_flags
4494 .include_checkpoint_artifacts_digest_in_summary = true;
4495 }
4496 cfg.feature_flags.correct_gas_payment_limit_check = true;
4497 cfg.feature_flags.authority_capabilities_v2 = true;
4498 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4499 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4500 cfg.feature_flags.enable_coin_registry = true;
4501
4502 cfg.feature_flags.mysticeti_fastpath = true;
4504 }
4505 97 => {
4506 cfg.feature_flags.additional_borrow_checks = true;
4507 }
4508 98 => {
4509 cfg.event_emit_auth_stream_cost = Some(52);
4510 cfg.feature_flags.better_loader_errors = true;
4511 cfg.feature_flags.generate_df_type_layouts = true;
4512 }
4513 99 => {
4514 cfg.feature_flags.use_new_commit_handler = true;
4515 }
4516 100 => {
4517 cfg.feature_flags.private_generics_verifier_v2 = true;
4518 }
4519 101 => {
4520 cfg.feature_flags.create_root_accumulator_object = true;
4521 cfg.max_updates_per_settlement_txn = Some(100);
4522 if chain != Chain::Mainnet {
4523 cfg.feature_flags.enable_poseidon = true;
4524 }
4525 }
4526 102 => {
4527 cfg.feature_flags.per_object_congestion_control_mode =
4531 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4532 ExecutionTimeEstimateParams {
4533 target_utilization: 50,
4534 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4536 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4538 stored_observations_limit: 180,
4539 stake_weighted_median_threshold: 3334,
4540 default_none_duration_for_new_keys: true,
4541 observations_chunk_size: Some(18),
4542 },
4543 );
4544 cfg.feature_flags.deprecate_global_storage_ops = true;
4545 }
4546 103 => {}
4547 104 => {
4548 cfg.translation_per_command_base_charge = Some(1);
4549 cfg.translation_per_input_base_charge = Some(1);
4550 cfg.translation_pure_input_per_byte_charge = Some(1);
4551 cfg.translation_per_type_node_charge = Some(1);
4552 cfg.translation_per_reference_node_charge = Some(1);
4553 cfg.translation_per_linkage_entry_charge = Some(10);
4554 cfg.gas_model_version = Some(11);
4555 cfg.feature_flags.abstract_size_in_object_runtime = true;
4556 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4557 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4558 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4559 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4560 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4561 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4562 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4563 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4564 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4565 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4566 cfg.feature_flags.enable_ptb_execution_v2 = true;
4567
4568 cfg.poseidon_bn254_cost_base = Some(260);
4569
4570 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4571
4572 if chain != Chain::Mainnet {
4573 cfg.feature_flags
4574 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4575 }
4576
4577 cfg.feature_flags
4578 .include_cancelled_randomness_txns_in_prologue = true;
4579 }
4580 105 => {
4581 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4582 cfg.feature_flags.disable_preconsensus_locking = true;
4583
4584 if chain != Chain::Mainnet {
4585 cfg.feature_flags
4586 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4587 }
4588 }
4589 106 => {
4590 cfg.accumulator_object_storage_cost = Some(7600);
4592
4593 if chain != Chain::Mainnet && chain != Chain::Testnet {
4594 cfg.feature_flags.enable_accumulators = true;
4595 cfg.feature_flags.enable_address_balance_gas_payments = true;
4596 cfg.feature_flags.enable_authenticated_event_streams = true;
4597 cfg.feature_flags.enable_object_funds_withdraw = true;
4598 }
4599 }
4600 107 => {
4601 cfg.feature_flags
4602 .consensus_skip_gced_blocks_in_direct_finalization = true;
4603
4604 if in_integration_test() {
4606 cfg.consensus_gc_depth = Some(6);
4607 cfg.consensus_max_num_transactions_in_block = Some(8);
4608 }
4609 }
4610 108 => {
4611 cfg.feature_flags.gas_rounding_halve_digits = true;
4612 cfg.feature_flags.flexible_tx_context_positions = true;
4613 cfg.feature_flags.disable_entry_point_signature_check = true;
4614
4615 if chain != Chain::Mainnet {
4616 cfg.feature_flags.address_aliases = true;
4617
4618 cfg.feature_flags.enable_accumulators = true;
4619 cfg.feature_flags.enable_address_balance_gas_payments = true;
4620 }
4621
4622 cfg.feature_flags.enable_poseidon = true;
4623 }
4624 109 => {
4625 cfg.binary_variant_handles = Some(1024);
4626 cfg.binary_variant_instantiation_handles = Some(1024);
4627 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4628 }
4629 110 => {
4630 cfg.feature_flags
4631 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4632 cfg.feature_flags
4633 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4634 if chain != Chain::Mainnet && chain != Chain::Testnet {
4635 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4636 }
4637 cfg.feature_flags.validate_zklogin_public_identifier = true;
4638 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4639 cfg.feature_flags
4640 .consensus_always_accept_system_transactions = true;
4641 if chain != Chain::Mainnet {
4642 cfg.feature_flags.enable_object_funds_withdraw = true;
4643 }
4644 }
4645 111 => {
4646 cfg.feature_flags.validator_metadata_verify_v2 = true;
4647 }
4648 112 => {
4649 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4650 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4651 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4652 cfg.group_ops_ristretto_point_add_cost = Some(500);
4653 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4654 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4655 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4656 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4657 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4658 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4659
4660 if chain != Chain::Mainnet && chain != Chain::Testnet {
4661 cfg.feature_flags.enable_ristretto255_group_ops = true;
4662 }
4663 }
4664 113 => {
4665 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4666 if chain != Chain::Mainnet && chain != Chain::Testnet {
4667 cfg.feature_flags.defer_unpaid_amplification = true;
4668 }
4669 }
4670 114 => {
4671 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4672 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4673 if chain != Chain::Mainnet {
4674 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4675 cfg.feature_flags.enable_authenticated_event_streams = true;
4676 cfg.feature_flags
4677 .include_checkpoint_artifacts_digest_in_summary = true;
4678 }
4679 }
4680 115 => {
4681 cfg.feature_flags.normalize_depth_formula = true;
4682 }
4683 116 => {
4684 cfg.feature_flags.gasless_transaction_drop_safety = true;
4685 cfg.feature_flags.address_aliases = true;
4686 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4687 cfg.feature_flags.defer_unpaid_amplification = false;
4689 cfg.feature_flags.enable_display_registry = true;
4690 }
4691 117 => {}
4692 118 => {}
4693 119 => {
4694 cfg.execution_version = Some(4);
4696 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4697 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4698 }
4699 _ => panic!("unsupported version {:?}", version),
4710 }
4711 }
4712
4713 cfg
4714 }
4715
4716 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4717 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4718 || !self.feature_flags.split_checkpoints_in_consensus_handler
4719 {
4720 return;
4721 }
4722
4723 if !mysten_common::in_test_configuration() {
4724 return;
4725 }
4726
4727 use rand::{Rng, SeedableRng, rngs::StdRng};
4728 let mut rng = StdRng::from_seed(*seed);
4729 let max_txns = rng.gen_range(10..=100u64);
4730 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4731 self.max_transactions_per_checkpoint = Some(max_txns);
4732 }
4733
4734 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4740 let (
4741 max_back_edges_per_function,
4742 max_back_edges_per_module,
4743 sanity_check_with_regex_reference_safety,
4744 ) = if let Some((
4745 max_back_edges_per_function,
4746 max_back_edges_per_module,
4747 sanity_check_with_regex_reference_safety,
4748 )) = signing_limits
4749 {
4750 (
4751 Some(max_back_edges_per_function),
4752 Some(max_back_edges_per_module),
4753 Some(sanity_check_with_regex_reference_safety),
4754 )
4755 } else {
4756 (None, None, None)
4757 };
4758
4759 let additional_borrow_checks = if signing_limits.is_some() {
4760 true
4762 } else {
4763 self.additional_borrow_checks()
4764 };
4765 let deprecate_global_storage_ops = if signing_limits.is_some() {
4766 true
4768 } else {
4769 self.deprecate_global_storage_ops()
4770 };
4771
4772 VerifierConfig {
4773 max_loop_depth: Some(self.max_loop_depth() as usize),
4774 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4775 max_function_parameters: Some(self.max_function_parameters() as usize),
4776 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4777 max_value_stack_size: self.max_value_stack_size() as usize,
4778 max_type_nodes: Some(self.max_type_nodes() as usize),
4779 max_push_size: Some(self.max_push_size() as usize),
4780 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4781 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4782 max_function_definitions: Some(self.max_function_definitions() as usize),
4783 max_data_definitions: Some(self.max_struct_definitions() as usize),
4784 max_constant_vector_len: Some(self.max_move_vector_len()),
4785 max_back_edges_per_function,
4786 max_back_edges_per_module,
4787 max_basic_blocks_in_script: None,
4788 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4790 allow_receiving_object_id: self.allow_receiving_object_id(),
4791 reject_mutable_random_on_entry_functions: self
4792 .reject_mutable_random_on_entry_functions(),
4793 bytecode_version: self.move_binary_format_version(),
4794 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4795 additional_borrow_checks,
4796 better_loader_errors: self.better_loader_errors(),
4797 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4798 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4799 .map(|limit| limit as u128),
4800 deprecate_global_storage_ops,
4801 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4802 switch_to_regex_reference_safety: false,
4803 }
4804 }
4805
4806 pub fn binary_config(
4807 &self,
4808 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4809 ) -> BinaryConfig {
4810 let deprecate_global_storage_ops =
4811 override_deprecate_global_storage_ops_during_deserialization
4812 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4813 BinaryConfig::new(
4814 self.move_binary_format_version(),
4815 self.min_move_binary_format_version_as_option()
4816 .unwrap_or(VERSION_1),
4817 self.no_extraneous_module_bytes(),
4818 deprecate_global_storage_ops,
4819 TableConfig {
4820 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4821 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4822 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4823 function_instantiations: self
4824 .binary_function_instantiations_as_option()
4825 .unwrap_or(u16::MAX),
4826 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4827 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4828 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4829 address_identifiers: self
4830 .binary_address_identifiers_as_option()
4831 .unwrap_or(u16::MAX),
4832 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4833 struct_def_instantiations: self
4834 .binary_struct_def_instantiations_as_option()
4835 .unwrap_or(u16::MAX),
4836 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4837 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4838 field_instantiations: self
4839 .binary_field_instantiations_as_option()
4840 .unwrap_or(u16::MAX),
4841 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4842 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4843 enum_def_instantiations: self
4844 .binary_enum_def_instantiations_as_option()
4845 .unwrap_or(u16::MAX),
4846 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4847 variant_instantiation_handles: self
4848 .binary_variant_instantiation_handles_as_option()
4849 .unwrap_or(u16::MAX),
4850 },
4851 )
4852 }
4853
4854 pub fn apply_overrides_for_testing(
4858 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4859 ) -> OverrideGuard {
4860 CONFIG_OVERRIDE.with(|ovr| {
4861 let mut cur = ovr.borrow_mut();
4862 assert!(cur.is_none(), "config override already present");
4863 *cur = Some(Box::new(override_fn));
4864 OverrideGuard
4865 })
4866 }
4867}
4868
4869impl ProtocolConfig {
4873 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4874 self.feature_flags
4875 .advance_to_highest_supported_protocol_version = val
4876 }
4877 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4878 self.feature_flags.commit_root_state_digest = val
4879 }
4880 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4881 self.feature_flags.zklogin_auth = val
4882 }
4883 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4884 self.feature_flags.enable_jwk_consensus_updates = val
4885 }
4886 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4887 self.feature_flags.random_beacon = val
4888 }
4889
4890 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4891 self.feature_flags.upgraded_multisig_supported = val
4892 }
4893 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4894 self.feature_flags.accept_zklogin_in_multisig = val
4895 }
4896
4897 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4898 self.feature_flags.shared_object_deletion = val;
4899 }
4900
4901 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4902 self.feature_flags.narwhal_new_leader_election_schedule = val;
4903 }
4904
4905 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4906 self.feature_flags.receive_objects = val
4907 }
4908 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4909 self.feature_flags.narwhal_certificate_v2 = val
4910 }
4911 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4912 self.feature_flags.verify_legacy_zklogin_address = val
4913 }
4914
4915 pub fn set_per_object_congestion_control_mode_for_testing(
4916 &mut self,
4917 val: PerObjectCongestionControlMode,
4918 ) {
4919 self.feature_flags.per_object_congestion_control_mode = val;
4920 }
4921
4922 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4923 self.feature_flags.consensus_choice = val;
4924 }
4925
4926 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4927 self.feature_flags.consensus_network = val;
4928 }
4929
4930 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4931 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4932 }
4933
4934 pub fn set_disable_bridge_for_testing(&mut self) {
4935 self.feature_flags.bridge = false
4936 }
4937
4938 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4939 self.feature_flags.mysticeti_num_leaders_per_round = val;
4940 }
4941
4942 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4943 self.feature_flags.soft_bundle = val;
4944 }
4945
4946 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4947 self.feature_flags.passkey_auth = val
4948 }
4949
4950 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4951 self.feature_flags.enable_party_transfer = val
4952 }
4953
4954 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4955 self.feature_flags
4956 .consensus_distributed_vote_scoring_strategy = val;
4957 }
4958
4959 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4960 self.feature_flags.consensus_round_prober = val;
4961 }
4962
4963 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4964 self.feature_flags
4965 .disallow_new_modules_in_deps_only_packages = val;
4966 }
4967
4968 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4969 self.feature_flags.correct_gas_payment_limit_check = val;
4970 }
4971
4972 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4973 self.feature_flags.address_aliases = val;
4974 }
4975
4976 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4977 self.feature_flags
4978 .consensus_round_prober_probe_accepted_rounds = val;
4979 }
4980
4981 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4982 self.feature_flags.mysticeti_fastpath = val;
4983 }
4984
4985 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4986 self.feature_flags.accept_passkey_in_multisig = val;
4987 }
4988
4989 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4990 self.feature_flags.consensus_batched_block_sync = val;
4991 }
4992
4993 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4994 self.feature_flags.record_time_estimate_processed = val;
4995 }
4996
4997 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4998 &mut self,
4999 val: bool,
5000 ) {
5001 self.feature_flags
5002 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5003 }
5004
5005 pub fn enable_accumulators_for_testing(&mut self) {
5006 self.feature_flags.enable_accumulators = true;
5007 }
5008
5009 pub fn disable_accumulators_for_testing(&mut self) {
5010 self.feature_flags.enable_accumulators = false;
5011 self.feature_flags.enable_address_balance_gas_payments = false;
5012 }
5013
5014 pub fn enable_coin_reservation_for_testing(&mut self) {
5015 self.feature_flags.enable_coin_reservation_obj_refs = true;
5016 }
5017
5018 pub fn create_root_accumulator_object_for_testing(&mut self) {
5019 self.feature_flags.create_root_accumulator_object = true;
5020 }
5021
5022 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5023 self.feature_flags.create_root_accumulator_object = false;
5024 }
5025
5026 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5027 self.feature_flags.enable_accumulators = true;
5028 self.feature_flags.allow_private_accumulator_entrypoints = true;
5029 self.feature_flags.enable_address_balance_gas_payments = true;
5030 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5031 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5032 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5033 }
5034
5035 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5036 self.feature_flags.enable_address_balance_gas_payments = false;
5037 }
5038
5039 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5040 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5041 }
5042
5043 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5044 self.enable_accumulators_for_testing();
5045 self.feature_flags.enable_authenticated_event_streams = true;
5046 self.feature_flags
5047 .include_checkpoint_artifacts_digest_in_summary = true;
5048 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5049 }
5050
5051 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5052 self.feature_flags.enable_authenticated_event_streams = false;
5053 }
5054
5055 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5056 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5057 }
5058
5059 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5060 self.feature_flags.enable_non_exclusive_writes = true;
5061 }
5062
5063 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5064 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5065 }
5066
5067 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5068 &mut self,
5069 val: bool,
5070 ) {
5071 self.feature_flags
5072 .ignore_execution_time_observations_after_certs_closed = val;
5073 }
5074
5075 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5076 &mut self,
5077 val: bool,
5078 ) {
5079 self.feature_flags
5080 .consensus_checkpoint_signature_key_includes_digest = val;
5081 }
5082
5083 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5084 self.feature_flags.cancel_for_failed_dkg_early = val;
5085 }
5086
5087 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5088 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5089 }
5090
5091 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5092 self.feature_flags.authority_capabilities_v2 = val;
5093 }
5094
5095 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5096 self.feature_flags.allow_references_in_ptbs = true;
5097 }
5098
5099 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5100 self.feature_flags.consensus_skip_gced_accept_votes = val;
5101 }
5102
5103 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5104 self.feature_flags.enable_object_funds_withdraw = val;
5105 }
5106
5107 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5108 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5109 }
5110
5111 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5112 self.feature_flags.merge_randomness_into_checkpoint = val;
5113 }
5114}
5115
5116type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5117
5118thread_local! {
5119 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5120}
5121
5122#[must_use]
5123pub struct OverrideGuard;
5124
5125impl Drop for OverrideGuard {
5126 fn drop(&mut self) {
5127 info!("restoring override fn");
5128 CONFIG_OVERRIDE.with(|ovr| {
5129 *ovr.borrow_mut() = None;
5130 });
5131 }
5132}
5133
5134#[derive(PartialEq, Eq)]
5137pub enum LimitThresholdCrossed {
5138 None,
5139 Soft(u128, u128),
5140 Hard(u128, u128),
5141}
5142
5143pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5146 x: T,
5147 soft_limit: U,
5148 hard_limit: V,
5149) -> LimitThresholdCrossed {
5150 let x: V = x.into();
5151 let soft_limit: V = soft_limit.into();
5152
5153 debug_assert!(soft_limit <= hard_limit);
5154
5155 if x >= hard_limit {
5158 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5159 } else if x < soft_limit {
5160 LimitThresholdCrossed::None
5161 } else {
5162 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5163 }
5164}
5165
5166#[macro_export]
5167macro_rules! check_limit {
5168 ($x:expr, $hard:expr) => {
5169 check_limit!($x, $hard, $hard)
5170 };
5171 ($x:expr, $soft:expr, $hard:expr) => {
5172 check_limit_in_range($x as u64, $soft, $hard)
5173 };
5174}
5175
5176#[macro_export]
5180macro_rules! check_limit_by_meter {
5181 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5182 let (h, metered_str) = if $is_metered {
5184 ($metered_limit, "metered")
5185 } else {
5186 ($unmetered_hard_limit, "unmetered")
5188 };
5189 use sui_protocol_config::check_limit_in_range;
5190 let result = check_limit_in_range($x as u64, $metered_limit, h);
5191 match result {
5192 LimitThresholdCrossed::None => {}
5193 LimitThresholdCrossed::Soft(_, _) => {
5194 $metric.with_label_values(&[metered_str, "soft"]).inc();
5195 }
5196 LimitThresholdCrossed::Hard(_, _) => {
5197 $metric.with_label_values(&[metered_str, "hard"]).inc();
5198 }
5199 };
5200 result
5201 }};
5202}
5203#[cfg(all(test, not(msim)))]
5204mod test {
5205 use insta::assert_yaml_snapshot;
5206
5207 use super::*;
5208
5209 #[test]
5210 fn snapshot_tests() {
5211 println!("\n============================================================================");
5212 println!("! !");
5213 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5214 println!("! !");
5215 println!("============================================================================\n");
5216 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5217 let chain_str = match chain_id {
5221 Chain::Unknown => "".to_string(),
5222 _ => format!("{:?}_", chain_id),
5223 };
5224 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5225 let cur = ProtocolVersion::new(i);
5226 assert_yaml_snapshot!(
5227 format!("{}version_{}", chain_str, cur.as_u64()),
5228 ProtocolConfig::get_for_version(cur, *chain_id)
5229 );
5230 }
5231 }
5232 }
5233
5234 #[test]
5235 fn test_getters() {
5236 let prot: ProtocolConfig =
5237 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5238 assert_eq!(
5239 prot.max_arguments(),
5240 prot.max_arguments_as_option().unwrap()
5241 );
5242 }
5243
5244 #[test]
5245 fn test_setters() {
5246 let mut prot: ProtocolConfig =
5247 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5248 prot.set_max_arguments_for_testing(123);
5249 assert_eq!(prot.max_arguments(), 123);
5250
5251 prot.set_max_arguments_from_str_for_testing("321".to_string());
5252 assert_eq!(prot.max_arguments(), 321);
5253
5254 prot.disable_max_arguments_for_testing();
5255 assert_eq!(prot.max_arguments_as_option(), None);
5256
5257 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5258 assert_eq!(prot.max_arguments(), 456);
5259 }
5260
5261 #[test]
5262 #[should_panic(expected = "unsupported version")]
5263 fn max_version_test() {
5264 let _ = ProtocolConfig::get_for_version_impl(
5267 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5268 Chain::Unknown,
5269 );
5270 }
5271
5272 #[test]
5273 fn lookup_by_string_test() {
5274 let prot: ProtocolConfig =
5275 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5276 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5278
5279 assert!(
5280 prot.lookup_attr("max_arguments".to_string())
5281 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5282 );
5283
5284 assert!(
5286 prot.lookup_attr("max_move_identifier_len".to_string())
5287 .is_none()
5288 );
5289
5290 let prot: ProtocolConfig =
5292 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5293 assert!(
5294 prot.lookup_attr("max_move_identifier_len".to_string())
5295 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5296 );
5297
5298 let prot: ProtocolConfig =
5299 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5300 assert!(
5302 prot.attr_map()
5303 .get("max_move_identifier_len")
5304 .unwrap()
5305 .is_none()
5306 );
5307 assert!(
5309 prot.attr_map().get("max_arguments").unwrap()
5310 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5311 );
5312
5313 let prot: ProtocolConfig =
5315 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5316 assert!(
5318 prot.feature_flags
5319 .lookup_attr("some random string".to_owned())
5320 .is_none()
5321 );
5322 assert!(
5323 !prot
5324 .feature_flags
5325 .attr_map()
5326 .contains_key("some random string")
5327 );
5328
5329 assert!(
5331 prot.feature_flags
5332 .lookup_attr("package_upgrades".to_owned())
5333 == Some(false)
5334 );
5335 assert!(
5336 prot.feature_flags
5337 .attr_map()
5338 .get("package_upgrades")
5339 .unwrap()
5340 == &false
5341 );
5342 let prot: ProtocolConfig =
5343 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5344 assert!(
5346 prot.feature_flags
5347 .lookup_attr("package_upgrades".to_owned())
5348 == Some(true)
5349 );
5350 assert!(
5351 prot.feature_flags
5352 .attr_map()
5353 .get("package_upgrades")
5354 .unwrap()
5355 == &true
5356 );
5357 }
5358
5359 #[test]
5360 fn limit_range_fn_test() {
5361 let low = 100u32;
5362 let high = 10000u64;
5363
5364 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5365 assert!(matches!(
5366 check_limit!(255u16, low, high),
5367 LimitThresholdCrossed::Soft(255u128, 100)
5368 ));
5369 assert!(matches!(
5375 check_limit!(2550000u64, low, high),
5376 LimitThresholdCrossed::Hard(2550000, 10000)
5377 ));
5378
5379 assert!(matches!(
5380 check_limit!(2550000u64, high, high),
5381 LimitThresholdCrossed::Hard(2550000, 10000)
5382 ));
5383
5384 assert!(matches!(
5385 check_limit!(1u8, high),
5386 LimitThresholdCrossed::None
5387 ));
5388
5389 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5390
5391 assert!(matches!(
5392 check_limit!(2550000u64, high),
5393 LimitThresholdCrossed::Hard(2550000, 10000)
5394 ));
5395 }
5396}