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)]
323pub struct ProtocolVersion(u64);
324
325impl ProtocolVersion {
326 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
331
332 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
333
334 #[cfg(not(msim))]
335 pub const MAX_ALLOWED: Self = Self::MAX;
336
337 #[cfg(msim)]
339 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
340
341 pub fn new(v: u64) -> Self {
342 Self(v)
343 }
344
345 pub const fn as_u64(&self) -> u64 {
346 self.0
347 }
348
349 pub fn max() -> Self {
352 Self::MAX
353 }
354
355 pub fn prev(self) -> Self {
356 Self(self.0.checked_sub(1).unwrap())
357 }
358}
359
360impl From<u64> for ProtocolVersion {
361 fn from(v: u64) -> Self {
362 Self::new(v)
363 }
364}
365
366impl std::ops::Sub<u64> for ProtocolVersion {
367 type Output = Self;
368 fn sub(self, rhs: u64) -> Self::Output {
369 Self::new(self.0 - rhs)
370 }
371}
372
373impl std::ops::Add<u64> for ProtocolVersion {
374 type Output = Self;
375 fn add(self, rhs: u64) -> Self::Output {
376 Self::new(self.0 + rhs)
377 }
378}
379
380#[derive(
381 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
382)]
383pub enum Chain {
384 Mainnet,
385 Testnet,
386 #[default]
387 Unknown,
388}
389
390impl Chain {
391 pub fn as_str(self) -> &'static str {
392 match self {
393 Chain::Mainnet => "mainnet",
394 Chain::Testnet => "testnet",
395 Chain::Unknown => "unknown",
396 }
397 }
398}
399
400pub struct Error(pub String);
401
402#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
405struct FeatureFlags {
406 #[serde(skip_serializing_if = "is_false")]
409 package_upgrades: bool,
410 #[serde(skip_serializing_if = "is_false")]
413 commit_root_state_digest: bool,
414 #[serde(skip_serializing_if = "is_false")]
416 advance_epoch_start_time_in_safe_mode: bool,
417 #[serde(skip_serializing_if = "is_false")]
420 loaded_child_objects_fixed: bool,
421 #[serde(skip_serializing_if = "is_false")]
424 missing_type_is_compatibility_error: bool,
425 #[serde(skip_serializing_if = "is_false")]
428 scoring_decision_with_validity_cutoff: bool,
429
430 #[serde(skip_serializing_if = "is_false")]
433 consensus_order_end_of_epoch_last: bool,
434
435 #[serde(skip_serializing_if = "is_false")]
437 disallow_adding_abilities_on_upgrade: bool,
438 #[serde(skip_serializing_if = "is_false")]
440 disable_invariant_violation_check_in_swap_loc: bool,
441 #[serde(skip_serializing_if = "is_false")]
444 advance_to_highest_supported_protocol_version: bool,
445 #[serde(skip_serializing_if = "is_false")]
447 ban_entry_init: bool,
448 #[serde(skip_serializing_if = "is_false")]
450 package_digest_hash_module: bool,
451 #[serde(skip_serializing_if = "is_false")]
453 disallow_change_struct_type_params_on_upgrade: bool,
454 #[serde(skip_serializing_if = "is_false")]
456 no_extraneous_module_bytes: bool,
457 #[serde(skip_serializing_if = "is_false")]
459 narwhal_versioned_metadata: bool,
460
461 #[serde(skip_serializing_if = "is_false")]
463 zklogin_auth: bool,
464 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
466 consensus_transaction_ordering: ConsensusTransactionOrdering,
467
468 #[serde(skip_serializing_if = "is_false")]
476 simplified_unwrap_then_delete: bool,
477 #[serde(skip_serializing_if = "is_false")]
479 upgraded_multisig_supported: bool,
480 #[serde(skip_serializing_if = "is_false")]
482 txn_base_cost_as_multiplier: bool,
483
484 #[serde(skip_serializing_if = "is_false")]
486 shared_object_deletion: bool,
487
488 #[serde(skip_serializing_if = "is_false")]
490 narwhal_new_leader_election_schedule: bool,
491
492 #[serde(skip_serializing_if = "is_empty")]
494 zklogin_supported_providers: BTreeSet<String>,
495
496 #[serde(skip_serializing_if = "is_false")]
498 loaded_child_object_format: bool,
499
500 #[serde(skip_serializing_if = "is_false")]
501 enable_jwk_consensus_updates: bool,
502
503 #[serde(skip_serializing_if = "is_false")]
504 end_of_epoch_transaction_supported: bool,
505
506 #[serde(skip_serializing_if = "is_false")]
509 simple_conservation_checks: bool,
510
511 #[serde(skip_serializing_if = "is_false")]
513 loaded_child_object_format_type: bool,
514
515 #[serde(skip_serializing_if = "is_false")]
517 receive_objects: bool,
518
519 #[serde(skip_serializing_if = "is_false")]
521 consensus_checkpoint_signature_key_includes_digest: bool,
522
523 #[serde(skip_serializing_if = "is_false")]
525 random_beacon: bool,
526
527 #[serde(skip_serializing_if = "is_false")]
529 bridge: bool,
530
531 #[serde(skip_serializing_if = "is_false")]
532 enable_effects_v2: bool,
533
534 #[serde(skip_serializing_if = "is_false")]
536 narwhal_certificate_v2: bool,
537
538 #[serde(skip_serializing_if = "is_false")]
540 verify_legacy_zklogin_address: bool,
541
542 #[serde(skip_serializing_if = "is_false")]
544 throughput_aware_consensus_submission: bool,
545
546 #[serde(skip_serializing_if = "is_false")]
548 recompute_has_public_transfer_in_execution: bool,
549
550 #[serde(skip_serializing_if = "is_false")]
552 accept_zklogin_in_multisig: bool,
553
554 #[serde(skip_serializing_if = "is_false")]
556 accept_passkey_in_multisig: bool,
557
558 #[serde(skip_serializing_if = "is_false")]
560 validate_zklogin_public_identifier: bool,
561
562 #[serde(skip_serializing_if = "is_false")]
565 include_consensus_digest_in_prologue: bool,
566
567 #[serde(skip_serializing_if = "is_false")]
569 hardened_otw_check: bool,
570
571 #[serde(skip_serializing_if = "is_false")]
573 allow_receiving_object_id: bool,
574
575 #[serde(skip_serializing_if = "is_false")]
577 enable_poseidon: bool,
578
579 #[serde(skip_serializing_if = "is_false")]
581 enable_coin_deny_list: bool,
582
583 #[serde(skip_serializing_if = "is_false")]
585 enable_group_ops_native_functions: bool,
586
587 #[serde(skip_serializing_if = "is_false")]
589 enable_group_ops_native_function_msm: bool,
590
591 #[serde(skip_serializing_if = "is_false")]
593 enable_ristretto255_group_ops: bool,
594
595 #[serde(skip_serializing_if = "is_false")]
597 enable_verify_bulletproofs_ristretto255: bool,
598
599 #[serde(skip_serializing_if = "is_false")]
601 enable_nitro_attestation: bool,
602
603 #[serde(skip_serializing_if = "is_false")]
605 enable_nitro_attestation_upgraded_parsing: bool,
606
607 #[serde(skip_serializing_if = "is_false")]
609 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
610
611 #[serde(skip_serializing_if = "is_false")]
613 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
614
615 #[serde(skip_serializing_if = "is_false")]
617 reject_mutable_random_on_entry_functions: bool,
618
619 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
621 per_object_congestion_control_mode: PerObjectCongestionControlMode,
622
623 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
625 consensus_choice: ConsensusChoice,
626
627 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
629 consensus_network: ConsensusNetwork,
630
631 #[serde(skip_serializing_if = "is_false")]
633 correct_gas_payment_limit_check: bool,
634
635 #[serde(skip_serializing_if = "Option::is_none")]
637 zklogin_max_epoch_upper_bound_delta: Option<u64>,
638
639 #[serde(skip_serializing_if = "is_false")]
641 mysticeti_leader_scoring_and_schedule: bool,
642
643 #[serde(skip_serializing_if = "is_false")]
645 reshare_at_same_initial_version: bool,
646
647 #[serde(skip_serializing_if = "is_false")]
649 resolve_abort_locations_to_package_id: bool,
650
651 #[serde(skip_serializing_if = "is_false")]
655 mysticeti_use_committed_subdag_digest: bool,
656
657 #[serde(skip_serializing_if = "is_false")]
659 enable_vdf: bool,
660
661 #[serde(skip_serializing_if = "is_false")]
666 record_consensus_determined_version_assignments_in_prologue: bool,
667 #[serde(skip_serializing_if = "is_false")]
668 record_consensus_determined_version_assignments_in_prologue_v2: bool,
669
670 #[serde(skip_serializing_if = "is_false")]
672 fresh_vm_on_framework_upgrade: bool,
673
674 #[serde(skip_serializing_if = "is_false")]
682 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
683
684 #[serde(skip_serializing_if = "Option::is_none")]
686 mysticeti_num_leaders_per_round: Option<usize>,
687
688 #[serde(skip_serializing_if = "is_false")]
690 soft_bundle: bool,
691
692 #[serde(skip_serializing_if = "is_false")]
694 enable_coin_deny_list_v2: bool,
695
696 #[serde(skip_serializing_if = "is_false")]
698 passkey_auth: bool,
699
700 #[serde(skip_serializing_if = "is_false")]
702 authority_capabilities_v2: bool,
703
704 #[serde(skip_serializing_if = "is_false")]
706 rethrow_serialization_type_layout_errors: bool,
707
708 #[serde(skip_serializing_if = "is_false")]
710 consensus_distributed_vote_scoring_strategy: bool,
711
712 #[serde(skip_serializing_if = "is_false")]
714 consensus_round_prober: bool,
715
716 #[serde(skip_serializing_if = "is_false")]
718 validate_identifier_inputs: bool,
719
720 #[serde(skip_serializing_if = "is_false")]
722 disallow_self_identifier: bool,
723
724 #[serde(skip_serializing_if = "is_false")]
726 mysticeti_fastpath: bool,
727
728 #[serde(skip_serializing_if = "is_false")]
732 disable_preconsensus_locking: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
736 relocate_event_module: bool,
737
738 #[serde(skip_serializing_if = "is_false")]
740 uncompressed_g1_group_elements: bool,
741
742 #[serde(skip_serializing_if = "is_false")]
743 disallow_new_modules_in_deps_only_packages: bool,
744
745 #[serde(skip_serializing_if = "is_false")]
747 consensus_smart_ancestor_selection: bool,
748
749 #[serde(skip_serializing_if = "is_false")]
751 consensus_round_prober_probe_accepted_rounds: bool,
752
753 #[serde(skip_serializing_if = "is_false")]
755 native_charging_v2: bool,
756
757 #[serde(skip_serializing_if = "is_false")]
760 consensus_linearize_subdag_v2: bool,
761
762 #[serde(skip_serializing_if = "is_false")]
764 convert_type_argument_error: bool,
765
766 #[serde(skip_serializing_if = "is_false")]
768 variant_nodes: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
772 consensus_zstd_compression: bool,
773
774 #[serde(skip_serializing_if = "is_false")]
776 minimize_child_object_mutations: bool,
777
778 #[serde(skip_serializing_if = "is_false")]
780 record_additional_state_digest_in_prologue: bool,
781
782 #[serde(skip_serializing_if = "is_false")]
784 move_native_context: bool,
785
786 #[serde(skip_serializing_if = "is_false")]
789 consensus_median_based_commit_timestamp: bool,
790
791 #[serde(skip_serializing_if = "is_false")]
794 normalize_ptb_arguments: bool,
795
796 #[serde(skip_serializing_if = "is_false")]
798 consensus_batched_block_sync: bool,
799
800 #[serde(skip_serializing_if = "is_false")]
802 enforce_checkpoint_timestamp_monotonicity: bool,
803
804 #[serde(skip_serializing_if = "is_false")]
806 max_ptb_value_size_v2: bool,
807
808 #[serde(skip_serializing_if = "is_false")]
810 resolve_type_input_ids_to_defining_id: bool,
811
812 #[serde(skip_serializing_if = "is_false")]
814 enable_party_transfer: bool,
815
816 #[serde(skip_serializing_if = "is_false")]
818 allow_unbounded_system_objects: bool,
819
820 #[serde(skip_serializing_if = "is_false")]
822 type_tags_in_object_runtime: bool,
823
824 #[serde(skip_serializing_if = "is_false")]
826 enable_accumulators: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
830 enable_coin_reservation_obj_refs: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
835 create_root_accumulator_object: bool,
836
837 #[serde(skip_serializing_if = "is_false")]
839 enable_authenticated_event_streams: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 enable_address_balance_gas_payments: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
847 address_balance_gas_check_rgp_at_signing: bool,
848
849 #[serde(skip_serializing_if = "is_false")]
850 address_balance_gas_reject_gas_coin_arg: bool,
851
852 #[serde(skip_serializing_if = "is_false")]
854 enable_multi_epoch_transaction_expiration: bool,
855
856 #[serde(skip_serializing_if = "is_false")]
858 relax_valid_during_for_owned_inputs: bool,
859
860 #[serde(skip_serializing_if = "is_false")]
862 enable_ptb_execution_v2: bool,
863
864 #[serde(skip_serializing_if = "is_false")]
866 better_adapter_type_resolution_errors: bool,
867
868 #[serde(skip_serializing_if = "is_false")]
870 record_time_estimate_processed: bool,
871
872 #[serde(skip_serializing_if = "is_false")]
874 dependency_linkage_error: bool,
875
876 #[serde(skip_serializing_if = "is_false")]
878 additional_multisig_checks: bool,
879
880 #[serde(skip_serializing_if = "is_false")]
882 ignore_execution_time_observations_after_certs_closed: bool,
883
884 #[serde(skip_serializing_if = "is_false")]
888 debug_fatal_on_move_invariant_violation: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
893 allow_private_accumulator_entrypoints: bool,
894
895 #[serde(skip_serializing_if = "is_false")]
897 additional_consensus_digest_indirect_state: bool,
898
899 #[serde(skip_serializing_if = "is_false")]
901 check_for_init_during_upgrade: bool,
902
903 #[serde(skip_serializing_if = "is_false")]
905 per_command_shared_object_transfer_rules: bool,
906
907 #[serde(skip_serializing_if = "is_false")]
909 include_checkpoint_artifacts_digest_in_summary: bool,
910
911 #[serde(skip_serializing_if = "is_false")]
913 use_mfp_txns_in_load_initial_object_debts: bool,
914
915 #[serde(skip_serializing_if = "is_false")]
917 cancel_for_failed_dkg_early: bool,
918
919 #[serde(skip_serializing_if = "is_false")]
921 enable_coin_registry: bool,
922
923 #[serde(skip_serializing_if = "is_false")]
925 abstract_size_in_object_runtime: bool,
926
927 #[serde(skip_serializing_if = "is_false")]
929 object_runtime_charge_cache_load_gas: bool,
930
931 #[serde(skip_serializing_if = "is_false")]
933 additional_borrow_checks: bool,
934
935 #[serde(skip_serializing_if = "is_false")]
937 use_new_commit_handler: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 better_loader_errors: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 generate_df_type_layouts: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 allow_references_in_ptbs: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 enable_display_registry: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 private_generics_verifier_v2: bool,
958
959 #[serde(skip_serializing_if = "is_false")]
961 deprecate_global_storage_ops_during_deserialization: bool,
962
963 #[serde(skip_serializing_if = "is_false")]
966 enable_non_exclusive_writes: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
970 deprecate_global_storage_ops: bool,
971
972 #[serde(skip_serializing_if = "is_false")]
974 normalize_depth_formula: bool,
975
976 #[serde(skip_serializing_if = "is_false")]
978 consensus_skip_gced_accept_votes: bool,
979
980 #[serde(skip_serializing_if = "is_false")]
982 include_cancelled_randomness_txns_in_prologue: bool,
983
984 #[serde(skip_serializing_if = "is_false")]
986 address_aliases: bool,
987
988 #[serde(skip_serializing_if = "is_false")]
991 fix_checkpoint_signature_mapping: bool,
992
993 #[serde(skip_serializing_if = "is_false")]
995 enable_object_funds_withdraw: bool,
996
997 #[serde(skip_serializing_if = "is_false")]
999 consensus_skip_gced_blocks_in_direct_finalization: bool,
1000
1001 #[serde(skip_serializing_if = "is_false")]
1003 gas_rounding_halve_digits: bool,
1004
1005 #[serde(skip_serializing_if = "is_false")]
1007 flexible_tx_context_positions: bool,
1008
1009 #[serde(skip_serializing_if = "is_false")]
1011 disable_entry_point_signature_check: bool,
1012
1013 #[serde(skip_serializing_if = "is_false")]
1015 convert_withdrawal_compatibility_ptb_arguments: bool,
1016
1017 #[serde(skip_serializing_if = "is_false")]
1019 restrict_hot_or_not_entry_functions: bool,
1020
1021 #[serde(skip_serializing_if = "is_false")]
1023 split_checkpoints_in_consensus_handler: bool,
1024
1025 #[serde(skip_serializing_if = "is_false")]
1027 consensus_always_accept_system_transactions: bool,
1028
1029 #[serde(skip_serializing_if = "is_false")]
1031 validator_metadata_verify_v2: bool,
1032
1033 #[serde(skip_serializing_if = "is_false")]
1036 defer_unpaid_amplification: bool,
1037
1038 #[serde(skip_serializing_if = "is_false")]
1039 randomize_checkpoint_tx_limit_in_tests: bool,
1040
1041 #[serde(skip_serializing_if = "is_false")]
1043 gasless_transaction_drop_safety: bool,
1044
1045 #[serde(skip_serializing_if = "is_false")]
1047 merge_randomness_into_checkpoint: bool,
1048
1049 #[serde(skip_serializing_if = "is_false")]
1051 use_coin_party_owner: bool,
1052
1053 #[serde(skip_serializing_if = "is_false")]
1054 enable_gasless: bool,
1055
1056 #[serde(skip_serializing_if = "is_false")]
1057 disallow_jump_orphans: bool,
1058
1059 #[serde(skip_serializing_if = "is_false")]
1061 early_return_receive_object_mismatched_type: bool,
1062}
1063
1064fn is_false(b: &bool) -> bool {
1065 !b
1066}
1067
1068fn is_empty(b: &BTreeSet<String>) -> bool {
1069 b.is_empty()
1070}
1071
1072fn is_zero(val: &u64) -> bool {
1073 *val == 0
1074}
1075
1076#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1078pub enum ConsensusTransactionOrdering {
1079 #[default]
1081 None,
1082 ByGasPrice,
1084}
1085
1086impl ConsensusTransactionOrdering {
1087 pub fn is_none(&self) -> bool {
1088 matches!(self, ConsensusTransactionOrdering::None)
1089 }
1090}
1091
1092#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1093pub struct ExecutionTimeEstimateParams {
1094 pub target_utilization: u64,
1096 pub allowed_txn_cost_overage_burst_limit_us: u64,
1100
1101 pub randomness_scalar: u64,
1104
1105 pub max_estimate_us: u64,
1107
1108 pub stored_observations_num_included_checkpoints: u64,
1111
1112 pub stored_observations_limit: u64,
1114
1115 #[serde(skip_serializing_if = "is_zero")]
1118 pub stake_weighted_median_threshold: u64,
1119
1120 #[serde(skip_serializing_if = "is_false")]
1124 pub default_none_duration_for_new_keys: bool,
1125
1126 #[serde(skip_serializing_if = "Option::is_none")]
1128 pub observations_chunk_size: Option<u64>,
1129}
1130
1131#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1133pub enum PerObjectCongestionControlMode {
1134 #[default]
1135 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1141
1142impl PerObjectCongestionControlMode {
1143 pub fn is_none(&self) -> bool {
1144 matches!(self, PerObjectCongestionControlMode::None)
1145 }
1146}
1147
1148#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1150pub enum ConsensusChoice {
1151 #[default]
1152 Narwhal,
1153 SwapEachEpoch,
1154 Mysticeti,
1155}
1156
1157impl ConsensusChoice {
1158 pub fn is_narwhal(&self) -> bool {
1159 matches!(self, ConsensusChoice::Narwhal)
1160 }
1161}
1162
1163#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1165pub enum ConsensusNetwork {
1166 #[default]
1167 Anemo,
1168 Tonic,
1169}
1170
1171impl ConsensusNetwork {
1172 pub fn is_anemo(&self) -> bool {
1173 matches!(self, ConsensusNetwork::Anemo)
1174 }
1175}
1176
1177#[skip_serializing_none]
1209#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1210pub struct ProtocolConfig {
1211 pub version: ProtocolVersion,
1212
1213 feature_flags: FeatureFlags,
1214
1215 max_tx_size_bytes: Option<u64>,
1218
1219 max_input_objects: Option<u64>,
1221
1222 max_size_written_objects: Option<u64>,
1226 max_size_written_objects_system_tx: Option<u64>,
1229
1230 max_serialized_tx_effects_size_bytes: Option<u64>,
1232
1233 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1235
1236 max_gas_payment_objects: Option<u32>,
1238
1239 max_modules_in_publish: Option<u32>,
1241
1242 max_package_dependencies: Option<u32>,
1244
1245 max_arguments: Option<u32>,
1248
1249 max_type_arguments: Option<u32>,
1251
1252 max_type_argument_depth: Option<u32>,
1254
1255 max_pure_argument_size: Option<u32>,
1257
1258 max_programmable_tx_commands: Option<u32>,
1260
1261 move_binary_format_version: Option<u32>,
1264 min_move_binary_format_version: Option<u32>,
1265
1266 binary_module_handles: Option<u16>,
1268 binary_struct_handles: Option<u16>,
1269 binary_function_handles: Option<u16>,
1270 binary_function_instantiations: Option<u16>,
1271 binary_signatures: Option<u16>,
1272 binary_constant_pool: Option<u16>,
1273 binary_identifiers: Option<u16>,
1274 binary_address_identifiers: Option<u16>,
1275 binary_struct_defs: Option<u16>,
1276 binary_struct_def_instantiations: Option<u16>,
1277 binary_function_defs: Option<u16>,
1278 binary_field_handles: Option<u16>,
1279 binary_field_instantiations: Option<u16>,
1280 binary_friend_decls: Option<u16>,
1281 binary_enum_defs: Option<u16>,
1282 binary_enum_def_instantiations: Option<u16>,
1283 binary_variant_handles: Option<u16>,
1284 binary_variant_instantiation_handles: Option<u16>,
1285
1286 max_move_object_size: Option<u64>,
1288
1289 max_move_package_size: Option<u64>,
1292
1293 max_publish_or_upgrade_per_ptb: Option<u64>,
1295
1296 max_tx_gas: Option<u64>,
1298
1299 max_gas_price: Option<u64>,
1301
1302 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1305
1306 max_gas_computation_bucket: Option<u64>,
1308
1309 gas_rounding_step: Option<u64>,
1311
1312 max_loop_depth: Option<u64>,
1314
1315 max_generic_instantiation_length: Option<u64>,
1317
1318 max_function_parameters: Option<u64>,
1320
1321 max_basic_blocks: Option<u64>,
1323
1324 max_value_stack_size: Option<u64>,
1326
1327 max_type_nodes: Option<u64>,
1329
1330 max_push_size: Option<u64>,
1332
1333 max_struct_definitions: Option<u64>,
1335
1336 max_function_definitions: Option<u64>,
1338
1339 max_fields_in_struct: Option<u64>,
1341
1342 max_dependency_depth: Option<u64>,
1344
1345 max_num_event_emit: Option<u64>,
1347
1348 max_num_new_move_object_ids: Option<u64>,
1350
1351 max_num_new_move_object_ids_system_tx: Option<u64>,
1353
1354 max_num_deleted_move_object_ids: Option<u64>,
1356
1357 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1359
1360 max_num_transferred_move_object_ids: Option<u64>,
1362
1363 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1365
1366 max_event_emit_size: Option<u64>,
1368
1369 max_event_emit_size_total: Option<u64>,
1371
1372 max_move_vector_len: Option<u64>,
1374
1375 max_move_identifier_len: Option<u64>,
1377
1378 max_move_value_depth: Option<u64>,
1380
1381 max_move_enum_variants: Option<u64>,
1383
1384 max_back_edges_per_function: Option<u64>,
1386
1387 max_back_edges_per_module: Option<u64>,
1389
1390 max_verifier_meter_ticks_per_function: Option<u64>,
1392
1393 max_meter_ticks_per_module: Option<u64>,
1395
1396 max_meter_ticks_per_package: Option<u64>,
1398
1399 object_runtime_max_num_cached_objects: Option<u64>,
1403
1404 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1406
1407 object_runtime_max_num_store_entries: Option<u64>,
1409
1410 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1412
1413 base_tx_cost_fixed: Option<u64>,
1416
1417 package_publish_cost_fixed: Option<u64>,
1420
1421 base_tx_cost_per_byte: Option<u64>,
1424
1425 package_publish_cost_per_byte: Option<u64>,
1427
1428 obj_access_cost_read_per_byte: Option<u64>,
1430
1431 obj_access_cost_mutate_per_byte: Option<u64>,
1433
1434 obj_access_cost_delete_per_byte: Option<u64>,
1436
1437 obj_access_cost_verify_per_byte: Option<u64>,
1447
1448 max_type_to_layout_nodes: Option<u64>,
1450
1451 max_ptb_value_size: Option<u64>,
1453
1454 gas_model_version: Option<u64>,
1457
1458 obj_data_cost_refundable: Option<u64>,
1461
1462 obj_metadata_cost_non_refundable: Option<u64>,
1466
1467 storage_rebate_rate: Option<u64>,
1473
1474 storage_fund_reinvest_rate: Option<u64>,
1477
1478 reward_slashing_rate: Option<u64>,
1481
1482 storage_gas_price: Option<u64>,
1484
1485 accumulator_object_storage_cost: Option<u64>,
1487
1488 max_transactions_per_checkpoint: Option<u64>,
1493
1494 max_checkpoint_size_bytes: Option<u64>,
1498
1499 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1504
1505 address_from_bytes_cost_base: Option<u64>,
1510 address_to_u256_cost_base: Option<u64>,
1512 address_from_u256_cost_base: Option<u64>,
1514
1515 config_read_setting_impl_cost_base: Option<u64>,
1520 config_read_setting_impl_cost_per_byte: Option<u64>,
1521
1522 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1525 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1526 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1527 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1528 dynamic_field_add_child_object_cost_base: Option<u64>,
1530 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1531 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1532 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1533 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1535 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1536 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1537 dynamic_field_remove_child_object_cost_base: Option<u64>,
1539 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1540 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1541 dynamic_field_has_child_object_cost_base: Option<u64>,
1543 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1545 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1546 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1547
1548 event_emit_cost_base: Option<u64>,
1551 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1552 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1553 event_emit_output_cost_per_byte: Option<u64>,
1554 event_emit_auth_stream_cost: Option<u64>,
1555
1556 object_borrow_uid_cost_base: Option<u64>,
1559 object_delete_impl_cost_base: Option<u64>,
1561 object_record_new_uid_cost_base: Option<u64>,
1563
1564 transfer_transfer_internal_cost_base: Option<u64>,
1567 transfer_party_transfer_internal_cost_base: Option<u64>,
1569 transfer_freeze_object_cost_base: Option<u64>,
1571 transfer_share_object_cost_base: Option<u64>,
1573 transfer_receive_object_cost_base: Option<u64>,
1576 transfer_receive_object_cost_per_byte: Option<u64>,
1577 transfer_receive_object_type_cost_per_byte: Option<u64>,
1578
1579 tx_context_derive_id_cost_base: Option<u64>,
1582 tx_context_fresh_id_cost_base: Option<u64>,
1583 tx_context_sender_cost_base: Option<u64>,
1584 tx_context_epoch_cost_base: Option<u64>,
1585 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1586 tx_context_sponsor_cost_base: Option<u64>,
1587 tx_context_rgp_cost_base: Option<u64>,
1588 tx_context_gas_price_cost_base: Option<u64>,
1589 tx_context_gas_budget_cost_base: Option<u64>,
1590 tx_context_ids_created_cost_base: Option<u64>,
1591 tx_context_replace_cost_base: Option<u64>,
1592
1593 types_is_one_time_witness_cost_base: Option<u64>,
1596 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1597 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1598
1599 validator_validate_metadata_cost_base: Option<u64>,
1602 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1603
1604 crypto_invalid_arguments_cost: Option<u64>,
1606 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1608 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1609 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1610
1611 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1613 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1614 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1615
1616 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1618 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1619 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1620 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1621 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1622 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1623
1624 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1626
1627 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1629 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1630 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1631 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1632 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1633 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1634
1635 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1637 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1638 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1639 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1640 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1641 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1642
1643 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1645 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1646 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1647 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1648 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1649 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1650
1651 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1653 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1654 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1655
1656 ed25519_ed25519_verify_cost_base: Option<u64>,
1658 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1659 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1660
1661 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1663 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1664
1665 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1667 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1668 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1669 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1670 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1671
1672 hash_blake2b256_cost_base: Option<u64>,
1674 hash_blake2b256_data_cost_per_byte: Option<u64>,
1675 hash_blake2b256_data_cost_per_block: Option<u64>,
1676
1677 hash_keccak256_cost_base: Option<u64>,
1679 hash_keccak256_data_cost_per_byte: Option<u64>,
1680 hash_keccak256_data_cost_per_block: Option<u64>,
1681
1682 poseidon_bn254_cost_base: Option<u64>,
1684 poseidon_bn254_cost_per_block: Option<u64>,
1685
1686 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1688 group_ops_bls12381_decode_g1_cost: Option<u64>,
1689 group_ops_bls12381_decode_g2_cost: Option<u64>,
1690 group_ops_bls12381_decode_gt_cost: Option<u64>,
1691 group_ops_bls12381_scalar_add_cost: Option<u64>,
1692 group_ops_bls12381_g1_add_cost: Option<u64>,
1693 group_ops_bls12381_g2_add_cost: Option<u64>,
1694 group_ops_bls12381_gt_add_cost: Option<u64>,
1695 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1696 group_ops_bls12381_g1_sub_cost: Option<u64>,
1697 group_ops_bls12381_g2_sub_cost: Option<u64>,
1698 group_ops_bls12381_gt_sub_cost: Option<u64>,
1699 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1700 group_ops_bls12381_g1_mul_cost: Option<u64>,
1701 group_ops_bls12381_g2_mul_cost: Option<u64>,
1702 group_ops_bls12381_gt_mul_cost: Option<u64>,
1703 group_ops_bls12381_scalar_div_cost: Option<u64>,
1704 group_ops_bls12381_g1_div_cost: Option<u64>,
1705 group_ops_bls12381_g2_div_cost: Option<u64>,
1706 group_ops_bls12381_gt_div_cost: Option<u64>,
1707 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1708 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1709 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1710 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1711 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1712 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1713 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1714 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1715 group_ops_bls12381_msm_max_len: Option<u32>,
1716 group_ops_bls12381_pairing_cost: Option<u64>,
1717 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1718 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1719 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1720 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1721 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1722
1723 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1724 group_ops_ristretto_decode_point_cost: Option<u64>,
1725 group_ops_ristretto_scalar_add_cost: Option<u64>,
1726 group_ops_ristretto_point_add_cost: Option<u64>,
1727 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1728 group_ops_ristretto_point_sub_cost: Option<u64>,
1729 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1730 group_ops_ristretto_point_mul_cost: Option<u64>,
1731 group_ops_ristretto_scalar_div_cost: Option<u64>,
1732 group_ops_ristretto_point_div_cost: Option<u64>,
1733
1734 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
1735 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
1736
1737 hmac_hmac_sha3_256_cost_base: Option<u64>,
1739 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1740 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1741
1742 check_zklogin_id_cost_base: Option<u64>,
1744 check_zklogin_issuer_cost_base: Option<u64>,
1746
1747 vdf_verify_vdf_cost: Option<u64>,
1748 vdf_hash_to_input_cost: Option<u64>,
1749
1750 nitro_attestation_parse_base_cost: Option<u64>,
1752 nitro_attestation_parse_cost_per_byte: Option<u64>,
1753 nitro_attestation_verify_base_cost: Option<u64>,
1754 nitro_attestation_verify_cost_per_cert: Option<u64>,
1755
1756 bcs_per_byte_serialized_cost: Option<u64>,
1758 bcs_legacy_min_output_size_cost: Option<u64>,
1759 bcs_failure_cost: Option<u64>,
1760
1761 hash_sha2_256_base_cost: Option<u64>,
1762 hash_sha2_256_per_byte_cost: Option<u64>,
1763 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1764 hash_sha3_256_base_cost: Option<u64>,
1765 hash_sha3_256_per_byte_cost: Option<u64>,
1766 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1767 type_name_get_base_cost: Option<u64>,
1768 type_name_get_per_byte_cost: Option<u64>,
1769 type_name_id_base_cost: Option<u64>,
1770
1771 string_check_utf8_base_cost: Option<u64>,
1772 string_check_utf8_per_byte_cost: Option<u64>,
1773 string_is_char_boundary_base_cost: Option<u64>,
1774 string_sub_string_base_cost: Option<u64>,
1775 string_sub_string_per_byte_cost: Option<u64>,
1776 string_index_of_base_cost: Option<u64>,
1777 string_index_of_per_byte_pattern_cost: Option<u64>,
1778 string_index_of_per_byte_searched_cost: Option<u64>,
1779
1780 vector_empty_base_cost: Option<u64>,
1781 vector_length_base_cost: Option<u64>,
1782 vector_push_back_base_cost: Option<u64>,
1783 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1784 vector_borrow_base_cost: Option<u64>,
1785 vector_pop_back_base_cost: Option<u64>,
1786 vector_destroy_empty_base_cost: Option<u64>,
1787 vector_swap_base_cost: Option<u64>,
1788 debug_print_base_cost: Option<u64>,
1789 debug_print_stack_trace_base_cost: Option<u64>,
1790
1791 execution_version: Option<u64>,
1800
1801 consensus_bad_nodes_stake_threshold: Option<u64>,
1805
1806 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1807 max_age_of_jwk_in_epochs: Option<u64>,
1811
1812 random_beacon_reduction_allowed_delta: Option<u16>,
1816
1817 random_beacon_reduction_lower_bound: Option<u32>,
1820
1821 random_beacon_dkg_timeout_round: Option<u32>,
1824
1825 random_beacon_min_round_interval_ms: Option<u64>,
1827
1828 random_beacon_dkg_version: Option<u64>,
1831
1832 consensus_max_transaction_size_bytes: Option<u64>,
1835 consensus_max_transactions_in_block_bytes: Option<u64>,
1837 consensus_max_num_transactions_in_block: Option<u64>,
1839
1840 consensus_voting_rounds: Option<u32>,
1842
1843 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1845
1846 max_deferral_rounds_for_congestion_control: Option<u64>,
1849
1850 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1852
1853 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1855
1856 min_checkpoint_interval_ms: Option<u64>,
1858
1859 checkpoint_summary_version_specific_data: Option<u64>,
1861
1862 max_soft_bundle_size: Option<u64>,
1864
1865 bridge_should_try_to_finalize_committee: Option<bool>,
1869
1870 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1876
1877 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1880
1881 consensus_gc_depth: Option<u32>,
1884
1885 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1887
1888 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1890
1891 sip_45_consensus_amplification_threshold: Option<u64>,
1894
1895 use_object_per_epoch_marker_table_v2: Option<bool>,
1898
1899 consensus_commit_rate_estimation_window_size: Option<u32>,
1901
1902 #[serde(skip_serializing_if = "Vec::is_empty")]
1906 aliased_addresses: Vec<AliasedAddress>,
1907
1908 translation_per_command_base_charge: Option<u64>,
1911
1912 translation_per_input_base_charge: Option<u64>,
1915
1916 translation_pure_input_per_byte_charge: Option<u64>,
1918
1919 translation_per_type_node_charge: Option<u64>,
1923
1924 translation_per_reference_node_charge: Option<u64>,
1927
1928 translation_per_linkage_entry_charge: Option<u64>,
1931
1932 max_updates_per_settlement_txn: Option<u32>,
1934
1935 gasless_max_computation_units: Option<u64>,
1937
1938 #[skip_accessor]
1940 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1941
1942 gasless_max_unused_inputs: Option<u64>,
1946
1947 gasless_max_pure_input_bytes: Option<u64>,
1950
1951 gasless_max_tps: Option<u64>,
1953}
1954
1955#[derive(Clone, Serialize, Deserialize, Debug)]
1957pub struct AliasedAddress {
1958 pub original: [u8; 32],
1960 pub aliased: [u8; 32],
1962 pub allowed_tx_digests: Vec<[u8; 32]>,
1964}
1965
1966impl ProtocolConfig {
1968 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1981 if self.feature_flags.package_upgrades {
1982 Ok(())
1983 } else {
1984 Err(Error(format!(
1985 "package upgrades are not supported at {:?}",
1986 self.version
1987 )))
1988 }
1989 }
1990
1991 pub fn allow_receiving_object_id(&self) -> bool {
1992 self.feature_flags.allow_receiving_object_id
1993 }
1994
1995 pub fn receiving_objects_supported(&self) -> bool {
1996 self.feature_flags.receive_objects
1997 }
1998
1999 pub fn package_upgrades_supported(&self) -> bool {
2000 self.feature_flags.package_upgrades
2001 }
2002
2003 pub fn check_commit_root_state_digest_supported(&self) -> bool {
2004 self.feature_flags.commit_root_state_digest
2005 }
2006
2007 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
2008 self.feature_flags.advance_epoch_start_time_in_safe_mode
2009 }
2010
2011 pub fn loaded_child_objects_fixed(&self) -> bool {
2012 self.feature_flags.loaded_child_objects_fixed
2013 }
2014
2015 pub fn missing_type_is_compatibility_error(&self) -> bool {
2016 self.feature_flags.missing_type_is_compatibility_error
2017 }
2018
2019 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
2020 self.feature_flags.scoring_decision_with_validity_cutoff
2021 }
2022
2023 pub fn narwhal_versioned_metadata(&self) -> bool {
2024 self.feature_flags.narwhal_versioned_metadata
2025 }
2026
2027 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2028 self.feature_flags.consensus_order_end_of_epoch_last
2029 }
2030
2031 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2032 self.feature_flags.disallow_adding_abilities_on_upgrade
2033 }
2034
2035 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2036 self.feature_flags
2037 .disable_invariant_violation_check_in_swap_loc
2038 }
2039
2040 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2041 self.feature_flags
2042 .advance_to_highest_supported_protocol_version
2043 }
2044
2045 pub fn ban_entry_init(&self) -> bool {
2046 self.feature_flags.ban_entry_init
2047 }
2048
2049 pub fn package_digest_hash_module(&self) -> bool {
2050 self.feature_flags.package_digest_hash_module
2051 }
2052
2053 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2054 self.feature_flags
2055 .disallow_change_struct_type_params_on_upgrade
2056 }
2057
2058 pub fn no_extraneous_module_bytes(&self) -> bool {
2059 self.feature_flags.no_extraneous_module_bytes
2060 }
2061
2062 pub fn zklogin_auth(&self) -> bool {
2063 self.feature_flags.zklogin_auth
2064 }
2065
2066 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2067 &self.feature_flags.zklogin_supported_providers
2068 }
2069
2070 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2071 self.feature_flags.consensus_transaction_ordering
2072 }
2073
2074 pub fn simplified_unwrap_then_delete(&self) -> bool {
2075 self.feature_flags.simplified_unwrap_then_delete
2076 }
2077
2078 pub fn supports_upgraded_multisig(&self) -> bool {
2079 self.feature_flags.upgraded_multisig_supported
2080 }
2081
2082 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2083 self.feature_flags.txn_base_cost_as_multiplier
2084 }
2085
2086 pub fn shared_object_deletion(&self) -> bool {
2087 self.feature_flags.shared_object_deletion
2088 }
2089
2090 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2091 self.feature_flags.narwhal_new_leader_election_schedule
2092 }
2093
2094 pub fn loaded_child_object_format(&self) -> bool {
2095 self.feature_flags.loaded_child_object_format
2096 }
2097
2098 pub fn enable_jwk_consensus_updates(&self) -> bool {
2099 let ret = self.feature_flags.enable_jwk_consensus_updates;
2100 if ret {
2101 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2103 }
2104 ret
2105 }
2106
2107 pub fn simple_conservation_checks(&self) -> bool {
2108 self.feature_flags.simple_conservation_checks
2109 }
2110
2111 pub fn loaded_child_object_format_type(&self) -> bool {
2112 self.feature_flags.loaded_child_object_format_type
2113 }
2114
2115 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2116 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2117 if !ret {
2118 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2120 }
2121 ret
2122 }
2123
2124 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2125 self.feature_flags
2126 .recompute_has_public_transfer_in_execution
2127 }
2128
2129 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2131 self.enable_jwk_consensus_updates()
2132 }
2133
2134 pub fn random_beacon(&self) -> bool {
2135 self.feature_flags.random_beacon
2136 }
2137
2138 pub fn dkg_version(&self) -> u64 {
2139 self.random_beacon_dkg_version.unwrap_or(1)
2141 }
2142
2143 pub fn enable_bridge(&self) -> bool {
2144 let ret = self.feature_flags.bridge;
2145 if ret {
2146 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2148 }
2149 ret
2150 }
2151
2152 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2153 if !self.enable_bridge() {
2154 return false;
2155 }
2156 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2158 }
2159
2160 pub fn enable_effects_v2(&self) -> bool {
2161 self.feature_flags.enable_effects_v2
2162 }
2163
2164 pub fn narwhal_certificate_v2(&self) -> bool {
2165 self.feature_flags.narwhal_certificate_v2
2166 }
2167
2168 pub fn verify_legacy_zklogin_address(&self) -> bool {
2169 self.feature_flags.verify_legacy_zklogin_address
2170 }
2171
2172 pub fn accept_zklogin_in_multisig(&self) -> bool {
2173 self.feature_flags.accept_zklogin_in_multisig
2174 }
2175
2176 pub fn accept_passkey_in_multisig(&self) -> bool {
2177 self.feature_flags.accept_passkey_in_multisig
2178 }
2179
2180 pub fn validate_zklogin_public_identifier(&self) -> bool {
2181 self.feature_flags.validate_zklogin_public_identifier
2182 }
2183
2184 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2185 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2186 }
2187
2188 pub fn throughput_aware_consensus_submission(&self) -> bool {
2189 self.feature_flags.throughput_aware_consensus_submission
2190 }
2191
2192 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2193 self.feature_flags.include_consensus_digest_in_prologue
2194 }
2195
2196 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2197 self.feature_flags
2198 .record_consensus_determined_version_assignments_in_prologue
2199 }
2200
2201 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2202 self.feature_flags
2203 .record_additional_state_digest_in_prologue
2204 }
2205
2206 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2207 self.feature_flags
2208 .record_consensus_determined_version_assignments_in_prologue_v2
2209 }
2210
2211 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2212 self.feature_flags
2213 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2214 }
2215
2216 pub fn hardened_otw_check(&self) -> bool {
2217 self.feature_flags.hardened_otw_check
2218 }
2219
2220 pub fn enable_poseidon(&self) -> bool {
2221 self.feature_flags.enable_poseidon
2222 }
2223
2224 pub fn enable_coin_deny_list_v1(&self) -> bool {
2225 self.feature_flags.enable_coin_deny_list
2226 }
2227
2228 pub fn enable_accumulators(&self) -> bool {
2229 self.feature_flags.enable_accumulators
2230 }
2231
2232 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2233 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2234 }
2235
2236 pub fn create_root_accumulator_object(&self) -> bool {
2237 self.feature_flags.create_root_accumulator_object
2238 }
2239
2240 pub fn enable_address_balance_gas_payments(&self) -> bool {
2241 self.feature_flags.enable_address_balance_gas_payments
2242 }
2243
2244 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2245 self.feature_flags.address_balance_gas_check_rgp_at_signing
2246 }
2247
2248 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2249 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2250 }
2251
2252 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2253 self.feature_flags.enable_multi_epoch_transaction_expiration
2254 }
2255
2256 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2257 self.feature_flags.relax_valid_during_for_owned_inputs
2258 }
2259
2260 pub fn enable_authenticated_event_streams(&self) -> bool {
2261 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2262 }
2263
2264 pub fn enable_non_exclusive_writes(&self) -> bool {
2265 self.feature_flags.enable_non_exclusive_writes
2266 }
2267
2268 pub fn enable_coin_registry(&self) -> bool {
2269 self.feature_flags.enable_coin_registry
2270 }
2271
2272 pub fn enable_display_registry(&self) -> bool {
2273 self.feature_flags.enable_display_registry
2274 }
2275
2276 pub fn enable_coin_deny_list_v2(&self) -> bool {
2277 self.feature_flags.enable_coin_deny_list_v2
2278 }
2279
2280 pub fn enable_group_ops_native_functions(&self) -> bool {
2281 self.feature_flags.enable_group_ops_native_functions
2282 }
2283
2284 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2285 self.feature_flags.enable_group_ops_native_function_msm
2286 }
2287
2288 pub fn enable_ristretto255_group_ops(&self) -> bool {
2289 self.feature_flags.enable_ristretto255_group_ops
2290 }
2291
2292 pub fn enable_verify_bulletproofs_ristretto255(&self) -> bool {
2293 self.feature_flags.enable_verify_bulletproofs_ristretto255
2294 }
2295
2296 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2297 self.feature_flags.reject_mutable_random_on_entry_functions
2298 }
2299
2300 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2301 self.feature_flags.per_object_congestion_control_mode
2302 }
2303
2304 pub fn consensus_choice(&self) -> ConsensusChoice {
2305 self.feature_flags.consensus_choice
2306 }
2307
2308 pub fn consensus_network(&self) -> ConsensusNetwork {
2309 self.feature_flags.consensus_network
2310 }
2311
2312 pub fn correct_gas_payment_limit_check(&self) -> bool {
2313 self.feature_flags.correct_gas_payment_limit_check
2314 }
2315
2316 pub fn reshare_at_same_initial_version(&self) -> bool {
2317 self.feature_flags.reshare_at_same_initial_version
2318 }
2319
2320 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2321 self.feature_flags.resolve_abort_locations_to_package_id
2322 }
2323
2324 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2325 self.feature_flags.mysticeti_use_committed_subdag_digest
2326 }
2327
2328 pub fn enable_vdf(&self) -> bool {
2329 self.feature_flags.enable_vdf
2330 }
2331
2332 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2333 self.feature_flags.fresh_vm_on_framework_upgrade
2334 }
2335
2336 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2337 self.feature_flags.mysticeti_num_leaders_per_round
2338 }
2339
2340 pub fn soft_bundle(&self) -> bool {
2341 self.feature_flags.soft_bundle
2342 }
2343
2344 pub fn passkey_auth(&self) -> bool {
2345 self.feature_flags.passkey_auth
2346 }
2347
2348 pub fn authority_capabilities_v2(&self) -> bool {
2349 self.feature_flags.authority_capabilities_v2
2350 }
2351
2352 pub fn max_transaction_size_bytes(&self) -> u64 {
2353 self.consensus_max_transaction_size_bytes
2355 .unwrap_or(256 * 1024)
2356 }
2357
2358 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2359 if cfg!(msim) {
2360 256 * 1024
2361 } else {
2362 self.consensus_max_transactions_in_block_bytes
2363 .unwrap_or(512 * 1024)
2364 }
2365 }
2366
2367 pub fn max_num_transactions_in_block(&self) -> u64 {
2368 if cfg!(msim) {
2369 8
2370 } else {
2371 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2372 }
2373 }
2374
2375 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2376 self.feature_flags.rethrow_serialization_type_layout_errors
2377 }
2378
2379 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2380 self.feature_flags
2381 .consensus_distributed_vote_scoring_strategy
2382 }
2383
2384 pub fn consensus_round_prober(&self) -> bool {
2385 self.feature_flags.consensus_round_prober
2386 }
2387
2388 pub fn validate_identifier_inputs(&self) -> bool {
2389 self.feature_flags.validate_identifier_inputs
2390 }
2391
2392 pub fn gc_depth(&self) -> u32 {
2393 self.consensus_gc_depth.unwrap_or(0)
2394 }
2395
2396 pub fn mysticeti_fastpath(&self) -> bool {
2397 self.feature_flags.mysticeti_fastpath
2398 }
2399
2400 pub fn relocate_event_module(&self) -> bool {
2401 self.feature_flags.relocate_event_module
2402 }
2403
2404 pub fn uncompressed_g1_group_elements(&self) -> bool {
2405 self.feature_flags.uncompressed_g1_group_elements
2406 }
2407
2408 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2409 self.feature_flags
2410 .disallow_new_modules_in_deps_only_packages
2411 }
2412
2413 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2414 self.feature_flags.consensus_smart_ancestor_selection
2415 }
2416
2417 pub fn disable_preconsensus_locking(&self) -> bool {
2418 self.feature_flags.disable_preconsensus_locking
2419 }
2420
2421 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2422 self.feature_flags
2423 .consensus_round_prober_probe_accepted_rounds
2424 }
2425
2426 pub fn native_charging_v2(&self) -> bool {
2427 self.feature_flags.native_charging_v2
2428 }
2429
2430 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2431 let res = self.feature_flags.consensus_linearize_subdag_v2;
2432 assert!(
2433 !res || self.gc_depth() > 0,
2434 "The consensus linearize sub dag V2 requires GC to be enabled"
2435 );
2436 res
2437 }
2438
2439 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2440 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2441 assert!(
2442 !res || self.gc_depth() > 0,
2443 "The consensus median based commit timestamp requires GC to be enabled"
2444 );
2445 res
2446 }
2447
2448 pub fn consensus_batched_block_sync(&self) -> bool {
2449 self.feature_flags.consensus_batched_block_sync
2450 }
2451
2452 pub fn convert_type_argument_error(&self) -> bool {
2453 self.feature_flags.convert_type_argument_error
2454 }
2455
2456 pub fn variant_nodes(&self) -> bool {
2457 self.feature_flags.variant_nodes
2458 }
2459
2460 pub fn consensus_zstd_compression(&self) -> bool {
2461 self.feature_flags.consensus_zstd_compression
2462 }
2463
2464 pub fn enable_nitro_attestation(&self) -> bool {
2465 self.feature_flags.enable_nitro_attestation
2466 }
2467
2468 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2469 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2470 }
2471
2472 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2473 self.feature_flags
2474 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2475 }
2476
2477 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2478 self.feature_flags
2479 .enable_nitro_attestation_always_include_required_pcrs_parsing
2480 }
2481
2482 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2483 self.consensus_commit_rate_estimation_window_size
2484 .unwrap_or(0)
2485 }
2486
2487 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2488 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2492 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2494 window_size
2495 }
2496
2497 pub fn minimize_child_object_mutations(&self) -> bool {
2498 self.feature_flags.minimize_child_object_mutations
2499 }
2500
2501 pub fn move_native_context(&self) -> bool {
2502 self.feature_flags.move_native_context
2503 }
2504
2505 pub fn normalize_ptb_arguments(&self) -> bool {
2506 self.feature_flags.normalize_ptb_arguments
2507 }
2508
2509 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2510 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2511 }
2512
2513 pub fn max_ptb_value_size_v2(&self) -> bool {
2514 self.feature_flags.max_ptb_value_size_v2
2515 }
2516
2517 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2518 self.feature_flags.resolve_type_input_ids_to_defining_id
2519 }
2520
2521 pub fn enable_party_transfer(&self) -> bool {
2522 self.feature_flags.enable_party_transfer
2523 }
2524
2525 pub fn allow_unbounded_system_objects(&self) -> bool {
2526 self.feature_flags.allow_unbounded_system_objects
2527 }
2528
2529 pub fn type_tags_in_object_runtime(&self) -> bool {
2530 self.feature_flags.type_tags_in_object_runtime
2531 }
2532
2533 pub fn enable_ptb_execution_v2(&self) -> bool {
2534 self.feature_flags.enable_ptb_execution_v2
2535 }
2536
2537 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2538 self.feature_flags.better_adapter_type_resolution_errors
2539 }
2540
2541 pub fn record_time_estimate_processed(&self) -> bool {
2542 self.feature_flags.record_time_estimate_processed
2543 }
2544
2545 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2546 self.feature_flags
2547 .ignore_execution_time_observations_after_certs_closed
2548 }
2549
2550 pub fn dependency_linkage_error(&self) -> bool {
2551 self.feature_flags.dependency_linkage_error
2552 }
2553
2554 pub fn additional_multisig_checks(&self) -> bool {
2555 self.feature_flags.additional_multisig_checks
2556 }
2557
2558 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2559 self.feature_flags.debug_fatal_on_move_invariant_violation
2560 }
2561
2562 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2563 self.feature_flags.allow_private_accumulator_entrypoints
2564 }
2565
2566 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2567 self.feature_flags
2568 .additional_consensus_digest_indirect_state
2569 }
2570
2571 pub fn check_for_init_during_upgrade(&self) -> bool {
2572 self.feature_flags.check_for_init_during_upgrade
2573 }
2574
2575 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2576 self.feature_flags.per_command_shared_object_transfer_rules
2577 }
2578
2579 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2580 self.feature_flags
2581 .consensus_checkpoint_signature_key_includes_digest
2582 }
2583
2584 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2585 self.feature_flags
2586 .include_checkpoint_artifacts_digest_in_summary
2587 }
2588
2589 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2590 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2591 }
2592
2593 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2594 self.feature_flags.cancel_for_failed_dkg_early
2595 }
2596
2597 pub fn abstract_size_in_object_runtime(&self) -> bool {
2598 self.feature_flags.abstract_size_in_object_runtime
2599 }
2600
2601 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2602 self.feature_flags.object_runtime_charge_cache_load_gas
2603 }
2604
2605 pub fn additional_borrow_checks(&self) -> bool {
2606 self.feature_flags.additional_borrow_checks
2607 }
2608
2609 pub fn use_new_commit_handler(&self) -> bool {
2610 self.feature_flags.use_new_commit_handler
2611 }
2612
2613 pub fn better_loader_errors(&self) -> bool {
2614 self.feature_flags.better_loader_errors
2615 }
2616
2617 pub fn generate_df_type_layouts(&self) -> bool {
2618 self.feature_flags.generate_df_type_layouts
2619 }
2620
2621 pub fn allow_references_in_ptbs(&self) -> bool {
2622 self.feature_flags.allow_references_in_ptbs
2623 }
2624
2625 pub fn private_generics_verifier_v2(&self) -> bool {
2626 self.feature_flags.private_generics_verifier_v2
2627 }
2628
2629 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2630 self.feature_flags
2631 .deprecate_global_storage_ops_during_deserialization
2632 }
2633
2634 pub fn enable_observation_chunking(&self) -> bool {
2635 matches!(self.feature_flags.per_object_congestion_control_mode,
2636 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2637 if params.observations_chunk_size.is_some()
2638 )
2639 }
2640
2641 pub fn deprecate_global_storage_ops(&self) -> bool {
2642 self.feature_flags.deprecate_global_storage_ops
2643 }
2644
2645 pub fn normalize_depth_formula(&self) -> bool {
2646 self.feature_flags.normalize_depth_formula
2647 }
2648
2649 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2650 self.feature_flags.consensus_skip_gced_accept_votes
2651 }
2652
2653 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2654 self.feature_flags
2655 .include_cancelled_randomness_txns_in_prologue
2656 }
2657
2658 pub fn address_aliases(&self) -> bool {
2659 let address_aliases = self.feature_flags.address_aliases;
2660 assert!(
2661 !address_aliases || self.mysticeti_fastpath(),
2662 "Address aliases requires Mysticeti fastpath to be enabled"
2663 );
2664 if address_aliases {
2665 assert!(
2666 self.feature_flags.disable_preconsensus_locking,
2667 "Address aliases requires CertifiedTransaction to be disabled"
2668 );
2669 }
2670 address_aliases
2671 }
2672
2673 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2674 self.feature_flags.fix_checkpoint_signature_mapping
2675 }
2676
2677 pub fn enable_object_funds_withdraw(&self) -> bool {
2678 self.feature_flags.enable_object_funds_withdraw
2679 }
2680
2681 pub fn gas_rounding_halve_digits(&self) -> bool {
2682 self.feature_flags.gas_rounding_halve_digits
2683 }
2684
2685 pub fn flexible_tx_context_positions(&self) -> bool {
2686 self.feature_flags.flexible_tx_context_positions
2687 }
2688
2689 pub fn disable_entry_point_signature_check(&self) -> bool {
2690 self.feature_flags.disable_entry_point_signature_check
2691 }
2692
2693 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2694 self.feature_flags
2695 .consensus_skip_gced_blocks_in_direct_finalization
2696 }
2697
2698 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2699 self.feature_flags
2700 .convert_withdrawal_compatibility_ptb_arguments
2701 }
2702
2703 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2704 self.feature_flags.restrict_hot_or_not_entry_functions
2705 }
2706
2707 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2708 self.feature_flags.split_checkpoints_in_consensus_handler
2709 }
2710
2711 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2712 self.feature_flags
2713 .consensus_always_accept_system_transactions
2714 }
2715
2716 pub fn validator_metadata_verify_v2(&self) -> bool {
2717 self.feature_flags.validator_metadata_verify_v2
2718 }
2719
2720 pub fn defer_unpaid_amplification(&self) -> bool {
2721 self.feature_flags.defer_unpaid_amplification
2722 }
2723
2724 pub fn gasless_transaction_drop_safety(&self) -> bool {
2725 self.feature_flags.gasless_transaction_drop_safety
2726 }
2727
2728 pub fn new_vm_enabled(&self) -> bool {
2729 self.execution_version.is_some_and(|v| v >= 4)
2730 }
2731
2732 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2733 self.feature_flags.merge_randomness_into_checkpoint
2734 }
2735
2736 pub fn use_coin_party_owner(&self) -> bool {
2737 self.feature_flags.use_coin_party_owner
2738 }
2739
2740 pub fn enable_gasless(&self) -> bool {
2741 self.feature_flags.enable_gasless
2742 }
2743
2744 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2745 debug_assert!(self.gasless_allowed_token_types.is_some());
2746 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2747 }
2748
2749 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2750 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2751 }
2752
2753 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2754 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2755 }
2756
2757 pub fn disallow_jump_orphans(&self) -> bool {
2758 self.feature_flags.disallow_jump_orphans
2759 }
2760
2761 pub fn early_return_receive_object_mismatched_type(&self) -> bool {
2762 self.feature_flags
2763 .early_return_receive_object_mismatched_type
2764 }
2765}
2766
2767#[cfg(not(msim))]
2768static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2769
2770#[cfg(msim)]
2772thread_local! {
2773 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2774}
2775
2776impl ProtocolConfig {
2778 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2780 assert!(
2782 version >= ProtocolVersion::MIN,
2783 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2784 version,
2785 ProtocolVersion::MIN.0,
2786 );
2787 assert!(
2788 version <= ProtocolVersion::MAX_ALLOWED,
2789 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2790 version,
2791 ProtocolVersion::MAX_ALLOWED.0,
2792 );
2793
2794 let mut ret = Self::get_for_version_impl(version, chain);
2795 ret.version = version;
2796
2797 ret = Self::apply_config_override(version, ret);
2798
2799 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2800 warn!(
2801 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2802 );
2803 let overrides: ProtocolConfigOptional =
2804 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2805 .expect("failed to parse ProtocolConfig override env variables");
2806 overrides.apply_to(&mut ret);
2807 }
2808
2809 ret
2810 }
2811
2812 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2815 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2816 let mut ret = Self::get_for_version_impl(version, chain);
2817 ret.version = version;
2818 ret = Self::apply_config_override(version, ret);
2819 Some(ret)
2820 } else {
2821 None
2822 }
2823 }
2824
2825 #[cfg(not(msim))]
2826 pub fn poison_get_for_min_version() {
2827 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2828 }
2829
2830 #[cfg(not(msim))]
2831 fn load_poison_get_for_min_version() -> bool {
2832 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2833 }
2834
2835 #[cfg(msim)]
2836 pub fn poison_get_for_min_version() {
2837 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2838 }
2839
2840 #[cfg(msim)]
2841 fn load_poison_get_for_min_version() -> bool {
2842 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2843 }
2844
2845 pub fn get_for_min_version() -> Self {
2848 if Self::load_poison_get_for_min_version() {
2849 panic!("get_for_min_version called on validator");
2850 }
2851 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2852 }
2853
2854 #[allow(non_snake_case)]
2864 pub fn get_for_max_version_UNSAFE() -> Self {
2865 if Self::load_poison_get_for_min_version() {
2866 panic!("get_for_max_version_UNSAFE called on validator");
2867 }
2868 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2869 }
2870
2871 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2872 #[cfg(msim)]
2873 {
2874 if version == ProtocolVersion::MAX_ALLOWED {
2876 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2877 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2878 return config;
2879 }
2880 }
2881
2882 let mut cfg = Self {
2885 version,
2887
2888 feature_flags: Default::default(),
2890
2891 max_tx_size_bytes: Some(128 * 1024),
2892 max_input_objects: Some(2048),
2894 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2895 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2896 max_gas_payment_objects: Some(256),
2897 max_modules_in_publish: Some(128),
2898 max_package_dependencies: None,
2899 max_arguments: Some(512),
2900 max_type_arguments: Some(16),
2901 max_type_argument_depth: Some(16),
2902 max_pure_argument_size: Some(16 * 1024),
2903 max_programmable_tx_commands: Some(1024),
2904 move_binary_format_version: Some(6),
2905 min_move_binary_format_version: None,
2906 binary_module_handles: None,
2907 binary_struct_handles: None,
2908 binary_function_handles: None,
2909 binary_function_instantiations: None,
2910 binary_signatures: None,
2911 binary_constant_pool: None,
2912 binary_identifiers: None,
2913 binary_address_identifiers: None,
2914 binary_struct_defs: None,
2915 binary_struct_def_instantiations: None,
2916 binary_function_defs: None,
2917 binary_field_handles: None,
2918 binary_field_instantiations: None,
2919 binary_friend_decls: None,
2920 binary_enum_defs: None,
2921 binary_enum_def_instantiations: None,
2922 binary_variant_handles: None,
2923 binary_variant_instantiation_handles: None,
2924 max_move_object_size: Some(250 * 1024),
2925 max_move_package_size: Some(100 * 1024),
2926 max_publish_or_upgrade_per_ptb: None,
2927 max_tx_gas: Some(10_000_000_000),
2928 max_gas_price: Some(100_000),
2929 max_gas_price_rgp_factor_for_aborted_transactions: None,
2930 max_gas_computation_bucket: Some(5_000_000),
2931 max_loop_depth: Some(5),
2932 max_generic_instantiation_length: Some(32),
2933 max_function_parameters: Some(128),
2934 max_basic_blocks: Some(1024),
2935 max_value_stack_size: Some(1024),
2936 max_type_nodes: Some(256),
2937 max_push_size: Some(10000),
2938 max_struct_definitions: Some(200),
2939 max_function_definitions: Some(1000),
2940 max_fields_in_struct: Some(32),
2941 max_dependency_depth: Some(100),
2942 max_num_event_emit: Some(256),
2943 max_num_new_move_object_ids: Some(2048),
2944 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2945 max_num_deleted_move_object_ids: Some(2048),
2946 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2947 max_num_transferred_move_object_ids: Some(2048),
2948 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2949 max_event_emit_size: Some(250 * 1024),
2950 max_move_vector_len: Some(256 * 1024),
2951 max_type_to_layout_nodes: None,
2952 max_ptb_value_size: None,
2953
2954 max_back_edges_per_function: Some(10_000),
2955 max_back_edges_per_module: Some(10_000),
2956 max_verifier_meter_ticks_per_function: Some(6_000_000),
2957 max_meter_ticks_per_module: Some(6_000_000),
2958 max_meter_ticks_per_package: None,
2959
2960 object_runtime_max_num_cached_objects: Some(1000),
2961 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2962 object_runtime_max_num_store_entries: Some(1000),
2963 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2964 base_tx_cost_fixed: Some(110_000),
2965 package_publish_cost_fixed: Some(1_000),
2966 base_tx_cost_per_byte: Some(0),
2967 package_publish_cost_per_byte: Some(80),
2968 obj_access_cost_read_per_byte: Some(15),
2969 obj_access_cost_mutate_per_byte: Some(40),
2970 obj_access_cost_delete_per_byte: Some(40),
2971 obj_access_cost_verify_per_byte: Some(200),
2972 obj_data_cost_refundable: Some(100),
2973 obj_metadata_cost_non_refundable: Some(50),
2974 gas_model_version: Some(1),
2975 storage_rebate_rate: Some(9900),
2976 storage_fund_reinvest_rate: Some(500),
2977 reward_slashing_rate: Some(5000),
2978 storage_gas_price: Some(1),
2979 accumulator_object_storage_cost: None,
2980 max_transactions_per_checkpoint: Some(10_000),
2981 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2982
2983 buffer_stake_for_protocol_upgrade_bps: Some(0),
2986
2987 address_from_bytes_cost_base: Some(52),
2991 address_to_u256_cost_base: Some(52),
2993 address_from_u256_cost_base: Some(52),
2995
2996 config_read_setting_impl_cost_base: None,
2999 config_read_setting_impl_cost_per_byte: None,
3000
3001 dynamic_field_hash_type_and_key_cost_base: Some(100),
3004 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
3005 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
3006 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
3007 dynamic_field_add_child_object_cost_base: Some(100),
3009 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
3010 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
3011 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
3012 dynamic_field_borrow_child_object_cost_base: Some(100),
3014 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3015 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3016 dynamic_field_remove_child_object_cost_base: Some(100),
3018 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3019 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3020 dynamic_field_has_child_object_cost_base: Some(100),
3022 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3024 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3025 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3026
3027 event_emit_cost_base: Some(52),
3030 event_emit_value_size_derivation_cost_per_byte: Some(2),
3031 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3032 event_emit_output_cost_per_byte: Some(10),
3033 event_emit_auth_stream_cost: None,
3034
3035 object_borrow_uid_cost_base: Some(52),
3038 object_delete_impl_cost_base: Some(52),
3040 object_record_new_uid_cost_base: Some(52),
3042
3043 transfer_transfer_internal_cost_base: Some(52),
3046 transfer_party_transfer_internal_cost_base: None,
3048 transfer_freeze_object_cost_base: Some(52),
3050 transfer_share_object_cost_base: Some(52),
3052 transfer_receive_object_cost_base: None,
3053 transfer_receive_object_type_cost_per_byte: None,
3054 transfer_receive_object_cost_per_byte: None,
3055
3056 tx_context_derive_id_cost_base: Some(52),
3059 tx_context_fresh_id_cost_base: None,
3060 tx_context_sender_cost_base: None,
3061 tx_context_epoch_cost_base: None,
3062 tx_context_epoch_timestamp_ms_cost_base: None,
3063 tx_context_sponsor_cost_base: None,
3064 tx_context_rgp_cost_base: None,
3065 tx_context_gas_price_cost_base: None,
3066 tx_context_gas_budget_cost_base: None,
3067 tx_context_ids_created_cost_base: None,
3068 tx_context_replace_cost_base: None,
3069
3070 types_is_one_time_witness_cost_base: Some(52),
3073 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3074 types_is_one_time_witness_type_cost_per_byte: Some(2),
3075
3076 validator_validate_metadata_cost_base: Some(52),
3079 validator_validate_metadata_data_cost_per_byte: Some(2),
3080
3081 crypto_invalid_arguments_cost: Some(100),
3083 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3085 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3086 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3087
3088 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3090 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3091 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3092
3093 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3095 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3096 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3097 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3098 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3099 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3100
3101 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3103
3104 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3106 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3107 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3108 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3109 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3110 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3111
3112 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3114 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3115 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3116 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3117 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3118 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3119
3120 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3122 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3123 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3124 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3125 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3126 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3127
3128 ecvrf_ecvrf_verify_cost_base: Some(52),
3130 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3131 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3132
3133 ed25519_ed25519_verify_cost_base: Some(52),
3135 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3136 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3137
3138 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3140 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3141
3142 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3144 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3145 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3146 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3147 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3148
3149 hash_blake2b256_cost_base: Some(52),
3151 hash_blake2b256_data_cost_per_byte: Some(2),
3152 hash_blake2b256_data_cost_per_block: Some(2),
3153
3154 hash_keccak256_cost_base: Some(52),
3156 hash_keccak256_data_cost_per_byte: Some(2),
3157 hash_keccak256_data_cost_per_block: Some(2),
3158
3159 poseidon_bn254_cost_base: None,
3160 poseidon_bn254_cost_per_block: None,
3161
3162 hmac_hmac_sha3_256_cost_base: Some(52),
3164 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3165 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3166
3167 group_ops_bls12381_decode_scalar_cost: None,
3169 group_ops_bls12381_decode_g1_cost: None,
3170 group_ops_bls12381_decode_g2_cost: None,
3171 group_ops_bls12381_decode_gt_cost: None,
3172 group_ops_bls12381_scalar_add_cost: None,
3173 group_ops_bls12381_g1_add_cost: None,
3174 group_ops_bls12381_g2_add_cost: None,
3175 group_ops_bls12381_gt_add_cost: None,
3176 group_ops_bls12381_scalar_sub_cost: None,
3177 group_ops_bls12381_g1_sub_cost: None,
3178 group_ops_bls12381_g2_sub_cost: None,
3179 group_ops_bls12381_gt_sub_cost: None,
3180 group_ops_bls12381_scalar_mul_cost: None,
3181 group_ops_bls12381_g1_mul_cost: None,
3182 group_ops_bls12381_g2_mul_cost: None,
3183 group_ops_bls12381_gt_mul_cost: None,
3184 group_ops_bls12381_scalar_div_cost: None,
3185 group_ops_bls12381_g1_div_cost: None,
3186 group_ops_bls12381_g2_div_cost: None,
3187 group_ops_bls12381_gt_div_cost: None,
3188 group_ops_bls12381_g1_hash_to_base_cost: None,
3189 group_ops_bls12381_g2_hash_to_base_cost: None,
3190 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3191 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3192 group_ops_bls12381_g1_msm_base_cost: None,
3193 group_ops_bls12381_g2_msm_base_cost: None,
3194 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3195 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3196 group_ops_bls12381_msm_max_len: None,
3197 group_ops_bls12381_pairing_cost: None,
3198 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3199 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3200 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3201 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3202 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3203
3204 group_ops_ristretto_decode_scalar_cost: None,
3205 group_ops_ristretto_decode_point_cost: None,
3206 group_ops_ristretto_scalar_add_cost: None,
3207 group_ops_ristretto_point_add_cost: None,
3208 group_ops_ristretto_scalar_sub_cost: None,
3209 group_ops_ristretto_point_sub_cost: None,
3210 group_ops_ristretto_scalar_mul_cost: None,
3211 group_ops_ristretto_point_mul_cost: None,
3212 group_ops_ristretto_scalar_div_cost: None,
3213 group_ops_ristretto_point_div_cost: None,
3214
3215 verify_bulletproofs_ristretto255_base_cost: None,
3216 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3217
3218 check_zklogin_id_cost_base: None,
3220 check_zklogin_issuer_cost_base: None,
3222
3223 vdf_verify_vdf_cost: None,
3224 vdf_hash_to_input_cost: None,
3225
3226 nitro_attestation_parse_base_cost: None,
3228 nitro_attestation_parse_cost_per_byte: None,
3229 nitro_attestation_verify_base_cost: None,
3230 nitro_attestation_verify_cost_per_cert: None,
3231
3232 bcs_per_byte_serialized_cost: None,
3233 bcs_legacy_min_output_size_cost: None,
3234 bcs_failure_cost: None,
3235 hash_sha2_256_base_cost: None,
3236 hash_sha2_256_per_byte_cost: None,
3237 hash_sha2_256_legacy_min_input_len_cost: None,
3238 hash_sha3_256_base_cost: None,
3239 hash_sha3_256_per_byte_cost: None,
3240 hash_sha3_256_legacy_min_input_len_cost: None,
3241 type_name_get_base_cost: None,
3242 type_name_get_per_byte_cost: None,
3243 type_name_id_base_cost: None,
3244 string_check_utf8_base_cost: None,
3245 string_check_utf8_per_byte_cost: None,
3246 string_is_char_boundary_base_cost: None,
3247 string_sub_string_base_cost: None,
3248 string_sub_string_per_byte_cost: None,
3249 string_index_of_base_cost: None,
3250 string_index_of_per_byte_pattern_cost: None,
3251 string_index_of_per_byte_searched_cost: None,
3252 vector_empty_base_cost: None,
3253 vector_length_base_cost: None,
3254 vector_push_back_base_cost: None,
3255 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3256 vector_borrow_base_cost: None,
3257 vector_pop_back_base_cost: None,
3258 vector_destroy_empty_base_cost: None,
3259 vector_swap_base_cost: None,
3260 debug_print_base_cost: None,
3261 debug_print_stack_trace_base_cost: None,
3262
3263 max_size_written_objects: None,
3264 max_size_written_objects_system_tx: None,
3265
3266 max_move_identifier_len: None,
3273 max_move_value_depth: None,
3274 max_move_enum_variants: None,
3275
3276 gas_rounding_step: None,
3277
3278 execution_version: None,
3279
3280 max_event_emit_size_total: None,
3281
3282 consensus_bad_nodes_stake_threshold: None,
3283
3284 max_jwk_votes_per_validator_per_epoch: None,
3285
3286 max_age_of_jwk_in_epochs: None,
3287
3288 random_beacon_reduction_allowed_delta: None,
3289
3290 random_beacon_reduction_lower_bound: None,
3291
3292 random_beacon_dkg_timeout_round: None,
3293
3294 random_beacon_min_round_interval_ms: None,
3295
3296 random_beacon_dkg_version: None,
3297
3298 consensus_max_transaction_size_bytes: None,
3299
3300 consensus_max_transactions_in_block_bytes: None,
3301
3302 consensus_max_num_transactions_in_block: None,
3303
3304 consensus_voting_rounds: None,
3305
3306 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3307
3308 max_deferral_rounds_for_congestion_control: None,
3309
3310 max_txn_cost_overage_per_object_in_commit: None,
3311
3312 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3313
3314 min_checkpoint_interval_ms: None,
3315
3316 checkpoint_summary_version_specific_data: None,
3317
3318 max_soft_bundle_size: None,
3319
3320 bridge_should_try_to_finalize_committee: None,
3321
3322 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3323
3324 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3325
3326 consensus_gc_depth: None,
3327
3328 gas_budget_based_txn_cost_cap_factor: None,
3329
3330 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3331
3332 sip_45_consensus_amplification_threshold: None,
3333
3334 use_object_per_epoch_marker_table_v2: None,
3335
3336 consensus_commit_rate_estimation_window_size: None,
3337
3338 aliased_addresses: vec![],
3339
3340 translation_per_command_base_charge: None,
3341 translation_per_input_base_charge: None,
3342 translation_pure_input_per_byte_charge: None,
3343 translation_per_type_node_charge: None,
3344 translation_per_reference_node_charge: None,
3345 translation_per_linkage_entry_charge: None,
3346
3347 max_updates_per_settlement_txn: None,
3348
3349 gasless_max_computation_units: None,
3350 gasless_allowed_token_types: None,
3351 gasless_max_unused_inputs: None,
3352 gasless_max_pure_input_bytes: None,
3353 gasless_max_tps: None,
3354 };
3357 for cur in 2..=version.0 {
3358 match cur {
3359 1 => unreachable!(),
3360 2 => {
3361 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3362 }
3363 3 => {
3364 cfg.gas_model_version = Some(2);
3366 cfg.max_tx_gas = Some(50_000_000_000);
3368 cfg.base_tx_cost_fixed = Some(2_000);
3370 cfg.storage_gas_price = Some(76);
3372 cfg.feature_flags.loaded_child_objects_fixed = true;
3373 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3376 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3379 cfg.feature_flags.package_upgrades = true;
3380 }
3381 4 => {
3386 cfg.reward_slashing_rate = Some(10000);
3388 cfg.gas_model_version = Some(3);
3390 }
3391 5 => {
3392 cfg.feature_flags.missing_type_is_compatibility_error = true;
3393 cfg.gas_model_version = Some(4);
3394 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3395 }
3399 6 => {
3400 cfg.gas_model_version = Some(5);
3401 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3402 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3403 }
3404 7 => {
3405 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3406 cfg.feature_flags
3407 .disable_invariant_violation_check_in_swap_loc = true;
3408 cfg.feature_flags.ban_entry_init = true;
3409 cfg.feature_flags.package_digest_hash_module = true;
3410 }
3411 8 => {
3412 cfg.feature_flags
3413 .disallow_change_struct_type_params_on_upgrade = true;
3414 }
3415 9 => {
3416 cfg.max_move_identifier_len = Some(128);
3418 cfg.feature_flags.no_extraneous_module_bytes = true;
3419 cfg.feature_flags
3420 .advance_to_highest_supported_protocol_version = true;
3421 }
3422 10 => {
3423 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3424 cfg.max_meter_ticks_per_module = Some(16_000_000);
3425 }
3426 11 => {
3427 cfg.max_move_value_depth = Some(128);
3428 }
3429 12 => {
3430 cfg.feature_flags.narwhal_versioned_metadata = true;
3431 if chain != Chain::Mainnet {
3432 cfg.feature_flags.commit_root_state_digest = true;
3433 }
3434
3435 if chain != Chain::Mainnet && chain != Chain::Testnet {
3436 cfg.feature_flags.zklogin_auth = true;
3437 }
3438 }
3439 13 => {}
3440 14 => {
3441 cfg.gas_rounding_step = Some(1_000);
3442 cfg.gas_model_version = Some(6);
3443 }
3444 15 => {
3445 cfg.feature_flags.consensus_transaction_ordering =
3446 ConsensusTransactionOrdering::ByGasPrice;
3447 }
3448 16 => {
3449 cfg.feature_flags.simplified_unwrap_then_delete = true;
3450 }
3451 17 => {
3452 cfg.feature_flags.upgraded_multisig_supported = true;
3453 }
3454 18 => {
3455 cfg.execution_version = Some(1);
3456 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3465 cfg.base_tx_cost_fixed = Some(1_000);
3467 }
3468 19 => {
3469 cfg.max_num_event_emit = Some(1024);
3470 cfg.max_event_emit_size_total = Some(
3473 256 * 250 * 1024, );
3475 }
3476 20 => {
3477 cfg.feature_flags.commit_root_state_digest = true;
3478
3479 if chain != Chain::Mainnet {
3480 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3481 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3482 }
3483 }
3484
3485 21 => {
3486 if chain != Chain::Mainnet {
3487 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3488 "Google".to_string(),
3489 "Facebook".to_string(),
3490 "Twitch".to_string(),
3491 ]);
3492 }
3493 }
3494 22 => {
3495 cfg.feature_flags.loaded_child_object_format = true;
3496 }
3497 23 => {
3498 cfg.feature_flags.loaded_child_object_format_type = true;
3499 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3500 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3506 }
3507 24 => {
3508 cfg.feature_flags.simple_conservation_checks = true;
3509 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3510
3511 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3512
3513 if chain != Chain::Mainnet {
3514 cfg.feature_flags.enable_jwk_consensus_updates = true;
3515 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3517 cfg.max_age_of_jwk_in_epochs = Some(1);
3518 }
3519 }
3520 25 => {
3521 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3523 "Google".to_string(),
3524 "Facebook".to_string(),
3525 "Twitch".to_string(),
3526 ]);
3527 cfg.feature_flags.zklogin_auth = true;
3528
3529 cfg.feature_flags.enable_jwk_consensus_updates = true;
3531 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3532 cfg.max_age_of_jwk_in_epochs = Some(1);
3533 }
3534 26 => {
3535 cfg.gas_model_version = Some(7);
3536 if chain != Chain::Mainnet && chain != Chain::Testnet {
3538 cfg.transfer_receive_object_cost_base = Some(52);
3539 cfg.feature_flags.receive_objects = true;
3540 }
3541 }
3542 27 => {
3543 cfg.gas_model_version = Some(8);
3544 }
3545 28 => {
3546 cfg.check_zklogin_id_cost_base = Some(200);
3548 cfg.check_zklogin_issuer_cost_base = Some(200);
3550
3551 if chain != Chain::Mainnet && chain != Chain::Testnet {
3553 cfg.feature_flags.enable_effects_v2 = true;
3554 }
3555 }
3556 29 => {
3557 cfg.feature_flags.verify_legacy_zklogin_address = true;
3558 }
3559 30 => {
3560 if chain != Chain::Mainnet {
3562 cfg.feature_flags.narwhal_certificate_v2 = true;
3563 }
3564
3565 cfg.random_beacon_reduction_allowed_delta = Some(800);
3566 if chain != Chain::Mainnet {
3568 cfg.feature_flags.enable_effects_v2 = true;
3569 }
3570
3571 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3575
3576 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3577 }
3578 31 => {
3579 cfg.execution_version = Some(2);
3580 if chain != Chain::Mainnet && chain != Chain::Testnet {
3582 cfg.feature_flags.shared_object_deletion = true;
3583 }
3584 }
3585 32 => {
3586 if chain != Chain::Mainnet {
3588 cfg.feature_flags.accept_zklogin_in_multisig = true;
3589 }
3590 if chain != Chain::Mainnet {
3592 cfg.transfer_receive_object_cost_base = Some(52);
3593 cfg.feature_flags.receive_objects = true;
3594 }
3595 if chain != Chain::Mainnet && chain != Chain::Testnet {
3597 cfg.feature_flags.random_beacon = true;
3598 cfg.random_beacon_reduction_lower_bound = Some(1600);
3599 cfg.random_beacon_dkg_timeout_round = Some(3000);
3600 cfg.random_beacon_min_round_interval_ms = Some(150);
3601 }
3602 if chain != Chain::Testnet && chain != Chain::Mainnet {
3604 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3605 }
3606
3607 cfg.feature_flags.narwhal_certificate_v2 = true;
3609 }
3610 33 => {
3611 cfg.feature_flags.hardened_otw_check = true;
3612 cfg.feature_flags.allow_receiving_object_id = true;
3613
3614 cfg.transfer_receive_object_cost_base = Some(52);
3616 cfg.feature_flags.receive_objects = true;
3617
3618 if chain != Chain::Mainnet {
3620 cfg.feature_flags.shared_object_deletion = true;
3621 }
3622
3623 cfg.feature_flags.enable_effects_v2 = true;
3624 }
3625 34 => {}
3626 35 => {
3627 if chain != Chain::Mainnet && chain != Chain::Testnet {
3629 cfg.feature_flags.enable_poseidon = true;
3630 cfg.poseidon_bn254_cost_base = Some(260);
3631 cfg.poseidon_bn254_cost_per_block = Some(10);
3632 }
3633
3634 cfg.feature_flags.enable_coin_deny_list = true;
3635 }
3636 36 => {
3637 if chain != Chain::Mainnet && chain != Chain::Testnet {
3639 cfg.feature_flags.enable_group_ops_native_functions = true;
3640 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3641 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3643 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3644 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3645 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3646 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3647 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3648 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3649 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3650 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3651 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3652 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3653 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3654 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3655 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3656 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3657 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3658 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3659 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3660 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3661 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3662 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3663 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3664 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3665 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3666 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3667 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3668 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3669 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3670 cfg.group_ops_bls12381_msm_max_len = Some(32);
3671 cfg.group_ops_bls12381_pairing_cost = Some(52);
3672 }
3673 cfg.feature_flags.shared_object_deletion = true;
3675
3676 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3678 }
3680 37 => {
3681 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3682
3683 if chain != Chain::Mainnet {
3685 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3686 }
3687 }
3688 38 => {
3689 cfg.binary_module_handles = Some(100);
3690 cfg.binary_struct_handles = Some(300);
3691 cfg.binary_function_handles = Some(1500);
3692 cfg.binary_function_instantiations = Some(750);
3693 cfg.binary_signatures = Some(1000);
3694 cfg.binary_constant_pool = Some(4000);
3698 cfg.binary_identifiers = Some(10000);
3699 cfg.binary_address_identifiers = Some(100);
3700 cfg.binary_struct_defs = Some(200);
3701 cfg.binary_struct_def_instantiations = Some(100);
3702 cfg.binary_function_defs = Some(1000);
3703 cfg.binary_field_handles = Some(500);
3704 cfg.binary_field_instantiations = Some(250);
3705 cfg.binary_friend_decls = Some(100);
3706 cfg.max_package_dependencies = Some(32);
3708 cfg.max_modules_in_publish = Some(64);
3709 cfg.execution_version = Some(3);
3711 }
3712 39 => {
3713 }
3715 40 => {}
3716 41 => {
3717 cfg.feature_flags.enable_group_ops_native_functions = true;
3719 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3721 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3722 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3723 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3724 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3725 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3726 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3727 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3728 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3729 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3730 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3731 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3732 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3733 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3734 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3735 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3736 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3737 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3738 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3739 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3740 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3741 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3742 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3743 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3744 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3745 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3746 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3747 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3748 cfg.group_ops_bls12381_msm_max_len = Some(32);
3749 cfg.group_ops_bls12381_pairing_cost = Some(52);
3750 }
3751 42 => {}
3752 43 => {
3753 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3754 cfg.max_meter_ticks_per_package = Some(16_000_000);
3755 }
3756 44 => {
3757 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3759 if chain != Chain::Mainnet {
3761 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3762 }
3763 }
3764 45 => {
3765 if chain != Chain::Testnet && chain != Chain::Mainnet {
3767 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3768 }
3769
3770 if chain != Chain::Mainnet {
3771 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3773 }
3774 cfg.min_move_binary_format_version = Some(6);
3775 cfg.feature_flags.accept_zklogin_in_multisig = true;
3776
3777 if chain != Chain::Mainnet && chain != Chain::Testnet {
3781 cfg.feature_flags.bridge = true;
3782 }
3783 }
3784 46 => {
3785 if chain != Chain::Mainnet {
3787 cfg.feature_flags.bridge = true;
3788 }
3789
3790 cfg.feature_flags.reshare_at_same_initial_version = true;
3792 }
3793 47 => {}
3794 48 => {
3795 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3797
3798 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3800
3801 if chain != Chain::Mainnet {
3803 cfg.feature_flags.random_beacon = true;
3804 cfg.random_beacon_reduction_lower_bound = Some(1600);
3805 cfg.random_beacon_dkg_timeout_round = Some(3000);
3806 cfg.random_beacon_min_round_interval_ms = Some(200);
3807 }
3808
3809 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3811 }
3812 49 => {
3813 if chain != Chain::Testnet && chain != Chain::Mainnet {
3814 cfg.move_binary_format_version = Some(7);
3815 }
3816
3817 if chain != Chain::Mainnet && chain != Chain::Testnet {
3819 cfg.feature_flags.enable_vdf = true;
3820 cfg.vdf_verify_vdf_cost = Some(1500);
3823 cfg.vdf_hash_to_input_cost = Some(100);
3824 }
3825
3826 if chain != Chain::Testnet && chain != Chain::Mainnet {
3828 cfg.feature_flags
3829 .record_consensus_determined_version_assignments_in_prologue = true;
3830 }
3831
3832 if chain != Chain::Mainnet {
3834 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3835 }
3836
3837 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3839 }
3840 50 => {
3841 if chain != Chain::Mainnet {
3843 cfg.checkpoint_summary_version_specific_data = Some(1);
3844 cfg.min_checkpoint_interval_ms = Some(200);
3845 }
3846
3847 if chain != Chain::Testnet && chain != Chain::Mainnet {
3849 cfg.feature_flags
3850 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3851 }
3852
3853 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3854
3855 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3857 }
3858 51 => {
3859 cfg.random_beacon_dkg_version = Some(1);
3860
3861 if chain != Chain::Testnet && chain != Chain::Mainnet {
3862 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3863 }
3864 }
3865 52 => {
3866 if chain != Chain::Mainnet {
3867 cfg.feature_flags.soft_bundle = true;
3868 cfg.max_soft_bundle_size = Some(5);
3869 }
3870
3871 cfg.config_read_setting_impl_cost_base = Some(100);
3872 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3873
3874 if chain != Chain::Testnet && chain != Chain::Mainnet {
3876 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3877 cfg.feature_flags.per_object_congestion_control_mode =
3878 PerObjectCongestionControlMode::TotalTxCount;
3879 }
3880
3881 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3883
3884 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3886
3887 cfg.checkpoint_summary_version_specific_data = Some(1);
3889 cfg.min_checkpoint_interval_ms = Some(200);
3890
3891 if chain != Chain::Mainnet {
3893 cfg.feature_flags
3894 .record_consensus_determined_version_assignments_in_prologue = true;
3895 cfg.feature_flags
3896 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3897 }
3898 if chain != Chain::Mainnet {
3900 cfg.move_binary_format_version = Some(7);
3901 }
3902
3903 if chain != Chain::Testnet && chain != Chain::Mainnet {
3904 cfg.feature_flags.passkey_auth = true;
3905 }
3906 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3907 }
3908 53 => {
3909 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3911
3912 cfg.feature_flags
3914 .record_consensus_determined_version_assignments_in_prologue = true;
3915 cfg.feature_flags
3916 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3917
3918 if chain == Chain::Unknown {
3919 cfg.feature_flags.authority_capabilities_v2 = true;
3920 }
3921
3922 if chain != Chain::Mainnet {
3924 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3925 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3926 cfg.feature_flags.per_object_congestion_control_mode =
3927 PerObjectCongestionControlMode::TotalTxCount;
3928 }
3929
3930 cfg.bcs_per_byte_serialized_cost = Some(2);
3932 cfg.bcs_legacy_min_output_size_cost = Some(1);
3933 cfg.bcs_failure_cost = Some(52);
3934 cfg.debug_print_base_cost = Some(52);
3935 cfg.debug_print_stack_trace_base_cost = Some(52);
3936 cfg.hash_sha2_256_base_cost = Some(52);
3937 cfg.hash_sha2_256_per_byte_cost = Some(2);
3938 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3939 cfg.hash_sha3_256_base_cost = Some(52);
3940 cfg.hash_sha3_256_per_byte_cost = Some(2);
3941 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3942 cfg.type_name_get_base_cost = Some(52);
3943 cfg.type_name_get_per_byte_cost = Some(2);
3944 cfg.string_check_utf8_base_cost = Some(52);
3945 cfg.string_check_utf8_per_byte_cost = Some(2);
3946 cfg.string_is_char_boundary_base_cost = Some(52);
3947 cfg.string_sub_string_base_cost = Some(52);
3948 cfg.string_sub_string_per_byte_cost = Some(2);
3949 cfg.string_index_of_base_cost = Some(52);
3950 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3951 cfg.string_index_of_per_byte_searched_cost = Some(2);
3952 cfg.vector_empty_base_cost = Some(52);
3953 cfg.vector_length_base_cost = Some(52);
3954 cfg.vector_push_back_base_cost = Some(52);
3955 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3956 cfg.vector_borrow_base_cost = Some(52);
3957 cfg.vector_pop_back_base_cost = Some(52);
3958 cfg.vector_destroy_empty_base_cost = Some(52);
3959 cfg.vector_swap_base_cost = Some(52);
3960 }
3961 54 => {
3962 cfg.feature_flags.random_beacon = true;
3964 cfg.random_beacon_reduction_lower_bound = Some(1000);
3965 cfg.random_beacon_dkg_timeout_round = Some(3000);
3966 cfg.random_beacon_min_round_interval_ms = Some(500);
3967
3968 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3970 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3971 cfg.feature_flags.per_object_congestion_control_mode =
3972 PerObjectCongestionControlMode::TotalTxCount;
3973
3974 cfg.feature_flags.soft_bundle = true;
3976 cfg.max_soft_bundle_size = Some(5);
3977 }
3978 55 => {
3979 cfg.move_binary_format_version = Some(7);
3981
3982 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3984 cfg.consensus_max_num_transactions_in_block = Some(512);
3987
3988 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3989 }
3990 56 => {
3991 if chain == Chain::Mainnet {
3992 cfg.feature_flags.bridge = true;
3993 }
3994 }
3995 57 => {
3996 cfg.random_beacon_reduction_lower_bound = Some(800);
3998 }
3999 58 => {
4000 if chain == Chain::Mainnet {
4001 cfg.bridge_should_try_to_finalize_committee = Some(true);
4002 }
4003
4004 if chain != Chain::Mainnet && chain != Chain::Testnet {
4005 cfg.feature_flags
4007 .consensus_distributed_vote_scoring_strategy = true;
4008 }
4009 }
4010 59 => {
4011 cfg.feature_flags.consensus_round_prober = true;
4013 }
4014 60 => {
4015 cfg.max_type_to_layout_nodes = Some(512);
4016 cfg.feature_flags.validate_identifier_inputs = true;
4017 }
4018 61 => {
4019 if chain != Chain::Mainnet {
4020 cfg.feature_flags
4022 .consensus_distributed_vote_scoring_strategy = true;
4023 }
4024 cfg.random_beacon_reduction_lower_bound = Some(700);
4026
4027 if chain != Chain::Mainnet && chain != Chain::Testnet {
4028 cfg.feature_flags.mysticeti_fastpath = true;
4030 }
4031 }
4032 62 => {
4033 cfg.feature_flags.relocate_event_module = true;
4034 }
4035 63 => {
4036 cfg.feature_flags.per_object_congestion_control_mode =
4037 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4038 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4039 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4040 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4041 }
4042 64 => {
4043 cfg.feature_flags.per_object_congestion_control_mode =
4044 PerObjectCongestionControlMode::TotalTxCount;
4045 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4046 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4047 }
4048 65 => {
4049 cfg.feature_flags
4051 .consensus_distributed_vote_scoring_strategy = true;
4052 }
4053 66 => {
4054 if chain == Chain::Mainnet {
4055 cfg.feature_flags
4057 .consensus_distributed_vote_scoring_strategy = false;
4058 }
4059 }
4060 67 => {
4061 cfg.feature_flags
4063 .consensus_distributed_vote_scoring_strategy = true;
4064 }
4065 68 => {
4066 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4067 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4068 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4069 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4070 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4071
4072 if chain != Chain::Mainnet && chain != Chain::Testnet {
4073 cfg.feature_flags.uncompressed_g1_group_elements = true;
4074 }
4075
4076 cfg.feature_flags.per_object_congestion_control_mode =
4077 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4078 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4079 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4080 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4081 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4083 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4084
4085 cfg.random_beacon_reduction_lower_bound = Some(500);
4087
4088 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4089 }
4090 69 => {
4091 cfg.consensus_voting_rounds = Some(40);
4093
4094 if chain != Chain::Mainnet && chain != Chain::Testnet {
4095 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4097 }
4098
4099 if chain != Chain::Mainnet {
4100 cfg.feature_flags.uncompressed_g1_group_elements = true;
4101 }
4102 }
4103 70 => {
4104 if chain != Chain::Mainnet {
4105 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4107 cfg.feature_flags
4109 .consensus_round_prober_probe_accepted_rounds = true;
4110 }
4111
4112 cfg.poseidon_bn254_cost_per_block = Some(388);
4113
4114 cfg.gas_model_version = Some(9);
4115 cfg.feature_flags.native_charging_v2 = true;
4116 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4117 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4118 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4119 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4120 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4121 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4122 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4123 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4124
4125 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4127 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4128 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4129 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4130
4131 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4132 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4133 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4134 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4135 Some(8213);
4136 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4137 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4138 Some(9484);
4139
4140 cfg.hash_keccak256_cost_base = Some(10);
4141 cfg.hash_blake2b256_cost_base = Some(10);
4142
4143 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4145 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4146 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4147 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4148
4149 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4150 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4151 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4152 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4153
4154 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4155 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4156 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4157 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4158
4159 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4160 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4161 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4162 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4163
4164 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4165 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4166 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4167 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4168
4169 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4170 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4171
4172 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4173 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4174 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4175 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4176
4177 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4178 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4179 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4180 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4181
4182 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4183 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4184
4185 cfg.validator_validate_metadata_cost_base = Some(20000);
4186 }
4187 71 => {
4188 cfg.sip_45_consensus_amplification_threshold = Some(5);
4189
4190 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4192 }
4193 72 => {
4194 cfg.feature_flags.convert_type_argument_error = true;
4195
4196 cfg.max_tx_gas = Some(50_000_000_000_000);
4199 cfg.max_gas_price = Some(50_000_000_000);
4201
4202 cfg.feature_flags.variant_nodes = true;
4203 }
4204 73 => {
4205 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4207
4208 if chain != Chain::Mainnet && chain != Chain::Testnet {
4209 cfg.consensus_gc_depth = Some(60);
4212 }
4213
4214 if chain != Chain::Mainnet {
4215 cfg.feature_flags.consensus_zstd_compression = true;
4217 }
4218
4219 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4221 cfg.feature_flags
4223 .consensus_round_prober_probe_accepted_rounds = true;
4224
4225 cfg.feature_flags.per_object_congestion_control_mode =
4227 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4228 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4229 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4230 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4231 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4233 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4234 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4235 }
4236 74 => {
4237 if chain != Chain::Mainnet && chain != Chain::Testnet {
4239 cfg.feature_flags.enable_nitro_attestation = true;
4240 }
4241 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4242 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4243 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4244 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4245
4246 cfg.feature_flags.consensus_zstd_compression = true;
4248
4249 if chain != Chain::Mainnet && chain != Chain::Testnet {
4250 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4251 }
4252 }
4253 75 => {
4254 if chain != Chain::Mainnet {
4255 cfg.feature_flags.passkey_auth = true;
4256 }
4257 }
4258 76 => {
4259 if chain != Chain::Mainnet && chain != Chain::Testnet {
4260 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4261 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4262 }
4263 cfg.feature_flags.minimize_child_object_mutations = true;
4264
4265 if chain != Chain::Mainnet {
4266 cfg.feature_flags.accept_passkey_in_multisig = true;
4267 }
4268 }
4269 77 => {
4270 cfg.feature_flags.uncompressed_g1_group_elements = true;
4271
4272 if chain != Chain::Mainnet {
4273 cfg.consensus_gc_depth = Some(60);
4274 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4275 }
4276 }
4277 78 => {
4278 cfg.feature_flags.move_native_context = true;
4279 cfg.tx_context_fresh_id_cost_base = Some(52);
4280 cfg.tx_context_sender_cost_base = Some(30);
4281 cfg.tx_context_epoch_cost_base = Some(30);
4282 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4283 cfg.tx_context_sponsor_cost_base = Some(30);
4284 cfg.tx_context_gas_price_cost_base = Some(30);
4285 cfg.tx_context_gas_budget_cost_base = Some(30);
4286 cfg.tx_context_ids_created_cost_base = Some(30);
4287 cfg.tx_context_replace_cost_base = Some(30);
4288 cfg.gas_model_version = Some(10);
4289
4290 if chain != Chain::Mainnet {
4291 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4292 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4293
4294 cfg.feature_flags.per_object_congestion_control_mode =
4296 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4297 ExecutionTimeEstimateParams {
4298 target_utilization: 30,
4299 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4301 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4303 stored_observations_limit: u64::MAX,
4304 stake_weighted_median_threshold: 0,
4305 default_none_duration_for_new_keys: false,
4306 observations_chunk_size: None,
4307 },
4308 );
4309 }
4310 }
4311 79 => {
4312 if chain != Chain::Mainnet {
4313 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4314
4315 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4318
4319 cfg.feature_flags.consensus_batched_block_sync = true;
4320
4321 cfg.feature_flags.enable_nitro_attestation = true
4323 }
4324 cfg.feature_flags.normalize_ptb_arguments = true;
4325
4326 cfg.consensus_gc_depth = Some(60);
4327 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4328 }
4329 80 => {
4330 cfg.max_ptb_value_size = Some(1024 * 1024);
4331 }
4332 81 => {
4333 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4334 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4335 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4336 }
4337 82 => {
4338 cfg.feature_flags.max_ptb_value_size_v2 = true;
4339 }
4340 83 => {
4341 if chain == Chain::Mainnet {
4342 let aliased: [u8; 32] = Hex::decode(
4344 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4345 )
4346 .unwrap()
4347 .try_into()
4348 .unwrap();
4349
4350 cfg.aliased_addresses.push(AliasedAddress {
4352 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4353 aliased,
4354 allowed_tx_digests: vec![
4355 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4356 ],
4357 });
4358
4359 cfg.aliased_addresses.push(AliasedAddress {
4360 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4361 aliased,
4362 allowed_tx_digests: vec![
4363 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4364 ],
4365 });
4366 }
4367
4368 if chain != Chain::Mainnet {
4371 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4372 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4373
4374 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4376 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4377 cfg.feature_flags.per_object_congestion_control_mode =
4378 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4379 ExecutionTimeEstimateParams {
4380 target_utilization: 30,
4381 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4383 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4385 stored_observations_limit: u64::MAX,
4386 stake_weighted_median_threshold: 0,
4387 default_none_duration_for_new_keys: false,
4388 observations_chunk_size: None,
4389 },
4390 );
4391
4392 cfg.feature_flags.consensus_batched_block_sync = true;
4394
4395 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4398 cfg.feature_flags.enable_nitro_attestation = true;
4399 }
4400 }
4401 84 => {
4402 if chain == Chain::Mainnet {
4403 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4404 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4405
4406 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4408 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4409 cfg.feature_flags.per_object_congestion_control_mode =
4410 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4411 ExecutionTimeEstimateParams {
4412 target_utilization: 30,
4413 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4415 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4417 stored_observations_limit: u64::MAX,
4418 stake_weighted_median_threshold: 0,
4419 default_none_duration_for_new_keys: false,
4420 observations_chunk_size: None,
4421 },
4422 );
4423
4424 cfg.feature_flags.consensus_batched_block_sync = true;
4426
4427 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4430 cfg.feature_flags.enable_nitro_attestation = true;
4431 }
4432
4433 cfg.feature_flags.per_object_congestion_control_mode =
4435 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4436 ExecutionTimeEstimateParams {
4437 target_utilization: 30,
4438 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4440 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4442 stored_observations_limit: 20,
4443 stake_weighted_median_threshold: 0,
4444 default_none_duration_for_new_keys: false,
4445 observations_chunk_size: None,
4446 },
4447 );
4448 cfg.feature_flags.allow_unbounded_system_objects = true;
4449 }
4450 85 => {
4451 if chain != Chain::Mainnet && chain != Chain::Testnet {
4452 cfg.feature_flags.enable_party_transfer = true;
4453 }
4454
4455 cfg.feature_flags
4456 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4457 cfg.feature_flags.disallow_self_identifier = true;
4458 cfg.feature_flags.per_object_congestion_control_mode =
4459 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4460 ExecutionTimeEstimateParams {
4461 target_utilization: 50,
4462 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4464 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4466 stored_observations_limit: 20,
4467 stake_weighted_median_threshold: 0,
4468 default_none_duration_for_new_keys: false,
4469 observations_chunk_size: None,
4470 },
4471 );
4472 }
4473 86 => {
4474 cfg.feature_flags.type_tags_in_object_runtime = true;
4475 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4476
4477 cfg.feature_flags.per_object_congestion_control_mode =
4479 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4480 ExecutionTimeEstimateParams {
4481 target_utilization: 50,
4482 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4484 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4486 stored_observations_limit: 20,
4487 stake_weighted_median_threshold: 3334,
4488 default_none_duration_for_new_keys: false,
4489 observations_chunk_size: None,
4490 },
4491 );
4492 if chain != Chain::Mainnet {
4494 cfg.feature_flags.enable_party_transfer = true;
4495 }
4496 }
4497 87 => {
4498 if chain == Chain::Mainnet {
4499 cfg.feature_flags.record_time_estimate_processed = true;
4500 }
4501 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4502 }
4503 88 => {
4504 cfg.feature_flags.record_time_estimate_processed = true;
4505 cfg.tx_context_rgp_cost_base = Some(30);
4506 cfg.feature_flags
4507 .ignore_execution_time_observations_after_certs_closed = true;
4508
4509 cfg.feature_flags.per_object_congestion_control_mode =
4512 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4513 ExecutionTimeEstimateParams {
4514 target_utilization: 50,
4515 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4517 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4519 stored_observations_limit: 20,
4520 stake_weighted_median_threshold: 3334,
4521 default_none_duration_for_new_keys: true,
4522 observations_chunk_size: None,
4523 },
4524 );
4525 }
4526 89 => {
4527 cfg.feature_flags.dependency_linkage_error = true;
4528 cfg.feature_flags.additional_multisig_checks = true;
4529 }
4530 90 => {
4531 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4533 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4534 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4535 cfg.feature_flags.accept_passkey_in_multisig = true;
4536 cfg.feature_flags.passkey_auth = true;
4537 cfg.feature_flags.check_for_init_during_upgrade = true;
4538
4539 if chain != Chain::Mainnet {
4541 cfg.feature_flags.mysticeti_fastpath = true;
4542 }
4543 }
4544 91 => {
4545 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4546 }
4547 92 => {
4548 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4549 }
4550 93 => {
4551 cfg.feature_flags
4552 .consensus_checkpoint_signature_key_includes_digest = true;
4553 }
4554 94 => {
4555 cfg.feature_flags.per_object_congestion_control_mode =
4557 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4558 ExecutionTimeEstimateParams {
4559 target_utilization: 50,
4560 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4562 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4564 stored_observations_limit: 18,
4565 stake_weighted_median_threshold: 3334,
4566 default_none_duration_for_new_keys: true,
4567 observations_chunk_size: None,
4568 },
4569 );
4570
4571 cfg.feature_flags.enable_party_transfer = true;
4573 }
4574 95 => {
4575 cfg.type_name_id_base_cost = Some(52);
4576
4577 cfg.max_transactions_per_checkpoint = Some(20_000);
4579 }
4580 96 => {
4581 if chain != Chain::Mainnet && chain != Chain::Testnet {
4583 cfg.feature_flags
4584 .include_checkpoint_artifacts_digest_in_summary = true;
4585 }
4586 cfg.feature_flags.correct_gas_payment_limit_check = true;
4587 cfg.feature_flags.authority_capabilities_v2 = true;
4588 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4589 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4590 cfg.feature_flags.enable_coin_registry = true;
4591
4592 cfg.feature_flags.mysticeti_fastpath = true;
4594 }
4595 97 => {
4596 cfg.feature_flags.additional_borrow_checks = true;
4597 }
4598 98 => {
4599 cfg.event_emit_auth_stream_cost = Some(52);
4600 cfg.feature_flags.better_loader_errors = true;
4601 cfg.feature_flags.generate_df_type_layouts = true;
4602 }
4603 99 => {
4604 cfg.feature_flags.use_new_commit_handler = true;
4605 }
4606 100 => {
4607 cfg.feature_flags.private_generics_verifier_v2 = true;
4608 }
4609 101 => {
4610 cfg.feature_flags.create_root_accumulator_object = true;
4611 cfg.max_updates_per_settlement_txn = Some(100);
4612 if chain != Chain::Mainnet {
4613 cfg.feature_flags.enable_poseidon = true;
4614 }
4615 }
4616 102 => {
4617 cfg.feature_flags.per_object_congestion_control_mode =
4621 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4622 ExecutionTimeEstimateParams {
4623 target_utilization: 50,
4624 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4626 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4628 stored_observations_limit: 180,
4629 stake_weighted_median_threshold: 3334,
4630 default_none_duration_for_new_keys: true,
4631 observations_chunk_size: Some(18),
4632 },
4633 );
4634 cfg.feature_flags.deprecate_global_storage_ops = true;
4635 }
4636 103 => {}
4637 104 => {
4638 cfg.translation_per_command_base_charge = Some(1);
4639 cfg.translation_per_input_base_charge = Some(1);
4640 cfg.translation_pure_input_per_byte_charge = Some(1);
4641 cfg.translation_per_type_node_charge = Some(1);
4642 cfg.translation_per_reference_node_charge = Some(1);
4643 cfg.translation_per_linkage_entry_charge = Some(10);
4644 cfg.gas_model_version = Some(11);
4645 cfg.feature_flags.abstract_size_in_object_runtime = true;
4646 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4647 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4648 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4649 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4650 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4651 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4652 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4653 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4654 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4655 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4656 cfg.feature_flags.enable_ptb_execution_v2 = true;
4657
4658 cfg.poseidon_bn254_cost_base = Some(260);
4659
4660 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4661
4662 if chain != Chain::Mainnet {
4663 cfg.feature_flags
4664 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4665 }
4666
4667 cfg.feature_flags
4668 .include_cancelled_randomness_txns_in_prologue = true;
4669 }
4670 105 => {
4671 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4672 cfg.feature_flags.disable_preconsensus_locking = true;
4673
4674 if chain != Chain::Mainnet {
4675 cfg.feature_flags
4676 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4677 }
4678 }
4679 106 => {
4680 cfg.accumulator_object_storage_cost = Some(7600);
4682
4683 if chain != Chain::Mainnet && chain != Chain::Testnet {
4684 cfg.feature_flags.enable_accumulators = true;
4685 cfg.feature_flags.enable_address_balance_gas_payments = true;
4686 cfg.feature_flags.enable_authenticated_event_streams = true;
4687 cfg.feature_flags.enable_object_funds_withdraw = true;
4688 }
4689 }
4690 107 => {
4691 cfg.feature_flags
4692 .consensus_skip_gced_blocks_in_direct_finalization = true;
4693
4694 if in_integration_test() {
4696 cfg.consensus_gc_depth = Some(6);
4697 cfg.consensus_max_num_transactions_in_block = Some(8);
4698 }
4699 }
4700 108 => {
4701 cfg.feature_flags.gas_rounding_halve_digits = true;
4702 cfg.feature_flags.flexible_tx_context_positions = true;
4703 cfg.feature_flags.disable_entry_point_signature_check = true;
4704
4705 if chain != Chain::Mainnet {
4706 cfg.feature_flags.address_aliases = true;
4707
4708 cfg.feature_flags.enable_accumulators = true;
4709 cfg.feature_flags.enable_address_balance_gas_payments = true;
4710 }
4711
4712 cfg.feature_flags.enable_poseidon = true;
4713 }
4714 109 => {
4715 cfg.binary_variant_handles = Some(1024);
4716 cfg.binary_variant_instantiation_handles = Some(1024);
4717 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4718 }
4719 110 => {
4720 cfg.feature_flags
4721 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4722 cfg.feature_flags
4723 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4724 if chain != Chain::Mainnet && chain != Chain::Testnet {
4725 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4726 }
4727 cfg.feature_flags.validate_zklogin_public_identifier = true;
4728 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4729 cfg.feature_flags
4730 .consensus_always_accept_system_transactions = true;
4731 if chain != Chain::Mainnet {
4732 cfg.feature_flags.enable_object_funds_withdraw = true;
4733 }
4734 }
4735 111 => {
4736 cfg.feature_flags.validator_metadata_verify_v2 = true;
4737 }
4738 112 => {
4739 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4740 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4741 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4742 cfg.group_ops_ristretto_point_add_cost = Some(500);
4743 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4744 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4745 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4746 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4747 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4748 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4749
4750 if chain != Chain::Mainnet && chain != Chain::Testnet {
4751 cfg.feature_flags.enable_ristretto255_group_ops = true;
4752 }
4753 }
4754 113 => {
4755 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4756 if chain != Chain::Mainnet && chain != Chain::Testnet {
4757 cfg.feature_flags.defer_unpaid_amplification = true;
4758 }
4759 }
4760 114 => {
4761 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4762 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4763 if chain != Chain::Mainnet {
4764 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4765 cfg.feature_flags.enable_authenticated_event_streams = true;
4766 cfg.feature_flags
4767 .include_checkpoint_artifacts_digest_in_summary = true;
4768 }
4769 }
4770 115 => {
4771 cfg.feature_flags.normalize_depth_formula = true;
4772 }
4773 116 => {
4774 cfg.feature_flags.gasless_transaction_drop_safety = true;
4775 cfg.feature_flags.address_aliases = true;
4776 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4777 cfg.feature_flags.defer_unpaid_amplification = false;
4779 cfg.feature_flags.enable_display_registry = true;
4780 }
4781 117 => {}
4782 118 => {
4783 cfg.feature_flags.use_coin_party_owner = true;
4784 }
4785 119 => {
4786 cfg.execution_version = Some(4);
4788 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4789 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4790 if chain != Chain::Mainnet {
4791 cfg.feature_flags.enable_gasless = true;
4792 cfg.gasless_max_computation_units = Some(50_000);
4793 cfg.gasless_allowed_token_types = Some(vec![]);
4794 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4795 cfg.feature_flags
4796 .convert_withdrawal_compatibility_ptb_arguments = true;
4797 }
4798 cfg.gasless_max_unused_inputs = Some(1);
4799 cfg.gasless_max_pure_input_bytes = Some(32);
4800 if chain == Chain::Testnet {
4801 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4802 }
4803 cfg.transfer_receive_object_cost_per_byte = Some(1);
4804 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4805 }
4806 120 => {
4807 cfg.feature_flags.disallow_jump_orphans = true;
4808 }
4809 121 => {
4810 if chain != Chain::Mainnet {
4812 cfg.feature_flags.defer_unpaid_amplification = true;
4813 cfg.gasless_max_tps = Some(50);
4814 }
4815 cfg.feature_flags
4816 .early_return_receive_object_mismatched_type = true;
4817 }
4818 122 => {
4819 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4821 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4822 if chain != Chain::Mainnet && chain != Chain::Testnet {
4823 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4824 }
4825 }
4826 _ => panic!("unsupported version {:?}", version),
4837 }
4838 }
4839
4840 cfg
4841 }
4842
4843 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4844 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4845 || !self.feature_flags.split_checkpoints_in_consensus_handler
4846 {
4847 return;
4848 }
4849
4850 if !mysten_common::in_test_configuration() {
4851 return;
4852 }
4853
4854 use rand::{Rng, SeedableRng, rngs::StdRng};
4855 let mut rng = StdRng::from_seed(*seed);
4856 let max_txns = rng.gen_range(10..=100u64);
4857 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4858 self.max_transactions_per_checkpoint = Some(max_txns);
4859 }
4860
4861 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4867 let (
4868 max_back_edges_per_function,
4869 max_back_edges_per_module,
4870 sanity_check_with_regex_reference_safety,
4871 ) = if let Some((
4872 max_back_edges_per_function,
4873 max_back_edges_per_module,
4874 sanity_check_with_regex_reference_safety,
4875 )) = signing_limits
4876 {
4877 (
4878 Some(max_back_edges_per_function),
4879 Some(max_back_edges_per_module),
4880 Some(sanity_check_with_regex_reference_safety),
4881 )
4882 } else {
4883 (None, None, None)
4884 };
4885
4886 let additional_borrow_checks = if signing_limits.is_some() {
4887 true
4889 } else {
4890 self.additional_borrow_checks()
4891 };
4892 let deprecate_global_storage_ops = if signing_limits.is_some() {
4893 true
4895 } else {
4896 self.deprecate_global_storage_ops()
4897 };
4898
4899 VerifierConfig {
4900 max_loop_depth: Some(self.max_loop_depth() as usize),
4901 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4902 max_function_parameters: Some(self.max_function_parameters() as usize),
4903 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4904 max_value_stack_size: self.max_value_stack_size() as usize,
4905 max_type_nodes: Some(self.max_type_nodes() as usize),
4906 max_push_size: Some(self.max_push_size() as usize),
4907 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4908 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4909 max_function_definitions: Some(self.max_function_definitions() as usize),
4910 max_data_definitions: Some(self.max_struct_definitions() as usize),
4911 max_constant_vector_len: Some(self.max_move_vector_len()),
4912 max_back_edges_per_function,
4913 max_back_edges_per_module,
4914 max_basic_blocks_in_script: None,
4915 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4917 allow_receiving_object_id: self.allow_receiving_object_id(),
4918 reject_mutable_random_on_entry_functions: self
4919 .reject_mutable_random_on_entry_functions(),
4920 bytecode_version: self.move_binary_format_version(),
4921 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4922 additional_borrow_checks,
4923 better_loader_errors: self.better_loader_errors(),
4924 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4925 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4926 .map(|limit| limit as u128),
4927 deprecate_global_storage_ops,
4928 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4929 switch_to_regex_reference_safety: false,
4930 disallow_jump_orphans: self.disallow_jump_orphans(),
4931 }
4932 }
4933
4934 pub fn binary_config(
4935 &self,
4936 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4937 ) -> BinaryConfig {
4938 let deprecate_global_storage_ops =
4939 override_deprecate_global_storage_ops_during_deserialization
4940 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4941 BinaryConfig::new(
4942 self.move_binary_format_version(),
4943 self.min_move_binary_format_version_as_option()
4944 .unwrap_or(VERSION_1),
4945 self.no_extraneous_module_bytes(),
4946 deprecate_global_storage_ops,
4947 TableConfig {
4948 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4949 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4950 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4951 function_instantiations: self
4952 .binary_function_instantiations_as_option()
4953 .unwrap_or(u16::MAX),
4954 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4955 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4956 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4957 address_identifiers: self
4958 .binary_address_identifiers_as_option()
4959 .unwrap_or(u16::MAX),
4960 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4961 struct_def_instantiations: self
4962 .binary_struct_def_instantiations_as_option()
4963 .unwrap_or(u16::MAX),
4964 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4965 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4966 field_instantiations: self
4967 .binary_field_instantiations_as_option()
4968 .unwrap_or(u16::MAX),
4969 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4970 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4971 enum_def_instantiations: self
4972 .binary_enum_def_instantiations_as_option()
4973 .unwrap_or(u16::MAX),
4974 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4975 variant_instantiation_handles: self
4976 .binary_variant_instantiation_handles_as_option()
4977 .unwrap_or(u16::MAX),
4978 },
4979 )
4980 }
4981
4982 #[cfg(not(msim))]
4986 pub fn apply_overrides_for_testing(
4987 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
4988 ) -> OverrideGuard {
4989 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
4990 assert!(cur.is_none(), "config override already present");
4991 *cur = Some(Box::new(override_fn));
4992 OverrideGuard
4993 }
4994
4995 #[cfg(msim)]
4999 pub fn apply_overrides_for_testing(
5000 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
5001 ) -> OverrideGuard {
5002 CONFIG_OVERRIDE.with(|ovr| {
5003 let mut cur = ovr.borrow_mut();
5004 assert!(cur.is_none(), "config override already present");
5005 *cur = Some(Box::new(override_fn));
5006 OverrideGuard
5007 })
5008 }
5009
5010 #[cfg(not(msim))]
5011 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5012 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5013 warn!(
5014 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5015 );
5016 ret = override_fn(version, ret);
5017 }
5018 ret
5019 }
5020
5021 #[cfg(msim)]
5022 fn apply_config_override(version: ProtocolVersion, ret: Self) -> Self {
5023 CONFIG_OVERRIDE.with(|ovr| {
5024 if let Some(override_fn) = &*ovr.borrow() {
5025 warn!(
5026 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5027 );
5028 override_fn(version, ret)
5029 } else {
5030 ret
5031 }
5032 })
5033 }
5034}
5035
5036impl ProtocolConfig {
5040 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
5041 self.feature_flags
5042 .advance_to_highest_supported_protocol_version = val
5043 }
5044 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
5045 self.feature_flags.commit_root_state_digest = val
5046 }
5047 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
5048 self.feature_flags.zklogin_auth = val
5049 }
5050 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
5051 self.feature_flags.enable_jwk_consensus_updates = val
5052 }
5053 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
5054 self.feature_flags.random_beacon = val
5055 }
5056
5057 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
5058 self.feature_flags.upgraded_multisig_supported = val
5059 }
5060 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
5061 self.feature_flags.accept_zklogin_in_multisig = val
5062 }
5063
5064 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
5065 self.feature_flags.shared_object_deletion = val;
5066 }
5067
5068 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
5069 self.feature_flags.narwhal_new_leader_election_schedule = val;
5070 }
5071
5072 pub fn set_receive_object_for_testing(&mut self, val: bool) {
5073 self.feature_flags.receive_objects = val
5074 }
5075 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
5076 self.feature_flags.narwhal_certificate_v2 = val
5077 }
5078 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
5079 self.feature_flags.verify_legacy_zklogin_address = val
5080 }
5081
5082 pub fn set_per_object_congestion_control_mode_for_testing(
5083 &mut self,
5084 val: PerObjectCongestionControlMode,
5085 ) {
5086 self.feature_flags.per_object_congestion_control_mode = val;
5087 }
5088
5089 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5090 self.feature_flags.consensus_choice = val;
5091 }
5092
5093 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5094 self.feature_flags.consensus_network = val;
5095 }
5096
5097 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5098 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5099 }
5100
5101 pub fn set_disable_bridge_for_testing(&mut self) {
5102 self.feature_flags.bridge = false
5103 }
5104
5105 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5106 self.feature_flags.mysticeti_num_leaders_per_round = val;
5107 }
5108
5109 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5110 self.feature_flags.soft_bundle = val;
5111 }
5112
5113 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5114 self.feature_flags.passkey_auth = val
5115 }
5116
5117 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5118 self.feature_flags.enable_party_transfer = val
5119 }
5120
5121 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5122 self.feature_flags
5123 .consensus_distributed_vote_scoring_strategy = val;
5124 }
5125
5126 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5127 self.feature_flags.consensus_round_prober = val;
5128 }
5129
5130 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5131 self.feature_flags
5132 .disallow_new_modules_in_deps_only_packages = val;
5133 }
5134
5135 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5136 self.feature_flags.correct_gas_payment_limit_check = val;
5137 }
5138
5139 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5140 self.feature_flags.address_aliases = val;
5141 }
5142
5143 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5144 self.feature_flags
5145 .consensus_round_prober_probe_accepted_rounds = val;
5146 }
5147
5148 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5149 self.feature_flags.mysticeti_fastpath = val;
5150 }
5151
5152 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5153 self.feature_flags.accept_passkey_in_multisig = val;
5154 }
5155
5156 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5157 self.feature_flags.consensus_batched_block_sync = val;
5158 }
5159
5160 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5161 self.feature_flags.record_time_estimate_processed = val;
5162 }
5163
5164 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5165 &mut self,
5166 val: bool,
5167 ) {
5168 self.feature_flags
5169 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5170 }
5171
5172 pub fn enable_accumulators_for_testing(&mut self) {
5173 self.feature_flags.enable_accumulators = true;
5174 }
5175
5176 pub fn disable_accumulators_for_testing(&mut self) {
5177 self.feature_flags.enable_accumulators = false;
5178 self.feature_flags.enable_address_balance_gas_payments = false;
5179 }
5180
5181 pub fn enable_coin_reservation_for_testing(&mut self) {
5182 self.feature_flags.enable_coin_reservation_obj_refs = true;
5183 self.feature_flags
5184 .convert_withdrawal_compatibility_ptb_arguments = true;
5185 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5188 }
5189
5190 pub fn disable_coin_reservation_for_testing(&mut self) {
5191 self.feature_flags.enable_coin_reservation_obj_refs = false;
5192 self.feature_flags
5193 .convert_withdrawal_compatibility_ptb_arguments = false;
5194 }
5195
5196 pub fn create_root_accumulator_object_for_testing(&mut self) {
5197 self.feature_flags.create_root_accumulator_object = true;
5198 }
5199
5200 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5201 self.feature_flags.create_root_accumulator_object = false;
5202 }
5203
5204 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5205 self.feature_flags.enable_accumulators = true;
5206 self.feature_flags.allow_private_accumulator_entrypoints = true;
5207 self.feature_flags.enable_address_balance_gas_payments = true;
5208 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5209 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5210 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5211 }
5212
5213 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5214 self.feature_flags.enable_address_balance_gas_payments = false;
5215 }
5216
5217 pub fn enable_gasless_for_testing(&mut self) {
5218 self.enable_address_balance_gas_payments_for_testing();
5219 self.feature_flags.enable_gasless = true;
5220 self.gasless_max_computation_units = Some(50_000);
5221 self.gasless_allowed_token_types = Some(vec![]);
5222 self.gasless_max_tps = Some(1000);
5223 }
5224
5225 pub fn disable_gasless_for_testing(&mut self) {
5226 self.feature_flags.enable_gasless = false;
5227 self.gasless_max_computation_units = None;
5228 self.gasless_allowed_token_types = None;
5229 }
5230
5231 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5232 self.gasless_allowed_token_types = Some(types);
5233 }
5234
5235 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5236 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5237 }
5238
5239 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5240 self.enable_accumulators_for_testing();
5241 self.feature_flags.enable_authenticated_event_streams = true;
5242 self.feature_flags
5243 .include_checkpoint_artifacts_digest_in_summary = true;
5244 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5245 }
5246
5247 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5248 self.feature_flags.enable_authenticated_event_streams = false;
5249 }
5250
5251 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5252 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5253 }
5254
5255 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5256 self.feature_flags.enable_non_exclusive_writes = true;
5257 }
5258
5259 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5260 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5261 }
5262
5263 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5264 &mut self,
5265 val: bool,
5266 ) {
5267 self.feature_flags
5268 .ignore_execution_time_observations_after_certs_closed = val;
5269 }
5270
5271 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5272 &mut self,
5273 val: bool,
5274 ) {
5275 self.feature_flags
5276 .consensus_checkpoint_signature_key_includes_digest = val;
5277 }
5278
5279 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5280 self.feature_flags.cancel_for_failed_dkg_early = val;
5281 }
5282
5283 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5284 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5285 }
5286
5287 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5288 self.feature_flags.authority_capabilities_v2 = val;
5289 }
5290
5291 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5292 self.feature_flags.allow_references_in_ptbs = true;
5293 }
5294
5295 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5296 self.feature_flags.consensus_skip_gced_accept_votes = val;
5297 }
5298
5299 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5300 self.feature_flags.enable_object_funds_withdraw = val;
5301 }
5302
5303 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5304 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5305 }
5306
5307 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5308 self.feature_flags.merge_randomness_into_checkpoint = val;
5309 }
5310}
5311
5312#[cfg(not(msim))]
5313type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5314
5315#[cfg(not(msim))]
5316static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5317
5318#[cfg(msim)]
5319type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5320
5321#[cfg(msim)]
5322thread_local! {
5323 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5324}
5325
5326#[must_use]
5327pub struct OverrideGuard;
5328
5329#[cfg(not(msim))]
5330impl Drop for OverrideGuard {
5331 fn drop(&mut self) {
5332 info!("restoring override fn");
5333 *CONFIG_OVERRIDE.lock().unwrap() = None;
5334 }
5335}
5336
5337#[cfg(msim)]
5338impl Drop for OverrideGuard {
5339 fn drop(&mut self) {
5340 info!("restoring override fn");
5341 CONFIG_OVERRIDE.with(|ovr| {
5342 *ovr.borrow_mut() = None;
5343 });
5344 }
5345}
5346
5347#[derive(PartialEq, Eq)]
5350pub enum LimitThresholdCrossed {
5351 None,
5352 Soft(u128, u128),
5353 Hard(u128, u128),
5354}
5355
5356pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5359 x: T,
5360 soft_limit: U,
5361 hard_limit: V,
5362) -> LimitThresholdCrossed {
5363 let x: V = x.into();
5364 let soft_limit: V = soft_limit.into();
5365
5366 debug_assert!(soft_limit <= hard_limit);
5367
5368 if x >= hard_limit {
5371 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5372 } else if x < soft_limit {
5373 LimitThresholdCrossed::None
5374 } else {
5375 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5376 }
5377}
5378
5379#[macro_export]
5380macro_rules! check_limit {
5381 ($x:expr, $hard:expr) => {
5382 check_limit!($x, $hard, $hard)
5383 };
5384 ($x:expr, $soft:expr, $hard:expr) => {
5385 check_limit_in_range($x as u64, $soft, $hard)
5386 };
5387}
5388
5389#[macro_export]
5393macro_rules! check_limit_by_meter {
5394 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5395 let (h, metered_str) = if $is_metered {
5397 ($metered_limit, "metered")
5398 } else {
5399 ($unmetered_hard_limit, "unmetered")
5401 };
5402 use sui_protocol_config::check_limit_in_range;
5403 let result = check_limit_in_range($x as u64, $metered_limit, h);
5404 match result {
5405 LimitThresholdCrossed::None => {}
5406 LimitThresholdCrossed::Soft(_, _) => {
5407 $metric.with_label_values(&[metered_str, "soft"]).inc();
5408 }
5409 LimitThresholdCrossed::Hard(_, _) => {
5410 $metric.with_label_values(&[metered_str, "hard"]).inc();
5411 }
5412 };
5413 result
5414 }};
5415}
5416#[cfg(all(test, not(msim)))]
5417mod test {
5418 use insta::assert_yaml_snapshot;
5419
5420 use super::*;
5421
5422 #[test]
5423 fn snapshot_tests() {
5424 println!("\n============================================================================");
5425 println!("! !");
5426 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5427 println!("! !");
5428 println!("============================================================================\n");
5429 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5430 let chain_str = match chain_id {
5434 Chain::Unknown => "".to_string(),
5435 _ => format!("{:?}_", chain_id),
5436 };
5437 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5438 let cur = ProtocolVersion::new(i);
5439 assert_yaml_snapshot!(
5440 format!("{}version_{}", chain_str, cur.as_u64()),
5441 ProtocolConfig::get_for_version(cur, *chain_id)
5442 );
5443 }
5444 }
5445 }
5446
5447 #[test]
5448 fn test_getters() {
5449 let prot: ProtocolConfig =
5450 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5451 assert_eq!(
5452 prot.max_arguments(),
5453 prot.max_arguments_as_option().unwrap()
5454 );
5455 }
5456
5457 #[test]
5458 fn test_setters() {
5459 let mut prot: ProtocolConfig =
5460 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5461 prot.set_max_arguments_for_testing(123);
5462 assert_eq!(prot.max_arguments(), 123);
5463
5464 prot.set_max_arguments_from_str_for_testing("321".to_string());
5465 assert_eq!(prot.max_arguments(), 321);
5466
5467 prot.disable_max_arguments_for_testing();
5468 assert_eq!(prot.max_arguments_as_option(), None);
5469
5470 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5471 assert_eq!(prot.max_arguments(), 456);
5472 }
5473
5474 #[test]
5475 fn test_get_for_version_if_supported_applies_test_overrides() {
5476 let before =
5477 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5478 .unwrap();
5479
5480 assert!(!before.enable_coin_reservation_obj_refs());
5481
5482 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5483 cfg.enable_coin_reservation_for_testing();
5484 cfg
5485 });
5486
5487 let after =
5488 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5489 .unwrap();
5490
5491 assert!(after.enable_coin_reservation_obj_refs());
5492 }
5493
5494 #[test]
5495 #[should_panic(expected = "unsupported version")]
5496 fn max_version_test() {
5497 let _ = ProtocolConfig::get_for_version_impl(
5500 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5501 Chain::Unknown,
5502 );
5503 }
5504
5505 #[test]
5506 fn lookup_by_string_test() {
5507 let prot: ProtocolConfig =
5508 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5509 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5511
5512 assert!(
5513 prot.lookup_attr("max_arguments".to_string())
5514 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5515 );
5516
5517 assert!(
5519 prot.lookup_attr("max_move_identifier_len".to_string())
5520 .is_none()
5521 );
5522
5523 let prot: ProtocolConfig =
5525 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5526 assert!(
5527 prot.lookup_attr("max_move_identifier_len".to_string())
5528 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5529 );
5530
5531 let prot: ProtocolConfig =
5532 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5533 assert!(
5535 prot.attr_map()
5536 .get("max_move_identifier_len")
5537 .unwrap()
5538 .is_none()
5539 );
5540 assert!(
5542 prot.attr_map().get("max_arguments").unwrap()
5543 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5544 );
5545
5546 let prot: ProtocolConfig =
5548 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5549 assert!(
5551 prot.feature_flags
5552 .lookup_attr("some random string".to_owned())
5553 .is_none()
5554 );
5555 assert!(
5556 !prot
5557 .feature_flags
5558 .attr_map()
5559 .contains_key("some random string")
5560 );
5561
5562 assert!(
5564 prot.feature_flags
5565 .lookup_attr("package_upgrades".to_owned())
5566 == Some(false)
5567 );
5568 assert!(
5569 prot.feature_flags
5570 .attr_map()
5571 .get("package_upgrades")
5572 .unwrap()
5573 == &false
5574 );
5575 let prot: ProtocolConfig =
5576 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5577 assert!(
5579 prot.feature_flags
5580 .lookup_attr("package_upgrades".to_owned())
5581 == Some(true)
5582 );
5583 assert!(
5584 prot.feature_flags
5585 .attr_map()
5586 .get("package_upgrades")
5587 .unwrap()
5588 == &true
5589 );
5590 }
5591
5592 #[test]
5593 fn limit_range_fn_test() {
5594 let low = 100u32;
5595 let high = 10000u64;
5596
5597 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5598 assert!(matches!(
5599 check_limit!(255u16, low, high),
5600 LimitThresholdCrossed::Soft(255u128, 100)
5601 ));
5602 assert!(matches!(
5608 check_limit!(2550000u64, low, high),
5609 LimitThresholdCrossed::Hard(2550000, 10000)
5610 ));
5611
5612 assert!(matches!(
5613 check_limit!(2550000u64, high, high),
5614 LimitThresholdCrossed::Hard(2550000, 10000)
5615 ));
5616
5617 assert!(matches!(
5618 check_limit!(1u8, high),
5619 LimitThresholdCrossed::None
5620 ));
5621
5622 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5623
5624 assert!(matches!(
5625 check_limit!(2550000u64, high),
5626 LimitThresholdCrossed::Hard(2550000, 10000)
5627 ));
5628 }
5629}