1use std::{
5 collections::BTreeSet,
6 sync::atomic::{AtomicBool, Ordering},
7};
8
9#[cfg(msim)]
10use std::cell::RefCell;
11#[cfg(not(msim))]
12use std::sync::Mutex;
13
14use clap::*;
15use fastcrypto::encoding::{Base58, Encoding, Hex};
16use move_binary_format::{
17 binary_config::{BinaryConfig, TableConfig},
18 file_format_common::VERSION_1,
19};
20use move_vm_config::verifier::VerifierConfig;
21use mysten_common::in_integration_test;
22use serde::{Deserialize, Serialize};
23use serde_with::skip_serializing_none;
24use sui_protocol_config_macros::{
25 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
26};
27use tracing::{info, warn};
28
29const MIN_PROTOCOL_VERSION: u64 = 1;
31const MAX_PROTOCOL_VERSION: u64 = 122;
32
33const TESTNET_USDC: &str =
34 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
35
36#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
322pub struct ProtocolVersion(u64);
323
324impl ProtocolVersion {
325 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
330
331 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
332
333 #[cfg(not(msim))]
334 pub const MAX_ALLOWED: Self = Self::MAX;
335
336 #[cfg(msim)]
338 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
339
340 pub fn new(v: u64) -> Self {
341 Self(v)
342 }
343
344 pub const fn as_u64(&self) -> u64 {
345 self.0
346 }
347
348 pub fn max() -> Self {
351 Self::MAX
352 }
353
354 pub fn prev(self) -> Self {
355 Self(self.0.checked_sub(1).unwrap())
356 }
357}
358
359impl From<u64> for ProtocolVersion {
360 fn from(v: u64) -> Self {
361 Self::new(v)
362 }
363}
364
365impl std::ops::Sub<u64> for ProtocolVersion {
366 type Output = Self;
367 fn sub(self, rhs: u64) -> Self::Output {
368 Self::new(self.0 - rhs)
369 }
370}
371
372impl std::ops::Add<u64> for ProtocolVersion {
373 type Output = Self;
374 fn add(self, rhs: u64) -> Self::Output {
375 Self::new(self.0 + rhs)
376 }
377}
378
379#[derive(
380 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
381)]
382pub enum Chain {
383 Mainnet,
384 Testnet,
385 #[default]
386 Unknown,
387}
388
389impl Chain {
390 pub fn as_str(self) -> &'static str {
391 match self {
392 Chain::Mainnet => "mainnet",
393 Chain::Testnet => "testnet",
394 Chain::Unknown => "unknown",
395 }
396 }
397}
398
399pub struct Error(pub String);
400
401#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
404struct FeatureFlags {
405 #[serde(skip_serializing_if = "is_false")]
408 package_upgrades: bool,
409 #[serde(skip_serializing_if = "is_false")]
412 commit_root_state_digest: bool,
413 #[serde(skip_serializing_if = "is_false")]
415 advance_epoch_start_time_in_safe_mode: bool,
416 #[serde(skip_serializing_if = "is_false")]
419 loaded_child_objects_fixed: bool,
420 #[serde(skip_serializing_if = "is_false")]
423 missing_type_is_compatibility_error: bool,
424 #[serde(skip_serializing_if = "is_false")]
427 scoring_decision_with_validity_cutoff: bool,
428
429 #[serde(skip_serializing_if = "is_false")]
432 consensus_order_end_of_epoch_last: bool,
433
434 #[serde(skip_serializing_if = "is_false")]
436 disallow_adding_abilities_on_upgrade: bool,
437 #[serde(skip_serializing_if = "is_false")]
439 disable_invariant_violation_check_in_swap_loc: bool,
440 #[serde(skip_serializing_if = "is_false")]
443 advance_to_highest_supported_protocol_version: bool,
444 #[serde(skip_serializing_if = "is_false")]
446 ban_entry_init: bool,
447 #[serde(skip_serializing_if = "is_false")]
449 package_digest_hash_module: bool,
450 #[serde(skip_serializing_if = "is_false")]
452 disallow_change_struct_type_params_on_upgrade: bool,
453 #[serde(skip_serializing_if = "is_false")]
455 no_extraneous_module_bytes: bool,
456 #[serde(skip_serializing_if = "is_false")]
458 narwhal_versioned_metadata: bool,
459
460 #[serde(skip_serializing_if = "is_false")]
462 zklogin_auth: bool,
463 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
465 consensus_transaction_ordering: ConsensusTransactionOrdering,
466
467 #[serde(skip_serializing_if = "is_false")]
475 simplified_unwrap_then_delete: bool,
476 #[serde(skip_serializing_if = "is_false")]
478 upgraded_multisig_supported: bool,
479 #[serde(skip_serializing_if = "is_false")]
481 txn_base_cost_as_multiplier: bool,
482
483 #[serde(skip_serializing_if = "is_false")]
485 shared_object_deletion: bool,
486
487 #[serde(skip_serializing_if = "is_false")]
489 narwhal_new_leader_election_schedule: bool,
490
491 #[serde(skip_serializing_if = "is_empty")]
493 zklogin_supported_providers: BTreeSet<String>,
494
495 #[serde(skip_serializing_if = "is_false")]
497 loaded_child_object_format: bool,
498
499 #[serde(skip_serializing_if = "is_false")]
500 enable_jwk_consensus_updates: bool,
501
502 #[serde(skip_serializing_if = "is_false")]
503 end_of_epoch_transaction_supported: bool,
504
505 #[serde(skip_serializing_if = "is_false")]
508 simple_conservation_checks: bool,
509
510 #[serde(skip_serializing_if = "is_false")]
512 loaded_child_object_format_type: bool,
513
514 #[serde(skip_serializing_if = "is_false")]
516 receive_objects: bool,
517
518 #[serde(skip_serializing_if = "is_false")]
520 consensus_checkpoint_signature_key_includes_digest: bool,
521
522 #[serde(skip_serializing_if = "is_false")]
524 random_beacon: bool,
525
526 #[serde(skip_serializing_if = "is_false")]
528 bridge: bool,
529
530 #[serde(skip_serializing_if = "is_false")]
531 enable_effects_v2: bool,
532
533 #[serde(skip_serializing_if = "is_false")]
535 narwhal_certificate_v2: bool,
536
537 #[serde(skip_serializing_if = "is_false")]
539 verify_legacy_zklogin_address: bool,
540
541 #[serde(skip_serializing_if = "is_false")]
543 throughput_aware_consensus_submission: bool,
544
545 #[serde(skip_serializing_if = "is_false")]
547 recompute_has_public_transfer_in_execution: bool,
548
549 #[serde(skip_serializing_if = "is_false")]
551 accept_zklogin_in_multisig: bool,
552
553 #[serde(skip_serializing_if = "is_false")]
555 accept_passkey_in_multisig: bool,
556
557 #[serde(skip_serializing_if = "is_false")]
559 validate_zklogin_public_identifier: bool,
560
561 #[serde(skip_serializing_if = "is_false")]
564 include_consensus_digest_in_prologue: bool,
565
566 #[serde(skip_serializing_if = "is_false")]
568 hardened_otw_check: bool,
569
570 #[serde(skip_serializing_if = "is_false")]
572 allow_receiving_object_id: bool,
573
574 #[serde(skip_serializing_if = "is_false")]
576 enable_poseidon: bool,
577
578 #[serde(skip_serializing_if = "is_false")]
580 enable_coin_deny_list: bool,
581
582 #[serde(skip_serializing_if = "is_false")]
584 enable_group_ops_native_functions: bool,
585
586 #[serde(skip_serializing_if = "is_false")]
588 enable_group_ops_native_function_msm: bool,
589
590 #[serde(skip_serializing_if = "is_false")]
592 enable_ristretto255_group_ops: bool,
593
594 #[serde(skip_serializing_if = "is_false")]
596 enable_nitro_attestation: bool,
597
598 #[serde(skip_serializing_if = "is_false")]
600 enable_nitro_attestation_upgraded_parsing: bool,
601
602 #[serde(skip_serializing_if = "is_false")]
604 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
605
606 #[serde(skip_serializing_if = "is_false")]
608 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
609
610 #[serde(skip_serializing_if = "is_false")]
612 reject_mutable_random_on_entry_functions: bool,
613
614 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
616 per_object_congestion_control_mode: PerObjectCongestionControlMode,
617
618 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
620 consensus_choice: ConsensusChoice,
621
622 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
624 consensus_network: ConsensusNetwork,
625
626 #[serde(skip_serializing_if = "is_false")]
628 correct_gas_payment_limit_check: bool,
629
630 #[serde(skip_serializing_if = "Option::is_none")]
632 zklogin_max_epoch_upper_bound_delta: Option<u64>,
633
634 #[serde(skip_serializing_if = "is_false")]
636 mysticeti_leader_scoring_and_schedule: bool,
637
638 #[serde(skip_serializing_if = "is_false")]
640 reshare_at_same_initial_version: bool,
641
642 #[serde(skip_serializing_if = "is_false")]
644 resolve_abort_locations_to_package_id: bool,
645
646 #[serde(skip_serializing_if = "is_false")]
650 mysticeti_use_committed_subdag_digest: bool,
651
652 #[serde(skip_serializing_if = "is_false")]
654 enable_vdf: bool,
655
656 #[serde(skip_serializing_if = "is_false")]
661 record_consensus_determined_version_assignments_in_prologue: bool,
662 #[serde(skip_serializing_if = "is_false")]
663 record_consensus_determined_version_assignments_in_prologue_v2: bool,
664
665 #[serde(skip_serializing_if = "is_false")]
667 fresh_vm_on_framework_upgrade: bool,
668
669 #[serde(skip_serializing_if = "is_false")]
677 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
678
679 #[serde(skip_serializing_if = "Option::is_none")]
681 mysticeti_num_leaders_per_round: Option<usize>,
682
683 #[serde(skip_serializing_if = "is_false")]
685 soft_bundle: bool,
686
687 #[serde(skip_serializing_if = "is_false")]
689 enable_coin_deny_list_v2: bool,
690
691 #[serde(skip_serializing_if = "is_false")]
693 passkey_auth: bool,
694
695 #[serde(skip_serializing_if = "is_false")]
697 authority_capabilities_v2: bool,
698
699 #[serde(skip_serializing_if = "is_false")]
701 rethrow_serialization_type_layout_errors: bool,
702
703 #[serde(skip_serializing_if = "is_false")]
705 consensus_distributed_vote_scoring_strategy: bool,
706
707 #[serde(skip_serializing_if = "is_false")]
709 consensus_round_prober: bool,
710
711 #[serde(skip_serializing_if = "is_false")]
713 validate_identifier_inputs: bool,
714
715 #[serde(skip_serializing_if = "is_false")]
717 disallow_self_identifier: bool,
718
719 #[serde(skip_serializing_if = "is_false")]
721 mysticeti_fastpath: bool,
722
723 #[serde(skip_serializing_if = "is_false")]
727 disable_preconsensus_locking: bool,
728
729 #[serde(skip_serializing_if = "is_false")]
731 relocate_event_module: bool,
732
733 #[serde(skip_serializing_if = "is_false")]
735 uncompressed_g1_group_elements: bool,
736
737 #[serde(skip_serializing_if = "is_false")]
738 disallow_new_modules_in_deps_only_packages: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 consensus_smart_ancestor_selection: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 consensus_round_prober_probe_accepted_rounds: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
750 native_charging_v2: bool,
751
752 #[serde(skip_serializing_if = "is_false")]
755 consensus_linearize_subdag_v2: bool,
756
757 #[serde(skip_serializing_if = "is_false")]
759 convert_type_argument_error: bool,
760
761 #[serde(skip_serializing_if = "is_false")]
763 variant_nodes: bool,
764
765 #[serde(skip_serializing_if = "is_false")]
767 consensus_zstd_compression: bool,
768
769 #[serde(skip_serializing_if = "is_false")]
771 minimize_child_object_mutations: bool,
772
773 #[serde(skip_serializing_if = "is_false")]
775 record_additional_state_digest_in_prologue: bool,
776
777 #[serde(skip_serializing_if = "is_false")]
779 move_native_context: bool,
780
781 #[serde(skip_serializing_if = "is_false")]
784 consensus_median_based_commit_timestamp: bool,
785
786 #[serde(skip_serializing_if = "is_false")]
789 normalize_ptb_arguments: bool,
790
791 #[serde(skip_serializing_if = "is_false")]
793 consensus_batched_block_sync: bool,
794
795 #[serde(skip_serializing_if = "is_false")]
797 enforce_checkpoint_timestamp_monotonicity: bool,
798
799 #[serde(skip_serializing_if = "is_false")]
801 max_ptb_value_size_v2: bool,
802
803 #[serde(skip_serializing_if = "is_false")]
805 resolve_type_input_ids_to_defining_id: bool,
806
807 #[serde(skip_serializing_if = "is_false")]
809 enable_party_transfer: bool,
810
811 #[serde(skip_serializing_if = "is_false")]
813 allow_unbounded_system_objects: bool,
814
815 #[serde(skip_serializing_if = "is_false")]
817 type_tags_in_object_runtime: bool,
818
819 #[serde(skip_serializing_if = "is_false")]
821 enable_accumulators: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
825 enable_coin_reservation_obj_refs: bool,
826
827 #[serde(skip_serializing_if = "is_false")]
830 create_root_accumulator_object: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
834 enable_authenticated_event_streams: bool,
835
836 #[serde(skip_serializing_if = "is_false")]
838 enable_address_balance_gas_payments: bool,
839
840 #[serde(skip_serializing_if = "is_false")]
842 address_balance_gas_check_rgp_at_signing: bool,
843
844 #[serde(skip_serializing_if = "is_false")]
845 address_balance_gas_reject_gas_coin_arg: bool,
846
847 #[serde(skip_serializing_if = "is_false")]
849 enable_multi_epoch_transaction_expiration: bool,
850
851 #[serde(skip_serializing_if = "is_false")]
853 relax_valid_during_for_owned_inputs: bool,
854
855 #[serde(skip_serializing_if = "is_false")]
857 enable_ptb_execution_v2: bool,
858
859 #[serde(skip_serializing_if = "is_false")]
861 better_adapter_type_resolution_errors: bool,
862
863 #[serde(skip_serializing_if = "is_false")]
865 record_time_estimate_processed: bool,
866
867 #[serde(skip_serializing_if = "is_false")]
869 dependency_linkage_error: bool,
870
871 #[serde(skip_serializing_if = "is_false")]
873 additional_multisig_checks: bool,
874
875 #[serde(skip_serializing_if = "is_false")]
877 ignore_execution_time_observations_after_certs_closed: bool,
878
879 #[serde(skip_serializing_if = "is_false")]
883 debug_fatal_on_move_invariant_violation: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
888 allow_private_accumulator_entrypoints: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 additional_consensus_digest_indirect_state: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
896 check_for_init_during_upgrade: bool,
897
898 #[serde(skip_serializing_if = "is_false")]
900 per_command_shared_object_transfer_rules: bool,
901
902 #[serde(skip_serializing_if = "is_false")]
904 include_checkpoint_artifacts_digest_in_summary: bool,
905
906 #[serde(skip_serializing_if = "is_false")]
908 use_mfp_txns_in_load_initial_object_debts: bool,
909
910 #[serde(skip_serializing_if = "is_false")]
912 cancel_for_failed_dkg_early: bool,
913
914 #[serde(skip_serializing_if = "is_false")]
916 enable_coin_registry: bool,
917
918 #[serde(skip_serializing_if = "is_false")]
920 abstract_size_in_object_runtime: bool,
921
922 #[serde(skip_serializing_if = "is_false")]
924 object_runtime_charge_cache_load_gas: bool,
925
926 #[serde(skip_serializing_if = "is_false")]
928 additional_borrow_checks: bool,
929
930 #[serde(skip_serializing_if = "is_false")]
932 use_new_commit_handler: bool,
933
934 #[serde(skip_serializing_if = "is_false")]
936 better_loader_errors: bool,
937
938 #[serde(skip_serializing_if = "is_false")]
940 generate_df_type_layouts: bool,
941
942 #[serde(skip_serializing_if = "is_false")]
944 allow_references_in_ptbs: bool,
945
946 #[serde(skip_serializing_if = "is_false")]
948 enable_display_registry: bool,
949
950 #[serde(skip_serializing_if = "is_false")]
952 private_generics_verifier_v2: bool,
953
954 #[serde(skip_serializing_if = "is_false")]
956 deprecate_global_storage_ops_during_deserialization: bool,
957
958 #[serde(skip_serializing_if = "is_false")]
961 enable_non_exclusive_writes: bool,
962
963 #[serde(skip_serializing_if = "is_false")]
965 deprecate_global_storage_ops: bool,
966
967 #[serde(skip_serializing_if = "is_false")]
969 normalize_depth_formula: bool,
970
971 #[serde(skip_serializing_if = "is_false")]
973 consensus_skip_gced_accept_votes: bool,
974
975 #[serde(skip_serializing_if = "is_false")]
977 include_cancelled_randomness_txns_in_prologue: bool,
978
979 #[serde(skip_serializing_if = "is_false")]
981 address_aliases: bool,
982
983 #[serde(skip_serializing_if = "is_false")]
986 fix_checkpoint_signature_mapping: bool,
987
988 #[serde(skip_serializing_if = "is_false")]
990 enable_object_funds_withdraw: bool,
991
992 #[serde(skip_serializing_if = "is_false")]
994 consensus_skip_gced_blocks_in_direct_finalization: bool,
995
996 #[serde(skip_serializing_if = "is_false")]
998 gas_rounding_halve_digits: bool,
999
1000 #[serde(skip_serializing_if = "is_false")]
1002 flexible_tx_context_positions: bool,
1003
1004 #[serde(skip_serializing_if = "is_false")]
1006 disable_entry_point_signature_check: bool,
1007
1008 #[serde(skip_serializing_if = "is_false")]
1010 convert_withdrawal_compatibility_ptb_arguments: bool,
1011
1012 #[serde(skip_serializing_if = "is_false")]
1014 restrict_hot_or_not_entry_functions: bool,
1015
1016 #[serde(skip_serializing_if = "is_false")]
1018 split_checkpoints_in_consensus_handler: bool,
1019
1020 #[serde(skip_serializing_if = "is_false")]
1022 consensus_always_accept_system_transactions: bool,
1023
1024 #[serde(skip_serializing_if = "is_false")]
1026 validator_metadata_verify_v2: bool,
1027
1028 #[serde(skip_serializing_if = "is_false")]
1031 defer_unpaid_amplification: bool,
1032
1033 #[serde(skip_serializing_if = "is_false")]
1034 randomize_checkpoint_tx_limit_in_tests: bool,
1035
1036 #[serde(skip_serializing_if = "is_false")]
1038 gasless_transaction_drop_safety: bool,
1039
1040 #[serde(skip_serializing_if = "is_false")]
1042 merge_randomness_into_checkpoint: bool,
1043
1044 #[serde(skip_serializing_if = "is_false")]
1046 use_coin_party_owner: bool,
1047
1048 #[serde(skip_serializing_if = "is_false")]
1049 enable_gasless: bool,
1050
1051 #[serde(skip_serializing_if = "is_false")]
1052 disallow_jump_orphans: bool,
1053
1054 #[serde(skip_serializing_if = "is_false")]
1056 early_return_receive_object_mismatched_type: bool,
1057}
1058
1059fn is_false(b: &bool) -> bool {
1060 !b
1061}
1062
1063fn is_empty(b: &BTreeSet<String>) -> bool {
1064 b.is_empty()
1065}
1066
1067fn is_zero(val: &u64) -> bool {
1068 *val == 0
1069}
1070
1071#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1073pub enum ConsensusTransactionOrdering {
1074 #[default]
1076 None,
1077 ByGasPrice,
1079}
1080
1081impl ConsensusTransactionOrdering {
1082 pub fn is_none(&self) -> bool {
1083 matches!(self, ConsensusTransactionOrdering::None)
1084 }
1085}
1086
1087#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1088pub struct ExecutionTimeEstimateParams {
1089 pub target_utilization: u64,
1091 pub allowed_txn_cost_overage_burst_limit_us: u64,
1095
1096 pub randomness_scalar: u64,
1099
1100 pub max_estimate_us: u64,
1102
1103 pub stored_observations_num_included_checkpoints: u64,
1106
1107 pub stored_observations_limit: u64,
1109
1110 #[serde(skip_serializing_if = "is_zero")]
1113 pub stake_weighted_median_threshold: u64,
1114
1115 #[serde(skip_serializing_if = "is_false")]
1119 pub default_none_duration_for_new_keys: bool,
1120
1121 #[serde(skip_serializing_if = "Option::is_none")]
1123 pub observations_chunk_size: Option<u64>,
1124}
1125
1126#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1128pub enum PerObjectCongestionControlMode {
1129 #[default]
1130 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1136
1137impl PerObjectCongestionControlMode {
1138 pub fn is_none(&self) -> bool {
1139 matches!(self, PerObjectCongestionControlMode::None)
1140 }
1141}
1142
1143#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1145pub enum ConsensusChoice {
1146 #[default]
1147 Narwhal,
1148 SwapEachEpoch,
1149 Mysticeti,
1150}
1151
1152impl ConsensusChoice {
1153 pub fn is_narwhal(&self) -> bool {
1154 matches!(self, ConsensusChoice::Narwhal)
1155 }
1156}
1157
1158#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1160pub enum ConsensusNetwork {
1161 #[default]
1162 Anemo,
1163 Tonic,
1164}
1165
1166impl ConsensusNetwork {
1167 pub fn is_anemo(&self) -> bool {
1168 matches!(self, ConsensusNetwork::Anemo)
1169 }
1170}
1171
1172#[skip_serializing_none]
1204#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1205pub struct ProtocolConfig {
1206 pub version: ProtocolVersion,
1207
1208 feature_flags: FeatureFlags,
1209
1210 max_tx_size_bytes: Option<u64>,
1213
1214 max_input_objects: Option<u64>,
1216
1217 max_size_written_objects: Option<u64>,
1221 max_size_written_objects_system_tx: Option<u64>,
1224
1225 max_serialized_tx_effects_size_bytes: Option<u64>,
1227
1228 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1230
1231 max_gas_payment_objects: Option<u32>,
1233
1234 max_modules_in_publish: Option<u32>,
1236
1237 max_package_dependencies: Option<u32>,
1239
1240 max_arguments: Option<u32>,
1243
1244 max_type_arguments: Option<u32>,
1246
1247 max_type_argument_depth: Option<u32>,
1249
1250 max_pure_argument_size: Option<u32>,
1252
1253 max_programmable_tx_commands: Option<u32>,
1255
1256 move_binary_format_version: Option<u32>,
1259 min_move_binary_format_version: Option<u32>,
1260
1261 binary_module_handles: Option<u16>,
1263 binary_struct_handles: Option<u16>,
1264 binary_function_handles: Option<u16>,
1265 binary_function_instantiations: Option<u16>,
1266 binary_signatures: Option<u16>,
1267 binary_constant_pool: Option<u16>,
1268 binary_identifiers: Option<u16>,
1269 binary_address_identifiers: Option<u16>,
1270 binary_struct_defs: Option<u16>,
1271 binary_struct_def_instantiations: Option<u16>,
1272 binary_function_defs: Option<u16>,
1273 binary_field_handles: Option<u16>,
1274 binary_field_instantiations: Option<u16>,
1275 binary_friend_decls: Option<u16>,
1276 binary_enum_defs: Option<u16>,
1277 binary_enum_def_instantiations: Option<u16>,
1278 binary_variant_handles: Option<u16>,
1279 binary_variant_instantiation_handles: Option<u16>,
1280
1281 max_move_object_size: Option<u64>,
1283
1284 max_move_package_size: Option<u64>,
1287
1288 max_publish_or_upgrade_per_ptb: Option<u64>,
1290
1291 max_tx_gas: Option<u64>,
1293
1294 max_gas_price: Option<u64>,
1296
1297 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1300
1301 max_gas_computation_bucket: Option<u64>,
1303
1304 gas_rounding_step: Option<u64>,
1306
1307 max_loop_depth: Option<u64>,
1309
1310 max_generic_instantiation_length: Option<u64>,
1312
1313 max_function_parameters: Option<u64>,
1315
1316 max_basic_blocks: Option<u64>,
1318
1319 max_value_stack_size: Option<u64>,
1321
1322 max_type_nodes: Option<u64>,
1324
1325 max_push_size: Option<u64>,
1327
1328 max_struct_definitions: Option<u64>,
1330
1331 max_function_definitions: Option<u64>,
1333
1334 max_fields_in_struct: Option<u64>,
1336
1337 max_dependency_depth: Option<u64>,
1339
1340 max_num_event_emit: Option<u64>,
1342
1343 max_num_new_move_object_ids: Option<u64>,
1345
1346 max_num_new_move_object_ids_system_tx: Option<u64>,
1348
1349 max_num_deleted_move_object_ids: Option<u64>,
1351
1352 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1354
1355 max_num_transferred_move_object_ids: Option<u64>,
1357
1358 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1360
1361 max_event_emit_size: Option<u64>,
1363
1364 max_event_emit_size_total: Option<u64>,
1366
1367 max_move_vector_len: Option<u64>,
1369
1370 max_move_identifier_len: Option<u64>,
1372
1373 max_move_value_depth: Option<u64>,
1375
1376 max_move_enum_variants: Option<u64>,
1378
1379 max_back_edges_per_function: Option<u64>,
1381
1382 max_back_edges_per_module: Option<u64>,
1384
1385 max_verifier_meter_ticks_per_function: Option<u64>,
1387
1388 max_meter_ticks_per_module: Option<u64>,
1390
1391 max_meter_ticks_per_package: Option<u64>,
1393
1394 object_runtime_max_num_cached_objects: Option<u64>,
1398
1399 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1401
1402 object_runtime_max_num_store_entries: Option<u64>,
1404
1405 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1407
1408 base_tx_cost_fixed: Option<u64>,
1411
1412 package_publish_cost_fixed: Option<u64>,
1415
1416 base_tx_cost_per_byte: Option<u64>,
1419
1420 package_publish_cost_per_byte: Option<u64>,
1422
1423 obj_access_cost_read_per_byte: Option<u64>,
1425
1426 obj_access_cost_mutate_per_byte: Option<u64>,
1428
1429 obj_access_cost_delete_per_byte: Option<u64>,
1431
1432 obj_access_cost_verify_per_byte: Option<u64>,
1442
1443 max_type_to_layout_nodes: Option<u64>,
1445
1446 max_ptb_value_size: Option<u64>,
1448
1449 gas_model_version: Option<u64>,
1452
1453 obj_data_cost_refundable: Option<u64>,
1456
1457 obj_metadata_cost_non_refundable: Option<u64>,
1461
1462 storage_rebate_rate: Option<u64>,
1468
1469 storage_fund_reinvest_rate: Option<u64>,
1472
1473 reward_slashing_rate: Option<u64>,
1476
1477 storage_gas_price: Option<u64>,
1479
1480 accumulator_object_storage_cost: Option<u64>,
1482
1483 max_transactions_per_checkpoint: Option<u64>,
1488
1489 max_checkpoint_size_bytes: Option<u64>,
1493
1494 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1499
1500 address_from_bytes_cost_base: Option<u64>,
1505 address_to_u256_cost_base: Option<u64>,
1507 address_from_u256_cost_base: Option<u64>,
1509
1510 config_read_setting_impl_cost_base: Option<u64>,
1515 config_read_setting_impl_cost_per_byte: Option<u64>,
1516
1517 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1520 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1521 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1522 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1523 dynamic_field_add_child_object_cost_base: Option<u64>,
1525 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1526 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1527 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1528 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1530 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1531 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1532 dynamic_field_remove_child_object_cost_base: Option<u64>,
1534 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1535 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1536 dynamic_field_has_child_object_cost_base: Option<u64>,
1538 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1540 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1541 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1542
1543 event_emit_cost_base: Option<u64>,
1546 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1547 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1548 event_emit_output_cost_per_byte: Option<u64>,
1549 event_emit_auth_stream_cost: Option<u64>,
1550
1551 object_borrow_uid_cost_base: Option<u64>,
1554 object_delete_impl_cost_base: Option<u64>,
1556 object_record_new_uid_cost_base: Option<u64>,
1558
1559 transfer_transfer_internal_cost_base: Option<u64>,
1562 transfer_party_transfer_internal_cost_base: Option<u64>,
1564 transfer_freeze_object_cost_base: Option<u64>,
1566 transfer_share_object_cost_base: Option<u64>,
1568 transfer_receive_object_cost_base: Option<u64>,
1571 transfer_receive_object_cost_per_byte: Option<u64>,
1572 transfer_receive_object_type_cost_per_byte: Option<u64>,
1573
1574 tx_context_derive_id_cost_base: Option<u64>,
1577 tx_context_fresh_id_cost_base: Option<u64>,
1578 tx_context_sender_cost_base: Option<u64>,
1579 tx_context_epoch_cost_base: Option<u64>,
1580 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1581 tx_context_sponsor_cost_base: Option<u64>,
1582 tx_context_rgp_cost_base: Option<u64>,
1583 tx_context_gas_price_cost_base: Option<u64>,
1584 tx_context_gas_budget_cost_base: Option<u64>,
1585 tx_context_ids_created_cost_base: Option<u64>,
1586 tx_context_replace_cost_base: Option<u64>,
1587
1588 types_is_one_time_witness_cost_base: Option<u64>,
1591 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1592 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1593
1594 validator_validate_metadata_cost_base: Option<u64>,
1597 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1598
1599 crypto_invalid_arguments_cost: Option<u64>,
1601 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1603 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1604 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1605
1606 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1608 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1609 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1610
1611 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1613 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1614 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1615 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1616 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1617 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1618
1619 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1621
1622 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1624 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1625 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1626 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1627 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1628 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1629
1630 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1632 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1633 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1634 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1635 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1636 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1637
1638 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1640 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1641 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1642 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1643 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1644 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1645
1646 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1648 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1649 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1650
1651 ed25519_ed25519_verify_cost_base: Option<u64>,
1653 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1654 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1655
1656 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1658 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1659
1660 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1662 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1663 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1664 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1665 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1666
1667 hash_blake2b256_cost_base: Option<u64>,
1669 hash_blake2b256_data_cost_per_byte: Option<u64>,
1670 hash_blake2b256_data_cost_per_block: Option<u64>,
1671
1672 hash_keccak256_cost_base: Option<u64>,
1674 hash_keccak256_data_cost_per_byte: Option<u64>,
1675 hash_keccak256_data_cost_per_block: Option<u64>,
1676
1677 poseidon_bn254_cost_base: Option<u64>,
1679 poseidon_bn254_cost_per_block: Option<u64>,
1680
1681 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1683 group_ops_bls12381_decode_g1_cost: Option<u64>,
1684 group_ops_bls12381_decode_g2_cost: Option<u64>,
1685 group_ops_bls12381_decode_gt_cost: Option<u64>,
1686 group_ops_bls12381_scalar_add_cost: Option<u64>,
1687 group_ops_bls12381_g1_add_cost: Option<u64>,
1688 group_ops_bls12381_g2_add_cost: Option<u64>,
1689 group_ops_bls12381_gt_add_cost: Option<u64>,
1690 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1691 group_ops_bls12381_g1_sub_cost: Option<u64>,
1692 group_ops_bls12381_g2_sub_cost: Option<u64>,
1693 group_ops_bls12381_gt_sub_cost: Option<u64>,
1694 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1695 group_ops_bls12381_g1_mul_cost: Option<u64>,
1696 group_ops_bls12381_g2_mul_cost: Option<u64>,
1697 group_ops_bls12381_gt_mul_cost: Option<u64>,
1698 group_ops_bls12381_scalar_div_cost: Option<u64>,
1699 group_ops_bls12381_g1_div_cost: Option<u64>,
1700 group_ops_bls12381_g2_div_cost: Option<u64>,
1701 group_ops_bls12381_gt_div_cost: Option<u64>,
1702 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1703 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1704 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1705 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1706 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1707 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1708 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1709 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1710 group_ops_bls12381_msm_max_len: Option<u32>,
1711 group_ops_bls12381_pairing_cost: Option<u64>,
1712 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1713 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1714 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1715 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1716 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1717
1718 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1719 group_ops_ristretto_decode_point_cost: Option<u64>,
1720 group_ops_ristretto_scalar_add_cost: Option<u64>,
1721 group_ops_ristretto_point_add_cost: Option<u64>,
1722 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1723 group_ops_ristretto_point_sub_cost: Option<u64>,
1724 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1725 group_ops_ristretto_point_mul_cost: Option<u64>,
1726 group_ops_ristretto_scalar_div_cost: Option<u64>,
1727 group_ops_ristretto_point_div_cost: Option<u64>,
1728
1729 hmac_hmac_sha3_256_cost_base: Option<u64>,
1731 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1732 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1733
1734 check_zklogin_id_cost_base: Option<u64>,
1736 check_zklogin_issuer_cost_base: Option<u64>,
1738
1739 vdf_verify_vdf_cost: Option<u64>,
1740 vdf_hash_to_input_cost: Option<u64>,
1741
1742 nitro_attestation_parse_base_cost: Option<u64>,
1744 nitro_attestation_parse_cost_per_byte: Option<u64>,
1745 nitro_attestation_verify_base_cost: Option<u64>,
1746 nitro_attestation_verify_cost_per_cert: Option<u64>,
1747
1748 bcs_per_byte_serialized_cost: Option<u64>,
1750 bcs_legacy_min_output_size_cost: Option<u64>,
1751 bcs_failure_cost: Option<u64>,
1752
1753 hash_sha2_256_base_cost: Option<u64>,
1754 hash_sha2_256_per_byte_cost: Option<u64>,
1755 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1756 hash_sha3_256_base_cost: Option<u64>,
1757 hash_sha3_256_per_byte_cost: Option<u64>,
1758 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1759 type_name_get_base_cost: Option<u64>,
1760 type_name_get_per_byte_cost: Option<u64>,
1761 type_name_id_base_cost: Option<u64>,
1762
1763 string_check_utf8_base_cost: Option<u64>,
1764 string_check_utf8_per_byte_cost: Option<u64>,
1765 string_is_char_boundary_base_cost: Option<u64>,
1766 string_sub_string_base_cost: Option<u64>,
1767 string_sub_string_per_byte_cost: Option<u64>,
1768 string_index_of_base_cost: Option<u64>,
1769 string_index_of_per_byte_pattern_cost: Option<u64>,
1770 string_index_of_per_byte_searched_cost: Option<u64>,
1771
1772 vector_empty_base_cost: Option<u64>,
1773 vector_length_base_cost: Option<u64>,
1774 vector_push_back_base_cost: Option<u64>,
1775 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1776 vector_borrow_base_cost: Option<u64>,
1777 vector_pop_back_base_cost: Option<u64>,
1778 vector_destroy_empty_base_cost: Option<u64>,
1779 vector_swap_base_cost: Option<u64>,
1780 debug_print_base_cost: Option<u64>,
1781 debug_print_stack_trace_base_cost: Option<u64>,
1782
1783 execution_version: Option<u64>,
1792
1793 consensus_bad_nodes_stake_threshold: Option<u64>,
1797
1798 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1799 max_age_of_jwk_in_epochs: Option<u64>,
1803
1804 random_beacon_reduction_allowed_delta: Option<u16>,
1808
1809 random_beacon_reduction_lower_bound: Option<u32>,
1812
1813 random_beacon_dkg_timeout_round: Option<u32>,
1816
1817 random_beacon_min_round_interval_ms: Option<u64>,
1819
1820 random_beacon_dkg_version: Option<u64>,
1823
1824 consensus_max_transaction_size_bytes: Option<u64>,
1827 consensus_max_transactions_in_block_bytes: Option<u64>,
1829 consensus_max_num_transactions_in_block: Option<u64>,
1831
1832 consensus_voting_rounds: Option<u32>,
1834
1835 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1837
1838 max_deferral_rounds_for_congestion_control: Option<u64>,
1841
1842 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1844
1845 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1847
1848 min_checkpoint_interval_ms: Option<u64>,
1850
1851 checkpoint_summary_version_specific_data: Option<u64>,
1853
1854 max_soft_bundle_size: Option<u64>,
1856
1857 bridge_should_try_to_finalize_committee: Option<bool>,
1861
1862 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1868
1869 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1872
1873 consensus_gc_depth: Option<u32>,
1876
1877 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1879
1880 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1882
1883 sip_45_consensus_amplification_threshold: Option<u64>,
1886
1887 use_object_per_epoch_marker_table_v2: Option<bool>,
1890
1891 consensus_commit_rate_estimation_window_size: Option<u32>,
1893
1894 #[serde(skip_serializing_if = "Vec::is_empty")]
1898 aliased_addresses: Vec<AliasedAddress>,
1899
1900 translation_per_command_base_charge: Option<u64>,
1903
1904 translation_per_input_base_charge: Option<u64>,
1907
1908 translation_pure_input_per_byte_charge: Option<u64>,
1910
1911 translation_per_type_node_charge: Option<u64>,
1915
1916 translation_per_reference_node_charge: Option<u64>,
1919
1920 translation_per_linkage_entry_charge: Option<u64>,
1923
1924 max_updates_per_settlement_txn: Option<u32>,
1926
1927 gasless_max_computation_units: Option<u64>,
1929
1930 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1932
1933 gasless_max_unused_inputs: Option<u64>,
1937
1938 gasless_max_pure_input_bytes: Option<u64>,
1941
1942 gasless_max_tps: Option<u64>,
1944}
1945
1946#[derive(Clone, Serialize, Deserialize, Debug)]
1948pub struct AliasedAddress {
1949 pub original: [u8; 32],
1951 pub aliased: [u8; 32],
1953 pub allowed_tx_digests: Vec<[u8; 32]>,
1955}
1956
1957impl ProtocolConfig {
1959 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1972 if self.feature_flags.package_upgrades {
1973 Ok(())
1974 } else {
1975 Err(Error(format!(
1976 "package upgrades are not supported at {:?}",
1977 self.version
1978 )))
1979 }
1980 }
1981
1982 pub fn allow_receiving_object_id(&self) -> bool {
1983 self.feature_flags.allow_receiving_object_id
1984 }
1985
1986 pub fn receiving_objects_supported(&self) -> bool {
1987 self.feature_flags.receive_objects
1988 }
1989
1990 pub fn package_upgrades_supported(&self) -> bool {
1991 self.feature_flags.package_upgrades
1992 }
1993
1994 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1995 self.feature_flags.commit_root_state_digest
1996 }
1997
1998 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1999 self.feature_flags.advance_epoch_start_time_in_safe_mode
2000 }
2001
2002 pub fn loaded_child_objects_fixed(&self) -> bool {
2003 self.feature_flags.loaded_child_objects_fixed
2004 }
2005
2006 pub fn missing_type_is_compatibility_error(&self) -> bool {
2007 self.feature_flags.missing_type_is_compatibility_error
2008 }
2009
2010 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
2011 self.feature_flags.scoring_decision_with_validity_cutoff
2012 }
2013
2014 pub fn narwhal_versioned_metadata(&self) -> bool {
2015 self.feature_flags.narwhal_versioned_metadata
2016 }
2017
2018 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2019 self.feature_flags.consensus_order_end_of_epoch_last
2020 }
2021
2022 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2023 self.feature_flags.disallow_adding_abilities_on_upgrade
2024 }
2025
2026 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2027 self.feature_flags
2028 .disable_invariant_violation_check_in_swap_loc
2029 }
2030
2031 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2032 self.feature_flags
2033 .advance_to_highest_supported_protocol_version
2034 }
2035
2036 pub fn ban_entry_init(&self) -> bool {
2037 self.feature_flags.ban_entry_init
2038 }
2039
2040 pub fn package_digest_hash_module(&self) -> bool {
2041 self.feature_flags.package_digest_hash_module
2042 }
2043
2044 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2045 self.feature_flags
2046 .disallow_change_struct_type_params_on_upgrade
2047 }
2048
2049 pub fn no_extraneous_module_bytes(&self) -> bool {
2050 self.feature_flags.no_extraneous_module_bytes
2051 }
2052
2053 pub fn zklogin_auth(&self) -> bool {
2054 self.feature_flags.zklogin_auth
2055 }
2056
2057 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2058 &self.feature_flags.zklogin_supported_providers
2059 }
2060
2061 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2062 self.feature_flags.consensus_transaction_ordering
2063 }
2064
2065 pub fn simplified_unwrap_then_delete(&self) -> bool {
2066 self.feature_flags.simplified_unwrap_then_delete
2067 }
2068
2069 pub fn supports_upgraded_multisig(&self) -> bool {
2070 self.feature_flags.upgraded_multisig_supported
2071 }
2072
2073 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2074 self.feature_flags.txn_base_cost_as_multiplier
2075 }
2076
2077 pub fn shared_object_deletion(&self) -> bool {
2078 self.feature_flags.shared_object_deletion
2079 }
2080
2081 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2082 self.feature_flags.narwhal_new_leader_election_schedule
2083 }
2084
2085 pub fn loaded_child_object_format(&self) -> bool {
2086 self.feature_flags.loaded_child_object_format
2087 }
2088
2089 pub fn enable_jwk_consensus_updates(&self) -> bool {
2090 let ret = self.feature_flags.enable_jwk_consensus_updates;
2091 if ret {
2092 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2094 }
2095 ret
2096 }
2097
2098 pub fn simple_conservation_checks(&self) -> bool {
2099 self.feature_flags.simple_conservation_checks
2100 }
2101
2102 pub fn loaded_child_object_format_type(&self) -> bool {
2103 self.feature_flags.loaded_child_object_format_type
2104 }
2105
2106 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2107 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2108 if !ret {
2109 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2111 }
2112 ret
2113 }
2114
2115 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2116 self.feature_flags
2117 .recompute_has_public_transfer_in_execution
2118 }
2119
2120 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2122 self.enable_jwk_consensus_updates()
2123 }
2124
2125 pub fn random_beacon(&self) -> bool {
2126 self.feature_flags.random_beacon
2127 }
2128
2129 pub fn dkg_version(&self) -> u64 {
2130 self.random_beacon_dkg_version.unwrap_or(1)
2132 }
2133
2134 pub fn enable_bridge(&self) -> bool {
2135 let ret = self.feature_flags.bridge;
2136 if ret {
2137 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2139 }
2140 ret
2141 }
2142
2143 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2144 if !self.enable_bridge() {
2145 return false;
2146 }
2147 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2149 }
2150
2151 pub fn enable_effects_v2(&self) -> bool {
2152 self.feature_flags.enable_effects_v2
2153 }
2154
2155 pub fn narwhal_certificate_v2(&self) -> bool {
2156 self.feature_flags.narwhal_certificate_v2
2157 }
2158
2159 pub fn verify_legacy_zklogin_address(&self) -> bool {
2160 self.feature_flags.verify_legacy_zklogin_address
2161 }
2162
2163 pub fn accept_zklogin_in_multisig(&self) -> bool {
2164 self.feature_flags.accept_zklogin_in_multisig
2165 }
2166
2167 pub fn accept_passkey_in_multisig(&self) -> bool {
2168 self.feature_flags.accept_passkey_in_multisig
2169 }
2170
2171 pub fn validate_zklogin_public_identifier(&self) -> bool {
2172 self.feature_flags.validate_zklogin_public_identifier
2173 }
2174
2175 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2176 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2177 }
2178
2179 pub fn throughput_aware_consensus_submission(&self) -> bool {
2180 self.feature_flags.throughput_aware_consensus_submission
2181 }
2182
2183 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2184 self.feature_flags.include_consensus_digest_in_prologue
2185 }
2186
2187 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2188 self.feature_flags
2189 .record_consensus_determined_version_assignments_in_prologue
2190 }
2191
2192 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2193 self.feature_flags
2194 .record_additional_state_digest_in_prologue
2195 }
2196
2197 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2198 self.feature_flags
2199 .record_consensus_determined_version_assignments_in_prologue_v2
2200 }
2201
2202 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2203 self.feature_flags
2204 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2205 }
2206
2207 pub fn hardened_otw_check(&self) -> bool {
2208 self.feature_flags.hardened_otw_check
2209 }
2210
2211 pub fn enable_poseidon(&self) -> bool {
2212 self.feature_flags.enable_poseidon
2213 }
2214
2215 pub fn enable_coin_deny_list_v1(&self) -> bool {
2216 self.feature_flags.enable_coin_deny_list
2217 }
2218
2219 pub fn enable_accumulators(&self) -> bool {
2220 self.feature_flags.enable_accumulators
2221 }
2222
2223 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2224 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2225 }
2226
2227 pub fn create_root_accumulator_object(&self) -> bool {
2228 self.feature_flags.create_root_accumulator_object
2229 }
2230
2231 pub fn enable_address_balance_gas_payments(&self) -> bool {
2232 self.feature_flags.enable_address_balance_gas_payments
2233 }
2234
2235 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2236 self.feature_flags.address_balance_gas_check_rgp_at_signing
2237 }
2238
2239 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2240 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2241 }
2242
2243 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2244 self.feature_flags.enable_multi_epoch_transaction_expiration
2245 }
2246
2247 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2248 self.feature_flags.relax_valid_during_for_owned_inputs
2249 }
2250
2251 pub fn enable_authenticated_event_streams(&self) -> bool {
2252 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2253 }
2254
2255 pub fn enable_non_exclusive_writes(&self) -> bool {
2256 self.feature_flags.enable_non_exclusive_writes
2257 }
2258
2259 pub fn enable_coin_registry(&self) -> bool {
2260 self.feature_flags.enable_coin_registry
2261 }
2262
2263 pub fn enable_display_registry(&self) -> bool {
2264 self.feature_flags.enable_display_registry
2265 }
2266
2267 pub fn enable_coin_deny_list_v2(&self) -> bool {
2268 self.feature_flags.enable_coin_deny_list_v2
2269 }
2270
2271 pub fn enable_group_ops_native_functions(&self) -> bool {
2272 self.feature_flags.enable_group_ops_native_functions
2273 }
2274
2275 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2276 self.feature_flags.enable_group_ops_native_function_msm
2277 }
2278
2279 pub fn enable_ristretto255_group_ops(&self) -> bool {
2280 self.feature_flags.enable_ristretto255_group_ops
2281 }
2282
2283 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2284 self.feature_flags.reject_mutable_random_on_entry_functions
2285 }
2286
2287 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2288 self.feature_flags.per_object_congestion_control_mode
2289 }
2290
2291 pub fn consensus_choice(&self) -> ConsensusChoice {
2292 self.feature_flags.consensus_choice
2293 }
2294
2295 pub fn consensus_network(&self) -> ConsensusNetwork {
2296 self.feature_flags.consensus_network
2297 }
2298
2299 pub fn correct_gas_payment_limit_check(&self) -> bool {
2300 self.feature_flags.correct_gas_payment_limit_check
2301 }
2302
2303 pub fn reshare_at_same_initial_version(&self) -> bool {
2304 self.feature_flags.reshare_at_same_initial_version
2305 }
2306
2307 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2308 self.feature_flags.resolve_abort_locations_to_package_id
2309 }
2310
2311 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2312 self.feature_flags.mysticeti_use_committed_subdag_digest
2313 }
2314
2315 pub fn enable_vdf(&self) -> bool {
2316 self.feature_flags.enable_vdf
2317 }
2318
2319 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2320 self.feature_flags.fresh_vm_on_framework_upgrade
2321 }
2322
2323 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2324 self.feature_flags.mysticeti_num_leaders_per_round
2325 }
2326
2327 pub fn soft_bundle(&self) -> bool {
2328 self.feature_flags.soft_bundle
2329 }
2330
2331 pub fn passkey_auth(&self) -> bool {
2332 self.feature_flags.passkey_auth
2333 }
2334
2335 pub fn authority_capabilities_v2(&self) -> bool {
2336 self.feature_flags.authority_capabilities_v2
2337 }
2338
2339 pub fn max_transaction_size_bytes(&self) -> u64 {
2340 self.consensus_max_transaction_size_bytes
2342 .unwrap_or(256 * 1024)
2343 }
2344
2345 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2346 if cfg!(msim) {
2347 256 * 1024
2348 } else {
2349 self.consensus_max_transactions_in_block_bytes
2350 .unwrap_or(512 * 1024)
2351 }
2352 }
2353
2354 pub fn max_num_transactions_in_block(&self) -> u64 {
2355 if cfg!(msim) {
2356 8
2357 } else {
2358 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2359 }
2360 }
2361
2362 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2363 self.feature_flags.rethrow_serialization_type_layout_errors
2364 }
2365
2366 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2367 self.feature_flags
2368 .consensus_distributed_vote_scoring_strategy
2369 }
2370
2371 pub fn consensus_round_prober(&self) -> bool {
2372 self.feature_flags.consensus_round_prober
2373 }
2374
2375 pub fn validate_identifier_inputs(&self) -> bool {
2376 self.feature_flags.validate_identifier_inputs
2377 }
2378
2379 pub fn gc_depth(&self) -> u32 {
2380 self.consensus_gc_depth.unwrap_or(0)
2381 }
2382
2383 pub fn mysticeti_fastpath(&self) -> bool {
2384 self.feature_flags.mysticeti_fastpath
2385 }
2386
2387 pub fn relocate_event_module(&self) -> bool {
2388 self.feature_flags.relocate_event_module
2389 }
2390
2391 pub fn uncompressed_g1_group_elements(&self) -> bool {
2392 self.feature_flags.uncompressed_g1_group_elements
2393 }
2394
2395 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2396 self.feature_flags
2397 .disallow_new_modules_in_deps_only_packages
2398 }
2399
2400 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2401 self.feature_flags.consensus_smart_ancestor_selection
2402 }
2403
2404 pub fn disable_preconsensus_locking(&self) -> bool {
2405 self.feature_flags.disable_preconsensus_locking
2406 }
2407
2408 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2409 self.feature_flags
2410 .consensus_round_prober_probe_accepted_rounds
2411 }
2412
2413 pub fn native_charging_v2(&self) -> bool {
2414 self.feature_flags.native_charging_v2
2415 }
2416
2417 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2418 let res = self.feature_flags.consensus_linearize_subdag_v2;
2419 assert!(
2420 !res || self.gc_depth() > 0,
2421 "The consensus linearize sub dag V2 requires GC to be enabled"
2422 );
2423 res
2424 }
2425
2426 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2427 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2428 assert!(
2429 !res || self.gc_depth() > 0,
2430 "The consensus median based commit timestamp requires GC to be enabled"
2431 );
2432 res
2433 }
2434
2435 pub fn consensus_batched_block_sync(&self) -> bool {
2436 self.feature_flags.consensus_batched_block_sync
2437 }
2438
2439 pub fn convert_type_argument_error(&self) -> bool {
2440 self.feature_flags.convert_type_argument_error
2441 }
2442
2443 pub fn variant_nodes(&self) -> bool {
2444 self.feature_flags.variant_nodes
2445 }
2446
2447 pub fn consensus_zstd_compression(&self) -> bool {
2448 self.feature_flags.consensus_zstd_compression
2449 }
2450
2451 pub fn enable_nitro_attestation(&self) -> bool {
2452 self.feature_flags.enable_nitro_attestation
2453 }
2454
2455 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2456 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2457 }
2458
2459 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2460 self.feature_flags
2461 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2462 }
2463
2464 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2465 self.feature_flags
2466 .enable_nitro_attestation_always_include_required_pcrs_parsing
2467 }
2468
2469 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2470 self.consensus_commit_rate_estimation_window_size
2471 .unwrap_or(0)
2472 }
2473
2474 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2475 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2479 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2481 window_size
2482 }
2483
2484 pub fn minimize_child_object_mutations(&self) -> bool {
2485 self.feature_flags.minimize_child_object_mutations
2486 }
2487
2488 pub fn move_native_context(&self) -> bool {
2489 self.feature_flags.move_native_context
2490 }
2491
2492 pub fn normalize_ptb_arguments(&self) -> bool {
2493 self.feature_flags.normalize_ptb_arguments
2494 }
2495
2496 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2497 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2498 }
2499
2500 pub fn max_ptb_value_size_v2(&self) -> bool {
2501 self.feature_flags.max_ptb_value_size_v2
2502 }
2503
2504 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2505 self.feature_flags.resolve_type_input_ids_to_defining_id
2506 }
2507
2508 pub fn enable_party_transfer(&self) -> bool {
2509 self.feature_flags.enable_party_transfer
2510 }
2511
2512 pub fn allow_unbounded_system_objects(&self) -> bool {
2513 self.feature_flags.allow_unbounded_system_objects
2514 }
2515
2516 pub fn type_tags_in_object_runtime(&self) -> bool {
2517 self.feature_flags.type_tags_in_object_runtime
2518 }
2519
2520 pub fn enable_ptb_execution_v2(&self) -> bool {
2521 self.feature_flags.enable_ptb_execution_v2
2522 }
2523
2524 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2525 self.feature_flags.better_adapter_type_resolution_errors
2526 }
2527
2528 pub fn record_time_estimate_processed(&self) -> bool {
2529 self.feature_flags.record_time_estimate_processed
2530 }
2531
2532 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2533 self.feature_flags
2534 .ignore_execution_time_observations_after_certs_closed
2535 }
2536
2537 pub fn dependency_linkage_error(&self) -> bool {
2538 self.feature_flags.dependency_linkage_error
2539 }
2540
2541 pub fn additional_multisig_checks(&self) -> bool {
2542 self.feature_flags.additional_multisig_checks
2543 }
2544
2545 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2546 self.feature_flags.debug_fatal_on_move_invariant_violation
2547 }
2548
2549 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2550 self.feature_flags.allow_private_accumulator_entrypoints
2551 }
2552
2553 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2554 self.feature_flags
2555 .additional_consensus_digest_indirect_state
2556 }
2557
2558 pub fn check_for_init_during_upgrade(&self) -> bool {
2559 self.feature_flags.check_for_init_during_upgrade
2560 }
2561
2562 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2563 self.feature_flags.per_command_shared_object_transfer_rules
2564 }
2565
2566 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2567 self.feature_flags
2568 .consensus_checkpoint_signature_key_includes_digest
2569 }
2570
2571 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2572 self.feature_flags
2573 .include_checkpoint_artifacts_digest_in_summary
2574 }
2575
2576 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2577 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2578 }
2579
2580 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2581 self.feature_flags.cancel_for_failed_dkg_early
2582 }
2583
2584 pub fn abstract_size_in_object_runtime(&self) -> bool {
2585 self.feature_flags.abstract_size_in_object_runtime
2586 }
2587
2588 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2589 self.feature_flags.object_runtime_charge_cache_load_gas
2590 }
2591
2592 pub fn additional_borrow_checks(&self) -> bool {
2593 self.feature_flags.additional_borrow_checks
2594 }
2595
2596 pub fn use_new_commit_handler(&self) -> bool {
2597 self.feature_flags.use_new_commit_handler
2598 }
2599
2600 pub fn better_loader_errors(&self) -> bool {
2601 self.feature_flags.better_loader_errors
2602 }
2603
2604 pub fn generate_df_type_layouts(&self) -> bool {
2605 self.feature_flags.generate_df_type_layouts
2606 }
2607
2608 pub fn allow_references_in_ptbs(&self) -> bool {
2609 self.feature_flags.allow_references_in_ptbs
2610 }
2611
2612 pub fn private_generics_verifier_v2(&self) -> bool {
2613 self.feature_flags.private_generics_verifier_v2
2614 }
2615
2616 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2617 self.feature_flags
2618 .deprecate_global_storage_ops_during_deserialization
2619 }
2620
2621 pub fn enable_observation_chunking(&self) -> bool {
2622 matches!(self.feature_flags.per_object_congestion_control_mode,
2623 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2624 if params.observations_chunk_size.is_some()
2625 )
2626 }
2627
2628 pub fn deprecate_global_storage_ops(&self) -> bool {
2629 self.feature_flags.deprecate_global_storage_ops
2630 }
2631
2632 pub fn normalize_depth_formula(&self) -> bool {
2633 self.feature_flags.normalize_depth_formula
2634 }
2635
2636 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2637 self.feature_flags.consensus_skip_gced_accept_votes
2638 }
2639
2640 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2641 self.feature_flags
2642 .include_cancelled_randomness_txns_in_prologue
2643 }
2644
2645 pub fn address_aliases(&self) -> bool {
2646 let address_aliases = self.feature_flags.address_aliases;
2647 assert!(
2648 !address_aliases || self.mysticeti_fastpath(),
2649 "Address aliases requires Mysticeti fastpath to be enabled"
2650 );
2651 if address_aliases {
2652 assert!(
2653 self.feature_flags.disable_preconsensus_locking,
2654 "Address aliases requires CertifiedTransaction to be disabled"
2655 );
2656 }
2657 address_aliases
2658 }
2659
2660 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2661 self.feature_flags.fix_checkpoint_signature_mapping
2662 }
2663
2664 pub fn enable_object_funds_withdraw(&self) -> bool {
2665 self.feature_flags.enable_object_funds_withdraw
2666 }
2667
2668 pub fn gas_rounding_halve_digits(&self) -> bool {
2669 self.feature_flags.gas_rounding_halve_digits
2670 }
2671
2672 pub fn flexible_tx_context_positions(&self) -> bool {
2673 self.feature_flags.flexible_tx_context_positions
2674 }
2675
2676 pub fn disable_entry_point_signature_check(&self) -> bool {
2677 self.feature_flags.disable_entry_point_signature_check
2678 }
2679
2680 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2681 self.feature_flags
2682 .consensus_skip_gced_blocks_in_direct_finalization
2683 }
2684
2685 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2686 self.feature_flags
2687 .convert_withdrawal_compatibility_ptb_arguments
2688 }
2689
2690 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2691 self.feature_flags.restrict_hot_or_not_entry_functions
2692 }
2693
2694 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2695 self.feature_flags.split_checkpoints_in_consensus_handler
2696 }
2697
2698 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2699 self.feature_flags
2700 .consensus_always_accept_system_transactions
2701 }
2702
2703 pub fn validator_metadata_verify_v2(&self) -> bool {
2704 self.feature_flags.validator_metadata_verify_v2
2705 }
2706
2707 pub fn defer_unpaid_amplification(&self) -> bool {
2708 self.feature_flags.defer_unpaid_amplification
2709 }
2710
2711 pub fn gasless_transaction_drop_safety(&self) -> bool {
2712 self.feature_flags.gasless_transaction_drop_safety
2713 }
2714
2715 pub fn new_vm_enabled(&self) -> bool {
2716 self.execution_version.is_some_and(|v| v >= 4)
2717 }
2718
2719 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2720 self.feature_flags.merge_randomness_into_checkpoint
2721 }
2722
2723 pub fn use_coin_party_owner(&self) -> bool {
2724 self.feature_flags.use_coin_party_owner
2725 }
2726
2727 pub fn enable_gasless(&self) -> bool {
2728 self.feature_flags.enable_gasless
2729 }
2730
2731 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2732 debug_assert!(self.gasless_allowed_token_types.is_some());
2733 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2734 }
2735
2736 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2737 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2738 }
2739
2740 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2741 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2742 }
2743
2744 pub fn disallow_jump_orphans(&self) -> bool {
2745 self.feature_flags.disallow_jump_orphans
2746 }
2747
2748 pub fn early_return_receive_object_mismatched_type(&self) -> bool {
2749 self.feature_flags
2750 .early_return_receive_object_mismatched_type
2751 }
2752}
2753
2754#[cfg(not(msim))]
2755static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2756
2757#[cfg(msim)]
2759thread_local! {
2760 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2761}
2762
2763impl ProtocolConfig {
2765 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2767 assert!(
2769 version >= ProtocolVersion::MIN,
2770 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2771 version,
2772 ProtocolVersion::MIN.0,
2773 );
2774 assert!(
2775 version <= ProtocolVersion::MAX_ALLOWED,
2776 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2777 version,
2778 ProtocolVersion::MAX_ALLOWED.0,
2779 );
2780
2781 let mut ret = Self::get_for_version_impl(version, chain);
2782 ret.version = version;
2783
2784 ret = Self::apply_config_override(version, ret);
2785
2786 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2787 warn!(
2788 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2789 );
2790 let overrides: ProtocolConfigOptional =
2791 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2792 .expect("failed to parse ProtocolConfig override env variables");
2793 overrides.apply_to(&mut ret);
2794 }
2795
2796 ret
2797 }
2798
2799 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2802 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2803 let mut ret = Self::get_for_version_impl(version, chain);
2804 ret.version = version;
2805 ret = Self::apply_config_override(version, ret);
2806 Some(ret)
2807 } else {
2808 None
2809 }
2810 }
2811
2812 #[cfg(not(msim))]
2813 pub fn poison_get_for_min_version() {
2814 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2815 }
2816
2817 #[cfg(not(msim))]
2818 fn load_poison_get_for_min_version() -> bool {
2819 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2820 }
2821
2822 #[cfg(msim)]
2823 pub fn poison_get_for_min_version() {
2824 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2825 }
2826
2827 #[cfg(msim)]
2828 fn load_poison_get_for_min_version() -> bool {
2829 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2830 }
2831
2832 pub fn get_for_min_version() -> Self {
2835 if Self::load_poison_get_for_min_version() {
2836 panic!("get_for_min_version called on validator");
2837 }
2838 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2839 }
2840
2841 #[allow(non_snake_case)]
2851 pub fn get_for_max_version_UNSAFE() -> Self {
2852 if Self::load_poison_get_for_min_version() {
2853 panic!("get_for_max_version_UNSAFE called on validator");
2854 }
2855 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2856 }
2857
2858 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2859 #[cfg(msim)]
2860 {
2861 if version == ProtocolVersion::MAX_ALLOWED {
2863 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2864 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2865 return config;
2866 }
2867 }
2868
2869 let mut cfg = Self {
2872 version,
2874
2875 feature_flags: Default::default(),
2877
2878 max_tx_size_bytes: Some(128 * 1024),
2879 max_input_objects: Some(2048),
2881 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2882 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2883 max_gas_payment_objects: Some(256),
2884 max_modules_in_publish: Some(128),
2885 max_package_dependencies: None,
2886 max_arguments: Some(512),
2887 max_type_arguments: Some(16),
2888 max_type_argument_depth: Some(16),
2889 max_pure_argument_size: Some(16 * 1024),
2890 max_programmable_tx_commands: Some(1024),
2891 move_binary_format_version: Some(6),
2892 min_move_binary_format_version: None,
2893 binary_module_handles: None,
2894 binary_struct_handles: None,
2895 binary_function_handles: None,
2896 binary_function_instantiations: None,
2897 binary_signatures: None,
2898 binary_constant_pool: None,
2899 binary_identifiers: None,
2900 binary_address_identifiers: None,
2901 binary_struct_defs: None,
2902 binary_struct_def_instantiations: None,
2903 binary_function_defs: None,
2904 binary_field_handles: None,
2905 binary_field_instantiations: None,
2906 binary_friend_decls: None,
2907 binary_enum_defs: None,
2908 binary_enum_def_instantiations: None,
2909 binary_variant_handles: None,
2910 binary_variant_instantiation_handles: None,
2911 max_move_object_size: Some(250 * 1024),
2912 max_move_package_size: Some(100 * 1024),
2913 max_publish_or_upgrade_per_ptb: None,
2914 max_tx_gas: Some(10_000_000_000),
2915 max_gas_price: Some(100_000),
2916 max_gas_price_rgp_factor_for_aborted_transactions: None,
2917 max_gas_computation_bucket: Some(5_000_000),
2918 max_loop_depth: Some(5),
2919 max_generic_instantiation_length: Some(32),
2920 max_function_parameters: Some(128),
2921 max_basic_blocks: Some(1024),
2922 max_value_stack_size: Some(1024),
2923 max_type_nodes: Some(256),
2924 max_push_size: Some(10000),
2925 max_struct_definitions: Some(200),
2926 max_function_definitions: Some(1000),
2927 max_fields_in_struct: Some(32),
2928 max_dependency_depth: Some(100),
2929 max_num_event_emit: Some(256),
2930 max_num_new_move_object_ids: Some(2048),
2931 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2932 max_num_deleted_move_object_ids: Some(2048),
2933 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2934 max_num_transferred_move_object_ids: Some(2048),
2935 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2936 max_event_emit_size: Some(250 * 1024),
2937 max_move_vector_len: Some(256 * 1024),
2938 max_type_to_layout_nodes: None,
2939 max_ptb_value_size: None,
2940
2941 max_back_edges_per_function: Some(10_000),
2942 max_back_edges_per_module: Some(10_000),
2943 max_verifier_meter_ticks_per_function: Some(6_000_000),
2944 max_meter_ticks_per_module: Some(6_000_000),
2945 max_meter_ticks_per_package: None,
2946
2947 object_runtime_max_num_cached_objects: Some(1000),
2948 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2949 object_runtime_max_num_store_entries: Some(1000),
2950 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2951 base_tx_cost_fixed: Some(110_000),
2952 package_publish_cost_fixed: Some(1_000),
2953 base_tx_cost_per_byte: Some(0),
2954 package_publish_cost_per_byte: Some(80),
2955 obj_access_cost_read_per_byte: Some(15),
2956 obj_access_cost_mutate_per_byte: Some(40),
2957 obj_access_cost_delete_per_byte: Some(40),
2958 obj_access_cost_verify_per_byte: Some(200),
2959 obj_data_cost_refundable: Some(100),
2960 obj_metadata_cost_non_refundable: Some(50),
2961 gas_model_version: Some(1),
2962 storage_rebate_rate: Some(9900),
2963 storage_fund_reinvest_rate: Some(500),
2964 reward_slashing_rate: Some(5000),
2965 storage_gas_price: Some(1),
2966 accumulator_object_storage_cost: None,
2967 max_transactions_per_checkpoint: Some(10_000),
2968 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2969
2970 buffer_stake_for_protocol_upgrade_bps: Some(0),
2973
2974 address_from_bytes_cost_base: Some(52),
2978 address_to_u256_cost_base: Some(52),
2980 address_from_u256_cost_base: Some(52),
2982
2983 config_read_setting_impl_cost_base: None,
2986 config_read_setting_impl_cost_per_byte: None,
2987
2988 dynamic_field_hash_type_and_key_cost_base: Some(100),
2991 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2992 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2993 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2994 dynamic_field_add_child_object_cost_base: Some(100),
2996 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2997 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2998 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2999 dynamic_field_borrow_child_object_cost_base: Some(100),
3001 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3002 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3003 dynamic_field_remove_child_object_cost_base: Some(100),
3005 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3006 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3007 dynamic_field_has_child_object_cost_base: Some(100),
3009 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3011 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3012 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3013
3014 event_emit_cost_base: Some(52),
3017 event_emit_value_size_derivation_cost_per_byte: Some(2),
3018 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3019 event_emit_output_cost_per_byte: Some(10),
3020 event_emit_auth_stream_cost: None,
3021
3022 object_borrow_uid_cost_base: Some(52),
3025 object_delete_impl_cost_base: Some(52),
3027 object_record_new_uid_cost_base: Some(52),
3029
3030 transfer_transfer_internal_cost_base: Some(52),
3033 transfer_party_transfer_internal_cost_base: None,
3035 transfer_freeze_object_cost_base: Some(52),
3037 transfer_share_object_cost_base: Some(52),
3039 transfer_receive_object_cost_base: None,
3040 transfer_receive_object_type_cost_per_byte: None,
3041 transfer_receive_object_cost_per_byte: None,
3042
3043 tx_context_derive_id_cost_base: Some(52),
3046 tx_context_fresh_id_cost_base: None,
3047 tx_context_sender_cost_base: None,
3048 tx_context_epoch_cost_base: None,
3049 tx_context_epoch_timestamp_ms_cost_base: None,
3050 tx_context_sponsor_cost_base: None,
3051 tx_context_rgp_cost_base: None,
3052 tx_context_gas_price_cost_base: None,
3053 tx_context_gas_budget_cost_base: None,
3054 tx_context_ids_created_cost_base: None,
3055 tx_context_replace_cost_base: None,
3056
3057 types_is_one_time_witness_cost_base: Some(52),
3060 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3061 types_is_one_time_witness_type_cost_per_byte: Some(2),
3062
3063 validator_validate_metadata_cost_base: Some(52),
3066 validator_validate_metadata_data_cost_per_byte: Some(2),
3067
3068 crypto_invalid_arguments_cost: Some(100),
3070 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3072 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3073 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3074
3075 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3077 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3078 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3079
3080 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3082 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3083 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3084 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3085 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3086 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3087
3088 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3090
3091 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3093 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3094 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3095 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3096 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3097 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3098
3099 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3101 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3102 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3103 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3104 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3105 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3106
3107 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3109 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3110 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3111 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3112 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3113 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3114
3115 ecvrf_ecvrf_verify_cost_base: Some(52),
3117 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3118 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3119
3120 ed25519_ed25519_verify_cost_base: Some(52),
3122 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3123 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3124
3125 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3127 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3128
3129 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3131 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3132 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3133 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3134 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3135
3136 hash_blake2b256_cost_base: Some(52),
3138 hash_blake2b256_data_cost_per_byte: Some(2),
3139 hash_blake2b256_data_cost_per_block: Some(2),
3140
3141 hash_keccak256_cost_base: Some(52),
3143 hash_keccak256_data_cost_per_byte: Some(2),
3144 hash_keccak256_data_cost_per_block: Some(2),
3145
3146 poseidon_bn254_cost_base: None,
3147 poseidon_bn254_cost_per_block: None,
3148
3149 hmac_hmac_sha3_256_cost_base: Some(52),
3151 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3152 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3153
3154 group_ops_bls12381_decode_scalar_cost: None,
3156 group_ops_bls12381_decode_g1_cost: None,
3157 group_ops_bls12381_decode_g2_cost: None,
3158 group_ops_bls12381_decode_gt_cost: None,
3159 group_ops_bls12381_scalar_add_cost: None,
3160 group_ops_bls12381_g1_add_cost: None,
3161 group_ops_bls12381_g2_add_cost: None,
3162 group_ops_bls12381_gt_add_cost: None,
3163 group_ops_bls12381_scalar_sub_cost: None,
3164 group_ops_bls12381_g1_sub_cost: None,
3165 group_ops_bls12381_g2_sub_cost: None,
3166 group_ops_bls12381_gt_sub_cost: None,
3167 group_ops_bls12381_scalar_mul_cost: None,
3168 group_ops_bls12381_g1_mul_cost: None,
3169 group_ops_bls12381_g2_mul_cost: None,
3170 group_ops_bls12381_gt_mul_cost: None,
3171 group_ops_bls12381_scalar_div_cost: None,
3172 group_ops_bls12381_g1_div_cost: None,
3173 group_ops_bls12381_g2_div_cost: None,
3174 group_ops_bls12381_gt_div_cost: None,
3175 group_ops_bls12381_g1_hash_to_base_cost: None,
3176 group_ops_bls12381_g2_hash_to_base_cost: None,
3177 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3178 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3179 group_ops_bls12381_g1_msm_base_cost: None,
3180 group_ops_bls12381_g2_msm_base_cost: None,
3181 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3182 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3183 group_ops_bls12381_msm_max_len: None,
3184 group_ops_bls12381_pairing_cost: None,
3185 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3186 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3187 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3188 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3189 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3190
3191 group_ops_ristretto_decode_scalar_cost: None,
3192 group_ops_ristretto_decode_point_cost: None,
3193 group_ops_ristretto_scalar_add_cost: None,
3194 group_ops_ristretto_point_add_cost: None,
3195 group_ops_ristretto_scalar_sub_cost: None,
3196 group_ops_ristretto_point_sub_cost: None,
3197 group_ops_ristretto_scalar_mul_cost: None,
3198 group_ops_ristretto_point_mul_cost: None,
3199 group_ops_ristretto_scalar_div_cost: None,
3200 group_ops_ristretto_point_div_cost: None,
3201
3202 check_zklogin_id_cost_base: None,
3204 check_zklogin_issuer_cost_base: None,
3206
3207 vdf_verify_vdf_cost: None,
3208 vdf_hash_to_input_cost: None,
3209
3210 nitro_attestation_parse_base_cost: None,
3212 nitro_attestation_parse_cost_per_byte: None,
3213 nitro_attestation_verify_base_cost: None,
3214 nitro_attestation_verify_cost_per_cert: None,
3215
3216 bcs_per_byte_serialized_cost: None,
3217 bcs_legacy_min_output_size_cost: None,
3218 bcs_failure_cost: None,
3219 hash_sha2_256_base_cost: None,
3220 hash_sha2_256_per_byte_cost: None,
3221 hash_sha2_256_legacy_min_input_len_cost: None,
3222 hash_sha3_256_base_cost: None,
3223 hash_sha3_256_per_byte_cost: None,
3224 hash_sha3_256_legacy_min_input_len_cost: None,
3225 type_name_get_base_cost: None,
3226 type_name_get_per_byte_cost: None,
3227 type_name_id_base_cost: None,
3228 string_check_utf8_base_cost: None,
3229 string_check_utf8_per_byte_cost: None,
3230 string_is_char_boundary_base_cost: None,
3231 string_sub_string_base_cost: None,
3232 string_sub_string_per_byte_cost: None,
3233 string_index_of_base_cost: None,
3234 string_index_of_per_byte_pattern_cost: None,
3235 string_index_of_per_byte_searched_cost: None,
3236 vector_empty_base_cost: None,
3237 vector_length_base_cost: None,
3238 vector_push_back_base_cost: None,
3239 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3240 vector_borrow_base_cost: None,
3241 vector_pop_back_base_cost: None,
3242 vector_destroy_empty_base_cost: None,
3243 vector_swap_base_cost: None,
3244 debug_print_base_cost: None,
3245 debug_print_stack_trace_base_cost: None,
3246
3247 max_size_written_objects: None,
3248 max_size_written_objects_system_tx: None,
3249
3250 max_move_identifier_len: None,
3257 max_move_value_depth: None,
3258 max_move_enum_variants: None,
3259
3260 gas_rounding_step: None,
3261
3262 execution_version: None,
3263
3264 max_event_emit_size_total: None,
3265
3266 consensus_bad_nodes_stake_threshold: None,
3267
3268 max_jwk_votes_per_validator_per_epoch: None,
3269
3270 max_age_of_jwk_in_epochs: None,
3271
3272 random_beacon_reduction_allowed_delta: None,
3273
3274 random_beacon_reduction_lower_bound: None,
3275
3276 random_beacon_dkg_timeout_round: None,
3277
3278 random_beacon_min_round_interval_ms: None,
3279
3280 random_beacon_dkg_version: None,
3281
3282 consensus_max_transaction_size_bytes: None,
3283
3284 consensus_max_transactions_in_block_bytes: None,
3285
3286 consensus_max_num_transactions_in_block: None,
3287
3288 consensus_voting_rounds: None,
3289
3290 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3291
3292 max_deferral_rounds_for_congestion_control: None,
3293
3294 max_txn_cost_overage_per_object_in_commit: None,
3295
3296 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3297
3298 min_checkpoint_interval_ms: None,
3299
3300 checkpoint_summary_version_specific_data: None,
3301
3302 max_soft_bundle_size: None,
3303
3304 bridge_should_try_to_finalize_committee: None,
3305
3306 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3307
3308 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3309
3310 consensus_gc_depth: None,
3311
3312 gas_budget_based_txn_cost_cap_factor: None,
3313
3314 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3315
3316 sip_45_consensus_amplification_threshold: None,
3317
3318 use_object_per_epoch_marker_table_v2: None,
3319
3320 consensus_commit_rate_estimation_window_size: None,
3321
3322 aliased_addresses: vec![],
3323
3324 translation_per_command_base_charge: None,
3325 translation_per_input_base_charge: None,
3326 translation_pure_input_per_byte_charge: None,
3327 translation_per_type_node_charge: None,
3328 translation_per_reference_node_charge: None,
3329 translation_per_linkage_entry_charge: None,
3330
3331 max_updates_per_settlement_txn: None,
3332
3333 gasless_max_computation_units: None,
3334 gasless_allowed_token_types: None,
3335 gasless_max_unused_inputs: None,
3336 gasless_max_pure_input_bytes: None,
3337 gasless_max_tps: None,
3338 };
3341 for cur in 2..=version.0 {
3342 match cur {
3343 1 => unreachable!(),
3344 2 => {
3345 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3346 }
3347 3 => {
3348 cfg.gas_model_version = Some(2);
3350 cfg.max_tx_gas = Some(50_000_000_000);
3352 cfg.base_tx_cost_fixed = Some(2_000);
3354 cfg.storage_gas_price = Some(76);
3356 cfg.feature_flags.loaded_child_objects_fixed = true;
3357 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3360 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3363 cfg.feature_flags.package_upgrades = true;
3364 }
3365 4 => {
3370 cfg.reward_slashing_rate = Some(10000);
3372 cfg.gas_model_version = Some(3);
3374 }
3375 5 => {
3376 cfg.feature_flags.missing_type_is_compatibility_error = true;
3377 cfg.gas_model_version = Some(4);
3378 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3379 }
3383 6 => {
3384 cfg.gas_model_version = Some(5);
3385 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3386 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3387 }
3388 7 => {
3389 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3390 cfg.feature_flags
3391 .disable_invariant_violation_check_in_swap_loc = true;
3392 cfg.feature_flags.ban_entry_init = true;
3393 cfg.feature_flags.package_digest_hash_module = true;
3394 }
3395 8 => {
3396 cfg.feature_flags
3397 .disallow_change_struct_type_params_on_upgrade = true;
3398 }
3399 9 => {
3400 cfg.max_move_identifier_len = Some(128);
3402 cfg.feature_flags.no_extraneous_module_bytes = true;
3403 cfg.feature_flags
3404 .advance_to_highest_supported_protocol_version = true;
3405 }
3406 10 => {
3407 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3408 cfg.max_meter_ticks_per_module = Some(16_000_000);
3409 }
3410 11 => {
3411 cfg.max_move_value_depth = Some(128);
3412 }
3413 12 => {
3414 cfg.feature_flags.narwhal_versioned_metadata = true;
3415 if chain != Chain::Mainnet {
3416 cfg.feature_flags.commit_root_state_digest = true;
3417 }
3418
3419 if chain != Chain::Mainnet && chain != Chain::Testnet {
3420 cfg.feature_flags.zklogin_auth = true;
3421 }
3422 }
3423 13 => {}
3424 14 => {
3425 cfg.gas_rounding_step = Some(1_000);
3426 cfg.gas_model_version = Some(6);
3427 }
3428 15 => {
3429 cfg.feature_flags.consensus_transaction_ordering =
3430 ConsensusTransactionOrdering::ByGasPrice;
3431 }
3432 16 => {
3433 cfg.feature_flags.simplified_unwrap_then_delete = true;
3434 }
3435 17 => {
3436 cfg.feature_flags.upgraded_multisig_supported = true;
3437 }
3438 18 => {
3439 cfg.execution_version = Some(1);
3440 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3449 cfg.base_tx_cost_fixed = Some(1_000);
3451 }
3452 19 => {
3453 cfg.max_num_event_emit = Some(1024);
3454 cfg.max_event_emit_size_total = Some(
3457 256 * 250 * 1024, );
3459 }
3460 20 => {
3461 cfg.feature_flags.commit_root_state_digest = true;
3462
3463 if chain != Chain::Mainnet {
3464 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3465 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3466 }
3467 }
3468
3469 21 => {
3470 if chain != Chain::Mainnet {
3471 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3472 "Google".to_string(),
3473 "Facebook".to_string(),
3474 "Twitch".to_string(),
3475 ]);
3476 }
3477 }
3478 22 => {
3479 cfg.feature_flags.loaded_child_object_format = true;
3480 }
3481 23 => {
3482 cfg.feature_flags.loaded_child_object_format_type = true;
3483 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3484 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3490 }
3491 24 => {
3492 cfg.feature_flags.simple_conservation_checks = true;
3493 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3494
3495 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3496
3497 if chain != Chain::Mainnet {
3498 cfg.feature_flags.enable_jwk_consensus_updates = true;
3499 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3501 cfg.max_age_of_jwk_in_epochs = Some(1);
3502 }
3503 }
3504 25 => {
3505 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3507 "Google".to_string(),
3508 "Facebook".to_string(),
3509 "Twitch".to_string(),
3510 ]);
3511 cfg.feature_flags.zklogin_auth = true;
3512
3513 cfg.feature_flags.enable_jwk_consensus_updates = true;
3515 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3516 cfg.max_age_of_jwk_in_epochs = Some(1);
3517 }
3518 26 => {
3519 cfg.gas_model_version = Some(7);
3520 if chain != Chain::Mainnet && chain != Chain::Testnet {
3522 cfg.transfer_receive_object_cost_base = Some(52);
3523 cfg.feature_flags.receive_objects = true;
3524 }
3525 }
3526 27 => {
3527 cfg.gas_model_version = Some(8);
3528 }
3529 28 => {
3530 cfg.check_zklogin_id_cost_base = Some(200);
3532 cfg.check_zklogin_issuer_cost_base = Some(200);
3534
3535 if chain != Chain::Mainnet && chain != Chain::Testnet {
3537 cfg.feature_flags.enable_effects_v2 = true;
3538 }
3539 }
3540 29 => {
3541 cfg.feature_flags.verify_legacy_zklogin_address = true;
3542 }
3543 30 => {
3544 if chain != Chain::Mainnet {
3546 cfg.feature_flags.narwhal_certificate_v2 = true;
3547 }
3548
3549 cfg.random_beacon_reduction_allowed_delta = Some(800);
3550 if chain != Chain::Mainnet {
3552 cfg.feature_flags.enable_effects_v2 = true;
3553 }
3554
3555 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3559
3560 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3561 }
3562 31 => {
3563 cfg.execution_version = Some(2);
3564 if chain != Chain::Mainnet && chain != Chain::Testnet {
3566 cfg.feature_flags.shared_object_deletion = true;
3567 }
3568 }
3569 32 => {
3570 if chain != Chain::Mainnet {
3572 cfg.feature_flags.accept_zklogin_in_multisig = true;
3573 }
3574 if chain != Chain::Mainnet {
3576 cfg.transfer_receive_object_cost_base = Some(52);
3577 cfg.feature_flags.receive_objects = true;
3578 }
3579 if chain != Chain::Mainnet && chain != Chain::Testnet {
3581 cfg.feature_flags.random_beacon = true;
3582 cfg.random_beacon_reduction_lower_bound = Some(1600);
3583 cfg.random_beacon_dkg_timeout_round = Some(3000);
3584 cfg.random_beacon_min_round_interval_ms = Some(150);
3585 }
3586 if chain != Chain::Testnet && chain != Chain::Mainnet {
3588 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3589 }
3590
3591 cfg.feature_flags.narwhal_certificate_v2 = true;
3593 }
3594 33 => {
3595 cfg.feature_flags.hardened_otw_check = true;
3596 cfg.feature_flags.allow_receiving_object_id = true;
3597
3598 cfg.transfer_receive_object_cost_base = Some(52);
3600 cfg.feature_flags.receive_objects = true;
3601
3602 if chain != Chain::Mainnet {
3604 cfg.feature_flags.shared_object_deletion = true;
3605 }
3606
3607 cfg.feature_flags.enable_effects_v2 = true;
3608 }
3609 34 => {}
3610 35 => {
3611 if chain != Chain::Mainnet && chain != Chain::Testnet {
3613 cfg.feature_flags.enable_poseidon = true;
3614 cfg.poseidon_bn254_cost_base = Some(260);
3615 cfg.poseidon_bn254_cost_per_block = Some(10);
3616 }
3617
3618 cfg.feature_flags.enable_coin_deny_list = true;
3619 }
3620 36 => {
3621 if chain != Chain::Mainnet && chain != Chain::Testnet {
3623 cfg.feature_flags.enable_group_ops_native_functions = true;
3624 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3625 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3627 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3628 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3629 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3630 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3631 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3632 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3633 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3634 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3635 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3636 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3637 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3638 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3639 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3640 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3641 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3642 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3643 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3644 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3645 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3646 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3647 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3648 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3649 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3650 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3651 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3652 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3653 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3654 cfg.group_ops_bls12381_msm_max_len = Some(32);
3655 cfg.group_ops_bls12381_pairing_cost = Some(52);
3656 }
3657 cfg.feature_flags.shared_object_deletion = true;
3659
3660 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3662 }
3664 37 => {
3665 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3666
3667 if chain != Chain::Mainnet {
3669 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3670 }
3671 }
3672 38 => {
3673 cfg.binary_module_handles = Some(100);
3674 cfg.binary_struct_handles = Some(300);
3675 cfg.binary_function_handles = Some(1500);
3676 cfg.binary_function_instantiations = Some(750);
3677 cfg.binary_signatures = Some(1000);
3678 cfg.binary_constant_pool = Some(4000);
3682 cfg.binary_identifiers = Some(10000);
3683 cfg.binary_address_identifiers = Some(100);
3684 cfg.binary_struct_defs = Some(200);
3685 cfg.binary_struct_def_instantiations = Some(100);
3686 cfg.binary_function_defs = Some(1000);
3687 cfg.binary_field_handles = Some(500);
3688 cfg.binary_field_instantiations = Some(250);
3689 cfg.binary_friend_decls = Some(100);
3690 cfg.max_package_dependencies = Some(32);
3692 cfg.max_modules_in_publish = Some(64);
3693 cfg.execution_version = Some(3);
3695 }
3696 39 => {
3697 }
3699 40 => {}
3700 41 => {
3701 cfg.feature_flags.enable_group_ops_native_functions = true;
3703 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3705 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3706 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3707 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3708 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3709 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3710 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3711 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3712 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3713 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3714 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3715 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3716 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3717 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3718 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3719 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3720 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3721 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3722 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3723 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3724 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3725 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3726 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3727 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3728 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3729 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3730 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3731 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3732 cfg.group_ops_bls12381_msm_max_len = Some(32);
3733 cfg.group_ops_bls12381_pairing_cost = Some(52);
3734 }
3735 42 => {}
3736 43 => {
3737 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3738 cfg.max_meter_ticks_per_package = Some(16_000_000);
3739 }
3740 44 => {
3741 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3743 if chain != Chain::Mainnet {
3745 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3746 }
3747 }
3748 45 => {
3749 if chain != Chain::Testnet && chain != Chain::Mainnet {
3751 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3752 }
3753
3754 if chain != Chain::Mainnet {
3755 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3757 }
3758 cfg.min_move_binary_format_version = Some(6);
3759 cfg.feature_flags.accept_zklogin_in_multisig = true;
3760
3761 if chain != Chain::Mainnet && chain != Chain::Testnet {
3765 cfg.feature_flags.bridge = true;
3766 }
3767 }
3768 46 => {
3769 if chain != Chain::Mainnet {
3771 cfg.feature_flags.bridge = true;
3772 }
3773
3774 cfg.feature_flags.reshare_at_same_initial_version = true;
3776 }
3777 47 => {}
3778 48 => {
3779 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3781
3782 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3784
3785 if chain != Chain::Mainnet {
3787 cfg.feature_flags.random_beacon = true;
3788 cfg.random_beacon_reduction_lower_bound = Some(1600);
3789 cfg.random_beacon_dkg_timeout_round = Some(3000);
3790 cfg.random_beacon_min_round_interval_ms = Some(200);
3791 }
3792
3793 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3795 }
3796 49 => {
3797 if chain != Chain::Testnet && chain != Chain::Mainnet {
3798 cfg.move_binary_format_version = Some(7);
3799 }
3800
3801 if chain != Chain::Mainnet && chain != Chain::Testnet {
3803 cfg.feature_flags.enable_vdf = true;
3804 cfg.vdf_verify_vdf_cost = Some(1500);
3807 cfg.vdf_hash_to_input_cost = Some(100);
3808 }
3809
3810 if chain != Chain::Testnet && chain != Chain::Mainnet {
3812 cfg.feature_flags
3813 .record_consensus_determined_version_assignments_in_prologue = true;
3814 }
3815
3816 if chain != Chain::Mainnet {
3818 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3819 }
3820
3821 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3823 }
3824 50 => {
3825 if chain != Chain::Mainnet {
3827 cfg.checkpoint_summary_version_specific_data = Some(1);
3828 cfg.min_checkpoint_interval_ms = Some(200);
3829 }
3830
3831 if chain != Chain::Testnet && chain != Chain::Mainnet {
3833 cfg.feature_flags
3834 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3835 }
3836
3837 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3838
3839 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3841 }
3842 51 => {
3843 cfg.random_beacon_dkg_version = Some(1);
3844
3845 if chain != Chain::Testnet && chain != Chain::Mainnet {
3846 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3847 }
3848 }
3849 52 => {
3850 if chain != Chain::Mainnet {
3851 cfg.feature_flags.soft_bundle = true;
3852 cfg.max_soft_bundle_size = Some(5);
3853 }
3854
3855 cfg.config_read_setting_impl_cost_base = Some(100);
3856 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3857
3858 if chain != Chain::Testnet && chain != Chain::Mainnet {
3860 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3861 cfg.feature_flags.per_object_congestion_control_mode =
3862 PerObjectCongestionControlMode::TotalTxCount;
3863 }
3864
3865 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3867
3868 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3870
3871 cfg.checkpoint_summary_version_specific_data = Some(1);
3873 cfg.min_checkpoint_interval_ms = Some(200);
3874
3875 if chain != Chain::Mainnet {
3877 cfg.feature_flags
3878 .record_consensus_determined_version_assignments_in_prologue = true;
3879 cfg.feature_flags
3880 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3881 }
3882 if chain != Chain::Mainnet {
3884 cfg.move_binary_format_version = Some(7);
3885 }
3886
3887 if chain != Chain::Testnet && chain != Chain::Mainnet {
3888 cfg.feature_flags.passkey_auth = true;
3889 }
3890 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3891 }
3892 53 => {
3893 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3895
3896 cfg.feature_flags
3898 .record_consensus_determined_version_assignments_in_prologue = true;
3899 cfg.feature_flags
3900 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3901
3902 if chain == Chain::Unknown {
3903 cfg.feature_flags.authority_capabilities_v2 = true;
3904 }
3905
3906 if chain != Chain::Mainnet {
3908 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3909 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3910 cfg.feature_flags.per_object_congestion_control_mode =
3911 PerObjectCongestionControlMode::TotalTxCount;
3912 }
3913
3914 cfg.bcs_per_byte_serialized_cost = Some(2);
3916 cfg.bcs_legacy_min_output_size_cost = Some(1);
3917 cfg.bcs_failure_cost = Some(52);
3918 cfg.debug_print_base_cost = Some(52);
3919 cfg.debug_print_stack_trace_base_cost = Some(52);
3920 cfg.hash_sha2_256_base_cost = Some(52);
3921 cfg.hash_sha2_256_per_byte_cost = Some(2);
3922 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3923 cfg.hash_sha3_256_base_cost = Some(52);
3924 cfg.hash_sha3_256_per_byte_cost = Some(2);
3925 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3926 cfg.type_name_get_base_cost = Some(52);
3927 cfg.type_name_get_per_byte_cost = Some(2);
3928 cfg.string_check_utf8_base_cost = Some(52);
3929 cfg.string_check_utf8_per_byte_cost = Some(2);
3930 cfg.string_is_char_boundary_base_cost = Some(52);
3931 cfg.string_sub_string_base_cost = Some(52);
3932 cfg.string_sub_string_per_byte_cost = Some(2);
3933 cfg.string_index_of_base_cost = Some(52);
3934 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3935 cfg.string_index_of_per_byte_searched_cost = Some(2);
3936 cfg.vector_empty_base_cost = Some(52);
3937 cfg.vector_length_base_cost = Some(52);
3938 cfg.vector_push_back_base_cost = Some(52);
3939 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3940 cfg.vector_borrow_base_cost = Some(52);
3941 cfg.vector_pop_back_base_cost = Some(52);
3942 cfg.vector_destroy_empty_base_cost = Some(52);
3943 cfg.vector_swap_base_cost = Some(52);
3944 }
3945 54 => {
3946 cfg.feature_flags.random_beacon = true;
3948 cfg.random_beacon_reduction_lower_bound = Some(1000);
3949 cfg.random_beacon_dkg_timeout_round = Some(3000);
3950 cfg.random_beacon_min_round_interval_ms = Some(500);
3951
3952 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3954 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3955 cfg.feature_flags.per_object_congestion_control_mode =
3956 PerObjectCongestionControlMode::TotalTxCount;
3957
3958 cfg.feature_flags.soft_bundle = true;
3960 cfg.max_soft_bundle_size = Some(5);
3961 }
3962 55 => {
3963 cfg.move_binary_format_version = Some(7);
3965
3966 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3968 cfg.consensus_max_num_transactions_in_block = Some(512);
3971
3972 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3973 }
3974 56 => {
3975 if chain == Chain::Mainnet {
3976 cfg.feature_flags.bridge = true;
3977 }
3978 }
3979 57 => {
3980 cfg.random_beacon_reduction_lower_bound = Some(800);
3982 }
3983 58 => {
3984 if chain == Chain::Mainnet {
3985 cfg.bridge_should_try_to_finalize_committee = Some(true);
3986 }
3987
3988 if chain != Chain::Mainnet && chain != Chain::Testnet {
3989 cfg.feature_flags
3991 .consensus_distributed_vote_scoring_strategy = true;
3992 }
3993 }
3994 59 => {
3995 cfg.feature_flags.consensus_round_prober = true;
3997 }
3998 60 => {
3999 cfg.max_type_to_layout_nodes = Some(512);
4000 cfg.feature_flags.validate_identifier_inputs = true;
4001 }
4002 61 => {
4003 if chain != Chain::Mainnet {
4004 cfg.feature_flags
4006 .consensus_distributed_vote_scoring_strategy = true;
4007 }
4008 cfg.random_beacon_reduction_lower_bound = Some(700);
4010
4011 if chain != Chain::Mainnet && chain != Chain::Testnet {
4012 cfg.feature_flags.mysticeti_fastpath = true;
4014 }
4015 }
4016 62 => {
4017 cfg.feature_flags.relocate_event_module = true;
4018 }
4019 63 => {
4020 cfg.feature_flags.per_object_congestion_control_mode =
4021 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4022 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4023 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4024 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4025 }
4026 64 => {
4027 cfg.feature_flags.per_object_congestion_control_mode =
4028 PerObjectCongestionControlMode::TotalTxCount;
4029 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4030 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4031 }
4032 65 => {
4033 cfg.feature_flags
4035 .consensus_distributed_vote_scoring_strategy = true;
4036 }
4037 66 => {
4038 if chain == Chain::Mainnet {
4039 cfg.feature_flags
4041 .consensus_distributed_vote_scoring_strategy = false;
4042 }
4043 }
4044 67 => {
4045 cfg.feature_flags
4047 .consensus_distributed_vote_scoring_strategy = true;
4048 }
4049 68 => {
4050 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4051 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4052 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4053 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4054 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4055
4056 if chain != Chain::Mainnet && chain != Chain::Testnet {
4057 cfg.feature_flags.uncompressed_g1_group_elements = true;
4058 }
4059
4060 cfg.feature_flags.per_object_congestion_control_mode =
4061 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4062 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4063 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4064 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4065 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4067 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4068
4069 cfg.random_beacon_reduction_lower_bound = Some(500);
4071
4072 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4073 }
4074 69 => {
4075 cfg.consensus_voting_rounds = Some(40);
4077
4078 if chain != Chain::Mainnet && chain != Chain::Testnet {
4079 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4081 }
4082
4083 if chain != Chain::Mainnet {
4084 cfg.feature_flags.uncompressed_g1_group_elements = true;
4085 }
4086 }
4087 70 => {
4088 if chain != Chain::Mainnet {
4089 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4091 cfg.feature_flags
4093 .consensus_round_prober_probe_accepted_rounds = true;
4094 }
4095
4096 cfg.poseidon_bn254_cost_per_block = Some(388);
4097
4098 cfg.gas_model_version = Some(9);
4099 cfg.feature_flags.native_charging_v2 = true;
4100 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4101 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4102 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4103 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4104 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4105 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4106 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4107 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4108
4109 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4111 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4112 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4113 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4114
4115 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4116 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4117 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4118 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4119 Some(8213);
4120 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4121 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4122 Some(9484);
4123
4124 cfg.hash_keccak256_cost_base = Some(10);
4125 cfg.hash_blake2b256_cost_base = Some(10);
4126
4127 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4129 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4130 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4131 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4132
4133 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4134 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4135 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4136 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4137
4138 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4139 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4140 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4141 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4142
4143 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4144 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4145 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4146 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4147
4148 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4149 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4150 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4151 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4152
4153 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4154 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4155
4156 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4157 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4158 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4159 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4160
4161 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4162 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4163 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4164 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4165
4166 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4167 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4168
4169 cfg.validator_validate_metadata_cost_base = Some(20000);
4170 }
4171 71 => {
4172 cfg.sip_45_consensus_amplification_threshold = Some(5);
4173
4174 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4176 }
4177 72 => {
4178 cfg.feature_flags.convert_type_argument_error = true;
4179
4180 cfg.max_tx_gas = Some(50_000_000_000_000);
4183 cfg.max_gas_price = Some(50_000_000_000);
4185
4186 cfg.feature_flags.variant_nodes = true;
4187 }
4188 73 => {
4189 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4191
4192 if chain != Chain::Mainnet && chain != Chain::Testnet {
4193 cfg.consensus_gc_depth = Some(60);
4196 }
4197
4198 if chain != Chain::Mainnet {
4199 cfg.feature_flags.consensus_zstd_compression = true;
4201 }
4202
4203 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4205 cfg.feature_flags
4207 .consensus_round_prober_probe_accepted_rounds = true;
4208
4209 cfg.feature_flags.per_object_congestion_control_mode =
4211 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4212 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4213 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4214 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4215 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4217 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4218 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4219 }
4220 74 => {
4221 if chain != Chain::Mainnet && chain != Chain::Testnet {
4223 cfg.feature_flags.enable_nitro_attestation = true;
4224 }
4225 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4226 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4227 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4228 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4229
4230 cfg.feature_flags.consensus_zstd_compression = true;
4232
4233 if chain != Chain::Mainnet && chain != Chain::Testnet {
4234 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4235 }
4236 }
4237 75 => {
4238 if chain != Chain::Mainnet {
4239 cfg.feature_flags.passkey_auth = true;
4240 }
4241 }
4242 76 => {
4243 if chain != Chain::Mainnet && chain != Chain::Testnet {
4244 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4245 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4246 }
4247 cfg.feature_flags.minimize_child_object_mutations = true;
4248
4249 if chain != Chain::Mainnet {
4250 cfg.feature_flags.accept_passkey_in_multisig = true;
4251 }
4252 }
4253 77 => {
4254 cfg.feature_flags.uncompressed_g1_group_elements = true;
4255
4256 if chain != Chain::Mainnet {
4257 cfg.consensus_gc_depth = Some(60);
4258 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4259 }
4260 }
4261 78 => {
4262 cfg.feature_flags.move_native_context = true;
4263 cfg.tx_context_fresh_id_cost_base = Some(52);
4264 cfg.tx_context_sender_cost_base = Some(30);
4265 cfg.tx_context_epoch_cost_base = Some(30);
4266 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4267 cfg.tx_context_sponsor_cost_base = Some(30);
4268 cfg.tx_context_gas_price_cost_base = Some(30);
4269 cfg.tx_context_gas_budget_cost_base = Some(30);
4270 cfg.tx_context_ids_created_cost_base = Some(30);
4271 cfg.tx_context_replace_cost_base = Some(30);
4272 cfg.gas_model_version = Some(10);
4273
4274 if chain != Chain::Mainnet {
4275 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4276 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4277
4278 cfg.feature_flags.per_object_congestion_control_mode =
4280 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4281 ExecutionTimeEstimateParams {
4282 target_utilization: 30,
4283 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4285 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4287 stored_observations_limit: u64::MAX,
4288 stake_weighted_median_threshold: 0,
4289 default_none_duration_for_new_keys: false,
4290 observations_chunk_size: None,
4291 },
4292 );
4293 }
4294 }
4295 79 => {
4296 if chain != Chain::Mainnet {
4297 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4298
4299 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4302
4303 cfg.feature_flags.consensus_batched_block_sync = true;
4304
4305 cfg.feature_flags.enable_nitro_attestation = true
4307 }
4308 cfg.feature_flags.normalize_ptb_arguments = true;
4309
4310 cfg.consensus_gc_depth = Some(60);
4311 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4312 }
4313 80 => {
4314 cfg.max_ptb_value_size = Some(1024 * 1024);
4315 }
4316 81 => {
4317 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4318 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4319 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4320 }
4321 82 => {
4322 cfg.feature_flags.max_ptb_value_size_v2 = true;
4323 }
4324 83 => {
4325 if chain == Chain::Mainnet {
4326 let aliased: [u8; 32] = Hex::decode(
4328 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4329 )
4330 .unwrap()
4331 .try_into()
4332 .unwrap();
4333
4334 cfg.aliased_addresses.push(AliasedAddress {
4336 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4337 aliased,
4338 allowed_tx_digests: vec![
4339 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4340 ],
4341 });
4342
4343 cfg.aliased_addresses.push(AliasedAddress {
4344 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4345 aliased,
4346 allowed_tx_digests: vec![
4347 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4348 ],
4349 });
4350 }
4351
4352 if chain != Chain::Mainnet {
4355 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4356 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4357
4358 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4360 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4361 cfg.feature_flags.per_object_congestion_control_mode =
4362 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4363 ExecutionTimeEstimateParams {
4364 target_utilization: 30,
4365 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4367 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4369 stored_observations_limit: u64::MAX,
4370 stake_weighted_median_threshold: 0,
4371 default_none_duration_for_new_keys: false,
4372 observations_chunk_size: None,
4373 },
4374 );
4375
4376 cfg.feature_flags.consensus_batched_block_sync = true;
4378
4379 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4382 cfg.feature_flags.enable_nitro_attestation = true;
4383 }
4384 }
4385 84 => {
4386 if chain == Chain::Mainnet {
4387 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4388 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4389
4390 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4392 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4393 cfg.feature_flags.per_object_congestion_control_mode =
4394 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4395 ExecutionTimeEstimateParams {
4396 target_utilization: 30,
4397 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4399 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4401 stored_observations_limit: u64::MAX,
4402 stake_weighted_median_threshold: 0,
4403 default_none_duration_for_new_keys: false,
4404 observations_chunk_size: None,
4405 },
4406 );
4407
4408 cfg.feature_flags.consensus_batched_block_sync = true;
4410
4411 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4414 cfg.feature_flags.enable_nitro_attestation = true;
4415 }
4416
4417 cfg.feature_flags.per_object_congestion_control_mode =
4419 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4420 ExecutionTimeEstimateParams {
4421 target_utilization: 30,
4422 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4424 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4426 stored_observations_limit: 20,
4427 stake_weighted_median_threshold: 0,
4428 default_none_duration_for_new_keys: false,
4429 observations_chunk_size: None,
4430 },
4431 );
4432 cfg.feature_flags.allow_unbounded_system_objects = true;
4433 }
4434 85 => {
4435 if chain != Chain::Mainnet && chain != Chain::Testnet {
4436 cfg.feature_flags.enable_party_transfer = true;
4437 }
4438
4439 cfg.feature_flags
4440 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4441 cfg.feature_flags.disallow_self_identifier = true;
4442 cfg.feature_flags.per_object_congestion_control_mode =
4443 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4444 ExecutionTimeEstimateParams {
4445 target_utilization: 50,
4446 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4448 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4450 stored_observations_limit: 20,
4451 stake_weighted_median_threshold: 0,
4452 default_none_duration_for_new_keys: false,
4453 observations_chunk_size: None,
4454 },
4455 );
4456 }
4457 86 => {
4458 cfg.feature_flags.type_tags_in_object_runtime = true;
4459 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4460
4461 cfg.feature_flags.per_object_congestion_control_mode =
4463 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4464 ExecutionTimeEstimateParams {
4465 target_utilization: 50,
4466 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4468 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4470 stored_observations_limit: 20,
4471 stake_weighted_median_threshold: 3334,
4472 default_none_duration_for_new_keys: false,
4473 observations_chunk_size: None,
4474 },
4475 );
4476 if chain != Chain::Mainnet {
4478 cfg.feature_flags.enable_party_transfer = true;
4479 }
4480 }
4481 87 => {
4482 if chain == Chain::Mainnet {
4483 cfg.feature_flags.record_time_estimate_processed = true;
4484 }
4485 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4486 }
4487 88 => {
4488 cfg.feature_flags.record_time_estimate_processed = true;
4489 cfg.tx_context_rgp_cost_base = Some(30);
4490 cfg.feature_flags
4491 .ignore_execution_time_observations_after_certs_closed = true;
4492
4493 cfg.feature_flags.per_object_congestion_control_mode =
4496 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4497 ExecutionTimeEstimateParams {
4498 target_utilization: 50,
4499 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4501 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4503 stored_observations_limit: 20,
4504 stake_weighted_median_threshold: 3334,
4505 default_none_duration_for_new_keys: true,
4506 observations_chunk_size: None,
4507 },
4508 );
4509 }
4510 89 => {
4511 cfg.feature_flags.dependency_linkage_error = true;
4512 cfg.feature_flags.additional_multisig_checks = true;
4513 }
4514 90 => {
4515 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4517 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4518 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4519 cfg.feature_flags.accept_passkey_in_multisig = true;
4520 cfg.feature_flags.passkey_auth = true;
4521 cfg.feature_flags.check_for_init_during_upgrade = true;
4522
4523 if chain != Chain::Mainnet {
4525 cfg.feature_flags.mysticeti_fastpath = true;
4526 }
4527 }
4528 91 => {
4529 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4530 }
4531 92 => {
4532 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4533 }
4534 93 => {
4535 cfg.feature_flags
4536 .consensus_checkpoint_signature_key_includes_digest = true;
4537 }
4538 94 => {
4539 cfg.feature_flags.per_object_congestion_control_mode =
4541 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4542 ExecutionTimeEstimateParams {
4543 target_utilization: 50,
4544 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4546 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4548 stored_observations_limit: 18,
4549 stake_weighted_median_threshold: 3334,
4550 default_none_duration_for_new_keys: true,
4551 observations_chunk_size: None,
4552 },
4553 );
4554
4555 cfg.feature_flags.enable_party_transfer = true;
4557 }
4558 95 => {
4559 cfg.type_name_id_base_cost = Some(52);
4560
4561 cfg.max_transactions_per_checkpoint = Some(20_000);
4563 }
4564 96 => {
4565 if chain != Chain::Mainnet && chain != Chain::Testnet {
4567 cfg.feature_flags
4568 .include_checkpoint_artifacts_digest_in_summary = true;
4569 }
4570 cfg.feature_flags.correct_gas_payment_limit_check = true;
4571 cfg.feature_flags.authority_capabilities_v2 = true;
4572 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4573 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4574 cfg.feature_flags.enable_coin_registry = true;
4575
4576 cfg.feature_flags.mysticeti_fastpath = true;
4578 }
4579 97 => {
4580 cfg.feature_flags.additional_borrow_checks = true;
4581 }
4582 98 => {
4583 cfg.event_emit_auth_stream_cost = Some(52);
4584 cfg.feature_flags.better_loader_errors = true;
4585 cfg.feature_flags.generate_df_type_layouts = true;
4586 }
4587 99 => {
4588 cfg.feature_flags.use_new_commit_handler = true;
4589 }
4590 100 => {
4591 cfg.feature_flags.private_generics_verifier_v2 = true;
4592 }
4593 101 => {
4594 cfg.feature_flags.create_root_accumulator_object = true;
4595 cfg.max_updates_per_settlement_txn = Some(100);
4596 if chain != Chain::Mainnet {
4597 cfg.feature_flags.enable_poseidon = true;
4598 }
4599 }
4600 102 => {
4601 cfg.feature_flags.per_object_congestion_control_mode =
4605 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4606 ExecutionTimeEstimateParams {
4607 target_utilization: 50,
4608 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4610 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4612 stored_observations_limit: 180,
4613 stake_weighted_median_threshold: 3334,
4614 default_none_duration_for_new_keys: true,
4615 observations_chunk_size: Some(18),
4616 },
4617 );
4618 cfg.feature_flags.deprecate_global_storage_ops = true;
4619 }
4620 103 => {}
4621 104 => {
4622 cfg.translation_per_command_base_charge = Some(1);
4623 cfg.translation_per_input_base_charge = Some(1);
4624 cfg.translation_pure_input_per_byte_charge = Some(1);
4625 cfg.translation_per_type_node_charge = Some(1);
4626 cfg.translation_per_reference_node_charge = Some(1);
4627 cfg.translation_per_linkage_entry_charge = Some(10);
4628 cfg.gas_model_version = Some(11);
4629 cfg.feature_flags.abstract_size_in_object_runtime = true;
4630 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4631 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4632 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4633 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4634 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4635 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4636 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4637 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4638 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4639 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4640 cfg.feature_flags.enable_ptb_execution_v2 = true;
4641
4642 cfg.poseidon_bn254_cost_base = Some(260);
4643
4644 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4645
4646 if chain != Chain::Mainnet {
4647 cfg.feature_flags
4648 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4649 }
4650
4651 cfg.feature_flags
4652 .include_cancelled_randomness_txns_in_prologue = true;
4653 }
4654 105 => {
4655 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4656 cfg.feature_flags.disable_preconsensus_locking = true;
4657
4658 if chain != Chain::Mainnet {
4659 cfg.feature_flags
4660 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4661 }
4662 }
4663 106 => {
4664 cfg.accumulator_object_storage_cost = Some(7600);
4666
4667 if chain != Chain::Mainnet && chain != Chain::Testnet {
4668 cfg.feature_flags.enable_accumulators = true;
4669 cfg.feature_flags.enable_address_balance_gas_payments = true;
4670 cfg.feature_flags.enable_authenticated_event_streams = true;
4671 cfg.feature_flags.enable_object_funds_withdraw = true;
4672 }
4673 }
4674 107 => {
4675 cfg.feature_flags
4676 .consensus_skip_gced_blocks_in_direct_finalization = true;
4677
4678 if in_integration_test() {
4680 cfg.consensus_gc_depth = Some(6);
4681 cfg.consensus_max_num_transactions_in_block = Some(8);
4682 }
4683 }
4684 108 => {
4685 cfg.feature_flags.gas_rounding_halve_digits = true;
4686 cfg.feature_flags.flexible_tx_context_positions = true;
4687 cfg.feature_flags.disable_entry_point_signature_check = true;
4688
4689 if chain != Chain::Mainnet {
4690 cfg.feature_flags.address_aliases = true;
4691
4692 cfg.feature_flags.enable_accumulators = true;
4693 cfg.feature_flags.enable_address_balance_gas_payments = true;
4694 }
4695
4696 cfg.feature_flags.enable_poseidon = true;
4697 }
4698 109 => {
4699 cfg.binary_variant_handles = Some(1024);
4700 cfg.binary_variant_instantiation_handles = Some(1024);
4701 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4702 }
4703 110 => {
4704 cfg.feature_flags
4705 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4706 cfg.feature_flags
4707 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4708 if chain != Chain::Mainnet && chain != Chain::Testnet {
4709 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4710 }
4711 cfg.feature_flags.validate_zklogin_public_identifier = true;
4712 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4713 cfg.feature_flags
4714 .consensus_always_accept_system_transactions = true;
4715 if chain != Chain::Mainnet {
4716 cfg.feature_flags.enable_object_funds_withdraw = true;
4717 }
4718 }
4719 111 => {
4720 cfg.feature_flags.validator_metadata_verify_v2 = true;
4721 }
4722 112 => {
4723 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4724 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4725 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4726 cfg.group_ops_ristretto_point_add_cost = Some(500);
4727 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4728 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4729 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4730 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4731 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4732 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4733
4734 if chain != Chain::Mainnet && chain != Chain::Testnet {
4735 cfg.feature_flags.enable_ristretto255_group_ops = true;
4736 }
4737 }
4738 113 => {
4739 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4740 if chain != Chain::Mainnet && chain != Chain::Testnet {
4741 cfg.feature_flags.defer_unpaid_amplification = true;
4742 }
4743 }
4744 114 => {
4745 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4746 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4747 if chain != Chain::Mainnet {
4748 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4749 cfg.feature_flags.enable_authenticated_event_streams = true;
4750 cfg.feature_flags
4751 .include_checkpoint_artifacts_digest_in_summary = true;
4752 }
4753 }
4754 115 => {
4755 cfg.feature_flags.normalize_depth_formula = true;
4756 }
4757 116 => {
4758 cfg.feature_flags.gasless_transaction_drop_safety = true;
4759 cfg.feature_flags.address_aliases = true;
4760 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4761 cfg.feature_flags.defer_unpaid_amplification = false;
4763 cfg.feature_flags.enable_display_registry = true;
4764 }
4765 117 => {}
4766 118 => {
4767 cfg.feature_flags.use_coin_party_owner = true;
4768 }
4769 119 => {
4770 cfg.execution_version = Some(4);
4772 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4773 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4774 if chain != Chain::Mainnet {
4775 cfg.feature_flags.enable_gasless = true;
4776 cfg.gasless_max_computation_units = Some(50_000);
4777 cfg.gasless_allowed_token_types = Some(vec![]);
4778 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4779 cfg.feature_flags
4780 .convert_withdrawal_compatibility_ptb_arguments = true;
4781 }
4782 cfg.gasless_max_unused_inputs = Some(1);
4783 cfg.gasless_max_pure_input_bytes = Some(32);
4784 if chain == Chain::Testnet {
4785 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4786 }
4787 cfg.transfer_receive_object_cost_per_byte = Some(1);
4788 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4789 }
4790 120 => {
4791 cfg.feature_flags.disallow_jump_orphans = true;
4792 }
4793 121 => {
4794 if chain != Chain::Mainnet {
4796 cfg.feature_flags.defer_unpaid_amplification = true;
4797 cfg.gasless_max_tps = Some(50);
4798 }
4799 cfg.feature_flags
4800 .early_return_receive_object_mismatched_type = true;
4801 }
4802 122 => {}
4803 _ => panic!("unsupported version {:?}", version),
4814 }
4815 }
4816
4817 cfg
4818 }
4819
4820 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4821 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4822 || !self.feature_flags.split_checkpoints_in_consensus_handler
4823 {
4824 return;
4825 }
4826
4827 if !mysten_common::in_test_configuration() {
4828 return;
4829 }
4830
4831 use rand::{Rng, SeedableRng, rngs::StdRng};
4832 let mut rng = StdRng::from_seed(*seed);
4833 let max_txns = rng.gen_range(10..=100u64);
4834 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4835 self.max_transactions_per_checkpoint = Some(max_txns);
4836 }
4837
4838 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4844 let (
4845 max_back_edges_per_function,
4846 max_back_edges_per_module,
4847 sanity_check_with_regex_reference_safety,
4848 ) = if let Some((
4849 max_back_edges_per_function,
4850 max_back_edges_per_module,
4851 sanity_check_with_regex_reference_safety,
4852 )) = signing_limits
4853 {
4854 (
4855 Some(max_back_edges_per_function),
4856 Some(max_back_edges_per_module),
4857 Some(sanity_check_with_regex_reference_safety),
4858 )
4859 } else {
4860 (None, None, None)
4861 };
4862
4863 let additional_borrow_checks = if signing_limits.is_some() {
4864 true
4866 } else {
4867 self.additional_borrow_checks()
4868 };
4869 let deprecate_global_storage_ops = if signing_limits.is_some() {
4870 true
4872 } else {
4873 self.deprecate_global_storage_ops()
4874 };
4875
4876 VerifierConfig {
4877 max_loop_depth: Some(self.max_loop_depth() as usize),
4878 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4879 max_function_parameters: Some(self.max_function_parameters() as usize),
4880 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4881 max_value_stack_size: self.max_value_stack_size() as usize,
4882 max_type_nodes: Some(self.max_type_nodes() as usize),
4883 max_push_size: Some(self.max_push_size() as usize),
4884 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4885 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4886 max_function_definitions: Some(self.max_function_definitions() as usize),
4887 max_data_definitions: Some(self.max_struct_definitions() as usize),
4888 max_constant_vector_len: Some(self.max_move_vector_len()),
4889 max_back_edges_per_function,
4890 max_back_edges_per_module,
4891 max_basic_blocks_in_script: None,
4892 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4894 allow_receiving_object_id: self.allow_receiving_object_id(),
4895 reject_mutable_random_on_entry_functions: self
4896 .reject_mutable_random_on_entry_functions(),
4897 bytecode_version: self.move_binary_format_version(),
4898 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4899 additional_borrow_checks,
4900 better_loader_errors: self.better_loader_errors(),
4901 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4902 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4903 .map(|limit| limit as u128),
4904 deprecate_global_storage_ops,
4905 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4906 switch_to_regex_reference_safety: false,
4907 disallow_jump_orphans: self.disallow_jump_orphans(),
4908 }
4909 }
4910
4911 pub fn binary_config(
4912 &self,
4913 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4914 ) -> BinaryConfig {
4915 let deprecate_global_storage_ops =
4916 override_deprecate_global_storage_ops_during_deserialization
4917 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4918 BinaryConfig::new(
4919 self.move_binary_format_version(),
4920 self.min_move_binary_format_version_as_option()
4921 .unwrap_or(VERSION_1),
4922 self.no_extraneous_module_bytes(),
4923 deprecate_global_storage_ops,
4924 TableConfig {
4925 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4926 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4927 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4928 function_instantiations: self
4929 .binary_function_instantiations_as_option()
4930 .unwrap_or(u16::MAX),
4931 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4932 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4933 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4934 address_identifiers: self
4935 .binary_address_identifiers_as_option()
4936 .unwrap_or(u16::MAX),
4937 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4938 struct_def_instantiations: self
4939 .binary_struct_def_instantiations_as_option()
4940 .unwrap_or(u16::MAX),
4941 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4942 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4943 field_instantiations: self
4944 .binary_field_instantiations_as_option()
4945 .unwrap_or(u16::MAX),
4946 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4947 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4948 enum_def_instantiations: self
4949 .binary_enum_def_instantiations_as_option()
4950 .unwrap_or(u16::MAX),
4951 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4952 variant_instantiation_handles: self
4953 .binary_variant_instantiation_handles_as_option()
4954 .unwrap_or(u16::MAX),
4955 },
4956 )
4957 }
4958
4959 #[cfg(not(msim))]
4963 pub fn apply_overrides_for_testing(
4964 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
4965 ) -> OverrideGuard {
4966 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
4967 assert!(cur.is_none(), "config override already present");
4968 *cur = Some(Box::new(override_fn));
4969 OverrideGuard
4970 }
4971
4972 #[cfg(msim)]
4976 pub fn apply_overrides_for_testing(
4977 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4978 ) -> OverrideGuard {
4979 CONFIG_OVERRIDE.with(|ovr| {
4980 let mut cur = ovr.borrow_mut();
4981 assert!(cur.is_none(), "config override already present");
4982 *cur = Some(Box::new(override_fn));
4983 OverrideGuard
4984 })
4985 }
4986
4987 #[cfg(not(msim))]
4988 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
4989 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
4990 warn!(
4991 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
4992 );
4993 ret = override_fn(version, ret);
4994 }
4995 ret
4996 }
4997
4998 #[cfg(msim)]
4999 fn apply_config_override(version: ProtocolVersion, ret: Self) -> Self {
5000 CONFIG_OVERRIDE.with(|ovr| {
5001 if let Some(override_fn) = &*ovr.borrow() {
5002 warn!(
5003 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5004 );
5005 override_fn(version, ret)
5006 } else {
5007 ret
5008 }
5009 })
5010 }
5011}
5012
5013impl ProtocolConfig {
5017 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
5018 self.feature_flags
5019 .advance_to_highest_supported_protocol_version = val
5020 }
5021 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
5022 self.feature_flags.commit_root_state_digest = val
5023 }
5024 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
5025 self.feature_flags.zklogin_auth = val
5026 }
5027 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
5028 self.feature_flags.enable_jwk_consensus_updates = val
5029 }
5030 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
5031 self.feature_flags.random_beacon = val
5032 }
5033
5034 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
5035 self.feature_flags.upgraded_multisig_supported = val
5036 }
5037 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
5038 self.feature_flags.accept_zklogin_in_multisig = val
5039 }
5040
5041 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
5042 self.feature_flags.shared_object_deletion = val;
5043 }
5044
5045 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
5046 self.feature_flags.narwhal_new_leader_election_schedule = val;
5047 }
5048
5049 pub fn set_receive_object_for_testing(&mut self, val: bool) {
5050 self.feature_flags.receive_objects = val
5051 }
5052 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
5053 self.feature_flags.narwhal_certificate_v2 = val
5054 }
5055 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
5056 self.feature_flags.verify_legacy_zklogin_address = val
5057 }
5058
5059 pub fn set_per_object_congestion_control_mode_for_testing(
5060 &mut self,
5061 val: PerObjectCongestionControlMode,
5062 ) {
5063 self.feature_flags.per_object_congestion_control_mode = val;
5064 }
5065
5066 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5067 self.feature_flags.consensus_choice = val;
5068 }
5069
5070 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5071 self.feature_flags.consensus_network = val;
5072 }
5073
5074 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5075 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5076 }
5077
5078 pub fn set_disable_bridge_for_testing(&mut self) {
5079 self.feature_flags.bridge = false
5080 }
5081
5082 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5083 self.feature_flags.mysticeti_num_leaders_per_round = val;
5084 }
5085
5086 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5087 self.feature_flags.soft_bundle = val;
5088 }
5089
5090 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5091 self.feature_flags.passkey_auth = val
5092 }
5093
5094 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5095 self.feature_flags.enable_party_transfer = val
5096 }
5097
5098 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5099 self.feature_flags
5100 .consensus_distributed_vote_scoring_strategy = val;
5101 }
5102
5103 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5104 self.feature_flags.consensus_round_prober = val;
5105 }
5106
5107 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5108 self.feature_flags
5109 .disallow_new_modules_in_deps_only_packages = val;
5110 }
5111
5112 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5113 self.feature_flags.correct_gas_payment_limit_check = val;
5114 }
5115
5116 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5117 self.feature_flags.address_aliases = val;
5118 }
5119
5120 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5121 self.feature_flags
5122 .consensus_round_prober_probe_accepted_rounds = val;
5123 }
5124
5125 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5126 self.feature_flags.mysticeti_fastpath = val;
5127 }
5128
5129 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5130 self.feature_flags.accept_passkey_in_multisig = val;
5131 }
5132
5133 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5134 self.feature_flags.consensus_batched_block_sync = val;
5135 }
5136
5137 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5138 self.feature_flags.record_time_estimate_processed = val;
5139 }
5140
5141 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5142 &mut self,
5143 val: bool,
5144 ) {
5145 self.feature_flags
5146 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5147 }
5148
5149 pub fn enable_accumulators_for_testing(&mut self) {
5150 self.feature_flags.enable_accumulators = true;
5151 }
5152
5153 pub fn disable_accumulators_for_testing(&mut self) {
5154 self.feature_flags.enable_accumulators = false;
5155 self.feature_flags.enable_address_balance_gas_payments = false;
5156 }
5157
5158 pub fn enable_coin_reservation_for_testing(&mut self) {
5159 self.feature_flags.enable_coin_reservation_obj_refs = true;
5160 self.feature_flags
5161 .convert_withdrawal_compatibility_ptb_arguments = true;
5162 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5165 }
5166
5167 pub fn disable_coin_reservation_for_testing(&mut self) {
5168 self.feature_flags.enable_coin_reservation_obj_refs = false;
5169 self.feature_flags
5170 .convert_withdrawal_compatibility_ptb_arguments = false;
5171 }
5172
5173 pub fn create_root_accumulator_object_for_testing(&mut self) {
5174 self.feature_flags.create_root_accumulator_object = true;
5175 }
5176
5177 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5178 self.feature_flags.create_root_accumulator_object = false;
5179 }
5180
5181 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5182 self.feature_flags.enable_accumulators = true;
5183 self.feature_flags.allow_private_accumulator_entrypoints = true;
5184 self.feature_flags.enable_address_balance_gas_payments = true;
5185 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5186 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5187 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5188 }
5189
5190 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5191 self.feature_flags.enable_address_balance_gas_payments = false;
5192 }
5193
5194 pub fn enable_gasless_for_testing(&mut self) {
5195 self.enable_address_balance_gas_payments_for_testing();
5196 self.feature_flags.enable_gasless = true;
5197 self.gasless_max_computation_units = Some(50_000);
5198 self.gasless_allowed_token_types = Some(vec![]);
5199 self.gasless_max_tps = Some(1000);
5200 }
5201
5202 pub fn disable_gasless_for_testing(&mut self) {
5203 self.feature_flags.enable_gasless = false;
5204 self.gasless_max_computation_units = None;
5205 self.gasless_allowed_token_types = None;
5206 }
5207
5208 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5209 self.gasless_allowed_token_types = Some(types);
5210 }
5211
5212 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5213 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5214 }
5215
5216 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5217 self.enable_accumulators_for_testing();
5218 self.feature_flags.enable_authenticated_event_streams = true;
5219 self.feature_flags
5220 .include_checkpoint_artifacts_digest_in_summary = true;
5221 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5222 }
5223
5224 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5225 self.feature_flags.enable_authenticated_event_streams = false;
5226 }
5227
5228 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5229 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5230 }
5231
5232 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5233 self.feature_flags.enable_non_exclusive_writes = true;
5234 }
5235
5236 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5237 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5238 }
5239
5240 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5241 &mut self,
5242 val: bool,
5243 ) {
5244 self.feature_flags
5245 .ignore_execution_time_observations_after_certs_closed = val;
5246 }
5247
5248 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5249 &mut self,
5250 val: bool,
5251 ) {
5252 self.feature_flags
5253 .consensus_checkpoint_signature_key_includes_digest = val;
5254 }
5255
5256 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5257 self.feature_flags.cancel_for_failed_dkg_early = val;
5258 }
5259
5260 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5261 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5262 }
5263
5264 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5265 self.feature_flags.authority_capabilities_v2 = val;
5266 }
5267
5268 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5269 self.feature_flags.allow_references_in_ptbs = true;
5270 }
5271
5272 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5273 self.feature_flags.consensus_skip_gced_accept_votes = val;
5274 }
5275
5276 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5277 self.feature_flags.enable_object_funds_withdraw = val;
5278 }
5279
5280 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5281 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5282 }
5283
5284 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5285 self.feature_flags.merge_randomness_into_checkpoint = val;
5286 }
5287}
5288
5289#[cfg(not(msim))]
5290type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5291
5292#[cfg(not(msim))]
5293static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5294
5295#[cfg(msim)]
5296type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5297
5298#[cfg(msim)]
5299thread_local! {
5300 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5301}
5302
5303#[must_use]
5304pub struct OverrideGuard;
5305
5306#[cfg(not(msim))]
5307impl Drop for OverrideGuard {
5308 fn drop(&mut self) {
5309 info!("restoring override fn");
5310 *CONFIG_OVERRIDE.lock().unwrap() = None;
5311 }
5312}
5313
5314#[cfg(msim)]
5315impl Drop for OverrideGuard {
5316 fn drop(&mut self) {
5317 info!("restoring override fn");
5318 CONFIG_OVERRIDE.with(|ovr| {
5319 *ovr.borrow_mut() = None;
5320 });
5321 }
5322}
5323
5324#[derive(PartialEq, Eq)]
5327pub enum LimitThresholdCrossed {
5328 None,
5329 Soft(u128, u128),
5330 Hard(u128, u128),
5331}
5332
5333pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5336 x: T,
5337 soft_limit: U,
5338 hard_limit: V,
5339) -> LimitThresholdCrossed {
5340 let x: V = x.into();
5341 let soft_limit: V = soft_limit.into();
5342
5343 debug_assert!(soft_limit <= hard_limit);
5344
5345 if x >= hard_limit {
5348 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5349 } else if x < soft_limit {
5350 LimitThresholdCrossed::None
5351 } else {
5352 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5353 }
5354}
5355
5356#[macro_export]
5357macro_rules! check_limit {
5358 ($x:expr, $hard:expr) => {
5359 check_limit!($x, $hard, $hard)
5360 };
5361 ($x:expr, $soft:expr, $hard:expr) => {
5362 check_limit_in_range($x as u64, $soft, $hard)
5363 };
5364}
5365
5366#[macro_export]
5370macro_rules! check_limit_by_meter {
5371 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5372 let (h, metered_str) = if $is_metered {
5374 ($metered_limit, "metered")
5375 } else {
5376 ($unmetered_hard_limit, "unmetered")
5378 };
5379 use sui_protocol_config::check_limit_in_range;
5380 let result = check_limit_in_range($x as u64, $metered_limit, h);
5381 match result {
5382 LimitThresholdCrossed::None => {}
5383 LimitThresholdCrossed::Soft(_, _) => {
5384 $metric.with_label_values(&[metered_str, "soft"]).inc();
5385 }
5386 LimitThresholdCrossed::Hard(_, _) => {
5387 $metric.with_label_values(&[metered_str, "hard"]).inc();
5388 }
5389 };
5390 result
5391 }};
5392}
5393#[cfg(all(test, not(msim)))]
5394mod test {
5395 use insta::assert_yaml_snapshot;
5396
5397 use super::*;
5398
5399 #[test]
5400 fn snapshot_tests() {
5401 println!("\n============================================================================");
5402 println!("! !");
5403 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5404 println!("! !");
5405 println!("============================================================================\n");
5406 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5407 let chain_str = match chain_id {
5411 Chain::Unknown => "".to_string(),
5412 _ => format!("{:?}_", chain_id),
5413 };
5414 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5415 let cur = ProtocolVersion::new(i);
5416 assert_yaml_snapshot!(
5417 format!("{}version_{}", chain_str, cur.as_u64()),
5418 ProtocolConfig::get_for_version(cur, *chain_id)
5419 );
5420 }
5421 }
5422 }
5423
5424 #[test]
5425 fn test_getters() {
5426 let prot: ProtocolConfig =
5427 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5428 assert_eq!(
5429 prot.max_arguments(),
5430 prot.max_arguments_as_option().unwrap()
5431 );
5432 }
5433
5434 #[test]
5435 fn test_setters() {
5436 let mut prot: ProtocolConfig =
5437 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5438 prot.set_max_arguments_for_testing(123);
5439 assert_eq!(prot.max_arguments(), 123);
5440
5441 prot.set_max_arguments_from_str_for_testing("321".to_string());
5442 assert_eq!(prot.max_arguments(), 321);
5443
5444 prot.disable_max_arguments_for_testing();
5445 assert_eq!(prot.max_arguments_as_option(), None);
5446
5447 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5448 assert_eq!(prot.max_arguments(), 456);
5449 }
5450
5451 #[test]
5452 fn test_get_for_version_if_supported_applies_test_overrides() {
5453 let before =
5454 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5455 .unwrap();
5456
5457 assert!(!before.enable_coin_reservation_obj_refs());
5458
5459 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5460 cfg.enable_coin_reservation_for_testing();
5461 cfg
5462 });
5463
5464 let after =
5465 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5466 .unwrap();
5467
5468 assert!(after.enable_coin_reservation_obj_refs());
5469 }
5470
5471 #[test]
5472 #[should_panic(expected = "unsupported version")]
5473 fn max_version_test() {
5474 let _ = ProtocolConfig::get_for_version_impl(
5477 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5478 Chain::Unknown,
5479 );
5480 }
5481
5482 #[test]
5483 fn lookup_by_string_test() {
5484 let prot: ProtocolConfig =
5485 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5486 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5488
5489 assert!(
5490 prot.lookup_attr("max_arguments".to_string())
5491 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5492 );
5493
5494 assert!(
5496 prot.lookup_attr("max_move_identifier_len".to_string())
5497 .is_none()
5498 );
5499
5500 let prot: ProtocolConfig =
5502 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5503 assert!(
5504 prot.lookup_attr("max_move_identifier_len".to_string())
5505 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5506 );
5507
5508 let prot: ProtocolConfig =
5509 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5510 assert!(
5512 prot.attr_map()
5513 .get("max_move_identifier_len")
5514 .unwrap()
5515 .is_none()
5516 );
5517 assert!(
5519 prot.attr_map().get("max_arguments").unwrap()
5520 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5521 );
5522
5523 let prot: ProtocolConfig =
5525 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5526 assert!(
5528 prot.feature_flags
5529 .lookup_attr("some random string".to_owned())
5530 .is_none()
5531 );
5532 assert!(
5533 !prot
5534 .feature_flags
5535 .attr_map()
5536 .contains_key("some random string")
5537 );
5538
5539 assert!(
5541 prot.feature_flags
5542 .lookup_attr("package_upgrades".to_owned())
5543 == Some(false)
5544 );
5545 assert!(
5546 prot.feature_flags
5547 .attr_map()
5548 .get("package_upgrades")
5549 .unwrap()
5550 == &false
5551 );
5552 let prot: ProtocolConfig =
5553 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5554 assert!(
5556 prot.feature_flags
5557 .lookup_attr("package_upgrades".to_owned())
5558 == Some(true)
5559 );
5560 assert!(
5561 prot.feature_flags
5562 .attr_map()
5563 .get("package_upgrades")
5564 .unwrap()
5565 == &true
5566 );
5567 }
5568
5569 #[test]
5570 fn limit_range_fn_test() {
5571 let low = 100u32;
5572 let high = 10000u64;
5573
5574 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5575 assert!(matches!(
5576 check_limit!(255u16, low, high),
5577 LimitThresholdCrossed::Soft(255u128, 100)
5578 ));
5579 assert!(matches!(
5585 check_limit!(2550000u64, low, high),
5586 LimitThresholdCrossed::Hard(2550000, 10000)
5587 ));
5588
5589 assert!(matches!(
5590 check_limit!(2550000u64, high, high),
5591 LimitThresholdCrossed::Hard(2550000, 10000)
5592 ));
5593
5594 assert!(matches!(
5595 check_limit!(1u8, high),
5596 LimitThresholdCrossed::None
5597 ));
5598
5599 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5600
5601 assert!(matches!(
5602 check_limit!(2550000u64, high),
5603 LimitThresholdCrossed::Hard(2550000, 10000)
5604 ));
5605 }
5606}