1use std::{
5 cell::RefCell,
6 collections::BTreeSet,
7 sync::atomic::{AtomicBool, Ordering},
8};
9
10use clap::*;
11use fastcrypto::encoding::{Base58, Encoding, Hex};
12use move_binary_format::{
13 binary_config::{BinaryConfig, TableConfig},
14 file_format_common::VERSION_1,
15};
16use move_vm_config::verifier::VerifierConfig;
17use mysten_common::in_integration_test;
18use serde::{Deserialize, Serialize};
19use serde_with::skip_serializing_none;
20use sui_protocol_config_macros::{
21 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
22};
23use tracing::{info, warn};
24
25const MIN_PROTOCOL_VERSION: u64 = 1;
27const MAX_PROTOCOL_VERSION: u64 = 118;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
311pub struct ProtocolVersion(u64);
312
313impl ProtocolVersion {
314 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
319
320 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
321
322 #[cfg(not(msim))]
323 pub const MAX_ALLOWED: Self = Self::MAX;
324
325 #[cfg(msim)]
327 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
328
329 pub fn new(v: u64) -> Self {
330 Self(v)
331 }
332
333 pub const fn as_u64(&self) -> u64 {
334 self.0
335 }
336
337 pub fn max() -> Self {
340 Self::MAX
341 }
342
343 pub fn prev(self) -> Self {
344 Self(self.0.checked_sub(1).unwrap())
345 }
346}
347
348impl From<u64> for ProtocolVersion {
349 fn from(v: u64) -> Self {
350 Self::new(v)
351 }
352}
353
354impl std::ops::Sub<u64> for ProtocolVersion {
355 type Output = Self;
356 fn sub(self, rhs: u64) -> Self::Output {
357 Self::new(self.0 - rhs)
358 }
359}
360
361impl std::ops::Add<u64> for ProtocolVersion {
362 type Output = Self;
363 fn add(self, rhs: u64) -> Self::Output {
364 Self::new(self.0 + rhs)
365 }
366}
367
368#[derive(
369 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
370)]
371pub enum Chain {
372 Mainnet,
373 Testnet,
374 #[default]
375 Unknown,
376}
377
378impl Chain {
379 pub fn as_str(self) -> &'static str {
380 match self {
381 Chain::Mainnet => "mainnet",
382 Chain::Testnet => "testnet",
383 Chain::Unknown => "unknown",
384 }
385 }
386}
387
388pub struct Error(pub String);
389
390#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
393struct FeatureFlags {
394 #[serde(skip_serializing_if = "is_false")]
397 package_upgrades: bool,
398 #[serde(skip_serializing_if = "is_false")]
401 commit_root_state_digest: bool,
402 #[serde(skip_serializing_if = "is_false")]
404 advance_epoch_start_time_in_safe_mode: bool,
405 #[serde(skip_serializing_if = "is_false")]
408 loaded_child_objects_fixed: bool,
409 #[serde(skip_serializing_if = "is_false")]
412 missing_type_is_compatibility_error: bool,
413 #[serde(skip_serializing_if = "is_false")]
416 scoring_decision_with_validity_cutoff: bool,
417
418 #[serde(skip_serializing_if = "is_false")]
421 consensus_order_end_of_epoch_last: bool,
422
423 #[serde(skip_serializing_if = "is_false")]
425 disallow_adding_abilities_on_upgrade: bool,
426 #[serde(skip_serializing_if = "is_false")]
428 disable_invariant_violation_check_in_swap_loc: bool,
429 #[serde(skip_serializing_if = "is_false")]
432 advance_to_highest_supported_protocol_version: bool,
433 #[serde(skip_serializing_if = "is_false")]
435 ban_entry_init: bool,
436 #[serde(skip_serializing_if = "is_false")]
438 package_digest_hash_module: bool,
439 #[serde(skip_serializing_if = "is_false")]
441 disallow_change_struct_type_params_on_upgrade: bool,
442 #[serde(skip_serializing_if = "is_false")]
444 no_extraneous_module_bytes: bool,
445 #[serde(skip_serializing_if = "is_false")]
447 narwhal_versioned_metadata: bool,
448
449 #[serde(skip_serializing_if = "is_false")]
451 zklogin_auth: bool,
452 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
454 consensus_transaction_ordering: ConsensusTransactionOrdering,
455
456 #[serde(skip_serializing_if = "is_false")]
464 simplified_unwrap_then_delete: bool,
465 #[serde(skip_serializing_if = "is_false")]
467 upgraded_multisig_supported: bool,
468 #[serde(skip_serializing_if = "is_false")]
470 txn_base_cost_as_multiplier: bool,
471
472 #[serde(skip_serializing_if = "is_false")]
474 shared_object_deletion: bool,
475
476 #[serde(skip_serializing_if = "is_false")]
478 narwhal_new_leader_election_schedule: bool,
479
480 #[serde(skip_serializing_if = "is_empty")]
482 zklogin_supported_providers: BTreeSet<String>,
483
484 #[serde(skip_serializing_if = "is_false")]
486 loaded_child_object_format: bool,
487
488 #[serde(skip_serializing_if = "is_false")]
489 enable_jwk_consensus_updates: bool,
490
491 #[serde(skip_serializing_if = "is_false")]
492 end_of_epoch_transaction_supported: bool,
493
494 #[serde(skip_serializing_if = "is_false")]
497 simple_conservation_checks: bool,
498
499 #[serde(skip_serializing_if = "is_false")]
501 loaded_child_object_format_type: bool,
502
503 #[serde(skip_serializing_if = "is_false")]
505 receive_objects: bool,
506
507 #[serde(skip_serializing_if = "is_false")]
509 consensus_checkpoint_signature_key_includes_digest: bool,
510
511 #[serde(skip_serializing_if = "is_false")]
513 random_beacon: bool,
514
515 #[serde(skip_serializing_if = "is_false")]
517 bridge: bool,
518
519 #[serde(skip_serializing_if = "is_false")]
520 enable_effects_v2: bool,
521
522 #[serde(skip_serializing_if = "is_false")]
524 narwhal_certificate_v2: bool,
525
526 #[serde(skip_serializing_if = "is_false")]
528 verify_legacy_zklogin_address: bool,
529
530 #[serde(skip_serializing_if = "is_false")]
532 throughput_aware_consensus_submission: bool,
533
534 #[serde(skip_serializing_if = "is_false")]
536 recompute_has_public_transfer_in_execution: bool,
537
538 #[serde(skip_serializing_if = "is_false")]
540 accept_zklogin_in_multisig: bool,
541
542 #[serde(skip_serializing_if = "is_false")]
544 accept_passkey_in_multisig: bool,
545
546 #[serde(skip_serializing_if = "is_false")]
548 validate_zklogin_public_identifier: bool,
549
550 #[serde(skip_serializing_if = "is_false")]
553 include_consensus_digest_in_prologue: bool,
554
555 #[serde(skip_serializing_if = "is_false")]
557 hardened_otw_check: bool,
558
559 #[serde(skip_serializing_if = "is_false")]
561 allow_receiving_object_id: bool,
562
563 #[serde(skip_serializing_if = "is_false")]
565 enable_poseidon: bool,
566
567 #[serde(skip_serializing_if = "is_false")]
569 enable_coin_deny_list: bool,
570
571 #[serde(skip_serializing_if = "is_false")]
573 enable_group_ops_native_functions: bool,
574
575 #[serde(skip_serializing_if = "is_false")]
577 enable_group_ops_native_function_msm: bool,
578
579 #[serde(skip_serializing_if = "is_false")]
581 enable_ristretto255_group_ops: bool,
582
583 #[serde(skip_serializing_if = "is_false")]
585 enable_nitro_attestation: bool,
586
587 #[serde(skip_serializing_if = "is_false")]
589 enable_nitro_attestation_upgraded_parsing: bool,
590
591 #[serde(skip_serializing_if = "is_false")]
593 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
594
595 #[serde(skip_serializing_if = "is_false")]
597 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
598
599 #[serde(skip_serializing_if = "is_false")]
601 reject_mutable_random_on_entry_functions: bool,
602
603 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
605 per_object_congestion_control_mode: PerObjectCongestionControlMode,
606
607 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
609 consensus_choice: ConsensusChoice,
610
611 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
613 consensus_network: ConsensusNetwork,
614
615 #[serde(skip_serializing_if = "is_false")]
617 correct_gas_payment_limit_check: bool,
618
619 #[serde(skip_serializing_if = "Option::is_none")]
621 zklogin_max_epoch_upper_bound_delta: Option<u64>,
622
623 #[serde(skip_serializing_if = "is_false")]
625 mysticeti_leader_scoring_and_schedule: bool,
626
627 #[serde(skip_serializing_if = "is_false")]
629 reshare_at_same_initial_version: bool,
630
631 #[serde(skip_serializing_if = "is_false")]
633 resolve_abort_locations_to_package_id: bool,
634
635 #[serde(skip_serializing_if = "is_false")]
639 mysticeti_use_committed_subdag_digest: bool,
640
641 #[serde(skip_serializing_if = "is_false")]
643 enable_vdf: bool,
644
645 #[serde(skip_serializing_if = "is_false")]
650 record_consensus_determined_version_assignments_in_prologue: bool,
651 #[serde(skip_serializing_if = "is_false")]
652 record_consensus_determined_version_assignments_in_prologue_v2: bool,
653
654 #[serde(skip_serializing_if = "is_false")]
656 fresh_vm_on_framework_upgrade: bool,
657
658 #[serde(skip_serializing_if = "is_false")]
666 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
667
668 #[serde(skip_serializing_if = "Option::is_none")]
670 mysticeti_num_leaders_per_round: Option<usize>,
671
672 #[serde(skip_serializing_if = "is_false")]
674 soft_bundle: bool,
675
676 #[serde(skip_serializing_if = "is_false")]
678 enable_coin_deny_list_v2: bool,
679
680 #[serde(skip_serializing_if = "is_false")]
682 passkey_auth: bool,
683
684 #[serde(skip_serializing_if = "is_false")]
686 authority_capabilities_v2: bool,
687
688 #[serde(skip_serializing_if = "is_false")]
690 rethrow_serialization_type_layout_errors: bool,
691
692 #[serde(skip_serializing_if = "is_false")]
694 consensus_distributed_vote_scoring_strategy: bool,
695
696 #[serde(skip_serializing_if = "is_false")]
698 consensus_round_prober: bool,
699
700 #[serde(skip_serializing_if = "is_false")]
702 validate_identifier_inputs: bool,
703
704 #[serde(skip_serializing_if = "is_false")]
706 disallow_self_identifier: bool,
707
708 #[serde(skip_serializing_if = "is_false")]
710 mysticeti_fastpath: bool,
711
712 #[serde(skip_serializing_if = "is_false")]
716 disable_preconsensus_locking: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 relocate_event_module: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 uncompressed_g1_group_elements: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
727 disallow_new_modules_in_deps_only_packages: bool,
728
729 #[serde(skip_serializing_if = "is_false")]
731 consensus_smart_ancestor_selection: bool,
732
733 #[serde(skip_serializing_if = "is_false")]
735 consensus_round_prober_probe_accepted_rounds: bool,
736
737 #[serde(skip_serializing_if = "is_false")]
739 native_charging_v2: bool,
740
741 #[serde(skip_serializing_if = "is_false")]
744 consensus_linearize_subdag_v2: bool,
745
746 #[serde(skip_serializing_if = "is_false")]
748 convert_type_argument_error: bool,
749
750 #[serde(skip_serializing_if = "is_false")]
752 variant_nodes: bool,
753
754 #[serde(skip_serializing_if = "is_false")]
756 consensus_zstd_compression: bool,
757
758 #[serde(skip_serializing_if = "is_false")]
760 minimize_child_object_mutations: bool,
761
762 #[serde(skip_serializing_if = "is_false")]
764 record_additional_state_digest_in_prologue: bool,
765
766 #[serde(skip_serializing_if = "is_false")]
768 move_native_context: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
773 consensus_median_based_commit_timestamp: bool,
774
775 #[serde(skip_serializing_if = "is_false")]
778 normalize_ptb_arguments: bool,
779
780 #[serde(skip_serializing_if = "is_false")]
782 consensus_batched_block_sync: bool,
783
784 #[serde(skip_serializing_if = "is_false")]
786 enforce_checkpoint_timestamp_monotonicity: bool,
787
788 #[serde(skip_serializing_if = "is_false")]
790 max_ptb_value_size_v2: bool,
791
792 #[serde(skip_serializing_if = "is_false")]
794 resolve_type_input_ids_to_defining_id: bool,
795
796 #[serde(skip_serializing_if = "is_false")]
798 enable_party_transfer: bool,
799
800 #[serde(skip_serializing_if = "is_false")]
802 allow_unbounded_system_objects: bool,
803
804 #[serde(skip_serializing_if = "is_false")]
806 type_tags_in_object_runtime: bool,
807
808 #[serde(skip_serializing_if = "is_false")]
810 enable_accumulators: bool,
811
812 #[serde(skip_serializing_if = "is_false")]
814 enable_coin_reservation_obj_refs: bool,
815
816 #[serde(skip_serializing_if = "is_false")]
819 create_root_accumulator_object: bool,
820
821 #[serde(skip_serializing_if = "is_false")]
823 enable_authenticated_event_streams: bool,
824
825 #[serde(skip_serializing_if = "is_false")]
827 enable_address_balance_gas_payments: bool,
828
829 #[serde(skip_serializing_if = "is_false")]
831 address_balance_gas_check_rgp_at_signing: bool,
832
833 #[serde(skip_serializing_if = "is_false")]
834 address_balance_gas_reject_gas_coin_arg: bool,
835
836 #[serde(skip_serializing_if = "is_false")]
838 enable_multi_epoch_transaction_expiration: bool,
839
840 #[serde(skip_serializing_if = "is_false")]
842 relax_valid_during_for_owned_inputs: bool,
843
844 #[serde(skip_serializing_if = "is_false")]
846 enable_ptb_execution_v2: bool,
847
848 #[serde(skip_serializing_if = "is_false")]
850 better_adapter_type_resolution_errors: bool,
851
852 #[serde(skip_serializing_if = "is_false")]
854 record_time_estimate_processed: bool,
855
856 #[serde(skip_serializing_if = "is_false")]
858 dependency_linkage_error: bool,
859
860 #[serde(skip_serializing_if = "is_false")]
862 additional_multisig_checks: bool,
863
864 #[serde(skip_serializing_if = "is_false")]
866 ignore_execution_time_observations_after_certs_closed: bool,
867
868 #[serde(skip_serializing_if = "is_false")]
872 debug_fatal_on_move_invariant_violation: bool,
873
874 #[serde(skip_serializing_if = "is_false")]
877 allow_private_accumulator_entrypoints: bool,
878
879 #[serde(skip_serializing_if = "is_false")]
881 additional_consensus_digest_indirect_state: bool,
882
883 #[serde(skip_serializing_if = "is_false")]
885 check_for_init_during_upgrade: bool,
886
887 #[serde(skip_serializing_if = "is_false")]
889 per_command_shared_object_transfer_rules: bool,
890
891 #[serde(skip_serializing_if = "is_false")]
893 include_checkpoint_artifacts_digest_in_summary: bool,
894
895 #[serde(skip_serializing_if = "is_false")]
897 use_mfp_txns_in_load_initial_object_debts: bool,
898
899 #[serde(skip_serializing_if = "is_false")]
901 cancel_for_failed_dkg_early: bool,
902
903 #[serde(skip_serializing_if = "is_false")]
905 enable_coin_registry: bool,
906
907 #[serde(skip_serializing_if = "is_false")]
909 abstract_size_in_object_runtime: bool,
910
911 #[serde(skip_serializing_if = "is_false")]
913 object_runtime_charge_cache_load_gas: bool,
914
915 #[serde(skip_serializing_if = "is_false")]
917 additional_borrow_checks: bool,
918
919 #[serde(skip_serializing_if = "is_false")]
921 use_new_commit_handler: bool,
922
923 #[serde(skip_serializing_if = "is_false")]
925 better_loader_errors: bool,
926
927 #[serde(skip_serializing_if = "is_false")]
929 generate_df_type_layouts: bool,
930
931 #[serde(skip_serializing_if = "is_false")]
933 allow_references_in_ptbs: bool,
934
935 #[serde(skip_serializing_if = "is_false")]
937 enable_display_registry: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 private_generics_verifier_v2: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 deprecate_global_storage_ops_during_deserialization: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
950 enable_non_exclusive_writes: bool,
951
952 #[serde(skip_serializing_if = "is_false")]
954 deprecate_global_storage_ops: bool,
955
956 #[serde(skip_serializing_if = "is_false")]
958 normalize_depth_formula: bool,
959
960 #[serde(skip_serializing_if = "is_false")]
962 consensus_skip_gced_accept_votes: bool,
963
964 #[serde(skip_serializing_if = "is_false")]
966 include_cancelled_randomness_txns_in_prologue: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
970 address_aliases: bool,
971
972 #[serde(skip_serializing_if = "is_false")]
975 fix_checkpoint_signature_mapping: bool,
976
977 #[serde(skip_serializing_if = "is_false")]
979 enable_object_funds_withdraw: bool,
980
981 #[serde(skip_serializing_if = "is_false")]
983 consensus_skip_gced_blocks_in_direct_finalization: bool,
984
985 #[serde(skip_serializing_if = "is_false")]
987 gas_rounding_halve_digits: bool,
988
989 #[serde(skip_serializing_if = "is_false")]
991 flexible_tx_context_positions: bool,
992
993 #[serde(skip_serializing_if = "is_false")]
995 disable_entry_point_signature_check: bool,
996
997 #[serde(skip_serializing_if = "is_false")]
999 convert_withdrawal_compatibility_ptb_arguments: bool,
1000
1001 #[serde(skip_serializing_if = "is_false")]
1003 restrict_hot_or_not_entry_functions: bool,
1004
1005 #[serde(skip_serializing_if = "is_false")]
1007 split_checkpoints_in_consensus_handler: bool,
1008
1009 #[serde(skip_serializing_if = "is_false")]
1011 consensus_always_accept_system_transactions: bool,
1012
1013 #[serde(skip_serializing_if = "is_false")]
1015 validator_metadata_verify_v2: bool,
1016
1017 #[serde(skip_serializing_if = "is_false")]
1020 defer_unpaid_amplification: bool,
1021
1022 #[serde(skip_serializing_if = "is_false")]
1023 randomize_checkpoint_tx_limit_in_tests: bool,
1024
1025 #[serde(skip_serializing_if = "is_false")]
1027 gasless_transaction_drop_safety: bool,
1028
1029 #[serde(skip_serializing_if = "is_false")]
1031 new_vm_enabled: bool,
1032}
1033
1034fn is_false(b: &bool) -> bool {
1035 !b
1036}
1037
1038fn is_empty(b: &BTreeSet<String>) -> bool {
1039 b.is_empty()
1040}
1041
1042fn is_zero(val: &u64) -> bool {
1043 *val == 0
1044}
1045
1046#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1048pub enum ConsensusTransactionOrdering {
1049 #[default]
1051 None,
1052 ByGasPrice,
1054}
1055
1056impl ConsensusTransactionOrdering {
1057 pub fn is_none(&self) -> bool {
1058 matches!(self, ConsensusTransactionOrdering::None)
1059 }
1060}
1061
1062#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1063pub struct ExecutionTimeEstimateParams {
1064 pub target_utilization: u64,
1066 pub allowed_txn_cost_overage_burst_limit_us: u64,
1070
1071 pub randomness_scalar: u64,
1074
1075 pub max_estimate_us: u64,
1077
1078 pub stored_observations_num_included_checkpoints: u64,
1081
1082 pub stored_observations_limit: u64,
1084
1085 #[serde(skip_serializing_if = "is_zero")]
1088 pub stake_weighted_median_threshold: u64,
1089
1090 #[serde(skip_serializing_if = "is_false")]
1094 pub default_none_duration_for_new_keys: bool,
1095
1096 #[serde(skip_serializing_if = "Option::is_none")]
1098 pub observations_chunk_size: Option<u64>,
1099}
1100
1101#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1103pub enum PerObjectCongestionControlMode {
1104 #[default]
1105 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1111
1112impl PerObjectCongestionControlMode {
1113 pub fn is_none(&self) -> bool {
1114 matches!(self, PerObjectCongestionControlMode::None)
1115 }
1116}
1117
1118#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1120pub enum ConsensusChoice {
1121 #[default]
1122 Narwhal,
1123 SwapEachEpoch,
1124 Mysticeti,
1125}
1126
1127impl ConsensusChoice {
1128 pub fn is_narwhal(&self) -> bool {
1129 matches!(self, ConsensusChoice::Narwhal)
1130 }
1131}
1132
1133#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1135pub enum ConsensusNetwork {
1136 #[default]
1137 Anemo,
1138 Tonic,
1139}
1140
1141impl ConsensusNetwork {
1142 pub fn is_anemo(&self) -> bool {
1143 matches!(self, ConsensusNetwork::Anemo)
1144 }
1145}
1146
1147#[skip_serializing_none]
1179#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1180pub struct ProtocolConfig {
1181 pub version: ProtocolVersion,
1182
1183 feature_flags: FeatureFlags,
1184
1185 max_tx_size_bytes: Option<u64>,
1188
1189 max_input_objects: Option<u64>,
1191
1192 max_size_written_objects: Option<u64>,
1196 max_size_written_objects_system_tx: Option<u64>,
1199
1200 max_serialized_tx_effects_size_bytes: Option<u64>,
1202
1203 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1205
1206 max_gas_payment_objects: Option<u32>,
1208
1209 max_modules_in_publish: Option<u32>,
1211
1212 max_package_dependencies: Option<u32>,
1214
1215 max_arguments: Option<u32>,
1218
1219 max_type_arguments: Option<u32>,
1221
1222 max_type_argument_depth: Option<u32>,
1224
1225 max_pure_argument_size: Option<u32>,
1227
1228 max_programmable_tx_commands: Option<u32>,
1230
1231 move_binary_format_version: Option<u32>,
1234 min_move_binary_format_version: Option<u32>,
1235
1236 binary_module_handles: Option<u16>,
1238 binary_struct_handles: Option<u16>,
1239 binary_function_handles: Option<u16>,
1240 binary_function_instantiations: Option<u16>,
1241 binary_signatures: Option<u16>,
1242 binary_constant_pool: Option<u16>,
1243 binary_identifiers: Option<u16>,
1244 binary_address_identifiers: Option<u16>,
1245 binary_struct_defs: Option<u16>,
1246 binary_struct_def_instantiations: Option<u16>,
1247 binary_function_defs: Option<u16>,
1248 binary_field_handles: Option<u16>,
1249 binary_field_instantiations: Option<u16>,
1250 binary_friend_decls: Option<u16>,
1251 binary_enum_defs: Option<u16>,
1252 binary_enum_def_instantiations: Option<u16>,
1253 binary_variant_handles: Option<u16>,
1254 binary_variant_instantiation_handles: Option<u16>,
1255
1256 max_move_object_size: Option<u64>,
1258
1259 max_move_package_size: Option<u64>,
1262
1263 max_publish_or_upgrade_per_ptb: Option<u64>,
1265
1266 max_tx_gas: Option<u64>,
1268
1269 max_gas_price: Option<u64>,
1271
1272 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1275
1276 max_gas_computation_bucket: Option<u64>,
1278
1279 gas_rounding_step: Option<u64>,
1281
1282 max_loop_depth: Option<u64>,
1284
1285 max_generic_instantiation_length: Option<u64>,
1287
1288 max_function_parameters: Option<u64>,
1290
1291 max_basic_blocks: Option<u64>,
1293
1294 max_value_stack_size: Option<u64>,
1296
1297 max_type_nodes: Option<u64>,
1299
1300 max_push_size: Option<u64>,
1302
1303 max_struct_definitions: Option<u64>,
1305
1306 max_function_definitions: Option<u64>,
1308
1309 max_fields_in_struct: Option<u64>,
1311
1312 max_dependency_depth: Option<u64>,
1314
1315 max_num_event_emit: Option<u64>,
1317
1318 max_num_new_move_object_ids: Option<u64>,
1320
1321 max_num_new_move_object_ids_system_tx: Option<u64>,
1323
1324 max_num_deleted_move_object_ids: Option<u64>,
1326
1327 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1329
1330 max_num_transferred_move_object_ids: Option<u64>,
1332
1333 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1335
1336 max_event_emit_size: Option<u64>,
1338
1339 max_event_emit_size_total: Option<u64>,
1341
1342 max_move_vector_len: Option<u64>,
1344
1345 max_move_identifier_len: Option<u64>,
1347
1348 max_move_value_depth: Option<u64>,
1350
1351 max_move_enum_variants: Option<u64>,
1353
1354 max_back_edges_per_function: Option<u64>,
1356
1357 max_back_edges_per_module: Option<u64>,
1359
1360 max_verifier_meter_ticks_per_function: Option<u64>,
1362
1363 max_meter_ticks_per_module: Option<u64>,
1365
1366 max_meter_ticks_per_package: Option<u64>,
1368
1369 object_runtime_max_num_cached_objects: Option<u64>,
1373
1374 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1376
1377 object_runtime_max_num_store_entries: Option<u64>,
1379
1380 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1382
1383 base_tx_cost_fixed: Option<u64>,
1386
1387 package_publish_cost_fixed: Option<u64>,
1390
1391 base_tx_cost_per_byte: Option<u64>,
1394
1395 package_publish_cost_per_byte: Option<u64>,
1397
1398 obj_access_cost_read_per_byte: Option<u64>,
1400
1401 obj_access_cost_mutate_per_byte: Option<u64>,
1403
1404 obj_access_cost_delete_per_byte: Option<u64>,
1406
1407 obj_access_cost_verify_per_byte: Option<u64>,
1417
1418 max_type_to_layout_nodes: Option<u64>,
1420
1421 max_ptb_value_size: Option<u64>,
1423
1424 gas_model_version: Option<u64>,
1427
1428 obj_data_cost_refundable: Option<u64>,
1431
1432 obj_metadata_cost_non_refundable: Option<u64>,
1436
1437 storage_rebate_rate: Option<u64>,
1443
1444 storage_fund_reinvest_rate: Option<u64>,
1447
1448 reward_slashing_rate: Option<u64>,
1451
1452 storage_gas_price: Option<u64>,
1454
1455 accumulator_object_storage_cost: Option<u64>,
1457
1458 max_transactions_per_checkpoint: Option<u64>,
1463
1464 max_checkpoint_size_bytes: Option<u64>,
1468
1469 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1474
1475 address_from_bytes_cost_base: Option<u64>,
1480 address_to_u256_cost_base: Option<u64>,
1482 address_from_u256_cost_base: Option<u64>,
1484
1485 config_read_setting_impl_cost_base: Option<u64>,
1490 config_read_setting_impl_cost_per_byte: Option<u64>,
1491
1492 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1495 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1496 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1497 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1498 dynamic_field_add_child_object_cost_base: Option<u64>,
1500 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1501 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1502 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1503 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1505 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1506 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1507 dynamic_field_remove_child_object_cost_base: Option<u64>,
1509 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1510 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1511 dynamic_field_has_child_object_cost_base: Option<u64>,
1513 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1515 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1516 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1517
1518 event_emit_cost_base: Option<u64>,
1521 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1522 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1523 event_emit_output_cost_per_byte: Option<u64>,
1524 event_emit_auth_stream_cost: Option<u64>,
1525
1526 object_borrow_uid_cost_base: Option<u64>,
1529 object_delete_impl_cost_base: Option<u64>,
1531 object_record_new_uid_cost_base: Option<u64>,
1533
1534 transfer_transfer_internal_cost_base: Option<u64>,
1537 transfer_party_transfer_internal_cost_base: Option<u64>,
1539 transfer_freeze_object_cost_base: Option<u64>,
1541 transfer_share_object_cost_base: Option<u64>,
1543 transfer_receive_object_cost_base: Option<u64>,
1546
1547 tx_context_derive_id_cost_base: Option<u64>,
1550 tx_context_fresh_id_cost_base: Option<u64>,
1551 tx_context_sender_cost_base: Option<u64>,
1552 tx_context_epoch_cost_base: Option<u64>,
1553 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1554 tx_context_sponsor_cost_base: Option<u64>,
1555 tx_context_rgp_cost_base: Option<u64>,
1556 tx_context_gas_price_cost_base: Option<u64>,
1557 tx_context_gas_budget_cost_base: Option<u64>,
1558 tx_context_ids_created_cost_base: Option<u64>,
1559 tx_context_replace_cost_base: Option<u64>,
1560
1561 types_is_one_time_witness_cost_base: Option<u64>,
1564 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1565 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1566
1567 validator_validate_metadata_cost_base: Option<u64>,
1570 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1571
1572 crypto_invalid_arguments_cost: Option<u64>,
1574 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1576 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1577 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1578
1579 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1581 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1582 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1583
1584 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1586 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1587 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1588 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1589 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1590 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1591
1592 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1594
1595 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1597 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1598 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1599 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1600 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1601 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1602
1603 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1605 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1606 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1607 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1608 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1609 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1610
1611 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1613 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1614 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1615 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1616 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1617 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1618
1619 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1621 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1622 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1623
1624 ed25519_ed25519_verify_cost_base: Option<u64>,
1626 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1627 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1628
1629 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1631 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1632
1633 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1635 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1636 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1637 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1638 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1639
1640 hash_blake2b256_cost_base: Option<u64>,
1642 hash_blake2b256_data_cost_per_byte: Option<u64>,
1643 hash_blake2b256_data_cost_per_block: Option<u64>,
1644
1645 hash_keccak256_cost_base: Option<u64>,
1647 hash_keccak256_data_cost_per_byte: Option<u64>,
1648 hash_keccak256_data_cost_per_block: Option<u64>,
1649
1650 poseidon_bn254_cost_base: Option<u64>,
1652 poseidon_bn254_cost_per_block: Option<u64>,
1653
1654 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1656 group_ops_bls12381_decode_g1_cost: Option<u64>,
1657 group_ops_bls12381_decode_g2_cost: Option<u64>,
1658 group_ops_bls12381_decode_gt_cost: Option<u64>,
1659 group_ops_bls12381_scalar_add_cost: Option<u64>,
1660 group_ops_bls12381_g1_add_cost: Option<u64>,
1661 group_ops_bls12381_g2_add_cost: Option<u64>,
1662 group_ops_bls12381_gt_add_cost: Option<u64>,
1663 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1664 group_ops_bls12381_g1_sub_cost: Option<u64>,
1665 group_ops_bls12381_g2_sub_cost: Option<u64>,
1666 group_ops_bls12381_gt_sub_cost: Option<u64>,
1667 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1668 group_ops_bls12381_g1_mul_cost: Option<u64>,
1669 group_ops_bls12381_g2_mul_cost: Option<u64>,
1670 group_ops_bls12381_gt_mul_cost: Option<u64>,
1671 group_ops_bls12381_scalar_div_cost: Option<u64>,
1672 group_ops_bls12381_g1_div_cost: Option<u64>,
1673 group_ops_bls12381_g2_div_cost: Option<u64>,
1674 group_ops_bls12381_gt_div_cost: Option<u64>,
1675 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1676 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1677 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1678 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1679 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1680 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1681 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1682 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1683 group_ops_bls12381_msm_max_len: Option<u32>,
1684 group_ops_bls12381_pairing_cost: Option<u64>,
1685 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1686 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1687 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1688 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1689 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1690
1691 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1692 group_ops_ristretto_decode_point_cost: Option<u64>,
1693 group_ops_ristretto_scalar_add_cost: Option<u64>,
1694 group_ops_ristretto_point_add_cost: Option<u64>,
1695 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1696 group_ops_ristretto_point_sub_cost: Option<u64>,
1697 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1698 group_ops_ristretto_point_mul_cost: Option<u64>,
1699 group_ops_ristretto_scalar_div_cost: Option<u64>,
1700 group_ops_ristretto_point_div_cost: Option<u64>,
1701
1702 hmac_hmac_sha3_256_cost_base: Option<u64>,
1704 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1705 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1706
1707 check_zklogin_id_cost_base: Option<u64>,
1709 check_zklogin_issuer_cost_base: Option<u64>,
1711
1712 vdf_verify_vdf_cost: Option<u64>,
1713 vdf_hash_to_input_cost: Option<u64>,
1714
1715 nitro_attestation_parse_base_cost: Option<u64>,
1717 nitro_attestation_parse_cost_per_byte: Option<u64>,
1718 nitro_attestation_verify_base_cost: Option<u64>,
1719 nitro_attestation_verify_cost_per_cert: Option<u64>,
1720
1721 bcs_per_byte_serialized_cost: Option<u64>,
1723 bcs_legacy_min_output_size_cost: Option<u64>,
1724 bcs_failure_cost: Option<u64>,
1725
1726 hash_sha2_256_base_cost: Option<u64>,
1727 hash_sha2_256_per_byte_cost: Option<u64>,
1728 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1729 hash_sha3_256_base_cost: Option<u64>,
1730 hash_sha3_256_per_byte_cost: Option<u64>,
1731 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1732 type_name_get_base_cost: Option<u64>,
1733 type_name_get_per_byte_cost: Option<u64>,
1734 type_name_id_base_cost: Option<u64>,
1735
1736 string_check_utf8_base_cost: Option<u64>,
1737 string_check_utf8_per_byte_cost: Option<u64>,
1738 string_is_char_boundary_base_cost: Option<u64>,
1739 string_sub_string_base_cost: Option<u64>,
1740 string_sub_string_per_byte_cost: Option<u64>,
1741 string_index_of_base_cost: Option<u64>,
1742 string_index_of_per_byte_pattern_cost: Option<u64>,
1743 string_index_of_per_byte_searched_cost: Option<u64>,
1744
1745 vector_empty_base_cost: Option<u64>,
1746 vector_length_base_cost: Option<u64>,
1747 vector_push_back_base_cost: Option<u64>,
1748 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1749 vector_borrow_base_cost: Option<u64>,
1750 vector_pop_back_base_cost: Option<u64>,
1751 vector_destroy_empty_base_cost: Option<u64>,
1752 vector_swap_base_cost: Option<u64>,
1753 debug_print_base_cost: Option<u64>,
1754 debug_print_stack_trace_base_cost: Option<u64>,
1755
1756 execution_version: Option<u64>,
1765
1766 consensus_bad_nodes_stake_threshold: Option<u64>,
1770
1771 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1772 max_age_of_jwk_in_epochs: Option<u64>,
1776
1777 random_beacon_reduction_allowed_delta: Option<u16>,
1781
1782 random_beacon_reduction_lower_bound: Option<u32>,
1785
1786 random_beacon_dkg_timeout_round: Option<u32>,
1789
1790 random_beacon_min_round_interval_ms: Option<u64>,
1792
1793 random_beacon_dkg_version: Option<u64>,
1796
1797 consensus_max_transaction_size_bytes: Option<u64>,
1800 consensus_max_transactions_in_block_bytes: Option<u64>,
1802 consensus_max_num_transactions_in_block: Option<u64>,
1804
1805 consensus_voting_rounds: Option<u32>,
1807
1808 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1810
1811 max_deferral_rounds_for_congestion_control: Option<u64>,
1814
1815 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1817
1818 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1820
1821 min_checkpoint_interval_ms: Option<u64>,
1823
1824 checkpoint_summary_version_specific_data: Option<u64>,
1826
1827 max_soft_bundle_size: Option<u64>,
1829
1830 bridge_should_try_to_finalize_committee: Option<bool>,
1834
1835 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1841
1842 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1845
1846 consensus_gc_depth: Option<u32>,
1849
1850 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1852
1853 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1855
1856 sip_45_consensus_amplification_threshold: Option<u64>,
1859
1860 use_object_per_epoch_marker_table_v2: Option<bool>,
1863
1864 consensus_commit_rate_estimation_window_size: Option<u32>,
1866
1867 #[serde(skip_serializing_if = "Vec::is_empty")]
1871 aliased_addresses: Vec<AliasedAddress>,
1872
1873 translation_per_command_base_charge: Option<u64>,
1876
1877 translation_per_input_base_charge: Option<u64>,
1880
1881 translation_pure_input_per_byte_charge: Option<u64>,
1883
1884 translation_per_type_node_charge: Option<u64>,
1888
1889 translation_per_reference_node_charge: Option<u64>,
1892
1893 translation_per_linkage_entry_charge: Option<u64>,
1896
1897 max_updates_per_settlement_txn: Option<u32>,
1899}
1900
1901#[derive(Clone, Serialize, Deserialize, Debug)]
1903pub struct AliasedAddress {
1904 pub original: [u8; 32],
1906 pub aliased: [u8; 32],
1908 pub allowed_tx_digests: Vec<[u8; 32]>,
1910}
1911
1912impl ProtocolConfig {
1914 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1927 if self.feature_flags.package_upgrades {
1928 Ok(())
1929 } else {
1930 Err(Error(format!(
1931 "package upgrades are not supported at {:?}",
1932 self.version
1933 )))
1934 }
1935 }
1936
1937 pub fn allow_receiving_object_id(&self) -> bool {
1938 self.feature_flags.allow_receiving_object_id
1939 }
1940
1941 pub fn receiving_objects_supported(&self) -> bool {
1942 self.feature_flags.receive_objects
1943 }
1944
1945 pub fn package_upgrades_supported(&self) -> bool {
1946 self.feature_flags.package_upgrades
1947 }
1948
1949 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1950 self.feature_flags.commit_root_state_digest
1951 }
1952
1953 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1954 self.feature_flags.advance_epoch_start_time_in_safe_mode
1955 }
1956
1957 pub fn loaded_child_objects_fixed(&self) -> bool {
1958 self.feature_flags.loaded_child_objects_fixed
1959 }
1960
1961 pub fn missing_type_is_compatibility_error(&self) -> bool {
1962 self.feature_flags.missing_type_is_compatibility_error
1963 }
1964
1965 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1966 self.feature_flags.scoring_decision_with_validity_cutoff
1967 }
1968
1969 pub fn narwhal_versioned_metadata(&self) -> bool {
1970 self.feature_flags.narwhal_versioned_metadata
1971 }
1972
1973 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1974 self.feature_flags.consensus_order_end_of_epoch_last
1975 }
1976
1977 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1978 self.feature_flags.disallow_adding_abilities_on_upgrade
1979 }
1980
1981 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1982 self.feature_flags
1983 .disable_invariant_violation_check_in_swap_loc
1984 }
1985
1986 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1987 self.feature_flags
1988 .advance_to_highest_supported_protocol_version
1989 }
1990
1991 pub fn ban_entry_init(&self) -> bool {
1992 self.feature_flags.ban_entry_init
1993 }
1994
1995 pub fn package_digest_hash_module(&self) -> bool {
1996 self.feature_flags.package_digest_hash_module
1997 }
1998
1999 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2000 self.feature_flags
2001 .disallow_change_struct_type_params_on_upgrade
2002 }
2003
2004 pub fn no_extraneous_module_bytes(&self) -> bool {
2005 self.feature_flags.no_extraneous_module_bytes
2006 }
2007
2008 pub fn zklogin_auth(&self) -> bool {
2009 self.feature_flags.zklogin_auth
2010 }
2011
2012 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2013 &self.feature_flags.zklogin_supported_providers
2014 }
2015
2016 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2017 self.feature_flags.consensus_transaction_ordering
2018 }
2019
2020 pub fn simplified_unwrap_then_delete(&self) -> bool {
2021 self.feature_flags.simplified_unwrap_then_delete
2022 }
2023
2024 pub fn supports_upgraded_multisig(&self) -> bool {
2025 self.feature_flags.upgraded_multisig_supported
2026 }
2027
2028 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2029 self.feature_flags.txn_base_cost_as_multiplier
2030 }
2031
2032 pub fn shared_object_deletion(&self) -> bool {
2033 self.feature_flags.shared_object_deletion
2034 }
2035
2036 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2037 self.feature_flags.narwhal_new_leader_election_schedule
2038 }
2039
2040 pub fn loaded_child_object_format(&self) -> bool {
2041 self.feature_flags.loaded_child_object_format
2042 }
2043
2044 pub fn enable_jwk_consensus_updates(&self) -> bool {
2045 let ret = self.feature_flags.enable_jwk_consensus_updates;
2046 if ret {
2047 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2049 }
2050 ret
2051 }
2052
2053 pub fn simple_conservation_checks(&self) -> bool {
2054 self.feature_flags.simple_conservation_checks
2055 }
2056
2057 pub fn loaded_child_object_format_type(&self) -> bool {
2058 self.feature_flags.loaded_child_object_format_type
2059 }
2060
2061 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2062 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2063 if !ret {
2064 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2066 }
2067 ret
2068 }
2069
2070 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2071 self.feature_flags
2072 .recompute_has_public_transfer_in_execution
2073 }
2074
2075 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2077 self.enable_jwk_consensus_updates()
2078 }
2079
2080 pub fn random_beacon(&self) -> bool {
2081 self.feature_flags.random_beacon
2082 }
2083
2084 pub fn dkg_version(&self) -> u64 {
2085 self.random_beacon_dkg_version.unwrap_or(1)
2087 }
2088
2089 pub fn enable_bridge(&self) -> bool {
2090 let ret = self.feature_flags.bridge;
2091 if ret {
2092 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2094 }
2095 ret
2096 }
2097
2098 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2099 if !self.enable_bridge() {
2100 return false;
2101 }
2102 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2104 }
2105
2106 pub fn enable_effects_v2(&self) -> bool {
2107 self.feature_flags.enable_effects_v2
2108 }
2109
2110 pub fn narwhal_certificate_v2(&self) -> bool {
2111 self.feature_flags.narwhal_certificate_v2
2112 }
2113
2114 pub fn verify_legacy_zklogin_address(&self) -> bool {
2115 self.feature_flags.verify_legacy_zklogin_address
2116 }
2117
2118 pub fn accept_zklogin_in_multisig(&self) -> bool {
2119 self.feature_flags.accept_zklogin_in_multisig
2120 }
2121
2122 pub fn accept_passkey_in_multisig(&self) -> bool {
2123 self.feature_flags.accept_passkey_in_multisig
2124 }
2125
2126 pub fn validate_zklogin_public_identifier(&self) -> bool {
2127 self.feature_flags.validate_zklogin_public_identifier
2128 }
2129
2130 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2131 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2132 }
2133
2134 pub fn throughput_aware_consensus_submission(&self) -> bool {
2135 self.feature_flags.throughput_aware_consensus_submission
2136 }
2137
2138 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2139 self.feature_flags.include_consensus_digest_in_prologue
2140 }
2141
2142 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2143 self.feature_flags
2144 .record_consensus_determined_version_assignments_in_prologue
2145 }
2146
2147 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2148 self.feature_flags
2149 .record_additional_state_digest_in_prologue
2150 }
2151
2152 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2153 self.feature_flags
2154 .record_consensus_determined_version_assignments_in_prologue_v2
2155 }
2156
2157 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2158 self.feature_flags
2159 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2160 }
2161
2162 pub fn hardened_otw_check(&self) -> bool {
2163 self.feature_flags.hardened_otw_check
2164 }
2165
2166 pub fn enable_poseidon(&self) -> bool {
2167 self.feature_flags.enable_poseidon
2168 }
2169
2170 pub fn enable_coin_deny_list_v1(&self) -> bool {
2171 self.feature_flags.enable_coin_deny_list
2172 }
2173
2174 pub fn enable_accumulators(&self) -> bool {
2175 self.feature_flags.enable_accumulators
2176 }
2177
2178 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2179 self.feature_flags.enable_coin_reservation_obj_refs
2180 }
2181
2182 pub fn create_root_accumulator_object(&self) -> bool {
2183 self.feature_flags.create_root_accumulator_object
2184 }
2185
2186 pub fn enable_address_balance_gas_payments(&self) -> bool {
2187 self.feature_flags.enable_address_balance_gas_payments
2188 }
2189
2190 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2191 self.feature_flags.address_balance_gas_check_rgp_at_signing
2192 }
2193
2194 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2195 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2196 }
2197
2198 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2199 self.feature_flags.enable_multi_epoch_transaction_expiration
2200 }
2201
2202 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2203 self.feature_flags.relax_valid_during_for_owned_inputs
2204 }
2205
2206 pub fn enable_authenticated_event_streams(&self) -> bool {
2207 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2208 }
2209
2210 pub fn enable_non_exclusive_writes(&self) -> bool {
2211 self.feature_flags.enable_non_exclusive_writes
2212 }
2213
2214 pub fn enable_coin_registry(&self) -> bool {
2215 self.feature_flags.enable_coin_registry
2216 }
2217
2218 pub fn enable_display_registry(&self) -> bool {
2219 self.feature_flags.enable_display_registry
2220 }
2221
2222 pub fn enable_coin_deny_list_v2(&self) -> bool {
2223 self.feature_flags.enable_coin_deny_list_v2
2224 }
2225
2226 pub fn enable_group_ops_native_functions(&self) -> bool {
2227 self.feature_flags.enable_group_ops_native_functions
2228 }
2229
2230 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2231 self.feature_flags.enable_group_ops_native_function_msm
2232 }
2233
2234 pub fn enable_ristretto255_group_ops(&self) -> bool {
2235 self.feature_flags.enable_ristretto255_group_ops
2236 }
2237
2238 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2239 self.feature_flags.reject_mutable_random_on_entry_functions
2240 }
2241
2242 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2243 self.feature_flags.per_object_congestion_control_mode
2244 }
2245
2246 pub fn consensus_choice(&self) -> ConsensusChoice {
2247 self.feature_flags.consensus_choice
2248 }
2249
2250 pub fn consensus_network(&self) -> ConsensusNetwork {
2251 self.feature_flags.consensus_network
2252 }
2253
2254 pub fn correct_gas_payment_limit_check(&self) -> bool {
2255 self.feature_flags.correct_gas_payment_limit_check
2256 }
2257
2258 pub fn reshare_at_same_initial_version(&self) -> bool {
2259 self.feature_flags.reshare_at_same_initial_version
2260 }
2261
2262 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2263 self.feature_flags.resolve_abort_locations_to_package_id
2264 }
2265
2266 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2267 self.feature_flags.mysticeti_use_committed_subdag_digest
2268 }
2269
2270 pub fn enable_vdf(&self) -> bool {
2271 self.feature_flags.enable_vdf
2272 }
2273
2274 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2275 self.feature_flags.fresh_vm_on_framework_upgrade
2276 }
2277
2278 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2279 self.feature_flags.mysticeti_num_leaders_per_round
2280 }
2281
2282 pub fn soft_bundle(&self) -> bool {
2283 self.feature_flags.soft_bundle
2284 }
2285
2286 pub fn passkey_auth(&self) -> bool {
2287 self.feature_flags.passkey_auth
2288 }
2289
2290 pub fn authority_capabilities_v2(&self) -> bool {
2291 self.feature_flags.authority_capabilities_v2
2292 }
2293
2294 pub fn max_transaction_size_bytes(&self) -> u64 {
2295 self.consensus_max_transaction_size_bytes
2297 .unwrap_or(256 * 1024)
2298 }
2299
2300 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2301 if cfg!(msim) {
2302 256 * 1024
2303 } else {
2304 self.consensus_max_transactions_in_block_bytes
2305 .unwrap_or(512 * 1024)
2306 }
2307 }
2308
2309 pub fn max_num_transactions_in_block(&self) -> u64 {
2310 if cfg!(msim) {
2311 8
2312 } else {
2313 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2314 }
2315 }
2316
2317 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2318 self.feature_flags.rethrow_serialization_type_layout_errors
2319 }
2320
2321 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2322 self.feature_flags
2323 .consensus_distributed_vote_scoring_strategy
2324 }
2325
2326 pub fn consensus_round_prober(&self) -> bool {
2327 self.feature_flags.consensus_round_prober
2328 }
2329
2330 pub fn validate_identifier_inputs(&self) -> bool {
2331 self.feature_flags.validate_identifier_inputs
2332 }
2333
2334 pub fn gc_depth(&self) -> u32 {
2335 self.consensus_gc_depth.unwrap_or(0)
2336 }
2337
2338 pub fn mysticeti_fastpath(&self) -> bool {
2339 self.feature_flags.mysticeti_fastpath
2340 }
2341
2342 pub fn relocate_event_module(&self) -> bool {
2343 self.feature_flags.relocate_event_module
2344 }
2345
2346 pub fn uncompressed_g1_group_elements(&self) -> bool {
2347 self.feature_flags.uncompressed_g1_group_elements
2348 }
2349
2350 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2351 self.feature_flags
2352 .disallow_new_modules_in_deps_only_packages
2353 }
2354
2355 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2356 self.feature_flags.consensus_smart_ancestor_selection
2357 }
2358
2359 pub fn disable_preconsensus_locking(&self) -> bool {
2360 self.feature_flags.disable_preconsensus_locking
2361 }
2362
2363 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2364 self.feature_flags
2365 .consensus_round_prober_probe_accepted_rounds
2366 }
2367
2368 pub fn native_charging_v2(&self) -> bool {
2369 self.feature_flags.native_charging_v2
2370 }
2371
2372 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2373 let res = self.feature_flags.consensus_linearize_subdag_v2;
2374 assert!(
2375 !res || self.gc_depth() > 0,
2376 "The consensus linearize sub dag V2 requires GC to be enabled"
2377 );
2378 res
2379 }
2380
2381 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2382 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2383 assert!(
2384 !res || self.gc_depth() > 0,
2385 "The consensus median based commit timestamp requires GC to be enabled"
2386 );
2387 res
2388 }
2389
2390 pub fn consensus_batched_block_sync(&self) -> bool {
2391 self.feature_flags.consensus_batched_block_sync
2392 }
2393
2394 pub fn convert_type_argument_error(&self) -> bool {
2395 self.feature_flags.convert_type_argument_error
2396 }
2397
2398 pub fn variant_nodes(&self) -> bool {
2399 self.feature_flags.variant_nodes
2400 }
2401
2402 pub fn consensus_zstd_compression(&self) -> bool {
2403 self.feature_flags.consensus_zstd_compression
2404 }
2405
2406 pub fn enable_nitro_attestation(&self) -> bool {
2407 self.feature_flags.enable_nitro_attestation
2408 }
2409
2410 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2411 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2412 }
2413
2414 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2415 self.feature_flags
2416 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2417 }
2418
2419 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2420 self.feature_flags
2421 .enable_nitro_attestation_always_include_required_pcrs_parsing
2422 }
2423
2424 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2425 self.consensus_commit_rate_estimation_window_size
2426 .unwrap_or(0)
2427 }
2428
2429 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2430 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2434 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2436 window_size
2437 }
2438
2439 pub fn minimize_child_object_mutations(&self) -> bool {
2440 self.feature_flags.minimize_child_object_mutations
2441 }
2442
2443 pub fn move_native_context(&self) -> bool {
2444 self.feature_flags.move_native_context
2445 }
2446
2447 pub fn normalize_ptb_arguments(&self) -> bool {
2448 self.feature_flags.normalize_ptb_arguments
2449 }
2450
2451 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2452 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2453 }
2454
2455 pub fn max_ptb_value_size_v2(&self) -> bool {
2456 self.feature_flags.max_ptb_value_size_v2
2457 }
2458
2459 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2460 self.feature_flags.resolve_type_input_ids_to_defining_id
2461 }
2462
2463 pub fn enable_party_transfer(&self) -> bool {
2464 self.feature_flags.enable_party_transfer
2465 }
2466
2467 pub fn allow_unbounded_system_objects(&self) -> bool {
2468 self.feature_flags.allow_unbounded_system_objects
2469 }
2470
2471 pub fn type_tags_in_object_runtime(&self) -> bool {
2472 self.feature_flags.type_tags_in_object_runtime
2473 }
2474
2475 pub fn enable_ptb_execution_v2(&self) -> bool {
2476 self.feature_flags.enable_ptb_execution_v2
2477 }
2478
2479 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2480 self.feature_flags.better_adapter_type_resolution_errors
2481 }
2482
2483 pub fn record_time_estimate_processed(&self) -> bool {
2484 self.feature_flags.record_time_estimate_processed
2485 }
2486
2487 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2488 self.feature_flags
2489 .ignore_execution_time_observations_after_certs_closed
2490 }
2491
2492 pub fn dependency_linkage_error(&self) -> bool {
2493 self.feature_flags.dependency_linkage_error
2494 }
2495
2496 pub fn additional_multisig_checks(&self) -> bool {
2497 self.feature_flags.additional_multisig_checks
2498 }
2499
2500 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2501 self.feature_flags.debug_fatal_on_move_invariant_violation
2502 }
2503
2504 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2505 self.feature_flags.allow_private_accumulator_entrypoints
2506 }
2507
2508 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2509 self.feature_flags
2510 .additional_consensus_digest_indirect_state
2511 }
2512
2513 pub fn check_for_init_during_upgrade(&self) -> bool {
2514 self.feature_flags.check_for_init_during_upgrade
2515 }
2516
2517 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2518 self.feature_flags.per_command_shared_object_transfer_rules
2519 }
2520
2521 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2522 self.feature_flags
2523 .consensus_checkpoint_signature_key_includes_digest
2524 }
2525
2526 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2527 self.feature_flags
2528 .include_checkpoint_artifacts_digest_in_summary
2529 }
2530
2531 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2532 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2533 }
2534
2535 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2536 self.feature_flags.cancel_for_failed_dkg_early
2537 }
2538
2539 pub fn abstract_size_in_object_runtime(&self) -> bool {
2540 self.feature_flags.abstract_size_in_object_runtime
2541 }
2542
2543 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2544 self.feature_flags.object_runtime_charge_cache_load_gas
2545 }
2546
2547 pub fn additional_borrow_checks(&self) -> bool {
2548 self.feature_flags.additional_borrow_checks
2549 }
2550
2551 pub fn use_new_commit_handler(&self) -> bool {
2552 self.feature_flags.use_new_commit_handler
2553 }
2554
2555 pub fn better_loader_errors(&self) -> bool {
2556 self.feature_flags.better_loader_errors
2557 }
2558
2559 pub fn generate_df_type_layouts(&self) -> bool {
2560 self.feature_flags.generate_df_type_layouts
2561 }
2562
2563 pub fn allow_references_in_ptbs(&self) -> bool {
2564 self.feature_flags.allow_references_in_ptbs
2565 }
2566
2567 pub fn private_generics_verifier_v2(&self) -> bool {
2568 self.feature_flags.private_generics_verifier_v2
2569 }
2570
2571 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2572 self.feature_flags
2573 .deprecate_global_storage_ops_during_deserialization
2574 }
2575
2576 pub fn enable_observation_chunking(&self) -> bool {
2577 matches!(self.feature_flags.per_object_congestion_control_mode,
2578 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2579 if params.observations_chunk_size.is_some()
2580 )
2581 }
2582
2583 pub fn deprecate_global_storage_ops(&self) -> bool {
2584 self.feature_flags.deprecate_global_storage_ops
2585 }
2586
2587 pub fn normalize_depth_formula(&self) -> bool {
2588 self.feature_flags.normalize_depth_formula
2589 }
2590
2591 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2592 self.feature_flags.consensus_skip_gced_accept_votes
2593 }
2594
2595 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2596 self.feature_flags
2597 .include_cancelled_randomness_txns_in_prologue
2598 }
2599
2600 pub fn address_aliases(&self) -> bool {
2601 let address_aliases = self.feature_flags.address_aliases;
2602 assert!(
2603 !address_aliases || self.mysticeti_fastpath(),
2604 "Address aliases requires Mysticeti fastpath to be enabled"
2605 );
2606 if address_aliases {
2607 assert!(
2608 self.feature_flags.disable_preconsensus_locking,
2609 "Address aliases requires CertifiedTransaction to be disabled"
2610 );
2611 }
2612 address_aliases
2613 }
2614
2615 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2616 self.feature_flags.fix_checkpoint_signature_mapping
2617 }
2618
2619 pub fn enable_object_funds_withdraw(&self) -> bool {
2620 self.feature_flags.enable_object_funds_withdraw
2621 }
2622
2623 pub fn gas_rounding_halve_digits(&self) -> bool {
2624 self.feature_flags.gas_rounding_halve_digits
2625 }
2626
2627 pub fn flexible_tx_context_positions(&self) -> bool {
2628 self.feature_flags.flexible_tx_context_positions
2629 }
2630
2631 pub fn disable_entry_point_signature_check(&self) -> bool {
2632 self.feature_flags.disable_entry_point_signature_check
2633 }
2634
2635 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2636 self.feature_flags
2637 .consensus_skip_gced_blocks_in_direct_finalization
2638 }
2639
2640 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2641 self.feature_flags
2642 .convert_withdrawal_compatibility_ptb_arguments
2643 }
2644
2645 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2646 self.feature_flags.restrict_hot_or_not_entry_functions
2647 }
2648
2649 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2650 self.feature_flags.split_checkpoints_in_consensus_handler
2651 }
2652
2653 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2654 self.feature_flags
2655 .consensus_always_accept_system_transactions
2656 }
2657
2658 pub fn validator_metadata_verify_v2(&self) -> bool {
2659 self.feature_flags.validator_metadata_verify_v2
2660 }
2661
2662 pub fn defer_unpaid_amplification(&self) -> bool {
2663 self.feature_flags.defer_unpaid_amplification
2664 }
2665
2666 pub fn gasless_transaction_drop_safety(&self) -> bool {
2667 self.feature_flags.gasless_transaction_drop_safety
2668 }
2669
2670 pub fn new_vm_enabled(&self) -> bool {
2671 self.feature_flags.new_vm_enabled
2672 }
2673}
2674
2675#[cfg(not(msim))]
2676static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2677
2678#[cfg(msim)]
2680thread_local! {
2681 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2682}
2683
2684impl ProtocolConfig {
2686 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2688 assert!(
2690 version >= ProtocolVersion::MIN,
2691 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2692 version,
2693 ProtocolVersion::MIN.0,
2694 );
2695 assert!(
2696 version <= ProtocolVersion::MAX_ALLOWED,
2697 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2698 version,
2699 ProtocolVersion::MAX_ALLOWED.0,
2700 );
2701
2702 let mut ret = Self::get_for_version_impl(version, chain);
2703 ret.version = version;
2704
2705 ret = CONFIG_OVERRIDE.with(|ovr| {
2706 if let Some(override_fn) = &*ovr.borrow() {
2707 warn!(
2708 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2709 );
2710 override_fn(version, ret)
2711 } else {
2712 ret
2713 }
2714 });
2715
2716 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2717 warn!(
2718 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2719 );
2720 let overrides: ProtocolConfigOptional =
2721 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2722 .expect("failed to parse ProtocolConfig override env variables");
2723 overrides.apply_to(&mut ret);
2724 }
2725
2726 ret
2727 }
2728
2729 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2732 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2733 let mut ret = Self::get_for_version_impl(version, chain);
2734 ret.version = version;
2735 Some(ret)
2736 } else {
2737 None
2738 }
2739 }
2740
2741 #[cfg(not(msim))]
2742 pub fn poison_get_for_min_version() {
2743 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2744 }
2745
2746 #[cfg(not(msim))]
2747 fn load_poison_get_for_min_version() -> bool {
2748 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2749 }
2750
2751 #[cfg(msim)]
2752 pub fn poison_get_for_min_version() {
2753 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2754 }
2755
2756 #[cfg(msim)]
2757 fn load_poison_get_for_min_version() -> bool {
2758 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2759 }
2760
2761 pub fn get_for_min_version() -> Self {
2764 if Self::load_poison_get_for_min_version() {
2765 panic!("get_for_min_version called on validator");
2766 }
2767 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2768 }
2769
2770 #[allow(non_snake_case)]
2780 pub fn get_for_max_version_UNSAFE() -> Self {
2781 if Self::load_poison_get_for_min_version() {
2782 panic!("get_for_max_version_UNSAFE called on validator");
2783 }
2784 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2785 }
2786
2787 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2788 #[cfg(msim)]
2789 {
2790 if version == ProtocolVersion::MAX_ALLOWED {
2792 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2793 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2794 return config;
2795 }
2796 }
2797
2798 let mut cfg = Self {
2801 version,
2803
2804 feature_flags: Default::default(),
2806
2807 max_tx_size_bytes: Some(128 * 1024),
2808 max_input_objects: Some(2048),
2810 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2811 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2812 max_gas_payment_objects: Some(256),
2813 max_modules_in_publish: Some(128),
2814 max_package_dependencies: None,
2815 max_arguments: Some(512),
2816 max_type_arguments: Some(16),
2817 max_type_argument_depth: Some(16),
2818 max_pure_argument_size: Some(16 * 1024),
2819 max_programmable_tx_commands: Some(1024),
2820 move_binary_format_version: Some(6),
2821 min_move_binary_format_version: None,
2822 binary_module_handles: None,
2823 binary_struct_handles: None,
2824 binary_function_handles: None,
2825 binary_function_instantiations: None,
2826 binary_signatures: None,
2827 binary_constant_pool: None,
2828 binary_identifiers: None,
2829 binary_address_identifiers: None,
2830 binary_struct_defs: None,
2831 binary_struct_def_instantiations: None,
2832 binary_function_defs: None,
2833 binary_field_handles: None,
2834 binary_field_instantiations: None,
2835 binary_friend_decls: None,
2836 binary_enum_defs: None,
2837 binary_enum_def_instantiations: None,
2838 binary_variant_handles: None,
2839 binary_variant_instantiation_handles: None,
2840 max_move_object_size: Some(250 * 1024),
2841 max_move_package_size: Some(100 * 1024),
2842 max_publish_or_upgrade_per_ptb: None,
2843 max_tx_gas: Some(10_000_000_000),
2844 max_gas_price: Some(100_000),
2845 max_gas_price_rgp_factor_for_aborted_transactions: None,
2846 max_gas_computation_bucket: Some(5_000_000),
2847 max_loop_depth: Some(5),
2848 max_generic_instantiation_length: Some(32),
2849 max_function_parameters: Some(128),
2850 max_basic_blocks: Some(1024),
2851 max_value_stack_size: Some(1024),
2852 max_type_nodes: Some(256),
2853 max_push_size: Some(10000),
2854 max_struct_definitions: Some(200),
2855 max_function_definitions: Some(1000),
2856 max_fields_in_struct: Some(32),
2857 max_dependency_depth: Some(100),
2858 max_num_event_emit: Some(256),
2859 max_num_new_move_object_ids: Some(2048),
2860 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2861 max_num_deleted_move_object_ids: Some(2048),
2862 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2863 max_num_transferred_move_object_ids: Some(2048),
2864 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2865 max_event_emit_size: Some(250 * 1024),
2866 max_move_vector_len: Some(256 * 1024),
2867 max_type_to_layout_nodes: None,
2868 max_ptb_value_size: None,
2869
2870 max_back_edges_per_function: Some(10_000),
2871 max_back_edges_per_module: Some(10_000),
2872 max_verifier_meter_ticks_per_function: Some(6_000_000),
2873 max_meter_ticks_per_module: Some(6_000_000),
2874 max_meter_ticks_per_package: None,
2875
2876 object_runtime_max_num_cached_objects: Some(1000),
2877 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2878 object_runtime_max_num_store_entries: Some(1000),
2879 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2880 base_tx_cost_fixed: Some(110_000),
2881 package_publish_cost_fixed: Some(1_000),
2882 base_tx_cost_per_byte: Some(0),
2883 package_publish_cost_per_byte: Some(80),
2884 obj_access_cost_read_per_byte: Some(15),
2885 obj_access_cost_mutate_per_byte: Some(40),
2886 obj_access_cost_delete_per_byte: Some(40),
2887 obj_access_cost_verify_per_byte: Some(200),
2888 obj_data_cost_refundable: Some(100),
2889 obj_metadata_cost_non_refundable: Some(50),
2890 gas_model_version: Some(1),
2891 storage_rebate_rate: Some(9900),
2892 storage_fund_reinvest_rate: Some(500),
2893 reward_slashing_rate: Some(5000),
2894 storage_gas_price: Some(1),
2895 accumulator_object_storage_cost: None,
2896 max_transactions_per_checkpoint: Some(10_000),
2897 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2898
2899 buffer_stake_for_protocol_upgrade_bps: Some(0),
2902
2903 address_from_bytes_cost_base: Some(52),
2907 address_to_u256_cost_base: Some(52),
2909 address_from_u256_cost_base: Some(52),
2911
2912 config_read_setting_impl_cost_base: None,
2915 config_read_setting_impl_cost_per_byte: None,
2916
2917 dynamic_field_hash_type_and_key_cost_base: Some(100),
2920 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2921 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2922 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2923 dynamic_field_add_child_object_cost_base: Some(100),
2925 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2926 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2927 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2928 dynamic_field_borrow_child_object_cost_base: Some(100),
2930 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2931 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2932 dynamic_field_remove_child_object_cost_base: Some(100),
2934 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2935 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2936 dynamic_field_has_child_object_cost_base: Some(100),
2938 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2940 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2941 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2942
2943 event_emit_cost_base: Some(52),
2946 event_emit_value_size_derivation_cost_per_byte: Some(2),
2947 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2948 event_emit_output_cost_per_byte: Some(10),
2949 event_emit_auth_stream_cost: None,
2950
2951 object_borrow_uid_cost_base: Some(52),
2954 object_delete_impl_cost_base: Some(52),
2956 object_record_new_uid_cost_base: Some(52),
2958
2959 transfer_transfer_internal_cost_base: Some(52),
2962 transfer_party_transfer_internal_cost_base: None,
2964 transfer_freeze_object_cost_base: Some(52),
2966 transfer_share_object_cost_base: Some(52),
2968 transfer_receive_object_cost_base: None,
2969
2970 tx_context_derive_id_cost_base: Some(52),
2973 tx_context_fresh_id_cost_base: None,
2974 tx_context_sender_cost_base: None,
2975 tx_context_epoch_cost_base: None,
2976 tx_context_epoch_timestamp_ms_cost_base: None,
2977 tx_context_sponsor_cost_base: None,
2978 tx_context_rgp_cost_base: None,
2979 tx_context_gas_price_cost_base: None,
2980 tx_context_gas_budget_cost_base: None,
2981 tx_context_ids_created_cost_base: None,
2982 tx_context_replace_cost_base: None,
2983
2984 types_is_one_time_witness_cost_base: Some(52),
2987 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2988 types_is_one_time_witness_type_cost_per_byte: Some(2),
2989
2990 validator_validate_metadata_cost_base: Some(52),
2993 validator_validate_metadata_data_cost_per_byte: Some(2),
2994
2995 crypto_invalid_arguments_cost: Some(100),
2997 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2999 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3000 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3001
3002 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3004 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3005 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3006
3007 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3009 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3010 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3011 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3012 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3013 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3014
3015 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3017
3018 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3020 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3021 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3022 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3023 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3024 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3025
3026 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3028 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3029 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3030 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3031 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3032 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3033
3034 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3036 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3037 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3038 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3039 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3040 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3041
3042 ecvrf_ecvrf_verify_cost_base: Some(52),
3044 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3045 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3046
3047 ed25519_ed25519_verify_cost_base: Some(52),
3049 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3050 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3051
3052 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3054 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3055
3056 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3058 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3059 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3060 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3061 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3062
3063 hash_blake2b256_cost_base: Some(52),
3065 hash_blake2b256_data_cost_per_byte: Some(2),
3066 hash_blake2b256_data_cost_per_block: Some(2),
3067
3068 hash_keccak256_cost_base: Some(52),
3070 hash_keccak256_data_cost_per_byte: Some(2),
3071 hash_keccak256_data_cost_per_block: Some(2),
3072
3073 poseidon_bn254_cost_base: None,
3074 poseidon_bn254_cost_per_block: None,
3075
3076 hmac_hmac_sha3_256_cost_base: Some(52),
3078 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3079 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3080
3081 group_ops_bls12381_decode_scalar_cost: None,
3083 group_ops_bls12381_decode_g1_cost: None,
3084 group_ops_bls12381_decode_g2_cost: None,
3085 group_ops_bls12381_decode_gt_cost: None,
3086 group_ops_bls12381_scalar_add_cost: None,
3087 group_ops_bls12381_g1_add_cost: None,
3088 group_ops_bls12381_g2_add_cost: None,
3089 group_ops_bls12381_gt_add_cost: None,
3090 group_ops_bls12381_scalar_sub_cost: None,
3091 group_ops_bls12381_g1_sub_cost: None,
3092 group_ops_bls12381_g2_sub_cost: None,
3093 group_ops_bls12381_gt_sub_cost: None,
3094 group_ops_bls12381_scalar_mul_cost: None,
3095 group_ops_bls12381_g1_mul_cost: None,
3096 group_ops_bls12381_g2_mul_cost: None,
3097 group_ops_bls12381_gt_mul_cost: None,
3098 group_ops_bls12381_scalar_div_cost: None,
3099 group_ops_bls12381_g1_div_cost: None,
3100 group_ops_bls12381_g2_div_cost: None,
3101 group_ops_bls12381_gt_div_cost: None,
3102 group_ops_bls12381_g1_hash_to_base_cost: None,
3103 group_ops_bls12381_g2_hash_to_base_cost: None,
3104 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3105 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3106 group_ops_bls12381_g1_msm_base_cost: None,
3107 group_ops_bls12381_g2_msm_base_cost: None,
3108 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3109 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3110 group_ops_bls12381_msm_max_len: None,
3111 group_ops_bls12381_pairing_cost: None,
3112 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3113 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3114 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3115 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3116 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3117
3118 group_ops_ristretto_decode_scalar_cost: None,
3119 group_ops_ristretto_decode_point_cost: None,
3120 group_ops_ristretto_scalar_add_cost: None,
3121 group_ops_ristretto_point_add_cost: None,
3122 group_ops_ristretto_scalar_sub_cost: None,
3123 group_ops_ristretto_point_sub_cost: None,
3124 group_ops_ristretto_scalar_mul_cost: None,
3125 group_ops_ristretto_point_mul_cost: None,
3126 group_ops_ristretto_scalar_div_cost: None,
3127 group_ops_ristretto_point_div_cost: None,
3128
3129 check_zklogin_id_cost_base: None,
3131 check_zklogin_issuer_cost_base: None,
3133
3134 vdf_verify_vdf_cost: None,
3135 vdf_hash_to_input_cost: None,
3136
3137 nitro_attestation_parse_base_cost: None,
3139 nitro_attestation_parse_cost_per_byte: None,
3140 nitro_attestation_verify_base_cost: None,
3141 nitro_attestation_verify_cost_per_cert: None,
3142
3143 bcs_per_byte_serialized_cost: None,
3144 bcs_legacy_min_output_size_cost: None,
3145 bcs_failure_cost: None,
3146 hash_sha2_256_base_cost: None,
3147 hash_sha2_256_per_byte_cost: None,
3148 hash_sha2_256_legacy_min_input_len_cost: None,
3149 hash_sha3_256_base_cost: None,
3150 hash_sha3_256_per_byte_cost: None,
3151 hash_sha3_256_legacy_min_input_len_cost: None,
3152 type_name_get_base_cost: None,
3153 type_name_get_per_byte_cost: None,
3154 type_name_id_base_cost: None,
3155 string_check_utf8_base_cost: None,
3156 string_check_utf8_per_byte_cost: None,
3157 string_is_char_boundary_base_cost: None,
3158 string_sub_string_base_cost: None,
3159 string_sub_string_per_byte_cost: None,
3160 string_index_of_base_cost: None,
3161 string_index_of_per_byte_pattern_cost: None,
3162 string_index_of_per_byte_searched_cost: None,
3163 vector_empty_base_cost: None,
3164 vector_length_base_cost: None,
3165 vector_push_back_base_cost: None,
3166 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3167 vector_borrow_base_cost: None,
3168 vector_pop_back_base_cost: None,
3169 vector_destroy_empty_base_cost: None,
3170 vector_swap_base_cost: None,
3171 debug_print_base_cost: None,
3172 debug_print_stack_trace_base_cost: None,
3173
3174 max_size_written_objects: None,
3175 max_size_written_objects_system_tx: None,
3176
3177 max_move_identifier_len: None,
3184 max_move_value_depth: None,
3185 max_move_enum_variants: None,
3186
3187 gas_rounding_step: None,
3188
3189 execution_version: None,
3190
3191 max_event_emit_size_total: None,
3192
3193 consensus_bad_nodes_stake_threshold: None,
3194
3195 max_jwk_votes_per_validator_per_epoch: None,
3196
3197 max_age_of_jwk_in_epochs: None,
3198
3199 random_beacon_reduction_allowed_delta: None,
3200
3201 random_beacon_reduction_lower_bound: None,
3202
3203 random_beacon_dkg_timeout_round: None,
3204
3205 random_beacon_min_round_interval_ms: None,
3206
3207 random_beacon_dkg_version: None,
3208
3209 consensus_max_transaction_size_bytes: None,
3210
3211 consensus_max_transactions_in_block_bytes: None,
3212
3213 consensus_max_num_transactions_in_block: None,
3214
3215 consensus_voting_rounds: None,
3216
3217 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3218
3219 max_deferral_rounds_for_congestion_control: None,
3220
3221 max_txn_cost_overage_per_object_in_commit: None,
3222
3223 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3224
3225 min_checkpoint_interval_ms: None,
3226
3227 checkpoint_summary_version_specific_data: None,
3228
3229 max_soft_bundle_size: None,
3230
3231 bridge_should_try_to_finalize_committee: None,
3232
3233 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3234
3235 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3236
3237 consensus_gc_depth: None,
3238
3239 gas_budget_based_txn_cost_cap_factor: None,
3240
3241 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3242
3243 sip_45_consensus_amplification_threshold: None,
3244
3245 use_object_per_epoch_marker_table_v2: None,
3246
3247 consensus_commit_rate_estimation_window_size: None,
3248
3249 aliased_addresses: vec![],
3250
3251 translation_per_command_base_charge: None,
3252 translation_per_input_base_charge: None,
3253 translation_pure_input_per_byte_charge: None,
3254 translation_per_type_node_charge: None,
3255 translation_per_reference_node_charge: None,
3256 translation_per_linkage_entry_charge: None,
3257
3258 max_updates_per_settlement_txn: None,
3259 };
3262 for cur in 2..=version.0 {
3263 match cur {
3264 1 => unreachable!(),
3265 2 => {
3266 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3267 }
3268 3 => {
3269 cfg.gas_model_version = Some(2);
3271 cfg.max_tx_gas = Some(50_000_000_000);
3273 cfg.base_tx_cost_fixed = Some(2_000);
3275 cfg.storage_gas_price = Some(76);
3277 cfg.feature_flags.loaded_child_objects_fixed = true;
3278 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3281 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3284 cfg.feature_flags.package_upgrades = true;
3285 }
3286 4 => {
3291 cfg.reward_slashing_rate = Some(10000);
3293 cfg.gas_model_version = Some(3);
3295 }
3296 5 => {
3297 cfg.feature_flags.missing_type_is_compatibility_error = true;
3298 cfg.gas_model_version = Some(4);
3299 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3300 }
3304 6 => {
3305 cfg.gas_model_version = Some(5);
3306 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3307 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3308 }
3309 7 => {
3310 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3311 cfg.feature_flags
3312 .disable_invariant_violation_check_in_swap_loc = true;
3313 cfg.feature_flags.ban_entry_init = true;
3314 cfg.feature_flags.package_digest_hash_module = true;
3315 }
3316 8 => {
3317 cfg.feature_flags
3318 .disallow_change_struct_type_params_on_upgrade = true;
3319 }
3320 9 => {
3321 cfg.max_move_identifier_len = Some(128);
3323 cfg.feature_flags.no_extraneous_module_bytes = true;
3324 cfg.feature_flags
3325 .advance_to_highest_supported_protocol_version = true;
3326 }
3327 10 => {
3328 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3329 cfg.max_meter_ticks_per_module = Some(16_000_000);
3330 }
3331 11 => {
3332 cfg.max_move_value_depth = Some(128);
3333 }
3334 12 => {
3335 cfg.feature_flags.narwhal_versioned_metadata = true;
3336 if chain != Chain::Mainnet {
3337 cfg.feature_flags.commit_root_state_digest = true;
3338 }
3339
3340 if chain != Chain::Mainnet && chain != Chain::Testnet {
3341 cfg.feature_flags.zklogin_auth = true;
3342 }
3343 }
3344 13 => {}
3345 14 => {
3346 cfg.gas_rounding_step = Some(1_000);
3347 cfg.gas_model_version = Some(6);
3348 }
3349 15 => {
3350 cfg.feature_flags.consensus_transaction_ordering =
3351 ConsensusTransactionOrdering::ByGasPrice;
3352 }
3353 16 => {
3354 cfg.feature_flags.simplified_unwrap_then_delete = true;
3355 }
3356 17 => {
3357 cfg.feature_flags.upgraded_multisig_supported = true;
3358 }
3359 18 => {
3360 cfg.execution_version = Some(1);
3361 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3370 cfg.base_tx_cost_fixed = Some(1_000);
3372 }
3373 19 => {
3374 cfg.max_num_event_emit = Some(1024);
3375 cfg.max_event_emit_size_total = Some(
3378 256 * 250 * 1024, );
3380 }
3381 20 => {
3382 cfg.feature_flags.commit_root_state_digest = true;
3383
3384 if chain != Chain::Mainnet {
3385 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3386 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3387 }
3388 }
3389
3390 21 => {
3391 if chain != Chain::Mainnet {
3392 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3393 "Google".to_string(),
3394 "Facebook".to_string(),
3395 "Twitch".to_string(),
3396 ]);
3397 }
3398 }
3399 22 => {
3400 cfg.feature_flags.loaded_child_object_format = true;
3401 }
3402 23 => {
3403 cfg.feature_flags.loaded_child_object_format_type = true;
3404 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3405 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3411 }
3412 24 => {
3413 cfg.feature_flags.simple_conservation_checks = true;
3414 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3415
3416 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3417
3418 if chain != Chain::Mainnet {
3419 cfg.feature_flags.enable_jwk_consensus_updates = true;
3420 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3422 cfg.max_age_of_jwk_in_epochs = Some(1);
3423 }
3424 }
3425 25 => {
3426 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3428 "Google".to_string(),
3429 "Facebook".to_string(),
3430 "Twitch".to_string(),
3431 ]);
3432 cfg.feature_flags.zklogin_auth = true;
3433
3434 cfg.feature_flags.enable_jwk_consensus_updates = true;
3436 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3437 cfg.max_age_of_jwk_in_epochs = Some(1);
3438 }
3439 26 => {
3440 cfg.gas_model_version = Some(7);
3441 if chain != Chain::Mainnet && chain != Chain::Testnet {
3443 cfg.transfer_receive_object_cost_base = Some(52);
3444 cfg.feature_flags.receive_objects = true;
3445 }
3446 }
3447 27 => {
3448 cfg.gas_model_version = Some(8);
3449 }
3450 28 => {
3451 cfg.check_zklogin_id_cost_base = Some(200);
3453 cfg.check_zklogin_issuer_cost_base = Some(200);
3455
3456 if chain != Chain::Mainnet && chain != Chain::Testnet {
3458 cfg.feature_flags.enable_effects_v2 = true;
3459 }
3460 }
3461 29 => {
3462 cfg.feature_flags.verify_legacy_zklogin_address = true;
3463 }
3464 30 => {
3465 if chain != Chain::Mainnet {
3467 cfg.feature_flags.narwhal_certificate_v2 = true;
3468 }
3469
3470 cfg.random_beacon_reduction_allowed_delta = Some(800);
3471 if chain != Chain::Mainnet {
3473 cfg.feature_flags.enable_effects_v2 = true;
3474 }
3475
3476 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3480
3481 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3482 }
3483 31 => {
3484 cfg.execution_version = Some(2);
3485 if chain != Chain::Mainnet && chain != Chain::Testnet {
3487 cfg.feature_flags.shared_object_deletion = true;
3488 }
3489 }
3490 32 => {
3491 if chain != Chain::Mainnet {
3493 cfg.feature_flags.accept_zklogin_in_multisig = true;
3494 }
3495 if chain != Chain::Mainnet {
3497 cfg.transfer_receive_object_cost_base = Some(52);
3498 cfg.feature_flags.receive_objects = true;
3499 }
3500 if chain != Chain::Mainnet && chain != Chain::Testnet {
3502 cfg.feature_flags.random_beacon = true;
3503 cfg.random_beacon_reduction_lower_bound = Some(1600);
3504 cfg.random_beacon_dkg_timeout_round = Some(3000);
3505 cfg.random_beacon_min_round_interval_ms = Some(150);
3506 }
3507 if chain != Chain::Testnet && chain != Chain::Mainnet {
3509 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3510 }
3511
3512 cfg.feature_flags.narwhal_certificate_v2 = true;
3514 }
3515 33 => {
3516 cfg.feature_flags.hardened_otw_check = true;
3517 cfg.feature_flags.allow_receiving_object_id = true;
3518
3519 cfg.transfer_receive_object_cost_base = Some(52);
3521 cfg.feature_flags.receive_objects = true;
3522
3523 if chain != Chain::Mainnet {
3525 cfg.feature_flags.shared_object_deletion = true;
3526 }
3527
3528 cfg.feature_flags.enable_effects_v2 = true;
3529 }
3530 34 => {}
3531 35 => {
3532 if chain != Chain::Mainnet && chain != Chain::Testnet {
3534 cfg.feature_flags.enable_poseidon = true;
3535 cfg.poseidon_bn254_cost_base = Some(260);
3536 cfg.poseidon_bn254_cost_per_block = Some(10);
3537 }
3538
3539 cfg.feature_flags.enable_coin_deny_list = true;
3540 }
3541 36 => {
3542 if chain != Chain::Mainnet && chain != Chain::Testnet {
3544 cfg.feature_flags.enable_group_ops_native_functions = true;
3545 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3546 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3548 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3549 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3550 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3551 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3552 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3553 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3554 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3555 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3556 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3557 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3558 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3559 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3560 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3561 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3562 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3563 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3564 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3565 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3566 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3567 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3568 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3569 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3570 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3571 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3572 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3573 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3574 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3575 cfg.group_ops_bls12381_msm_max_len = Some(32);
3576 cfg.group_ops_bls12381_pairing_cost = Some(52);
3577 }
3578 cfg.feature_flags.shared_object_deletion = true;
3580
3581 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3583 }
3585 37 => {
3586 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3587
3588 if chain != Chain::Mainnet {
3590 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3591 }
3592 }
3593 38 => {
3594 cfg.binary_module_handles = Some(100);
3595 cfg.binary_struct_handles = Some(300);
3596 cfg.binary_function_handles = Some(1500);
3597 cfg.binary_function_instantiations = Some(750);
3598 cfg.binary_signatures = Some(1000);
3599 cfg.binary_constant_pool = Some(4000);
3603 cfg.binary_identifiers = Some(10000);
3604 cfg.binary_address_identifiers = Some(100);
3605 cfg.binary_struct_defs = Some(200);
3606 cfg.binary_struct_def_instantiations = Some(100);
3607 cfg.binary_function_defs = Some(1000);
3608 cfg.binary_field_handles = Some(500);
3609 cfg.binary_field_instantiations = Some(250);
3610 cfg.binary_friend_decls = Some(100);
3611 cfg.max_package_dependencies = Some(32);
3613 cfg.max_modules_in_publish = Some(64);
3614 cfg.execution_version = Some(3);
3616 }
3617 39 => {
3618 }
3620 40 => {}
3621 41 => {
3622 cfg.feature_flags.enable_group_ops_native_functions = true;
3624 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3626 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3627 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3628 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3629 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3630 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3631 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3632 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3633 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3634 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3635 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3636 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3637 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3638 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3639 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3640 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3641 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3642 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3643 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3644 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3645 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3646 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3647 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3648 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3649 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3650 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3651 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3652 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3653 cfg.group_ops_bls12381_msm_max_len = Some(32);
3654 cfg.group_ops_bls12381_pairing_cost = Some(52);
3655 }
3656 42 => {}
3657 43 => {
3658 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3659 cfg.max_meter_ticks_per_package = Some(16_000_000);
3660 }
3661 44 => {
3662 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3664 if chain != Chain::Mainnet {
3666 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3667 }
3668 }
3669 45 => {
3670 if chain != Chain::Testnet && chain != Chain::Mainnet {
3672 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3673 }
3674
3675 if chain != Chain::Mainnet {
3676 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3678 }
3679 cfg.min_move_binary_format_version = Some(6);
3680 cfg.feature_flags.accept_zklogin_in_multisig = true;
3681
3682 if chain != Chain::Mainnet && chain != Chain::Testnet {
3686 cfg.feature_flags.bridge = true;
3687 }
3688 }
3689 46 => {
3690 if chain != Chain::Mainnet {
3692 cfg.feature_flags.bridge = true;
3693 }
3694
3695 cfg.feature_flags.reshare_at_same_initial_version = true;
3697 }
3698 47 => {}
3699 48 => {
3700 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3702
3703 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3705
3706 if chain != Chain::Mainnet {
3708 cfg.feature_flags.random_beacon = true;
3709 cfg.random_beacon_reduction_lower_bound = Some(1600);
3710 cfg.random_beacon_dkg_timeout_round = Some(3000);
3711 cfg.random_beacon_min_round_interval_ms = Some(200);
3712 }
3713
3714 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3716 }
3717 49 => {
3718 if chain != Chain::Testnet && chain != Chain::Mainnet {
3719 cfg.move_binary_format_version = Some(7);
3720 }
3721
3722 if chain != Chain::Mainnet && chain != Chain::Testnet {
3724 cfg.feature_flags.enable_vdf = true;
3725 cfg.vdf_verify_vdf_cost = Some(1500);
3728 cfg.vdf_hash_to_input_cost = Some(100);
3729 }
3730
3731 if chain != Chain::Testnet && chain != Chain::Mainnet {
3733 cfg.feature_flags
3734 .record_consensus_determined_version_assignments_in_prologue = true;
3735 }
3736
3737 if chain != Chain::Mainnet {
3739 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3740 }
3741
3742 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3744 }
3745 50 => {
3746 if chain != Chain::Mainnet {
3748 cfg.checkpoint_summary_version_specific_data = Some(1);
3749 cfg.min_checkpoint_interval_ms = Some(200);
3750 }
3751
3752 if chain != Chain::Testnet && chain != Chain::Mainnet {
3754 cfg.feature_flags
3755 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3756 }
3757
3758 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3759
3760 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3762 }
3763 51 => {
3764 cfg.random_beacon_dkg_version = Some(1);
3765
3766 if chain != Chain::Testnet && chain != Chain::Mainnet {
3767 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3768 }
3769 }
3770 52 => {
3771 if chain != Chain::Mainnet {
3772 cfg.feature_flags.soft_bundle = true;
3773 cfg.max_soft_bundle_size = Some(5);
3774 }
3775
3776 cfg.config_read_setting_impl_cost_base = Some(100);
3777 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3778
3779 if chain != Chain::Testnet && chain != Chain::Mainnet {
3781 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3782 cfg.feature_flags.per_object_congestion_control_mode =
3783 PerObjectCongestionControlMode::TotalTxCount;
3784 }
3785
3786 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3788
3789 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3791
3792 cfg.checkpoint_summary_version_specific_data = Some(1);
3794 cfg.min_checkpoint_interval_ms = Some(200);
3795
3796 if chain != Chain::Mainnet {
3798 cfg.feature_flags
3799 .record_consensus_determined_version_assignments_in_prologue = true;
3800 cfg.feature_flags
3801 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3802 }
3803 if chain != Chain::Mainnet {
3805 cfg.move_binary_format_version = Some(7);
3806 }
3807
3808 if chain != Chain::Testnet && chain != Chain::Mainnet {
3809 cfg.feature_flags.passkey_auth = true;
3810 }
3811 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3812 }
3813 53 => {
3814 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3816
3817 cfg.feature_flags
3819 .record_consensus_determined_version_assignments_in_prologue = true;
3820 cfg.feature_flags
3821 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3822
3823 if chain == Chain::Unknown {
3824 cfg.feature_flags.authority_capabilities_v2 = true;
3825 }
3826
3827 if chain != Chain::Mainnet {
3829 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3830 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3831 cfg.feature_flags.per_object_congestion_control_mode =
3832 PerObjectCongestionControlMode::TotalTxCount;
3833 }
3834
3835 cfg.bcs_per_byte_serialized_cost = Some(2);
3837 cfg.bcs_legacy_min_output_size_cost = Some(1);
3838 cfg.bcs_failure_cost = Some(52);
3839 cfg.debug_print_base_cost = Some(52);
3840 cfg.debug_print_stack_trace_base_cost = Some(52);
3841 cfg.hash_sha2_256_base_cost = Some(52);
3842 cfg.hash_sha2_256_per_byte_cost = Some(2);
3843 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3844 cfg.hash_sha3_256_base_cost = Some(52);
3845 cfg.hash_sha3_256_per_byte_cost = Some(2);
3846 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3847 cfg.type_name_get_base_cost = Some(52);
3848 cfg.type_name_get_per_byte_cost = Some(2);
3849 cfg.string_check_utf8_base_cost = Some(52);
3850 cfg.string_check_utf8_per_byte_cost = Some(2);
3851 cfg.string_is_char_boundary_base_cost = Some(52);
3852 cfg.string_sub_string_base_cost = Some(52);
3853 cfg.string_sub_string_per_byte_cost = Some(2);
3854 cfg.string_index_of_base_cost = Some(52);
3855 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3856 cfg.string_index_of_per_byte_searched_cost = Some(2);
3857 cfg.vector_empty_base_cost = Some(52);
3858 cfg.vector_length_base_cost = Some(52);
3859 cfg.vector_push_back_base_cost = Some(52);
3860 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3861 cfg.vector_borrow_base_cost = Some(52);
3862 cfg.vector_pop_back_base_cost = Some(52);
3863 cfg.vector_destroy_empty_base_cost = Some(52);
3864 cfg.vector_swap_base_cost = Some(52);
3865 }
3866 54 => {
3867 cfg.feature_flags.random_beacon = true;
3869 cfg.random_beacon_reduction_lower_bound = Some(1000);
3870 cfg.random_beacon_dkg_timeout_round = Some(3000);
3871 cfg.random_beacon_min_round_interval_ms = Some(500);
3872
3873 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3875 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3876 cfg.feature_flags.per_object_congestion_control_mode =
3877 PerObjectCongestionControlMode::TotalTxCount;
3878
3879 cfg.feature_flags.soft_bundle = true;
3881 cfg.max_soft_bundle_size = Some(5);
3882 }
3883 55 => {
3884 cfg.move_binary_format_version = Some(7);
3886
3887 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3889 cfg.consensus_max_num_transactions_in_block = Some(512);
3892
3893 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3894 }
3895 56 => {
3896 if chain == Chain::Mainnet {
3897 cfg.feature_flags.bridge = true;
3898 }
3899 }
3900 57 => {
3901 cfg.random_beacon_reduction_lower_bound = Some(800);
3903 }
3904 58 => {
3905 if chain == Chain::Mainnet {
3906 cfg.bridge_should_try_to_finalize_committee = Some(true);
3907 }
3908
3909 if chain != Chain::Mainnet && chain != Chain::Testnet {
3910 cfg.feature_flags
3912 .consensus_distributed_vote_scoring_strategy = true;
3913 }
3914 }
3915 59 => {
3916 cfg.feature_flags.consensus_round_prober = true;
3918 }
3919 60 => {
3920 cfg.max_type_to_layout_nodes = Some(512);
3921 cfg.feature_flags.validate_identifier_inputs = true;
3922 }
3923 61 => {
3924 if chain != Chain::Mainnet {
3925 cfg.feature_flags
3927 .consensus_distributed_vote_scoring_strategy = true;
3928 }
3929 cfg.random_beacon_reduction_lower_bound = Some(700);
3931
3932 if chain != Chain::Mainnet && chain != Chain::Testnet {
3933 cfg.feature_flags.mysticeti_fastpath = true;
3935 }
3936 }
3937 62 => {
3938 cfg.feature_flags.relocate_event_module = true;
3939 }
3940 63 => {
3941 cfg.feature_flags.per_object_congestion_control_mode =
3942 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3943 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3944 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3945 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3946 }
3947 64 => {
3948 cfg.feature_flags.per_object_congestion_control_mode =
3949 PerObjectCongestionControlMode::TotalTxCount;
3950 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3951 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3952 }
3953 65 => {
3954 cfg.feature_flags
3956 .consensus_distributed_vote_scoring_strategy = true;
3957 }
3958 66 => {
3959 if chain == Chain::Mainnet {
3960 cfg.feature_flags
3962 .consensus_distributed_vote_scoring_strategy = false;
3963 }
3964 }
3965 67 => {
3966 cfg.feature_flags
3968 .consensus_distributed_vote_scoring_strategy = true;
3969 }
3970 68 => {
3971 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3972 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3973 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3974 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3975 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3976
3977 if chain != Chain::Mainnet && chain != Chain::Testnet {
3978 cfg.feature_flags.uncompressed_g1_group_elements = true;
3979 }
3980
3981 cfg.feature_flags.per_object_congestion_control_mode =
3982 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3983 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3984 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3985 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3986 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3988 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3989
3990 cfg.random_beacon_reduction_lower_bound = Some(500);
3992
3993 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3994 }
3995 69 => {
3996 cfg.consensus_voting_rounds = Some(40);
3998
3999 if chain != Chain::Mainnet && chain != Chain::Testnet {
4000 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4002 }
4003
4004 if chain != Chain::Mainnet {
4005 cfg.feature_flags.uncompressed_g1_group_elements = true;
4006 }
4007 }
4008 70 => {
4009 if chain != Chain::Mainnet {
4010 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4012 cfg.feature_flags
4014 .consensus_round_prober_probe_accepted_rounds = true;
4015 }
4016
4017 cfg.poseidon_bn254_cost_per_block = Some(388);
4018
4019 cfg.gas_model_version = Some(9);
4020 cfg.feature_flags.native_charging_v2 = true;
4021 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4022 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4023 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4024 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4025 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4026 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4027 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4028 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4029
4030 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4032 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4033 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4034 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4035
4036 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4037 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4038 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4039 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4040 Some(8213);
4041 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4042 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4043 Some(9484);
4044
4045 cfg.hash_keccak256_cost_base = Some(10);
4046 cfg.hash_blake2b256_cost_base = Some(10);
4047
4048 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4050 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4051 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4052 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4053
4054 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4055 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4056 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4057 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4058
4059 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4060 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4061 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4062 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4063
4064 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4065 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4066 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4067 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4068
4069 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4070 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4071 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4072 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4073
4074 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4075 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4076
4077 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4078 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4079 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4080 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4081
4082 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4083 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4084 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4085 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4086
4087 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4088 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4089
4090 cfg.validator_validate_metadata_cost_base = Some(20000);
4091 }
4092 71 => {
4093 cfg.sip_45_consensus_amplification_threshold = Some(5);
4094
4095 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4097 }
4098 72 => {
4099 cfg.feature_flags.convert_type_argument_error = true;
4100
4101 cfg.max_tx_gas = Some(50_000_000_000_000);
4104 cfg.max_gas_price = Some(50_000_000_000);
4106
4107 cfg.feature_flags.variant_nodes = true;
4108 }
4109 73 => {
4110 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4112
4113 if chain != Chain::Mainnet && chain != Chain::Testnet {
4114 cfg.consensus_gc_depth = Some(60);
4117 }
4118
4119 if chain != Chain::Mainnet {
4120 cfg.feature_flags.consensus_zstd_compression = true;
4122 }
4123
4124 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4126 cfg.feature_flags
4128 .consensus_round_prober_probe_accepted_rounds = true;
4129
4130 cfg.feature_flags.per_object_congestion_control_mode =
4132 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4133 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4134 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4135 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4136 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4138 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4139 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4140 }
4141 74 => {
4142 if chain != Chain::Mainnet && chain != Chain::Testnet {
4144 cfg.feature_flags.enable_nitro_attestation = true;
4145 }
4146 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4147 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4148 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4149 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4150
4151 cfg.feature_flags.consensus_zstd_compression = true;
4153
4154 if chain != Chain::Mainnet && chain != Chain::Testnet {
4155 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4156 }
4157 }
4158 75 => {
4159 if chain != Chain::Mainnet {
4160 cfg.feature_flags.passkey_auth = true;
4161 }
4162 }
4163 76 => {
4164 if chain != Chain::Mainnet && chain != Chain::Testnet {
4165 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4166 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4167 }
4168 cfg.feature_flags.minimize_child_object_mutations = true;
4169
4170 if chain != Chain::Mainnet {
4171 cfg.feature_flags.accept_passkey_in_multisig = true;
4172 }
4173 }
4174 77 => {
4175 cfg.feature_flags.uncompressed_g1_group_elements = true;
4176
4177 if chain != Chain::Mainnet {
4178 cfg.consensus_gc_depth = Some(60);
4179 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4180 }
4181 }
4182 78 => {
4183 cfg.feature_flags.move_native_context = true;
4184 cfg.tx_context_fresh_id_cost_base = Some(52);
4185 cfg.tx_context_sender_cost_base = Some(30);
4186 cfg.tx_context_epoch_cost_base = Some(30);
4187 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4188 cfg.tx_context_sponsor_cost_base = Some(30);
4189 cfg.tx_context_gas_price_cost_base = Some(30);
4190 cfg.tx_context_gas_budget_cost_base = Some(30);
4191 cfg.tx_context_ids_created_cost_base = Some(30);
4192 cfg.tx_context_replace_cost_base = Some(30);
4193 cfg.gas_model_version = Some(10);
4194
4195 if chain != Chain::Mainnet {
4196 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4197 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4198
4199 cfg.feature_flags.per_object_congestion_control_mode =
4201 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4202 ExecutionTimeEstimateParams {
4203 target_utilization: 30,
4204 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4206 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4208 stored_observations_limit: u64::MAX,
4209 stake_weighted_median_threshold: 0,
4210 default_none_duration_for_new_keys: false,
4211 observations_chunk_size: None,
4212 },
4213 );
4214 }
4215 }
4216 79 => {
4217 if chain != Chain::Mainnet {
4218 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4219
4220 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4223
4224 cfg.feature_flags.consensus_batched_block_sync = true;
4225
4226 cfg.feature_flags.enable_nitro_attestation = true
4228 }
4229 cfg.feature_flags.normalize_ptb_arguments = true;
4230
4231 cfg.consensus_gc_depth = Some(60);
4232 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4233 }
4234 80 => {
4235 cfg.max_ptb_value_size = Some(1024 * 1024);
4236 }
4237 81 => {
4238 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4239 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4240 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4241 }
4242 82 => {
4243 cfg.feature_flags.max_ptb_value_size_v2 = true;
4244 }
4245 83 => {
4246 if chain == Chain::Mainnet {
4247 let aliased: [u8; 32] = Hex::decode(
4249 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4250 )
4251 .unwrap()
4252 .try_into()
4253 .unwrap();
4254
4255 cfg.aliased_addresses.push(AliasedAddress {
4257 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4258 aliased,
4259 allowed_tx_digests: vec![
4260 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4261 ],
4262 });
4263
4264 cfg.aliased_addresses.push(AliasedAddress {
4265 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4266 aliased,
4267 allowed_tx_digests: vec![
4268 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4269 ],
4270 });
4271 }
4272
4273 if chain != Chain::Mainnet {
4276 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4277 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4278
4279 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4281 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4282 cfg.feature_flags.per_object_congestion_control_mode =
4283 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4284 ExecutionTimeEstimateParams {
4285 target_utilization: 30,
4286 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4288 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4290 stored_observations_limit: u64::MAX,
4291 stake_weighted_median_threshold: 0,
4292 default_none_duration_for_new_keys: false,
4293 observations_chunk_size: None,
4294 },
4295 );
4296
4297 cfg.feature_flags.consensus_batched_block_sync = true;
4299
4300 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4303 cfg.feature_flags.enable_nitro_attestation = true;
4304 }
4305 }
4306 84 => {
4307 if chain == Chain::Mainnet {
4308 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4309 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4310
4311 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4313 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4314 cfg.feature_flags.per_object_congestion_control_mode =
4315 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4316 ExecutionTimeEstimateParams {
4317 target_utilization: 30,
4318 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4320 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4322 stored_observations_limit: u64::MAX,
4323 stake_weighted_median_threshold: 0,
4324 default_none_duration_for_new_keys: false,
4325 observations_chunk_size: None,
4326 },
4327 );
4328
4329 cfg.feature_flags.consensus_batched_block_sync = true;
4331
4332 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4335 cfg.feature_flags.enable_nitro_attestation = true;
4336 }
4337
4338 cfg.feature_flags.per_object_congestion_control_mode =
4340 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4341 ExecutionTimeEstimateParams {
4342 target_utilization: 30,
4343 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4345 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4347 stored_observations_limit: 20,
4348 stake_weighted_median_threshold: 0,
4349 default_none_duration_for_new_keys: false,
4350 observations_chunk_size: None,
4351 },
4352 );
4353 cfg.feature_flags.allow_unbounded_system_objects = true;
4354 }
4355 85 => {
4356 if chain != Chain::Mainnet && chain != Chain::Testnet {
4357 cfg.feature_flags.enable_party_transfer = true;
4358 }
4359
4360 cfg.feature_flags
4361 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4362 cfg.feature_flags.disallow_self_identifier = true;
4363 cfg.feature_flags.per_object_congestion_control_mode =
4364 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4365 ExecutionTimeEstimateParams {
4366 target_utilization: 50,
4367 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4369 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4371 stored_observations_limit: 20,
4372 stake_weighted_median_threshold: 0,
4373 default_none_duration_for_new_keys: false,
4374 observations_chunk_size: None,
4375 },
4376 );
4377 }
4378 86 => {
4379 cfg.feature_flags.type_tags_in_object_runtime = true;
4380 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4381
4382 cfg.feature_flags.per_object_congestion_control_mode =
4384 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4385 ExecutionTimeEstimateParams {
4386 target_utilization: 50,
4387 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4389 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4391 stored_observations_limit: 20,
4392 stake_weighted_median_threshold: 3334,
4393 default_none_duration_for_new_keys: false,
4394 observations_chunk_size: None,
4395 },
4396 );
4397 if chain != Chain::Mainnet {
4399 cfg.feature_flags.enable_party_transfer = true;
4400 }
4401 }
4402 87 => {
4403 if chain == Chain::Mainnet {
4404 cfg.feature_flags.record_time_estimate_processed = true;
4405 }
4406 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4407 }
4408 88 => {
4409 cfg.feature_flags.record_time_estimate_processed = true;
4410 cfg.tx_context_rgp_cost_base = Some(30);
4411 cfg.feature_flags
4412 .ignore_execution_time_observations_after_certs_closed = true;
4413
4414 cfg.feature_flags.per_object_congestion_control_mode =
4417 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4418 ExecutionTimeEstimateParams {
4419 target_utilization: 50,
4420 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4422 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4424 stored_observations_limit: 20,
4425 stake_weighted_median_threshold: 3334,
4426 default_none_duration_for_new_keys: true,
4427 observations_chunk_size: None,
4428 },
4429 );
4430 }
4431 89 => {
4432 cfg.feature_flags.dependency_linkage_error = true;
4433 cfg.feature_flags.additional_multisig_checks = true;
4434 }
4435 90 => {
4436 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4438 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4439 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4440 cfg.feature_flags.accept_passkey_in_multisig = true;
4441 cfg.feature_flags.passkey_auth = true;
4442 cfg.feature_flags.check_for_init_during_upgrade = true;
4443
4444 if chain != Chain::Mainnet {
4446 cfg.feature_flags.mysticeti_fastpath = true;
4447 }
4448 }
4449 91 => {
4450 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4451 }
4452 92 => {
4453 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4454 }
4455 93 => {
4456 cfg.feature_flags
4457 .consensus_checkpoint_signature_key_includes_digest = true;
4458 }
4459 94 => {
4460 cfg.feature_flags.per_object_congestion_control_mode =
4462 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4463 ExecutionTimeEstimateParams {
4464 target_utilization: 50,
4465 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4467 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4469 stored_observations_limit: 18,
4470 stake_weighted_median_threshold: 3334,
4471 default_none_duration_for_new_keys: true,
4472 observations_chunk_size: None,
4473 },
4474 );
4475
4476 cfg.feature_flags.enable_party_transfer = true;
4478 }
4479 95 => {
4480 cfg.type_name_id_base_cost = Some(52);
4481
4482 cfg.max_transactions_per_checkpoint = Some(20_000);
4484 }
4485 96 => {
4486 if chain != Chain::Mainnet && chain != Chain::Testnet {
4488 cfg.feature_flags
4489 .include_checkpoint_artifacts_digest_in_summary = true;
4490 }
4491 cfg.feature_flags.correct_gas_payment_limit_check = true;
4492 cfg.feature_flags.authority_capabilities_v2 = true;
4493 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4494 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4495 cfg.feature_flags.enable_coin_registry = true;
4496
4497 cfg.feature_flags.mysticeti_fastpath = true;
4499 }
4500 97 => {
4501 cfg.feature_flags.additional_borrow_checks = true;
4502 }
4503 98 => {
4504 cfg.event_emit_auth_stream_cost = Some(52);
4505 cfg.feature_flags.better_loader_errors = true;
4506 cfg.feature_flags.generate_df_type_layouts = true;
4507 }
4508 99 => {
4509 cfg.feature_flags.use_new_commit_handler = true;
4510 }
4511 100 => {
4512 cfg.feature_flags.private_generics_verifier_v2 = true;
4513 }
4514 101 => {
4515 cfg.feature_flags.create_root_accumulator_object = true;
4516 cfg.max_updates_per_settlement_txn = Some(100);
4517 if chain != Chain::Mainnet {
4518 cfg.feature_flags.enable_poseidon = true;
4519 }
4520 }
4521 102 => {
4522 cfg.feature_flags.per_object_congestion_control_mode =
4526 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4527 ExecutionTimeEstimateParams {
4528 target_utilization: 50,
4529 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4531 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4533 stored_observations_limit: 180,
4534 stake_weighted_median_threshold: 3334,
4535 default_none_duration_for_new_keys: true,
4536 observations_chunk_size: Some(18),
4537 },
4538 );
4539 cfg.feature_flags.deprecate_global_storage_ops = true;
4540 }
4541 103 => {}
4542 104 => {
4543 cfg.translation_per_command_base_charge = Some(1);
4544 cfg.translation_per_input_base_charge = Some(1);
4545 cfg.translation_pure_input_per_byte_charge = Some(1);
4546 cfg.translation_per_type_node_charge = Some(1);
4547 cfg.translation_per_reference_node_charge = Some(1);
4548 cfg.translation_per_linkage_entry_charge = Some(10);
4549 cfg.gas_model_version = Some(11);
4550 cfg.feature_flags.abstract_size_in_object_runtime = true;
4551 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4552 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4553 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4554 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4555 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4556 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4557 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4558 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4559 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4560 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4561 cfg.feature_flags.enable_ptb_execution_v2 = true;
4562
4563 cfg.poseidon_bn254_cost_base = Some(260);
4564
4565 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4566
4567 if chain != Chain::Mainnet {
4568 cfg.feature_flags
4569 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4570 }
4571
4572 cfg.feature_flags
4573 .include_cancelled_randomness_txns_in_prologue = true;
4574 }
4575 105 => {
4576 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4577 cfg.feature_flags.disable_preconsensus_locking = true;
4578
4579 if chain != Chain::Mainnet {
4580 cfg.feature_flags
4581 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4582 }
4583 }
4584 106 => {
4585 cfg.accumulator_object_storage_cost = Some(7600);
4587
4588 if chain != Chain::Mainnet && chain != Chain::Testnet {
4589 cfg.feature_flags.enable_accumulators = true;
4590 cfg.feature_flags.enable_address_balance_gas_payments = true;
4591 cfg.feature_flags.enable_authenticated_event_streams = true;
4592 cfg.feature_flags.enable_object_funds_withdraw = true;
4593 }
4594 }
4595 107 => {
4596 cfg.feature_flags
4597 .consensus_skip_gced_blocks_in_direct_finalization = true;
4598
4599 if in_integration_test() {
4601 cfg.consensus_gc_depth = Some(6);
4602 cfg.consensus_max_num_transactions_in_block = Some(8);
4603 }
4604 }
4605 108 => {
4606 cfg.feature_flags.gas_rounding_halve_digits = true;
4607 cfg.feature_flags.flexible_tx_context_positions = true;
4608 cfg.feature_flags.disable_entry_point_signature_check = true;
4609
4610 if chain != Chain::Mainnet {
4611 cfg.feature_flags.address_aliases = true;
4612
4613 cfg.feature_flags.enable_accumulators = true;
4614 cfg.feature_flags.enable_address_balance_gas_payments = true;
4615 }
4616
4617 cfg.feature_flags.enable_poseidon = true;
4618 }
4619 109 => {
4620 cfg.binary_variant_handles = Some(1024);
4621 cfg.binary_variant_instantiation_handles = Some(1024);
4622 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4623 }
4624 110 => {
4625 cfg.feature_flags
4626 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4627 cfg.feature_flags
4628 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4629 if chain != Chain::Mainnet && chain != Chain::Testnet {
4630 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4631 }
4632 cfg.feature_flags.validate_zklogin_public_identifier = true;
4633 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4634 cfg.feature_flags
4635 .consensus_always_accept_system_transactions = true;
4636 if chain != Chain::Mainnet {
4637 cfg.feature_flags.enable_object_funds_withdraw = true;
4638 }
4639 }
4640 111 => {
4641 cfg.feature_flags.validator_metadata_verify_v2 = true;
4642 }
4643 112 => {
4644 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4645 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4646 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4647 cfg.group_ops_ristretto_point_add_cost = Some(500);
4648 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4649 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4650 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4651 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4652 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4653 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4654
4655 if chain != Chain::Mainnet && chain != Chain::Testnet {
4656 cfg.feature_flags.enable_ristretto255_group_ops = true;
4657 }
4658 }
4659 113 => {
4660 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4661 if chain != Chain::Mainnet && chain != Chain::Testnet {
4662 cfg.feature_flags.defer_unpaid_amplification = true;
4663 }
4664 }
4665 114 => {
4666 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4667 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4668 if chain != Chain::Mainnet {
4669 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4670 cfg.feature_flags.enable_authenticated_event_streams = true;
4671 cfg.feature_flags
4672 .include_checkpoint_artifacts_digest_in_summary = true;
4673 }
4674 }
4675 115 => {
4676 cfg.feature_flags.normalize_depth_formula = true;
4677 }
4678 116 => {
4679 cfg.feature_flags.gasless_transaction_drop_safety = true;
4680 cfg.feature_flags.address_aliases = true;
4681 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4682 cfg.feature_flags.defer_unpaid_amplification = false;
4684 cfg.feature_flags.enable_display_registry = true;
4685 }
4686 117 => {}
4687 118 => {
4688 cfg.execution_version = Some(4);
4690 cfg.feature_flags.new_vm_enabled = true;
4691 }
4692 _ => panic!("unsupported version {:?}", version),
4703 }
4704 }
4705
4706 cfg
4707 }
4708
4709 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4710 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4711 || !self.feature_flags.split_checkpoints_in_consensus_handler
4712 {
4713 return;
4714 }
4715
4716 if !mysten_common::in_test_configuration() {
4717 return;
4718 }
4719
4720 use rand::{Rng, SeedableRng, rngs::StdRng};
4721 let mut rng = StdRng::from_seed(*seed);
4722 let max_txns = rng.gen_range(10..=100u64);
4723 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4724 self.max_transactions_per_checkpoint = Some(max_txns);
4725 }
4726
4727 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4733 let (
4734 max_back_edges_per_function,
4735 max_back_edges_per_module,
4736 sanity_check_with_regex_reference_safety,
4737 ) = if let Some((
4738 max_back_edges_per_function,
4739 max_back_edges_per_module,
4740 sanity_check_with_regex_reference_safety,
4741 )) = signing_limits
4742 {
4743 (
4744 Some(max_back_edges_per_function),
4745 Some(max_back_edges_per_module),
4746 Some(sanity_check_with_regex_reference_safety),
4747 )
4748 } else {
4749 (None, None, None)
4750 };
4751
4752 let additional_borrow_checks = if signing_limits.is_some() {
4753 true
4755 } else {
4756 self.additional_borrow_checks()
4757 };
4758 let deprecate_global_storage_ops = if signing_limits.is_some() {
4759 true
4761 } else {
4762 self.deprecate_global_storage_ops()
4763 };
4764
4765 VerifierConfig {
4766 max_loop_depth: Some(self.max_loop_depth() as usize),
4767 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4768 max_function_parameters: Some(self.max_function_parameters() as usize),
4769 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4770 max_value_stack_size: self.max_value_stack_size() as usize,
4771 max_type_nodes: Some(self.max_type_nodes() as usize),
4772 max_push_size: Some(self.max_push_size() as usize),
4773 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4774 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4775 max_function_definitions: Some(self.max_function_definitions() as usize),
4776 max_data_definitions: Some(self.max_struct_definitions() as usize),
4777 max_constant_vector_len: Some(self.max_move_vector_len()),
4778 max_back_edges_per_function,
4779 max_back_edges_per_module,
4780 max_basic_blocks_in_script: None,
4781 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4783 allow_receiving_object_id: self.allow_receiving_object_id(),
4784 reject_mutable_random_on_entry_functions: self
4785 .reject_mutable_random_on_entry_functions(),
4786 bytecode_version: self.move_binary_format_version(),
4787 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4788 additional_borrow_checks,
4789 better_loader_errors: self.better_loader_errors(),
4790 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4791 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4792 .map(|limit| limit as u128),
4793 deprecate_global_storage_ops,
4794 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4795 switch_to_regex_reference_safety: false,
4796 }
4797 }
4798
4799 pub fn binary_config(
4800 &self,
4801 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4802 ) -> BinaryConfig {
4803 let deprecate_global_storage_ops =
4804 override_deprecate_global_storage_ops_during_deserialization
4805 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4806 BinaryConfig::new(
4807 self.move_binary_format_version(),
4808 self.min_move_binary_format_version_as_option()
4809 .unwrap_or(VERSION_1),
4810 self.no_extraneous_module_bytes(),
4811 deprecate_global_storage_ops,
4812 TableConfig {
4813 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4814 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4815 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4816 function_instantiations: self
4817 .binary_function_instantiations_as_option()
4818 .unwrap_or(u16::MAX),
4819 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4820 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4821 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4822 address_identifiers: self
4823 .binary_address_identifiers_as_option()
4824 .unwrap_or(u16::MAX),
4825 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4826 struct_def_instantiations: self
4827 .binary_struct_def_instantiations_as_option()
4828 .unwrap_or(u16::MAX),
4829 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4830 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4831 field_instantiations: self
4832 .binary_field_instantiations_as_option()
4833 .unwrap_or(u16::MAX),
4834 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4835 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4836 enum_def_instantiations: self
4837 .binary_enum_def_instantiations_as_option()
4838 .unwrap_or(u16::MAX),
4839 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4840 variant_instantiation_handles: self
4841 .binary_variant_instantiation_handles_as_option()
4842 .unwrap_or(u16::MAX),
4843 },
4844 )
4845 }
4846
4847 pub fn apply_overrides_for_testing(
4851 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4852 ) -> OverrideGuard {
4853 CONFIG_OVERRIDE.with(|ovr| {
4854 let mut cur = ovr.borrow_mut();
4855 assert!(cur.is_none(), "config override already present");
4856 *cur = Some(Box::new(override_fn));
4857 OverrideGuard
4858 })
4859 }
4860}
4861
4862impl ProtocolConfig {
4866 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4867 self.feature_flags
4868 .advance_to_highest_supported_protocol_version = val
4869 }
4870 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4871 self.feature_flags.commit_root_state_digest = val
4872 }
4873 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4874 self.feature_flags.zklogin_auth = val
4875 }
4876 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4877 self.feature_flags.enable_jwk_consensus_updates = val
4878 }
4879 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4880 self.feature_flags.random_beacon = val
4881 }
4882
4883 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4884 self.feature_flags.upgraded_multisig_supported = val
4885 }
4886 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4887 self.feature_flags.accept_zklogin_in_multisig = val
4888 }
4889
4890 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4891 self.feature_flags.shared_object_deletion = val;
4892 }
4893
4894 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4895 self.feature_flags.narwhal_new_leader_election_schedule = val;
4896 }
4897
4898 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4899 self.feature_flags.receive_objects = val
4900 }
4901 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4902 self.feature_flags.narwhal_certificate_v2 = val
4903 }
4904 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4905 self.feature_flags.verify_legacy_zklogin_address = val
4906 }
4907
4908 pub fn set_per_object_congestion_control_mode_for_testing(
4909 &mut self,
4910 val: PerObjectCongestionControlMode,
4911 ) {
4912 self.feature_flags.per_object_congestion_control_mode = val;
4913 }
4914
4915 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4916 self.feature_flags.consensus_choice = val;
4917 }
4918
4919 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4920 self.feature_flags.consensus_network = val;
4921 }
4922
4923 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4924 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4925 }
4926
4927 pub fn set_disable_bridge_for_testing(&mut self) {
4928 self.feature_flags.bridge = false
4929 }
4930
4931 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4932 self.feature_flags.mysticeti_num_leaders_per_round = val;
4933 }
4934
4935 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4936 self.feature_flags.soft_bundle = val;
4937 }
4938
4939 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4940 self.feature_flags.passkey_auth = val
4941 }
4942
4943 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4944 self.feature_flags.enable_party_transfer = val
4945 }
4946
4947 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4948 self.feature_flags
4949 .consensus_distributed_vote_scoring_strategy = val;
4950 }
4951
4952 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4953 self.feature_flags.consensus_round_prober = val;
4954 }
4955
4956 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4957 self.feature_flags
4958 .disallow_new_modules_in_deps_only_packages = val;
4959 }
4960
4961 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4962 self.feature_flags.correct_gas_payment_limit_check = val;
4963 }
4964
4965 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4966 self.feature_flags.address_aliases = val;
4967 }
4968
4969 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4970 self.feature_flags
4971 .consensus_round_prober_probe_accepted_rounds = val;
4972 }
4973
4974 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4975 self.feature_flags.mysticeti_fastpath = val;
4976 }
4977
4978 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4979 self.feature_flags.accept_passkey_in_multisig = val;
4980 }
4981
4982 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4983 self.feature_flags.consensus_batched_block_sync = val;
4984 }
4985
4986 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4987 self.feature_flags.record_time_estimate_processed = val;
4988 }
4989
4990 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4991 &mut self,
4992 val: bool,
4993 ) {
4994 self.feature_flags
4995 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4996 }
4997
4998 pub fn enable_accumulators_for_testing(&mut self) {
4999 self.feature_flags.enable_accumulators = true;
5000 }
5001
5002 pub fn disable_accumulators_for_testing(&mut self) {
5003 self.feature_flags.enable_accumulators = false;
5004 self.feature_flags.enable_address_balance_gas_payments = false;
5005 }
5006
5007 pub fn enable_coin_reservation_for_testing(&mut self) {
5008 self.feature_flags.enable_coin_reservation_obj_refs = true;
5009 }
5010
5011 pub fn create_root_accumulator_object_for_testing(&mut self) {
5012 self.feature_flags.create_root_accumulator_object = true;
5013 }
5014
5015 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5016 self.feature_flags.create_root_accumulator_object = false;
5017 }
5018
5019 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5020 self.feature_flags.enable_accumulators = true;
5021 self.feature_flags.allow_private_accumulator_entrypoints = true;
5022 self.feature_flags.enable_address_balance_gas_payments = true;
5023 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5024 self.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
5025 }
5026
5027 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5028 self.feature_flags.enable_address_balance_gas_payments = false;
5029 }
5030
5031 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5032 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5033 }
5034
5035 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5036 self.enable_accumulators_for_testing();
5037 self.feature_flags.enable_authenticated_event_streams = true;
5038 self.feature_flags
5039 .include_checkpoint_artifacts_digest_in_summary = true;
5040 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5041 }
5042
5043 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5044 self.feature_flags.enable_authenticated_event_streams = false;
5045 }
5046
5047 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5048 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5049 }
5050
5051 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5052 self.feature_flags.enable_non_exclusive_writes = true;
5053 }
5054
5055 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5056 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5057 }
5058
5059 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5060 &mut self,
5061 val: bool,
5062 ) {
5063 self.feature_flags
5064 .ignore_execution_time_observations_after_certs_closed = val;
5065 }
5066
5067 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5068 &mut self,
5069 val: bool,
5070 ) {
5071 self.feature_flags
5072 .consensus_checkpoint_signature_key_includes_digest = val;
5073 }
5074
5075 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5076 self.feature_flags.cancel_for_failed_dkg_early = val;
5077 }
5078
5079 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5080 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5081 }
5082
5083 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5084 self.feature_flags.authority_capabilities_v2 = val;
5085 }
5086
5087 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5088 self.feature_flags.allow_references_in_ptbs = true;
5089 }
5090
5091 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5092 self.feature_flags.consensus_skip_gced_accept_votes = val;
5093 }
5094
5095 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5096 self.feature_flags.enable_object_funds_withdraw = val;
5097 }
5098
5099 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5100 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5101 }
5102}
5103
5104type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5105
5106thread_local! {
5107 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5108}
5109
5110#[must_use]
5111pub struct OverrideGuard;
5112
5113impl Drop for OverrideGuard {
5114 fn drop(&mut self) {
5115 info!("restoring override fn");
5116 CONFIG_OVERRIDE.with(|ovr| {
5117 *ovr.borrow_mut() = None;
5118 });
5119 }
5120}
5121
5122#[derive(PartialEq, Eq)]
5125pub enum LimitThresholdCrossed {
5126 None,
5127 Soft(u128, u128),
5128 Hard(u128, u128),
5129}
5130
5131pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5134 x: T,
5135 soft_limit: U,
5136 hard_limit: V,
5137) -> LimitThresholdCrossed {
5138 let x: V = x.into();
5139 let soft_limit: V = soft_limit.into();
5140
5141 debug_assert!(soft_limit <= hard_limit);
5142
5143 if x >= hard_limit {
5146 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5147 } else if x < soft_limit {
5148 LimitThresholdCrossed::None
5149 } else {
5150 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5151 }
5152}
5153
5154#[macro_export]
5155macro_rules! check_limit {
5156 ($x:expr, $hard:expr) => {
5157 check_limit!($x, $hard, $hard)
5158 };
5159 ($x:expr, $soft:expr, $hard:expr) => {
5160 check_limit_in_range($x as u64, $soft, $hard)
5161 };
5162}
5163
5164#[macro_export]
5168macro_rules! check_limit_by_meter {
5169 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5170 let (h, metered_str) = if $is_metered {
5172 ($metered_limit, "metered")
5173 } else {
5174 ($unmetered_hard_limit, "unmetered")
5176 };
5177 use sui_protocol_config::check_limit_in_range;
5178 let result = check_limit_in_range($x as u64, $metered_limit, h);
5179 match result {
5180 LimitThresholdCrossed::None => {}
5181 LimitThresholdCrossed::Soft(_, _) => {
5182 $metric.with_label_values(&[metered_str, "soft"]).inc();
5183 }
5184 LimitThresholdCrossed::Hard(_, _) => {
5185 $metric.with_label_values(&[metered_str, "hard"]).inc();
5186 }
5187 };
5188 result
5189 }};
5190}
5191#[cfg(all(test, not(msim)))]
5192mod test {
5193 use insta::assert_yaml_snapshot;
5194
5195 use super::*;
5196
5197 #[test]
5198 fn snapshot_tests() {
5199 println!("\n============================================================================");
5200 println!("! !");
5201 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5202 println!("! !");
5203 println!("============================================================================\n");
5204 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5205 let chain_str = match chain_id {
5209 Chain::Unknown => "".to_string(),
5210 _ => format!("{:?}_", chain_id),
5211 };
5212 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5213 let cur = ProtocolVersion::new(i);
5214 assert_yaml_snapshot!(
5215 format!("{}version_{}", chain_str, cur.as_u64()),
5216 ProtocolConfig::get_for_version(cur, *chain_id)
5217 );
5218 }
5219 }
5220 }
5221
5222 #[test]
5223 fn test_getters() {
5224 let prot: ProtocolConfig =
5225 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5226 assert_eq!(
5227 prot.max_arguments(),
5228 prot.max_arguments_as_option().unwrap()
5229 );
5230 }
5231
5232 #[test]
5233 fn test_setters() {
5234 let mut prot: ProtocolConfig =
5235 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5236 prot.set_max_arguments_for_testing(123);
5237 assert_eq!(prot.max_arguments(), 123);
5238
5239 prot.set_max_arguments_from_str_for_testing("321".to_string());
5240 assert_eq!(prot.max_arguments(), 321);
5241
5242 prot.disable_max_arguments_for_testing();
5243 assert_eq!(prot.max_arguments_as_option(), None);
5244
5245 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5246 assert_eq!(prot.max_arguments(), 456);
5247 }
5248
5249 #[test]
5250 #[should_panic(expected = "unsupported version")]
5251 fn max_version_test() {
5252 let _ = ProtocolConfig::get_for_version_impl(
5255 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5256 Chain::Unknown,
5257 );
5258 }
5259
5260 #[test]
5261 fn lookup_by_string_test() {
5262 let prot: ProtocolConfig =
5263 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5264 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5266
5267 assert!(
5268 prot.lookup_attr("max_arguments".to_string())
5269 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5270 );
5271
5272 assert!(
5274 prot.lookup_attr("max_move_identifier_len".to_string())
5275 .is_none()
5276 );
5277
5278 let prot: ProtocolConfig =
5280 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5281 assert!(
5282 prot.lookup_attr("max_move_identifier_len".to_string())
5283 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5284 );
5285
5286 let prot: ProtocolConfig =
5287 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5288 assert!(
5290 prot.attr_map()
5291 .get("max_move_identifier_len")
5292 .unwrap()
5293 .is_none()
5294 );
5295 assert!(
5297 prot.attr_map().get("max_arguments").unwrap()
5298 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5299 );
5300
5301 let prot: ProtocolConfig =
5303 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5304 assert!(
5306 prot.feature_flags
5307 .lookup_attr("some random string".to_owned())
5308 .is_none()
5309 );
5310 assert!(
5311 !prot
5312 .feature_flags
5313 .attr_map()
5314 .contains_key("some random string")
5315 );
5316
5317 assert!(
5319 prot.feature_flags
5320 .lookup_attr("package_upgrades".to_owned())
5321 == Some(false)
5322 );
5323 assert!(
5324 prot.feature_flags
5325 .attr_map()
5326 .get("package_upgrades")
5327 .unwrap()
5328 == &false
5329 );
5330 let prot: ProtocolConfig =
5331 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5332 assert!(
5334 prot.feature_flags
5335 .lookup_attr("package_upgrades".to_owned())
5336 == Some(true)
5337 );
5338 assert!(
5339 prot.feature_flags
5340 .attr_map()
5341 .get("package_upgrades")
5342 .unwrap()
5343 == &true
5344 );
5345 }
5346
5347 #[test]
5348 fn limit_range_fn_test() {
5349 let low = 100u32;
5350 let high = 10000u64;
5351
5352 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5353 assert!(matches!(
5354 check_limit!(255u16, low, high),
5355 LimitThresholdCrossed::Soft(255u128, 100)
5356 ));
5357 assert!(matches!(
5363 check_limit!(2550000u64, low, high),
5364 LimitThresholdCrossed::Hard(2550000, 10000)
5365 ));
5366
5367 assert!(matches!(
5368 check_limit!(2550000u64, high, high),
5369 LimitThresholdCrossed::Hard(2550000, 10000)
5370 ));
5371
5372 assert!(matches!(
5373 check_limit!(1u8, high),
5374 LimitThresholdCrossed::None
5375 ));
5376
5377 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5378
5379 assert!(matches!(
5380 check_limit!(2550000u64, high),
5381 LimitThresholdCrossed::Hard(2550000, 10000)
5382 ));
5383 }
5384}