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
1030fn is_false(b: &bool) -> bool {
1031 !b
1032}
1033
1034fn is_empty(b: &BTreeSet<String>) -> bool {
1035 b.is_empty()
1036}
1037
1038fn is_zero(val: &u64) -> bool {
1039 *val == 0
1040}
1041
1042#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1044pub enum ConsensusTransactionOrdering {
1045 #[default]
1047 None,
1048 ByGasPrice,
1050}
1051
1052impl ConsensusTransactionOrdering {
1053 pub fn is_none(&self) -> bool {
1054 matches!(self, ConsensusTransactionOrdering::None)
1055 }
1056}
1057
1058#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1059pub struct ExecutionTimeEstimateParams {
1060 pub target_utilization: u64,
1062 pub allowed_txn_cost_overage_burst_limit_us: u64,
1066
1067 pub randomness_scalar: u64,
1070
1071 pub max_estimate_us: u64,
1073
1074 pub stored_observations_num_included_checkpoints: u64,
1077
1078 pub stored_observations_limit: u64,
1080
1081 #[serde(skip_serializing_if = "is_zero")]
1084 pub stake_weighted_median_threshold: u64,
1085
1086 #[serde(skip_serializing_if = "is_false")]
1090 pub default_none_duration_for_new_keys: bool,
1091
1092 #[serde(skip_serializing_if = "Option::is_none")]
1094 pub observations_chunk_size: Option<u64>,
1095}
1096
1097#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1099pub enum PerObjectCongestionControlMode {
1100 #[default]
1101 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1107
1108impl PerObjectCongestionControlMode {
1109 pub fn is_none(&self) -> bool {
1110 matches!(self, PerObjectCongestionControlMode::None)
1111 }
1112}
1113
1114#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1116pub enum ConsensusChoice {
1117 #[default]
1118 Narwhal,
1119 SwapEachEpoch,
1120 Mysticeti,
1121}
1122
1123impl ConsensusChoice {
1124 pub fn is_narwhal(&self) -> bool {
1125 matches!(self, ConsensusChoice::Narwhal)
1126 }
1127}
1128
1129#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1131pub enum ConsensusNetwork {
1132 #[default]
1133 Anemo,
1134 Tonic,
1135}
1136
1137impl ConsensusNetwork {
1138 pub fn is_anemo(&self) -> bool {
1139 matches!(self, ConsensusNetwork::Anemo)
1140 }
1141}
1142
1143#[skip_serializing_none]
1175#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1176pub struct ProtocolConfig {
1177 pub version: ProtocolVersion,
1178
1179 feature_flags: FeatureFlags,
1180
1181 max_tx_size_bytes: Option<u64>,
1184
1185 max_input_objects: Option<u64>,
1187
1188 max_size_written_objects: Option<u64>,
1192 max_size_written_objects_system_tx: Option<u64>,
1195
1196 max_serialized_tx_effects_size_bytes: Option<u64>,
1198
1199 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1201
1202 max_gas_payment_objects: Option<u32>,
1204
1205 max_modules_in_publish: Option<u32>,
1207
1208 max_package_dependencies: Option<u32>,
1210
1211 max_arguments: Option<u32>,
1214
1215 max_type_arguments: Option<u32>,
1217
1218 max_type_argument_depth: Option<u32>,
1220
1221 max_pure_argument_size: Option<u32>,
1223
1224 max_programmable_tx_commands: Option<u32>,
1226
1227 move_binary_format_version: Option<u32>,
1230 min_move_binary_format_version: Option<u32>,
1231
1232 binary_module_handles: Option<u16>,
1234 binary_struct_handles: Option<u16>,
1235 binary_function_handles: Option<u16>,
1236 binary_function_instantiations: Option<u16>,
1237 binary_signatures: Option<u16>,
1238 binary_constant_pool: Option<u16>,
1239 binary_identifiers: Option<u16>,
1240 binary_address_identifiers: Option<u16>,
1241 binary_struct_defs: Option<u16>,
1242 binary_struct_def_instantiations: Option<u16>,
1243 binary_function_defs: Option<u16>,
1244 binary_field_handles: Option<u16>,
1245 binary_field_instantiations: Option<u16>,
1246 binary_friend_decls: Option<u16>,
1247 binary_enum_defs: Option<u16>,
1248 binary_enum_def_instantiations: Option<u16>,
1249 binary_variant_handles: Option<u16>,
1250 binary_variant_instantiation_handles: Option<u16>,
1251
1252 max_move_object_size: Option<u64>,
1254
1255 max_move_package_size: Option<u64>,
1258
1259 max_publish_or_upgrade_per_ptb: Option<u64>,
1261
1262 max_tx_gas: Option<u64>,
1264
1265 max_gas_price: Option<u64>,
1267
1268 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1271
1272 max_gas_computation_bucket: Option<u64>,
1274
1275 gas_rounding_step: Option<u64>,
1277
1278 max_loop_depth: Option<u64>,
1280
1281 max_generic_instantiation_length: Option<u64>,
1283
1284 max_function_parameters: Option<u64>,
1286
1287 max_basic_blocks: Option<u64>,
1289
1290 max_value_stack_size: Option<u64>,
1292
1293 max_type_nodes: Option<u64>,
1295
1296 max_push_size: Option<u64>,
1298
1299 max_struct_definitions: Option<u64>,
1301
1302 max_function_definitions: Option<u64>,
1304
1305 max_fields_in_struct: Option<u64>,
1307
1308 max_dependency_depth: Option<u64>,
1310
1311 max_num_event_emit: Option<u64>,
1313
1314 max_num_new_move_object_ids: Option<u64>,
1316
1317 max_num_new_move_object_ids_system_tx: Option<u64>,
1319
1320 max_num_deleted_move_object_ids: Option<u64>,
1322
1323 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1325
1326 max_num_transferred_move_object_ids: Option<u64>,
1328
1329 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1331
1332 max_event_emit_size: Option<u64>,
1334
1335 max_event_emit_size_total: Option<u64>,
1337
1338 max_move_vector_len: Option<u64>,
1340
1341 max_move_identifier_len: Option<u64>,
1343
1344 max_move_value_depth: Option<u64>,
1346
1347 max_move_enum_variants: Option<u64>,
1349
1350 max_back_edges_per_function: Option<u64>,
1352
1353 max_back_edges_per_module: Option<u64>,
1355
1356 max_verifier_meter_ticks_per_function: Option<u64>,
1358
1359 max_meter_ticks_per_module: Option<u64>,
1361
1362 max_meter_ticks_per_package: Option<u64>,
1364
1365 object_runtime_max_num_cached_objects: Option<u64>,
1369
1370 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1372
1373 object_runtime_max_num_store_entries: Option<u64>,
1375
1376 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1378
1379 base_tx_cost_fixed: Option<u64>,
1382
1383 package_publish_cost_fixed: Option<u64>,
1386
1387 base_tx_cost_per_byte: Option<u64>,
1390
1391 package_publish_cost_per_byte: Option<u64>,
1393
1394 obj_access_cost_read_per_byte: Option<u64>,
1396
1397 obj_access_cost_mutate_per_byte: Option<u64>,
1399
1400 obj_access_cost_delete_per_byte: Option<u64>,
1402
1403 obj_access_cost_verify_per_byte: Option<u64>,
1413
1414 max_type_to_layout_nodes: Option<u64>,
1416
1417 max_ptb_value_size: Option<u64>,
1419
1420 gas_model_version: Option<u64>,
1423
1424 obj_data_cost_refundable: Option<u64>,
1427
1428 obj_metadata_cost_non_refundable: Option<u64>,
1432
1433 storage_rebate_rate: Option<u64>,
1439
1440 storage_fund_reinvest_rate: Option<u64>,
1443
1444 reward_slashing_rate: Option<u64>,
1447
1448 storage_gas_price: Option<u64>,
1450
1451 accumulator_object_storage_cost: Option<u64>,
1453
1454 max_transactions_per_checkpoint: Option<u64>,
1459
1460 max_checkpoint_size_bytes: Option<u64>,
1464
1465 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1470
1471 address_from_bytes_cost_base: Option<u64>,
1476 address_to_u256_cost_base: Option<u64>,
1478 address_from_u256_cost_base: Option<u64>,
1480
1481 config_read_setting_impl_cost_base: Option<u64>,
1486 config_read_setting_impl_cost_per_byte: Option<u64>,
1487
1488 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1491 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1492 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1493 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1494 dynamic_field_add_child_object_cost_base: Option<u64>,
1496 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1497 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1498 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1499 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1501 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1502 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1503 dynamic_field_remove_child_object_cost_base: Option<u64>,
1505 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1506 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1507 dynamic_field_has_child_object_cost_base: Option<u64>,
1509 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1511 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1512 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1513
1514 event_emit_cost_base: Option<u64>,
1517 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1518 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1519 event_emit_output_cost_per_byte: Option<u64>,
1520 event_emit_auth_stream_cost: Option<u64>,
1521
1522 object_borrow_uid_cost_base: Option<u64>,
1525 object_delete_impl_cost_base: Option<u64>,
1527 object_record_new_uid_cost_base: Option<u64>,
1529
1530 transfer_transfer_internal_cost_base: Option<u64>,
1533 transfer_party_transfer_internal_cost_base: Option<u64>,
1535 transfer_freeze_object_cost_base: Option<u64>,
1537 transfer_share_object_cost_base: Option<u64>,
1539 transfer_receive_object_cost_base: Option<u64>,
1542
1543 tx_context_derive_id_cost_base: Option<u64>,
1546 tx_context_fresh_id_cost_base: Option<u64>,
1547 tx_context_sender_cost_base: Option<u64>,
1548 tx_context_epoch_cost_base: Option<u64>,
1549 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1550 tx_context_sponsor_cost_base: Option<u64>,
1551 tx_context_rgp_cost_base: Option<u64>,
1552 tx_context_gas_price_cost_base: Option<u64>,
1553 tx_context_gas_budget_cost_base: Option<u64>,
1554 tx_context_ids_created_cost_base: Option<u64>,
1555 tx_context_replace_cost_base: Option<u64>,
1556
1557 types_is_one_time_witness_cost_base: Option<u64>,
1560 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1561 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1562
1563 validator_validate_metadata_cost_base: Option<u64>,
1566 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1567
1568 crypto_invalid_arguments_cost: Option<u64>,
1570 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1572 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1573 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1574
1575 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1577 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1578 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1579
1580 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1582 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1583 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1584 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1585 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1586 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1587
1588 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1590
1591 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1593 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1594 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1595 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1596 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1597 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1598
1599 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1601 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1602 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1603 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1604 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1605 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1606
1607 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1609 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1610 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1611 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1612 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1613 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1614
1615 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1617 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1618 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1619
1620 ed25519_ed25519_verify_cost_base: Option<u64>,
1622 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1623 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1624
1625 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1627 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1628
1629 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1631 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1632 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1633 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1634 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1635
1636 hash_blake2b256_cost_base: Option<u64>,
1638 hash_blake2b256_data_cost_per_byte: Option<u64>,
1639 hash_blake2b256_data_cost_per_block: Option<u64>,
1640
1641 hash_keccak256_cost_base: Option<u64>,
1643 hash_keccak256_data_cost_per_byte: Option<u64>,
1644 hash_keccak256_data_cost_per_block: Option<u64>,
1645
1646 poseidon_bn254_cost_base: Option<u64>,
1648 poseidon_bn254_cost_per_block: Option<u64>,
1649
1650 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1652 group_ops_bls12381_decode_g1_cost: Option<u64>,
1653 group_ops_bls12381_decode_g2_cost: Option<u64>,
1654 group_ops_bls12381_decode_gt_cost: Option<u64>,
1655 group_ops_bls12381_scalar_add_cost: Option<u64>,
1656 group_ops_bls12381_g1_add_cost: Option<u64>,
1657 group_ops_bls12381_g2_add_cost: Option<u64>,
1658 group_ops_bls12381_gt_add_cost: Option<u64>,
1659 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1660 group_ops_bls12381_g1_sub_cost: Option<u64>,
1661 group_ops_bls12381_g2_sub_cost: Option<u64>,
1662 group_ops_bls12381_gt_sub_cost: Option<u64>,
1663 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1664 group_ops_bls12381_g1_mul_cost: Option<u64>,
1665 group_ops_bls12381_g2_mul_cost: Option<u64>,
1666 group_ops_bls12381_gt_mul_cost: Option<u64>,
1667 group_ops_bls12381_scalar_div_cost: Option<u64>,
1668 group_ops_bls12381_g1_div_cost: Option<u64>,
1669 group_ops_bls12381_g2_div_cost: Option<u64>,
1670 group_ops_bls12381_gt_div_cost: Option<u64>,
1671 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1672 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1673 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1674 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1675 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1676 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1677 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1678 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1679 group_ops_bls12381_msm_max_len: Option<u32>,
1680 group_ops_bls12381_pairing_cost: Option<u64>,
1681 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1682 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1683 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1684 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1685 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1686
1687 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1688 group_ops_ristretto_decode_point_cost: Option<u64>,
1689 group_ops_ristretto_scalar_add_cost: Option<u64>,
1690 group_ops_ristretto_point_add_cost: Option<u64>,
1691 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1692 group_ops_ristretto_point_sub_cost: Option<u64>,
1693 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1694 group_ops_ristretto_point_mul_cost: Option<u64>,
1695 group_ops_ristretto_scalar_div_cost: Option<u64>,
1696 group_ops_ristretto_point_div_cost: Option<u64>,
1697
1698 hmac_hmac_sha3_256_cost_base: Option<u64>,
1700 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1701 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1702
1703 check_zklogin_id_cost_base: Option<u64>,
1705 check_zklogin_issuer_cost_base: Option<u64>,
1707
1708 vdf_verify_vdf_cost: Option<u64>,
1709 vdf_hash_to_input_cost: Option<u64>,
1710
1711 nitro_attestation_parse_base_cost: Option<u64>,
1713 nitro_attestation_parse_cost_per_byte: Option<u64>,
1714 nitro_attestation_verify_base_cost: Option<u64>,
1715 nitro_attestation_verify_cost_per_cert: Option<u64>,
1716
1717 bcs_per_byte_serialized_cost: Option<u64>,
1719 bcs_legacy_min_output_size_cost: Option<u64>,
1720 bcs_failure_cost: Option<u64>,
1721
1722 hash_sha2_256_base_cost: Option<u64>,
1723 hash_sha2_256_per_byte_cost: Option<u64>,
1724 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1725 hash_sha3_256_base_cost: Option<u64>,
1726 hash_sha3_256_per_byte_cost: Option<u64>,
1727 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1728 type_name_get_base_cost: Option<u64>,
1729 type_name_get_per_byte_cost: Option<u64>,
1730 type_name_id_base_cost: Option<u64>,
1731
1732 string_check_utf8_base_cost: Option<u64>,
1733 string_check_utf8_per_byte_cost: Option<u64>,
1734 string_is_char_boundary_base_cost: Option<u64>,
1735 string_sub_string_base_cost: Option<u64>,
1736 string_sub_string_per_byte_cost: Option<u64>,
1737 string_index_of_base_cost: Option<u64>,
1738 string_index_of_per_byte_pattern_cost: Option<u64>,
1739 string_index_of_per_byte_searched_cost: Option<u64>,
1740
1741 vector_empty_base_cost: Option<u64>,
1742 vector_length_base_cost: Option<u64>,
1743 vector_push_back_base_cost: Option<u64>,
1744 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1745 vector_borrow_base_cost: Option<u64>,
1746 vector_pop_back_base_cost: Option<u64>,
1747 vector_destroy_empty_base_cost: Option<u64>,
1748 vector_swap_base_cost: Option<u64>,
1749 debug_print_base_cost: Option<u64>,
1750 debug_print_stack_trace_base_cost: Option<u64>,
1751
1752 execution_version: Option<u64>,
1761
1762 consensus_bad_nodes_stake_threshold: Option<u64>,
1766
1767 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1768 max_age_of_jwk_in_epochs: Option<u64>,
1772
1773 random_beacon_reduction_allowed_delta: Option<u16>,
1777
1778 random_beacon_reduction_lower_bound: Option<u32>,
1781
1782 random_beacon_dkg_timeout_round: Option<u32>,
1785
1786 random_beacon_min_round_interval_ms: Option<u64>,
1788
1789 random_beacon_dkg_version: Option<u64>,
1792
1793 consensus_max_transaction_size_bytes: Option<u64>,
1796 consensus_max_transactions_in_block_bytes: Option<u64>,
1798 consensus_max_num_transactions_in_block: Option<u64>,
1800
1801 consensus_voting_rounds: Option<u32>,
1803
1804 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1806
1807 max_deferral_rounds_for_congestion_control: Option<u64>,
1810
1811 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1813
1814 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1816
1817 min_checkpoint_interval_ms: Option<u64>,
1819
1820 checkpoint_summary_version_specific_data: Option<u64>,
1822
1823 max_soft_bundle_size: Option<u64>,
1825
1826 bridge_should_try_to_finalize_committee: Option<bool>,
1830
1831 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1837
1838 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1841
1842 consensus_gc_depth: Option<u32>,
1845
1846 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1848
1849 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1851
1852 sip_45_consensus_amplification_threshold: Option<u64>,
1855
1856 use_object_per_epoch_marker_table_v2: Option<bool>,
1859
1860 consensus_commit_rate_estimation_window_size: Option<u32>,
1862
1863 #[serde(skip_serializing_if = "Vec::is_empty")]
1867 aliased_addresses: Vec<AliasedAddress>,
1868
1869 translation_per_command_base_charge: Option<u64>,
1872
1873 translation_per_input_base_charge: Option<u64>,
1876
1877 translation_pure_input_per_byte_charge: Option<u64>,
1879
1880 translation_per_type_node_charge: Option<u64>,
1884
1885 translation_per_reference_node_charge: Option<u64>,
1888
1889 translation_per_linkage_entry_charge: Option<u64>,
1892
1893 max_updates_per_settlement_txn: Option<u32>,
1895}
1896
1897#[derive(Clone, Serialize, Deserialize, Debug)]
1899pub struct AliasedAddress {
1900 pub original: [u8; 32],
1902 pub aliased: [u8; 32],
1904 pub allowed_tx_digests: Vec<[u8; 32]>,
1906}
1907
1908impl ProtocolConfig {
1910 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1923 if self.feature_flags.package_upgrades {
1924 Ok(())
1925 } else {
1926 Err(Error(format!(
1927 "package upgrades are not supported at {:?}",
1928 self.version
1929 )))
1930 }
1931 }
1932
1933 pub fn allow_receiving_object_id(&self) -> bool {
1934 self.feature_flags.allow_receiving_object_id
1935 }
1936
1937 pub fn receiving_objects_supported(&self) -> bool {
1938 self.feature_flags.receive_objects
1939 }
1940
1941 pub fn package_upgrades_supported(&self) -> bool {
1942 self.feature_flags.package_upgrades
1943 }
1944
1945 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1946 self.feature_flags.commit_root_state_digest
1947 }
1948
1949 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1950 self.feature_flags.advance_epoch_start_time_in_safe_mode
1951 }
1952
1953 pub fn loaded_child_objects_fixed(&self) -> bool {
1954 self.feature_flags.loaded_child_objects_fixed
1955 }
1956
1957 pub fn missing_type_is_compatibility_error(&self) -> bool {
1958 self.feature_flags.missing_type_is_compatibility_error
1959 }
1960
1961 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1962 self.feature_flags.scoring_decision_with_validity_cutoff
1963 }
1964
1965 pub fn narwhal_versioned_metadata(&self) -> bool {
1966 self.feature_flags.narwhal_versioned_metadata
1967 }
1968
1969 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1970 self.feature_flags.consensus_order_end_of_epoch_last
1971 }
1972
1973 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1974 self.feature_flags.disallow_adding_abilities_on_upgrade
1975 }
1976
1977 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1978 self.feature_flags
1979 .disable_invariant_violation_check_in_swap_loc
1980 }
1981
1982 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1983 self.feature_flags
1984 .advance_to_highest_supported_protocol_version
1985 }
1986
1987 pub fn ban_entry_init(&self) -> bool {
1988 self.feature_flags.ban_entry_init
1989 }
1990
1991 pub fn package_digest_hash_module(&self) -> bool {
1992 self.feature_flags.package_digest_hash_module
1993 }
1994
1995 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1996 self.feature_flags
1997 .disallow_change_struct_type_params_on_upgrade
1998 }
1999
2000 pub fn no_extraneous_module_bytes(&self) -> bool {
2001 self.feature_flags.no_extraneous_module_bytes
2002 }
2003
2004 pub fn zklogin_auth(&self) -> bool {
2005 self.feature_flags.zklogin_auth
2006 }
2007
2008 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2009 &self.feature_flags.zklogin_supported_providers
2010 }
2011
2012 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2013 self.feature_flags.consensus_transaction_ordering
2014 }
2015
2016 pub fn simplified_unwrap_then_delete(&self) -> bool {
2017 self.feature_flags.simplified_unwrap_then_delete
2018 }
2019
2020 pub fn supports_upgraded_multisig(&self) -> bool {
2021 self.feature_flags.upgraded_multisig_supported
2022 }
2023
2024 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2025 self.feature_flags.txn_base_cost_as_multiplier
2026 }
2027
2028 pub fn shared_object_deletion(&self) -> bool {
2029 self.feature_flags.shared_object_deletion
2030 }
2031
2032 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2033 self.feature_flags.narwhal_new_leader_election_schedule
2034 }
2035
2036 pub fn loaded_child_object_format(&self) -> bool {
2037 self.feature_flags.loaded_child_object_format
2038 }
2039
2040 pub fn enable_jwk_consensus_updates(&self) -> bool {
2041 let ret = self.feature_flags.enable_jwk_consensus_updates;
2042 if ret {
2043 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2045 }
2046 ret
2047 }
2048
2049 pub fn simple_conservation_checks(&self) -> bool {
2050 self.feature_flags.simple_conservation_checks
2051 }
2052
2053 pub fn loaded_child_object_format_type(&self) -> bool {
2054 self.feature_flags.loaded_child_object_format_type
2055 }
2056
2057 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2058 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2059 if !ret {
2060 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2062 }
2063 ret
2064 }
2065
2066 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2067 self.feature_flags
2068 .recompute_has_public_transfer_in_execution
2069 }
2070
2071 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2073 self.enable_jwk_consensus_updates()
2074 }
2075
2076 pub fn random_beacon(&self) -> bool {
2077 self.feature_flags.random_beacon
2078 }
2079
2080 pub fn dkg_version(&self) -> u64 {
2081 self.random_beacon_dkg_version.unwrap_or(1)
2083 }
2084
2085 pub fn enable_bridge(&self) -> bool {
2086 let ret = self.feature_flags.bridge;
2087 if ret {
2088 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2090 }
2091 ret
2092 }
2093
2094 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2095 if !self.enable_bridge() {
2096 return false;
2097 }
2098 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2100 }
2101
2102 pub fn enable_effects_v2(&self) -> bool {
2103 self.feature_flags.enable_effects_v2
2104 }
2105
2106 pub fn narwhal_certificate_v2(&self) -> bool {
2107 self.feature_flags.narwhal_certificate_v2
2108 }
2109
2110 pub fn verify_legacy_zklogin_address(&self) -> bool {
2111 self.feature_flags.verify_legacy_zklogin_address
2112 }
2113
2114 pub fn accept_zklogin_in_multisig(&self) -> bool {
2115 self.feature_flags.accept_zklogin_in_multisig
2116 }
2117
2118 pub fn accept_passkey_in_multisig(&self) -> bool {
2119 self.feature_flags.accept_passkey_in_multisig
2120 }
2121
2122 pub fn validate_zklogin_public_identifier(&self) -> bool {
2123 self.feature_flags.validate_zklogin_public_identifier
2124 }
2125
2126 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2127 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2128 }
2129
2130 pub fn throughput_aware_consensus_submission(&self) -> bool {
2131 self.feature_flags.throughput_aware_consensus_submission
2132 }
2133
2134 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2135 self.feature_flags.include_consensus_digest_in_prologue
2136 }
2137
2138 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2139 self.feature_flags
2140 .record_consensus_determined_version_assignments_in_prologue
2141 }
2142
2143 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2144 self.feature_flags
2145 .record_additional_state_digest_in_prologue
2146 }
2147
2148 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2149 self.feature_flags
2150 .record_consensus_determined_version_assignments_in_prologue_v2
2151 }
2152
2153 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2154 self.feature_flags
2155 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2156 }
2157
2158 pub fn hardened_otw_check(&self) -> bool {
2159 self.feature_flags.hardened_otw_check
2160 }
2161
2162 pub fn enable_poseidon(&self) -> bool {
2163 self.feature_flags.enable_poseidon
2164 }
2165
2166 pub fn enable_coin_deny_list_v1(&self) -> bool {
2167 self.feature_flags.enable_coin_deny_list
2168 }
2169
2170 pub fn enable_accumulators(&self) -> bool {
2171 self.feature_flags.enable_accumulators
2172 }
2173
2174 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2175 self.feature_flags.enable_coin_reservation_obj_refs
2176 }
2177
2178 pub fn create_root_accumulator_object(&self) -> bool {
2179 self.feature_flags.create_root_accumulator_object
2180 }
2181
2182 pub fn enable_address_balance_gas_payments(&self) -> bool {
2183 self.feature_flags.enable_address_balance_gas_payments
2184 }
2185
2186 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2187 self.feature_flags.address_balance_gas_check_rgp_at_signing
2188 }
2189
2190 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2191 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2192 }
2193
2194 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2195 self.feature_flags.enable_multi_epoch_transaction_expiration
2196 }
2197
2198 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2199 self.feature_flags.relax_valid_during_for_owned_inputs
2200 }
2201
2202 pub fn enable_authenticated_event_streams(&self) -> bool {
2203 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2204 }
2205
2206 pub fn enable_non_exclusive_writes(&self) -> bool {
2207 self.feature_flags.enable_non_exclusive_writes
2208 }
2209
2210 pub fn enable_coin_registry(&self) -> bool {
2211 self.feature_flags.enable_coin_registry
2212 }
2213
2214 pub fn enable_display_registry(&self) -> bool {
2215 self.feature_flags.enable_display_registry
2216 }
2217
2218 pub fn enable_coin_deny_list_v2(&self) -> bool {
2219 self.feature_flags.enable_coin_deny_list_v2
2220 }
2221
2222 pub fn enable_group_ops_native_functions(&self) -> bool {
2223 self.feature_flags.enable_group_ops_native_functions
2224 }
2225
2226 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2227 self.feature_flags.enable_group_ops_native_function_msm
2228 }
2229
2230 pub fn enable_ristretto255_group_ops(&self) -> bool {
2231 self.feature_flags.enable_ristretto255_group_ops
2232 }
2233
2234 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2235 self.feature_flags.reject_mutable_random_on_entry_functions
2236 }
2237
2238 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2239 self.feature_flags.per_object_congestion_control_mode
2240 }
2241
2242 pub fn consensus_choice(&self) -> ConsensusChoice {
2243 self.feature_flags.consensus_choice
2244 }
2245
2246 pub fn consensus_network(&self) -> ConsensusNetwork {
2247 self.feature_flags.consensus_network
2248 }
2249
2250 pub fn correct_gas_payment_limit_check(&self) -> bool {
2251 self.feature_flags.correct_gas_payment_limit_check
2252 }
2253
2254 pub fn reshare_at_same_initial_version(&self) -> bool {
2255 self.feature_flags.reshare_at_same_initial_version
2256 }
2257
2258 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2259 self.feature_flags.resolve_abort_locations_to_package_id
2260 }
2261
2262 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2263 self.feature_flags.mysticeti_use_committed_subdag_digest
2264 }
2265
2266 pub fn enable_vdf(&self) -> bool {
2267 self.feature_flags.enable_vdf
2268 }
2269
2270 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2271 self.feature_flags.fresh_vm_on_framework_upgrade
2272 }
2273
2274 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2275 self.feature_flags.mysticeti_num_leaders_per_round
2276 }
2277
2278 pub fn soft_bundle(&self) -> bool {
2279 self.feature_flags.soft_bundle
2280 }
2281
2282 pub fn passkey_auth(&self) -> bool {
2283 self.feature_flags.passkey_auth
2284 }
2285
2286 pub fn authority_capabilities_v2(&self) -> bool {
2287 self.feature_flags.authority_capabilities_v2
2288 }
2289
2290 pub fn max_transaction_size_bytes(&self) -> u64 {
2291 self.consensus_max_transaction_size_bytes
2293 .unwrap_or(256 * 1024)
2294 }
2295
2296 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2297 if cfg!(msim) {
2298 256 * 1024
2299 } else {
2300 self.consensus_max_transactions_in_block_bytes
2301 .unwrap_or(512 * 1024)
2302 }
2303 }
2304
2305 pub fn max_num_transactions_in_block(&self) -> u64 {
2306 if cfg!(msim) {
2307 8
2308 } else {
2309 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2310 }
2311 }
2312
2313 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2314 self.feature_flags.rethrow_serialization_type_layout_errors
2315 }
2316
2317 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2318 self.feature_flags
2319 .consensus_distributed_vote_scoring_strategy
2320 }
2321
2322 pub fn consensus_round_prober(&self) -> bool {
2323 self.feature_flags.consensus_round_prober
2324 }
2325
2326 pub fn validate_identifier_inputs(&self) -> bool {
2327 self.feature_flags.validate_identifier_inputs
2328 }
2329
2330 pub fn gc_depth(&self) -> u32 {
2331 self.consensus_gc_depth.unwrap_or(0)
2332 }
2333
2334 pub fn mysticeti_fastpath(&self) -> bool {
2335 self.feature_flags.mysticeti_fastpath
2336 }
2337
2338 pub fn relocate_event_module(&self) -> bool {
2339 self.feature_flags.relocate_event_module
2340 }
2341
2342 pub fn uncompressed_g1_group_elements(&self) -> bool {
2343 self.feature_flags.uncompressed_g1_group_elements
2344 }
2345
2346 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2347 self.feature_flags
2348 .disallow_new_modules_in_deps_only_packages
2349 }
2350
2351 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2352 self.feature_flags.consensus_smart_ancestor_selection
2353 }
2354
2355 pub fn disable_preconsensus_locking(&self) -> bool {
2356 self.feature_flags.disable_preconsensus_locking
2357 }
2358
2359 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2360 self.feature_flags
2361 .consensus_round_prober_probe_accepted_rounds
2362 }
2363
2364 pub fn native_charging_v2(&self) -> bool {
2365 self.feature_flags.native_charging_v2
2366 }
2367
2368 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2369 let res = self.feature_flags.consensus_linearize_subdag_v2;
2370 assert!(
2371 !res || self.gc_depth() > 0,
2372 "The consensus linearize sub dag V2 requires GC to be enabled"
2373 );
2374 res
2375 }
2376
2377 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2378 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2379 assert!(
2380 !res || self.gc_depth() > 0,
2381 "The consensus median based commit timestamp requires GC to be enabled"
2382 );
2383 res
2384 }
2385
2386 pub fn consensus_batched_block_sync(&self) -> bool {
2387 self.feature_flags.consensus_batched_block_sync
2388 }
2389
2390 pub fn convert_type_argument_error(&self) -> bool {
2391 self.feature_flags.convert_type_argument_error
2392 }
2393
2394 pub fn variant_nodes(&self) -> bool {
2395 self.feature_flags.variant_nodes
2396 }
2397
2398 pub fn consensus_zstd_compression(&self) -> bool {
2399 self.feature_flags.consensus_zstd_compression
2400 }
2401
2402 pub fn enable_nitro_attestation(&self) -> bool {
2403 self.feature_flags.enable_nitro_attestation
2404 }
2405
2406 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2407 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2408 }
2409
2410 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2411 self.feature_flags
2412 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2413 }
2414
2415 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2416 self.feature_flags
2417 .enable_nitro_attestation_always_include_required_pcrs_parsing
2418 }
2419
2420 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2421 self.consensus_commit_rate_estimation_window_size
2422 .unwrap_or(0)
2423 }
2424
2425 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2426 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2430 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2432 window_size
2433 }
2434
2435 pub fn minimize_child_object_mutations(&self) -> bool {
2436 self.feature_flags.minimize_child_object_mutations
2437 }
2438
2439 pub fn move_native_context(&self) -> bool {
2440 self.feature_flags.move_native_context
2441 }
2442
2443 pub fn normalize_ptb_arguments(&self) -> bool {
2444 self.feature_flags.normalize_ptb_arguments
2445 }
2446
2447 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2448 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2449 }
2450
2451 pub fn max_ptb_value_size_v2(&self) -> bool {
2452 self.feature_flags.max_ptb_value_size_v2
2453 }
2454
2455 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2456 self.feature_flags.resolve_type_input_ids_to_defining_id
2457 }
2458
2459 pub fn enable_party_transfer(&self) -> bool {
2460 self.feature_flags.enable_party_transfer
2461 }
2462
2463 pub fn allow_unbounded_system_objects(&self) -> bool {
2464 self.feature_flags.allow_unbounded_system_objects
2465 }
2466
2467 pub fn type_tags_in_object_runtime(&self) -> bool {
2468 self.feature_flags.type_tags_in_object_runtime
2469 }
2470
2471 pub fn enable_ptb_execution_v2(&self) -> bool {
2472 self.feature_flags.enable_ptb_execution_v2
2473 }
2474
2475 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2476 self.feature_flags.better_adapter_type_resolution_errors
2477 }
2478
2479 pub fn record_time_estimate_processed(&self) -> bool {
2480 self.feature_flags.record_time_estimate_processed
2481 }
2482
2483 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2484 self.feature_flags
2485 .ignore_execution_time_observations_after_certs_closed
2486 }
2487
2488 pub fn dependency_linkage_error(&self) -> bool {
2489 self.feature_flags.dependency_linkage_error
2490 }
2491
2492 pub fn additional_multisig_checks(&self) -> bool {
2493 self.feature_flags.additional_multisig_checks
2494 }
2495
2496 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2497 self.feature_flags.debug_fatal_on_move_invariant_violation
2498 }
2499
2500 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2501 self.feature_flags.allow_private_accumulator_entrypoints
2502 }
2503
2504 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2505 self.feature_flags
2506 .additional_consensus_digest_indirect_state
2507 }
2508
2509 pub fn check_for_init_during_upgrade(&self) -> bool {
2510 self.feature_flags.check_for_init_during_upgrade
2511 }
2512
2513 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2514 self.feature_flags.per_command_shared_object_transfer_rules
2515 }
2516
2517 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2518 self.feature_flags
2519 .consensus_checkpoint_signature_key_includes_digest
2520 }
2521
2522 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2523 self.feature_flags
2524 .include_checkpoint_artifacts_digest_in_summary
2525 }
2526
2527 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2528 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2529 }
2530
2531 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2532 self.feature_flags.cancel_for_failed_dkg_early
2533 }
2534
2535 pub fn abstract_size_in_object_runtime(&self) -> bool {
2536 self.feature_flags.abstract_size_in_object_runtime
2537 }
2538
2539 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2540 self.feature_flags.object_runtime_charge_cache_load_gas
2541 }
2542
2543 pub fn additional_borrow_checks(&self) -> bool {
2544 self.feature_flags.additional_borrow_checks
2545 }
2546
2547 pub fn use_new_commit_handler(&self) -> bool {
2548 self.feature_flags.use_new_commit_handler
2549 }
2550
2551 pub fn better_loader_errors(&self) -> bool {
2552 self.feature_flags.better_loader_errors
2553 }
2554
2555 pub fn generate_df_type_layouts(&self) -> bool {
2556 self.feature_flags.generate_df_type_layouts
2557 }
2558
2559 pub fn allow_references_in_ptbs(&self) -> bool {
2560 self.feature_flags.allow_references_in_ptbs
2561 }
2562
2563 pub fn private_generics_verifier_v2(&self) -> bool {
2564 self.feature_flags.private_generics_verifier_v2
2565 }
2566
2567 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2568 self.feature_flags
2569 .deprecate_global_storage_ops_during_deserialization
2570 }
2571
2572 pub fn enable_observation_chunking(&self) -> bool {
2573 matches!(self.feature_flags.per_object_congestion_control_mode,
2574 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2575 if params.observations_chunk_size.is_some()
2576 )
2577 }
2578
2579 pub fn deprecate_global_storage_ops(&self) -> bool {
2580 self.feature_flags.deprecate_global_storage_ops
2581 }
2582
2583 pub fn normalize_depth_formula(&self) -> bool {
2584 self.feature_flags.normalize_depth_formula
2585 }
2586
2587 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2588 self.feature_flags.consensus_skip_gced_accept_votes
2589 }
2590
2591 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2592 self.feature_flags
2593 .include_cancelled_randomness_txns_in_prologue
2594 }
2595
2596 pub fn address_aliases(&self) -> bool {
2597 let address_aliases = self.feature_flags.address_aliases;
2598 assert!(
2599 !address_aliases || self.mysticeti_fastpath(),
2600 "Address aliases requires Mysticeti fastpath to be enabled"
2601 );
2602 if address_aliases {
2603 assert!(
2604 self.feature_flags.disable_preconsensus_locking,
2605 "Address aliases requires CertifiedTransaction to be disabled"
2606 );
2607 }
2608 address_aliases
2609 }
2610
2611 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2612 self.feature_flags.fix_checkpoint_signature_mapping
2613 }
2614
2615 pub fn enable_object_funds_withdraw(&self) -> bool {
2616 self.feature_flags.enable_object_funds_withdraw
2617 }
2618
2619 pub fn gas_rounding_halve_digits(&self) -> bool {
2620 self.feature_flags.gas_rounding_halve_digits
2621 }
2622
2623 pub fn flexible_tx_context_positions(&self) -> bool {
2624 self.feature_flags.flexible_tx_context_positions
2625 }
2626
2627 pub fn disable_entry_point_signature_check(&self) -> bool {
2628 self.feature_flags.disable_entry_point_signature_check
2629 }
2630
2631 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2632 self.feature_flags
2633 .consensus_skip_gced_blocks_in_direct_finalization
2634 }
2635
2636 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2637 self.feature_flags
2638 .convert_withdrawal_compatibility_ptb_arguments
2639 }
2640
2641 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2642 self.feature_flags.restrict_hot_or_not_entry_functions
2643 }
2644
2645 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2646 self.feature_flags.split_checkpoints_in_consensus_handler
2647 }
2648
2649 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2650 self.feature_flags
2651 .consensus_always_accept_system_transactions
2652 }
2653
2654 pub fn validator_metadata_verify_v2(&self) -> bool {
2655 self.feature_flags.validator_metadata_verify_v2
2656 }
2657
2658 pub fn defer_unpaid_amplification(&self) -> bool {
2659 self.feature_flags.defer_unpaid_amplification
2660 }
2661
2662 pub fn gasless_transaction_drop_safety(&self) -> bool {
2663 self.feature_flags.gasless_transaction_drop_safety
2664 }
2665}
2666
2667#[cfg(not(msim))]
2668static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2669
2670#[cfg(msim)]
2672thread_local! {
2673 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2674}
2675
2676impl ProtocolConfig {
2678 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2680 assert!(
2682 version >= ProtocolVersion::MIN,
2683 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2684 version,
2685 ProtocolVersion::MIN.0,
2686 );
2687 assert!(
2688 version <= ProtocolVersion::MAX_ALLOWED,
2689 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2690 version,
2691 ProtocolVersion::MAX_ALLOWED.0,
2692 );
2693
2694 let mut ret = Self::get_for_version_impl(version, chain);
2695 ret.version = version;
2696
2697 ret = CONFIG_OVERRIDE.with(|ovr| {
2698 if let Some(override_fn) = &*ovr.borrow() {
2699 warn!(
2700 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2701 );
2702 override_fn(version, ret)
2703 } else {
2704 ret
2705 }
2706 });
2707
2708 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2709 warn!(
2710 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2711 );
2712 let overrides: ProtocolConfigOptional =
2713 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2714 .expect("failed to parse ProtocolConfig override env variables");
2715 overrides.apply_to(&mut ret);
2716 }
2717
2718 ret
2719 }
2720
2721 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2724 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2725 let mut ret = Self::get_for_version_impl(version, chain);
2726 ret.version = version;
2727 Some(ret)
2728 } else {
2729 None
2730 }
2731 }
2732
2733 #[cfg(not(msim))]
2734 pub fn poison_get_for_min_version() {
2735 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2736 }
2737
2738 #[cfg(not(msim))]
2739 fn load_poison_get_for_min_version() -> bool {
2740 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2741 }
2742
2743 #[cfg(msim)]
2744 pub fn poison_get_for_min_version() {
2745 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2746 }
2747
2748 #[cfg(msim)]
2749 fn load_poison_get_for_min_version() -> bool {
2750 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2751 }
2752
2753 pub fn get_for_min_version() -> Self {
2756 if Self::load_poison_get_for_min_version() {
2757 panic!("get_for_min_version called on validator");
2758 }
2759 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2760 }
2761
2762 #[allow(non_snake_case)]
2772 pub fn get_for_max_version_UNSAFE() -> Self {
2773 if Self::load_poison_get_for_min_version() {
2774 panic!("get_for_max_version_UNSAFE called on validator");
2775 }
2776 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2777 }
2778
2779 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2780 #[cfg(msim)]
2781 {
2782 if version == ProtocolVersion::MAX_ALLOWED {
2784 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2785 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2786 return config;
2787 }
2788 }
2789
2790 let mut cfg = Self {
2793 version,
2795
2796 feature_flags: Default::default(),
2798
2799 max_tx_size_bytes: Some(128 * 1024),
2800 max_input_objects: Some(2048),
2802 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2803 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2804 max_gas_payment_objects: Some(256),
2805 max_modules_in_publish: Some(128),
2806 max_package_dependencies: None,
2807 max_arguments: Some(512),
2808 max_type_arguments: Some(16),
2809 max_type_argument_depth: Some(16),
2810 max_pure_argument_size: Some(16 * 1024),
2811 max_programmable_tx_commands: Some(1024),
2812 move_binary_format_version: Some(6),
2813 min_move_binary_format_version: None,
2814 binary_module_handles: None,
2815 binary_struct_handles: None,
2816 binary_function_handles: None,
2817 binary_function_instantiations: None,
2818 binary_signatures: None,
2819 binary_constant_pool: None,
2820 binary_identifiers: None,
2821 binary_address_identifiers: None,
2822 binary_struct_defs: None,
2823 binary_struct_def_instantiations: None,
2824 binary_function_defs: None,
2825 binary_field_handles: None,
2826 binary_field_instantiations: None,
2827 binary_friend_decls: None,
2828 binary_enum_defs: None,
2829 binary_enum_def_instantiations: None,
2830 binary_variant_handles: None,
2831 binary_variant_instantiation_handles: None,
2832 max_move_object_size: Some(250 * 1024),
2833 max_move_package_size: Some(100 * 1024),
2834 max_publish_or_upgrade_per_ptb: None,
2835 max_tx_gas: Some(10_000_000_000),
2836 max_gas_price: Some(100_000),
2837 max_gas_price_rgp_factor_for_aborted_transactions: None,
2838 max_gas_computation_bucket: Some(5_000_000),
2839 max_loop_depth: Some(5),
2840 max_generic_instantiation_length: Some(32),
2841 max_function_parameters: Some(128),
2842 max_basic_blocks: Some(1024),
2843 max_value_stack_size: Some(1024),
2844 max_type_nodes: Some(256),
2845 max_push_size: Some(10000),
2846 max_struct_definitions: Some(200),
2847 max_function_definitions: Some(1000),
2848 max_fields_in_struct: Some(32),
2849 max_dependency_depth: Some(100),
2850 max_num_event_emit: Some(256),
2851 max_num_new_move_object_ids: Some(2048),
2852 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2853 max_num_deleted_move_object_ids: Some(2048),
2854 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2855 max_num_transferred_move_object_ids: Some(2048),
2856 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2857 max_event_emit_size: Some(250 * 1024),
2858 max_move_vector_len: Some(256 * 1024),
2859 max_type_to_layout_nodes: None,
2860 max_ptb_value_size: None,
2861
2862 max_back_edges_per_function: Some(10_000),
2863 max_back_edges_per_module: Some(10_000),
2864 max_verifier_meter_ticks_per_function: Some(6_000_000),
2865 max_meter_ticks_per_module: Some(6_000_000),
2866 max_meter_ticks_per_package: None,
2867
2868 object_runtime_max_num_cached_objects: Some(1000),
2869 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2870 object_runtime_max_num_store_entries: Some(1000),
2871 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2872 base_tx_cost_fixed: Some(110_000),
2873 package_publish_cost_fixed: Some(1_000),
2874 base_tx_cost_per_byte: Some(0),
2875 package_publish_cost_per_byte: Some(80),
2876 obj_access_cost_read_per_byte: Some(15),
2877 obj_access_cost_mutate_per_byte: Some(40),
2878 obj_access_cost_delete_per_byte: Some(40),
2879 obj_access_cost_verify_per_byte: Some(200),
2880 obj_data_cost_refundable: Some(100),
2881 obj_metadata_cost_non_refundable: Some(50),
2882 gas_model_version: Some(1),
2883 storage_rebate_rate: Some(9900),
2884 storage_fund_reinvest_rate: Some(500),
2885 reward_slashing_rate: Some(5000),
2886 storage_gas_price: Some(1),
2887 accumulator_object_storage_cost: None,
2888 max_transactions_per_checkpoint: Some(10_000),
2889 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2890
2891 buffer_stake_for_protocol_upgrade_bps: Some(0),
2894
2895 address_from_bytes_cost_base: Some(52),
2899 address_to_u256_cost_base: Some(52),
2901 address_from_u256_cost_base: Some(52),
2903
2904 config_read_setting_impl_cost_base: None,
2907 config_read_setting_impl_cost_per_byte: None,
2908
2909 dynamic_field_hash_type_and_key_cost_base: Some(100),
2912 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2913 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2914 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2915 dynamic_field_add_child_object_cost_base: Some(100),
2917 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2918 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2919 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2920 dynamic_field_borrow_child_object_cost_base: Some(100),
2922 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2923 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2924 dynamic_field_remove_child_object_cost_base: Some(100),
2926 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2927 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2928 dynamic_field_has_child_object_cost_base: Some(100),
2930 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2932 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2933 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2934
2935 event_emit_cost_base: Some(52),
2938 event_emit_value_size_derivation_cost_per_byte: Some(2),
2939 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2940 event_emit_output_cost_per_byte: Some(10),
2941 event_emit_auth_stream_cost: None,
2942
2943 object_borrow_uid_cost_base: Some(52),
2946 object_delete_impl_cost_base: Some(52),
2948 object_record_new_uid_cost_base: Some(52),
2950
2951 transfer_transfer_internal_cost_base: Some(52),
2954 transfer_party_transfer_internal_cost_base: None,
2956 transfer_freeze_object_cost_base: Some(52),
2958 transfer_share_object_cost_base: Some(52),
2960 transfer_receive_object_cost_base: None,
2961
2962 tx_context_derive_id_cost_base: Some(52),
2965 tx_context_fresh_id_cost_base: None,
2966 tx_context_sender_cost_base: None,
2967 tx_context_epoch_cost_base: None,
2968 tx_context_epoch_timestamp_ms_cost_base: None,
2969 tx_context_sponsor_cost_base: None,
2970 tx_context_rgp_cost_base: None,
2971 tx_context_gas_price_cost_base: None,
2972 tx_context_gas_budget_cost_base: None,
2973 tx_context_ids_created_cost_base: None,
2974 tx_context_replace_cost_base: None,
2975
2976 types_is_one_time_witness_cost_base: Some(52),
2979 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2980 types_is_one_time_witness_type_cost_per_byte: Some(2),
2981
2982 validator_validate_metadata_cost_base: Some(52),
2985 validator_validate_metadata_data_cost_per_byte: Some(2),
2986
2987 crypto_invalid_arguments_cost: Some(100),
2989 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2991 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2992 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2993
2994 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2996 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2997 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2998
2999 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3001 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3002 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3003 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3004 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3005 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3006
3007 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3009
3010 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3012 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3013 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3014 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3015 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3016 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3017
3018 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3020 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3021 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3022 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3023 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3024 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3025
3026 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3028 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3029 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3030 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3031 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3032 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3033
3034 ecvrf_ecvrf_verify_cost_base: Some(52),
3036 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3037 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3038
3039 ed25519_ed25519_verify_cost_base: Some(52),
3041 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3042 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3043
3044 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3046 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3047
3048 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3050 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3051 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3052 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3053 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3054
3055 hash_blake2b256_cost_base: Some(52),
3057 hash_blake2b256_data_cost_per_byte: Some(2),
3058 hash_blake2b256_data_cost_per_block: Some(2),
3059
3060 hash_keccak256_cost_base: Some(52),
3062 hash_keccak256_data_cost_per_byte: Some(2),
3063 hash_keccak256_data_cost_per_block: Some(2),
3064
3065 poseidon_bn254_cost_base: None,
3066 poseidon_bn254_cost_per_block: None,
3067
3068 hmac_hmac_sha3_256_cost_base: Some(52),
3070 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3071 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3072
3073 group_ops_bls12381_decode_scalar_cost: None,
3075 group_ops_bls12381_decode_g1_cost: None,
3076 group_ops_bls12381_decode_g2_cost: None,
3077 group_ops_bls12381_decode_gt_cost: None,
3078 group_ops_bls12381_scalar_add_cost: None,
3079 group_ops_bls12381_g1_add_cost: None,
3080 group_ops_bls12381_g2_add_cost: None,
3081 group_ops_bls12381_gt_add_cost: None,
3082 group_ops_bls12381_scalar_sub_cost: None,
3083 group_ops_bls12381_g1_sub_cost: None,
3084 group_ops_bls12381_g2_sub_cost: None,
3085 group_ops_bls12381_gt_sub_cost: None,
3086 group_ops_bls12381_scalar_mul_cost: None,
3087 group_ops_bls12381_g1_mul_cost: None,
3088 group_ops_bls12381_g2_mul_cost: None,
3089 group_ops_bls12381_gt_mul_cost: None,
3090 group_ops_bls12381_scalar_div_cost: None,
3091 group_ops_bls12381_g1_div_cost: None,
3092 group_ops_bls12381_g2_div_cost: None,
3093 group_ops_bls12381_gt_div_cost: None,
3094 group_ops_bls12381_g1_hash_to_base_cost: None,
3095 group_ops_bls12381_g2_hash_to_base_cost: None,
3096 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3097 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3098 group_ops_bls12381_g1_msm_base_cost: None,
3099 group_ops_bls12381_g2_msm_base_cost: None,
3100 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3101 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3102 group_ops_bls12381_msm_max_len: None,
3103 group_ops_bls12381_pairing_cost: None,
3104 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3105 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3106 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3107 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3108 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3109
3110 group_ops_ristretto_decode_scalar_cost: None,
3111 group_ops_ristretto_decode_point_cost: None,
3112 group_ops_ristretto_scalar_add_cost: None,
3113 group_ops_ristretto_point_add_cost: None,
3114 group_ops_ristretto_scalar_sub_cost: None,
3115 group_ops_ristretto_point_sub_cost: None,
3116 group_ops_ristretto_scalar_mul_cost: None,
3117 group_ops_ristretto_point_mul_cost: None,
3118 group_ops_ristretto_scalar_div_cost: None,
3119 group_ops_ristretto_point_div_cost: None,
3120
3121 check_zklogin_id_cost_base: None,
3123 check_zklogin_issuer_cost_base: None,
3125
3126 vdf_verify_vdf_cost: None,
3127 vdf_hash_to_input_cost: None,
3128
3129 nitro_attestation_parse_base_cost: None,
3131 nitro_attestation_parse_cost_per_byte: None,
3132 nitro_attestation_verify_base_cost: None,
3133 nitro_attestation_verify_cost_per_cert: None,
3134
3135 bcs_per_byte_serialized_cost: None,
3136 bcs_legacy_min_output_size_cost: None,
3137 bcs_failure_cost: None,
3138 hash_sha2_256_base_cost: None,
3139 hash_sha2_256_per_byte_cost: None,
3140 hash_sha2_256_legacy_min_input_len_cost: None,
3141 hash_sha3_256_base_cost: None,
3142 hash_sha3_256_per_byte_cost: None,
3143 hash_sha3_256_legacy_min_input_len_cost: None,
3144 type_name_get_base_cost: None,
3145 type_name_get_per_byte_cost: None,
3146 type_name_id_base_cost: None,
3147 string_check_utf8_base_cost: None,
3148 string_check_utf8_per_byte_cost: None,
3149 string_is_char_boundary_base_cost: None,
3150 string_sub_string_base_cost: None,
3151 string_sub_string_per_byte_cost: None,
3152 string_index_of_base_cost: None,
3153 string_index_of_per_byte_pattern_cost: None,
3154 string_index_of_per_byte_searched_cost: None,
3155 vector_empty_base_cost: None,
3156 vector_length_base_cost: None,
3157 vector_push_back_base_cost: None,
3158 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3159 vector_borrow_base_cost: None,
3160 vector_pop_back_base_cost: None,
3161 vector_destroy_empty_base_cost: None,
3162 vector_swap_base_cost: None,
3163 debug_print_base_cost: None,
3164 debug_print_stack_trace_base_cost: None,
3165
3166 max_size_written_objects: None,
3167 max_size_written_objects_system_tx: None,
3168
3169 max_move_identifier_len: None,
3176 max_move_value_depth: None,
3177 max_move_enum_variants: None,
3178
3179 gas_rounding_step: None,
3180
3181 execution_version: None,
3182
3183 max_event_emit_size_total: None,
3184
3185 consensus_bad_nodes_stake_threshold: None,
3186
3187 max_jwk_votes_per_validator_per_epoch: None,
3188
3189 max_age_of_jwk_in_epochs: None,
3190
3191 random_beacon_reduction_allowed_delta: None,
3192
3193 random_beacon_reduction_lower_bound: None,
3194
3195 random_beacon_dkg_timeout_round: None,
3196
3197 random_beacon_min_round_interval_ms: None,
3198
3199 random_beacon_dkg_version: None,
3200
3201 consensus_max_transaction_size_bytes: None,
3202
3203 consensus_max_transactions_in_block_bytes: None,
3204
3205 consensus_max_num_transactions_in_block: None,
3206
3207 consensus_voting_rounds: None,
3208
3209 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3210
3211 max_deferral_rounds_for_congestion_control: None,
3212
3213 max_txn_cost_overage_per_object_in_commit: None,
3214
3215 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3216
3217 min_checkpoint_interval_ms: None,
3218
3219 checkpoint_summary_version_specific_data: None,
3220
3221 max_soft_bundle_size: None,
3222
3223 bridge_should_try_to_finalize_committee: None,
3224
3225 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3226
3227 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3228
3229 consensus_gc_depth: None,
3230
3231 gas_budget_based_txn_cost_cap_factor: None,
3232
3233 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3234
3235 sip_45_consensus_amplification_threshold: None,
3236
3237 use_object_per_epoch_marker_table_v2: None,
3238
3239 consensus_commit_rate_estimation_window_size: None,
3240
3241 aliased_addresses: vec![],
3242
3243 translation_per_command_base_charge: None,
3244 translation_per_input_base_charge: None,
3245 translation_pure_input_per_byte_charge: None,
3246 translation_per_type_node_charge: None,
3247 translation_per_reference_node_charge: None,
3248 translation_per_linkage_entry_charge: None,
3249
3250 max_updates_per_settlement_txn: None,
3251 };
3254 for cur in 2..=version.0 {
3255 match cur {
3256 1 => unreachable!(),
3257 2 => {
3258 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3259 }
3260 3 => {
3261 cfg.gas_model_version = Some(2);
3263 cfg.max_tx_gas = Some(50_000_000_000);
3265 cfg.base_tx_cost_fixed = Some(2_000);
3267 cfg.storage_gas_price = Some(76);
3269 cfg.feature_flags.loaded_child_objects_fixed = true;
3270 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3273 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3276 cfg.feature_flags.package_upgrades = true;
3277 }
3278 4 => {
3283 cfg.reward_slashing_rate = Some(10000);
3285 cfg.gas_model_version = Some(3);
3287 }
3288 5 => {
3289 cfg.feature_flags.missing_type_is_compatibility_error = true;
3290 cfg.gas_model_version = Some(4);
3291 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3292 }
3296 6 => {
3297 cfg.gas_model_version = Some(5);
3298 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3299 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3300 }
3301 7 => {
3302 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3303 cfg.feature_flags
3304 .disable_invariant_violation_check_in_swap_loc = true;
3305 cfg.feature_flags.ban_entry_init = true;
3306 cfg.feature_flags.package_digest_hash_module = true;
3307 }
3308 8 => {
3309 cfg.feature_flags
3310 .disallow_change_struct_type_params_on_upgrade = true;
3311 }
3312 9 => {
3313 cfg.max_move_identifier_len = Some(128);
3315 cfg.feature_flags.no_extraneous_module_bytes = true;
3316 cfg.feature_flags
3317 .advance_to_highest_supported_protocol_version = true;
3318 }
3319 10 => {
3320 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3321 cfg.max_meter_ticks_per_module = Some(16_000_000);
3322 }
3323 11 => {
3324 cfg.max_move_value_depth = Some(128);
3325 }
3326 12 => {
3327 cfg.feature_flags.narwhal_versioned_metadata = true;
3328 if chain != Chain::Mainnet {
3329 cfg.feature_flags.commit_root_state_digest = true;
3330 }
3331
3332 if chain != Chain::Mainnet && chain != Chain::Testnet {
3333 cfg.feature_flags.zklogin_auth = true;
3334 }
3335 }
3336 13 => {}
3337 14 => {
3338 cfg.gas_rounding_step = Some(1_000);
3339 cfg.gas_model_version = Some(6);
3340 }
3341 15 => {
3342 cfg.feature_flags.consensus_transaction_ordering =
3343 ConsensusTransactionOrdering::ByGasPrice;
3344 }
3345 16 => {
3346 cfg.feature_flags.simplified_unwrap_then_delete = true;
3347 }
3348 17 => {
3349 cfg.feature_flags.upgraded_multisig_supported = true;
3350 }
3351 18 => {
3352 cfg.execution_version = Some(1);
3353 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3362 cfg.base_tx_cost_fixed = Some(1_000);
3364 }
3365 19 => {
3366 cfg.max_num_event_emit = Some(1024);
3367 cfg.max_event_emit_size_total = Some(
3370 256 * 250 * 1024, );
3372 }
3373 20 => {
3374 cfg.feature_flags.commit_root_state_digest = true;
3375
3376 if chain != Chain::Mainnet {
3377 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3378 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3379 }
3380 }
3381
3382 21 => {
3383 if chain != Chain::Mainnet {
3384 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3385 "Google".to_string(),
3386 "Facebook".to_string(),
3387 "Twitch".to_string(),
3388 ]);
3389 }
3390 }
3391 22 => {
3392 cfg.feature_flags.loaded_child_object_format = true;
3393 }
3394 23 => {
3395 cfg.feature_flags.loaded_child_object_format_type = true;
3396 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3397 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3403 }
3404 24 => {
3405 cfg.feature_flags.simple_conservation_checks = true;
3406 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3407
3408 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3409
3410 if chain != Chain::Mainnet {
3411 cfg.feature_flags.enable_jwk_consensus_updates = true;
3412 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3414 cfg.max_age_of_jwk_in_epochs = Some(1);
3415 }
3416 }
3417 25 => {
3418 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3420 "Google".to_string(),
3421 "Facebook".to_string(),
3422 "Twitch".to_string(),
3423 ]);
3424 cfg.feature_flags.zklogin_auth = true;
3425
3426 cfg.feature_flags.enable_jwk_consensus_updates = true;
3428 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3429 cfg.max_age_of_jwk_in_epochs = Some(1);
3430 }
3431 26 => {
3432 cfg.gas_model_version = Some(7);
3433 if chain != Chain::Mainnet && chain != Chain::Testnet {
3435 cfg.transfer_receive_object_cost_base = Some(52);
3436 cfg.feature_flags.receive_objects = true;
3437 }
3438 }
3439 27 => {
3440 cfg.gas_model_version = Some(8);
3441 }
3442 28 => {
3443 cfg.check_zklogin_id_cost_base = Some(200);
3445 cfg.check_zklogin_issuer_cost_base = Some(200);
3447
3448 if chain != Chain::Mainnet && chain != Chain::Testnet {
3450 cfg.feature_flags.enable_effects_v2 = true;
3451 }
3452 }
3453 29 => {
3454 cfg.feature_flags.verify_legacy_zklogin_address = true;
3455 }
3456 30 => {
3457 if chain != Chain::Mainnet {
3459 cfg.feature_flags.narwhal_certificate_v2 = true;
3460 }
3461
3462 cfg.random_beacon_reduction_allowed_delta = Some(800);
3463 if chain != Chain::Mainnet {
3465 cfg.feature_flags.enable_effects_v2 = true;
3466 }
3467
3468 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3472
3473 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3474 }
3475 31 => {
3476 cfg.execution_version = Some(2);
3477 if chain != Chain::Mainnet && chain != Chain::Testnet {
3479 cfg.feature_flags.shared_object_deletion = true;
3480 }
3481 }
3482 32 => {
3483 if chain != Chain::Mainnet {
3485 cfg.feature_flags.accept_zklogin_in_multisig = true;
3486 }
3487 if chain != Chain::Mainnet {
3489 cfg.transfer_receive_object_cost_base = Some(52);
3490 cfg.feature_flags.receive_objects = true;
3491 }
3492 if chain != Chain::Mainnet && chain != Chain::Testnet {
3494 cfg.feature_flags.random_beacon = true;
3495 cfg.random_beacon_reduction_lower_bound = Some(1600);
3496 cfg.random_beacon_dkg_timeout_round = Some(3000);
3497 cfg.random_beacon_min_round_interval_ms = Some(150);
3498 }
3499 if chain != Chain::Testnet && chain != Chain::Mainnet {
3501 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3502 }
3503
3504 cfg.feature_flags.narwhal_certificate_v2 = true;
3506 }
3507 33 => {
3508 cfg.feature_flags.hardened_otw_check = true;
3509 cfg.feature_flags.allow_receiving_object_id = true;
3510
3511 cfg.transfer_receive_object_cost_base = Some(52);
3513 cfg.feature_flags.receive_objects = true;
3514
3515 if chain != Chain::Mainnet {
3517 cfg.feature_flags.shared_object_deletion = true;
3518 }
3519
3520 cfg.feature_flags.enable_effects_v2 = true;
3521 }
3522 34 => {}
3523 35 => {
3524 if chain != Chain::Mainnet && chain != Chain::Testnet {
3526 cfg.feature_flags.enable_poseidon = true;
3527 cfg.poseidon_bn254_cost_base = Some(260);
3528 cfg.poseidon_bn254_cost_per_block = Some(10);
3529 }
3530
3531 cfg.feature_flags.enable_coin_deny_list = true;
3532 }
3533 36 => {
3534 if chain != Chain::Mainnet && chain != Chain::Testnet {
3536 cfg.feature_flags.enable_group_ops_native_functions = true;
3537 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3538 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3540 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3541 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3542 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3543 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3544 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3545 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3546 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3547 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3548 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3549 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3550 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3551 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3552 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3553 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3554 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3555 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3556 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3557 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3558 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3559 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3560 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3561 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3562 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3563 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3564 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3565 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3566 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3567 cfg.group_ops_bls12381_msm_max_len = Some(32);
3568 cfg.group_ops_bls12381_pairing_cost = Some(52);
3569 }
3570 cfg.feature_flags.shared_object_deletion = true;
3572
3573 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3575 }
3577 37 => {
3578 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3579
3580 if chain != Chain::Mainnet {
3582 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3583 }
3584 }
3585 38 => {
3586 cfg.binary_module_handles = Some(100);
3587 cfg.binary_struct_handles = Some(300);
3588 cfg.binary_function_handles = Some(1500);
3589 cfg.binary_function_instantiations = Some(750);
3590 cfg.binary_signatures = Some(1000);
3591 cfg.binary_constant_pool = Some(4000);
3595 cfg.binary_identifiers = Some(10000);
3596 cfg.binary_address_identifiers = Some(100);
3597 cfg.binary_struct_defs = Some(200);
3598 cfg.binary_struct_def_instantiations = Some(100);
3599 cfg.binary_function_defs = Some(1000);
3600 cfg.binary_field_handles = Some(500);
3601 cfg.binary_field_instantiations = Some(250);
3602 cfg.binary_friend_decls = Some(100);
3603 cfg.max_package_dependencies = Some(32);
3605 cfg.max_modules_in_publish = Some(64);
3606 cfg.execution_version = Some(3);
3608 }
3609 39 => {
3610 }
3612 40 => {}
3613 41 => {
3614 cfg.feature_flags.enable_group_ops_native_functions = true;
3616 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3618 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3619 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3620 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3621 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3622 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3623 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3624 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3625 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3626 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3627 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3628 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3629 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3630 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3631 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3632 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3633 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3634 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3635 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3636 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3637 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3638 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3639 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3640 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3641 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3642 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3643 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3644 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3645 cfg.group_ops_bls12381_msm_max_len = Some(32);
3646 cfg.group_ops_bls12381_pairing_cost = Some(52);
3647 }
3648 42 => {}
3649 43 => {
3650 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3651 cfg.max_meter_ticks_per_package = Some(16_000_000);
3652 }
3653 44 => {
3654 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3656 if chain != Chain::Mainnet {
3658 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3659 }
3660 }
3661 45 => {
3662 if chain != Chain::Testnet && chain != Chain::Mainnet {
3664 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3665 }
3666
3667 if chain != Chain::Mainnet {
3668 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3670 }
3671 cfg.min_move_binary_format_version = Some(6);
3672 cfg.feature_flags.accept_zklogin_in_multisig = true;
3673
3674 if chain != Chain::Mainnet && chain != Chain::Testnet {
3678 cfg.feature_flags.bridge = true;
3679 }
3680 }
3681 46 => {
3682 if chain != Chain::Mainnet {
3684 cfg.feature_flags.bridge = true;
3685 }
3686
3687 cfg.feature_flags.reshare_at_same_initial_version = true;
3689 }
3690 47 => {}
3691 48 => {
3692 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3694
3695 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3697
3698 if chain != Chain::Mainnet {
3700 cfg.feature_flags.random_beacon = true;
3701 cfg.random_beacon_reduction_lower_bound = Some(1600);
3702 cfg.random_beacon_dkg_timeout_round = Some(3000);
3703 cfg.random_beacon_min_round_interval_ms = Some(200);
3704 }
3705
3706 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3708 }
3709 49 => {
3710 if chain != Chain::Testnet && chain != Chain::Mainnet {
3711 cfg.move_binary_format_version = Some(7);
3712 }
3713
3714 if chain != Chain::Mainnet && chain != Chain::Testnet {
3716 cfg.feature_flags.enable_vdf = true;
3717 cfg.vdf_verify_vdf_cost = Some(1500);
3720 cfg.vdf_hash_to_input_cost = Some(100);
3721 }
3722
3723 if chain != Chain::Testnet && chain != Chain::Mainnet {
3725 cfg.feature_flags
3726 .record_consensus_determined_version_assignments_in_prologue = true;
3727 }
3728
3729 if chain != Chain::Mainnet {
3731 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3732 }
3733
3734 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3736 }
3737 50 => {
3738 if chain != Chain::Mainnet {
3740 cfg.checkpoint_summary_version_specific_data = Some(1);
3741 cfg.min_checkpoint_interval_ms = Some(200);
3742 }
3743
3744 if chain != Chain::Testnet && chain != Chain::Mainnet {
3746 cfg.feature_flags
3747 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3748 }
3749
3750 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3751
3752 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3754 }
3755 51 => {
3756 cfg.random_beacon_dkg_version = Some(1);
3757
3758 if chain != Chain::Testnet && chain != Chain::Mainnet {
3759 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3760 }
3761 }
3762 52 => {
3763 if chain != Chain::Mainnet {
3764 cfg.feature_flags.soft_bundle = true;
3765 cfg.max_soft_bundle_size = Some(5);
3766 }
3767
3768 cfg.config_read_setting_impl_cost_base = Some(100);
3769 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3770
3771 if chain != Chain::Testnet && chain != Chain::Mainnet {
3773 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3774 cfg.feature_flags.per_object_congestion_control_mode =
3775 PerObjectCongestionControlMode::TotalTxCount;
3776 }
3777
3778 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3780
3781 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3783
3784 cfg.checkpoint_summary_version_specific_data = Some(1);
3786 cfg.min_checkpoint_interval_ms = Some(200);
3787
3788 if chain != Chain::Mainnet {
3790 cfg.feature_flags
3791 .record_consensus_determined_version_assignments_in_prologue = true;
3792 cfg.feature_flags
3793 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3794 }
3795 if chain != Chain::Mainnet {
3797 cfg.move_binary_format_version = Some(7);
3798 }
3799
3800 if chain != Chain::Testnet && chain != Chain::Mainnet {
3801 cfg.feature_flags.passkey_auth = true;
3802 }
3803 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3804 }
3805 53 => {
3806 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3808
3809 cfg.feature_flags
3811 .record_consensus_determined_version_assignments_in_prologue = true;
3812 cfg.feature_flags
3813 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3814
3815 if chain == Chain::Unknown {
3816 cfg.feature_flags.authority_capabilities_v2 = true;
3817 }
3818
3819 if chain != Chain::Mainnet {
3821 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3822 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3823 cfg.feature_flags.per_object_congestion_control_mode =
3824 PerObjectCongestionControlMode::TotalTxCount;
3825 }
3826
3827 cfg.bcs_per_byte_serialized_cost = Some(2);
3829 cfg.bcs_legacy_min_output_size_cost = Some(1);
3830 cfg.bcs_failure_cost = Some(52);
3831 cfg.debug_print_base_cost = Some(52);
3832 cfg.debug_print_stack_trace_base_cost = Some(52);
3833 cfg.hash_sha2_256_base_cost = Some(52);
3834 cfg.hash_sha2_256_per_byte_cost = Some(2);
3835 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3836 cfg.hash_sha3_256_base_cost = Some(52);
3837 cfg.hash_sha3_256_per_byte_cost = Some(2);
3838 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3839 cfg.type_name_get_base_cost = Some(52);
3840 cfg.type_name_get_per_byte_cost = Some(2);
3841 cfg.string_check_utf8_base_cost = Some(52);
3842 cfg.string_check_utf8_per_byte_cost = Some(2);
3843 cfg.string_is_char_boundary_base_cost = Some(52);
3844 cfg.string_sub_string_base_cost = Some(52);
3845 cfg.string_sub_string_per_byte_cost = Some(2);
3846 cfg.string_index_of_base_cost = Some(52);
3847 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3848 cfg.string_index_of_per_byte_searched_cost = Some(2);
3849 cfg.vector_empty_base_cost = Some(52);
3850 cfg.vector_length_base_cost = Some(52);
3851 cfg.vector_push_back_base_cost = Some(52);
3852 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3853 cfg.vector_borrow_base_cost = Some(52);
3854 cfg.vector_pop_back_base_cost = Some(52);
3855 cfg.vector_destroy_empty_base_cost = Some(52);
3856 cfg.vector_swap_base_cost = Some(52);
3857 }
3858 54 => {
3859 cfg.feature_flags.random_beacon = true;
3861 cfg.random_beacon_reduction_lower_bound = Some(1000);
3862 cfg.random_beacon_dkg_timeout_round = Some(3000);
3863 cfg.random_beacon_min_round_interval_ms = Some(500);
3864
3865 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3867 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3868 cfg.feature_flags.per_object_congestion_control_mode =
3869 PerObjectCongestionControlMode::TotalTxCount;
3870
3871 cfg.feature_flags.soft_bundle = true;
3873 cfg.max_soft_bundle_size = Some(5);
3874 }
3875 55 => {
3876 cfg.move_binary_format_version = Some(7);
3878
3879 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3881 cfg.consensus_max_num_transactions_in_block = Some(512);
3884
3885 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3886 }
3887 56 => {
3888 if chain == Chain::Mainnet {
3889 cfg.feature_flags.bridge = true;
3890 }
3891 }
3892 57 => {
3893 cfg.random_beacon_reduction_lower_bound = Some(800);
3895 }
3896 58 => {
3897 if chain == Chain::Mainnet {
3898 cfg.bridge_should_try_to_finalize_committee = Some(true);
3899 }
3900
3901 if chain != Chain::Mainnet && chain != Chain::Testnet {
3902 cfg.feature_flags
3904 .consensus_distributed_vote_scoring_strategy = true;
3905 }
3906 }
3907 59 => {
3908 cfg.feature_flags.consensus_round_prober = true;
3910 }
3911 60 => {
3912 cfg.max_type_to_layout_nodes = Some(512);
3913 cfg.feature_flags.validate_identifier_inputs = true;
3914 }
3915 61 => {
3916 if chain != Chain::Mainnet {
3917 cfg.feature_flags
3919 .consensus_distributed_vote_scoring_strategy = true;
3920 }
3921 cfg.random_beacon_reduction_lower_bound = Some(700);
3923
3924 if chain != Chain::Mainnet && chain != Chain::Testnet {
3925 cfg.feature_flags.mysticeti_fastpath = true;
3927 }
3928 }
3929 62 => {
3930 cfg.feature_flags.relocate_event_module = true;
3931 }
3932 63 => {
3933 cfg.feature_flags.per_object_congestion_control_mode =
3934 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3935 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3936 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3937 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3938 }
3939 64 => {
3940 cfg.feature_flags.per_object_congestion_control_mode =
3941 PerObjectCongestionControlMode::TotalTxCount;
3942 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3943 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3944 }
3945 65 => {
3946 cfg.feature_flags
3948 .consensus_distributed_vote_scoring_strategy = true;
3949 }
3950 66 => {
3951 if chain == Chain::Mainnet {
3952 cfg.feature_flags
3954 .consensus_distributed_vote_scoring_strategy = false;
3955 }
3956 }
3957 67 => {
3958 cfg.feature_flags
3960 .consensus_distributed_vote_scoring_strategy = true;
3961 }
3962 68 => {
3963 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3964 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3965 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3966 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3967 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3968
3969 if chain != Chain::Mainnet && chain != Chain::Testnet {
3970 cfg.feature_flags.uncompressed_g1_group_elements = true;
3971 }
3972
3973 cfg.feature_flags.per_object_congestion_control_mode =
3974 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3975 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3976 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3977 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3978 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3980 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3981
3982 cfg.random_beacon_reduction_lower_bound = Some(500);
3984
3985 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3986 }
3987 69 => {
3988 cfg.consensus_voting_rounds = Some(40);
3990
3991 if chain != Chain::Mainnet && chain != Chain::Testnet {
3992 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3994 }
3995
3996 if chain != Chain::Mainnet {
3997 cfg.feature_flags.uncompressed_g1_group_elements = true;
3998 }
3999 }
4000 70 => {
4001 if chain != Chain::Mainnet {
4002 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4004 cfg.feature_flags
4006 .consensus_round_prober_probe_accepted_rounds = true;
4007 }
4008
4009 cfg.poseidon_bn254_cost_per_block = Some(388);
4010
4011 cfg.gas_model_version = Some(9);
4012 cfg.feature_flags.native_charging_v2 = true;
4013 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4014 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4015 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4016 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4017 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4018 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4019 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4020 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4021
4022 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4024 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4025 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4026 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4027
4028 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4029 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4030 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4031 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4032 Some(8213);
4033 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4034 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4035 Some(9484);
4036
4037 cfg.hash_keccak256_cost_base = Some(10);
4038 cfg.hash_blake2b256_cost_base = Some(10);
4039
4040 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4042 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4043 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4044 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4045
4046 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4047 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4048 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4049 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4050
4051 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4052 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4053 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4054 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4055
4056 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4057 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4058 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4059 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4060
4061 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4062 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4063 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4064 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4065
4066 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4067 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4068
4069 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4070 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4071 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4072 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4073
4074 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4075 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4076 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4077 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4078
4079 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4080 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4081
4082 cfg.validator_validate_metadata_cost_base = Some(20000);
4083 }
4084 71 => {
4085 cfg.sip_45_consensus_amplification_threshold = Some(5);
4086
4087 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4089 }
4090 72 => {
4091 cfg.feature_flags.convert_type_argument_error = true;
4092
4093 cfg.max_tx_gas = Some(50_000_000_000_000);
4096 cfg.max_gas_price = Some(50_000_000_000);
4098
4099 cfg.feature_flags.variant_nodes = true;
4100 }
4101 73 => {
4102 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4104
4105 if chain != Chain::Mainnet && chain != Chain::Testnet {
4106 cfg.consensus_gc_depth = Some(60);
4109 }
4110
4111 if chain != Chain::Mainnet {
4112 cfg.feature_flags.consensus_zstd_compression = true;
4114 }
4115
4116 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4118 cfg.feature_flags
4120 .consensus_round_prober_probe_accepted_rounds = true;
4121
4122 cfg.feature_flags.per_object_congestion_control_mode =
4124 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4125 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4126 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4127 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4128 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4130 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4131 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4132 }
4133 74 => {
4134 if chain != Chain::Mainnet && chain != Chain::Testnet {
4136 cfg.feature_flags.enable_nitro_attestation = true;
4137 }
4138 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4139 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4140 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4141 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4142
4143 cfg.feature_flags.consensus_zstd_compression = true;
4145
4146 if chain != Chain::Mainnet && chain != Chain::Testnet {
4147 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4148 }
4149 }
4150 75 => {
4151 if chain != Chain::Mainnet {
4152 cfg.feature_flags.passkey_auth = true;
4153 }
4154 }
4155 76 => {
4156 if chain != Chain::Mainnet && chain != Chain::Testnet {
4157 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4158 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4159 }
4160 cfg.feature_flags.minimize_child_object_mutations = true;
4161
4162 if chain != Chain::Mainnet {
4163 cfg.feature_flags.accept_passkey_in_multisig = true;
4164 }
4165 }
4166 77 => {
4167 cfg.feature_flags.uncompressed_g1_group_elements = true;
4168
4169 if chain != Chain::Mainnet {
4170 cfg.consensus_gc_depth = Some(60);
4171 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4172 }
4173 }
4174 78 => {
4175 cfg.feature_flags.move_native_context = true;
4176 cfg.tx_context_fresh_id_cost_base = Some(52);
4177 cfg.tx_context_sender_cost_base = Some(30);
4178 cfg.tx_context_epoch_cost_base = Some(30);
4179 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4180 cfg.tx_context_sponsor_cost_base = Some(30);
4181 cfg.tx_context_gas_price_cost_base = Some(30);
4182 cfg.tx_context_gas_budget_cost_base = Some(30);
4183 cfg.tx_context_ids_created_cost_base = Some(30);
4184 cfg.tx_context_replace_cost_base = Some(30);
4185 cfg.gas_model_version = Some(10);
4186
4187 if chain != Chain::Mainnet {
4188 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4189 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4190
4191 cfg.feature_flags.per_object_congestion_control_mode =
4193 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4194 ExecutionTimeEstimateParams {
4195 target_utilization: 30,
4196 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4198 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4200 stored_observations_limit: u64::MAX,
4201 stake_weighted_median_threshold: 0,
4202 default_none_duration_for_new_keys: false,
4203 observations_chunk_size: None,
4204 },
4205 );
4206 }
4207 }
4208 79 => {
4209 if chain != Chain::Mainnet {
4210 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4211
4212 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4215
4216 cfg.feature_flags.consensus_batched_block_sync = true;
4217
4218 cfg.feature_flags.enable_nitro_attestation = true
4220 }
4221 cfg.feature_flags.normalize_ptb_arguments = true;
4222
4223 cfg.consensus_gc_depth = Some(60);
4224 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4225 }
4226 80 => {
4227 cfg.max_ptb_value_size = Some(1024 * 1024);
4228 }
4229 81 => {
4230 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4231 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4232 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4233 }
4234 82 => {
4235 cfg.feature_flags.max_ptb_value_size_v2 = true;
4236 }
4237 83 => {
4238 if chain == Chain::Mainnet {
4239 let aliased: [u8; 32] = Hex::decode(
4241 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4242 )
4243 .unwrap()
4244 .try_into()
4245 .unwrap();
4246
4247 cfg.aliased_addresses.push(AliasedAddress {
4249 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4250 aliased,
4251 allowed_tx_digests: vec![
4252 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4253 ],
4254 });
4255
4256 cfg.aliased_addresses.push(AliasedAddress {
4257 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4258 aliased,
4259 allowed_tx_digests: vec![
4260 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4261 ],
4262 });
4263 }
4264
4265 if chain != Chain::Mainnet {
4268 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4269 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4270
4271 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4273 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4274 cfg.feature_flags.per_object_congestion_control_mode =
4275 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4276 ExecutionTimeEstimateParams {
4277 target_utilization: 30,
4278 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4280 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4282 stored_observations_limit: u64::MAX,
4283 stake_weighted_median_threshold: 0,
4284 default_none_duration_for_new_keys: false,
4285 observations_chunk_size: None,
4286 },
4287 );
4288
4289 cfg.feature_flags.consensus_batched_block_sync = true;
4291
4292 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4295 cfg.feature_flags.enable_nitro_attestation = true;
4296 }
4297 }
4298 84 => {
4299 if chain == Chain::Mainnet {
4300 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4301 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4302
4303 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4305 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4306 cfg.feature_flags.per_object_congestion_control_mode =
4307 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4308 ExecutionTimeEstimateParams {
4309 target_utilization: 30,
4310 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4312 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4314 stored_observations_limit: u64::MAX,
4315 stake_weighted_median_threshold: 0,
4316 default_none_duration_for_new_keys: false,
4317 observations_chunk_size: None,
4318 },
4319 );
4320
4321 cfg.feature_flags.consensus_batched_block_sync = true;
4323
4324 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4327 cfg.feature_flags.enable_nitro_attestation = true;
4328 }
4329
4330 cfg.feature_flags.per_object_congestion_control_mode =
4332 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4333 ExecutionTimeEstimateParams {
4334 target_utilization: 30,
4335 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4337 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4339 stored_observations_limit: 20,
4340 stake_weighted_median_threshold: 0,
4341 default_none_duration_for_new_keys: false,
4342 observations_chunk_size: None,
4343 },
4344 );
4345 cfg.feature_flags.allow_unbounded_system_objects = true;
4346 }
4347 85 => {
4348 if chain != Chain::Mainnet && chain != Chain::Testnet {
4349 cfg.feature_flags.enable_party_transfer = true;
4350 }
4351
4352 cfg.feature_flags
4353 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4354 cfg.feature_flags.disallow_self_identifier = true;
4355 cfg.feature_flags.per_object_congestion_control_mode =
4356 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4357 ExecutionTimeEstimateParams {
4358 target_utilization: 50,
4359 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4361 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4363 stored_observations_limit: 20,
4364 stake_weighted_median_threshold: 0,
4365 default_none_duration_for_new_keys: false,
4366 observations_chunk_size: None,
4367 },
4368 );
4369 }
4370 86 => {
4371 cfg.feature_flags.type_tags_in_object_runtime = true;
4372 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4373
4374 cfg.feature_flags.per_object_congestion_control_mode =
4376 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4377 ExecutionTimeEstimateParams {
4378 target_utilization: 50,
4379 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4381 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4383 stored_observations_limit: 20,
4384 stake_weighted_median_threshold: 3334,
4385 default_none_duration_for_new_keys: false,
4386 observations_chunk_size: None,
4387 },
4388 );
4389 if chain != Chain::Mainnet {
4391 cfg.feature_flags.enable_party_transfer = true;
4392 }
4393 }
4394 87 => {
4395 if chain == Chain::Mainnet {
4396 cfg.feature_flags.record_time_estimate_processed = true;
4397 }
4398 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4399 }
4400 88 => {
4401 cfg.feature_flags.record_time_estimate_processed = true;
4402 cfg.tx_context_rgp_cost_base = Some(30);
4403 cfg.feature_flags
4404 .ignore_execution_time_observations_after_certs_closed = true;
4405
4406 cfg.feature_flags.per_object_congestion_control_mode =
4409 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4410 ExecutionTimeEstimateParams {
4411 target_utilization: 50,
4412 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4414 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4416 stored_observations_limit: 20,
4417 stake_weighted_median_threshold: 3334,
4418 default_none_duration_for_new_keys: true,
4419 observations_chunk_size: None,
4420 },
4421 );
4422 }
4423 89 => {
4424 cfg.feature_flags.dependency_linkage_error = true;
4425 cfg.feature_flags.additional_multisig_checks = true;
4426 }
4427 90 => {
4428 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4430 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4431 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4432 cfg.feature_flags.accept_passkey_in_multisig = true;
4433 cfg.feature_flags.passkey_auth = true;
4434 cfg.feature_flags.check_for_init_during_upgrade = true;
4435
4436 if chain != Chain::Mainnet {
4438 cfg.feature_flags.mysticeti_fastpath = true;
4439 }
4440 }
4441 91 => {
4442 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4443 }
4444 92 => {
4445 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4446 }
4447 93 => {
4448 cfg.feature_flags
4449 .consensus_checkpoint_signature_key_includes_digest = true;
4450 }
4451 94 => {
4452 cfg.feature_flags.per_object_congestion_control_mode =
4454 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4455 ExecutionTimeEstimateParams {
4456 target_utilization: 50,
4457 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4459 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4461 stored_observations_limit: 18,
4462 stake_weighted_median_threshold: 3334,
4463 default_none_duration_for_new_keys: true,
4464 observations_chunk_size: None,
4465 },
4466 );
4467
4468 cfg.feature_flags.enable_party_transfer = true;
4470 }
4471 95 => {
4472 cfg.type_name_id_base_cost = Some(52);
4473
4474 cfg.max_transactions_per_checkpoint = Some(20_000);
4476 }
4477 96 => {
4478 if chain != Chain::Mainnet && chain != Chain::Testnet {
4480 cfg.feature_flags
4481 .include_checkpoint_artifacts_digest_in_summary = true;
4482 }
4483 cfg.feature_flags.correct_gas_payment_limit_check = true;
4484 cfg.feature_flags.authority_capabilities_v2 = true;
4485 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4486 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4487 cfg.feature_flags.enable_coin_registry = true;
4488
4489 cfg.feature_flags.mysticeti_fastpath = true;
4491 }
4492 97 => {
4493 cfg.feature_flags.additional_borrow_checks = true;
4494 }
4495 98 => {
4496 cfg.event_emit_auth_stream_cost = Some(52);
4497 cfg.feature_flags.better_loader_errors = true;
4498 cfg.feature_flags.generate_df_type_layouts = true;
4499 }
4500 99 => {
4501 cfg.feature_flags.use_new_commit_handler = true;
4502 }
4503 100 => {
4504 cfg.feature_flags.private_generics_verifier_v2 = true;
4505 }
4506 101 => {
4507 cfg.feature_flags.create_root_accumulator_object = true;
4508 cfg.max_updates_per_settlement_txn = Some(100);
4509 if chain != Chain::Mainnet {
4510 cfg.feature_flags.enable_poseidon = true;
4511 }
4512 }
4513 102 => {
4514 cfg.feature_flags.per_object_congestion_control_mode =
4518 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4519 ExecutionTimeEstimateParams {
4520 target_utilization: 50,
4521 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4523 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4525 stored_observations_limit: 180,
4526 stake_weighted_median_threshold: 3334,
4527 default_none_duration_for_new_keys: true,
4528 observations_chunk_size: Some(18),
4529 },
4530 );
4531 cfg.feature_flags.deprecate_global_storage_ops = true;
4532 }
4533 103 => {}
4534 104 => {
4535 cfg.translation_per_command_base_charge = Some(1);
4536 cfg.translation_per_input_base_charge = Some(1);
4537 cfg.translation_pure_input_per_byte_charge = Some(1);
4538 cfg.translation_per_type_node_charge = Some(1);
4539 cfg.translation_per_reference_node_charge = Some(1);
4540 cfg.translation_per_linkage_entry_charge = Some(10);
4541 cfg.gas_model_version = Some(11);
4542 cfg.feature_flags.abstract_size_in_object_runtime = true;
4543 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4544 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4545 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4546 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4547 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4548 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4549 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4550 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4551 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4552 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4553 cfg.feature_flags.enable_ptb_execution_v2 = true;
4554
4555 cfg.poseidon_bn254_cost_base = Some(260);
4556
4557 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4558
4559 if chain != Chain::Mainnet {
4560 cfg.feature_flags
4561 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4562 }
4563
4564 cfg.feature_flags
4565 .include_cancelled_randomness_txns_in_prologue = true;
4566 }
4567 105 => {
4568 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4569 cfg.feature_flags.disable_preconsensus_locking = true;
4570
4571 if chain != Chain::Mainnet {
4572 cfg.feature_flags
4573 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4574 }
4575 }
4576 106 => {
4577 cfg.accumulator_object_storage_cost = Some(7600);
4579
4580 if chain != Chain::Mainnet && chain != Chain::Testnet {
4581 cfg.feature_flags.enable_accumulators = true;
4582 cfg.feature_flags.enable_address_balance_gas_payments = true;
4583 cfg.feature_flags.enable_authenticated_event_streams = true;
4584 cfg.feature_flags.enable_object_funds_withdraw = true;
4585 }
4586 }
4587 107 => {
4588 cfg.feature_flags
4589 .consensus_skip_gced_blocks_in_direct_finalization = true;
4590
4591 if in_integration_test() {
4593 cfg.consensus_gc_depth = Some(6);
4594 cfg.consensus_max_num_transactions_in_block = Some(8);
4595 }
4596 }
4597 108 => {
4598 cfg.feature_flags.gas_rounding_halve_digits = true;
4599 cfg.feature_flags.flexible_tx_context_positions = true;
4600 cfg.feature_flags.disable_entry_point_signature_check = true;
4601
4602 if chain != Chain::Mainnet {
4603 cfg.feature_flags.address_aliases = true;
4604
4605 cfg.feature_flags.enable_accumulators = true;
4606 cfg.feature_flags.enable_address_balance_gas_payments = true;
4607 }
4608
4609 cfg.feature_flags.enable_poseidon = true;
4610 }
4611 109 => {
4612 cfg.binary_variant_handles = Some(1024);
4613 cfg.binary_variant_instantiation_handles = Some(1024);
4614 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4615 }
4616 110 => {
4617 cfg.feature_flags
4618 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4619 cfg.feature_flags
4620 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4621 if chain != Chain::Mainnet && chain != Chain::Testnet {
4622 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4623 }
4624 cfg.feature_flags.validate_zklogin_public_identifier = true;
4625 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4626 cfg.feature_flags
4627 .consensus_always_accept_system_transactions = true;
4628 if chain != Chain::Mainnet {
4629 cfg.feature_flags.enable_object_funds_withdraw = true;
4630 }
4631 }
4632 111 => {
4633 cfg.feature_flags.validator_metadata_verify_v2 = true;
4634 }
4635 112 => {
4636 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4637 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4638 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4639 cfg.group_ops_ristretto_point_add_cost = Some(500);
4640 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4641 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4642 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4643 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4644 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4645 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4646
4647 if chain != Chain::Mainnet && chain != Chain::Testnet {
4648 cfg.feature_flags.enable_ristretto255_group_ops = true;
4649 }
4650 }
4651 113 => {
4652 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4653 if chain != Chain::Mainnet && chain != Chain::Testnet {
4654 cfg.feature_flags.defer_unpaid_amplification = true;
4655 }
4656 }
4657 114 => {
4658 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4659 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4660 if chain != Chain::Mainnet {
4661 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4662 cfg.feature_flags.enable_authenticated_event_streams = true;
4663 cfg.feature_flags
4664 .include_checkpoint_artifacts_digest_in_summary = true;
4665 }
4666 }
4667 115 => {
4668 cfg.feature_flags.normalize_depth_formula = true;
4669 }
4670 116 => {
4671 cfg.feature_flags.gasless_transaction_drop_safety = true;
4672 cfg.feature_flags.address_aliases = true;
4673 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4674 cfg.feature_flags.defer_unpaid_amplification = false;
4676 cfg.feature_flags.enable_display_registry = true;
4677 }
4678 117 => {}
4679 118 => {
4680 }
4682 _ => panic!("unsupported version {:?}", version),
4693 }
4694 }
4695
4696 cfg
4697 }
4698
4699 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4700 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4701 || !self.feature_flags.split_checkpoints_in_consensus_handler
4702 {
4703 return;
4704 }
4705
4706 if !mysten_common::in_test_configuration() {
4707 return;
4708 }
4709
4710 use rand::{Rng, SeedableRng, rngs::StdRng};
4711 let mut rng = StdRng::from_seed(*seed);
4712 let max_txns = rng.gen_range(10..=100u64);
4713 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4714 self.max_transactions_per_checkpoint = Some(max_txns);
4715 }
4716
4717 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4723 let (
4724 max_back_edges_per_function,
4725 max_back_edges_per_module,
4726 sanity_check_with_regex_reference_safety,
4727 ) = if let Some((
4728 max_back_edges_per_function,
4729 max_back_edges_per_module,
4730 sanity_check_with_regex_reference_safety,
4731 )) = signing_limits
4732 {
4733 (
4734 Some(max_back_edges_per_function),
4735 Some(max_back_edges_per_module),
4736 Some(sanity_check_with_regex_reference_safety),
4737 )
4738 } else {
4739 (None, None, None)
4740 };
4741
4742 let additional_borrow_checks = if signing_limits.is_some() {
4743 true
4745 } else {
4746 self.additional_borrow_checks()
4747 };
4748 let deprecate_global_storage_ops = if signing_limits.is_some() {
4749 true
4751 } else {
4752 self.deprecate_global_storage_ops()
4753 };
4754
4755 VerifierConfig {
4756 max_loop_depth: Some(self.max_loop_depth() as usize),
4757 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4758 max_function_parameters: Some(self.max_function_parameters() as usize),
4759 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4760 max_value_stack_size: self.max_value_stack_size() as usize,
4761 max_type_nodes: Some(self.max_type_nodes() as usize),
4762 max_push_size: Some(self.max_push_size() as usize),
4763 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4764 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4765 max_function_definitions: Some(self.max_function_definitions() as usize),
4766 max_data_definitions: Some(self.max_struct_definitions() as usize),
4767 max_constant_vector_len: Some(self.max_move_vector_len()),
4768 max_back_edges_per_function,
4769 max_back_edges_per_module,
4770 max_basic_blocks_in_script: None,
4771 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4773 allow_receiving_object_id: self.allow_receiving_object_id(),
4774 reject_mutable_random_on_entry_functions: self
4775 .reject_mutable_random_on_entry_functions(),
4776 bytecode_version: self.move_binary_format_version(),
4777 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4778 additional_borrow_checks,
4779 better_loader_errors: self.better_loader_errors(),
4780 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4781 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4782 .map(|limit| limit as u128),
4783 deprecate_global_storage_ops,
4784 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4785 switch_to_regex_reference_safety: false,
4786 }
4787 }
4788
4789 pub fn binary_config(
4790 &self,
4791 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4792 ) -> BinaryConfig {
4793 let deprecate_global_storage_ops =
4794 override_deprecate_global_storage_ops_during_deserialization
4795 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4796 BinaryConfig::new(
4797 self.move_binary_format_version(),
4798 self.min_move_binary_format_version_as_option()
4799 .unwrap_or(VERSION_1),
4800 self.no_extraneous_module_bytes(),
4801 deprecate_global_storage_ops,
4802 TableConfig {
4803 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4804 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4805 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4806 function_instantiations: self
4807 .binary_function_instantiations_as_option()
4808 .unwrap_or(u16::MAX),
4809 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4810 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4811 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4812 address_identifiers: self
4813 .binary_address_identifiers_as_option()
4814 .unwrap_or(u16::MAX),
4815 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4816 struct_def_instantiations: self
4817 .binary_struct_def_instantiations_as_option()
4818 .unwrap_or(u16::MAX),
4819 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4820 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4821 field_instantiations: self
4822 .binary_field_instantiations_as_option()
4823 .unwrap_or(u16::MAX),
4824 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4825 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4826 enum_def_instantiations: self
4827 .binary_enum_def_instantiations_as_option()
4828 .unwrap_or(u16::MAX),
4829 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4830 variant_instantiation_handles: self
4831 .binary_variant_instantiation_handles_as_option()
4832 .unwrap_or(u16::MAX),
4833 },
4834 )
4835 }
4836
4837 pub fn apply_overrides_for_testing(
4841 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4842 ) -> OverrideGuard {
4843 CONFIG_OVERRIDE.with(|ovr| {
4844 let mut cur = ovr.borrow_mut();
4845 assert!(cur.is_none(), "config override already present");
4846 *cur = Some(Box::new(override_fn));
4847 OverrideGuard
4848 })
4849 }
4850}
4851
4852impl ProtocolConfig {
4856 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4857 self.feature_flags
4858 .advance_to_highest_supported_protocol_version = val
4859 }
4860 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4861 self.feature_flags.commit_root_state_digest = val
4862 }
4863 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4864 self.feature_flags.zklogin_auth = val
4865 }
4866 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4867 self.feature_flags.enable_jwk_consensus_updates = val
4868 }
4869 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4870 self.feature_flags.random_beacon = val
4871 }
4872
4873 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4874 self.feature_flags.upgraded_multisig_supported = val
4875 }
4876 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4877 self.feature_flags.accept_zklogin_in_multisig = val
4878 }
4879
4880 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4881 self.feature_flags.shared_object_deletion = val;
4882 }
4883
4884 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4885 self.feature_flags.narwhal_new_leader_election_schedule = val;
4886 }
4887
4888 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4889 self.feature_flags.receive_objects = val
4890 }
4891 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4892 self.feature_flags.narwhal_certificate_v2 = val
4893 }
4894 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4895 self.feature_flags.verify_legacy_zklogin_address = val
4896 }
4897
4898 pub fn set_per_object_congestion_control_mode_for_testing(
4899 &mut self,
4900 val: PerObjectCongestionControlMode,
4901 ) {
4902 self.feature_flags.per_object_congestion_control_mode = val;
4903 }
4904
4905 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4906 self.feature_flags.consensus_choice = val;
4907 }
4908
4909 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4910 self.feature_flags.consensus_network = val;
4911 }
4912
4913 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4914 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4915 }
4916
4917 pub fn set_disable_bridge_for_testing(&mut self) {
4918 self.feature_flags.bridge = false
4919 }
4920
4921 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4922 self.feature_flags.mysticeti_num_leaders_per_round = val;
4923 }
4924
4925 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4926 self.feature_flags.soft_bundle = val;
4927 }
4928
4929 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4930 self.feature_flags.passkey_auth = val
4931 }
4932
4933 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4934 self.feature_flags.enable_party_transfer = val
4935 }
4936
4937 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4938 self.feature_flags
4939 .consensus_distributed_vote_scoring_strategy = val;
4940 }
4941
4942 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4943 self.feature_flags.consensus_round_prober = val;
4944 }
4945
4946 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4947 self.feature_flags
4948 .disallow_new_modules_in_deps_only_packages = val;
4949 }
4950
4951 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4952 self.feature_flags.correct_gas_payment_limit_check = val;
4953 }
4954
4955 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4956 self.feature_flags.address_aliases = val;
4957 }
4958
4959 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4960 self.feature_flags
4961 .consensus_round_prober_probe_accepted_rounds = val;
4962 }
4963
4964 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4965 self.feature_flags.mysticeti_fastpath = val;
4966 }
4967
4968 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4969 self.feature_flags.accept_passkey_in_multisig = val;
4970 }
4971
4972 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4973 self.feature_flags.consensus_batched_block_sync = val;
4974 }
4975
4976 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4977 self.feature_flags.record_time_estimate_processed = val;
4978 }
4979
4980 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4981 &mut self,
4982 val: bool,
4983 ) {
4984 self.feature_flags
4985 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4986 }
4987
4988 pub fn enable_accumulators_for_testing(&mut self) {
4989 self.feature_flags.enable_accumulators = true;
4990 }
4991
4992 pub fn disable_accumulators_for_testing(&mut self) {
4993 self.feature_flags.enable_accumulators = false;
4994 self.feature_flags.enable_address_balance_gas_payments = false;
4995 }
4996
4997 pub fn enable_coin_reservation_for_testing(&mut self) {
4998 self.feature_flags.enable_coin_reservation_obj_refs = true;
4999 }
5000
5001 pub fn create_root_accumulator_object_for_testing(&mut self) {
5002 self.feature_flags.create_root_accumulator_object = true;
5003 }
5004
5005 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5006 self.feature_flags.create_root_accumulator_object = false;
5007 }
5008
5009 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5010 self.feature_flags.enable_accumulators = true;
5011 self.feature_flags.allow_private_accumulator_entrypoints = true;
5012 self.feature_flags.enable_address_balance_gas_payments = true;
5013 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5014 self.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
5015 }
5016
5017 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5018 self.feature_flags.enable_address_balance_gas_payments = false;
5019 }
5020
5021 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5022 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5023 }
5024
5025 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5026 self.enable_accumulators_for_testing();
5027 self.feature_flags.enable_authenticated_event_streams = true;
5028 self.feature_flags
5029 .include_checkpoint_artifacts_digest_in_summary = true;
5030 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5031 }
5032
5033 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5034 self.feature_flags.enable_authenticated_event_streams = false;
5035 }
5036
5037 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5038 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5039 }
5040
5041 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5042 self.feature_flags.enable_non_exclusive_writes = true;
5043 }
5044
5045 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5046 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5047 }
5048
5049 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5050 &mut self,
5051 val: bool,
5052 ) {
5053 self.feature_flags
5054 .ignore_execution_time_observations_after_certs_closed = val;
5055 }
5056
5057 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5058 &mut self,
5059 val: bool,
5060 ) {
5061 self.feature_flags
5062 .consensus_checkpoint_signature_key_includes_digest = val;
5063 }
5064
5065 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5066 self.feature_flags.cancel_for_failed_dkg_early = val;
5067 }
5068
5069 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5070 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5071 }
5072
5073 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5074 self.feature_flags.authority_capabilities_v2 = val;
5075 }
5076
5077 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5078 self.feature_flags.allow_references_in_ptbs = true;
5079 }
5080
5081 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5082 self.feature_flags.consensus_skip_gced_accept_votes = val;
5083 }
5084
5085 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5086 self.feature_flags.enable_object_funds_withdraw = val;
5087 }
5088
5089 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5090 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5091 }
5092}
5093
5094type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5095
5096thread_local! {
5097 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5098}
5099
5100#[must_use]
5101pub struct OverrideGuard;
5102
5103impl Drop for OverrideGuard {
5104 fn drop(&mut self) {
5105 info!("restoring override fn");
5106 CONFIG_OVERRIDE.with(|ovr| {
5107 *ovr.borrow_mut() = None;
5108 });
5109 }
5110}
5111
5112#[derive(PartialEq, Eq)]
5115pub enum LimitThresholdCrossed {
5116 None,
5117 Soft(u128, u128),
5118 Hard(u128, u128),
5119}
5120
5121pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5124 x: T,
5125 soft_limit: U,
5126 hard_limit: V,
5127) -> LimitThresholdCrossed {
5128 let x: V = x.into();
5129 let soft_limit: V = soft_limit.into();
5130
5131 debug_assert!(soft_limit <= hard_limit);
5132
5133 if x >= hard_limit {
5136 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5137 } else if x < soft_limit {
5138 LimitThresholdCrossed::None
5139 } else {
5140 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5141 }
5142}
5143
5144#[macro_export]
5145macro_rules! check_limit {
5146 ($x:expr, $hard:expr) => {
5147 check_limit!($x, $hard, $hard)
5148 };
5149 ($x:expr, $soft:expr, $hard:expr) => {
5150 check_limit_in_range($x as u64, $soft, $hard)
5151 };
5152}
5153
5154#[macro_export]
5158macro_rules! check_limit_by_meter {
5159 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5160 let (h, metered_str) = if $is_metered {
5162 ($metered_limit, "metered")
5163 } else {
5164 ($unmetered_hard_limit, "unmetered")
5166 };
5167 use sui_protocol_config::check_limit_in_range;
5168 let result = check_limit_in_range($x as u64, $metered_limit, h);
5169 match result {
5170 LimitThresholdCrossed::None => {}
5171 LimitThresholdCrossed::Soft(_, _) => {
5172 $metric.with_label_values(&[metered_str, "soft"]).inc();
5173 }
5174 LimitThresholdCrossed::Hard(_, _) => {
5175 $metric.with_label_values(&[metered_str, "hard"]).inc();
5176 }
5177 };
5178 result
5179 }};
5180}
5181#[cfg(all(test, not(msim)))]
5182mod test {
5183 use insta::assert_yaml_snapshot;
5184
5185 use super::*;
5186
5187 #[test]
5188 fn snapshot_tests() {
5189 println!("\n============================================================================");
5190 println!("! !");
5191 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5192 println!("! !");
5193 println!("============================================================================\n");
5194 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5195 let chain_str = match chain_id {
5199 Chain::Unknown => "".to_string(),
5200 _ => format!("{:?}_", chain_id),
5201 };
5202 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5203 let cur = ProtocolVersion::new(i);
5204 assert_yaml_snapshot!(
5205 format!("{}version_{}", chain_str, cur.as_u64()),
5206 ProtocolConfig::get_for_version(cur, *chain_id)
5207 );
5208 }
5209 }
5210 }
5211
5212 #[test]
5213 fn test_getters() {
5214 let prot: ProtocolConfig =
5215 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5216 assert_eq!(
5217 prot.max_arguments(),
5218 prot.max_arguments_as_option().unwrap()
5219 );
5220 }
5221
5222 #[test]
5223 fn test_setters() {
5224 let mut prot: ProtocolConfig =
5225 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5226 prot.set_max_arguments_for_testing(123);
5227 assert_eq!(prot.max_arguments(), 123);
5228
5229 prot.set_max_arguments_from_str_for_testing("321".to_string());
5230 assert_eq!(prot.max_arguments(), 321);
5231
5232 prot.disable_max_arguments_for_testing();
5233 assert_eq!(prot.max_arguments_as_option(), None);
5234
5235 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5236 assert_eq!(prot.max_arguments(), 456);
5237 }
5238
5239 #[test]
5240 #[should_panic(expected = "unsupported version")]
5241 fn max_version_test() {
5242 let _ = ProtocolConfig::get_for_version_impl(
5245 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5246 Chain::Unknown,
5247 );
5248 }
5249
5250 #[test]
5251 fn lookup_by_string_test() {
5252 let prot: ProtocolConfig =
5253 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5254 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5256
5257 assert!(
5258 prot.lookup_attr("max_arguments".to_string())
5259 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5260 );
5261
5262 assert!(
5264 prot.lookup_attr("max_move_identifier_len".to_string())
5265 .is_none()
5266 );
5267
5268 let prot: ProtocolConfig =
5270 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5271 assert!(
5272 prot.lookup_attr("max_move_identifier_len".to_string())
5273 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5274 );
5275
5276 let prot: ProtocolConfig =
5277 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5278 assert!(
5280 prot.attr_map()
5281 .get("max_move_identifier_len")
5282 .unwrap()
5283 .is_none()
5284 );
5285 assert!(
5287 prot.attr_map().get("max_arguments").unwrap()
5288 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5289 );
5290
5291 let prot: ProtocolConfig =
5293 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5294 assert!(
5296 prot.feature_flags
5297 .lookup_attr("some random string".to_owned())
5298 .is_none()
5299 );
5300 assert!(
5301 !prot
5302 .feature_flags
5303 .attr_map()
5304 .contains_key("some random string")
5305 );
5306
5307 assert!(
5309 prot.feature_flags
5310 .lookup_attr("package_upgrades".to_owned())
5311 == Some(false)
5312 );
5313 assert!(
5314 prot.feature_flags
5315 .attr_map()
5316 .get("package_upgrades")
5317 .unwrap()
5318 == &false
5319 );
5320 let prot: ProtocolConfig =
5321 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5322 assert!(
5324 prot.feature_flags
5325 .lookup_attr("package_upgrades".to_owned())
5326 == Some(true)
5327 );
5328 assert!(
5329 prot.feature_flags
5330 .attr_map()
5331 .get("package_upgrades")
5332 .unwrap()
5333 == &true
5334 );
5335 }
5336
5337 #[test]
5338 fn limit_range_fn_test() {
5339 let low = 100u32;
5340 let high = 10000u64;
5341
5342 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5343 assert!(matches!(
5344 check_limit!(255u16, low, high),
5345 LimitThresholdCrossed::Soft(255u128, 100)
5346 ));
5347 assert!(matches!(
5353 check_limit!(2550000u64, low, high),
5354 LimitThresholdCrossed::Hard(2550000, 10000)
5355 ));
5356
5357 assert!(matches!(
5358 check_limit!(2550000u64, high, high),
5359 LimitThresholdCrossed::Hard(2550000, 10000)
5360 ));
5361
5362 assert!(matches!(
5363 check_limit!(1u8, high),
5364 LimitThresholdCrossed::None
5365 ));
5366
5367 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5368
5369 assert!(matches!(
5370 check_limit!(2550000u64, high),
5371 LimitThresholdCrossed::Hard(2550000, 10000)
5372 ));
5373 }
5374}