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 = 110;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
300pub struct ProtocolVersion(u64);
301
302impl ProtocolVersion {
303 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
308
309 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
310
311 #[cfg(not(msim))]
312 pub const MAX_ALLOWED: Self = Self::MAX;
313
314 #[cfg(msim)]
316 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
317
318 pub fn new(v: u64) -> Self {
319 Self(v)
320 }
321
322 pub const fn as_u64(&self) -> u64 {
323 self.0
324 }
325
326 pub fn max() -> Self {
329 Self::MAX
330 }
331
332 pub fn prev(self) -> Self {
333 Self(self.0.checked_sub(1).unwrap())
334 }
335}
336
337impl From<u64> for ProtocolVersion {
338 fn from(v: u64) -> Self {
339 Self::new(v)
340 }
341}
342
343impl std::ops::Sub<u64> for ProtocolVersion {
344 type Output = Self;
345 fn sub(self, rhs: u64) -> Self::Output {
346 Self::new(self.0 - rhs)
347 }
348}
349
350impl std::ops::Add<u64> for ProtocolVersion {
351 type Output = Self;
352 fn add(self, rhs: u64) -> Self::Output {
353 Self::new(self.0 + rhs)
354 }
355}
356
357#[derive(
358 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
359)]
360pub enum Chain {
361 Mainnet,
362 Testnet,
363 #[default]
364 Unknown,
365}
366
367impl Chain {
368 pub fn as_str(self) -> &'static str {
369 match self {
370 Chain::Mainnet => "mainnet",
371 Chain::Testnet => "testnet",
372 Chain::Unknown => "unknown",
373 }
374 }
375}
376
377pub struct Error(pub String);
378
379#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
382struct FeatureFlags {
383 #[serde(skip_serializing_if = "is_false")]
386 package_upgrades: bool,
387 #[serde(skip_serializing_if = "is_false")]
390 commit_root_state_digest: bool,
391 #[serde(skip_serializing_if = "is_false")]
393 advance_epoch_start_time_in_safe_mode: bool,
394 #[serde(skip_serializing_if = "is_false")]
397 loaded_child_objects_fixed: bool,
398 #[serde(skip_serializing_if = "is_false")]
401 missing_type_is_compatibility_error: bool,
402 #[serde(skip_serializing_if = "is_false")]
405 scoring_decision_with_validity_cutoff: bool,
406
407 #[serde(skip_serializing_if = "is_false")]
410 consensus_order_end_of_epoch_last: bool,
411
412 #[serde(skip_serializing_if = "is_false")]
414 disallow_adding_abilities_on_upgrade: bool,
415 #[serde(skip_serializing_if = "is_false")]
417 disable_invariant_violation_check_in_swap_loc: bool,
418 #[serde(skip_serializing_if = "is_false")]
421 advance_to_highest_supported_protocol_version: bool,
422 #[serde(skip_serializing_if = "is_false")]
424 ban_entry_init: bool,
425 #[serde(skip_serializing_if = "is_false")]
427 package_digest_hash_module: bool,
428 #[serde(skip_serializing_if = "is_false")]
430 disallow_change_struct_type_params_on_upgrade: bool,
431 #[serde(skip_serializing_if = "is_false")]
433 no_extraneous_module_bytes: bool,
434 #[serde(skip_serializing_if = "is_false")]
436 narwhal_versioned_metadata: bool,
437
438 #[serde(skip_serializing_if = "is_false")]
440 zklogin_auth: bool,
441 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
443 consensus_transaction_ordering: ConsensusTransactionOrdering,
444
445 #[serde(skip_serializing_if = "is_false")]
453 simplified_unwrap_then_delete: bool,
454 #[serde(skip_serializing_if = "is_false")]
456 upgraded_multisig_supported: bool,
457 #[serde(skip_serializing_if = "is_false")]
459 txn_base_cost_as_multiplier: bool,
460
461 #[serde(skip_serializing_if = "is_false")]
463 shared_object_deletion: bool,
464
465 #[serde(skip_serializing_if = "is_false")]
467 narwhal_new_leader_election_schedule: bool,
468
469 #[serde(skip_serializing_if = "is_empty")]
471 zklogin_supported_providers: BTreeSet<String>,
472
473 #[serde(skip_serializing_if = "is_false")]
475 loaded_child_object_format: bool,
476
477 #[serde(skip_serializing_if = "is_false")]
478 enable_jwk_consensus_updates: bool,
479
480 #[serde(skip_serializing_if = "is_false")]
481 end_of_epoch_transaction_supported: bool,
482
483 #[serde(skip_serializing_if = "is_false")]
486 simple_conservation_checks: bool,
487
488 #[serde(skip_serializing_if = "is_false")]
490 loaded_child_object_format_type: bool,
491
492 #[serde(skip_serializing_if = "is_false")]
494 receive_objects: bool,
495
496 #[serde(skip_serializing_if = "is_false")]
498 consensus_checkpoint_signature_key_includes_digest: bool,
499
500 #[serde(skip_serializing_if = "is_false")]
502 random_beacon: bool,
503
504 #[serde(skip_serializing_if = "is_false")]
506 bridge: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
509 enable_effects_v2: bool,
510
511 #[serde(skip_serializing_if = "is_false")]
513 narwhal_certificate_v2: bool,
514
515 #[serde(skip_serializing_if = "is_false")]
517 verify_legacy_zklogin_address: bool,
518
519 #[serde(skip_serializing_if = "is_false")]
521 throughput_aware_consensus_submission: bool,
522
523 #[serde(skip_serializing_if = "is_false")]
525 recompute_has_public_transfer_in_execution: bool,
526
527 #[serde(skip_serializing_if = "is_false")]
529 accept_zklogin_in_multisig: bool,
530
531 #[serde(skip_serializing_if = "is_false")]
533 accept_passkey_in_multisig: bool,
534
535 #[serde(skip_serializing_if = "is_false")]
537 validate_zklogin_public_identifier: bool,
538
539 #[serde(skip_serializing_if = "is_false")]
542 include_consensus_digest_in_prologue: bool,
543
544 #[serde(skip_serializing_if = "is_false")]
546 hardened_otw_check: bool,
547
548 #[serde(skip_serializing_if = "is_false")]
550 allow_receiving_object_id: bool,
551
552 #[serde(skip_serializing_if = "is_false")]
554 enable_poseidon: bool,
555
556 #[serde(skip_serializing_if = "is_false")]
558 enable_coin_deny_list: bool,
559
560 #[serde(skip_serializing_if = "is_false")]
562 enable_group_ops_native_functions: bool,
563
564 #[serde(skip_serializing_if = "is_false")]
566 enable_group_ops_native_function_msm: bool,
567
568 #[serde(skip_serializing_if = "is_false")]
570 enable_nitro_attestation: bool,
571
572 #[serde(skip_serializing_if = "is_false")]
574 enable_nitro_attestation_upgraded_parsing: bool,
575
576 #[serde(skip_serializing_if = "is_false")]
578 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
579
580 #[serde(skip_serializing_if = "is_false")]
582 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
583
584 #[serde(skip_serializing_if = "is_false")]
586 reject_mutable_random_on_entry_functions: bool,
587
588 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
590 per_object_congestion_control_mode: PerObjectCongestionControlMode,
591
592 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
594 consensus_choice: ConsensusChoice,
595
596 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
598 consensus_network: ConsensusNetwork,
599
600 #[serde(skip_serializing_if = "is_false")]
602 correct_gas_payment_limit_check: bool,
603
604 #[serde(skip_serializing_if = "Option::is_none")]
606 zklogin_max_epoch_upper_bound_delta: Option<u64>,
607
608 #[serde(skip_serializing_if = "is_false")]
610 mysticeti_leader_scoring_and_schedule: bool,
611
612 #[serde(skip_serializing_if = "is_false")]
614 reshare_at_same_initial_version: bool,
615
616 #[serde(skip_serializing_if = "is_false")]
618 resolve_abort_locations_to_package_id: bool,
619
620 #[serde(skip_serializing_if = "is_false")]
624 mysticeti_use_committed_subdag_digest: bool,
625
626 #[serde(skip_serializing_if = "is_false")]
628 enable_vdf: bool,
629
630 #[serde(skip_serializing_if = "is_false")]
635 record_consensus_determined_version_assignments_in_prologue: bool,
636 #[serde(skip_serializing_if = "is_false")]
637 record_consensus_determined_version_assignments_in_prologue_v2: bool,
638
639 #[serde(skip_serializing_if = "is_false")]
641 fresh_vm_on_framework_upgrade: bool,
642
643 #[serde(skip_serializing_if = "is_false")]
651 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
652
653 #[serde(skip_serializing_if = "Option::is_none")]
655 mysticeti_num_leaders_per_round: Option<usize>,
656
657 #[serde(skip_serializing_if = "is_false")]
659 soft_bundle: bool,
660
661 #[serde(skip_serializing_if = "is_false")]
663 enable_coin_deny_list_v2: bool,
664
665 #[serde(skip_serializing_if = "is_false")]
667 passkey_auth: bool,
668
669 #[serde(skip_serializing_if = "is_false")]
671 authority_capabilities_v2: bool,
672
673 #[serde(skip_serializing_if = "is_false")]
675 rethrow_serialization_type_layout_errors: bool,
676
677 #[serde(skip_serializing_if = "is_false")]
679 consensus_distributed_vote_scoring_strategy: bool,
680
681 #[serde(skip_serializing_if = "is_false")]
683 consensus_round_prober: bool,
684
685 #[serde(skip_serializing_if = "is_false")]
687 validate_identifier_inputs: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 disallow_self_identifier: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
695 mysticeti_fastpath: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
701 disable_preconsensus_locking: bool,
702
703 #[serde(skip_serializing_if = "is_false")]
705 relocate_event_module: bool,
706
707 #[serde(skip_serializing_if = "is_false")]
709 uncompressed_g1_group_elements: bool,
710
711 #[serde(skip_serializing_if = "is_false")]
712 disallow_new_modules_in_deps_only_packages: bool,
713
714 #[serde(skip_serializing_if = "is_false")]
716 consensus_smart_ancestor_selection: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 consensus_round_prober_probe_accepted_rounds: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 native_charging_v2: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
729 consensus_linearize_subdag_v2: bool,
730
731 #[serde(skip_serializing_if = "is_false")]
733 convert_type_argument_error: bool,
734
735 #[serde(skip_serializing_if = "is_false")]
737 variant_nodes: bool,
738
739 #[serde(skip_serializing_if = "is_false")]
741 consensus_zstd_compression: bool,
742
743 #[serde(skip_serializing_if = "is_false")]
745 minimize_child_object_mutations: bool,
746
747 #[serde(skip_serializing_if = "is_false")]
749 record_additional_state_digest_in_prologue: bool,
750
751 #[serde(skip_serializing_if = "is_false")]
753 move_native_context: bool,
754
755 #[serde(skip_serializing_if = "is_false")]
758 consensus_median_based_commit_timestamp: bool,
759
760 #[serde(skip_serializing_if = "is_false")]
763 normalize_ptb_arguments: bool,
764
765 #[serde(skip_serializing_if = "is_false")]
767 consensus_batched_block_sync: bool,
768
769 #[serde(skip_serializing_if = "is_false")]
771 enforce_checkpoint_timestamp_monotonicity: bool,
772
773 #[serde(skip_serializing_if = "is_false")]
775 max_ptb_value_size_v2: bool,
776
777 #[serde(skip_serializing_if = "is_false")]
779 resolve_type_input_ids_to_defining_id: bool,
780
781 #[serde(skip_serializing_if = "is_false")]
783 enable_party_transfer: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 allow_unbounded_system_objects: bool,
788
789 #[serde(skip_serializing_if = "is_false")]
791 type_tags_in_object_runtime: bool,
792
793 #[serde(skip_serializing_if = "is_false")]
795 enable_accumulators: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
799 enable_coin_reservation_obj_refs: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
804 create_root_accumulator_object: bool,
805
806 #[serde(skip_serializing_if = "is_false")]
808 enable_authenticated_event_streams: bool,
809
810 #[serde(skip_serializing_if = "is_false")]
812 enable_address_balance_gas_payments: bool,
813
814 #[serde(skip_serializing_if = "is_false")]
816 enable_multi_epoch_transaction_expiration: bool,
817
818 #[serde(skip_serializing_if = "is_false")]
820 enable_ptb_execution_v2: bool,
821
822 #[serde(skip_serializing_if = "is_false")]
824 better_adapter_type_resolution_errors: bool,
825
826 #[serde(skip_serializing_if = "is_false")]
828 record_time_estimate_processed: bool,
829
830 #[serde(skip_serializing_if = "is_false")]
832 dependency_linkage_error: bool,
833
834 #[serde(skip_serializing_if = "is_false")]
836 additional_multisig_checks: bool,
837
838 #[serde(skip_serializing_if = "is_false")]
840 ignore_execution_time_observations_after_certs_closed: bool,
841
842 #[serde(skip_serializing_if = "is_false")]
846 debug_fatal_on_move_invariant_violation: bool,
847
848 #[serde(skip_serializing_if = "is_false")]
851 allow_private_accumulator_entrypoints: bool,
852
853 #[serde(skip_serializing_if = "is_false")]
855 additional_consensus_digest_indirect_state: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 check_for_init_during_upgrade: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 per_command_shared_object_transfer_rules: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
867 include_checkpoint_artifacts_digest_in_summary: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
871 use_mfp_txns_in_load_initial_object_debts: bool,
872
873 #[serde(skip_serializing_if = "is_false")]
875 cancel_for_failed_dkg_early: bool,
876
877 #[serde(skip_serializing_if = "is_false")]
879 enable_coin_registry: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
883 abstract_size_in_object_runtime: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
887 object_runtime_charge_cache_load_gas: bool,
888
889 #[serde(skip_serializing_if = "is_false")]
891 additional_borrow_checks: bool,
892
893 #[serde(skip_serializing_if = "is_false")]
895 use_new_commit_handler: bool,
896
897 #[serde(skip_serializing_if = "is_false")]
899 better_loader_errors: bool,
900
901 #[serde(skip_serializing_if = "is_false")]
903 generate_df_type_layouts: bool,
904
905 #[serde(skip_serializing_if = "is_false")]
907 allow_references_in_ptbs: bool,
908
909 #[serde(skip_serializing_if = "is_false")]
911 enable_display_registry: bool,
912
913 #[serde(skip_serializing_if = "is_false")]
915 private_generics_verifier_v2: bool,
916
917 #[serde(skip_serializing_if = "is_false")]
919 deprecate_global_storage_ops_during_deserialization: bool,
920
921 #[serde(skip_serializing_if = "is_false")]
924 enable_non_exclusive_writes: bool,
925
926 #[serde(skip_serializing_if = "is_false")]
928 deprecate_global_storage_ops: bool,
929
930 #[serde(skip_serializing_if = "is_false")]
932 consensus_skip_gced_accept_votes: bool,
933
934 #[serde(skip_serializing_if = "is_false")]
936 include_cancelled_randomness_txns_in_prologue: bool,
937
938 #[serde(skip_serializing_if = "is_false")]
940 address_aliases: bool,
941
942 #[serde(skip_serializing_if = "is_false")]
945 fix_checkpoint_signature_mapping: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 enable_object_funds_withdraw: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 consensus_skip_gced_blocks_in_direct_finalization: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 gas_rounding_halve_digits: bool,
958
959 #[serde(skip_serializing_if = "is_false")]
961 flexible_tx_context_positions: bool,
962
963 #[serde(skip_serializing_if = "is_false")]
965 disable_entry_point_signature_check: bool,
966
967 #[serde(skip_serializing_if = "is_false")]
969 convert_withdrawal_compatibility_ptb_arguments: bool,
970
971 #[serde(skip_serializing_if = "is_false")]
973 restrict_hot_or_not_entry_functions: bool,
974
975 #[serde(skip_serializing_if = "is_false")]
977 split_checkpoints_in_consensus_handler: bool,
978
979 #[serde(skip_serializing_if = "is_false")]
981 consensus_always_accept_system_transactions: bool,
982}
983
984fn is_false(b: &bool) -> bool {
985 !b
986}
987
988fn is_empty(b: &BTreeSet<String>) -> bool {
989 b.is_empty()
990}
991
992fn is_zero(val: &u64) -> bool {
993 *val == 0
994}
995
996#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
998pub enum ConsensusTransactionOrdering {
999 #[default]
1001 None,
1002 ByGasPrice,
1004}
1005
1006impl ConsensusTransactionOrdering {
1007 pub fn is_none(&self) -> bool {
1008 matches!(self, ConsensusTransactionOrdering::None)
1009 }
1010}
1011
1012#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1013pub struct ExecutionTimeEstimateParams {
1014 pub target_utilization: u64,
1016 pub allowed_txn_cost_overage_burst_limit_us: u64,
1020
1021 pub randomness_scalar: u64,
1024
1025 pub max_estimate_us: u64,
1027
1028 pub stored_observations_num_included_checkpoints: u64,
1031
1032 pub stored_observations_limit: u64,
1034
1035 #[serde(skip_serializing_if = "is_zero")]
1038 pub stake_weighted_median_threshold: u64,
1039
1040 #[serde(skip_serializing_if = "is_false")]
1044 pub default_none_duration_for_new_keys: bool,
1045
1046 #[serde(skip_serializing_if = "Option::is_none")]
1048 pub observations_chunk_size: Option<u64>,
1049}
1050
1051#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1053pub enum PerObjectCongestionControlMode {
1054 #[default]
1055 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1061
1062impl PerObjectCongestionControlMode {
1063 pub fn is_none(&self) -> bool {
1064 matches!(self, PerObjectCongestionControlMode::None)
1065 }
1066}
1067
1068#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1070pub enum ConsensusChoice {
1071 #[default]
1072 Narwhal,
1073 SwapEachEpoch,
1074 Mysticeti,
1075}
1076
1077impl ConsensusChoice {
1078 pub fn is_narwhal(&self) -> bool {
1079 matches!(self, ConsensusChoice::Narwhal)
1080 }
1081}
1082
1083#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1085pub enum ConsensusNetwork {
1086 #[default]
1087 Anemo,
1088 Tonic,
1089}
1090
1091impl ConsensusNetwork {
1092 pub fn is_anemo(&self) -> bool {
1093 matches!(self, ConsensusNetwork::Anemo)
1094 }
1095}
1096
1097#[skip_serializing_none]
1129#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1130pub struct ProtocolConfig {
1131 pub version: ProtocolVersion,
1132
1133 feature_flags: FeatureFlags,
1134
1135 max_tx_size_bytes: Option<u64>,
1138
1139 max_input_objects: Option<u64>,
1141
1142 max_size_written_objects: Option<u64>,
1146 max_size_written_objects_system_tx: Option<u64>,
1149
1150 max_serialized_tx_effects_size_bytes: Option<u64>,
1152
1153 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1155
1156 max_gas_payment_objects: Option<u32>,
1158
1159 max_modules_in_publish: Option<u32>,
1161
1162 max_package_dependencies: Option<u32>,
1164
1165 max_arguments: Option<u32>,
1168
1169 max_type_arguments: Option<u32>,
1171
1172 max_type_argument_depth: Option<u32>,
1174
1175 max_pure_argument_size: Option<u32>,
1177
1178 max_programmable_tx_commands: Option<u32>,
1180
1181 move_binary_format_version: Option<u32>,
1184 min_move_binary_format_version: Option<u32>,
1185
1186 binary_module_handles: Option<u16>,
1188 binary_struct_handles: Option<u16>,
1189 binary_function_handles: Option<u16>,
1190 binary_function_instantiations: Option<u16>,
1191 binary_signatures: Option<u16>,
1192 binary_constant_pool: Option<u16>,
1193 binary_identifiers: Option<u16>,
1194 binary_address_identifiers: Option<u16>,
1195 binary_struct_defs: Option<u16>,
1196 binary_struct_def_instantiations: Option<u16>,
1197 binary_function_defs: Option<u16>,
1198 binary_field_handles: Option<u16>,
1199 binary_field_instantiations: Option<u16>,
1200 binary_friend_decls: Option<u16>,
1201 binary_enum_defs: Option<u16>,
1202 binary_enum_def_instantiations: Option<u16>,
1203 binary_variant_handles: Option<u16>,
1204 binary_variant_instantiation_handles: Option<u16>,
1205
1206 max_move_object_size: Option<u64>,
1208
1209 max_move_package_size: Option<u64>,
1212
1213 max_publish_or_upgrade_per_ptb: Option<u64>,
1215
1216 max_tx_gas: Option<u64>,
1218
1219 max_gas_price: Option<u64>,
1221
1222 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1225
1226 max_gas_computation_bucket: Option<u64>,
1228
1229 gas_rounding_step: Option<u64>,
1231
1232 max_loop_depth: Option<u64>,
1234
1235 max_generic_instantiation_length: Option<u64>,
1237
1238 max_function_parameters: Option<u64>,
1240
1241 max_basic_blocks: Option<u64>,
1243
1244 max_value_stack_size: Option<u64>,
1246
1247 max_type_nodes: Option<u64>,
1249
1250 max_push_size: Option<u64>,
1252
1253 max_struct_definitions: Option<u64>,
1255
1256 max_function_definitions: Option<u64>,
1258
1259 max_fields_in_struct: Option<u64>,
1261
1262 max_dependency_depth: Option<u64>,
1264
1265 max_num_event_emit: Option<u64>,
1267
1268 max_num_new_move_object_ids: Option<u64>,
1270
1271 max_num_new_move_object_ids_system_tx: Option<u64>,
1273
1274 max_num_deleted_move_object_ids: Option<u64>,
1276
1277 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1279
1280 max_num_transferred_move_object_ids: Option<u64>,
1282
1283 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1285
1286 max_event_emit_size: Option<u64>,
1288
1289 max_event_emit_size_total: Option<u64>,
1291
1292 max_move_vector_len: Option<u64>,
1294
1295 max_move_identifier_len: Option<u64>,
1297
1298 max_move_value_depth: Option<u64>,
1300
1301 max_move_enum_variants: Option<u64>,
1303
1304 max_back_edges_per_function: Option<u64>,
1306
1307 max_back_edges_per_module: Option<u64>,
1309
1310 max_verifier_meter_ticks_per_function: Option<u64>,
1312
1313 max_meter_ticks_per_module: Option<u64>,
1315
1316 max_meter_ticks_per_package: Option<u64>,
1318
1319 object_runtime_max_num_cached_objects: Option<u64>,
1323
1324 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1326
1327 object_runtime_max_num_store_entries: Option<u64>,
1329
1330 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1332
1333 base_tx_cost_fixed: Option<u64>,
1336
1337 package_publish_cost_fixed: Option<u64>,
1340
1341 base_tx_cost_per_byte: Option<u64>,
1344
1345 package_publish_cost_per_byte: Option<u64>,
1347
1348 obj_access_cost_read_per_byte: Option<u64>,
1350
1351 obj_access_cost_mutate_per_byte: Option<u64>,
1353
1354 obj_access_cost_delete_per_byte: Option<u64>,
1356
1357 obj_access_cost_verify_per_byte: Option<u64>,
1367
1368 max_type_to_layout_nodes: Option<u64>,
1370
1371 max_ptb_value_size: Option<u64>,
1373
1374 gas_model_version: Option<u64>,
1377
1378 obj_data_cost_refundable: Option<u64>,
1381
1382 obj_metadata_cost_non_refundable: Option<u64>,
1386
1387 storage_rebate_rate: Option<u64>,
1393
1394 storage_fund_reinvest_rate: Option<u64>,
1397
1398 reward_slashing_rate: Option<u64>,
1401
1402 storage_gas_price: Option<u64>,
1404
1405 accumulator_object_storage_cost: Option<u64>,
1407
1408 max_transactions_per_checkpoint: Option<u64>,
1413
1414 max_checkpoint_size_bytes: Option<u64>,
1418
1419 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1424
1425 address_from_bytes_cost_base: Option<u64>,
1430 address_to_u256_cost_base: Option<u64>,
1432 address_from_u256_cost_base: Option<u64>,
1434
1435 config_read_setting_impl_cost_base: Option<u64>,
1440 config_read_setting_impl_cost_per_byte: Option<u64>,
1441
1442 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1445 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1446 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1447 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1448 dynamic_field_add_child_object_cost_base: Option<u64>,
1450 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1451 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1452 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1453 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1455 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1456 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1457 dynamic_field_remove_child_object_cost_base: Option<u64>,
1459 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1460 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1461 dynamic_field_has_child_object_cost_base: Option<u64>,
1463 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1465 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1466 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1467
1468 event_emit_cost_base: Option<u64>,
1471 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1472 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1473 event_emit_output_cost_per_byte: Option<u64>,
1474 event_emit_auth_stream_cost: Option<u64>,
1475
1476 object_borrow_uid_cost_base: Option<u64>,
1479 object_delete_impl_cost_base: Option<u64>,
1481 object_record_new_uid_cost_base: Option<u64>,
1483
1484 transfer_transfer_internal_cost_base: Option<u64>,
1487 transfer_party_transfer_internal_cost_base: Option<u64>,
1489 transfer_freeze_object_cost_base: Option<u64>,
1491 transfer_share_object_cost_base: Option<u64>,
1493 transfer_receive_object_cost_base: Option<u64>,
1496
1497 tx_context_derive_id_cost_base: Option<u64>,
1500 tx_context_fresh_id_cost_base: Option<u64>,
1501 tx_context_sender_cost_base: Option<u64>,
1502 tx_context_epoch_cost_base: Option<u64>,
1503 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1504 tx_context_sponsor_cost_base: Option<u64>,
1505 tx_context_rgp_cost_base: Option<u64>,
1506 tx_context_gas_price_cost_base: Option<u64>,
1507 tx_context_gas_budget_cost_base: Option<u64>,
1508 tx_context_ids_created_cost_base: Option<u64>,
1509 tx_context_replace_cost_base: Option<u64>,
1510
1511 types_is_one_time_witness_cost_base: Option<u64>,
1514 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1515 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1516
1517 validator_validate_metadata_cost_base: Option<u64>,
1520 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1521
1522 crypto_invalid_arguments_cost: Option<u64>,
1524 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1526 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1527 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1528
1529 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1531 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1532 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1533
1534 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1536 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1537 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1538 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1539 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1540 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1541
1542 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1544
1545 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1547 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1548 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1549 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1550 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1551 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1552
1553 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1555 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1556 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1557 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1558 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1559 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1560
1561 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1563 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1564 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1565 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1566 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1567 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1568
1569 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1571 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1572 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1573
1574 ed25519_ed25519_verify_cost_base: Option<u64>,
1576 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1577 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1578
1579 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1581 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1582
1583 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1585 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1586 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1587 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1588 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1589
1590 hash_blake2b256_cost_base: Option<u64>,
1592 hash_blake2b256_data_cost_per_byte: Option<u64>,
1593 hash_blake2b256_data_cost_per_block: Option<u64>,
1594
1595 hash_keccak256_cost_base: Option<u64>,
1597 hash_keccak256_data_cost_per_byte: Option<u64>,
1598 hash_keccak256_data_cost_per_block: Option<u64>,
1599
1600 poseidon_bn254_cost_base: Option<u64>,
1602 poseidon_bn254_cost_per_block: Option<u64>,
1603
1604 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1606 group_ops_bls12381_decode_g1_cost: Option<u64>,
1607 group_ops_bls12381_decode_g2_cost: Option<u64>,
1608 group_ops_bls12381_decode_gt_cost: Option<u64>,
1609 group_ops_bls12381_scalar_add_cost: Option<u64>,
1610 group_ops_bls12381_g1_add_cost: Option<u64>,
1611 group_ops_bls12381_g2_add_cost: Option<u64>,
1612 group_ops_bls12381_gt_add_cost: Option<u64>,
1613 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1614 group_ops_bls12381_g1_sub_cost: Option<u64>,
1615 group_ops_bls12381_g2_sub_cost: Option<u64>,
1616 group_ops_bls12381_gt_sub_cost: Option<u64>,
1617 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1618 group_ops_bls12381_g1_mul_cost: Option<u64>,
1619 group_ops_bls12381_g2_mul_cost: Option<u64>,
1620 group_ops_bls12381_gt_mul_cost: Option<u64>,
1621 group_ops_bls12381_scalar_div_cost: Option<u64>,
1622 group_ops_bls12381_g1_div_cost: Option<u64>,
1623 group_ops_bls12381_g2_div_cost: Option<u64>,
1624 group_ops_bls12381_gt_div_cost: Option<u64>,
1625 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1626 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1627 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1628 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1629 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1630 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1631 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1632 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1633 group_ops_bls12381_msm_max_len: Option<u32>,
1634 group_ops_bls12381_pairing_cost: Option<u64>,
1635 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1636 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1637 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1638 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1639 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1640
1641 hmac_hmac_sha3_256_cost_base: Option<u64>,
1643 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1644 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1645
1646 check_zklogin_id_cost_base: Option<u64>,
1648 check_zklogin_issuer_cost_base: Option<u64>,
1650
1651 vdf_verify_vdf_cost: Option<u64>,
1652 vdf_hash_to_input_cost: Option<u64>,
1653
1654 nitro_attestation_parse_base_cost: Option<u64>,
1656 nitro_attestation_parse_cost_per_byte: Option<u64>,
1657 nitro_attestation_verify_base_cost: Option<u64>,
1658 nitro_attestation_verify_cost_per_cert: Option<u64>,
1659
1660 bcs_per_byte_serialized_cost: Option<u64>,
1662 bcs_legacy_min_output_size_cost: Option<u64>,
1663 bcs_failure_cost: Option<u64>,
1664
1665 hash_sha2_256_base_cost: Option<u64>,
1666 hash_sha2_256_per_byte_cost: Option<u64>,
1667 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1668 hash_sha3_256_base_cost: Option<u64>,
1669 hash_sha3_256_per_byte_cost: Option<u64>,
1670 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1671 type_name_get_base_cost: Option<u64>,
1672 type_name_get_per_byte_cost: Option<u64>,
1673 type_name_id_base_cost: Option<u64>,
1674
1675 string_check_utf8_base_cost: Option<u64>,
1676 string_check_utf8_per_byte_cost: Option<u64>,
1677 string_is_char_boundary_base_cost: Option<u64>,
1678 string_sub_string_base_cost: Option<u64>,
1679 string_sub_string_per_byte_cost: Option<u64>,
1680 string_index_of_base_cost: Option<u64>,
1681 string_index_of_per_byte_pattern_cost: Option<u64>,
1682 string_index_of_per_byte_searched_cost: Option<u64>,
1683
1684 vector_empty_base_cost: Option<u64>,
1685 vector_length_base_cost: Option<u64>,
1686 vector_push_back_base_cost: Option<u64>,
1687 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1688 vector_borrow_base_cost: Option<u64>,
1689 vector_pop_back_base_cost: Option<u64>,
1690 vector_destroy_empty_base_cost: Option<u64>,
1691 vector_swap_base_cost: Option<u64>,
1692 debug_print_base_cost: Option<u64>,
1693 debug_print_stack_trace_base_cost: Option<u64>,
1694
1695 execution_version: Option<u64>,
1704
1705 consensus_bad_nodes_stake_threshold: Option<u64>,
1709
1710 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1711 max_age_of_jwk_in_epochs: Option<u64>,
1715
1716 random_beacon_reduction_allowed_delta: Option<u16>,
1720
1721 random_beacon_reduction_lower_bound: Option<u32>,
1724
1725 random_beacon_dkg_timeout_round: Option<u32>,
1728
1729 random_beacon_min_round_interval_ms: Option<u64>,
1731
1732 random_beacon_dkg_version: Option<u64>,
1735
1736 consensus_max_transaction_size_bytes: Option<u64>,
1739 consensus_max_transactions_in_block_bytes: Option<u64>,
1741 consensus_max_num_transactions_in_block: Option<u64>,
1743
1744 consensus_voting_rounds: Option<u32>,
1746
1747 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1749
1750 max_deferral_rounds_for_congestion_control: Option<u64>,
1753
1754 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1756
1757 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1759
1760 min_checkpoint_interval_ms: Option<u64>,
1762
1763 checkpoint_summary_version_specific_data: Option<u64>,
1765
1766 max_soft_bundle_size: Option<u64>,
1768
1769 bridge_should_try_to_finalize_committee: Option<bool>,
1773
1774 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1780
1781 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1784
1785 consensus_gc_depth: Option<u32>,
1788
1789 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1791
1792 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1794
1795 sip_45_consensus_amplification_threshold: Option<u64>,
1798
1799 use_object_per_epoch_marker_table_v2: Option<bool>,
1802
1803 consensus_commit_rate_estimation_window_size: Option<u32>,
1805
1806 #[serde(skip_serializing_if = "Vec::is_empty")]
1810 aliased_addresses: Vec<AliasedAddress>,
1811
1812 translation_per_command_base_charge: Option<u64>,
1815
1816 translation_per_input_base_charge: Option<u64>,
1819
1820 translation_pure_input_per_byte_charge: Option<u64>,
1822
1823 translation_per_type_node_charge: Option<u64>,
1827
1828 translation_per_reference_node_charge: Option<u64>,
1831
1832 translation_per_linkage_entry_charge: Option<u64>,
1835
1836 max_updates_per_settlement_txn: Option<u32>,
1838}
1839
1840#[derive(Clone, Serialize, Deserialize, Debug)]
1842pub struct AliasedAddress {
1843 pub original: [u8; 32],
1845 pub aliased: [u8; 32],
1847 pub allowed_tx_digests: Vec<[u8; 32]>,
1849}
1850
1851impl ProtocolConfig {
1853 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1866 if self.feature_flags.package_upgrades {
1867 Ok(())
1868 } else {
1869 Err(Error(format!(
1870 "package upgrades are not supported at {:?}",
1871 self.version
1872 )))
1873 }
1874 }
1875
1876 pub fn allow_receiving_object_id(&self) -> bool {
1877 self.feature_flags.allow_receiving_object_id
1878 }
1879
1880 pub fn receiving_objects_supported(&self) -> bool {
1881 self.feature_flags.receive_objects
1882 }
1883
1884 pub fn package_upgrades_supported(&self) -> bool {
1885 self.feature_flags.package_upgrades
1886 }
1887
1888 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1889 self.feature_flags.commit_root_state_digest
1890 }
1891
1892 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1893 self.feature_flags.advance_epoch_start_time_in_safe_mode
1894 }
1895
1896 pub fn loaded_child_objects_fixed(&self) -> bool {
1897 self.feature_flags.loaded_child_objects_fixed
1898 }
1899
1900 pub fn missing_type_is_compatibility_error(&self) -> bool {
1901 self.feature_flags.missing_type_is_compatibility_error
1902 }
1903
1904 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1905 self.feature_flags.scoring_decision_with_validity_cutoff
1906 }
1907
1908 pub fn narwhal_versioned_metadata(&self) -> bool {
1909 self.feature_flags.narwhal_versioned_metadata
1910 }
1911
1912 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1913 self.feature_flags.consensus_order_end_of_epoch_last
1914 }
1915
1916 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1917 self.feature_flags.disallow_adding_abilities_on_upgrade
1918 }
1919
1920 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1921 self.feature_flags
1922 .disable_invariant_violation_check_in_swap_loc
1923 }
1924
1925 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1926 self.feature_flags
1927 .advance_to_highest_supported_protocol_version
1928 }
1929
1930 pub fn ban_entry_init(&self) -> bool {
1931 self.feature_flags.ban_entry_init
1932 }
1933
1934 pub fn package_digest_hash_module(&self) -> bool {
1935 self.feature_flags.package_digest_hash_module
1936 }
1937
1938 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1939 self.feature_flags
1940 .disallow_change_struct_type_params_on_upgrade
1941 }
1942
1943 pub fn no_extraneous_module_bytes(&self) -> bool {
1944 self.feature_flags.no_extraneous_module_bytes
1945 }
1946
1947 pub fn zklogin_auth(&self) -> bool {
1948 self.feature_flags.zklogin_auth
1949 }
1950
1951 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
1952 &self.feature_flags.zklogin_supported_providers
1953 }
1954
1955 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
1956 self.feature_flags.consensus_transaction_ordering
1957 }
1958
1959 pub fn simplified_unwrap_then_delete(&self) -> bool {
1960 self.feature_flags.simplified_unwrap_then_delete
1961 }
1962
1963 pub fn supports_upgraded_multisig(&self) -> bool {
1964 self.feature_flags.upgraded_multisig_supported
1965 }
1966
1967 pub fn txn_base_cost_as_multiplier(&self) -> bool {
1968 self.feature_flags.txn_base_cost_as_multiplier
1969 }
1970
1971 pub fn shared_object_deletion(&self) -> bool {
1972 self.feature_flags.shared_object_deletion
1973 }
1974
1975 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
1976 self.feature_flags.narwhal_new_leader_election_schedule
1977 }
1978
1979 pub fn loaded_child_object_format(&self) -> bool {
1980 self.feature_flags.loaded_child_object_format
1981 }
1982
1983 pub fn enable_jwk_consensus_updates(&self) -> bool {
1984 let ret = self.feature_flags.enable_jwk_consensus_updates;
1985 if ret {
1986 assert!(self.feature_flags.end_of_epoch_transaction_supported);
1988 }
1989 ret
1990 }
1991
1992 pub fn simple_conservation_checks(&self) -> bool {
1993 self.feature_flags.simple_conservation_checks
1994 }
1995
1996 pub fn loaded_child_object_format_type(&self) -> bool {
1997 self.feature_flags.loaded_child_object_format_type
1998 }
1999
2000 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2001 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2002 if !ret {
2003 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2005 }
2006 ret
2007 }
2008
2009 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2010 self.feature_flags
2011 .recompute_has_public_transfer_in_execution
2012 }
2013
2014 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2016 self.enable_jwk_consensus_updates()
2017 }
2018
2019 pub fn random_beacon(&self) -> bool {
2020 self.feature_flags.random_beacon
2021 }
2022
2023 pub fn dkg_version(&self) -> u64 {
2024 self.random_beacon_dkg_version.unwrap_or(1)
2026 }
2027
2028 pub fn enable_bridge(&self) -> bool {
2029 let ret = self.feature_flags.bridge;
2030 if ret {
2031 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2033 }
2034 ret
2035 }
2036
2037 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2038 if !self.enable_bridge() {
2039 return false;
2040 }
2041 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2043 }
2044
2045 pub fn enable_effects_v2(&self) -> bool {
2046 self.feature_flags.enable_effects_v2
2047 }
2048
2049 pub fn narwhal_certificate_v2(&self) -> bool {
2050 self.feature_flags.narwhal_certificate_v2
2051 }
2052
2053 pub fn verify_legacy_zklogin_address(&self) -> bool {
2054 self.feature_flags.verify_legacy_zklogin_address
2055 }
2056
2057 pub fn accept_zklogin_in_multisig(&self) -> bool {
2058 self.feature_flags.accept_zklogin_in_multisig
2059 }
2060
2061 pub fn accept_passkey_in_multisig(&self) -> bool {
2062 self.feature_flags.accept_passkey_in_multisig
2063 }
2064
2065 pub fn validate_zklogin_public_identifier(&self) -> bool {
2066 self.feature_flags.validate_zklogin_public_identifier
2067 }
2068
2069 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2070 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2071 }
2072
2073 pub fn throughput_aware_consensus_submission(&self) -> bool {
2074 self.feature_flags.throughput_aware_consensus_submission
2075 }
2076
2077 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2078 self.feature_flags.include_consensus_digest_in_prologue
2079 }
2080
2081 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2082 self.feature_flags
2083 .record_consensus_determined_version_assignments_in_prologue
2084 }
2085
2086 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2087 self.feature_flags
2088 .record_additional_state_digest_in_prologue
2089 }
2090
2091 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2092 self.feature_flags
2093 .record_consensus_determined_version_assignments_in_prologue_v2
2094 }
2095
2096 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2097 self.feature_flags
2098 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2099 }
2100
2101 pub fn hardened_otw_check(&self) -> bool {
2102 self.feature_flags.hardened_otw_check
2103 }
2104
2105 pub fn enable_poseidon(&self) -> bool {
2106 self.feature_flags.enable_poseidon
2107 }
2108
2109 pub fn enable_coin_deny_list_v1(&self) -> bool {
2110 self.feature_flags.enable_coin_deny_list
2111 }
2112
2113 pub fn enable_accumulators(&self) -> bool {
2114 self.feature_flags.enable_accumulators
2115 }
2116
2117 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2118 self.feature_flags.enable_coin_reservation_obj_refs
2119 }
2120
2121 pub fn create_root_accumulator_object(&self) -> bool {
2122 self.feature_flags.create_root_accumulator_object
2123 }
2124
2125 pub fn enable_address_balance_gas_payments(&self) -> bool {
2126 self.feature_flags.enable_address_balance_gas_payments
2127 }
2128
2129 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2130 self.feature_flags.enable_multi_epoch_transaction_expiration
2131 }
2132
2133 pub fn enable_authenticated_event_streams(&self) -> bool {
2134 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2135 }
2136
2137 pub fn enable_non_exclusive_writes(&self) -> bool {
2138 self.feature_flags.enable_non_exclusive_writes
2139 }
2140
2141 pub fn enable_coin_registry(&self) -> bool {
2142 self.feature_flags.enable_coin_registry
2143 }
2144
2145 pub fn enable_display_registry(&self) -> bool {
2146 self.feature_flags.enable_display_registry
2147 }
2148
2149 pub fn enable_coin_deny_list_v2(&self) -> bool {
2150 self.feature_flags.enable_coin_deny_list_v2
2151 }
2152
2153 pub fn enable_group_ops_native_functions(&self) -> bool {
2154 self.feature_flags.enable_group_ops_native_functions
2155 }
2156
2157 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2158 self.feature_flags.enable_group_ops_native_function_msm
2159 }
2160
2161 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2162 self.feature_flags.reject_mutable_random_on_entry_functions
2163 }
2164
2165 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2166 self.feature_flags.per_object_congestion_control_mode
2167 }
2168
2169 pub fn consensus_choice(&self) -> ConsensusChoice {
2170 self.feature_flags.consensus_choice
2171 }
2172
2173 pub fn consensus_network(&self) -> ConsensusNetwork {
2174 self.feature_flags.consensus_network
2175 }
2176
2177 pub fn correct_gas_payment_limit_check(&self) -> bool {
2178 self.feature_flags.correct_gas_payment_limit_check
2179 }
2180
2181 pub fn reshare_at_same_initial_version(&self) -> bool {
2182 self.feature_flags.reshare_at_same_initial_version
2183 }
2184
2185 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2186 self.feature_flags.resolve_abort_locations_to_package_id
2187 }
2188
2189 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2190 self.feature_flags.mysticeti_use_committed_subdag_digest
2191 }
2192
2193 pub fn enable_vdf(&self) -> bool {
2194 self.feature_flags.enable_vdf
2195 }
2196
2197 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2198 self.feature_flags.fresh_vm_on_framework_upgrade
2199 }
2200
2201 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2202 self.feature_flags.mysticeti_num_leaders_per_round
2203 }
2204
2205 pub fn soft_bundle(&self) -> bool {
2206 self.feature_flags.soft_bundle
2207 }
2208
2209 pub fn passkey_auth(&self) -> bool {
2210 self.feature_flags.passkey_auth
2211 }
2212
2213 pub fn authority_capabilities_v2(&self) -> bool {
2214 self.feature_flags.authority_capabilities_v2
2215 }
2216
2217 pub fn max_transaction_size_bytes(&self) -> u64 {
2218 self.consensus_max_transaction_size_bytes
2220 .unwrap_or(256 * 1024)
2221 }
2222
2223 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2224 if cfg!(msim) {
2225 256 * 1024
2226 } else {
2227 self.consensus_max_transactions_in_block_bytes
2228 .unwrap_or(512 * 1024)
2229 }
2230 }
2231
2232 pub fn max_num_transactions_in_block(&self) -> u64 {
2233 if cfg!(msim) {
2234 8
2235 } else {
2236 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2237 }
2238 }
2239
2240 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2241 self.feature_flags.rethrow_serialization_type_layout_errors
2242 }
2243
2244 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2245 self.feature_flags
2246 .consensus_distributed_vote_scoring_strategy
2247 }
2248
2249 pub fn consensus_round_prober(&self) -> bool {
2250 self.feature_flags.consensus_round_prober
2251 }
2252
2253 pub fn validate_identifier_inputs(&self) -> bool {
2254 self.feature_flags.validate_identifier_inputs
2255 }
2256
2257 pub fn gc_depth(&self) -> u32 {
2258 self.consensus_gc_depth.unwrap_or(0)
2259 }
2260
2261 pub fn mysticeti_fastpath(&self) -> bool {
2262 self.feature_flags.mysticeti_fastpath
2263 }
2264
2265 pub fn relocate_event_module(&self) -> bool {
2266 self.feature_flags.relocate_event_module
2267 }
2268
2269 pub fn uncompressed_g1_group_elements(&self) -> bool {
2270 self.feature_flags.uncompressed_g1_group_elements
2271 }
2272
2273 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2274 self.feature_flags
2275 .disallow_new_modules_in_deps_only_packages
2276 }
2277
2278 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2279 self.feature_flags.consensus_smart_ancestor_selection
2280 }
2281
2282 pub fn disable_preconsensus_locking(&self) -> bool {
2283 self.feature_flags.disable_preconsensus_locking
2284 }
2285
2286 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2287 self.feature_flags
2288 .consensus_round_prober_probe_accepted_rounds
2289 }
2290
2291 pub fn native_charging_v2(&self) -> bool {
2292 self.feature_flags.native_charging_v2
2293 }
2294
2295 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2296 let res = self.feature_flags.consensus_linearize_subdag_v2;
2297 assert!(
2298 !res || self.gc_depth() > 0,
2299 "The consensus linearize sub dag V2 requires GC to be enabled"
2300 );
2301 res
2302 }
2303
2304 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2305 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2306 assert!(
2307 !res || self.gc_depth() > 0,
2308 "The consensus median based commit timestamp requires GC to be enabled"
2309 );
2310 res
2311 }
2312
2313 pub fn consensus_batched_block_sync(&self) -> bool {
2314 self.feature_flags.consensus_batched_block_sync
2315 }
2316
2317 pub fn convert_type_argument_error(&self) -> bool {
2318 self.feature_flags.convert_type_argument_error
2319 }
2320
2321 pub fn variant_nodes(&self) -> bool {
2322 self.feature_flags.variant_nodes
2323 }
2324
2325 pub fn consensus_zstd_compression(&self) -> bool {
2326 self.feature_flags.consensus_zstd_compression
2327 }
2328
2329 pub fn enable_nitro_attestation(&self) -> bool {
2330 self.feature_flags.enable_nitro_attestation
2331 }
2332
2333 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2334 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2335 }
2336
2337 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2338 self.feature_flags
2339 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2340 }
2341
2342 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2343 self.feature_flags
2344 .enable_nitro_attestation_always_include_required_pcrs_parsing
2345 }
2346
2347 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2348 self.consensus_commit_rate_estimation_window_size
2349 .unwrap_or(0)
2350 }
2351
2352 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2353 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2357 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2359 window_size
2360 }
2361
2362 pub fn minimize_child_object_mutations(&self) -> bool {
2363 self.feature_flags.minimize_child_object_mutations
2364 }
2365
2366 pub fn move_native_context(&self) -> bool {
2367 self.feature_flags.move_native_context
2368 }
2369
2370 pub fn normalize_ptb_arguments(&self) -> bool {
2371 self.feature_flags.normalize_ptb_arguments
2372 }
2373
2374 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2375 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2376 }
2377
2378 pub fn max_ptb_value_size_v2(&self) -> bool {
2379 self.feature_flags.max_ptb_value_size_v2
2380 }
2381
2382 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2383 self.feature_flags.resolve_type_input_ids_to_defining_id
2384 }
2385
2386 pub fn enable_party_transfer(&self) -> bool {
2387 self.feature_flags.enable_party_transfer
2388 }
2389
2390 pub fn allow_unbounded_system_objects(&self) -> bool {
2391 self.feature_flags.allow_unbounded_system_objects
2392 }
2393
2394 pub fn type_tags_in_object_runtime(&self) -> bool {
2395 self.feature_flags.type_tags_in_object_runtime
2396 }
2397
2398 pub fn enable_ptb_execution_v2(&self) -> bool {
2399 self.feature_flags.enable_ptb_execution_v2
2400 }
2401
2402 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2403 self.feature_flags.better_adapter_type_resolution_errors
2404 }
2405
2406 pub fn record_time_estimate_processed(&self) -> bool {
2407 self.feature_flags.record_time_estimate_processed
2408 }
2409
2410 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2411 self.feature_flags
2412 .ignore_execution_time_observations_after_certs_closed
2413 }
2414
2415 pub fn dependency_linkage_error(&self) -> bool {
2416 self.feature_flags.dependency_linkage_error
2417 }
2418
2419 pub fn additional_multisig_checks(&self) -> bool {
2420 self.feature_flags.additional_multisig_checks
2421 }
2422
2423 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2424 self.feature_flags.debug_fatal_on_move_invariant_violation
2425 }
2426
2427 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2428 self.feature_flags.allow_private_accumulator_entrypoints
2429 }
2430
2431 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2432 self.feature_flags
2433 .additional_consensus_digest_indirect_state
2434 }
2435
2436 pub fn check_for_init_during_upgrade(&self) -> bool {
2437 self.feature_flags.check_for_init_during_upgrade
2438 }
2439
2440 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2441 self.feature_flags.per_command_shared_object_transfer_rules
2442 }
2443
2444 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2445 self.feature_flags
2446 .consensus_checkpoint_signature_key_includes_digest
2447 }
2448
2449 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2450 self.feature_flags
2451 .include_checkpoint_artifacts_digest_in_summary
2452 }
2453
2454 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2455 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2456 }
2457
2458 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2459 self.feature_flags.cancel_for_failed_dkg_early
2460 }
2461
2462 pub fn abstract_size_in_object_runtime(&self) -> bool {
2463 self.feature_flags.abstract_size_in_object_runtime
2464 }
2465
2466 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2467 self.feature_flags.object_runtime_charge_cache_load_gas
2468 }
2469
2470 pub fn additional_borrow_checks(&self) -> bool {
2471 self.feature_flags.additional_borrow_checks
2472 }
2473
2474 pub fn use_new_commit_handler(&self) -> bool {
2475 self.feature_flags.use_new_commit_handler
2476 }
2477
2478 pub fn better_loader_errors(&self) -> bool {
2479 self.feature_flags.better_loader_errors
2480 }
2481
2482 pub fn generate_df_type_layouts(&self) -> bool {
2483 self.feature_flags.generate_df_type_layouts
2484 }
2485
2486 pub fn allow_references_in_ptbs(&self) -> bool {
2487 self.feature_flags.allow_references_in_ptbs
2488 }
2489
2490 pub fn private_generics_verifier_v2(&self) -> bool {
2491 self.feature_flags.private_generics_verifier_v2
2492 }
2493
2494 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2495 self.feature_flags
2496 .deprecate_global_storage_ops_during_deserialization
2497 }
2498
2499 pub fn enable_observation_chunking(&self) -> bool {
2500 matches!(self.feature_flags.per_object_congestion_control_mode,
2501 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2502 if params.observations_chunk_size.is_some()
2503 )
2504 }
2505
2506 pub fn deprecate_global_storage_ops(&self) -> bool {
2507 self.feature_flags.deprecate_global_storage_ops
2508 }
2509
2510 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2511 self.feature_flags.consensus_skip_gced_accept_votes
2512 }
2513
2514 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2515 self.feature_flags
2516 .include_cancelled_randomness_txns_in_prologue
2517 }
2518
2519 pub fn address_aliases(&self) -> bool {
2520 let address_aliases = self.feature_flags.address_aliases;
2521 assert!(
2522 !address_aliases || self.mysticeti_fastpath(),
2523 "Address aliases requires Mysticeti fastpath to be enabled"
2524 );
2525 if address_aliases {
2526 assert!(
2527 self.feature_flags.disable_preconsensus_locking,
2528 "Address aliases requires CertifiedTransaction to be disabled"
2529 );
2530 }
2531 address_aliases
2532 }
2533
2534 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2535 self.feature_flags.fix_checkpoint_signature_mapping
2536 }
2537
2538 pub fn enable_object_funds_withdraw(&self) -> bool {
2539 self.feature_flags.enable_object_funds_withdraw
2540 }
2541
2542 pub fn gas_rounding_halve_digits(&self) -> bool {
2543 self.feature_flags.gas_rounding_halve_digits
2544 }
2545
2546 pub fn flexible_tx_context_positions(&self) -> bool {
2547 self.feature_flags.flexible_tx_context_positions
2548 }
2549
2550 pub fn disable_entry_point_signature_check(&self) -> bool {
2551 self.feature_flags.disable_entry_point_signature_check
2552 }
2553
2554 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2555 self.feature_flags
2556 .consensus_skip_gced_blocks_in_direct_finalization
2557 }
2558
2559 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2560 self.feature_flags
2561 .convert_withdrawal_compatibility_ptb_arguments
2562 }
2563
2564 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2565 self.feature_flags.restrict_hot_or_not_entry_functions
2566 }
2567
2568 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2569 self.feature_flags.split_checkpoints_in_consensus_handler
2570 }
2571
2572 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2573 self.feature_flags
2574 .consensus_always_accept_system_transactions
2575 }
2576}
2577
2578#[cfg(not(msim))]
2579static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2580
2581#[cfg(msim)]
2583thread_local! {
2584 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2585}
2586
2587impl ProtocolConfig {
2589 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2591 assert!(
2593 version >= ProtocolVersion::MIN,
2594 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2595 version,
2596 ProtocolVersion::MIN.0,
2597 );
2598 assert!(
2599 version <= ProtocolVersion::MAX_ALLOWED,
2600 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2601 version,
2602 ProtocolVersion::MAX_ALLOWED.0,
2603 );
2604
2605 let mut ret = Self::get_for_version_impl(version, chain);
2606 ret.version = version;
2607
2608 ret = CONFIG_OVERRIDE.with(|ovr| {
2609 if let Some(override_fn) = &*ovr.borrow() {
2610 warn!(
2611 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2612 );
2613 override_fn(version, ret)
2614 } else {
2615 ret
2616 }
2617 });
2618
2619 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2620 warn!(
2621 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2622 );
2623 let overrides: ProtocolConfigOptional =
2624 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2625 .expect("failed to parse ProtocolConfig override env variables");
2626 overrides.apply_to(&mut ret);
2627 }
2628
2629 ret
2630 }
2631
2632 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2635 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2636 let mut ret = Self::get_for_version_impl(version, chain);
2637 ret.version = version;
2638 Some(ret)
2639 } else {
2640 None
2641 }
2642 }
2643
2644 #[cfg(not(msim))]
2645 pub fn poison_get_for_min_version() {
2646 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2647 }
2648
2649 #[cfg(not(msim))]
2650 fn load_poison_get_for_min_version() -> bool {
2651 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2652 }
2653
2654 #[cfg(msim)]
2655 pub fn poison_get_for_min_version() {
2656 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2657 }
2658
2659 #[cfg(msim)]
2660 fn load_poison_get_for_min_version() -> bool {
2661 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2662 }
2663
2664 pub fn get_for_min_version() -> Self {
2667 if Self::load_poison_get_for_min_version() {
2668 panic!("get_for_min_version called on validator");
2669 }
2670 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2671 }
2672
2673 #[allow(non_snake_case)]
2683 pub fn get_for_max_version_UNSAFE() -> Self {
2684 if Self::load_poison_get_for_min_version() {
2685 panic!("get_for_max_version_UNSAFE called on validator");
2686 }
2687 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2688 }
2689
2690 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2691 #[cfg(msim)]
2692 {
2693 if version == ProtocolVersion::MAX_ALLOWED {
2695 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2696 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2697 return config;
2698 }
2699 }
2700
2701 let mut cfg = Self {
2704 version,
2706
2707 feature_flags: Default::default(),
2709
2710 max_tx_size_bytes: Some(128 * 1024),
2711 max_input_objects: Some(2048),
2713 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2714 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2715 max_gas_payment_objects: Some(256),
2716 max_modules_in_publish: Some(128),
2717 max_package_dependencies: None,
2718 max_arguments: Some(512),
2719 max_type_arguments: Some(16),
2720 max_type_argument_depth: Some(16),
2721 max_pure_argument_size: Some(16 * 1024),
2722 max_programmable_tx_commands: Some(1024),
2723 move_binary_format_version: Some(6),
2724 min_move_binary_format_version: None,
2725 binary_module_handles: None,
2726 binary_struct_handles: None,
2727 binary_function_handles: None,
2728 binary_function_instantiations: None,
2729 binary_signatures: None,
2730 binary_constant_pool: None,
2731 binary_identifiers: None,
2732 binary_address_identifiers: None,
2733 binary_struct_defs: None,
2734 binary_struct_def_instantiations: None,
2735 binary_function_defs: None,
2736 binary_field_handles: None,
2737 binary_field_instantiations: None,
2738 binary_friend_decls: None,
2739 binary_enum_defs: None,
2740 binary_enum_def_instantiations: None,
2741 binary_variant_handles: None,
2742 binary_variant_instantiation_handles: None,
2743 max_move_object_size: Some(250 * 1024),
2744 max_move_package_size: Some(100 * 1024),
2745 max_publish_or_upgrade_per_ptb: None,
2746 max_tx_gas: Some(10_000_000_000),
2747 max_gas_price: Some(100_000),
2748 max_gas_price_rgp_factor_for_aborted_transactions: None,
2749 max_gas_computation_bucket: Some(5_000_000),
2750 max_loop_depth: Some(5),
2751 max_generic_instantiation_length: Some(32),
2752 max_function_parameters: Some(128),
2753 max_basic_blocks: Some(1024),
2754 max_value_stack_size: Some(1024),
2755 max_type_nodes: Some(256),
2756 max_push_size: Some(10000),
2757 max_struct_definitions: Some(200),
2758 max_function_definitions: Some(1000),
2759 max_fields_in_struct: Some(32),
2760 max_dependency_depth: Some(100),
2761 max_num_event_emit: Some(256),
2762 max_num_new_move_object_ids: Some(2048),
2763 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2764 max_num_deleted_move_object_ids: Some(2048),
2765 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2766 max_num_transferred_move_object_ids: Some(2048),
2767 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2768 max_event_emit_size: Some(250 * 1024),
2769 max_move_vector_len: Some(256 * 1024),
2770 max_type_to_layout_nodes: None,
2771 max_ptb_value_size: None,
2772
2773 max_back_edges_per_function: Some(10_000),
2774 max_back_edges_per_module: Some(10_000),
2775 max_verifier_meter_ticks_per_function: Some(6_000_000),
2776 max_meter_ticks_per_module: Some(6_000_000),
2777 max_meter_ticks_per_package: None,
2778
2779 object_runtime_max_num_cached_objects: Some(1000),
2780 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2781 object_runtime_max_num_store_entries: Some(1000),
2782 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2783 base_tx_cost_fixed: Some(110_000),
2784 package_publish_cost_fixed: Some(1_000),
2785 base_tx_cost_per_byte: Some(0),
2786 package_publish_cost_per_byte: Some(80),
2787 obj_access_cost_read_per_byte: Some(15),
2788 obj_access_cost_mutate_per_byte: Some(40),
2789 obj_access_cost_delete_per_byte: Some(40),
2790 obj_access_cost_verify_per_byte: Some(200),
2791 obj_data_cost_refundable: Some(100),
2792 obj_metadata_cost_non_refundable: Some(50),
2793 gas_model_version: Some(1),
2794 storage_rebate_rate: Some(9900),
2795 storage_fund_reinvest_rate: Some(500),
2796 reward_slashing_rate: Some(5000),
2797 storage_gas_price: Some(1),
2798 accumulator_object_storage_cost: None,
2799 max_transactions_per_checkpoint: Some(10_000),
2800 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2801
2802 buffer_stake_for_protocol_upgrade_bps: Some(0),
2805
2806 address_from_bytes_cost_base: Some(52),
2810 address_to_u256_cost_base: Some(52),
2812 address_from_u256_cost_base: Some(52),
2814
2815 config_read_setting_impl_cost_base: None,
2818 config_read_setting_impl_cost_per_byte: None,
2819
2820 dynamic_field_hash_type_and_key_cost_base: Some(100),
2823 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2824 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2825 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2826 dynamic_field_add_child_object_cost_base: Some(100),
2828 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2829 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2830 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2831 dynamic_field_borrow_child_object_cost_base: Some(100),
2833 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2834 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2835 dynamic_field_remove_child_object_cost_base: Some(100),
2837 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2838 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2839 dynamic_field_has_child_object_cost_base: Some(100),
2841 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2843 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2844 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2845
2846 event_emit_cost_base: Some(52),
2849 event_emit_value_size_derivation_cost_per_byte: Some(2),
2850 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2851 event_emit_output_cost_per_byte: Some(10),
2852 event_emit_auth_stream_cost: None,
2853
2854 object_borrow_uid_cost_base: Some(52),
2857 object_delete_impl_cost_base: Some(52),
2859 object_record_new_uid_cost_base: Some(52),
2861
2862 transfer_transfer_internal_cost_base: Some(52),
2865 transfer_party_transfer_internal_cost_base: None,
2867 transfer_freeze_object_cost_base: Some(52),
2869 transfer_share_object_cost_base: Some(52),
2871 transfer_receive_object_cost_base: None,
2872
2873 tx_context_derive_id_cost_base: Some(52),
2876 tx_context_fresh_id_cost_base: None,
2877 tx_context_sender_cost_base: None,
2878 tx_context_epoch_cost_base: None,
2879 tx_context_epoch_timestamp_ms_cost_base: None,
2880 tx_context_sponsor_cost_base: None,
2881 tx_context_rgp_cost_base: None,
2882 tx_context_gas_price_cost_base: None,
2883 tx_context_gas_budget_cost_base: None,
2884 tx_context_ids_created_cost_base: None,
2885 tx_context_replace_cost_base: None,
2886
2887 types_is_one_time_witness_cost_base: Some(52),
2890 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2891 types_is_one_time_witness_type_cost_per_byte: Some(2),
2892
2893 validator_validate_metadata_cost_base: Some(52),
2896 validator_validate_metadata_data_cost_per_byte: Some(2),
2897
2898 crypto_invalid_arguments_cost: Some(100),
2900 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2902 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2903 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2904
2905 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2907 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2908 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2909
2910 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2912 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2913 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2914 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2915 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2916 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2917
2918 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2920
2921 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2923 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2924 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2925 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2926 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2927 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2928
2929 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2931 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2932 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2933 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
2934 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2935 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
2936
2937 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
2939 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
2940 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
2941 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
2942 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
2943 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
2944
2945 ecvrf_ecvrf_verify_cost_base: Some(52),
2947 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
2948 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
2949
2950 ed25519_ed25519_verify_cost_base: Some(52),
2952 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
2953 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
2954
2955 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
2957 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
2958
2959 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
2961 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
2962 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
2963 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
2964 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
2965
2966 hash_blake2b256_cost_base: Some(52),
2968 hash_blake2b256_data_cost_per_byte: Some(2),
2969 hash_blake2b256_data_cost_per_block: Some(2),
2970 hash_keccak256_cost_base: Some(52),
2972 hash_keccak256_data_cost_per_byte: Some(2),
2973 hash_keccak256_data_cost_per_block: Some(2),
2974
2975 poseidon_bn254_cost_base: None,
2976 poseidon_bn254_cost_per_block: None,
2977
2978 hmac_hmac_sha3_256_cost_base: Some(52),
2980 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
2981 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
2982
2983 group_ops_bls12381_decode_scalar_cost: None,
2985 group_ops_bls12381_decode_g1_cost: None,
2986 group_ops_bls12381_decode_g2_cost: None,
2987 group_ops_bls12381_decode_gt_cost: None,
2988 group_ops_bls12381_scalar_add_cost: None,
2989 group_ops_bls12381_g1_add_cost: None,
2990 group_ops_bls12381_g2_add_cost: None,
2991 group_ops_bls12381_gt_add_cost: None,
2992 group_ops_bls12381_scalar_sub_cost: None,
2993 group_ops_bls12381_g1_sub_cost: None,
2994 group_ops_bls12381_g2_sub_cost: None,
2995 group_ops_bls12381_gt_sub_cost: None,
2996 group_ops_bls12381_scalar_mul_cost: None,
2997 group_ops_bls12381_g1_mul_cost: None,
2998 group_ops_bls12381_g2_mul_cost: None,
2999 group_ops_bls12381_gt_mul_cost: None,
3000 group_ops_bls12381_scalar_div_cost: None,
3001 group_ops_bls12381_g1_div_cost: None,
3002 group_ops_bls12381_g2_div_cost: None,
3003 group_ops_bls12381_gt_div_cost: None,
3004 group_ops_bls12381_g1_hash_to_base_cost: None,
3005 group_ops_bls12381_g2_hash_to_base_cost: None,
3006 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3007 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3008 group_ops_bls12381_g1_msm_base_cost: None,
3009 group_ops_bls12381_g2_msm_base_cost: None,
3010 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3011 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3012 group_ops_bls12381_msm_max_len: None,
3013 group_ops_bls12381_pairing_cost: None,
3014 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3015 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3016 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3017 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3018 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3019
3020 check_zklogin_id_cost_base: None,
3022 check_zklogin_issuer_cost_base: None,
3024
3025 vdf_verify_vdf_cost: None,
3026 vdf_hash_to_input_cost: None,
3027
3028 nitro_attestation_parse_base_cost: None,
3030 nitro_attestation_parse_cost_per_byte: None,
3031 nitro_attestation_verify_base_cost: None,
3032 nitro_attestation_verify_cost_per_cert: None,
3033
3034 bcs_per_byte_serialized_cost: None,
3035 bcs_legacy_min_output_size_cost: None,
3036 bcs_failure_cost: None,
3037 hash_sha2_256_base_cost: None,
3038 hash_sha2_256_per_byte_cost: None,
3039 hash_sha2_256_legacy_min_input_len_cost: None,
3040 hash_sha3_256_base_cost: None,
3041 hash_sha3_256_per_byte_cost: None,
3042 hash_sha3_256_legacy_min_input_len_cost: None,
3043 type_name_get_base_cost: None,
3044 type_name_get_per_byte_cost: None,
3045 type_name_id_base_cost: None,
3046 string_check_utf8_base_cost: None,
3047 string_check_utf8_per_byte_cost: None,
3048 string_is_char_boundary_base_cost: None,
3049 string_sub_string_base_cost: None,
3050 string_sub_string_per_byte_cost: None,
3051 string_index_of_base_cost: None,
3052 string_index_of_per_byte_pattern_cost: None,
3053 string_index_of_per_byte_searched_cost: None,
3054 vector_empty_base_cost: None,
3055 vector_length_base_cost: None,
3056 vector_push_back_base_cost: None,
3057 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3058 vector_borrow_base_cost: None,
3059 vector_pop_back_base_cost: None,
3060 vector_destroy_empty_base_cost: None,
3061 vector_swap_base_cost: None,
3062 debug_print_base_cost: None,
3063 debug_print_stack_trace_base_cost: None,
3064
3065 max_size_written_objects: None,
3066 max_size_written_objects_system_tx: None,
3067
3068 max_move_identifier_len: None,
3075 max_move_value_depth: None,
3076 max_move_enum_variants: None,
3077
3078 gas_rounding_step: None,
3079
3080 execution_version: None,
3081
3082 max_event_emit_size_total: None,
3083
3084 consensus_bad_nodes_stake_threshold: None,
3085
3086 max_jwk_votes_per_validator_per_epoch: None,
3087
3088 max_age_of_jwk_in_epochs: None,
3089
3090 random_beacon_reduction_allowed_delta: None,
3091
3092 random_beacon_reduction_lower_bound: None,
3093
3094 random_beacon_dkg_timeout_round: None,
3095
3096 random_beacon_min_round_interval_ms: None,
3097
3098 random_beacon_dkg_version: None,
3099
3100 consensus_max_transaction_size_bytes: None,
3101
3102 consensus_max_transactions_in_block_bytes: None,
3103
3104 consensus_max_num_transactions_in_block: None,
3105
3106 consensus_voting_rounds: None,
3107
3108 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3109
3110 max_deferral_rounds_for_congestion_control: None,
3111
3112 max_txn_cost_overage_per_object_in_commit: None,
3113
3114 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3115
3116 min_checkpoint_interval_ms: None,
3117
3118 checkpoint_summary_version_specific_data: None,
3119
3120 max_soft_bundle_size: None,
3121
3122 bridge_should_try_to_finalize_committee: None,
3123
3124 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3125
3126 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3127
3128 consensus_gc_depth: None,
3129
3130 gas_budget_based_txn_cost_cap_factor: None,
3131
3132 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3133
3134 sip_45_consensus_amplification_threshold: None,
3135
3136 use_object_per_epoch_marker_table_v2: None,
3137
3138 consensus_commit_rate_estimation_window_size: None,
3139
3140 aliased_addresses: vec![],
3141
3142 translation_per_command_base_charge: None,
3143 translation_per_input_base_charge: None,
3144 translation_pure_input_per_byte_charge: None,
3145 translation_per_type_node_charge: None,
3146 translation_per_reference_node_charge: None,
3147 translation_per_linkage_entry_charge: None,
3148
3149 max_updates_per_settlement_txn: None,
3150 };
3153 for cur in 2..=version.0 {
3154 match cur {
3155 1 => unreachable!(),
3156 2 => {
3157 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3158 }
3159 3 => {
3160 cfg.gas_model_version = Some(2);
3162 cfg.max_tx_gas = Some(50_000_000_000);
3164 cfg.base_tx_cost_fixed = Some(2_000);
3166 cfg.storage_gas_price = Some(76);
3168 cfg.feature_flags.loaded_child_objects_fixed = true;
3169 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3172 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3175 cfg.feature_flags.package_upgrades = true;
3176 }
3177 4 => {
3182 cfg.reward_slashing_rate = Some(10000);
3184 cfg.gas_model_version = Some(3);
3186 }
3187 5 => {
3188 cfg.feature_flags.missing_type_is_compatibility_error = true;
3189 cfg.gas_model_version = Some(4);
3190 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3191 }
3195 6 => {
3196 cfg.gas_model_version = Some(5);
3197 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3198 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3199 }
3200 7 => {
3201 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3202 cfg.feature_flags
3203 .disable_invariant_violation_check_in_swap_loc = true;
3204 cfg.feature_flags.ban_entry_init = true;
3205 cfg.feature_flags.package_digest_hash_module = true;
3206 }
3207 8 => {
3208 cfg.feature_flags
3209 .disallow_change_struct_type_params_on_upgrade = true;
3210 }
3211 9 => {
3212 cfg.max_move_identifier_len = Some(128);
3214 cfg.feature_flags.no_extraneous_module_bytes = true;
3215 cfg.feature_flags
3216 .advance_to_highest_supported_protocol_version = true;
3217 }
3218 10 => {
3219 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3220 cfg.max_meter_ticks_per_module = Some(16_000_000);
3221 }
3222 11 => {
3223 cfg.max_move_value_depth = Some(128);
3224 }
3225 12 => {
3226 cfg.feature_flags.narwhal_versioned_metadata = true;
3227 if chain != Chain::Mainnet {
3228 cfg.feature_flags.commit_root_state_digest = true;
3229 }
3230
3231 if chain != Chain::Mainnet && chain != Chain::Testnet {
3232 cfg.feature_flags.zklogin_auth = true;
3233 }
3234 }
3235 13 => {}
3236 14 => {
3237 cfg.gas_rounding_step = Some(1_000);
3238 cfg.gas_model_version = Some(6);
3239 }
3240 15 => {
3241 cfg.feature_flags.consensus_transaction_ordering =
3242 ConsensusTransactionOrdering::ByGasPrice;
3243 }
3244 16 => {
3245 cfg.feature_flags.simplified_unwrap_then_delete = true;
3246 }
3247 17 => {
3248 cfg.feature_flags.upgraded_multisig_supported = true;
3249 }
3250 18 => {
3251 cfg.execution_version = Some(1);
3252 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3261 cfg.base_tx_cost_fixed = Some(1_000);
3263 }
3264 19 => {
3265 cfg.max_num_event_emit = Some(1024);
3266 cfg.max_event_emit_size_total = Some(
3269 256 * 250 * 1024, );
3271 }
3272 20 => {
3273 cfg.feature_flags.commit_root_state_digest = true;
3274
3275 if chain != Chain::Mainnet {
3276 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3277 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3278 }
3279 }
3280
3281 21 => {
3282 if chain != Chain::Mainnet {
3283 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3284 "Google".to_string(),
3285 "Facebook".to_string(),
3286 "Twitch".to_string(),
3287 ]);
3288 }
3289 }
3290 22 => {
3291 cfg.feature_flags.loaded_child_object_format = true;
3292 }
3293 23 => {
3294 cfg.feature_flags.loaded_child_object_format_type = true;
3295 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3296 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3302 }
3303 24 => {
3304 cfg.feature_flags.simple_conservation_checks = true;
3305 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3306
3307 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3308
3309 if chain != Chain::Mainnet {
3310 cfg.feature_flags.enable_jwk_consensus_updates = true;
3311 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3313 cfg.max_age_of_jwk_in_epochs = Some(1);
3314 }
3315 }
3316 25 => {
3317 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3319 "Google".to_string(),
3320 "Facebook".to_string(),
3321 "Twitch".to_string(),
3322 ]);
3323 cfg.feature_flags.zklogin_auth = true;
3324
3325 cfg.feature_flags.enable_jwk_consensus_updates = true;
3327 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3328 cfg.max_age_of_jwk_in_epochs = Some(1);
3329 }
3330 26 => {
3331 cfg.gas_model_version = Some(7);
3332 if chain != Chain::Mainnet && chain != Chain::Testnet {
3334 cfg.transfer_receive_object_cost_base = Some(52);
3335 cfg.feature_flags.receive_objects = true;
3336 }
3337 }
3338 27 => {
3339 cfg.gas_model_version = Some(8);
3340 }
3341 28 => {
3342 cfg.check_zklogin_id_cost_base = Some(200);
3344 cfg.check_zklogin_issuer_cost_base = Some(200);
3346
3347 if chain != Chain::Mainnet && chain != Chain::Testnet {
3349 cfg.feature_flags.enable_effects_v2 = true;
3350 }
3351 }
3352 29 => {
3353 cfg.feature_flags.verify_legacy_zklogin_address = true;
3354 }
3355 30 => {
3356 if chain != Chain::Mainnet {
3358 cfg.feature_flags.narwhal_certificate_v2 = true;
3359 }
3360
3361 cfg.random_beacon_reduction_allowed_delta = Some(800);
3362 if chain != Chain::Mainnet {
3364 cfg.feature_flags.enable_effects_v2 = true;
3365 }
3366
3367 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3371
3372 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3373 }
3374 31 => {
3375 cfg.execution_version = Some(2);
3376 if chain != Chain::Mainnet && chain != Chain::Testnet {
3378 cfg.feature_flags.shared_object_deletion = true;
3379 }
3380 }
3381 32 => {
3382 if chain != Chain::Mainnet {
3384 cfg.feature_flags.accept_zklogin_in_multisig = true;
3385 }
3386 if chain != Chain::Mainnet {
3388 cfg.transfer_receive_object_cost_base = Some(52);
3389 cfg.feature_flags.receive_objects = true;
3390 }
3391 if chain != Chain::Mainnet && chain != Chain::Testnet {
3393 cfg.feature_flags.random_beacon = true;
3394 cfg.random_beacon_reduction_lower_bound = Some(1600);
3395 cfg.random_beacon_dkg_timeout_round = Some(3000);
3396 cfg.random_beacon_min_round_interval_ms = Some(150);
3397 }
3398 if chain != Chain::Testnet && chain != Chain::Mainnet {
3400 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3401 }
3402
3403 cfg.feature_flags.narwhal_certificate_v2 = true;
3405 }
3406 33 => {
3407 cfg.feature_flags.hardened_otw_check = true;
3408 cfg.feature_flags.allow_receiving_object_id = true;
3409
3410 cfg.transfer_receive_object_cost_base = Some(52);
3412 cfg.feature_flags.receive_objects = true;
3413
3414 if chain != Chain::Mainnet {
3416 cfg.feature_flags.shared_object_deletion = true;
3417 }
3418
3419 cfg.feature_flags.enable_effects_v2 = true;
3420 }
3421 34 => {}
3422 35 => {
3423 if chain != Chain::Mainnet && chain != Chain::Testnet {
3425 cfg.feature_flags.enable_poseidon = true;
3426 cfg.poseidon_bn254_cost_base = Some(260);
3427 cfg.poseidon_bn254_cost_per_block = Some(10);
3428 }
3429
3430 cfg.feature_flags.enable_coin_deny_list = true;
3431 }
3432 36 => {
3433 if chain != Chain::Mainnet && chain != Chain::Testnet {
3435 cfg.feature_flags.enable_group_ops_native_functions = true;
3436 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3437 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3439 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3440 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3441 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3442 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3443 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3444 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3445 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3446 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3447 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3448 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3449 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3450 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3451 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3452 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3453 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3454 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3455 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3456 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3457 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3458 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3459 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3460 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3461 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3462 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3463 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3464 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3465 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3466 cfg.group_ops_bls12381_msm_max_len = Some(32);
3467 cfg.group_ops_bls12381_pairing_cost = Some(52);
3468 }
3469 cfg.feature_flags.shared_object_deletion = true;
3471
3472 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3474 }
3476 37 => {
3477 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3478
3479 if chain != Chain::Mainnet {
3481 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3482 }
3483 }
3484 38 => {
3485 cfg.binary_module_handles = Some(100);
3486 cfg.binary_struct_handles = Some(300);
3487 cfg.binary_function_handles = Some(1500);
3488 cfg.binary_function_instantiations = Some(750);
3489 cfg.binary_signatures = Some(1000);
3490 cfg.binary_constant_pool = Some(4000);
3494 cfg.binary_identifiers = Some(10000);
3495 cfg.binary_address_identifiers = Some(100);
3496 cfg.binary_struct_defs = Some(200);
3497 cfg.binary_struct_def_instantiations = Some(100);
3498 cfg.binary_function_defs = Some(1000);
3499 cfg.binary_field_handles = Some(500);
3500 cfg.binary_field_instantiations = Some(250);
3501 cfg.binary_friend_decls = Some(100);
3502 cfg.max_package_dependencies = Some(32);
3504 cfg.max_modules_in_publish = Some(64);
3505 cfg.execution_version = Some(3);
3507 }
3508 39 => {
3509 }
3511 40 => {}
3512 41 => {
3513 cfg.feature_flags.enable_group_ops_native_functions = true;
3515 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3517 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3518 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3519 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3520 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3521 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3522 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3523 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3524 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3525 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3526 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3527 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3528 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3529 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3530 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3531 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3532 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3533 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3534 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3535 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3536 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3537 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3538 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3539 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3540 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3541 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3542 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3543 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3544 cfg.group_ops_bls12381_msm_max_len = Some(32);
3545 cfg.group_ops_bls12381_pairing_cost = Some(52);
3546 }
3547 42 => {}
3548 43 => {
3549 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3550 cfg.max_meter_ticks_per_package = Some(16_000_000);
3551 }
3552 44 => {
3553 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3555 if chain != Chain::Mainnet {
3557 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3558 }
3559 }
3560 45 => {
3561 if chain != Chain::Testnet && chain != Chain::Mainnet {
3563 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3564 }
3565
3566 if chain != Chain::Mainnet {
3567 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3569 }
3570 cfg.min_move_binary_format_version = Some(6);
3571 cfg.feature_flags.accept_zklogin_in_multisig = true;
3572
3573 if chain != Chain::Mainnet && chain != Chain::Testnet {
3577 cfg.feature_flags.bridge = true;
3578 }
3579 }
3580 46 => {
3581 if chain != Chain::Mainnet {
3583 cfg.feature_flags.bridge = true;
3584 }
3585
3586 cfg.feature_flags.reshare_at_same_initial_version = true;
3588 }
3589 47 => {}
3590 48 => {
3591 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3593
3594 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3596
3597 if chain != Chain::Mainnet {
3599 cfg.feature_flags.random_beacon = true;
3600 cfg.random_beacon_reduction_lower_bound = Some(1600);
3601 cfg.random_beacon_dkg_timeout_round = Some(3000);
3602 cfg.random_beacon_min_round_interval_ms = Some(200);
3603 }
3604
3605 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3607 }
3608 49 => {
3609 if chain != Chain::Testnet && chain != Chain::Mainnet {
3610 cfg.move_binary_format_version = Some(7);
3611 }
3612
3613 if chain != Chain::Mainnet && chain != Chain::Testnet {
3615 cfg.feature_flags.enable_vdf = true;
3616 cfg.vdf_verify_vdf_cost = Some(1500);
3619 cfg.vdf_hash_to_input_cost = Some(100);
3620 }
3621
3622 if chain != Chain::Testnet && chain != Chain::Mainnet {
3624 cfg.feature_flags
3625 .record_consensus_determined_version_assignments_in_prologue = true;
3626 }
3627
3628 if chain != Chain::Mainnet {
3630 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3631 }
3632
3633 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3635 }
3636 50 => {
3637 if chain != Chain::Mainnet {
3639 cfg.checkpoint_summary_version_specific_data = Some(1);
3640 cfg.min_checkpoint_interval_ms = Some(200);
3641 }
3642
3643 if chain != Chain::Testnet && chain != Chain::Mainnet {
3645 cfg.feature_flags
3646 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3647 }
3648
3649 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3650
3651 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3653 }
3654 51 => {
3655 cfg.random_beacon_dkg_version = Some(1);
3656
3657 if chain != Chain::Testnet && chain != Chain::Mainnet {
3658 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3659 }
3660 }
3661 52 => {
3662 if chain != Chain::Mainnet {
3663 cfg.feature_flags.soft_bundle = true;
3664 cfg.max_soft_bundle_size = Some(5);
3665 }
3666
3667 cfg.config_read_setting_impl_cost_base = Some(100);
3668 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3669
3670 if chain != Chain::Testnet && chain != Chain::Mainnet {
3672 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3673 cfg.feature_flags.per_object_congestion_control_mode =
3674 PerObjectCongestionControlMode::TotalTxCount;
3675 }
3676
3677 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3679
3680 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3682
3683 cfg.checkpoint_summary_version_specific_data = Some(1);
3685 cfg.min_checkpoint_interval_ms = Some(200);
3686
3687 if chain != Chain::Mainnet {
3689 cfg.feature_flags
3690 .record_consensus_determined_version_assignments_in_prologue = true;
3691 cfg.feature_flags
3692 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3693 }
3694 if chain != Chain::Mainnet {
3696 cfg.move_binary_format_version = Some(7);
3697 }
3698
3699 if chain != Chain::Testnet && chain != Chain::Mainnet {
3700 cfg.feature_flags.passkey_auth = true;
3701 }
3702 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3703 }
3704 53 => {
3705 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3707
3708 cfg.feature_flags
3710 .record_consensus_determined_version_assignments_in_prologue = true;
3711 cfg.feature_flags
3712 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3713
3714 if chain == Chain::Unknown {
3715 cfg.feature_flags.authority_capabilities_v2 = true;
3716 }
3717
3718 if chain != Chain::Mainnet {
3720 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3721 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3722 cfg.feature_flags.per_object_congestion_control_mode =
3723 PerObjectCongestionControlMode::TotalTxCount;
3724 }
3725
3726 cfg.bcs_per_byte_serialized_cost = Some(2);
3728 cfg.bcs_legacy_min_output_size_cost = Some(1);
3729 cfg.bcs_failure_cost = Some(52);
3730 cfg.debug_print_base_cost = Some(52);
3731 cfg.debug_print_stack_trace_base_cost = Some(52);
3732 cfg.hash_sha2_256_base_cost = Some(52);
3733 cfg.hash_sha2_256_per_byte_cost = Some(2);
3734 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3735 cfg.hash_sha3_256_base_cost = Some(52);
3736 cfg.hash_sha3_256_per_byte_cost = Some(2);
3737 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3738 cfg.type_name_get_base_cost = Some(52);
3739 cfg.type_name_get_per_byte_cost = Some(2);
3740 cfg.string_check_utf8_base_cost = Some(52);
3741 cfg.string_check_utf8_per_byte_cost = Some(2);
3742 cfg.string_is_char_boundary_base_cost = Some(52);
3743 cfg.string_sub_string_base_cost = Some(52);
3744 cfg.string_sub_string_per_byte_cost = Some(2);
3745 cfg.string_index_of_base_cost = Some(52);
3746 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3747 cfg.string_index_of_per_byte_searched_cost = Some(2);
3748 cfg.vector_empty_base_cost = Some(52);
3749 cfg.vector_length_base_cost = Some(52);
3750 cfg.vector_push_back_base_cost = Some(52);
3751 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3752 cfg.vector_borrow_base_cost = Some(52);
3753 cfg.vector_pop_back_base_cost = Some(52);
3754 cfg.vector_destroy_empty_base_cost = Some(52);
3755 cfg.vector_swap_base_cost = Some(52);
3756 }
3757 54 => {
3758 cfg.feature_flags.random_beacon = true;
3760 cfg.random_beacon_reduction_lower_bound = Some(1000);
3761 cfg.random_beacon_dkg_timeout_round = Some(3000);
3762 cfg.random_beacon_min_round_interval_ms = Some(500);
3763
3764 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3766 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3767 cfg.feature_flags.per_object_congestion_control_mode =
3768 PerObjectCongestionControlMode::TotalTxCount;
3769
3770 cfg.feature_flags.soft_bundle = true;
3772 cfg.max_soft_bundle_size = Some(5);
3773 }
3774 55 => {
3775 cfg.move_binary_format_version = Some(7);
3777
3778 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3780 cfg.consensus_max_num_transactions_in_block = Some(512);
3783
3784 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3785 }
3786 56 => {
3787 if chain == Chain::Mainnet {
3788 cfg.feature_flags.bridge = true;
3789 }
3790 }
3791 57 => {
3792 cfg.random_beacon_reduction_lower_bound = Some(800);
3794 }
3795 58 => {
3796 if chain == Chain::Mainnet {
3797 cfg.bridge_should_try_to_finalize_committee = Some(true);
3798 }
3799
3800 if chain != Chain::Mainnet && chain != Chain::Testnet {
3801 cfg.feature_flags
3803 .consensus_distributed_vote_scoring_strategy = true;
3804 }
3805 }
3806 59 => {
3807 cfg.feature_flags.consensus_round_prober = true;
3809 }
3810 60 => {
3811 cfg.max_type_to_layout_nodes = Some(512);
3812 cfg.feature_flags.validate_identifier_inputs = true;
3813 }
3814 61 => {
3815 if chain != Chain::Mainnet {
3816 cfg.feature_flags
3818 .consensus_distributed_vote_scoring_strategy = true;
3819 }
3820 cfg.random_beacon_reduction_lower_bound = Some(700);
3822
3823 if chain != Chain::Mainnet && chain != Chain::Testnet {
3824 cfg.feature_flags.mysticeti_fastpath = true;
3826 }
3827 }
3828 62 => {
3829 cfg.feature_flags.relocate_event_module = true;
3830 }
3831 63 => {
3832 cfg.feature_flags.per_object_congestion_control_mode =
3833 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3834 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3835 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3836 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3837 }
3838 64 => {
3839 cfg.feature_flags.per_object_congestion_control_mode =
3840 PerObjectCongestionControlMode::TotalTxCount;
3841 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3842 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3843 }
3844 65 => {
3845 cfg.feature_flags
3847 .consensus_distributed_vote_scoring_strategy = true;
3848 }
3849 66 => {
3850 if chain == Chain::Mainnet {
3851 cfg.feature_flags
3853 .consensus_distributed_vote_scoring_strategy = false;
3854 }
3855 }
3856 67 => {
3857 cfg.feature_flags
3859 .consensus_distributed_vote_scoring_strategy = true;
3860 }
3861 68 => {
3862 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3863 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3864 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3865 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3866 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3867
3868 if chain != Chain::Mainnet && chain != Chain::Testnet {
3869 cfg.feature_flags.uncompressed_g1_group_elements = true;
3870 }
3871
3872 cfg.feature_flags.per_object_congestion_control_mode =
3873 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3874 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3875 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3876 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3877 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3879 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3880
3881 cfg.random_beacon_reduction_lower_bound = Some(500);
3883
3884 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3885 }
3886 69 => {
3887 cfg.consensus_voting_rounds = Some(40);
3889
3890 if chain != Chain::Mainnet && chain != Chain::Testnet {
3891 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3893 }
3894
3895 if chain != Chain::Mainnet {
3896 cfg.feature_flags.uncompressed_g1_group_elements = true;
3897 }
3898 }
3899 70 => {
3900 if chain != Chain::Mainnet {
3901 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3903 cfg.feature_flags
3905 .consensus_round_prober_probe_accepted_rounds = true;
3906 }
3907
3908 cfg.poseidon_bn254_cost_per_block = Some(388);
3909
3910 cfg.gas_model_version = Some(9);
3911 cfg.feature_flags.native_charging_v2 = true;
3912 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
3913 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
3914 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
3915 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
3916 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
3917 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
3918 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
3919 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
3920
3921 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
3923 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
3924 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
3925 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
3926
3927 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
3928 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
3929 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
3930 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
3931 Some(8213);
3932 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
3933 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
3934 Some(9484);
3935
3936 cfg.hash_keccak256_cost_base = Some(10);
3937 cfg.hash_blake2b256_cost_base = Some(10);
3938
3939 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
3941 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
3942 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
3943 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
3944
3945 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
3946 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
3947 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
3948 cfg.group_ops_bls12381_gt_add_cost = Some(188);
3949
3950 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
3951 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
3952 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
3953 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
3954
3955 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
3956 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
3957 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
3958 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
3959
3960 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
3961 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
3962 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
3963 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
3964
3965 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
3966 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
3967
3968 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
3969 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
3970 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
3971 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
3972
3973 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
3974 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
3975 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
3976 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
3977
3978 cfg.group_ops_bls12381_pairing_cost = Some(26897);
3979 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
3980
3981 cfg.validator_validate_metadata_cost_base = Some(20000);
3982 }
3983 71 => {
3984 cfg.sip_45_consensus_amplification_threshold = Some(5);
3985
3986 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
3988 }
3989 72 => {
3990 cfg.feature_flags.convert_type_argument_error = true;
3991
3992 cfg.max_tx_gas = Some(50_000_000_000_000);
3995 cfg.max_gas_price = Some(50_000_000_000);
3997
3998 cfg.feature_flags.variant_nodes = true;
3999 }
4000 73 => {
4001 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4003
4004 if chain != Chain::Mainnet && chain != Chain::Testnet {
4005 cfg.consensus_gc_depth = Some(60);
4008 }
4009
4010 if chain != Chain::Mainnet {
4011 cfg.feature_flags.consensus_zstd_compression = true;
4013 }
4014
4015 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4017 cfg.feature_flags
4019 .consensus_round_prober_probe_accepted_rounds = true;
4020
4021 cfg.feature_flags.per_object_congestion_control_mode =
4023 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4024 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4025 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4026 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4027 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4029 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4030 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4031 }
4032 74 => {
4033 if chain != Chain::Mainnet && chain != Chain::Testnet {
4035 cfg.feature_flags.enable_nitro_attestation = true;
4036 }
4037 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4038 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4039 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4040 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4041
4042 cfg.feature_flags.consensus_zstd_compression = true;
4044
4045 if chain != Chain::Mainnet && chain != Chain::Testnet {
4046 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4047 }
4048 }
4049 75 => {
4050 if chain != Chain::Mainnet {
4051 cfg.feature_flags.passkey_auth = true;
4052 }
4053 }
4054 76 => {
4055 if chain != Chain::Mainnet && chain != Chain::Testnet {
4056 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4057 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4058 }
4059 cfg.feature_flags.minimize_child_object_mutations = true;
4060
4061 if chain != Chain::Mainnet {
4062 cfg.feature_flags.accept_passkey_in_multisig = true;
4063 }
4064 }
4065 77 => {
4066 cfg.feature_flags.uncompressed_g1_group_elements = true;
4067
4068 if chain != Chain::Mainnet {
4069 cfg.consensus_gc_depth = Some(60);
4070 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4071 }
4072 }
4073 78 => {
4074 cfg.feature_flags.move_native_context = true;
4075 cfg.tx_context_fresh_id_cost_base = Some(52);
4076 cfg.tx_context_sender_cost_base = Some(30);
4077 cfg.tx_context_epoch_cost_base = Some(30);
4078 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4079 cfg.tx_context_sponsor_cost_base = Some(30);
4080 cfg.tx_context_gas_price_cost_base = Some(30);
4081 cfg.tx_context_gas_budget_cost_base = Some(30);
4082 cfg.tx_context_ids_created_cost_base = Some(30);
4083 cfg.tx_context_replace_cost_base = Some(30);
4084 cfg.gas_model_version = Some(10);
4085
4086 if chain != Chain::Mainnet {
4087 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4088 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4089
4090 cfg.feature_flags.per_object_congestion_control_mode =
4092 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4093 ExecutionTimeEstimateParams {
4094 target_utilization: 30,
4095 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4097 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4099 stored_observations_limit: u64::MAX,
4100 stake_weighted_median_threshold: 0,
4101 default_none_duration_for_new_keys: false,
4102 observations_chunk_size: None,
4103 },
4104 );
4105 }
4106 }
4107 79 => {
4108 if chain != Chain::Mainnet {
4109 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4110
4111 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4114
4115 cfg.feature_flags.consensus_batched_block_sync = true;
4116
4117 cfg.feature_flags.enable_nitro_attestation = true
4119 }
4120 cfg.feature_flags.normalize_ptb_arguments = true;
4121
4122 cfg.consensus_gc_depth = Some(60);
4123 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4124 }
4125 80 => {
4126 cfg.max_ptb_value_size = Some(1024 * 1024);
4127 }
4128 81 => {
4129 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4130 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4131 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4132 }
4133 82 => {
4134 cfg.feature_flags.max_ptb_value_size_v2 = true;
4135 }
4136 83 => {
4137 if chain == Chain::Mainnet {
4138 let aliased: [u8; 32] = Hex::decode(
4140 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4141 )
4142 .unwrap()
4143 .try_into()
4144 .unwrap();
4145
4146 cfg.aliased_addresses.push(AliasedAddress {
4148 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4149 aliased,
4150 allowed_tx_digests: vec![
4151 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4152 ],
4153 });
4154
4155 cfg.aliased_addresses.push(AliasedAddress {
4156 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4157 aliased,
4158 allowed_tx_digests: vec![
4159 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4160 ],
4161 });
4162 }
4163
4164 if chain != Chain::Mainnet {
4167 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4168 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4169
4170 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4172 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4173 cfg.feature_flags.per_object_congestion_control_mode =
4174 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4175 ExecutionTimeEstimateParams {
4176 target_utilization: 30,
4177 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4179 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4181 stored_observations_limit: u64::MAX,
4182 stake_weighted_median_threshold: 0,
4183 default_none_duration_for_new_keys: false,
4184 observations_chunk_size: None,
4185 },
4186 );
4187
4188 cfg.feature_flags.consensus_batched_block_sync = true;
4190
4191 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4194 cfg.feature_flags.enable_nitro_attestation = true;
4195 }
4196 }
4197 84 => {
4198 if chain == Chain::Mainnet {
4199 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4200 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4201
4202 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4204 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4205 cfg.feature_flags.per_object_congestion_control_mode =
4206 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4207 ExecutionTimeEstimateParams {
4208 target_utilization: 30,
4209 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4211 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4213 stored_observations_limit: u64::MAX,
4214 stake_weighted_median_threshold: 0,
4215 default_none_duration_for_new_keys: false,
4216 observations_chunk_size: None,
4217 },
4218 );
4219
4220 cfg.feature_flags.consensus_batched_block_sync = true;
4222
4223 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4226 cfg.feature_flags.enable_nitro_attestation = true;
4227 }
4228
4229 cfg.feature_flags.per_object_congestion_control_mode =
4231 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4232 ExecutionTimeEstimateParams {
4233 target_utilization: 30,
4234 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4236 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4238 stored_observations_limit: 20,
4239 stake_weighted_median_threshold: 0,
4240 default_none_duration_for_new_keys: false,
4241 observations_chunk_size: None,
4242 },
4243 );
4244 cfg.feature_flags.allow_unbounded_system_objects = true;
4245 }
4246 85 => {
4247 if chain != Chain::Mainnet && chain != Chain::Testnet {
4248 cfg.feature_flags.enable_party_transfer = true;
4249 }
4250
4251 cfg.feature_flags
4252 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4253 cfg.feature_flags.disallow_self_identifier = true;
4254 cfg.feature_flags.per_object_congestion_control_mode =
4255 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4256 ExecutionTimeEstimateParams {
4257 target_utilization: 50,
4258 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4260 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4262 stored_observations_limit: 20,
4263 stake_weighted_median_threshold: 0,
4264 default_none_duration_for_new_keys: false,
4265 observations_chunk_size: None,
4266 },
4267 );
4268 }
4269 86 => {
4270 cfg.feature_flags.type_tags_in_object_runtime = true;
4271 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4272
4273 cfg.feature_flags.per_object_congestion_control_mode =
4275 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4276 ExecutionTimeEstimateParams {
4277 target_utilization: 50,
4278 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4280 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4282 stored_observations_limit: 20,
4283 stake_weighted_median_threshold: 3334,
4284 default_none_duration_for_new_keys: false,
4285 observations_chunk_size: None,
4286 },
4287 );
4288 if chain != Chain::Mainnet {
4290 cfg.feature_flags.enable_party_transfer = true;
4291 }
4292 }
4293 87 => {
4294 if chain == Chain::Mainnet {
4295 cfg.feature_flags.record_time_estimate_processed = true;
4296 }
4297 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4298 }
4299 88 => {
4300 cfg.feature_flags.record_time_estimate_processed = true;
4301 cfg.tx_context_rgp_cost_base = Some(30);
4302 cfg.feature_flags
4303 .ignore_execution_time_observations_after_certs_closed = true;
4304
4305 cfg.feature_flags.per_object_congestion_control_mode =
4308 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4309 ExecutionTimeEstimateParams {
4310 target_utilization: 50,
4311 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4313 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4315 stored_observations_limit: 20,
4316 stake_weighted_median_threshold: 3334,
4317 default_none_duration_for_new_keys: true,
4318 observations_chunk_size: None,
4319 },
4320 );
4321 }
4322 89 => {
4323 cfg.feature_flags.dependency_linkage_error = true;
4324 cfg.feature_flags.additional_multisig_checks = true;
4325 }
4326 90 => {
4327 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4329 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4330 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4331 cfg.feature_flags.accept_passkey_in_multisig = true;
4332 cfg.feature_flags.passkey_auth = true;
4333 cfg.feature_flags.check_for_init_during_upgrade = true;
4334
4335 if chain != Chain::Mainnet {
4337 cfg.feature_flags.mysticeti_fastpath = true;
4338 }
4339 }
4340 91 => {
4341 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4342 }
4343 92 => {
4344 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4345 }
4346 93 => {
4347 cfg.feature_flags
4348 .consensus_checkpoint_signature_key_includes_digest = true;
4349 }
4350 94 => {
4351 cfg.feature_flags.per_object_congestion_control_mode =
4353 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4354 ExecutionTimeEstimateParams {
4355 target_utilization: 50,
4356 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4358 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4360 stored_observations_limit: 18,
4361 stake_weighted_median_threshold: 3334,
4362 default_none_duration_for_new_keys: true,
4363 observations_chunk_size: None,
4364 },
4365 );
4366
4367 cfg.feature_flags.enable_party_transfer = true;
4369 }
4370 95 => {
4371 cfg.type_name_id_base_cost = Some(52);
4372
4373 cfg.max_transactions_per_checkpoint = Some(20_000);
4375 }
4376 96 => {
4377 if chain != Chain::Mainnet && chain != Chain::Testnet {
4379 cfg.feature_flags
4380 .include_checkpoint_artifacts_digest_in_summary = true;
4381 }
4382 cfg.feature_flags.correct_gas_payment_limit_check = true;
4383 cfg.feature_flags.authority_capabilities_v2 = true;
4384 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4385 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4386 cfg.feature_flags.enable_coin_registry = true;
4387
4388 cfg.feature_flags.mysticeti_fastpath = true;
4390 }
4391 97 => {
4392 cfg.feature_flags.additional_borrow_checks = true;
4393 }
4394 98 => {
4395 cfg.event_emit_auth_stream_cost = Some(52);
4396 cfg.feature_flags.better_loader_errors = true;
4397 cfg.feature_flags.generate_df_type_layouts = true;
4398 }
4399 99 => {
4400 cfg.feature_flags.use_new_commit_handler = true;
4401 }
4402 100 => {
4403 cfg.feature_flags.private_generics_verifier_v2 = true;
4404 }
4405 101 => {
4406 cfg.feature_flags.create_root_accumulator_object = true;
4407 cfg.max_updates_per_settlement_txn = Some(100);
4408 if chain != Chain::Mainnet {
4409 cfg.feature_flags.enable_poseidon = true;
4410 }
4411 }
4412 102 => {
4413 cfg.feature_flags.per_object_congestion_control_mode =
4417 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4418 ExecutionTimeEstimateParams {
4419 target_utilization: 50,
4420 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4422 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4424 stored_observations_limit: 180,
4425 stake_weighted_median_threshold: 3334,
4426 default_none_duration_for_new_keys: true,
4427 observations_chunk_size: Some(18),
4428 },
4429 );
4430 cfg.feature_flags.deprecate_global_storage_ops = true;
4431 }
4432 103 => {}
4433 104 => {
4434 cfg.translation_per_command_base_charge = Some(1);
4435 cfg.translation_per_input_base_charge = Some(1);
4436 cfg.translation_pure_input_per_byte_charge = Some(1);
4437 cfg.translation_per_type_node_charge = Some(1);
4438 cfg.translation_per_reference_node_charge = Some(1);
4439 cfg.translation_per_linkage_entry_charge = Some(10);
4440 cfg.gas_model_version = Some(11);
4441 cfg.feature_flags.abstract_size_in_object_runtime = true;
4442 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4443 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4444 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4445 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4446 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4447 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4448 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4449 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4450 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4451 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4452 cfg.feature_flags.enable_ptb_execution_v2 = true;
4453
4454 cfg.poseidon_bn254_cost_base = Some(260);
4455
4456 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4457
4458 if chain != Chain::Mainnet {
4459 cfg.feature_flags
4460 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4461 }
4462
4463 cfg.feature_flags
4464 .include_cancelled_randomness_txns_in_prologue = true;
4465 }
4466 105 => {
4467 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4468 cfg.feature_flags.disable_preconsensus_locking = true;
4469
4470 if chain != Chain::Mainnet {
4471 cfg.feature_flags
4472 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4473 }
4474 }
4475 106 => {
4476 cfg.accumulator_object_storage_cost = Some(7600);
4478
4479 if chain != Chain::Mainnet && chain != Chain::Testnet {
4480 cfg.feature_flags.enable_accumulators = true;
4481 cfg.feature_flags.enable_address_balance_gas_payments = true;
4482 cfg.feature_flags.enable_authenticated_event_streams = true;
4483 cfg.feature_flags.enable_object_funds_withdraw = true;
4484 }
4485 }
4486 107 => {
4487 cfg.feature_flags
4488 .consensus_skip_gced_blocks_in_direct_finalization = true;
4489
4490 if in_integration_test() {
4492 cfg.consensus_gc_depth = Some(6);
4493 cfg.consensus_max_num_transactions_in_block = Some(8);
4494 }
4495 }
4496 108 => {
4497 cfg.feature_flags.gas_rounding_halve_digits = true;
4498 cfg.feature_flags.flexible_tx_context_positions = true;
4499 cfg.feature_flags.disable_entry_point_signature_check = true;
4500
4501 if chain != Chain::Mainnet {
4502 cfg.feature_flags.address_aliases = true;
4503
4504 cfg.feature_flags.enable_accumulators = true;
4505 cfg.feature_flags.enable_address_balance_gas_payments = true;
4506 }
4507
4508 cfg.feature_flags.enable_poseidon = true;
4509 }
4510 109 => {
4511 cfg.binary_variant_handles = Some(1024);
4512 cfg.binary_variant_instantiation_handles = Some(1024);
4513 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4514 }
4515 110 => {
4516 cfg.feature_flags
4517 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4518 cfg.feature_flags
4519 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4520 if chain != Chain::Mainnet && chain != Chain::Testnet {
4521 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4522 }
4523 cfg.feature_flags.validate_zklogin_public_identifier = true;
4524 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4525 cfg.feature_flags
4526 .consensus_always_accept_system_transactions = true;
4527 if chain != Chain::Mainnet {
4528 cfg.feature_flags.enable_object_funds_withdraw = true;
4529 }
4530 }
4531 _ => panic!("unsupported version {:?}", version),
4542 }
4543 }
4544
4545 if cfg!(msim) {
4547 }
4552
4553 cfg
4554 }
4555
4556 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4562 let (
4563 max_back_edges_per_function,
4564 max_back_edges_per_module,
4565 sanity_check_with_regex_reference_safety,
4566 ) = if let Some((
4567 max_back_edges_per_function,
4568 max_back_edges_per_module,
4569 sanity_check_with_regex_reference_safety,
4570 )) = signing_limits
4571 {
4572 (
4573 Some(max_back_edges_per_function),
4574 Some(max_back_edges_per_module),
4575 Some(sanity_check_with_regex_reference_safety),
4576 )
4577 } else {
4578 (None, None, None)
4579 };
4580
4581 let additional_borrow_checks = if signing_limits.is_some() {
4582 true
4584 } else {
4585 self.additional_borrow_checks()
4586 };
4587 let deprecate_global_storage_ops = if signing_limits.is_some() {
4588 true
4590 } else {
4591 self.deprecate_global_storage_ops()
4592 };
4593
4594 VerifierConfig {
4595 max_loop_depth: Some(self.max_loop_depth() as usize),
4596 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4597 max_function_parameters: Some(self.max_function_parameters() as usize),
4598 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4599 max_value_stack_size: self.max_value_stack_size() as usize,
4600 max_type_nodes: Some(self.max_type_nodes() as usize),
4601 max_push_size: Some(self.max_push_size() as usize),
4602 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4603 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4604 max_function_definitions: Some(self.max_function_definitions() as usize),
4605 max_data_definitions: Some(self.max_struct_definitions() as usize),
4606 max_constant_vector_len: Some(self.max_move_vector_len()),
4607 max_back_edges_per_function,
4608 max_back_edges_per_module,
4609 max_basic_blocks_in_script: None,
4610 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4612 allow_receiving_object_id: self.allow_receiving_object_id(),
4613 reject_mutable_random_on_entry_functions: self
4614 .reject_mutable_random_on_entry_functions(),
4615 bytecode_version: self.move_binary_format_version(),
4616 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4617 additional_borrow_checks,
4618 better_loader_errors: self.better_loader_errors(),
4619 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4620 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4621 .map(|limit| limit as u128),
4622 deprecate_global_storage_ops,
4623 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4624 switch_to_regex_reference_safety: false,
4625 }
4626 }
4627
4628 pub fn binary_config(
4629 &self,
4630 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4631 ) -> BinaryConfig {
4632 let deprecate_global_storage_ops =
4633 override_deprecate_global_storage_ops_during_deserialization
4634 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4635 BinaryConfig::new(
4636 self.move_binary_format_version(),
4637 self.min_move_binary_format_version_as_option()
4638 .unwrap_or(VERSION_1),
4639 self.no_extraneous_module_bytes(),
4640 deprecate_global_storage_ops,
4641 TableConfig {
4642 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4643 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4644 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4645 function_instantiations: self
4646 .binary_function_instantiations_as_option()
4647 .unwrap_or(u16::MAX),
4648 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4649 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4650 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4651 address_identifiers: self
4652 .binary_address_identifiers_as_option()
4653 .unwrap_or(u16::MAX),
4654 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4655 struct_def_instantiations: self
4656 .binary_struct_def_instantiations_as_option()
4657 .unwrap_or(u16::MAX),
4658 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4659 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4660 field_instantiations: self
4661 .binary_field_instantiations_as_option()
4662 .unwrap_or(u16::MAX),
4663 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4664 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4665 enum_def_instantiations: self
4666 .binary_enum_def_instantiations_as_option()
4667 .unwrap_or(u16::MAX),
4668 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4669 variant_instantiation_handles: self
4670 .binary_variant_instantiation_handles_as_option()
4671 .unwrap_or(u16::MAX),
4672 },
4673 )
4674 }
4675
4676 pub fn apply_overrides_for_testing(
4680 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4681 ) -> OverrideGuard {
4682 CONFIG_OVERRIDE.with(|ovr| {
4683 let mut cur = ovr.borrow_mut();
4684 assert!(cur.is_none(), "config override already present");
4685 *cur = Some(Box::new(override_fn));
4686 OverrideGuard
4687 })
4688 }
4689}
4690
4691impl ProtocolConfig {
4695 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4696 self.feature_flags
4697 .advance_to_highest_supported_protocol_version = val
4698 }
4699 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4700 self.feature_flags.commit_root_state_digest = val
4701 }
4702 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4703 self.feature_flags.zklogin_auth = val
4704 }
4705 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4706 self.feature_flags.enable_jwk_consensus_updates = val
4707 }
4708 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4709 self.feature_flags.random_beacon = val
4710 }
4711
4712 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4713 self.feature_flags.upgraded_multisig_supported = val
4714 }
4715 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4716 self.feature_flags.accept_zklogin_in_multisig = val
4717 }
4718
4719 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4720 self.feature_flags.shared_object_deletion = val;
4721 }
4722
4723 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4724 self.feature_flags.narwhal_new_leader_election_schedule = val;
4725 }
4726
4727 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4728 self.feature_flags.receive_objects = val
4729 }
4730 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4731 self.feature_flags.narwhal_certificate_v2 = val
4732 }
4733 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4734 self.feature_flags.verify_legacy_zklogin_address = val
4735 }
4736
4737 pub fn set_per_object_congestion_control_mode_for_testing(
4738 &mut self,
4739 val: PerObjectCongestionControlMode,
4740 ) {
4741 self.feature_flags.per_object_congestion_control_mode = val;
4742 }
4743
4744 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4745 self.feature_flags.consensus_choice = val;
4746 }
4747
4748 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4749 self.feature_flags.consensus_network = val;
4750 }
4751
4752 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4753 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4754 }
4755
4756 pub fn set_disable_bridge_for_testing(&mut self) {
4757 self.feature_flags.bridge = false
4758 }
4759
4760 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4761 self.feature_flags.mysticeti_num_leaders_per_round = val;
4762 }
4763
4764 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4765 self.feature_flags.soft_bundle = val;
4766 }
4767
4768 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4769 self.feature_flags.passkey_auth = val
4770 }
4771
4772 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4773 self.feature_flags.enable_party_transfer = val
4774 }
4775
4776 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4777 self.feature_flags
4778 .consensus_distributed_vote_scoring_strategy = val;
4779 }
4780
4781 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4782 self.feature_flags.consensus_round_prober = val;
4783 }
4784
4785 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4786 self.feature_flags
4787 .disallow_new_modules_in_deps_only_packages = val;
4788 }
4789
4790 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4791 self.feature_flags.correct_gas_payment_limit_check = val;
4792 }
4793
4794 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4795 self.feature_flags.address_aliases = val;
4796 }
4797
4798 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4799 self.feature_flags
4800 .consensus_round_prober_probe_accepted_rounds = val;
4801 }
4802
4803 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4804 self.feature_flags.mysticeti_fastpath = val;
4805 }
4806
4807 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4808 self.feature_flags.accept_passkey_in_multisig = val;
4809 }
4810
4811 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4812 self.feature_flags.consensus_batched_block_sync = val;
4813 }
4814
4815 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4816 self.feature_flags.record_time_estimate_processed = val;
4817 }
4818
4819 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4820 &mut self,
4821 val: bool,
4822 ) {
4823 self.feature_flags
4824 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4825 }
4826
4827 pub fn enable_accumulators_for_testing(&mut self) {
4828 self.feature_flags.enable_accumulators = true;
4829 }
4830
4831 pub fn disable_accumulators_for_testing(&mut self) {
4832 self.feature_flags.enable_accumulators = false;
4833 self.feature_flags.enable_address_balance_gas_payments = false;
4834 }
4835
4836 pub fn enable_coin_reservation_for_testing(&mut self) {
4837 self.feature_flags.enable_coin_reservation_obj_refs = true;
4838 }
4839
4840 pub fn create_root_accumulator_object_for_testing(&mut self) {
4841 self.feature_flags.create_root_accumulator_object = true;
4842 }
4843
4844 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
4845 self.feature_flags.create_root_accumulator_object = false;
4846 }
4847
4848 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
4849 self.feature_flags.enable_accumulators = true;
4850 self.feature_flags.allow_private_accumulator_entrypoints = true;
4851 self.feature_flags.enable_address_balance_gas_payments = true;
4852 }
4853
4854 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
4855 self.feature_flags.enable_address_balance_gas_payments = false;
4856 }
4857
4858 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
4859 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
4860 }
4861
4862 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
4863 self.enable_accumulators_for_testing();
4864 self.feature_flags.enable_authenticated_event_streams = true;
4865 self.feature_flags
4866 .include_checkpoint_artifacts_digest_in_summary = true;
4867 }
4868
4869 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
4870 self.feature_flags.enable_authenticated_event_streams = false;
4871 }
4872
4873 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
4874 self.feature_flags.enable_non_exclusive_writes = true;
4875 }
4876
4877 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
4878 &mut self,
4879 val: bool,
4880 ) {
4881 self.feature_flags
4882 .ignore_execution_time_observations_after_certs_closed = val;
4883 }
4884
4885 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
4886 &mut self,
4887 val: bool,
4888 ) {
4889 self.feature_flags
4890 .consensus_checkpoint_signature_key_includes_digest = val;
4891 }
4892
4893 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
4894 self.feature_flags.cancel_for_failed_dkg_early = val;
4895 }
4896
4897 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
4898 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
4899 }
4900
4901 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
4902 self.feature_flags.authority_capabilities_v2 = val;
4903 }
4904
4905 pub fn allow_references_in_ptbs_for_testing(&mut self) {
4906 self.feature_flags.allow_references_in_ptbs = true;
4907 }
4908
4909 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
4910 self.feature_flags.consensus_skip_gced_accept_votes = val;
4911 }
4912
4913 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
4914 self.feature_flags.enable_object_funds_withdraw = val;
4915 }
4916
4917 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
4918 self.feature_flags.split_checkpoints_in_consensus_handler = val;
4919 }
4920}
4921
4922type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
4923
4924thread_local! {
4925 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
4926}
4927
4928#[must_use]
4929pub struct OverrideGuard;
4930
4931impl Drop for OverrideGuard {
4932 fn drop(&mut self) {
4933 info!("restoring override fn");
4934 CONFIG_OVERRIDE.with(|ovr| {
4935 *ovr.borrow_mut() = None;
4936 });
4937 }
4938}
4939
4940#[derive(PartialEq, Eq)]
4943pub enum LimitThresholdCrossed {
4944 None,
4945 Soft(u128, u128),
4946 Hard(u128, u128),
4947}
4948
4949pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
4952 x: T,
4953 soft_limit: U,
4954 hard_limit: V,
4955) -> LimitThresholdCrossed {
4956 let x: V = x.into();
4957 let soft_limit: V = soft_limit.into();
4958
4959 debug_assert!(soft_limit <= hard_limit);
4960
4961 if x >= hard_limit {
4964 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
4965 } else if x < soft_limit {
4966 LimitThresholdCrossed::None
4967 } else {
4968 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
4969 }
4970}
4971
4972#[macro_export]
4973macro_rules! check_limit {
4974 ($x:expr, $hard:expr) => {
4975 check_limit!($x, $hard, $hard)
4976 };
4977 ($x:expr, $soft:expr, $hard:expr) => {
4978 check_limit_in_range($x as u64, $soft, $hard)
4979 };
4980}
4981
4982#[macro_export]
4986macro_rules! check_limit_by_meter {
4987 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
4988 let (h, metered_str) = if $is_metered {
4990 ($metered_limit, "metered")
4991 } else {
4992 ($unmetered_hard_limit, "unmetered")
4994 };
4995 use sui_protocol_config::check_limit_in_range;
4996 let result = check_limit_in_range($x as u64, $metered_limit, h);
4997 match result {
4998 LimitThresholdCrossed::None => {}
4999 LimitThresholdCrossed::Soft(_, _) => {
5000 $metric.with_label_values(&[metered_str, "soft"]).inc();
5001 }
5002 LimitThresholdCrossed::Hard(_, _) => {
5003 $metric.with_label_values(&[metered_str, "hard"]).inc();
5004 }
5005 };
5006 result
5007 }};
5008}
5009#[cfg(all(test, not(msim)))]
5010mod test {
5011 use insta::assert_yaml_snapshot;
5012
5013 use super::*;
5014
5015 #[test]
5016 fn snapshot_tests() {
5017 println!("\n============================================================================");
5018 println!("! !");
5019 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5020 println!("! !");
5021 println!("============================================================================\n");
5022 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5023 let chain_str = match chain_id {
5027 Chain::Unknown => "".to_string(),
5028 _ => format!("{:?}_", chain_id),
5029 };
5030 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5031 let cur = ProtocolVersion::new(i);
5032 assert_yaml_snapshot!(
5033 format!("{}version_{}", chain_str, cur.as_u64()),
5034 ProtocolConfig::get_for_version(cur, *chain_id)
5035 );
5036 }
5037 }
5038 }
5039
5040 #[test]
5041 fn test_getters() {
5042 let prot: ProtocolConfig =
5043 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5044 assert_eq!(
5045 prot.max_arguments(),
5046 prot.max_arguments_as_option().unwrap()
5047 );
5048 }
5049
5050 #[test]
5051 fn test_setters() {
5052 let mut prot: ProtocolConfig =
5053 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5054 prot.set_max_arguments_for_testing(123);
5055 assert_eq!(prot.max_arguments(), 123);
5056
5057 prot.set_max_arguments_from_str_for_testing("321".to_string());
5058 assert_eq!(prot.max_arguments(), 321);
5059
5060 prot.disable_max_arguments_for_testing();
5061 assert_eq!(prot.max_arguments_as_option(), None);
5062
5063 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5064 assert_eq!(prot.max_arguments(), 456);
5065 }
5066
5067 #[test]
5068 #[should_panic(expected = "unsupported version")]
5069 fn max_version_test() {
5070 let _ = ProtocolConfig::get_for_version_impl(
5073 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5074 Chain::Unknown,
5075 );
5076 }
5077
5078 #[test]
5079 fn lookup_by_string_test() {
5080 let prot: ProtocolConfig =
5081 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5082 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5084
5085 assert!(
5086 prot.lookup_attr("max_arguments".to_string())
5087 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5088 );
5089
5090 assert!(
5092 prot.lookup_attr("max_move_identifier_len".to_string())
5093 .is_none()
5094 );
5095
5096 let prot: ProtocolConfig =
5098 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5099 assert!(
5100 prot.lookup_attr("max_move_identifier_len".to_string())
5101 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5102 );
5103
5104 let prot: ProtocolConfig =
5105 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5106 assert!(
5108 prot.attr_map()
5109 .get("max_move_identifier_len")
5110 .unwrap()
5111 .is_none()
5112 );
5113 assert!(
5115 prot.attr_map().get("max_arguments").unwrap()
5116 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5117 );
5118
5119 let prot: ProtocolConfig =
5121 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5122 assert!(
5124 prot.feature_flags
5125 .lookup_attr("some random string".to_owned())
5126 .is_none()
5127 );
5128 assert!(
5129 !prot
5130 .feature_flags
5131 .attr_map()
5132 .contains_key("some random string")
5133 );
5134
5135 assert!(
5137 prot.feature_flags
5138 .lookup_attr("package_upgrades".to_owned())
5139 == Some(false)
5140 );
5141 assert!(
5142 prot.feature_flags
5143 .attr_map()
5144 .get("package_upgrades")
5145 .unwrap()
5146 == &false
5147 );
5148 let prot: ProtocolConfig =
5149 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5150 assert!(
5152 prot.feature_flags
5153 .lookup_attr("package_upgrades".to_owned())
5154 == Some(true)
5155 );
5156 assert!(
5157 prot.feature_flags
5158 .attr_map()
5159 .get("package_upgrades")
5160 .unwrap()
5161 == &true
5162 );
5163 }
5164
5165 #[test]
5166 fn limit_range_fn_test() {
5167 let low = 100u32;
5168 let high = 10000u64;
5169
5170 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5171 assert!(matches!(
5172 check_limit!(255u16, low, high),
5173 LimitThresholdCrossed::Soft(255u128, 100)
5174 ));
5175 assert!(matches!(
5181 check_limit!(2550000u64, low, high),
5182 LimitThresholdCrossed::Hard(2550000, 10000)
5183 ));
5184
5185 assert!(matches!(
5186 check_limit!(2550000u64, high, high),
5187 LimitThresholdCrossed::Hard(2550000, 10000)
5188 ));
5189
5190 assert!(matches!(
5191 check_limit!(1u8, high),
5192 LimitThresholdCrossed::None
5193 ));
5194
5195 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5196
5197 assert!(matches!(
5198 check_limit!(2550000u64, high),
5199 LimitThresholdCrossed::Hard(2550000, 10000)
5200 ));
5201 }
5202}