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 = 109;
28
29#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
297pub struct ProtocolVersion(u64);
298
299impl ProtocolVersion {
300 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
305
306 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
307
308 #[cfg(not(msim))]
309 pub const MAX_ALLOWED: Self = Self::MAX;
310
311 #[cfg(msim)]
313 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
314
315 pub fn new(v: u64) -> Self {
316 Self(v)
317 }
318
319 pub const fn as_u64(&self) -> u64 {
320 self.0
321 }
322
323 pub fn max() -> Self {
326 Self::MAX
327 }
328
329 pub fn prev(self) -> Self {
330 Self(self.0.checked_sub(1).unwrap())
331 }
332}
333
334impl From<u64> for ProtocolVersion {
335 fn from(v: u64) -> Self {
336 Self::new(v)
337 }
338}
339
340impl std::ops::Sub<u64> for ProtocolVersion {
341 type Output = Self;
342 fn sub(self, rhs: u64) -> Self::Output {
343 Self::new(self.0 - rhs)
344 }
345}
346
347impl std::ops::Add<u64> for ProtocolVersion {
348 type Output = Self;
349 fn add(self, rhs: u64) -> Self::Output {
350 Self::new(self.0 + rhs)
351 }
352}
353
354#[derive(
355 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
356)]
357pub enum Chain {
358 Mainnet,
359 Testnet,
360 #[default]
361 Unknown,
362}
363
364impl Chain {
365 pub fn as_str(self) -> &'static str {
366 match self {
367 Chain::Mainnet => "mainnet",
368 Chain::Testnet => "testnet",
369 Chain::Unknown => "unknown",
370 }
371 }
372}
373
374pub struct Error(pub String);
375
376#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
379struct FeatureFlags {
380 #[serde(skip_serializing_if = "is_false")]
383 package_upgrades: bool,
384 #[serde(skip_serializing_if = "is_false")]
387 commit_root_state_digest: bool,
388 #[serde(skip_serializing_if = "is_false")]
390 advance_epoch_start_time_in_safe_mode: bool,
391 #[serde(skip_serializing_if = "is_false")]
394 loaded_child_objects_fixed: bool,
395 #[serde(skip_serializing_if = "is_false")]
398 missing_type_is_compatibility_error: bool,
399 #[serde(skip_serializing_if = "is_false")]
402 scoring_decision_with_validity_cutoff: bool,
403
404 #[serde(skip_serializing_if = "is_false")]
407 consensus_order_end_of_epoch_last: bool,
408
409 #[serde(skip_serializing_if = "is_false")]
411 disallow_adding_abilities_on_upgrade: bool,
412 #[serde(skip_serializing_if = "is_false")]
414 disable_invariant_violation_check_in_swap_loc: bool,
415 #[serde(skip_serializing_if = "is_false")]
418 advance_to_highest_supported_protocol_version: bool,
419 #[serde(skip_serializing_if = "is_false")]
421 ban_entry_init: bool,
422 #[serde(skip_serializing_if = "is_false")]
424 package_digest_hash_module: bool,
425 #[serde(skip_serializing_if = "is_false")]
427 disallow_change_struct_type_params_on_upgrade: bool,
428 #[serde(skip_serializing_if = "is_false")]
430 no_extraneous_module_bytes: bool,
431 #[serde(skip_serializing_if = "is_false")]
433 narwhal_versioned_metadata: bool,
434
435 #[serde(skip_serializing_if = "is_false")]
437 zklogin_auth: bool,
438 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
440 consensus_transaction_ordering: ConsensusTransactionOrdering,
441
442 #[serde(skip_serializing_if = "is_false")]
450 simplified_unwrap_then_delete: bool,
451 #[serde(skip_serializing_if = "is_false")]
453 upgraded_multisig_supported: bool,
454 #[serde(skip_serializing_if = "is_false")]
456 txn_base_cost_as_multiplier: bool,
457
458 #[serde(skip_serializing_if = "is_false")]
460 shared_object_deletion: bool,
461
462 #[serde(skip_serializing_if = "is_false")]
464 narwhal_new_leader_election_schedule: bool,
465
466 #[serde(skip_serializing_if = "is_empty")]
468 zklogin_supported_providers: BTreeSet<String>,
469
470 #[serde(skip_serializing_if = "is_false")]
472 loaded_child_object_format: bool,
473
474 #[serde(skip_serializing_if = "is_false")]
475 enable_jwk_consensus_updates: bool,
476
477 #[serde(skip_serializing_if = "is_false")]
478 end_of_epoch_transaction_supported: bool,
479
480 #[serde(skip_serializing_if = "is_false")]
483 simple_conservation_checks: bool,
484
485 #[serde(skip_serializing_if = "is_false")]
487 loaded_child_object_format_type: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
491 receive_objects: bool,
492
493 #[serde(skip_serializing_if = "is_false")]
495 consensus_checkpoint_signature_key_includes_digest: bool,
496
497 #[serde(skip_serializing_if = "is_false")]
499 random_beacon: bool,
500
501 #[serde(skip_serializing_if = "is_false")]
503 bridge: bool,
504
505 #[serde(skip_serializing_if = "is_false")]
506 enable_effects_v2: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
510 narwhal_certificate_v2: bool,
511
512 #[serde(skip_serializing_if = "is_false")]
514 verify_legacy_zklogin_address: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 throughput_aware_consensus_submission: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 recompute_has_public_transfer_in_execution: bool,
523
524 #[serde(skip_serializing_if = "is_false")]
526 accept_zklogin_in_multisig: bool,
527
528 #[serde(skip_serializing_if = "is_false")]
530 accept_passkey_in_multisig: bool,
531
532 #[serde(skip_serializing_if = "is_false")]
535 include_consensus_digest_in_prologue: bool,
536
537 #[serde(skip_serializing_if = "is_false")]
539 hardened_otw_check: bool,
540
541 #[serde(skip_serializing_if = "is_false")]
543 allow_receiving_object_id: bool,
544
545 #[serde(skip_serializing_if = "is_false")]
547 enable_poseidon: bool,
548
549 #[serde(skip_serializing_if = "is_false")]
551 enable_coin_deny_list: bool,
552
553 #[serde(skip_serializing_if = "is_false")]
555 enable_group_ops_native_functions: bool,
556
557 #[serde(skip_serializing_if = "is_false")]
559 enable_group_ops_native_function_msm: bool,
560
561 #[serde(skip_serializing_if = "is_false")]
563 enable_nitro_attestation: bool,
564
565 #[serde(skip_serializing_if = "is_false")]
567 enable_nitro_attestation_upgraded_parsing: bool,
568
569 #[serde(skip_serializing_if = "is_false")]
571 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
572
573 #[serde(skip_serializing_if = "is_false")]
575 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
576
577 #[serde(skip_serializing_if = "is_false")]
579 reject_mutable_random_on_entry_functions: bool,
580
581 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
583 per_object_congestion_control_mode: PerObjectCongestionControlMode,
584
585 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
587 consensus_choice: ConsensusChoice,
588
589 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
591 consensus_network: ConsensusNetwork,
592
593 #[serde(skip_serializing_if = "is_false")]
595 correct_gas_payment_limit_check: bool,
596
597 #[serde(skip_serializing_if = "Option::is_none")]
599 zklogin_max_epoch_upper_bound_delta: Option<u64>,
600
601 #[serde(skip_serializing_if = "is_false")]
603 mysticeti_leader_scoring_and_schedule: bool,
604
605 #[serde(skip_serializing_if = "is_false")]
607 reshare_at_same_initial_version: bool,
608
609 #[serde(skip_serializing_if = "is_false")]
611 resolve_abort_locations_to_package_id: bool,
612
613 #[serde(skip_serializing_if = "is_false")]
617 mysticeti_use_committed_subdag_digest: bool,
618
619 #[serde(skip_serializing_if = "is_false")]
621 enable_vdf: bool,
622
623 #[serde(skip_serializing_if = "is_false")]
628 record_consensus_determined_version_assignments_in_prologue: bool,
629 #[serde(skip_serializing_if = "is_false")]
630 record_consensus_determined_version_assignments_in_prologue_v2: bool,
631
632 #[serde(skip_serializing_if = "is_false")]
634 fresh_vm_on_framework_upgrade: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
644 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
645
646 #[serde(skip_serializing_if = "Option::is_none")]
648 mysticeti_num_leaders_per_round: Option<usize>,
649
650 #[serde(skip_serializing_if = "is_false")]
652 soft_bundle: bool,
653
654 #[serde(skip_serializing_if = "is_false")]
656 enable_coin_deny_list_v2: bool,
657
658 #[serde(skip_serializing_if = "is_false")]
660 passkey_auth: bool,
661
662 #[serde(skip_serializing_if = "is_false")]
664 authority_capabilities_v2: bool,
665
666 #[serde(skip_serializing_if = "is_false")]
668 rethrow_serialization_type_layout_errors: bool,
669
670 #[serde(skip_serializing_if = "is_false")]
672 consensus_distributed_vote_scoring_strategy: bool,
673
674 #[serde(skip_serializing_if = "is_false")]
676 consensus_round_prober: bool,
677
678 #[serde(skip_serializing_if = "is_false")]
680 validate_identifier_inputs: bool,
681
682 #[serde(skip_serializing_if = "is_false")]
684 disallow_self_identifier: bool,
685
686 #[serde(skip_serializing_if = "is_false")]
688 mysticeti_fastpath: bool,
689
690 #[serde(skip_serializing_if = "is_false")]
694 disable_preconsensus_locking: bool,
695
696 #[serde(skip_serializing_if = "is_false")]
698 relocate_event_module: bool,
699
700 #[serde(skip_serializing_if = "is_false")]
702 uncompressed_g1_group_elements: bool,
703
704 #[serde(skip_serializing_if = "is_false")]
705 disallow_new_modules_in_deps_only_packages: bool,
706
707 #[serde(skip_serializing_if = "is_false")]
709 consensus_smart_ancestor_selection: bool,
710
711 #[serde(skip_serializing_if = "is_false")]
713 consensus_round_prober_probe_accepted_rounds: bool,
714
715 #[serde(skip_serializing_if = "is_false")]
717 native_charging_v2: bool,
718
719 #[serde(skip_serializing_if = "is_false")]
722 consensus_linearize_subdag_v2: bool,
723
724 #[serde(skip_serializing_if = "is_false")]
726 convert_type_argument_error: bool,
727
728 #[serde(skip_serializing_if = "is_false")]
730 variant_nodes: bool,
731
732 #[serde(skip_serializing_if = "is_false")]
734 consensus_zstd_compression: bool,
735
736 #[serde(skip_serializing_if = "is_false")]
738 minimize_child_object_mutations: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 record_additional_state_digest_in_prologue: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 move_native_context: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
751 consensus_median_based_commit_timestamp: bool,
752
753 #[serde(skip_serializing_if = "is_false")]
756 normalize_ptb_arguments: bool,
757
758 #[serde(skip_serializing_if = "is_false")]
760 consensus_batched_block_sync: bool,
761
762 #[serde(skip_serializing_if = "is_false")]
764 enforce_checkpoint_timestamp_monotonicity: bool,
765
766 #[serde(skip_serializing_if = "is_false")]
768 max_ptb_value_size_v2: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
772 resolve_type_input_ids_to_defining_id: bool,
773
774 #[serde(skip_serializing_if = "is_false")]
776 enable_party_transfer: bool,
777
778 #[serde(skip_serializing_if = "is_false")]
780 allow_unbounded_system_objects: bool,
781
782 #[serde(skip_serializing_if = "is_false")]
784 type_tags_in_object_runtime: bool,
785
786 #[serde(skip_serializing_if = "is_false")]
788 enable_accumulators: bool,
789
790 #[serde(skip_serializing_if = "is_false")]
792 enable_coin_reservation_obj_refs: bool,
793
794 #[serde(skip_serializing_if = "is_false")]
797 create_root_accumulator_object: bool,
798
799 #[serde(skip_serializing_if = "is_false")]
801 enable_authenticated_event_streams: bool,
802
803 #[serde(skip_serializing_if = "is_false")]
805 enable_address_balance_gas_payments: bool,
806
807 #[serde(skip_serializing_if = "is_false")]
809 enable_multi_epoch_transaction_expiration: bool,
810
811 #[serde(skip_serializing_if = "is_false")]
813 enable_ptb_execution_v2: bool,
814
815 #[serde(skip_serializing_if = "is_false")]
817 better_adapter_type_resolution_errors: bool,
818
819 #[serde(skip_serializing_if = "is_false")]
821 record_time_estimate_processed: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
825 dependency_linkage_error: bool,
826
827 #[serde(skip_serializing_if = "is_false")]
829 additional_multisig_checks: bool,
830
831 #[serde(skip_serializing_if = "is_false")]
833 ignore_execution_time_observations_after_certs_closed: bool,
834
835 #[serde(skip_serializing_if = "is_false")]
839 debug_fatal_on_move_invariant_violation: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
844 allow_private_accumulator_entrypoints: bool,
845
846 #[serde(skip_serializing_if = "is_false")]
848 additional_consensus_digest_indirect_state: bool,
849
850 #[serde(skip_serializing_if = "is_false")]
852 check_for_init_during_upgrade: bool,
853
854 #[serde(skip_serializing_if = "is_false")]
856 per_command_shared_object_transfer_rules: bool,
857
858 #[serde(skip_serializing_if = "is_false")]
860 include_checkpoint_artifacts_digest_in_summary: bool,
861
862 #[serde(skip_serializing_if = "is_false")]
864 use_mfp_txns_in_load_initial_object_debts: bool,
865
866 #[serde(skip_serializing_if = "is_false")]
868 cancel_for_failed_dkg_early: bool,
869
870 #[serde(skip_serializing_if = "is_false")]
872 enable_coin_registry: bool,
873
874 #[serde(skip_serializing_if = "is_false")]
876 abstract_size_in_object_runtime: bool,
877
878 #[serde(skip_serializing_if = "is_false")]
880 object_runtime_charge_cache_load_gas: bool,
881
882 #[serde(skip_serializing_if = "is_false")]
884 additional_borrow_checks: bool,
885
886 #[serde(skip_serializing_if = "is_false")]
888 use_new_commit_handler: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
892 better_loader_errors: bool,
893
894 #[serde(skip_serializing_if = "is_false")]
896 generate_df_type_layouts: bool,
897
898 #[serde(skip_serializing_if = "is_false")]
900 allow_references_in_ptbs: bool,
901
902 #[serde(skip_serializing_if = "is_false")]
904 enable_display_registry: bool,
905
906 #[serde(skip_serializing_if = "is_false")]
908 private_generics_verifier_v2: bool,
909
910 #[serde(skip_serializing_if = "is_false")]
912 deprecate_global_storage_ops_during_deserialization: bool,
913
914 #[serde(skip_serializing_if = "is_false")]
917 enable_non_exclusive_writes: bool,
918
919 #[serde(skip_serializing_if = "is_false")]
921 deprecate_global_storage_ops: bool,
922
923 #[serde(skip_serializing_if = "is_false")]
925 consensus_skip_gced_accept_votes: bool,
926
927 #[serde(skip_serializing_if = "is_false")]
929 include_cancelled_randomness_txns_in_prologue: bool,
930
931 #[serde(skip_serializing_if = "is_false")]
933 address_aliases: bool,
934
935 #[serde(skip_serializing_if = "is_false")]
937 enable_object_funds_withdraw: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 consensus_skip_gced_blocks_in_direct_finalization: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 gas_rounding_halve_digits: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 flexible_tx_context_positions: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 disable_entry_point_signature_check: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 convert_withdrawal_compatibility_ptb_arguments: bool,
958}
959
960fn is_false(b: &bool) -> bool {
961 !b
962}
963
964fn is_empty(b: &BTreeSet<String>) -> bool {
965 b.is_empty()
966}
967
968fn is_zero(val: &u64) -> bool {
969 *val == 0
970}
971
972#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
974pub enum ConsensusTransactionOrdering {
975 #[default]
977 None,
978 ByGasPrice,
980}
981
982impl ConsensusTransactionOrdering {
983 pub fn is_none(&self) -> bool {
984 matches!(self, ConsensusTransactionOrdering::None)
985 }
986}
987
988#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
989pub struct ExecutionTimeEstimateParams {
990 pub target_utilization: u64,
992 pub allowed_txn_cost_overage_burst_limit_us: u64,
996
997 pub randomness_scalar: u64,
1000
1001 pub max_estimate_us: u64,
1003
1004 pub stored_observations_num_included_checkpoints: u64,
1007
1008 pub stored_observations_limit: u64,
1010
1011 #[serde(skip_serializing_if = "is_zero")]
1014 pub stake_weighted_median_threshold: u64,
1015
1016 #[serde(skip_serializing_if = "is_false")]
1020 pub default_none_duration_for_new_keys: bool,
1021
1022 #[serde(skip_serializing_if = "Option::is_none")]
1024 pub observations_chunk_size: Option<u64>,
1025}
1026
1027#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1029pub enum PerObjectCongestionControlMode {
1030 #[default]
1031 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1037
1038impl PerObjectCongestionControlMode {
1039 pub fn is_none(&self) -> bool {
1040 matches!(self, PerObjectCongestionControlMode::None)
1041 }
1042}
1043
1044#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1046pub enum ConsensusChoice {
1047 #[default]
1048 Narwhal,
1049 SwapEachEpoch,
1050 Mysticeti,
1051}
1052
1053impl ConsensusChoice {
1054 pub fn is_narwhal(&self) -> bool {
1055 matches!(self, ConsensusChoice::Narwhal)
1056 }
1057}
1058
1059#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1061pub enum ConsensusNetwork {
1062 #[default]
1063 Anemo,
1064 Tonic,
1065}
1066
1067impl ConsensusNetwork {
1068 pub fn is_anemo(&self) -> bool {
1069 matches!(self, ConsensusNetwork::Anemo)
1070 }
1071}
1072
1073#[skip_serializing_none]
1105#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1106pub struct ProtocolConfig {
1107 pub version: ProtocolVersion,
1108
1109 feature_flags: FeatureFlags,
1110
1111 max_tx_size_bytes: Option<u64>,
1114
1115 max_input_objects: Option<u64>,
1117
1118 max_size_written_objects: Option<u64>,
1122 max_size_written_objects_system_tx: Option<u64>,
1125
1126 max_serialized_tx_effects_size_bytes: Option<u64>,
1128
1129 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1131
1132 max_gas_payment_objects: Option<u32>,
1134
1135 max_modules_in_publish: Option<u32>,
1137
1138 max_package_dependencies: Option<u32>,
1140
1141 max_arguments: Option<u32>,
1144
1145 max_type_arguments: Option<u32>,
1147
1148 max_type_argument_depth: Option<u32>,
1150
1151 max_pure_argument_size: Option<u32>,
1153
1154 max_programmable_tx_commands: Option<u32>,
1156
1157 move_binary_format_version: Option<u32>,
1160 min_move_binary_format_version: Option<u32>,
1161
1162 binary_module_handles: Option<u16>,
1164 binary_struct_handles: Option<u16>,
1165 binary_function_handles: Option<u16>,
1166 binary_function_instantiations: Option<u16>,
1167 binary_signatures: Option<u16>,
1168 binary_constant_pool: Option<u16>,
1169 binary_identifiers: Option<u16>,
1170 binary_address_identifiers: Option<u16>,
1171 binary_struct_defs: Option<u16>,
1172 binary_struct_def_instantiations: Option<u16>,
1173 binary_function_defs: Option<u16>,
1174 binary_field_handles: Option<u16>,
1175 binary_field_instantiations: Option<u16>,
1176 binary_friend_decls: Option<u16>,
1177 binary_enum_defs: Option<u16>,
1178 binary_enum_def_instantiations: Option<u16>,
1179 binary_variant_handles: Option<u16>,
1180 binary_variant_instantiation_handles: Option<u16>,
1181
1182 max_move_object_size: Option<u64>,
1184
1185 max_move_package_size: Option<u64>,
1188
1189 max_publish_or_upgrade_per_ptb: Option<u64>,
1191
1192 max_tx_gas: Option<u64>,
1194
1195 max_gas_price: Option<u64>,
1197
1198 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1201
1202 max_gas_computation_bucket: Option<u64>,
1204
1205 gas_rounding_step: Option<u64>,
1207
1208 max_loop_depth: Option<u64>,
1210
1211 max_generic_instantiation_length: Option<u64>,
1213
1214 max_function_parameters: Option<u64>,
1216
1217 max_basic_blocks: Option<u64>,
1219
1220 max_value_stack_size: Option<u64>,
1222
1223 max_type_nodes: Option<u64>,
1225
1226 max_push_size: Option<u64>,
1228
1229 max_struct_definitions: Option<u64>,
1231
1232 max_function_definitions: Option<u64>,
1234
1235 max_fields_in_struct: Option<u64>,
1237
1238 max_dependency_depth: Option<u64>,
1240
1241 max_num_event_emit: Option<u64>,
1243
1244 max_num_new_move_object_ids: Option<u64>,
1246
1247 max_num_new_move_object_ids_system_tx: Option<u64>,
1249
1250 max_num_deleted_move_object_ids: Option<u64>,
1252
1253 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1255
1256 max_num_transferred_move_object_ids: Option<u64>,
1258
1259 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1261
1262 max_event_emit_size: Option<u64>,
1264
1265 max_event_emit_size_total: Option<u64>,
1267
1268 max_move_vector_len: Option<u64>,
1270
1271 max_move_identifier_len: Option<u64>,
1273
1274 max_move_value_depth: Option<u64>,
1276
1277 max_move_enum_variants: Option<u64>,
1279
1280 max_back_edges_per_function: Option<u64>,
1282
1283 max_back_edges_per_module: Option<u64>,
1285
1286 max_verifier_meter_ticks_per_function: Option<u64>,
1288
1289 max_meter_ticks_per_module: Option<u64>,
1291
1292 max_meter_ticks_per_package: Option<u64>,
1294
1295 object_runtime_max_num_cached_objects: Option<u64>,
1299
1300 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1302
1303 object_runtime_max_num_store_entries: Option<u64>,
1305
1306 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1308
1309 base_tx_cost_fixed: Option<u64>,
1312
1313 package_publish_cost_fixed: Option<u64>,
1316
1317 base_tx_cost_per_byte: Option<u64>,
1320
1321 package_publish_cost_per_byte: Option<u64>,
1323
1324 obj_access_cost_read_per_byte: Option<u64>,
1326
1327 obj_access_cost_mutate_per_byte: Option<u64>,
1329
1330 obj_access_cost_delete_per_byte: Option<u64>,
1332
1333 obj_access_cost_verify_per_byte: Option<u64>,
1343
1344 max_type_to_layout_nodes: Option<u64>,
1346
1347 max_ptb_value_size: Option<u64>,
1349
1350 gas_model_version: Option<u64>,
1353
1354 obj_data_cost_refundable: Option<u64>,
1357
1358 obj_metadata_cost_non_refundable: Option<u64>,
1362
1363 storage_rebate_rate: Option<u64>,
1369
1370 storage_fund_reinvest_rate: Option<u64>,
1373
1374 reward_slashing_rate: Option<u64>,
1377
1378 storage_gas_price: Option<u64>,
1380
1381 accumulator_object_storage_cost: Option<u64>,
1383
1384 max_transactions_per_checkpoint: Option<u64>,
1389
1390 max_checkpoint_size_bytes: Option<u64>,
1394
1395 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1400
1401 address_from_bytes_cost_base: Option<u64>,
1406 address_to_u256_cost_base: Option<u64>,
1408 address_from_u256_cost_base: Option<u64>,
1410
1411 config_read_setting_impl_cost_base: Option<u64>,
1416 config_read_setting_impl_cost_per_byte: Option<u64>,
1417
1418 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1421 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1422 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1423 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1424 dynamic_field_add_child_object_cost_base: Option<u64>,
1426 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1427 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1428 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1429 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1431 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1432 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1433 dynamic_field_remove_child_object_cost_base: Option<u64>,
1435 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1436 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1437 dynamic_field_has_child_object_cost_base: Option<u64>,
1439 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1441 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1442 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1443
1444 event_emit_cost_base: Option<u64>,
1447 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1448 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1449 event_emit_output_cost_per_byte: Option<u64>,
1450 event_emit_auth_stream_cost: Option<u64>,
1451
1452 object_borrow_uid_cost_base: Option<u64>,
1455 object_delete_impl_cost_base: Option<u64>,
1457 object_record_new_uid_cost_base: Option<u64>,
1459
1460 transfer_transfer_internal_cost_base: Option<u64>,
1463 transfer_party_transfer_internal_cost_base: Option<u64>,
1465 transfer_freeze_object_cost_base: Option<u64>,
1467 transfer_share_object_cost_base: Option<u64>,
1469 transfer_receive_object_cost_base: Option<u64>,
1472
1473 tx_context_derive_id_cost_base: Option<u64>,
1476 tx_context_fresh_id_cost_base: Option<u64>,
1477 tx_context_sender_cost_base: Option<u64>,
1478 tx_context_epoch_cost_base: Option<u64>,
1479 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1480 tx_context_sponsor_cost_base: Option<u64>,
1481 tx_context_rgp_cost_base: Option<u64>,
1482 tx_context_gas_price_cost_base: Option<u64>,
1483 tx_context_gas_budget_cost_base: Option<u64>,
1484 tx_context_ids_created_cost_base: Option<u64>,
1485 tx_context_replace_cost_base: Option<u64>,
1486
1487 types_is_one_time_witness_cost_base: Option<u64>,
1490 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1491 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1492
1493 validator_validate_metadata_cost_base: Option<u64>,
1496 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1497
1498 crypto_invalid_arguments_cost: Option<u64>,
1500 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1502 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1503 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1504
1505 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1507 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1508 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1509
1510 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1512 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1513 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1514 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1515 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1516 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1517
1518 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1520
1521 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1523 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1524 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1525 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1526 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1527 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1528
1529 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1531 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1532 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1533 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1534 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1535 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1536
1537 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1539 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1540 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1541 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1542 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1543 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1544
1545 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1547 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1548 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1549
1550 ed25519_ed25519_verify_cost_base: Option<u64>,
1552 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1553 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1554
1555 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1557 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1558
1559 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1561 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1562 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1563 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1564 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1565
1566 hash_blake2b256_cost_base: Option<u64>,
1568 hash_blake2b256_data_cost_per_byte: Option<u64>,
1569 hash_blake2b256_data_cost_per_block: Option<u64>,
1570
1571 hash_keccak256_cost_base: Option<u64>,
1573 hash_keccak256_data_cost_per_byte: Option<u64>,
1574 hash_keccak256_data_cost_per_block: Option<u64>,
1575
1576 poseidon_bn254_cost_base: Option<u64>,
1578 poseidon_bn254_cost_per_block: Option<u64>,
1579
1580 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1582 group_ops_bls12381_decode_g1_cost: Option<u64>,
1583 group_ops_bls12381_decode_g2_cost: Option<u64>,
1584 group_ops_bls12381_decode_gt_cost: Option<u64>,
1585 group_ops_bls12381_scalar_add_cost: Option<u64>,
1586 group_ops_bls12381_g1_add_cost: Option<u64>,
1587 group_ops_bls12381_g2_add_cost: Option<u64>,
1588 group_ops_bls12381_gt_add_cost: Option<u64>,
1589 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1590 group_ops_bls12381_g1_sub_cost: Option<u64>,
1591 group_ops_bls12381_g2_sub_cost: Option<u64>,
1592 group_ops_bls12381_gt_sub_cost: Option<u64>,
1593 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1594 group_ops_bls12381_g1_mul_cost: Option<u64>,
1595 group_ops_bls12381_g2_mul_cost: Option<u64>,
1596 group_ops_bls12381_gt_mul_cost: Option<u64>,
1597 group_ops_bls12381_scalar_div_cost: Option<u64>,
1598 group_ops_bls12381_g1_div_cost: Option<u64>,
1599 group_ops_bls12381_g2_div_cost: Option<u64>,
1600 group_ops_bls12381_gt_div_cost: Option<u64>,
1601 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1602 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1603 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1604 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1605 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1606 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1607 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1608 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1609 group_ops_bls12381_msm_max_len: Option<u32>,
1610 group_ops_bls12381_pairing_cost: Option<u64>,
1611 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1612 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1613 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1614 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1615 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1616
1617 hmac_hmac_sha3_256_cost_base: Option<u64>,
1619 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1620 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1621
1622 check_zklogin_id_cost_base: Option<u64>,
1624 check_zklogin_issuer_cost_base: Option<u64>,
1626
1627 vdf_verify_vdf_cost: Option<u64>,
1628 vdf_hash_to_input_cost: Option<u64>,
1629
1630 nitro_attestation_parse_base_cost: Option<u64>,
1632 nitro_attestation_parse_cost_per_byte: Option<u64>,
1633 nitro_attestation_verify_base_cost: Option<u64>,
1634 nitro_attestation_verify_cost_per_cert: Option<u64>,
1635
1636 bcs_per_byte_serialized_cost: Option<u64>,
1638 bcs_legacy_min_output_size_cost: Option<u64>,
1639 bcs_failure_cost: Option<u64>,
1640
1641 hash_sha2_256_base_cost: Option<u64>,
1642 hash_sha2_256_per_byte_cost: Option<u64>,
1643 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1644 hash_sha3_256_base_cost: Option<u64>,
1645 hash_sha3_256_per_byte_cost: Option<u64>,
1646 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1647 type_name_get_base_cost: Option<u64>,
1648 type_name_get_per_byte_cost: Option<u64>,
1649 type_name_id_base_cost: Option<u64>,
1650
1651 string_check_utf8_base_cost: Option<u64>,
1652 string_check_utf8_per_byte_cost: Option<u64>,
1653 string_is_char_boundary_base_cost: Option<u64>,
1654 string_sub_string_base_cost: Option<u64>,
1655 string_sub_string_per_byte_cost: Option<u64>,
1656 string_index_of_base_cost: Option<u64>,
1657 string_index_of_per_byte_pattern_cost: Option<u64>,
1658 string_index_of_per_byte_searched_cost: Option<u64>,
1659
1660 vector_empty_base_cost: Option<u64>,
1661 vector_length_base_cost: Option<u64>,
1662 vector_push_back_base_cost: Option<u64>,
1663 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1664 vector_borrow_base_cost: Option<u64>,
1665 vector_pop_back_base_cost: Option<u64>,
1666 vector_destroy_empty_base_cost: Option<u64>,
1667 vector_swap_base_cost: Option<u64>,
1668 debug_print_base_cost: Option<u64>,
1669 debug_print_stack_trace_base_cost: Option<u64>,
1670
1671 execution_version: Option<u64>,
1680
1681 consensus_bad_nodes_stake_threshold: Option<u64>,
1685
1686 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1687 max_age_of_jwk_in_epochs: Option<u64>,
1691
1692 random_beacon_reduction_allowed_delta: Option<u16>,
1696
1697 random_beacon_reduction_lower_bound: Option<u32>,
1700
1701 random_beacon_dkg_timeout_round: Option<u32>,
1704
1705 random_beacon_min_round_interval_ms: Option<u64>,
1707
1708 random_beacon_dkg_version: Option<u64>,
1711
1712 consensus_max_transaction_size_bytes: Option<u64>,
1715 consensus_max_transactions_in_block_bytes: Option<u64>,
1717 consensus_max_num_transactions_in_block: Option<u64>,
1719
1720 consensus_voting_rounds: Option<u32>,
1722
1723 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1725
1726 max_deferral_rounds_for_congestion_control: Option<u64>,
1729
1730 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1732
1733 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1735
1736 min_checkpoint_interval_ms: Option<u64>,
1738
1739 checkpoint_summary_version_specific_data: Option<u64>,
1741
1742 max_soft_bundle_size: Option<u64>,
1744
1745 bridge_should_try_to_finalize_committee: Option<bool>,
1749
1750 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1756
1757 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1760
1761 consensus_gc_depth: Option<u32>,
1764
1765 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1767
1768 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1770
1771 sip_45_consensus_amplification_threshold: Option<u64>,
1774
1775 use_object_per_epoch_marker_table_v2: Option<bool>,
1778
1779 consensus_commit_rate_estimation_window_size: Option<u32>,
1781
1782 #[serde(skip_serializing_if = "Vec::is_empty")]
1786 aliased_addresses: Vec<AliasedAddress>,
1787
1788 translation_per_command_base_charge: Option<u64>,
1791
1792 translation_per_input_base_charge: Option<u64>,
1795
1796 translation_pure_input_per_byte_charge: Option<u64>,
1798
1799 translation_per_type_node_charge: Option<u64>,
1803
1804 translation_per_reference_node_charge: Option<u64>,
1807
1808 translation_per_linkage_entry_charge: Option<u64>,
1811
1812 max_updates_per_settlement_txn: Option<u32>,
1814}
1815
1816#[derive(Clone, Serialize, Deserialize, Debug)]
1818pub struct AliasedAddress {
1819 pub original: [u8; 32],
1821 pub aliased: [u8; 32],
1823 pub allowed_tx_digests: Vec<[u8; 32]>,
1825}
1826
1827impl ProtocolConfig {
1829 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1842 if self.feature_flags.package_upgrades {
1843 Ok(())
1844 } else {
1845 Err(Error(format!(
1846 "package upgrades are not supported at {:?}",
1847 self.version
1848 )))
1849 }
1850 }
1851
1852 pub fn allow_receiving_object_id(&self) -> bool {
1853 self.feature_flags.allow_receiving_object_id
1854 }
1855
1856 pub fn receiving_objects_supported(&self) -> bool {
1857 self.feature_flags.receive_objects
1858 }
1859
1860 pub fn package_upgrades_supported(&self) -> bool {
1861 self.feature_flags.package_upgrades
1862 }
1863
1864 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1865 self.feature_flags.commit_root_state_digest
1866 }
1867
1868 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1869 self.feature_flags.advance_epoch_start_time_in_safe_mode
1870 }
1871
1872 pub fn loaded_child_objects_fixed(&self) -> bool {
1873 self.feature_flags.loaded_child_objects_fixed
1874 }
1875
1876 pub fn missing_type_is_compatibility_error(&self) -> bool {
1877 self.feature_flags.missing_type_is_compatibility_error
1878 }
1879
1880 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1881 self.feature_flags.scoring_decision_with_validity_cutoff
1882 }
1883
1884 pub fn narwhal_versioned_metadata(&self) -> bool {
1885 self.feature_flags.narwhal_versioned_metadata
1886 }
1887
1888 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1889 self.feature_flags.consensus_order_end_of_epoch_last
1890 }
1891
1892 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1893 self.feature_flags.disallow_adding_abilities_on_upgrade
1894 }
1895
1896 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1897 self.feature_flags
1898 .disable_invariant_violation_check_in_swap_loc
1899 }
1900
1901 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1902 self.feature_flags
1903 .advance_to_highest_supported_protocol_version
1904 }
1905
1906 pub fn ban_entry_init(&self) -> bool {
1907 self.feature_flags.ban_entry_init
1908 }
1909
1910 pub fn package_digest_hash_module(&self) -> bool {
1911 self.feature_flags.package_digest_hash_module
1912 }
1913
1914 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1915 self.feature_flags
1916 .disallow_change_struct_type_params_on_upgrade
1917 }
1918
1919 pub fn no_extraneous_module_bytes(&self) -> bool {
1920 self.feature_flags.no_extraneous_module_bytes
1921 }
1922
1923 pub fn zklogin_auth(&self) -> bool {
1924 self.feature_flags.zklogin_auth
1925 }
1926
1927 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
1928 &self.feature_flags.zklogin_supported_providers
1929 }
1930
1931 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
1932 self.feature_flags.consensus_transaction_ordering
1933 }
1934
1935 pub fn simplified_unwrap_then_delete(&self) -> bool {
1936 self.feature_flags.simplified_unwrap_then_delete
1937 }
1938
1939 pub fn supports_upgraded_multisig(&self) -> bool {
1940 self.feature_flags.upgraded_multisig_supported
1941 }
1942
1943 pub fn txn_base_cost_as_multiplier(&self) -> bool {
1944 self.feature_flags.txn_base_cost_as_multiplier
1945 }
1946
1947 pub fn shared_object_deletion(&self) -> bool {
1948 self.feature_flags.shared_object_deletion
1949 }
1950
1951 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
1952 self.feature_flags.narwhal_new_leader_election_schedule
1953 }
1954
1955 pub fn loaded_child_object_format(&self) -> bool {
1956 self.feature_flags.loaded_child_object_format
1957 }
1958
1959 pub fn enable_jwk_consensus_updates(&self) -> bool {
1960 let ret = self.feature_flags.enable_jwk_consensus_updates;
1961 if ret {
1962 assert!(self.feature_flags.end_of_epoch_transaction_supported);
1964 }
1965 ret
1966 }
1967
1968 pub fn simple_conservation_checks(&self) -> bool {
1969 self.feature_flags.simple_conservation_checks
1970 }
1971
1972 pub fn loaded_child_object_format_type(&self) -> bool {
1973 self.feature_flags.loaded_child_object_format_type
1974 }
1975
1976 pub fn end_of_epoch_transaction_supported(&self) -> bool {
1977 let ret = self.feature_flags.end_of_epoch_transaction_supported;
1978 if !ret {
1979 assert!(!self.feature_flags.enable_jwk_consensus_updates);
1981 }
1982 ret
1983 }
1984
1985 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
1986 self.feature_flags
1987 .recompute_has_public_transfer_in_execution
1988 }
1989
1990 pub fn create_authenticator_state_in_genesis(&self) -> bool {
1992 self.enable_jwk_consensus_updates()
1993 }
1994
1995 pub fn random_beacon(&self) -> bool {
1996 self.feature_flags.random_beacon
1997 }
1998
1999 pub fn dkg_version(&self) -> u64 {
2000 self.random_beacon_dkg_version.unwrap_or(1)
2002 }
2003
2004 pub fn enable_bridge(&self) -> bool {
2005 let ret = self.feature_flags.bridge;
2006 if ret {
2007 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2009 }
2010 ret
2011 }
2012
2013 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2014 if !self.enable_bridge() {
2015 return false;
2016 }
2017 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2019 }
2020
2021 pub fn enable_effects_v2(&self) -> bool {
2022 self.feature_flags.enable_effects_v2
2023 }
2024
2025 pub fn narwhal_certificate_v2(&self) -> bool {
2026 self.feature_flags.narwhal_certificate_v2
2027 }
2028
2029 pub fn verify_legacy_zklogin_address(&self) -> bool {
2030 self.feature_flags.verify_legacy_zklogin_address
2031 }
2032
2033 pub fn accept_zklogin_in_multisig(&self) -> bool {
2034 self.feature_flags.accept_zklogin_in_multisig
2035 }
2036
2037 pub fn accept_passkey_in_multisig(&self) -> bool {
2038 self.feature_flags.accept_passkey_in_multisig
2039 }
2040
2041 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2042 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2043 }
2044
2045 pub fn throughput_aware_consensus_submission(&self) -> bool {
2046 self.feature_flags.throughput_aware_consensus_submission
2047 }
2048
2049 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2050 self.feature_flags.include_consensus_digest_in_prologue
2051 }
2052
2053 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2054 self.feature_flags
2055 .record_consensus_determined_version_assignments_in_prologue
2056 }
2057
2058 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2059 self.feature_flags
2060 .record_additional_state_digest_in_prologue
2061 }
2062
2063 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2064 self.feature_flags
2065 .record_consensus_determined_version_assignments_in_prologue_v2
2066 }
2067
2068 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2069 self.feature_flags
2070 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2071 }
2072
2073 pub fn hardened_otw_check(&self) -> bool {
2074 self.feature_flags.hardened_otw_check
2075 }
2076
2077 pub fn enable_poseidon(&self) -> bool {
2078 self.feature_flags.enable_poseidon
2079 }
2080
2081 pub fn enable_coin_deny_list_v1(&self) -> bool {
2082 self.feature_flags.enable_coin_deny_list
2083 }
2084
2085 pub fn enable_accumulators(&self) -> bool {
2086 self.feature_flags.enable_accumulators
2087 }
2088
2089 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2090 self.feature_flags.enable_coin_reservation_obj_refs
2091 }
2092
2093 pub fn create_root_accumulator_object(&self) -> bool {
2094 self.feature_flags.create_root_accumulator_object
2095 }
2096
2097 pub fn enable_address_balance_gas_payments(&self) -> bool {
2098 self.feature_flags.enable_address_balance_gas_payments
2099 }
2100
2101 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2102 self.feature_flags.enable_multi_epoch_transaction_expiration
2103 }
2104
2105 pub fn enable_authenticated_event_streams(&self) -> bool {
2106 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2107 }
2108
2109 pub fn enable_non_exclusive_writes(&self) -> bool {
2110 self.feature_flags.enable_non_exclusive_writes
2111 }
2112
2113 pub fn enable_coin_registry(&self) -> bool {
2114 self.feature_flags.enable_coin_registry
2115 }
2116
2117 pub fn enable_display_registry(&self) -> bool {
2118 self.feature_flags.enable_display_registry
2119 }
2120
2121 pub fn enable_coin_deny_list_v2(&self) -> bool {
2122 self.feature_flags.enable_coin_deny_list_v2
2123 }
2124
2125 pub fn enable_group_ops_native_functions(&self) -> bool {
2126 self.feature_flags.enable_group_ops_native_functions
2127 }
2128
2129 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2130 self.feature_flags.enable_group_ops_native_function_msm
2131 }
2132
2133 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2134 self.feature_flags.reject_mutable_random_on_entry_functions
2135 }
2136
2137 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2138 self.feature_flags.per_object_congestion_control_mode
2139 }
2140
2141 pub fn consensus_choice(&self) -> ConsensusChoice {
2142 self.feature_flags.consensus_choice
2143 }
2144
2145 pub fn consensus_network(&self) -> ConsensusNetwork {
2146 self.feature_flags.consensus_network
2147 }
2148
2149 pub fn correct_gas_payment_limit_check(&self) -> bool {
2150 self.feature_flags.correct_gas_payment_limit_check
2151 }
2152
2153 pub fn reshare_at_same_initial_version(&self) -> bool {
2154 self.feature_flags.reshare_at_same_initial_version
2155 }
2156
2157 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2158 self.feature_flags.resolve_abort_locations_to_package_id
2159 }
2160
2161 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2162 self.feature_flags.mysticeti_use_committed_subdag_digest
2163 }
2164
2165 pub fn enable_vdf(&self) -> bool {
2166 self.feature_flags.enable_vdf
2167 }
2168
2169 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2170 self.feature_flags.fresh_vm_on_framework_upgrade
2171 }
2172
2173 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2174 self.feature_flags.mysticeti_num_leaders_per_round
2175 }
2176
2177 pub fn soft_bundle(&self) -> bool {
2178 self.feature_flags.soft_bundle
2179 }
2180
2181 pub fn passkey_auth(&self) -> bool {
2182 self.feature_flags.passkey_auth
2183 }
2184
2185 pub fn authority_capabilities_v2(&self) -> bool {
2186 self.feature_flags.authority_capabilities_v2
2187 }
2188
2189 pub fn max_transaction_size_bytes(&self) -> u64 {
2190 self.consensus_max_transaction_size_bytes
2192 .unwrap_or(256 * 1024)
2193 }
2194
2195 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2196 if cfg!(msim) {
2197 256 * 1024
2198 } else {
2199 self.consensus_max_transactions_in_block_bytes
2200 .unwrap_or(512 * 1024)
2201 }
2202 }
2203
2204 pub fn max_num_transactions_in_block(&self) -> u64 {
2205 if cfg!(msim) {
2206 8
2207 } else {
2208 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2209 }
2210 }
2211
2212 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2213 self.feature_flags.rethrow_serialization_type_layout_errors
2214 }
2215
2216 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2217 self.feature_flags
2218 .consensus_distributed_vote_scoring_strategy
2219 }
2220
2221 pub fn consensus_round_prober(&self) -> bool {
2222 self.feature_flags.consensus_round_prober
2223 }
2224
2225 pub fn validate_identifier_inputs(&self) -> bool {
2226 self.feature_flags.validate_identifier_inputs
2227 }
2228
2229 pub fn gc_depth(&self) -> u32 {
2230 self.consensus_gc_depth.unwrap_or(0)
2231 }
2232
2233 pub fn mysticeti_fastpath(&self) -> bool {
2234 self.feature_flags.mysticeti_fastpath
2235 }
2236
2237 pub fn relocate_event_module(&self) -> bool {
2238 self.feature_flags.relocate_event_module
2239 }
2240
2241 pub fn uncompressed_g1_group_elements(&self) -> bool {
2242 self.feature_flags.uncompressed_g1_group_elements
2243 }
2244
2245 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2246 self.feature_flags
2247 .disallow_new_modules_in_deps_only_packages
2248 }
2249
2250 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2251 self.feature_flags.consensus_smart_ancestor_selection
2252 }
2253
2254 pub fn disable_preconsensus_locking(&self) -> bool {
2255 self.feature_flags.disable_preconsensus_locking
2256 }
2257
2258 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2259 self.feature_flags
2260 .consensus_round_prober_probe_accepted_rounds
2261 }
2262
2263 pub fn native_charging_v2(&self) -> bool {
2264 self.feature_flags.native_charging_v2
2265 }
2266
2267 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2268 let res = self.feature_flags.consensus_linearize_subdag_v2;
2269 assert!(
2270 !res || self.gc_depth() > 0,
2271 "The consensus linearize sub dag V2 requires GC to be enabled"
2272 );
2273 res
2274 }
2275
2276 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2277 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2278 assert!(
2279 !res || self.gc_depth() > 0,
2280 "The consensus median based commit timestamp requires GC to be enabled"
2281 );
2282 res
2283 }
2284
2285 pub fn consensus_batched_block_sync(&self) -> bool {
2286 self.feature_flags.consensus_batched_block_sync
2287 }
2288
2289 pub fn convert_type_argument_error(&self) -> bool {
2290 self.feature_flags.convert_type_argument_error
2291 }
2292
2293 pub fn variant_nodes(&self) -> bool {
2294 self.feature_flags.variant_nodes
2295 }
2296
2297 pub fn consensus_zstd_compression(&self) -> bool {
2298 self.feature_flags.consensus_zstd_compression
2299 }
2300
2301 pub fn enable_nitro_attestation(&self) -> bool {
2302 self.feature_flags.enable_nitro_attestation
2303 }
2304
2305 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2306 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2307 }
2308
2309 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2310 self.feature_flags
2311 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2312 }
2313
2314 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2315 self.feature_flags
2316 .enable_nitro_attestation_always_include_required_pcrs_parsing
2317 }
2318
2319 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2320 self.consensus_commit_rate_estimation_window_size
2321 .unwrap_or(0)
2322 }
2323
2324 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2325 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2329 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2331 window_size
2332 }
2333
2334 pub fn minimize_child_object_mutations(&self) -> bool {
2335 self.feature_flags.minimize_child_object_mutations
2336 }
2337
2338 pub fn move_native_context(&self) -> bool {
2339 self.feature_flags.move_native_context
2340 }
2341
2342 pub fn normalize_ptb_arguments(&self) -> bool {
2343 self.feature_flags.normalize_ptb_arguments
2344 }
2345
2346 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2347 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2348 }
2349
2350 pub fn max_ptb_value_size_v2(&self) -> bool {
2351 self.feature_flags.max_ptb_value_size_v2
2352 }
2353
2354 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2355 self.feature_flags.resolve_type_input_ids_to_defining_id
2356 }
2357
2358 pub fn enable_party_transfer(&self) -> bool {
2359 self.feature_flags.enable_party_transfer
2360 }
2361
2362 pub fn allow_unbounded_system_objects(&self) -> bool {
2363 self.feature_flags.allow_unbounded_system_objects
2364 }
2365
2366 pub fn type_tags_in_object_runtime(&self) -> bool {
2367 self.feature_flags.type_tags_in_object_runtime
2368 }
2369
2370 pub fn enable_ptb_execution_v2(&self) -> bool {
2371 self.feature_flags.enable_ptb_execution_v2
2372 }
2373
2374 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2375 self.feature_flags.better_adapter_type_resolution_errors
2376 }
2377
2378 pub fn record_time_estimate_processed(&self) -> bool {
2379 self.feature_flags.record_time_estimate_processed
2380 }
2381
2382 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2383 self.feature_flags
2384 .ignore_execution_time_observations_after_certs_closed
2385 }
2386
2387 pub fn dependency_linkage_error(&self) -> bool {
2388 self.feature_flags.dependency_linkage_error
2389 }
2390
2391 pub fn additional_multisig_checks(&self) -> bool {
2392 self.feature_flags.additional_multisig_checks
2393 }
2394
2395 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2396 self.feature_flags.debug_fatal_on_move_invariant_violation
2397 }
2398
2399 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2400 self.feature_flags.allow_private_accumulator_entrypoints
2401 }
2402
2403 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2404 self.feature_flags
2405 .additional_consensus_digest_indirect_state
2406 }
2407
2408 pub fn check_for_init_during_upgrade(&self) -> bool {
2409 self.feature_flags.check_for_init_during_upgrade
2410 }
2411
2412 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2413 self.feature_flags.per_command_shared_object_transfer_rules
2414 }
2415
2416 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2417 self.feature_flags
2418 .consensus_checkpoint_signature_key_includes_digest
2419 }
2420
2421 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2422 self.feature_flags
2423 .include_checkpoint_artifacts_digest_in_summary
2424 }
2425
2426 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2427 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2428 }
2429
2430 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2431 self.feature_flags.cancel_for_failed_dkg_early
2432 }
2433
2434 pub fn abstract_size_in_object_runtime(&self) -> bool {
2435 self.feature_flags.abstract_size_in_object_runtime
2436 }
2437
2438 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2439 self.feature_flags.object_runtime_charge_cache_load_gas
2440 }
2441
2442 pub fn additional_borrow_checks(&self) -> bool {
2443 self.feature_flags.additional_borrow_checks
2444 }
2445
2446 pub fn use_new_commit_handler(&self) -> bool {
2447 self.feature_flags.use_new_commit_handler
2448 }
2449
2450 pub fn better_loader_errors(&self) -> bool {
2451 self.feature_flags.better_loader_errors
2452 }
2453
2454 pub fn generate_df_type_layouts(&self) -> bool {
2455 self.feature_flags.generate_df_type_layouts
2456 }
2457
2458 pub fn allow_references_in_ptbs(&self) -> bool {
2459 self.feature_flags.allow_references_in_ptbs
2460 }
2461
2462 pub fn private_generics_verifier_v2(&self) -> bool {
2463 self.feature_flags.private_generics_verifier_v2
2464 }
2465
2466 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2467 self.feature_flags
2468 .deprecate_global_storage_ops_during_deserialization
2469 }
2470
2471 pub fn enable_observation_chunking(&self) -> bool {
2472 matches!(self.feature_flags.per_object_congestion_control_mode,
2473 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2474 if params.observations_chunk_size.is_some()
2475 )
2476 }
2477
2478 pub fn deprecate_global_storage_ops(&self) -> bool {
2479 self.feature_flags.deprecate_global_storage_ops
2480 }
2481
2482 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2483 self.feature_flags.consensus_skip_gced_accept_votes
2484 }
2485
2486 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2487 self.feature_flags
2488 .include_cancelled_randomness_txns_in_prologue
2489 }
2490
2491 pub fn address_aliases(&self) -> bool {
2492 let address_aliases = self.feature_flags.address_aliases;
2493 assert!(
2494 !address_aliases || self.mysticeti_fastpath(),
2495 "Address aliases requires Mysticeti fastpath to be enabled"
2496 );
2497 if address_aliases {
2498 assert!(
2499 self.feature_flags.disable_preconsensus_locking,
2500 "Address aliases requires CertifiedTransaction to be disabled"
2501 );
2502 }
2503 address_aliases
2504 }
2505
2506 pub fn enable_object_funds_withdraw(&self) -> bool {
2507 self.feature_flags.enable_object_funds_withdraw
2508 }
2509
2510 pub fn gas_rounding_halve_digits(&self) -> bool {
2511 self.feature_flags.gas_rounding_halve_digits
2512 }
2513
2514 pub fn flexible_tx_context_positions(&self) -> bool {
2515 self.feature_flags.flexible_tx_context_positions
2516 }
2517
2518 pub fn disable_entry_point_signature_check(&self) -> bool {
2519 self.feature_flags.disable_entry_point_signature_check
2520 }
2521
2522 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2523 self.feature_flags
2524 .consensus_skip_gced_blocks_in_direct_finalization
2525 }
2526
2527 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2528 self.feature_flags
2529 .convert_withdrawal_compatibility_ptb_arguments
2530 }
2531}
2532
2533#[cfg(not(msim))]
2534static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2535
2536#[cfg(msim)]
2538thread_local! {
2539 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2540}
2541
2542impl ProtocolConfig {
2544 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2546 assert!(
2548 version >= ProtocolVersion::MIN,
2549 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2550 version,
2551 ProtocolVersion::MIN.0,
2552 );
2553 assert!(
2554 version <= ProtocolVersion::MAX_ALLOWED,
2555 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2556 version,
2557 ProtocolVersion::MAX_ALLOWED.0,
2558 );
2559
2560 let mut ret = Self::get_for_version_impl(version, chain);
2561 ret.version = version;
2562
2563 ret = CONFIG_OVERRIDE.with(|ovr| {
2564 if let Some(override_fn) = &*ovr.borrow() {
2565 warn!(
2566 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2567 );
2568 override_fn(version, ret)
2569 } else {
2570 ret
2571 }
2572 });
2573
2574 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2575 warn!(
2576 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2577 );
2578 let overrides: ProtocolConfigOptional =
2579 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2580 .expect("failed to parse ProtocolConfig override env variables");
2581 overrides.apply_to(&mut ret);
2582 }
2583
2584 ret
2585 }
2586
2587 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2590 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2591 let mut ret = Self::get_for_version_impl(version, chain);
2592 ret.version = version;
2593 Some(ret)
2594 } else {
2595 None
2596 }
2597 }
2598
2599 #[cfg(not(msim))]
2600 pub fn poison_get_for_min_version() {
2601 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2602 }
2603
2604 #[cfg(not(msim))]
2605 fn load_poison_get_for_min_version() -> bool {
2606 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2607 }
2608
2609 #[cfg(msim)]
2610 pub fn poison_get_for_min_version() {
2611 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2612 }
2613
2614 #[cfg(msim)]
2615 fn load_poison_get_for_min_version() -> bool {
2616 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2617 }
2618
2619 pub fn get_for_min_version() -> Self {
2622 if Self::load_poison_get_for_min_version() {
2623 panic!("get_for_min_version called on validator");
2624 }
2625 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2626 }
2627
2628 #[allow(non_snake_case)]
2638 pub fn get_for_max_version_UNSAFE() -> Self {
2639 if Self::load_poison_get_for_min_version() {
2640 panic!("get_for_max_version_UNSAFE called on validator");
2641 }
2642 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2643 }
2644
2645 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2646 #[cfg(msim)]
2647 {
2648 if version == ProtocolVersion::MAX_ALLOWED {
2650 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2651 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2652 return config;
2653 }
2654 }
2655
2656 let mut cfg = Self {
2659 version,
2661
2662 feature_flags: Default::default(),
2664
2665 max_tx_size_bytes: Some(128 * 1024),
2666 max_input_objects: Some(2048),
2668 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2669 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2670 max_gas_payment_objects: Some(256),
2671 max_modules_in_publish: Some(128),
2672 max_package_dependencies: None,
2673 max_arguments: Some(512),
2674 max_type_arguments: Some(16),
2675 max_type_argument_depth: Some(16),
2676 max_pure_argument_size: Some(16 * 1024),
2677 max_programmable_tx_commands: Some(1024),
2678 move_binary_format_version: Some(6),
2679 min_move_binary_format_version: None,
2680 binary_module_handles: None,
2681 binary_struct_handles: None,
2682 binary_function_handles: None,
2683 binary_function_instantiations: None,
2684 binary_signatures: None,
2685 binary_constant_pool: None,
2686 binary_identifiers: None,
2687 binary_address_identifiers: None,
2688 binary_struct_defs: None,
2689 binary_struct_def_instantiations: None,
2690 binary_function_defs: None,
2691 binary_field_handles: None,
2692 binary_field_instantiations: None,
2693 binary_friend_decls: None,
2694 binary_enum_defs: None,
2695 binary_enum_def_instantiations: None,
2696 binary_variant_handles: None,
2697 binary_variant_instantiation_handles: None,
2698 max_move_object_size: Some(250 * 1024),
2699 max_move_package_size: Some(100 * 1024),
2700 max_publish_or_upgrade_per_ptb: None,
2701 max_tx_gas: Some(10_000_000_000),
2702 max_gas_price: Some(100_000),
2703 max_gas_price_rgp_factor_for_aborted_transactions: None,
2704 max_gas_computation_bucket: Some(5_000_000),
2705 max_loop_depth: Some(5),
2706 max_generic_instantiation_length: Some(32),
2707 max_function_parameters: Some(128),
2708 max_basic_blocks: Some(1024),
2709 max_value_stack_size: Some(1024),
2710 max_type_nodes: Some(256),
2711 max_push_size: Some(10000),
2712 max_struct_definitions: Some(200),
2713 max_function_definitions: Some(1000),
2714 max_fields_in_struct: Some(32),
2715 max_dependency_depth: Some(100),
2716 max_num_event_emit: Some(256),
2717 max_num_new_move_object_ids: Some(2048),
2718 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2719 max_num_deleted_move_object_ids: Some(2048),
2720 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2721 max_num_transferred_move_object_ids: Some(2048),
2722 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2723 max_event_emit_size: Some(250 * 1024),
2724 max_move_vector_len: Some(256 * 1024),
2725 max_type_to_layout_nodes: None,
2726 max_ptb_value_size: None,
2727
2728 max_back_edges_per_function: Some(10_000),
2729 max_back_edges_per_module: Some(10_000),
2730 max_verifier_meter_ticks_per_function: Some(6_000_000),
2731 max_meter_ticks_per_module: Some(6_000_000),
2732 max_meter_ticks_per_package: None,
2733
2734 object_runtime_max_num_cached_objects: Some(1000),
2735 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2736 object_runtime_max_num_store_entries: Some(1000),
2737 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2738 base_tx_cost_fixed: Some(110_000),
2739 package_publish_cost_fixed: Some(1_000),
2740 base_tx_cost_per_byte: Some(0),
2741 package_publish_cost_per_byte: Some(80),
2742 obj_access_cost_read_per_byte: Some(15),
2743 obj_access_cost_mutate_per_byte: Some(40),
2744 obj_access_cost_delete_per_byte: Some(40),
2745 obj_access_cost_verify_per_byte: Some(200),
2746 obj_data_cost_refundable: Some(100),
2747 obj_metadata_cost_non_refundable: Some(50),
2748 gas_model_version: Some(1),
2749 storage_rebate_rate: Some(9900),
2750 storage_fund_reinvest_rate: Some(500),
2751 reward_slashing_rate: Some(5000),
2752 storage_gas_price: Some(1),
2753 accumulator_object_storage_cost: None,
2754 max_transactions_per_checkpoint: Some(10_000),
2755 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2756
2757 buffer_stake_for_protocol_upgrade_bps: Some(0),
2760
2761 address_from_bytes_cost_base: Some(52),
2765 address_to_u256_cost_base: Some(52),
2767 address_from_u256_cost_base: Some(52),
2769
2770 config_read_setting_impl_cost_base: None,
2773 config_read_setting_impl_cost_per_byte: None,
2774
2775 dynamic_field_hash_type_and_key_cost_base: Some(100),
2778 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2779 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2780 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2781 dynamic_field_add_child_object_cost_base: Some(100),
2783 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2784 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2785 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2786 dynamic_field_borrow_child_object_cost_base: Some(100),
2788 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2789 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2790 dynamic_field_remove_child_object_cost_base: Some(100),
2792 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2793 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2794 dynamic_field_has_child_object_cost_base: Some(100),
2796 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2798 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2799 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2800
2801 event_emit_cost_base: Some(52),
2804 event_emit_value_size_derivation_cost_per_byte: Some(2),
2805 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2806 event_emit_output_cost_per_byte: Some(10),
2807 event_emit_auth_stream_cost: None,
2808
2809 object_borrow_uid_cost_base: Some(52),
2812 object_delete_impl_cost_base: Some(52),
2814 object_record_new_uid_cost_base: Some(52),
2816
2817 transfer_transfer_internal_cost_base: Some(52),
2820 transfer_party_transfer_internal_cost_base: None,
2822 transfer_freeze_object_cost_base: Some(52),
2824 transfer_share_object_cost_base: Some(52),
2826 transfer_receive_object_cost_base: None,
2827
2828 tx_context_derive_id_cost_base: Some(52),
2831 tx_context_fresh_id_cost_base: None,
2832 tx_context_sender_cost_base: None,
2833 tx_context_epoch_cost_base: None,
2834 tx_context_epoch_timestamp_ms_cost_base: None,
2835 tx_context_sponsor_cost_base: None,
2836 tx_context_rgp_cost_base: None,
2837 tx_context_gas_price_cost_base: None,
2838 tx_context_gas_budget_cost_base: None,
2839 tx_context_ids_created_cost_base: None,
2840 tx_context_replace_cost_base: None,
2841
2842 types_is_one_time_witness_cost_base: Some(52),
2845 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2846 types_is_one_time_witness_type_cost_per_byte: Some(2),
2847
2848 validator_validate_metadata_cost_base: Some(52),
2851 validator_validate_metadata_data_cost_per_byte: Some(2),
2852
2853 crypto_invalid_arguments_cost: Some(100),
2855 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2857 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2858 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2859
2860 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2862 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2863 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2864
2865 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2867 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2868 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2869 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2870 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2871 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2872
2873 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2875
2876 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2878 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2879 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2880 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2881 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2882 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2883
2884 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2886 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2887 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2888 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
2889 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2890 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
2891
2892 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
2894 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
2895 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
2896 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
2897 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
2898 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
2899
2900 ecvrf_ecvrf_verify_cost_base: Some(52),
2902 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
2903 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
2904
2905 ed25519_ed25519_verify_cost_base: Some(52),
2907 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
2908 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
2909
2910 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
2912 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
2913
2914 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
2916 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
2917 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
2918 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
2919 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
2920
2921 hash_blake2b256_cost_base: Some(52),
2923 hash_blake2b256_data_cost_per_byte: Some(2),
2924 hash_blake2b256_data_cost_per_block: Some(2),
2925 hash_keccak256_cost_base: Some(52),
2927 hash_keccak256_data_cost_per_byte: Some(2),
2928 hash_keccak256_data_cost_per_block: Some(2),
2929
2930 poseidon_bn254_cost_base: None,
2931 poseidon_bn254_cost_per_block: None,
2932
2933 hmac_hmac_sha3_256_cost_base: Some(52),
2935 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
2936 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
2937
2938 group_ops_bls12381_decode_scalar_cost: None,
2940 group_ops_bls12381_decode_g1_cost: None,
2941 group_ops_bls12381_decode_g2_cost: None,
2942 group_ops_bls12381_decode_gt_cost: None,
2943 group_ops_bls12381_scalar_add_cost: None,
2944 group_ops_bls12381_g1_add_cost: None,
2945 group_ops_bls12381_g2_add_cost: None,
2946 group_ops_bls12381_gt_add_cost: None,
2947 group_ops_bls12381_scalar_sub_cost: None,
2948 group_ops_bls12381_g1_sub_cost: None,
2949 group_ops_bls12381_g2_sub_cost: None,
2950 group_ops_bls12381_gt_sub_cost: None,
2951 group_ops_bls12381_scalar_mul_cost: None,
2952 group_ops_bls12381_g1_mul_cost: None,
2953 group_ops_bls12381_g2_mul_cost: None,
2954 group_ops_bls12381_gt_mul_cost: None,
2955 group_ops_bls12381_scalar_div_cost: None,
2956 group_ops_bls12381_g1_div_cost: None,
2957 group_ops_bls12381_g2_div_cost: None,
2958 group_ops_bls12381_gt_div_cost: None,
2959 group_ops_bls12381_g1_hash_to_base_cost: None,
2960 group_ops_bls12381_g2_hash_to_base_cost: None,
2961 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
2962 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
2963 group_ops_bls12381_g1_msm_base_cost: None,
2964 group_ops_bls12381_g2_msm_base_cost: None,
2965 group_ops_bls12381_g1_msm_base_cost_per_input: None,
2966 group_ops_bls12381_g2_msm_base_cost_per_input: None,
2967 group_ops_bls12381_msm_max_len: None,
2968 group_ops_bls12381_pairing_cost: None,
2969 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
2970 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
2971 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
2972 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
2973 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
2974
2975 check_zklogin_id_cost_base: None,
2977 check_zklogin_issuer_cost_base: None,
2979
2980 vdf_verify_vdf_cost: None,
2981 vdf_hash_to_input_cost: None,
2982
2983 nitro_attestation_parse_base_cost: None,
2985 nitro_attestation_parse_cost_per_byte: None,
2986 nitro_attestation_verify_base_cost: None,
2987 nitro_attestation_verify_cost_per_cert: None,
2988
2989 bcs_per_byte_serialized_cost: None,
2990 bcs_legacy_min_output_size_cost: None,
2991 bcs_failure_cost: None,
2992 hash_sha2_256_base_cost: None,
2993 hash_sha2_256_per_byte_cost: None,
2994 hash_sha2_256_legacy_min_input_len_cost: None,
2995 hash_sha3_256_base_cost: None,
2996 hash_sha3_256_per_byte_cost: None,
2997 hash_sha3_256_legacy_min_input_len_cost: None,
2998 type_name_get_base_cost: None,
2999 type_name_get_per_byte_cost: None,
3000 type_name_id_base_cost: None,
3001 string_check_utf8_base_cost: None,
3002 string_check_utf8_per_byte_cost: None,
3003 string_is_char_boundary_base_cost: None,
3004 string_sub_string_base_cost: None,
3005 string_sub_string_per_byte_cost: None,
3006 string_index_of_base_cost: None,
3007 string_index_of_per_byte_pattern_cost: None,
3008 string_index_of_per_byte_searched_cost: None,
3009 vector_empty_base_cost: None,
3010 vector_length_base_cost: None,
3011 vector_push_back_base_cost: None,
3012 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3013 vector_borrow_base_cost: None,
3014 vector_pop_back_base_cost: None,
3015 vector_destroy_empty_base_cost: None,
3016 vector_swap_base_cost: None,
3017 debug_print_base_cost: None,
3018 debug_print_stack_trace_base_cost: None,
3019
3020 max_size_written_objects: None,
3021 max_size_written_objects_system_tx: None,
3022
3023 max_move_identifier_len: None,
3030 max_move_value_depth: None,
3031 max_move_enum_variants: None,
3032
3033 gas_rounding_step: None,
3034
3035 execution_version: None,
3036
3037 max_event_emit_size_total: None,
3038
3039 consensus_bad_nodes_stake_threshold: None,
3040
3041 max_jwk_votes_per_validator_per_epoch: None,
3042
3043 max_age_of_jwk_in_epochs: None,
3044
3045 random_beacon_reduction_allowed_delta: None,
3046
3047 random_beacon_reduction_lower_bound: None,
3048
3049 random_beacon_dkg_timeout_round: None,
3050
3051 random_beacon_min_round_interval_ms: None,
3052
3053 random_beacon_dkg_version: None,
3054
3055 consensus_max_transaction_size_bytes: None,
3056
3057 consensus_max_transactions_in_block_bytes: None,
3058
3059 consensus_max_num_transactions_in_block: None,
3060
3061 consensus_voting_rounds: None,
3062
3063 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3064
3065 max_deferral_rounds_for_congestion_control: None,
3066
3067 max_txn_cost_overage_per_object_in_commit: None,
3068
3069 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3070
3071 min_checkpoint_interval_ms: None,
3072
3073 checkpoint_summary_version_specific_data: None,
3074
3075 max_soft_bundle_size: None,
3076
3077 bridge_should_try_to_finalize_committee: None,
3078
3079 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3080
3081 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3082
3083 consensus_gc_depth: None,
3084
3085 gas_budget_based_txn_cost_cap_factor: None,
3086
3087 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3088
3089 sip_45_consensus_amplification_threshold: None,
3090
3091 use_object_per_epoch_marker_table_v2: None,
3092
3093 consensus_commit_rate_estimation_window_size: None,
3094
3095 aliased_addresses: vec![],
3096
3097 translation_per_command_base_charge: None,
3098 translation_per_input_base_charge: None,
3099 translation_pure_input_per_byte_charge: None,
3100 translation_per_type_node_charge: None,
3101 translation_per_reference_node_charge: None,
3102 translation_per_linkage_entry_charge: None,
3103
3104 max_updates_per_settlement_txn: None,
3105 };
3108 for cur in 2..=version.0 {
3109 match cur {
3110 1 => unreachable!(),
3111 2 => {
3112 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3113 }
3114 3 => {
3115 cfg.gas_model_version = Some(2);
3117 cfg.max_tx_gas = Some(50_000_000_000);
3119 cfg.base_tx_cost_fixed = Some(2_000);
3121 cfg.storage_gas_price = Some(76);
3123 cfg.feature_flags.loaded_child_objects_fixed = true;
3124 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3127 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3130 cfg.feature_flags.package_upgrades = true;
3131 }
3132 4 => {
3137 cfg.reward_slashing_rate = Some(10000);
3139 cfg.gas_model_version = Some(3);
3141 }
3142 5 => {
3143 cfg.feature_flags.missing_type_is_compatibility_error = true;
3144 cfg.gas_model_version = Some(4);
3145 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3146 }
3150 6 => {
3151 cfg.gas_model_version = Some(5);
3152 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3153 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3154 }
3155 7 => {
3156 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3157 cfg.feature_flags
3158 .disable_invariant_violation_check_in_swap_loc = true;
3159 cfg.feature_flags.ban_entry_init = true;
3160 cfg.feature_flags.package_digest_hash_module = true;
3161 }
3162 8 => {
3163 cfg.feature_flags
3164 .disallow_change_struct_type_params_on_upgrade = true;
3165 }
3166 9 => {
3167 cfg.max_move_identifier_len = Some(128);
3169 cfg.feature_flags.no_extraneous_module_bytes = true;
3170 cfg.feature_flags
3171 .advance_to_highest_supported_protocol_version = true;
3172 }
3173 10 => {
3174 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3175 cfg.max_meter_ticks_per_module = Some(16_000_000);
3176 }
3177 11 => {
3178 cfg.max_move_value_depth = Some(128);
3179 }
3180 12 => {
3181 cfg.feature_flags.narwhal_versioned_metadata = true;
3182 if chain != Chain::Mainnet {
3183 cfg.feature_flags.commit_root_state_digest = true;
3184 }
3185
3186 if chain != Chain::Mainnet && chain != Chain::Testnet {
3187 cfg.feature_flags.zklogin_auth = true;
3188 }
3189 }
3190 13 => {}
3191 14 => {
3192 cfg.gas_rounding_step = Some(1_000);
3193 cfg.gas_model_version = Some(6);
3194 }
3195 15 => {
3196 cfg.feature_flags.consensus_transaction_ordering =
3197 ConsensusTransactionOrdering::ByGasPrice;
3198 }
3199 16 => {
3200 cfg.feature_flags.simplified_unwrap_then_delete = true;
3201 }
3202 17 => {
3203 cfg.feature_flags.upgraded_multisig_supported = true;
3204 }
3205 18 => {
3206 cfg.execution_version = Some(1);
3207 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3216 cfg.base_tx_cost_fixed = Some(1_000);
3218 }
3219 19 => {
3220 cfg.max_num_event_emit = Some(1024);
3221 cfg.max_event_emit_size_total = Some(
3224 256 * 250 * 1024, );
3226 }
3227 20 => {
3228 cfg.feature_flags.commit_root_state_digest = true;
3229
3230 if chain != Chain::Mainnet {
3231 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3232 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3233 }
3234 }
3235
3236 21 => {
3237 if chain != Chain::Mainnet {
3238 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3239 "Google".to_string(),
3240 "Facebook".to_string(),
3241 "Twitch".to_string(),
3242 ]);
3243 }
3244 }
3245 22 => {
3246 cfg.feature_flags.loaded_child_object_format = true;
3247 }
3248 23 => {
3249 cfg.feature_flags.loaded_child_object_format_type = true;
3250 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3251 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3257 }
3258 24 => {
3259 cfg.feature_flags.simple_conservation_checks = true;
3260 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3261
3262 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3263
3264 if chain != Chain::Mainnet {
3265 cfg.feature_flags.enable_jwk_consensus_updates = true;
3266 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3268 cfg.max_age_of_jwk_in_epochs = Some(1);
3269 }
3270 }
3271 25 => {
3272 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3274 "Google".to_string(),
3275 "Facebook".to_string(),
3276 "Twitch".to_string(),
3277 ]);
3278 cfg.feature_flags.zklogin_auth = true;
3279
3280 cfg.feature_flags.enable_jwk_consensus_updates = true;
3282 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3283 cfg.max_age_of_jwk_in_epochs = Some(1);
3284 }
3285 26 => {
3286 cfg.gas_model_version = Some(7);
3287 if chain != Chain::Mainnet && chain != Chain::Testnet {
3289 cfg.transfer_receive_object_cost_base = Some(52);
3290 cfg.feature_flags.receive_objects = true;
3291 }
3292 }
3293 27 => {
3294 cfg.gas_model_version = Some(8);
3295 }
3296 28 => {
3297 cfg.check_zklogin_id_cost_base = Some(200);
3299 cfg.check_zklogin_issuer_cost_base = Some(200);
3301
3302 if chain != Chain::Mainnet && chain != Chain::Testnet {
3304 cfg.feature_flags.enable_effects_v2 = true;
3305 }
3306 }
3307 29 => {
3308 cfg.feature_flags.verify_legacy_zklogin_address = true;
3309 }
3310 30 => {
3311 if chain != Chain::Mainnet {
3313 cfg.feature_flags.narwhal_certificate_v2 = true;
3314 }
3315
3316 cfg.random_beacon_reduction_allowed_delta = Some(800);
3317 if chain != Chain::Mainnet {
3319 cfg.feature_flags.enable_effects_v2 = true;
3320 }
3321
3322 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3326
3327 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3328 }
3329 31 => {
3330 cfg.execution_version = Some(2);
3331 if chain != Chain::Mainnet && chain != Chain::Testnet {
3333 cfg.feature_flags.shared_object_deletion = true;
3334 }
3335 }
3336 32 => {
3337 if chain != Chain::Mainnet {
3339 cfg.feature_flags.accept_zklogin_in_multisig = true;
3340 }
3341 if chain != Chain::Mainnet {
3343 cfg.transfer_receive_object_cost_base = Some(52);
3344 cfg.feature_flags.receive_objects = true;
3345 }
3346 if chain != Chain::Mainnet && chain != Chain::Testnet {
3348 cfg.feature_flags.random_beacon = true;
3349 cfg.random_beacon_reduction_lower_bound = Some(1600);
3350 cfg.random_beacon_dkg_timeout_round = Some(3000);
3351 cfg.random_beacon_min_round_interval_ms = Some(150);
3352 }
3353 if chain != Chain::Testnet && chain != Chain::Mainnet {
3355 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3356 }
3357
3358 cfg.feature_flags.narwhal_certificate_v2 = true;
3360 }
3361 33 => {
3362 cfg.feature_flags.hardened_otw_check = true;
3363 cfg.feature_flags.allow_receiving_object_id = true;
3364
3365 cfg.transfer_receive_object_cost_base = Some(52);
3367 cfg.feature_flags.receive_objects = true;
3368
3369 if chain != Chain::Mainnet {
3371 cfg.feature_flags.shared_object_deletion = true;
3372 }
3373
3374 cfg.feature_flags.enable_effects_v2 = true;
3375 }
3376 34 => {}
3377 35 => {
3378 if chain != Chain::Mainnet && chain != Chain::Testnet {
3380 cfg.feature_flags.enable_poseidon = true;
3381 cfg.poseidon_bn254_cost_base = Some(260);
3382 cfg.poseidon_bn254_cost_per_block = Some(10);
3383 }
3384
3385 cfg.feature_flags.enable_coin_deny_list = true;
3386 }
3387 36 => {
3388 if chain != Chain::Mainnet && chain != Chain::Testnet {
3390 cfg.feature_flags.enable_group_ops_native_functions = true;
3391 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3392 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3394 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3395 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3396 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3397 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3398 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3399 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3400 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3401 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3402 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3403 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3404 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3405 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3406 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3407 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3408 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3409 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3410 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3411 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3412 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3413 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3414 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3415 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3416 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3417 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3418 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3419 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3420 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3421 cfg.group_ops_bls12381_msm_max_len = Some(32);
3422 cfg.group_ops_bls12381_pairing_cost = Some(52);
3423 }
3424 cfg.feature_flags.shared_object_deletion = true;
3426
3427 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3429 }
3431 37 => {
3432 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3433
3434 if chain != Chain::Mainnet {
3436 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3437 }
3438 }
3439 38 => {
3440 cfg.binary_module_handles = Some(100);
3441 cfg.binary_struct_handles = Some(300);
3442 cfg.binary_function_handles = Some(1500);
3443 cfg.binary_function_instantiations = Some(750);
3444 cfg.binary_signatures = Some(1000);
3445 cfg.binary_constant_pool = Some(4000);
3449 cfg.binary_identifiers = Some(10000);
3450 cfg.binary_address_identifiers = Some(100);
3451 cfg.binary_struct_defs = Some(200);
3452 cfg.binary_struct_def_instantiations = Some(100);
3453 cfg.binary_function_defs = Some(1000);
3454 cfg.binary_field_handles = Some(500);
3455 cfg.binary_field_instantiations = Some(250);
3456 cfg.binary_friend_decls = Some(100);
3457 cfg.max_package_dependencies = Some(32);
3459 cfg.max_modules_in_publish = Some(64);
3460 cfg.execution_version = Some(3);
3462 }
3463 39 => {
3464 }
3466 40 => {}
3467 41 => {
3468 cfg.feature_flags.enable_group_ops_native_functions = true;
3470 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3472 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3473 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3474 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3475 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3476 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3477 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3478 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3479 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3480 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3481 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3482 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3483 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3484 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3485 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3486 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3487 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3488 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3489 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3490 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3491 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3492 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3493 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3494 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3495 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3496 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3497 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3498 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3499 cfg.group_ops_bls12381_msm_max_len = Some(32);
3500 cfg.group_ops_bls12381_pairing_cost = Some(52);
3501 }
3502 42 => {}
3503 43 => {
3504 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3505 cfg.max_meter_ticks_per_package = Some(16_000_000);
3506 }
3507 44 => {
3508 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3510 if chain != Chain::Mainnet {
3512 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3513 }
3514 }
3515 45 => {
3516 if chain != Chain::Testnet && chain != Chain::Mainnet {
3518 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3519 }
3520
3521 if chain != Chain::Mainnet {
3522 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3524 }
3525 cfg.min_move_binary_format_version = Some(6);
3526 cfg.feature_flags.accept_zklogin_in_multisig = true;
3527
3528 if chain != Chain::Mainnet && chain != Chain::Testnet {
3532 cfg.feature_flags.bridge = true;
3533 }
3534 }
3535 46 => {
3536 if chain != Chain::Mainnet {
3538 cfg.feature_flags.bridge = true;
3539 }
3540
3541 cfg.feature_flags.reshare_at_same_initial_version = true;
3543 }
3544 47 => {}
3545 48 => {
3546 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3548
3549 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3551
3552 if chain != Chain::Mainnet {
3554 cfg.feature_flags.random_beacon = true;
3555 cfg.random_beacon_reduction_lower_bound = Some(1600);
3556 cfg.random_beacon_dkg_timeout_round = Some(3000);
3557 cfg.random_beacon_min_round_interval_ms = Some(200);
3558 }
3559
3560 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3562 }
3563 49 => {
3564 if chain != Chain::Testnet && chain != Chain::Mainnet {
3565 cfg.move_binary_format_version = Some(7);
3566 }
3567
3568 if chain != Chain::Mainnet && chain != Chain::Testnet {
3570 cfg.feature_flags.enable_vdf = true;
3571 cfg.vdf_verify_vdf_cost = Some(1500);
3574 cfg.vdf_hash_to_input_cost = Some(100);
3575 }
3576
3577 if chain != Chain::Testnet && chain != Chain::Mainnet {
3579 cfg.feature_flags
3580 .record_consensus_determined_version_assignments_in_prologue = true;
3581 }
3582
3583 if chain != Chain::Mainnet {
3585 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3586 }
3587
3588 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3590 }
3591 50 => {
3592 if chain != Chain::Mainnet {
3594 cfg.checkpoint_summary_version_specific_data = Some(1);
3595 cfg.min_checkpoint_interval_ms = Some(200);
3596 }
3597
3598 if chain != Chain::Testnet && chain != Chain::Mainnet {
3600 cfg.feature_flags
3601 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3602 }
3603
3604 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3605
3606 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3608 }
3609 51 => {
3610 cfg.random_beacon_dkg_version = Some(1);
3611
3612 if chain != Chain::Testnet && chain != Chain::Mainnet {
3613 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3614 }
3615 }
3616 52 => {
3617 if chain != Chain::Mainnet {
3618 cfg.feature_flags.soft_bundle = true;
3619 cfg.max_soft_bundle_size = Some(5);
3620 }
3621
3622 cfg.config_read_setting_impl_cost_base = Some(100);
3623 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3624
3625 if chain != Chain::Testnet && chain != Chain::Mainnet {
3627 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3628 cfg.feature_flags.per_object_congestion_control_mode =
3629 PerObjectCongestionControlMode::TotalTxCount;
3630 }
3631
3632 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3634
3635 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3637
3638 cfg.checkpoint_summary_version_specific_data = Some(1);
3640 cfg.min_checkpoint_interval_ms = Some(200);
3641
3642 if chain != Chain::Mainnet {
3644 cfg.feature_flags
3645 .record_consensus_determined_version_assignments_in_prologue = true;
3646 cfg.feature_flags
3647 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3648 }
3649 if chain != Chain::Mainnet {
3651 cfg.move_binary_format_version = Some(7);
3652 }
3653
3654 if chain != Chain::Testnet && chain != Chain::Mainnet {
3655 cfg.feature_flags.passkey_auth = true;
3656 }
3657 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3658 }
3659 53 => {
3660 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3662
3663 cfg.feature_flags
3665 .record_consensus_determined_version_assignments_in_prologue = true;
3666 cfg.feature_flags
3667 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3668
3669 if chain == Chain::Unknown {
3670 cfg.feature_flags.authority_capabilities_v2 = true;
3671 }
3672
3673 if chain != Chain::Mainnet {
3675 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3676 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3677 cfg.feature_flags.per_object_congestion_control_mode =
3678 PerObjectCongestionControlMode::TotalTxCount;
3679 }
3680
3681 cfg.bcs_per_byte_serialized_cost = Some(2);
3683 cfg.bcs_legacy_min_output_size_cost = Some(1);
3684 cfg.bcs_failure_cost = Some(52);
3685 cfg.debug_print_base_cost = Some(52);
3686 cfg.debug_print_stack_trace_base_cost = Some(52);
3687 cfg.hash_sha2_256_base_cost = Some(52);
3688 cfg.hash_sha2_256_per_byte_cost = Some(2);
3689 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3690 cfg.hash_sha3_256_base_cost = Some(52);
3691 cfg.hash_sha3_256_per_byte_cost = Some(2);
3692 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3693 cfg.type_name_get_base_cost = Some(52);
3694 cfg.type_name_get_per_byte_cost = Some(2);
3695 cfg.string_check_utf8_base_cost = Some(52);
3696 cfg.string_check_utf8_per_byte_cost = Some(2);
3697 cfg.string_is_char_boundary_base_cost = Some(52);
3698 cfg.string_sub_string_base_cost = Some(52);
3699 cfg.string_sub_string_per_byte_cost = Some(2);
3700 cfg.string_index_of_base_cost = Some(52);
3701 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3702 cfg.string_index_of_per_byte_searched_cost = Some(2);
3703 cfg.vector_empty_base_cost = Some(52);
3704 cfg.vector_length_base_cost = Some(52);
3705 cfg.vector_push_back_base_cost = Some(52);
3706 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3707 cfg.vector_borrow_base_cost = Some(52);
3708 cfg.vector_pop_back_base_cost = Some(52);
3709 cfg.vector_destroy_empty_base_cost = Some(52);
3710 cfg.vector_swap_base_cost = Some(52);
3711 }
3712 54 => {
3713 cfg.feature_flags.random_beacon = true;
3715 cfg.random_beacon_reduction_lower_bound = Some(1000);
3716 cfg.random_beacon_dkg_timeout_round = Some(3000);
3717 cfg.random_beacon_min_round_interval_ms = Some(500);
3718
3719 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 cfg.feature_flags.soft_bundle = true;
3727 cfg.max_soft_bundle_size = Some(5);
3728 }
3729 55 => {
3730 cfg.move_binary_format_version = Some(7);
3732
3733 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3735 cfg.consensus_max_num_transactions_in_block = Some(512);
3738
3739 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3740 }
3741 56 => {
3742 if chain == Chain::Mainnet {
3743 cfg.feature_flags.bridge = true;
3744 }
3745 }
3746 57 => {
3747 cfg.random_beacon_reduction_lower_bound = Some(800);
3749 }
3750 58 => {
3751 if chain == Chain::Mainnet {
3752 cfg.bridge_should_try_to_finalize_committee = Some(true);
3753 }
3754
3755 if chain != Chain::Mainnet && chain != Chain::Testnet {
3756 cfg.feature_flags
3758 .consensus_distributed_vote_scoring_strategy = true;
3759 }
3760 }
3761 59 => {
3762 cfg.feature_flags.consensus_round_prober = true;
3764 }
3765 60 => {
3766 cfg.max_type_to_layout_nodes = Some(512);
3767 cfg.feature_flags.validate_identifier_inputs = true;
3768 }
3769 61 => {
3770 if chain != Chain::Mainnet {
3771 cfg.feature_flags
3773 .consensus_distributed_vote_scoring_strategy = true;
3774 }
3775 cfg.random_beacon_reduction_lower_bound = Some(700);
3777
3778 if chain != Chain::Mainnet && chain != Chain::Testnet {
3779 cfg.feature_flags.mysticeti_fastpath = true;
3781 }
3782 }
3783 62 => {
3784 cfg.feature_flags.relocate_event_module = true;
3785 }
3786 63 => {
3787 cfg.feature_flags.per_object_congestion_control_mode =
3788 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3789 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3790 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3791 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3792 }
3793 64 => {
3794 cfg.feature_flags.per_object_congestion_control_mode =
3795 PerObjectCongestionControlMode::TotalTxCount;
3796 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3797 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3798 }
3799 65 => {
3800 cfg.feature_flags
3802 .consensus_distributed_vote_scoring_strategy = true;
3803 }
3804 66 => {
3805 if chain == Chain::Mainnet {
3806 cfg.feature_flags
3808 .consensus_distributed_vote_scoring_strategy = false;
3809 }
3810 }
3811 67 => {
3812 cfg.feature_flags
3814 .consensus_distributed_vote_scoring_strategy = true;
3815 }
3816 68 => {
3817 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3818 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3819 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3820 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3821 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3822
3823 if chain != Chain::Mainnet && chain != Chain::Testnet {
3824 cfg.feature_flags.uncompressed_g1_group_elements = true;
3825 }
3826
3827 cfg.feature_flags.per_object_congestion_control_mode =
3828 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3829 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3830 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3831 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3832 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3834 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3835
3836 cfg.random_beacon_reduction_lower_bound = Some(500);
3838
3839 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3840 }
3841 69 => {
3842 cfg.consensus_voting_rounds = Some(40);
3844
3845 if chain != Chain::Mainnet && chain != Chain::Testnet {
3846 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3848 }
3849
3850 if chain != Chain::Mainnet {
3851 cfg.feature_flags.uncompressed_g1_group_elements = true;
3852 }
3853 }
3854 70 => {
3855 if chain != Chain::Mainnet {
3856 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3858 cfg.feature_flags
3860 .consensus_round_prober_probe_accepted_rounds = true;
3861 }
3862
3863 cfg.poseidon_bn254_cost_per_block = Some(388);
3864
3865 cfg.gas_model_version = Some(9);
3866 cfg.feature_flags.native_charging_v2 = true;
3867 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
3868 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
3869 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
3870 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
3871 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
3872 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
3873 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
3874 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
3875
3876 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
3878 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
3879 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
3880 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
3881
3882 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
3883 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
3884 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
3885 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
3886 Some(8213);
3887 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
3888 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
3889 Some(9484);
3890
3891 cfg.hash_keccak256_cost_base = Some(10);
3892 cfg.hash_blake2b256_cost_base = Some(10);
3893
3894 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
3896 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
3897 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
3898 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
3899
3900 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
3901 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
3902 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
3903 cfg.group_ops_bls12381_gt_add_cost = Some(188);
3904
3905 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
3906 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
3907 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
3908 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
3909
3910 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
3911 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
3912 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
3913 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
3914
3915 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
3916 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
3917 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
3918 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
3919
3920 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
3921 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
3922
3923 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
3924 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
3925 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
3926 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
3927
3928 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
3929 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
3930 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
3931 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
3932
3933 cfg.group_ops_bls12381_pairing_cost = Some(26897);
3934 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
3935
3936 cfg.validator_validate_metadata_cost_base = Some(20000);
3937 }
3938 71 => {
3939 cfg.sip_45_consensus_amplification_threshold = Some(5);
3940
3941 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
3943 }
3944 72 => {
3945 cfg.feature_flags.convert_type_argument_error = true;
3946
3947 cfg.max_tx_gas = Some(50_000_000_000_000);
3950 cfg.max_gas_price = Some(50_000_000_000);
3952
3953 cfg.feature_flags.variant_nodes = true;
3954 }
3955 73 => {
3956 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
3958
3959 if chain != Chain::Mainnet && chain != Chain::Testnet {
3960 cfg.consensus_gc_depth = Some(60);
3963 }
3964
3965 if chain != Chain::Mainnet {
3966 cfg.feature_flags.consensus_zstd_compression = true;
3968 }
3969
3970 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3972 cfg.feature_flags
3974 .consensus_round_prober_probe_accepted_rounds = true;
3975
3976 cfg.feature_flags.per_object_congestion_control_mode =
3978 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3979 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3980 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
3981 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3982 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3984 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3985 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
3986 }
3987 74 => {
3988 if chain != Chain::Mainnet && chain != Chain::Testnet {
3990 cfg.feature_flags.enable_nitro_attestation = true;
3991 }
3992 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
3993 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
3994 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
3995 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
3996
3997 cfg.feature_flags.consensus_zstd_compression = true;
3999
4000 if chain != Chain::Mainnet && chain != Chain::Testnet {
4001 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4002 }
4003 }
4004 75 => {
4005 if chain != Chain::Mainnet {
4006 cfg.feature_flags.passkey_auth = true;
4007 }
4008 }
4009 76 => {
4010 if chain != Chain::Mainnet && chain != Chain::Testnet {
4011 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4012 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4013 }
4014 cfg.feature_flags.minimize_child_object_mutations = true;
4015
4016 if chain != Chain::Mainnet {
4017 cfg.feature_flags.accept_passkey_in_multisig = true;
4018 }
4019 }
4020 77 => {
4021 cfg.feature_flags.uncompressed_g1_group_elements = true;
4022
4023 if chain != Chain::Mainnet {
4024 cfg.consensus_gc_depth = Some(60);
4025 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4026 }
4027 }
4028 78 => {
4029 cfg.feature_flags.move_native_context = true;
4030 cfg.tx_context_fresh_id_cost_base = Some(52);
4031 cfg.tx_context_sender_cost_base = Some(30);
4032 cfg.tx_context_epoch_cost_base = Some(30);
4033 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4034 cfg.tx_context_sponsor_cost_base = Some(30);
4035 cfg.tx_context_gas_price_cost_base = Some(30);
4036 cfg.tx_context_gas_budget_cost_base = Some(30);
4037 cfg.tx_context_ids_created_cost_base = Some(30);
4038 cfg.tx_context_replace_cost_base = Some(30);
4039 cfg.gas_model_version = Some(10);
4040
4041 if chain != Chain::Mainnet {
4042 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4043 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4044
4045 cfg.feature_flags.per_object_congestion_control_mode =
4047 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4048 ExecutionTimeEstimateParams {
4049 target_utilization: 30,
4050 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4052 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4054 stored_observations_limit: u64::MAX,
4055 stake_weighted_median_threshold: 0,
4056 default_none_duration_for_new_keys: false,
4057 observations_chunk_size: None,
4058 },
4059 );
4060 }
4061 }
4062 79 => {
4063 if chain != Chain::Mainnet {
4064 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4065
4066 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4069
4070 cfg.feature_flags.consensus_batched_block_sync = true;
4071
4072 cfg.feature_flags.enable_nitro_attestation = true
4074 }
4075 cfg.feature_flags.normalize_ptb_arguments = true;
4076
4077 cfg.consensus_gc_depth = Some(60);
4078 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4079 }
4080 80 => {
4081 cfg.max_ptb_value_size = Some(1024 * 1024);
4082 }
4083 81 => {
4084 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4085 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4086 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4087 }
4088 82 => {
4089 cfg.feature_flags.max_ptb_value_size_v2 = true;
4090 }
4091 83 => {
4092 if chain == Chain::Mainnet {
4093 let aliased: [u8; 32] = Hex::decode(
4095 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4096 )
4097 .unwrap()
4098 .try_into()
4099 .unwrap();
4100
4101 cfg.aliased_addresses.push(AliasedAddress {
4103 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4104 aliased,
4105 allowed_tx_digests: vec![
4106 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4107 ],
4108 });
4109
4110 cfg.aliased_addresses.push(AliasedAddress {
4111 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4112 aliased,
4113 allowed_tx_digests: vec![
4114 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4115 ],
4116 });
4117 }
4118
4119 if chain != Chain::Mainnet {
4122 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4123 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4124
4125 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4127 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4128 cfg.feature_flags.per_object_congestion_control_mode =
4129 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4130 ExecutionTimeEstimateParams {
4131 target_utilization: 30,
4132 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4134 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4136 stored_observations_limit: u64::MAX,
4137 stake_weighted_median_threshold: 0,
4138 default_none_duration_for_new_keys: false,
4139 observations_chunk_size: None,
4140 },
4141 );
4142
4143 cfg.feature_flags.consensus_batched_block_sync = true;
4145
4146 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4149 cfg.feature_flags.enable_nitro_attestation = true;
4150 }
4151 }
4152 84 => {
4153 if chain == Chain::Mainnet {
4154 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4155 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4156
4157 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4159 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4160 cfg.feature_flags.per_object_congestion_control_mode =
4161 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4162 ExecutionTimeEstimateParams {
4163 target_utilization: 30,
4164 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4166 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4168 stored_observations_limit: u64::MAX,
4169 stake_weighted_median_threshold: 0,
4170 default_none_duration_for_new_keys: false,
4171 observations_chunk_size: None,
4172 },
4173 );
4174
4175 cfg.feature_flags.consensus_batched_block_sync = true;
4177
4178 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4181 cfg.feature_flags.enable_nitro_attestation = true;
4182 }
4183
4184 cfg.feature_flags.per_object_congestion_control_mode =
4186 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4187 ExecutionTimeEstimateParams {
4188 target_utilization: 30,
4189 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4191 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4193 stored_observations_limit: 20,
4194 stake_weighted_median_threshold: 0,
4195 default_none_duration_for_new_keys: false,
4196 observations_chunk_size: None,
4197 },
4198 );
4199 cfg.feature_flags.allow_unbounded_system_objects = true;
4200 }
4201 85 => {
4202 if chain != Chain::Mainnet && chain != Chain::Testnet {
4203 cfg.feature_flags.enable_party_transfer = true;
4204 }
4205
4206 cfg.feature_flags
4207 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4208 cfg.feature_flags.disallow_self_identifier = true;
4209 cfg.feature_flags.per_object_congestion_control_mode =
4210 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4211 ExecutionTimeEstimateParams {
4212 target_utilization: 50,
4213 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4215 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4217 stored_observations_limit: 20,
4218 stake_weighted_median_threshold: 0,
4219 default_none_duration_for_new_keys: false,
4220 observations_chunk_size: None,
4221 },
4222 );
4223 }
4224 86 => {
4225 cfg.feature_flags.type_tags_in_object_runtime = true;
4226 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4227
4228 cfg.feature_flags.per_object_congestion_control_mode =
4230 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4231 ExecutionTimeEstimateParams {
4232 target_utilization: 50,
4233 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4235 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4237 stored_observations_limit: 20,
4238 stake_weighted_median_threshold: 3334,
4239 default_none_duration_for_new_keys: false,
4240 observations_chunk_size: None,
4241 },
4242 );
4243 if chain != Chain::Mainnet {
4245 cfg.feature_flags.enable_party_transfer = true;
4246 }
4247 }
4248 87 => {
4249 if chain == Chain::Mainnet {
4250 cfg.feature_flags.record_time_estimate_processed = true;
4251 }
4252 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4253 }
4254 88 => {
4255 cfg.feature_flags.record_time_estimate_processed = true;
4256 cfg.tx_context_rgp_cost_base = Some(30);
4257 cfg.feature_flags
4258 .ignore_execution_time_observations_after_certs_closed = true;
4259
4260 cfg.feature_flags.per_object_congestion_control_mode =
4263 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4264 ExecutionTimeEstimateParams {
4265 target_utilization: 50,
4266 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4268 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4270 stored_observations_limit: 20,
4271 stake_weighted_median_threshold: 3334,
4272 default_none_duration_for_new_keys: true,
4273 observations_chunk_size: None,
4274 },
4275 );
4276 }
4277 89 => {
4278 cfg.feature_flags.dependency_linkage_error = true;
4279 cfg.feature_flags.additional_multisig_checks = true;
4280 }
4281 90 => {
4282 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4284 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4285 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4286 cfg.feature_flags.accept_passkey_in_multisig = true;
4287 cfg.feature_flags.passkey_auth = true;
4288 cfg.feature_flags.check_for_init_during_upgrade = true;
4289
4290 if chain != Chain::Mainnet {
4292 cfg.feature_flags.mysticeti_fastpath = true;
4293 }
4294 }
4295 91 => {
4296 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4297 }
4298 92 => {
4299 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4300 }
4301 93 => {
4302 cfg.feature_flags
4303 .consensus_checkpoint_signature_key_includes_digest = true;
4304 }
4305 94 => {
4306 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: 18,
4316 stake_weighted_median_threshold: 3334,
4317 default_none_duration_for_new_keys: true,
4318 observations_chunk_size: None,
4319 },
4320 );
4321
4322 cfg.feature_flags.enable_party_transfer = true;
4324 }
4325 95 => {
4326 cfg.type_name_id_base_cost = Some(52);
4327
4328 cfg.max_transactions_per_checkpoint = Some(20_000);
4330 }
4331 96 => {
4332 if chain != Chain::Mainnet && chain != Chain::Testnet {
4334 cfg.feature_flags
4335 .include_checkpoint_artifacts_digest_in_summary = true;
4336 }
4337 cfg.feature_flags.correct_gas_payment_limit_check = true;
4338 cfg.feature_flags.authority_capabilities_v2 = true;
4339 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4340 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4341 cfg.feature_flags.enable_coin_registry = true;
4342
4343 cfg.feature_flags.mysticeti_fastpath = true;
4345 }
4346 97 => {
4347 cfg.feature_flags.additional_borrow_checks = true;
4348 }
4349 98 => {
4350 cfg.event_emit_auth_stream_cost = Some(52);
4351 cfg.feature_flags.better_loader_errors = true;
4352 cfg.feature_flags.generate_df_type_layouts = true;
4353 }
4354 99 => {
4355 cfg.feature_flags.use_new_commit_handler = true;
4356 }
4357 100 => {
4358 cfg.feature_flags.private_generics_verifier_v2 = true;
4359 }
4360 101 => {
4361 cfg.feature_flags.create_root_accumulator_object = true;
4362 cfg.max_updates_per_settlement_txn = Some(100);
4363 if chain != Chain::Mainnet {
4364 cfg.feature_flags.enable_poseidon = true;
4365 }
4366 }
4367 102 => {
4368 cfg.feature_flags.per_object_congestion_control_mode =
4372 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4373 ExecutionTimeEstimateParams {
4374 target_utilization: 50,
4375 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4377 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4379 stored_observations_limit: 180,
4380 stake_weighted_median_threshold: 3334,
4381 default_none_duration_for_new_keys: true,
4382 observations_chunk_size: Some(18),
4383 },
4384 );
4385 cfg.feature_flags.deprecate_global_storage_ops = true;
4386 }
4387 103 => {}
4388 104 => {
4389 cfg.translation_per_command_base_charge = Some(1);
4390 cfg.translation_per_input_base_charge = Some(1);
4391 cfg.translation_pure_input_per_byte_charge = Some(1);
4392 cfg.translation_per_type_node_charge = Some(1);
4393 cfg.translation_per_reference_node_charge = Some(1);
4394 cfg.translation_per_linkage_entry_charge = Some(10);
4395 cfg.gas_model_version = Some(11);
4396 cfg.feature_flags.abstract_size_in_object_runtime = true;
4397 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4398 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4399 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4400 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4401 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4402 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4403 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4404 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4405 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4406 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4407 cfg.feature_flags.enable_ptb_execution_v2 = true;
4408
4409 cfg.poseidon_bn254_cost_base = Some(260);
4410
4411 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4412
4413 if chain != Chain::Mainnet {
4414 cfg.feature_flags
4415 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4416 }
4417
4418 cfg.feature_flags
4419 .include_cancelled_randomness_txns_in_prologue = true;
4420 }
4421 105 => {
4422 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4423 cfg.feature_flags.disable_preconsensus_locking = true;
4424
4425 if chain != Chain::Mainnet {
4426 cfg.feature_flags
4427 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4428 }
4429 }
4430 106 => {
4431 cfg.accumulator_object_storage_cost = Some(7600);
4433
4434 if chain != Chain::Mainnet && chain != Chain::Testnet {
4435 cfg.feature_flags.enable_accumulators = true;
4436 cfg.feature_flags.enable_address_balance_gas_payments = true;
4437 cfg.feature_flags.enable_authenticated_event_streams = true;
4438 cfg.feature_flags.enable_object_funds_withdraw = true;
4439 }
4440 }
4441 107 => {
4442 cfg.feature_flags
4443 .consensus_skip_gced_blocks_in_direct_finalization = true;
4444
4445 if in_integration_test() {
4447 cfg.consensus_gc_depth = Some(6);
4448 cfg.consensus_max_num_transactions_in_block = Some(8);
4449 }
4450 }
4451 108 => {
4452 cfg.feature_flags.gas_rounding_halve_digits = true;
4453 cfg.feature_flags.flexible_tx_context_positions = true;
4454 cfg.feature_flags.disable_entry_point_signature_check = true;
4455
4456 if chain != Chain::Mainnet {
4457 cfg.feature_flags.address_aliases = true;
4458
4459 cfg.feature_flags.enable_accumulators = true;
4460 cfg.feature_flags.enable_address_balance_gas_payments = true;
4461 }
4462
4463 cfg.feature_flags.enable_poseidon = true;
4464 }
4465 109 => {
4466 cfg.feature_flags
4467 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4468 cfg.feature_flags
4469 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4470 }
4471 _ => panic!("unsupported version {:?}", version),
4482 }
4483 }
4484
4485 if cfg!(msim) {
4487 }
4492
4493 cfg
4494 }
4495
4496 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4502 let (
4503 max_back_edges_per_function,
4504 max_back_edges_per_module,
4505 sanity_check_with_regex_reference_safety,
4506 ) = if let Some((
4507 max_back_edges_per_function,
4508 max_back_edges_per_module,
4509 sanity_check_with_regex_reference_safety,
4510 )) = signing_limits
4511 {
4512 (
4513 Some(max_back_edges_per_function),
4514 Some(max_back_edges_per_module),
4515 Some(sanity_check_with_regex_reference_safety),
4516 )
4517 } else {
4518 (None, None, None)
4519 };
4520
4521 let additional_borrow_checks = if signing_limits.is_some() {
4522 true
4524 } else {
4525 self.additional_borrow_checks()
4526 };
4527 let deprecate_global_storage_ops = if signing_limits.is_some() {
4528 true
4530 } else {
4531 self.deprecate_global_storage_ops()
4532 };
4533
4534 VerifierConfig {
4535 max_loop_depth: Some(self.max_loop_depth() as usize),
4536 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4537 max_function_parameters: Some(self.max_function_parameters() as usize),
4538 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4539 max_value_stack_size: self.max_value_stack_size() as usize,
4540 max_type_nodes: Some(self.max_type_nodes() as usize),
4541 max_push_size: Some(self.max_push_size() as usize),
4542 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4543 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4544 max_function_definitions: Some(self.max_function_definitions() as usize),
4545 max_data_definitions: Some(self.max_struct_definitions() as usize),
4546 max_constant_vector_len: Some(self.max_move_vector_len()),
4547 max_back_edges_per_function,
4548 max_back_edges_per_module,
4549 max_basic_blocks_in_script: None,
4550 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4552 allow_receiving_object_id: self.allow_receiving_object_id(),
4553 reject_mutable_random_on_entry_functions: self
4554 .reject_mutable_random_on_entry_functions(),
4555 bytecode_version: self.move_binary_format_version(),
4556 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4557 additional_borrow_checks,
4558 better_loader_errors: self.better_loader_errors(),
4559 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4560 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4561 .map(|limit| limit as u128),
4562 deprecate_global_storage_ops,
4563 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4564 switch_to_regex_reference_safety: false,
4565 }
4566 }
4567
4568 pub fn binary_config(
4569 &self,
4570 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4571 ) -> BinaryConfig {
4572 let deprecate_global_storage_ops =
4573 override_deprecate_global_storage_ops_during_deserialization
4574 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4575 BinaryConfig::new(
4576 self.move_binary_format_version(),
4577 self.min_move_binary_format_version_as_option()
4578 .unwrap_or(VERSION_1),
4579 self.no_extraneous_module_bytes(),
4580 deprecate_global_storage_ops,
4581 TableConfig {
4582 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4583 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4584 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4585 function_instantiations: self
4586 .binary_function_instantiations_as_option()
4587 .unwrap_or(u16::MAX),
4588 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4589 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4590 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4591 address_identifiers: self
4592 .binary_address_identifiers_as_option()
4593 .unwrap_or(u16::MAX),
4594 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4595 struct_def_instantiations: self
4596 .binary_struct_def_instantiations_as_option()
4597 .unwrap_or(u16::MAX),
4598 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4599 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4600 field_instantiations: self
4601 .binary_field_instantiations_as_option()
4602 .unwrap_or(u16::MAX),
4603 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4604 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4605 enum_def_instantiations: self
4606 .binary_enum_def_instantiations_as_option()
4607 .unwrap_or(u16::MAX),
4608 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4609 variant_instantiation_handles: self
4610 .binary_variant_instantiation_handles_as_option()
4611 .unwrap_or(u16::MAX),
4612 },
4613 )
4614 }
4615
4616 pub fn apply_overrides_for_testing(
4620 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4621 ) -> OverrideGuard {
4622 CONFIG_OVERRIDE.with(|ovr| {
4623 let mut cur = ovr.borrow_mut();
4624 assert!(cur.is_none(), "config override already present");
4625 *cur = Some(Box::new(override_fn));
4626 OverrideGuard
4627 })
4628 }
4629}
4630
4631impl ProtocolConfig {
4635 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4636 self.feature_flags
4637 .advance_to_highest_supported_protocol_version = val
4638 }
4639 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4640 self.feature_flags.commit_root_state_digest = val
4641 }
4642 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4643 self.feature_flags.zklogin_auth = val
4644 }
4645 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4646 self.feature_flags.enable_jwk_consensus_updates = val
4647 }
4648 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4649 self.feature_flags.random_beacon = val
4650 }
4651
4652 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4653 self.feature_flags.upgraded_multisig_supported = val
4654 }
4655 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4656 self.feature_flags.accept_zklogin_in_multisig = val
4657 }
4658
4659 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4660 self.feature_flags.shared_object_deletion = val;
4661 }
4662
4663 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4664 self.feature_flags.narwhal_new_leader_election_schedule = val;
4665 }
4666
4667 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4668 self.feature_flags.receive_objects = val
4669 }
4670 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4671 self.feature_flags.narwhal_certificate_v2 = val
4672 }
4673 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4674 self.feature_flags.verify_legacy_zklogin_address = val
4675 }
4676
4677 pub fn set_per_object_congestion_control_mode_for_testing(
4678 &mut self,
4679 val: PerObjectCongestionControlMode,
4680 ) {
4681 self.feature_flags.per_object_congestion_control_mode = val;
4682 }
4683
4684 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4685 self.feature_flags.consensus_choice = val;
4686 }
4687
4688 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4689 self.feature_flags.consensus_network = val;
4690 }
4691
4692 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4693 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4694 }
4695
4696 pub fn set_disable_bridge_for_testing(&mut self) {
4697 self.feature_flags.bridge = false
4698 }
4699
4700 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4701 self.feature_flags.mysticeti_num_leaders_per_round = val;
4702 }
4703
4704 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4705 self.feature_flags.soft_bundle = val;
4706 }
4707
4708 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4709 self.feature_flags.passkey_auth = val
4710 }
4711
4712 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4713 self.feature_flags.enable_party_transfer = val
4714 }
4715
4716 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4717 self.feature_flags
4718 .consensus_distributed_vote_scoring_strategy = val;
4719 }
4720
4721 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4722 self.feature_flags.consensus_round_prober = val;
4723 }
4724
4725 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4726 self.feature_flags
4727 .disallow_new_modules_in_deps_only_packages = val;
4728 }
4729
4730 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4731 self.feature_flags.correct_gas_payment_limit_check = val;
4732 }
4733
4734 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4735 self.feature_flags.address_aliases = val;
4736 }
4737
4738 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4739 self.feature_flags
4740 .consensus_round_prober_probe_accepted_rounds = val;
4741 }
4742
4743 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4744 self.feature_flags.mysticeti_fastpath = val;
4745 }
4746
4747 pub fn set_disable_preconsensus_locking_for_testing(&mut self, val: bool) {
4748 self.feature_flags.disable_preconsensus_locking = val;
4749 }
4750
4751 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4752 self.feature_flags.accept_passkey_in_multisig = val;
4753 }
4754
4755 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4756 self.feature_flags.consensus_batched_block_sync = val;
4757 }
4758
4759 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4760 self.feature_flags.record_time_estimate_processed = val;
4761 }
4762
4763 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4764 &mut self,
4765 val: bool,
4766 ) {
4767 self.feature_flags
4768 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4769 }
4770
4771 pub fn enable_accumulators_for_testing(&mut self) {
4772 self.feature_flags.enable_accumulators = true;
4773 }
4774
4775 pub fn disable_accumulators_for_testing(&mut self) {
4776 self.feature_flags.enable_accumulators = false;
4777 self.feature_flags.enable_address_balance_gas_payments = false;
4778 }
4779
4780 pub fn enable_coin_reservation_for_testing(&mut self) {
4781 self.feature_flags.enable_coin_reservation_obj_refs = true;
4782 }
4783
4784 pub fn create_root_accumulator_object_for_testing(&mut self) {
4785 self.feature_flags.create_root_accumulator_object = true;
4786 }
4787
4788 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
4789 self.feature_flags.create_root_accumulator_object = false;
4790 }
4791
4792 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
4793 self.feature_flags.enable_accumulators = true;
4794 self.feature_flags.allow_private_accumulator_entrypoints = true;
4795 self.feature_flags.enable_address_balance_gas_payments = true;
4796 }
4797
4798 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
4799 self.feature_flags.enable_address_balance_gas_payments = false;
4800 }
4801
4802 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
4803 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
4804 }
4805
4806 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
4807 self.enable_accumulators_for_testing();
4808 self.feature_flags.enable_authenticated_event_streams = true;
4809 self.feature_flags
4810 .include_checkpoint_artifacts_digest_in_summary = true;
4811 }
4812
4813 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
4814 self.feature_flags.enable_authenticated_event_streams = false;
4815 }
4816
4817 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
4818 self.feature_flags.enable_non_exclusive_writes = true;
4819 }
4820
4821 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
4822 &mut self,
4823 val: bool,
4824 ) {
4825 self.feature_flags
4826 .ignore_execution_time_observations_after_certs_closed = val;
4827 }
4828
4829 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
4830 &mut self,
4831 val: bool,
4832 ) {
4833 self.feature_flags
4834 .consensus_checkpoint_signature_key_includes_digest = val;
4835 }
4836
4837 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
4838 self.feature_flags.cancel_for_failed_dkg_early = val;
4839 }
4840
4841 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
4842 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
4843 }
4844
4845 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
4846 self.feature_flags.authority_capabilities_v2 = val;
4847 }
4848
4849 pub fn allow_references_in_ptbs_for_testing(&mut self) {
4850 self.feature_flags.allow_references_in_ptbs = true;
4851 }
4852
4853 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
4854 self.feature_flags.consensus_skip_gced_accept_votes = val;
4855 }
4856
4857 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
4858 self.feature_flags.enable_object_funds_withdraw = val;
4859 }
4860}
4861
4862type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
4863
4864thread_local! {
4865 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
4866}
4867
4868#[must_use]
4869pub struct OverrideGuard;
4870
4871impl Drop for OverrideGuard {
4872 fn drop(&mut self) {
4873 info!("restoring override fn");
4874 CONFIG_OVERRIDE.with(|ovr| {
4875 *ovr.borrow_mut() = None;
4876 });
4877 }
4878}
4879
4880#[derive(PartialEq, Eq)]
4883pub enum LimitThresholdCrossed {
4884 None,
4885 Soft(u128, u128),
4886 Hard(u128, u128),
4887}
4888
4889pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
4892 x: T,
4893 soft_limit: U,
4894 hard_limit: V,
4895) -> LimitThresholdCrossed {
4896 let x: V = x.into();
4897 let soft_limit: V = soft_limit.into();
4898
4899 debug_assert!(soft_limit <= hard_limit);
4900
4901 if x >= hard_limit {
4904 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
4905 } else if x < soft_limit {
4906 LimitThresholdCrossed::None
4907 } else {
4908 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
4909 }
4910}
4911
4912#[macro_export]
4913macro_rules! check_limit {
4914 ($x:expr, $hard:expr) => {
4915 check_limit!($x, $hard, $hard)
4916 };
4917 ($x:expr, $soft:expr, $hard:expr) => {
4918 check_limit_in_range($x as u64, $soft, $hard)
4919 };
4920}
4921
4922#[macro_export]
4926macro_rules! check_limit_by_meter {
4927 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
4928 let (h, metered_str) = if $is_metered {
4930 ($metered_limit, "metered")
4931 } else {
4932 ($unmetered_hard_limit, "unmetered")
4934 };
4935 use sui_protocol_config::check_limit_in_range;
4936 let result = check_limit_in_range($x as u64, $metered_limit, h);
4937 match result {
4938 LimitThresholdCrossed::None => {}
4939 LimitThresholdCrossed::Soft(_, _) => {
4940 $metric.with_label_values(&[metered_str, "soft"]).inc();
4941 }
4942 LimitThresholdCrossed::Hard(_, _) => {
4943 $metric.with_label_values(&[metered_str, "hard"]).inc();
4944 }
4945 };
4946 result
4947 }};
4948}
4949#[cfg(all(test, not(msim)))]
4950mod test {
4951 use insta::assert_yaml_snapshot;
4952
4953 use super::*;
4954
4955 #[test]
4956 fn snapshot_tests() {
4957 println!("\n============================================================================");
4958 println!("! !");
4959 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
4960 println!("! !");
4961 println!("============================================================================\n");
4962 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
4963 let chain_str = match chain_id {
4967 Chain::Unknown => "".to_string(),
4968 _ => format!("{:?}_", chain_id),
4969 };
4970 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
4971 let cur = ProtocolVersion::new(i);
4972 assert_yaml_snapshot!(
4973 format!("{}version_{}", chain_str, cur.as_u64()),
4974 ProtocolConfig::get_for_version(cur, *chain_id)
4975 );
4976 }
4977 }
4978 }
4979
4980 #[test]
4981 fn test_getters() {
4982 let prot: ProtocolConfig =
4983 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4984 assert_eq!(
4985 prot.max_arguments(),
4986 prot.max_arguments_as_option().unwrap()
4987 );
4988 }
4989
4990 #[test]
4991 fn test_setters() {
4992 let mut prot: ProtocolConfig =
4993 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4994 prot.set_max_arguments_for_testing(123);
4995 assert_eq!(prot.max_arguments(), 123);
4996
4997 prot.set_max_arguments_from_str_for_testing("321".to_string());
4998 assert_eq!(prot.max_arguments(), 321);
4999
5000 prot.disable_max_arguments_for_testing();
5001 assert_eq!(prot.max_arguments_as_option(), None);
5002
5003 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5004 assert_eq!(prot.max_arguments(), 456);
5005 }
5006
5007 #[test]
5008 #[should_panic(expected = "unsupported version")]
5009 fn max_version_test() {
5010 let _ = ProtocolConfig::get_for_version_impl(
5013 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5014 Chain::Unknown,
5015 );
5016 }
5017
5018 #[test]
5019 fn lookup_by_string_test() {
5020 let prot: ProtocolConfig =
5021 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5022 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5024
5025 assert!(
5026 prot.lookup_attr("max_arguments".to_string())
5027 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5028 );
5029
5030 assert!(
5032 prot.lookup_attr("max_move_identifier_len".to_string())
5033 .is_none()
5034 );
5035
5036 let prot: ProtocolConfig =
5038 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5039 assert!(
5040 prot.lookup_attr("max_move_identifier_len".to_string())
5041 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5042 );
5043
5044 let prot: ProtocolConfig =
5045 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5046 assert!(
5048 prot.attr_map()
5049 .get("max_move_identifier_len")
5050 .unwrap()
5051 .is_none()
5052 );
5053 assert!(
5055 prot.attr_map().get("max_arguments").unwrap()
5056 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5057 );
5058
5059 let prot: ProtocolConfig =
5061 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5062 assert!(
5064 prot.feature_flags
5065 .lookup_attr("some random string".to_owned())
5066 .is_none()
5067 );
5068 assert!(
5069 !prot
5070 .feature_flags
5071 .attr_map()
5072 .contains_key("some random string")
5073 );
5074
5075 assert!(
5077 prot.feature_flags
5078 .lookup_attr("package_upgrades".to_owned())
5079 == Some(false)
5080 );
5081 assert!(
5082 prot.feature_flags
5083 .attr_map()
5084 .get("package_upgrades")
5085 .unwrap()
5086 == &false
5087 );
5088 let prot: ProtocolConfig =
5089 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5090 assert!(
5092 prot.feature_flags
5093 .lookup_attr("package_upgrades".to_owned())
5094 == Some(true)
5095 );
5096 assert!(
5097 prot.feature_flags
5098 .attr_map()
5099 .get("package_upgrades")
5100 .unwrap()
5101 == &true
5102 );
5103 }
5104
5105 #[test]
5106 fn limit_range_fn_test() {
5107 let low = 100u32;
5108 let high = 10000u64;
5109
5110 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5111 assert!(matches!(
5112 check_limit!(255u16, low, high),
5113 LimitThresholdCrossed::Soft(255u128, 100)
5114 ));
5115 assert!(matches!(
5121 check_limit!(2550000u64, low, high),
5122 LimitThresholdCrossed::Hard(2550000, 10000)
5123 ));
5124
5125 assert!(matches!(
5126 check_limit!(2550000u64, high, high),
5127 LimitThresholdCrossed::Hard(2550000, 10000)
5128 ));
5129
5130 assert!(matches!(
5131 check_limit!(1u8, high),
5132 LimitThresholdCrossed::None
5133 ));
5134
5135 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5136
5137 assert!(matches!(
5138 check_limit!(2550000u64, high),
5139 LimitThresholdCrossed::Hard(2550000, 10000)
5140 ));
5141 }
5142}