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 serde::{Deserialize, Serialize};
18use serde_with::skip_serializing_none;
19use sui_protocol_config_macros::{
20 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
21};
22use tracing::{info, warn};
23
24const MIN_PROTOCOL_VERSION: u64 = 1;
26const MAX_PROTOCOL_VERSION: u64 = 105;
27
28#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
286pub struct ProtocolVersion(u64);
287
288impl ProtocolVersion {
289 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
294
295 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
296
297 #[cfg(not(msim))]
298 pub const MAX_ALLOWED: Self = Self::MAX;
299
300 #[cfg(msim)]
302 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
303
304 pub fn new(v: u64) -> Self {
305 Self(v)
306 }
307
308 pub const fn as_u64(&self) -> u64 {
309 self.0
310 }
311
312 pub fn max() -> Self {
315 Self::MAX
316 }
317
318 pub fn prev(self) -> Self {
319 Self(self.0.checked_sub(1).unwrap())
320 }
321}
322
323impl From<u64> for ProtocolVersion {
324 fn from(v: u64) -> Self {
325 Self::new(v)
326 }
327}
328
329impl std::ops::Sub<u64> for ProtocolVersion {
330 type Output = Self;
331 fn sub(self, rhs: u64) -> Self::Output {
332 Self::new(self.0 - rhs)
333 }
334}
335
336impl std::ops::Add<u64> for ProtocolVersion {
337 type Output = Self;
338 fn add(self, rhs: u64) -> Self::Output {
339 Self::new(self.0 + rhs)
340 }
341}
342
343#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum)]
344pub enum Chain {
345 Mainnet,
346 Testnet,
347 Unknown,
348}
349
350impl Default for Chain {
351 fn default() -> Self {
352 Self::Unknown
353 }
354}
355
356impl Chain {
357 pub fn as_str(self) -> &'static str {
358 match self {
359 Chain::Mainnet => "mainnet",
360 Chain::Testnet => "testnet",
361 Chain::Unknown => "unknown",
362 }
363 }
364}
365
366pub struct Error(pub String);
367
368#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
371struct FeatureFlags {
372 #[serde(skip_serializing_if = "is_false")]
375 package_upgrades: bool,
376 #[serde(skip_serializing_if = "is_false")]
379 commit_root_state_digest: bool,
380 #[serde(skip_serializing_if = "is_false")]
382 advance_epoch_start_time_in_safe_mode: bool,
383 #[serde(skip_serializing_if = "is_false")]
386 loaded_child_objects_fixed: bool,
387 #[serde(skip_serializing_if = "is_false")]
390 missing_type_is_compatibility_error: bool,
391 #[serde(skip_serializing_if = "is_false")]
394 scoring_decision_with_validity_cutoff: bool,
395
396 #[serde(skip_serializing_if = "is_false")]
399 consensus_order_end_of_epoch_last: bool,
400
401 #[serde(skip_serializing_if = "is_false")]
403 disallow_adding_abilities_on_upgrade: bool,
404 #[serde(skip_serializing_if = "is_false")]
406 disable_invariant_violation_check_in_swap_loc: bool,
407 #[serde(skip_serializing_if = "is_false")]
410 advance_to_highest_supported_protocol_version: bool,
411 #[serde(skip_serializing_if = "is_false")]
413 ban_entry_init: bool,
414 #[serde(skip_serializing_if = "is_false")]
416 package_digest_hash_module: bool,
417 #[serde(skip_serializing_if = "is_false")]
419 disallow_change_struct_type_params_on_upgrade: bool,
420 #[serde(skip_serializing_if = "is_false")]
422 no_extraneous_module_bytes: bool,
423 #[serde(skip_serializing_if = "is_false")]
425 narwhal_versioned_metadata: bool,
426
427 #[serde(skip_serializing_if = "is_false")]
429 zklogin_auth: bool,
430 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
432 consensus_transaction_ordering: ConsensusTransactionOrdering,
433
434 #[serde(skip_serializing_if = "is_false")]
442 simplified_unwrap_then_delete: bool,
443 #[serde(skip_serializing_if = "is_false")]
445 upgraded_multisig_supported: bool,
446 #[serde(skip_serializing_if = "is_false")]
448 txn_base_cost_as_multiplier: bool,
449
450 #[serde(skip_serializing_if = "is_false")]
452 shared_object_deletion: bool,
453
454 #[serde(skip_serializing_if = "is_false")]
456 narwhal_new_leader_election_schedule: bool,
457
458 #[serde(skip_serializing_if = "is_empty")]
460 zklogin_supported_providers: BTreeSet<String>,
461
462 #[serde(skip_serializing_if = "is_false")]
464 loaded_child_object_format: bool,
465
466 #[serde(skip_serializing_if = "is_false")]
467 enable_jwk_consensus_updates: bool,
468
469 #[serde(skip_serializing_if = "is_false")]
470 end_of_epoch_transaction_supported: bool,
471
472 #[serde(skip_serializing_if = "is_false")]
475 simple_conservation_checks: bool,
476
477 #[serde(skip_serializing_if = "is_false")]
479 loaded_child_object_format_type: bool,
480
481 #[serde(skip_serializing_if = "is_false")]
483 receive_objects: bool,
484
485 #[serde(skip_serializing_if = "is_false")]
487 consensus_checkpoint_signature_key_includes_digest: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
491 random_beacon: bool,
492
493 #[serde(skip_serializing_if = "is_false")]
495 bridge: bool,
496
497 #[serde(skip_serializing_if = "is_false")]
498 enable_effects_v2: bool,
499
500 #[serde(skip_serializing_if = "is_false")]
502 narwhal_certificate_v2: bool,
503
504 #[serde(skip_serializing_if = "is_false")]
506 verify_legacy_zklogin_address: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
510 throughput_aware_consensus_submission: bool,
511
512 #[serde(skip_serializing_if = "is_false")]
514 recompute_has_public_transfer_in_execution: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 accept_zklogin_in_multisig: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 accept_passkey_in_multisig: bool,
523
524 #[serde(skip_serializing_if = "is_false")]
527 include_consensus_digest_in_prologue: bool,
528
529 #[serde(skip_serializing_if = "is_false")]
531 hardened_otw_check: bool,
532
533 #[serde(skip_serializing_if = "is_false")]
535 allow_receiving_object_id: bool,
536
537 #[serde(skip_serializing_if = "is_false")]
539 enable_poseidon: bool,
540
541 #[serde(skip_serializing_if = "is_false")]
543 enable_coin_deny_list: bool,
544
545 #[serde(skip_serializing_if = "is_false")]
547 enable_group_ops_native_functions: bool,
548
549 #[serde(skip_serializing_if = "is_false")]
551 enable_group_ops_native_function_msm: bool,
552
553 #[serde(skip_serializing_if = "is_false")]
555 enable_nitro_attestation: bool,
556
557 #[serde(skip_serializing_if = "is_false")]
559 enable_nitro_attestation_upgraded_parsing: bool,
560
561 #[serde(skip_serializing_if = "is_false")]
563 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
564
565 #[serde(skip_serializing_if = "is_false")]
567 reject_mutable_random_on_entry_functions: bool,
568
569 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
571 per_object_congestion_control_mode: PerObjectCongestionControlMode,
572
573 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
575 consensus_choice: ConsensusChoice,
576
577 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
579 consensus_network: ConsensusNetwork,
580
581 #[serde(skip_serializing_if = "is_false")]
583 correct_gas_payment_limit_check: bool,
584
585 #[serde(skip_serializing_if = "Option::is_none")]
587 zklogin_max_epoch_upper_bound_delta: Option<u64>,
588
589 #[serde(skip_serializing_if = "is_false")]
591 mysticeti_leader_scoring_and_schedule: bool,
592
593 #[serde(skip_serializing_if = "is_false")]
595 reshare_at_same_initial_version: bool,
596
597 #[serde(skip_serializing_if = "is_false")]
599 resolve_abort_locations_to_package_id: bool,
600
601 #[serde(skip_serializing_if = "is_false")]
605 mysticeti_use_committed_subdag_digest: bool,
606
607 #[serde(skip_serializing_if = "is_false")]
609 enable_vdf: bool,
610
611 #[serde(skip_serializing_if = "is_false")]
616 record_consensus_determined_version_assignments_in_prologue: bool,
617 #[serde(skip_serializing_if = "is_false")]
618 record_consensus_determined_version_assignments_in_prologue_v2: bool,
619
620 #[serde(skip_serializing_if = "is_false")]
622 fresh_vm_on_framework_upgrade: bool,
623
624 #[serde(skip_serializing_if = "is_false")]
632 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
633
634 #[serde(skip_serializing_if = "Option::is_none")]
636 mysticeti_num_leaders_per_round: Option<usize>,
637
638 #[serde(skip_serializing_if = "is_false")]
640 soft_bundle: bool,
641
642 #[serde(skip_serializing_if = "is_false")]
644 enable_coin_deny_list_v2: bool,
645
646 #[serde(skip_serializing_if = "is_false")]
648 passkey_auth: bool,
649
650 #[serde(skip_serializing_if = "is_false")]
652 authority_capabilities_v2: bool,
653
654 #[serde(skip_serializing_if = "is_false")]
656 rethrow_serialization_type_layout_errors: bool,
657
658 #[serde(skip_serializing_if = "is_false")]
660 consensus_distributed_vote_scoring_strategy: bool,
661
662 #[serde(skip_serializing_if = "is_false")]
664 consensus_round_prober: bool,
665
666 #[serde(skip_serializing_if = "is_false")]
668 validate_identifier_inputs: bool,
669
670 #[serde(skip_serializing_if = "is_false")]
672 disallow_self_identifier: bool,
673
674 #[serde(skip_serializing_if = "is_false")]
676 mysticeti_fastpath: bool,
677
678 #[serde(skip_serializing_if = "is_false")]
680 relocate_event_module: bool,
681
682 #[serde(skip_serializing_if = "is_false")]
684 uncompressed_g1_group_elements: bool,
685
686 #[serde(skip_serializing_if = "is_false")]
687 disallow_new_modules_in_deps_only_packages: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 consensus_smart_ancestor_selection: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
695 consensus_round_prober_probe_accepted_rounds: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
699 native_charging_v2: bool,
700
701 #[serde(skip_serializing_if = "is_false")]
704 consensus_linearize_subdag_v2: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
708 convert_type_argument_error: bool,
709
710 #[serde(skip_serializing_if = "is_false")]
712 variant_nodes: bool,
713
714 #[serde(skip_serializing_if = "is_false")]
716 consensus_zstd_compression: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 minimize_child_object_mutations: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 record_additional_state_digest_in_prologue: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
728 move_native_context: bool,
729
730 #[serde(skip_serializing_if = "is_false")]
733 consensus_median_based_commit_timestamp: bool,
734
735 #[serde(skip_serializing_if = "is_false")]
738 normalize_ptb_arguments: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 consensus_batched_block_sync: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 enforce_checkpoint_timestamp_monotonicity: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
750 max_ptb_value_size_v2: bool,
751
752 #[serde(skip_serializing_if = "is_false")]
754 resolve_type_input_ids_to_defining_id: bool,
755
756 #[serde(skip_serializing_if = "is_false")]
758 enable_party_transfer: bool,
759
760 #[serde(skip_serializing_if = "is_false")]
762 allow_unbounded_system_objects: bool,
763
764 #[serde(skip_serializing_if = "is_false")]
766 type_tags_in_object_runtime: bool,
767
768 #[serde(skip_serializing_if = "is_false")]
770 enable_accumulators: bool,
771
772 #[serde(skip_serializing_if = "is_false")]
774 enable_coin_reservation_obj_refs: bool,
775
776 #[serde(skip_serializing_if = "is_false")]
779 create_root_accumulator_object: bool,
780
781 #[serde(skip_serializing_if = "is_false")]
783 enable_authenticated_event_streams: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 enable_address_balance_gas_payments: bool,
788
789 #[serde(skip_serializing_if = "is_false")]
791 enable_multi_epoch_transaction_expiration: bool,
792
793 #[serde(skip_serializing_if = "is_false")]
795 enable_ptb_execution_v2: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
799 better_adapter_type_resolution_errors: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
803 record_time_estimate_processed: bool,
804
805 #[serde(skip_serializing_if = "is_false")]
807 dependency_linkage_error: bool,
808
809 #[serde(skip_serializing_if = "is_false")]
811 additional_multisig_checks: bool,
812
813 #[serde(skip_serializing_if = "is_false")]
815 ignore_execution_time_observations_after_certs_closed: bool,
816
817 #[serde(skip_serializing_if = "is_false")]
821 debug_fatal_on_move_invariant_violation: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
826 allow_private_accumulator_entrypoints: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
830 additional_consensus_digest_indirect_state: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
834 check_for_init_during_upgrade: bool,
835
836 #[serde(skip_serializing_if = "is_false")]
838 per_command_shared_object_transfer_rules: bool,
839
840 #[serde(skip_serializing_if = "is_false")]
842 include_checkpoint_artifacts_digest_in_summary: bool,
843
844 #[serde(skip_serializing_if = "is_false")]
846 use_mfp_txns_in_load_initial_object_debts: bool,
847
848 #[serde(skip_serializing_if = "is_false")]
850 cancel_for_failed_dkg_early: bool,
851
852 #[serde(skip_serializing_if = "is_false")]
854 enable_coin_registry: bool,
855
856 #[serde(skip_serializing_if = "is_false")]
858 abstract_size_in_object_runtime: bool,
859
860 #[serde(skip_serializing_if = "is_false")]
862 object_runtime_charge_cache_load_gas: bool,
863
864 #[serde(skip_serializing_if = "is_false")]
866 additional_borrow_checks: bool,
867
868 #[serde(skip_serializing_if = "is_false")]
870 use_new_commit_handler: bool,
871
872 #[serde(skip_serializing_if = "is_false")]
874 better_loader_errors: bool,
875
876 #[serde(skip_serializing_if = "is_false")]
878 generate_df_type_layouts: bool,
879
880 #[serde(skip_serializing_if = "is_false")]
882 allow_references_in_ptbs: bool,
883
884 #[serde(skip_serializing_if = "is_false")]
886 enable_display_registry: bool,
887
888 #[serde(skip_serializing_if = "is_false")]
890 private_generics_verifier_v2: bool,
891
892 #[serde(skip_serializing_if = "is_false")]
894 deprecate_global_storage_ops_during_deserialization: bool,
895
896 #[serde(skip_serializing_if = "is_false")]
899 enable_non_exclusive_writes: bool,
900
901 #[serde(skip_serializing_if = "is_false")]
903 deprecate_global_storage_ops: bool,
904
905 #[serde(skip_serializing_if = "is_false")]
907 consensus_skip_gced_accept_votes: bool,
908
909 #[serde(skip_serializing_if = "is_false")]
911 include_cancelled_randomness_txns_in_prologue: bool,
912
913 #[serde(skip_serializing_if = "is_false")]
915 address_aliases: bool,
916
917 #[serde(skip_serializing_if = "is_false")]
919 enable_object_funds_withdraw: bool,
920}
921
922fn is_false(b: &bool) -> bool {
923 !b
924}
925
926fn is_empty(b: &BTreeSet<String>) -> bool {
927 b.is_empty()
928}
929
930fn is_zero(val: &u64) -> bool {
931 *val == 0
932}
933
934#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
936pub enum ConsensusTransactionOrdering {
937 #[default]
939 None,
940 ByGasPrice,
942}
943
944impl ConsensusTransactionOrdering {
945 pub fn is_none(&self) -> bool {
946 matches!(self, ConsensusTransactionOrdering::None)
947 }
948}
949
950#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
951pub struct ExecutionTimeEstimateParams {
952 pub target_utilization: u64,
954 pub allowed_txn_cost_overage_burst_limit_us: u64,
958
959 pub randomness_scalar: u64,
962
963 pub max_estimate_us: u64,
965
966 pub stored_observations_num_included_checkpoints: u64,
969
970 pub stored_observations_limit: u64,
972
973 #[serde(skip_serializing_if = "is_zero")]
976 pub stake_weighted_median_threshold: u64,
977
978 #[serde(skip_serializing_if = "is_false")]
982 pub default_none_duration_for_new_keys: bool,
983
984 #[serde(skip_serializing_if = "Option::is_none")]
986 pub observations_chunk_size: Option<u64>,
987}
988
989#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
991pub enum PerObjectCongestionControlMode {
992 #[default]
993 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
999
1000impl PerObjectCongestionControlMode {
1001 pub fn is_none(&self) -> bool {
1002 matches!(self, PerObjectCongestionControlMode::None)
1003 }
1004}
1005
1006#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1008pub enum ConsensusChoice {
1009 #[default]
1010 Narwhal,
1011 SwapEachEpoch,
1012 Mysticeti,
1013}
1014
1015impl ConsensusChoice {
1016 pub fn is_narwhal(&self) -> bool {
1017 matches!(self, ConsensusChoice::Narwhal)
1018 }
1019}
1020
1021#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1023pub enum ConsensusNetwork {
1024 #[default]
1025 Anemo,
1026 Tonic,
1027}
1028
1029impl ConsensusNetwork {
1030 pub fn is_anemo(&self) -> bool {
1031 matches!(self, ConsensusNetwork::Anemo)
1032 }
1033}
1034
1035#[skip_serializing_none]
1067#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1068pub struct ProtocolConfig {
1069 pub version: ProtocolVersion,
1070
1071 feature_flags: FeatureFlags,
1072
1073 max_tx_size_bytes: Option<u64>,
1076
1077 max_input_objects: Option<u64>,
1079
1080 max_size_written_objects: Option<u64>,
1084 max_size_written_objects_system_tx: Option<u64>,
1087
1088 max_serialized_tx_effects_size_bytes: Option<u64>,
1090
1091 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1093
1094 max_gas_payment_objects: Option<u32>,
1096
1097 max_modules_in_publish: Option<u32>,
1099
1100 max_package_dependencies: Option<u32>,
1102
1103 max_arguments: Option<u32>,
1106
1107 max_type_arguments: Option<u32>,
1109
1110 max_type_argument_depth: Option<u32>,
1112
1113 max_pure_argument_size: Option<u32>,
1115
1116 max_programmable_tx_commands: Option<u32>,
1118
1119 move_binary_format_version: Option<u32>,
1122 min_move_binary_format_version: Option<u32>,
1123
1124 binary_module_handles: Option<u16>,
1126 binary_struct_handles: Option<u16>,
1127 binary_function_handles: Option<u16>,
1128 binary_function_instantiations: Option<u16>,
1129 binary_signatures: Option<u16>,
1130 binary_constant_pool: Option<u16>,
1131 binary_identifiers: Option<u16>,
1132 binary_address_identifiers: Option<u16>,
1133 binary_struct_defs: Option<u16>,
1134 binary_struct_def_instantiations: Option<u16>,
1135 binary_function_defs: Option<u16>,
1136 binary_field_handles: Option<u16>,
1137 binary_field_instantiations: Option<u16>,
1138 binary_friend_decls: Option<u16>,
1139 binary_enum_defs: Option<u16>,
1140 binary_enum_def_instantiations: Option<u16>,
1141 binary_variant_handles: Option<u16>,
1142 binary_variant_instantiation_handles: Option<u16>,
1143
1144 max_move_object_size: Option<u64>,
1146
1147 max_move_package_size: Option<u64>,
1150
1151 max_publish_or_upgrade_per_ptb: Option<u64>,
1153
1154 max_tx_gas: Option<u64>,
1156
1157 max_gas_price: Option<u64>,
1159
1160 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1163
1164 max_gas_computation_bucket: Option<u64>,
1166
1167 gas_rounding_step: Option<u64>,
1169
1170 max_loop_depth: Option<u64>,
1172
1173 max_generic_instantiation_length: Option<u64>,
1175
1176 max_function_parameters: Option<u64>,
1178
1179 max_basic_blocks: Option<u64>,
1181
1182 max_value_stack_size: Option<u64>,
1184
1185 max_type_nodes: Option<u64>,
1187
1188 max_push_size: Option<u64>,
1190
1191 max_struct_definitions: Option<u64>,
1193
1194 max_function_definitions: Option<u64>,
1196
1197 max_fields_in_struct: Option<u64>,
1199
1200 max_dependency_depth: Option<u64>,
1202
1203 max_num_event_emit: Option<u64>,
1205
1206 max_num_new_move_object_ids: Option<u64>,
1208
1209 max_num_new_move_object_ids_system_tx: Option<u64>,
1211
1212 max_num_deleted_move_object_ids: Option<u64>,
1214
1215 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1217
1218 max_num_transferred_move_object_ids: Option<u64>,
1220
1221 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1223
1224 max_event_emit_size: Option<u64>,
1226
1227 max_event_emit_size_total: Option<u64>,
1229
1230 max_move_vector_len: Option<u64>,
1232
1233 max_move_identifier_len: Option<u64>,
1235
1236 max_move_value_depth: Option<u64>,
1238
1239 max_move_enum_variants: Option<u64>,
1241
1242 max_back_edges_per_function: Option<u64>,
1244
1245 max_back_edges_per_module: Option<u64>,
1247
1248 max_verifier_meter_ticks_per_function: Option<u64>,
1250
1251 max_meter_ticks_per_module: Option<u64>,
1253
1254 max_meter_ticks_per_package: Option<u64>,
1256
1257 object_runtime_max_num_cached_objects: Option<u64>,
1261
1262 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1264
1265 object_runtime_max_num_store_entries: Option<u64>,
1267
1268 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1270
1271 base_tx_cost_fixed: Option<u64>,
1274
1275 package_publish_cost_fixed: Option<u64>,
1278
1279 base_tx_cost_per_byte: Option<u64>,
1282
1283 package_publish_cost_per_byte: Option<u64>,
1285
1286 obj_access_cost_read_per_byte: Option<u64>,
1288
1289 obj_access_cost_mutate_per_byte: Option<u64>,
1291
1292 obj_access_cost_delete_per_byte: Option<u64>,
1294
1295 obj_access_cost_verify_per_byte: Option<u64>,
1305
1306 max_type_to_layout_nodes: Option<u64>,
1308
1309 max_ptb_value_size: Option<u64>,
1311
1312 gas_model_version: Option<u64>,
1315
1316 obj_data_cost_refundable: Option<u64>,
1319
1320 obj_metadata_cost_non_refundable: Option<u64>,
1324
1325 storage_rebate_rate: Option<u64>,
1331
1332 storage_fund_reinvest_rate: Option<u64>,
1335
1336 reward_slashing_rate: Option<u64>,
1339
1340 storage_gas_price: Option<u64>,
1342
1343 max_transactions_per_checkpoint: Option<u64>,
1348
1349 max_checkpoint_size_bytes: Option<u64>,
1353
1354 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1359
1360 address_from_bytes_cost_base: Option<u64>,
1365 address_to_u256_cost_base: Option<u64>,
1367 address_from_u256_cost_base: Option<u64>,
1369
1370 config_read_setting_impl_cost_base: Option<u64>,
1375 config_read_setting_impl_cost_per_byte: Option<u64>,
1376
1377 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1380 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1381 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1382 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1383 dynamic_field_add_child_object_cost_base: Option<u64>,
1385 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1386 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1387 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1388 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1390 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1391 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1392 dynamic_field_remove_child_object_cost_base: Option<u64>,
1394 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1395 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1396 dynamic_field_has_child_object_cost_base: Option<u64>,
1398 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1400 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1401 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1402
1403 event_emit_cost_base: Option<u64>,
1406 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1407 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1408 event_emit_output_cost_per_byte: Option<u64>,
1409 event_emit_auth_stream_cost: Option<u64>,
1410
1411 object_borrow_uid_cost_base: Option<u64>,
1414 object_delete_impl_cost_base: Option<u64>,
1416 object_record_new_uid_cost_base: Option<u64>,
1418
1419 transfer_transfer_internal_cost_base: Option<u64>,
1422 transfer_party_transfer_internal_cost_base: Option<u64>,
1424 transfer_freeze_object_cost_base: Option<u64>,
1426 transfer_share_object_cost_base: Option<u64>,
1428 transfer_receive_object_cost_base: Option<u64>,
1431
1432 tx_context_derive_id_cost_base: Option<u64>,
1435 tx_context_fresh_id_cost_base: Option<u64>,
1436 tx_context_sender_cost_base: Option<u64>,
1437 tx_context_epoch_cost_base: Option<u64>,
1438 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1439 tx_context_sponsor_cost_base: Option<u64>,
1440 tx_context_rgp_cost_base: Option<u64>,
1441 tx_context_gas_price_cost_base: Option<u64>,
1442 tx_context_gas_budget_cost_base: Option<u64>,
1443 tx_context_ids_created_cost_base: Option<u64>,
1444 tx_context_replace_cost_base: Option<u64>,
1445
1446 types_is_one_time_witness_cost_base: Option<u64>,
1449 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1450 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1451
1452 validator_validate_metadata_cost_base: Option<u64>,
1455 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1456
1457 crypto_invalid_arguments_cost: Option<u64>,
1459 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1461 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1462 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1463
1464 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1466 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1467 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1468
1469 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1471 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1472 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1473 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1474 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1475 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1476
1477 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1479
1480 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1482 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1483 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1484 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1485 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1486 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1487
1488 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1490 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1491 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1492 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1493 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1494 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1495
1496 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1498 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1499 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1500 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1501 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1502 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1503
1504 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1506 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1507 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1508
1509 ed25519_ed25519_verify_cost_base: Option<u64>,
1511 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1512 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1513
1514 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1516 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1517
1518 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1520 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1521 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1522 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1523 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1524
1525 hash_blake2b256_cost_base: Option<u64>,
1527 hash_blake2b256_data_cost_per_byte: Option<u64>,
1528 hash_blake2b256_data_cost_per_block: Option<u64>,
1529
1530 hash_keccak256_cost_base: Option<u64>,
1532 hash_keccak256_data_cost_per_byte: Option<u64>,
1533 hash_keccak256_data_cost_per_block: Option<u64>,
1534
1535 poseidon_bn254_cost_base: Option<u64>,
1537 poseidon_bn254_cost_per_block: Option<u64>,
1538
1539 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1541 group_ops_bls12381_decode_g1_cost: Option<u64>,
1542 group_ops_bls12381_decode_g2_cost: Option<u64>,
1543 group_ops_bls12381_decode_gt_cost: Option<u64>,
1544 group_ops_bls12381_scalar_add_cost: Option<u64>,
1545 group_ops_bls12381_g1_add_cost: Option<u64>,
1546 group_ops_bls12381_g2_add_cost: Option<u64>,
1547 group_ops_bls12381_gt_add_cost: Option<u64>,
1548 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1549 group_ops_bls12381_g1_sub_cost: Option<u64>,
1550 group_ops_bls12381_g2_sub_cost: Option<u64>,
1551 group_ops_bls12381_gt_sub_cost: Option<u64>,
1552 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1553 group_ops_bls12381_g1_mul_cost: Option<u64>,
1554 group_ops_bls12381_g2_mul_cost: Option<u64>,
1555 group_ops_bls12381_gt_mul_cost: Option<u64>,
1556 group_ops_bls12381_scalar_div_cost: Option<u64>,
1557 group_ops_bls12381_g1_div_cost: Option<u64>,
1558 group_ops_bls12381_g2_div_cost: Option<u64>,
1559 group_ops_bls12381_gt_div_cost: Option<u64>,
1560 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1561 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1562 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1563 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1564 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1565 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1566 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1567 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1568 group_ops_bls12381_msm_max_len: Option<u32>,
1569 group_ops_bls12381_pairing_cost: Option<u64>,
1570 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1571 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1572 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1573 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1574 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1575
1576 hmac_hmac_sha3_256_cost_base: Option<u64>,
1578 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1579 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1580
1581 check_zklogin_id_cost_base: Option<u64>,
1583 check_zklogin_issuer_cost_base: Option<u64>,
1585
1586 vdf_verify_vdf_cost: Option<u64>,
1587 vdf_hash_to_input_cost: Option<u64>,
1588
1589 nitro_attestation_parse_base_cost: Option<u64>,
1591 nitro_attestation_parse_cost_per_byte: Option<u64>,
1592 nitro_attestation_verify_base_cost: Option<u64>,
1593 nitro_attestation_verify_cost_per_cert: Option<u64>,
1594
1595 bcs_per_byte_serialized_cost: Option<u64>,
1597 bcs_legacy_min_output_size_cost: Option<u64>,
1598 bcs_failure_cost: Option<u64>,
1599
1600 hash_sha2_256_base_cost: Option<u64>,
1601 hash_sha2_256_per_byte_cost: Option<u64>,
1602 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1603 hash_sha3_256_base_cost: Option<u64>,
1604 hash_sha3_256_per_byte_cost: Option<u64>,
1605 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1606 type_name_get_base_cost: Option<u64>,
1607 type_name_get_per_byte_cost: Option<u64>,
1608 type_name_id_base_cost: Option<u64>,
1609
1610 string_check_utf8_base_cost: Option<u64>,
1611 string_check_utf8_per_byte_cost: Option<u64>,
1612 string_is_char_boundary_base_cost: Option<u64>,
1613 string_sub_string_base_cost: Option<u64>,
1614 string_sub_string_per_byte_cost: Option<u64>,
1615 string_index_of_base_cost: Option<u64>,
1616 string_index_of_per_byte_pattern_cost: Option<u64>,
1617 string_index_of_per_byte_searched_cost: Option<u64>,
1618
1619 vector_empty_base_cost: Option<u64>,
1620 vector_length_base_cost: Option<u64>,
1621 vector_push_back_base_cost: Option<u64>,
1622 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1623 vector_borrow_base_cost: Option<u64>,
1624 vector_pop_back_base_cost: Option<u64>,
1625 vector_destroy_empty_base_cost: Option<u64>,
1626 vector_swap_base_cost: Option<u64>,
1627 debug_print_base_cost: Option<u64>,
1628 debug_print_stack_trace_base_cost: Option<u64>,
1629
1630 execution_version: Option<u64>,
1639
1640 consensus_bad_nodes_stake_threshold: Option<u64>,
1644
1645 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1646 max_age_of_jwk_in_epochs: Option<u64>,
1650
1651 random_beacon_reduction_allowed_delta: Option<u16>,
1655
1656 random_beacon_reduction_lower_bound: Option<u32>,
1659
1660 random_beacon_dkg_timeout_round: Option<u32>,
1663
1664 random_beacon_min_round_interval_ms: Option<u64>,
1666
1667 random_beacon_dkg_version: Option<u64>,
1670
1671 consensus_max_transaction_size_bytes: Option<u64>,
1674 consensus_max_transactions_in_block_bytes: Option<u64>,
1676 consensus_max_num_transactions_in_block: Option<u64>,
1678
1679 consensus_voting_rounds: Option<u32>,
1681
1682 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1684
1685 max_deferral_rounds_for_congestion_control: Option<u64>,
1688
1689 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1691
1692 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1694
1695 min_checkpoint_interval_ms: Option<u64>,
1697
1698 checkpoint_summary_version_specific_data: Option<u64>,
1700
1701 max_soft_bundle_size: Option<u64>,
1703
1704 bridge_should_try_to_finalize_committee: Option<bool>,
1708
1709 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1715
1716 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1719
1720 consensus_gc_depth: Option<u32>,
1723
1724 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1726
1727 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1729
1730 sip_45_consensus_amplification_threshold: Option<u64>,
1733
1734 use_object_per_epoch_marker_table_v2: Option<bool>,
1737
1738 consensus_commit_rate_estimation_window_size: Option<u32>,
1740
1741 #[serde(skip_serializing_if = "Vec::is_empty")]
1745 aliased_addresses: Vec<AliasedAddress>,
1746
1747 translation_per_command_base_charge: Option<u64>,
1750
1751 translation_per_input_base_charge: Option<u64>,
1754
1755 translation_pure_input_per_byte_charge: Option<u64>,
1757
1758 translation_per_type_node_charge: Option<u64>,
1762
1763 translation_per_reference_node_charge: Option<u64>,
1766
1767 translation_per_linkage_entry_charge: Option<u64>,
1770
1771 max_updates_per_settlement_txn: Option<u32>,
1773}
1774
1775#[derive(Clone, Serialize, Deserialize, Debug)]
1777pub struct AliasedAddress {
1778 pub original: [u8; 32],
1780 pub aliased: [u8; 32],
1782 pub allowed_tx_digests: Vec<[u8; 32]>,
1784}
1785
1786impl ProtocolConfig {
1788 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1801 if self.feature_flags.package_upgrades {
1802 Ok(())
1803 } else {
1804 Err(Error(format!(
1805 "package upgrades are not supported at {:?}",
1806 self.version
1807 )))
1808 }
1809 }
1810
1811 pub fn allow_receiving_object_id(&self) -> bool {
1812 self.feature_flags.allow_receiving_object_id
1813 }
1814
1815 pub fn receiving_objects_supported(&self) -> bool {
1816 self.feature_flags.receive_objects
1817 }
1818
1819 pub fn package_upgrades_supported(&self) -> bool {
1820 self.feature_flags.package_upgrades
1821 }
1822
1823 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1824 self.feature_flags.commit_root_state_digest
1825 }
1826
1827 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1828 self.feature_flags.advance_epoch_start_time_in_safe_mode
1829 }
1830
1831 pub fn loaded_child_objects_fixed(&self) -> bool {
1832 self.feature_flags.loaded_child_objects_fixed
1833 }
1834
1835 pub fn missing_type_is_compatibility_error(&self) -> bool {
1836 self.feature_flags.missing_type_is_compatibility_error
1837 }
1838
1839 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1840 self.feature_flags.scoring_decision_with_validity_cutoff
1841 }
1842
1843 pub fn narwhal_versioned_metadata(&self) -> bool {
1844 self.feature_flags.narwhal_versioned_metadata
1845 }
1846
1847 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
1848 self.feature_flags.consensus_order_end_of_epoch_last
1849 }
1850
1851 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
1852 self.feature_flags.disallow_adding_abilities_on_upgrade
1853 }
1854
1855 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
1856 self.feature_flags
1857 .disable_invariant_violation_check_in_swap_loc
1858 }
1859
1860 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
1861 self.feature_flags
1862 .advance_to_highest_supported_protocol_version
1863 }
1864
1865 pub fn ban_entry_init(&self) -> bool {
1866 self.feature_flags.ban_entry_init
1867 }
1868
1869 pub fn package_digest_hash_module(&self) -> bool {
1870 self.feature_flags.package_digest_hash_module
1871 }
1872
1873 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
1874 self.feature_flags
1875 .disallow_change_struct_type_params_on_upgrade
1876 }
1877
1878 pub fn no_extraneous_module_bytes(&self) -> bool {
1879 self.feature_flags.no_extraneous_module_bytes
1880 }
1881
1882 pub fn zklogin_auth(&self) -> bool {
1883 self.feature_flags.zklogin_auth
1884 }
1885
1886 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
1887 &self.feature_flags.zklogin_supported_providers
1888 }
1889
1890 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
1891 self.feature_flags.consensus_transaction_ordering
1892 }
1893
1894 pub fn simplified_unwrap_then_delete(&self) -> bool {
1895 self.feature_flags.simplified_unwrap_then_delete
1896 }
1897
1898 pub fn supports_upgraded_multisig(&self) -> bool {
1899 self.feature_flags.upgraded_multisig_supported
1900 }
1901
1902 pub fn txn_base_cost_as_multiplier(&self) -> bool {
1903 self.feature_flags.txn_base_cost_as_multiplier
1904 }
1905
1906 pub fn shared_object_deletion(&self) -> bool {
1907 self.feature_flags.shared_object_deletion
1908 }
1909
1910 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
1911 self.feature_flags.narwhal_new_leader_election_schedule
1912 }
1913
1914 pub fn loaded_child_object_format(&self) -> bool {
1915 self.feature_flags.loaded_child_object_format
1916 }
1917
1918 pub fn enable_jwk_consensus_updates(&self) -> bool {
1919 let ret = self.feature_flags.enable_jwk_consensus_updates;
1920 if ret {
1921 assert!(self.feature_flags.end_of_epoch_transaction_supported);
1923 }
1924 ret
1925 }
1926
1927 pub fn simple_conservation_checks(&self) -> bool {
1928 self.feature_flags.simple_conservation_checks
1929 }
1930
1931 pub fn loaded_child_object_format_type(&self) -> bool {
1932 self.feature_flags.loaded_child_object_format_type
1933 }
1934
1935 pub fn end_of_epoch_transaction_supported(&self) -> bool {
1936 let ret = self.feature_flags.end_of_epoch_transaction_supported;
1937 if !ret {
1938 assert!(!self.feature_flags.enable_jwk_consensus_updates);
1940 }
1941 ret
1942 }
1943
1944 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
1945 self.feature_flags
1946 .recompute_has_public_transfer_in_execution
1947 }
1948
1949 pub fn create_authenticator_state_in_genesis(&self) -> bool {
1951 self.enable_jwk_consensus_updates()
1952 }
1953
1954 pub fn random_beacon(&self) -> bool {
1955 self.feature_flags.random_beacon
1956 }
1957
1958 pub fn dkg_version(&self) -> u64 {
1959 self.random_beacon_dkg_version.unwrap_or(1)
1961 }
1962
1963 pub fn enable_bridge(&self) -> bool {
1964 let ret = self.feature_flags.bridge;
1965 if ret {
1966 assert!(self.feature_flags.end_of_epoch_transaction_supported);
1968 }
1969 ret
1970 }
1971
1972 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
1973 if !self.enable_bridge() {
1974 return false;
1975 }
1976 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
1978 }
1979
1980 pub fn enable_effects_v2(&self) -> bool {
1981 self.feature_flags.enable_effects_v2
1982 }
1983
1984 pub fn narwhal_certificate_v2(&self) -> bool {
1985 self.feature_flags.narwhal_certificate_v2
1986 }
1987
1988 pub fn verify_legacy_zklogin_address(&self) -> bool {
1989 self.feature_flags.verify_legacy_zklogin_address
1990 }
1991
1992 pub fn accept_zklogin_in_multisig(&self) -> bool {
1993 self.feature_flags.accept_zklogin_in_multisig
1994 }
1995
1996 pub fn accept_passkey_in_multisig(&self) -> bool {
1997 self.feature_flags.accept_passkey_in_multisig
1998 }
1999
2000 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2001 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2002 }
2003
2004 pub fn throughput_aware_consensus_submission(&self) -> bool {
2005 self.feature_flags.throughput_aware_consensus_submission
2006 }
2007
2008 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2009 self.feature_flags.include_consensus_digest_in_prologue
2010 }
2011
2012 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2013 self.feature_flags
2014 .record_consensus_determined_version_assignments_in_prologue
2015 }
2016
2017 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2018 self.feature_flags
2019 .record_additional_state_digest_in_prologue
2020 }
2021
2022 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2023 self.feature_flags
2024 .record_consensus_determined_version_assignments_in_prologue_v2
2025 }
2026
2027 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2028 self.feature_flags
2029 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2030 }
2031
2032 pub fn hardened_otw_check(&self) -> bool {
2033 self.feature_flags.hardened_otw_check
2034 }
2035
2036 pub fn enable_poseidon(&self) -> bool {
2037 self.feature_flags.enable_poseidon
2038 }
2039
2040 pub fn enable_coin_deny_list_v1(&self) -> bool {
2041 self.feature_flags.enable_coin_deny_list
2042 }
2043
2044 pub fn enable_accumulators(&self) -> bool {
2045 self.feature_flags.enable_accumulators
2046 }
2047
2048 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2049 self.feature_flags.enable_coin_reservation_obj_refs
2050 }
2051
2052 pub fn create_root_accumulator_object(&self) -> bool {
2053 self.feature_flags.create_root_accumulator_object
2054 }
2055
2056 pub fn enable_address_balance_gas_payments(&self) -> bool {
2057 self.feature_flags.enable_address_balance_gas_payments
2058 }
2059
2060 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2061 self.feature_flags.enable_multi_epoch_transaction_expiration
2062 }
2063
2064 pub fn enable_authenticated_event_streams(&self) -> bool {
2065 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2066 }
2067
2068 pub fn enable_non_exclusive_writes(&self) -> bool {
2069 self.feature_flags.enable_non_exclusive_writes
2070 }
2071
2072 pub fn enable_coin_registry(&self) -> bool {
2073 self.feature_flags.enable_coin_registry
2074 }
2075
2076 pub fn enable_display_registry(&self) -> bool {
2077 self.feature_flags.enable_display_registry
2078 }
2079
2080 pub fn enable_coin_deny_list_v2(&self) -> bool {
2081 self.feature_flags.enable_coin_deny_list_v2
2082 }
2083
2084 pub fn enable_group_ops_native_functions(&self) -> bool {
2085 self.feature_flags.enable_group_ops_native_functions
2086 }
2087
2088 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2089 self.feature_flags.enable_group_ops_native_function_msm
2090 }
2091
2092 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2093 self.feature_flags.reject_mutable_random_on_entry_functions
2094 }
2095
2096 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2097 self.feature_flags.per_object_congestion_control_mode
2098 }
2099
2100 pub fn consensus_choice(&self) -> ConsensusChoice {
2101 self.feature_flags.consensus_choice
2102 }
2103
2104 pub fn consensus_network(&self) -> ConsensusNetwork {
2105 self.feature_flags.consensus_network
2106 }
2107
2108 pub fn correct_gas_payment_limit_check(&self) -> bool {
2109 self.feature_flags.correct_gas_payment_limit_check
2110 }
2111
2112 pub fn reshare_at_same_initial_version(&self) -> bool {
2113 self.feature_flags.reshare_at_same_initial_version
2114 }
2115
2116 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2117 self.feature_flags.resolve_abort_locations_to_package_id
2118 }
2119
2120 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2121 self.feature_flags.mysticeti_use_committed_subdag_digest
2122 }
2123
2124 pub fn enable_vdf(&self) -> bool {
2125 self.feature_flags.enable_vdf
2126 }
2127
2128 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2129 self.feature_flags.fresh_vm_on_framework_upgrade
2130 }
2131
2132 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2133 self.feature_flags.mysticeti_num_leaders_per_round
2134 }
2135
2136 pub fn soft_bundle(&self) -> bool {
2137 self.feature_flags.soft_bundle
2138 }
2139
2140 pub fn passkey_auth(&self) -> bool {
2141 self.feature_flags.passkey_auth
2142 }
2143
2144 pub fn authority_capabilities_v2(&self) -> bool {
2145 self.feature_flags.authority_capabilities_v2
2146 }
2147
2148 pub fn max_transaction_size_bytes(&self) -> u64 {
2149 self.consensus_max_transaction_size_bytes
2151 .unwrap_or(256 * 1024)
2152 }
2153
2154 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2155 if cfg!(msim) {
2156 256 * 1024
2157 } else {
2158 self.consensus_max_transactions_in_block_bytes
2159 .unwrap_or(512 * 1024)
2160 }
2161 }
2162
2163 pub fn max_num_transactions_in_block(&self) -> u64 {
2164 if cfg!(msim) {
2165 8
2166 } else {
2167 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2168 }
2169 }
2170
2171 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2172 self.feature_flags.rethrow_serialization_type_layout_errors
2173 }
2174
2175 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2176 self.feature_flags
2177 .consensus_distributed_vote_scoring_strategy
2178 }
2179
2180 pub fn consensus_round_prober(&self) -> bool {
2181 self.feature_flags.consensus_round_prober
2182 }
2183
2184 pub fn validate_identifier_inputs(&self) -> bool {
2185 self.feature_flags.validate_identifier_inputs
2186 }
2187
2188 pub fn gc_depth(&self) -> u32 {
2189 self.consensus_gc_depth.unwrap_or(0)
2190 }
2191
2192 pub fn mysticeti_fastpath(&self) -> bool {
2193 self.feature_flags.mysticeti_fastpath
2194 }
2195
2196 pub fn relocate_event_module(&self) -> bool {
2197 self.feature_flags.relocate_event_module
2198 }
2199
2200 pub fn uncompressed_g1_group_elements(&self) -> bool {
2201 self.feature_flags.uncompressed_g1_group_elements
2202 }
2203
2204 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2205 self.feature_flags
2206 .disallow_new_modules_in_deps_only_packages
2207 }
2208
2209 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2210 self.feature_flags.consensus_smart_ancestor_selection
2211 }
2212
2213 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2214 self.feature_flags
2215 .consensus_round_prober_probe_accepted_rounds
2216 }
2217
2218 pub fn native_charging_v2(&self) -> bool {
2219 self.feature_flags.native_charging_v2
2220 }
2221
2222 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2223 let res = self.feature_flags.consensus_linearize_subdag_v2;
2224 assert!(
2225 !res || self.gc_depth() > 0,
2226 "The consensus linearize sub dag V2 requires GC to be enabled"
2227 );
2228 res
2229 }
2230
2231 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2232 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2233 assert!(
2234 !res || self.gc_depth() > 0,
2235 "The consensus median based commit timestamp requires GC to be enabled"
2236 );
2237 res
2238 }
2239
2240 pub fn consensus_batched_block_sync(&self) -> bool {
2241 self.feature_flags.consensus_batched_block_sync
2242 }
2243
2244 pub fn convert_type_argument_error(&self) -> bool {
2245 self.feature_flags.convert_type_argument_error
2246 }
2247
2248 pub fn variant_nodes(&self) -> bool {
2249 self.feature_flags.variant_nodes
2250 }
2251
2252 pub fn consensus_zstd_compression(&self) -> bool {
2253 self.feature_flags.consensus_zstd_compression
2254 }
2255
2256 pub fn enable_nitro_attestation(&self) -> bool {
2257 self.feature_flags.enable_nitro_attestation
2258 }
2259
2260 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2261 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2262 }
2263
2264 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2265 self.feature_flags
2266 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2267 }
2268
2269 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2270 self.consensus_commit_rate_estimation_window_size
2271 .unwrap_or(0)
2272 }
2273
2274 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2275 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2279 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2281 window_size
2282 }
2283
2284 pub fn minimize_child_object_mutations(&self) -> bool {
2285 self.feature_flags.minimize_child_object_mutations
2286 }
2287
2288 pub fn move_native_context(&self) -> bool {
2289 self.feature_flags.move_native_context
2290 }
2291
2292 pub fn normalize_ptb_arguments(&self) -> bool {
2293 self.feature_flags.normalize_ptb_arguments
2294 }
2295
2296 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2297 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2298 }
2299
2300 pub fn max_ptb_value_size_v2(&self) -> bool {
2301 self.feature_flags.max_ptb_value_size_v2
2302 }
2303
2304 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2305 self.feature_flags.resolve_type_input_ids_to_defining_id
2306 }
2307
2308 pub fn enable_party_transfer(&self) -> bool {
2309 self.feature_flags.enable_party_transfer
2310 }
2311
2312 pub fn allow_unbounded_system_objects(&self) -> bool {
2313 self.feature_flags.allow_unbounded_system_objects
2314 }
2315
2316 pub fn type_tags_in_object_runtime(&self) -> bool {
2317 self.feature_flags.type_tags_in_object_runtime
2318 }
2319
2320 pub fn enable_ptb_execution_v2(&self) -> bool {
2321 self.feature_flags.enable_ptb_execution_v2
2322 }
2323
2324 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2325 self.feature_flags.better_adapter_type_resolution_errors
2326 }
2327
2328 pub fn record_time_estimate_processed(&self) -> bool {
2329 self.feature_flags.record_time_estimate_processed
2330 }
2331
2332 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2333 self.feature_flags
2334 .ignore_execution_time_observations_after_certs_closed
2335 }
2336
2337 pub fn dependency_linkage_error(&self) -> bool {
2338 self.feature_flags.dependency_linkage_error
2339 }
2340
2341 pub fn additional_multisig_checks(&self) -> bool {
2342 self.feature_flags.additional_multisig_checks
2343 }
2344
2345 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2346 self.feature_flags.debug_fatal_on_move_invariant_violation
2347 }
2348
2349 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2350 self.feature_flags.allow_private_accumulator_entrypoints
2351 }
2352
2353 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2354 self.feature_flags
2355 .additional_consensus_digest_indirect_state
2356 }
2357
2358 pub fn check_for_init_during_upgrade(&self) -> bool {
2359 self.feature_flags.check_for_init_during_upgrade
2360 }
2361
2362 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2363 self.feature_flags.per_command_shared_object_transfer_rules
2364 }
2365
2366 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2367 self.feature_flags
2368 .consensus_checkpoint_signature_key_includes_digest
2369 }
2370
2371 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2372 self.feature_flags
2373 .include_checkpoint_artifacts_digest_in_summary
2374 }
2375
2376 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2377 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2378 }
2379
2380 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2381 self.feature_flags.cancel_for_failed_dkg_early
2382 }
2383
2384 pub fn abstract_size_in_object_runtime(&self) -> bool {
2385 self.feature_flags.abstract_size_in_object_runtime
2386 }
2387
2388 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2389 self.feature_flags.object_runtime_charge_cache_load_gas
2390 }
2391
2392 pub fn additional_borrow_checks(&self) -> bool {
2393 self.feature_flags.additional_borrow_checks
2394 }
2395
2396 pub fn use_new_commit_handler(&self) -> bool {
2397 self.feature_flags.use_new_commit_handler
2398 }
2399
2400 pub fn better_loader_errors(&self) -> bool {
2401 self.feature_flags.better_loader_errors
2402 }
2403
2404 pub fn generate_df_type_layouts(&self) -> bool {
2405 self.feature_flags.generate_df_type_layouts
2406 }
2407
2408 pub fn allow_references_in_ptbs(&self) -> bool {
2409 self.feature_flags.allow_references_in_ptbs
2410 }
2411
2412 pub fn private_generics_verifier_v2(&self) -> bool {
2413 self.feature_flags.private_generics_verifier_v2
2414 }
2415
2416 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2417 self.feature_flags
2418 .deprecate_global_storage_ops_during_deserialization
2419 }
2420
2421 pub fn enable_observation_chunking(&self) -> bool {
2422 matches!(self.feature_flags.per_object_congestion_control_mode,
2423 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2424 if params.observations_chunk_size.is_some()
2425 )
2426 }
2427
2428 pub fn deprecate_global_storage_ops(&self) -> bool {
2429 self.feature_flags.deprecate_global_storage_ops
2430 }
2431
2432 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2433 self.feature_flags.consensus_skip_gced_accept_votes
2434 }
2435
2436 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2437 self.feature_flags
2438 .include_cancelled_randomness_txns_in_prologue
2439 }
2440
2441 pub fn address_aliases(&self) -> bool {
2442 let address_aliases = self.feature_flags.address_aliases;
2443 assert!(
2444 !address_aliases || self.mysticeti_fastpath(),
2445 "Address aliases requires Mysticeti fastpath to be enabled"
2446 );
2447 if address_aliases {
2448 }
2450 address_aliases
2451 }
2452
2453 pub fn enable_object_funds_withdraw(&self) -> bool {
2454 self.feature_flags.enable_object_funds_withdraw
2455 }
2456}
2457
2458#[cfg(not(msim))]
2459static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2460
2461#[cfg(msim)]
2463thread_local! {
2464 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2465}
2466
2467impl ProtocolConfig {
2469 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2471 assert!(
2473 version >= ProtocolVersion::MIN,
2474 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2475 version,
2476 ProtocolVersion::MIN.0,
2477 );
2478 assert!(
2479 version <= ProtocolVersion::MAX_ALLOWED,
2480 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2481 version,
2482 ProtocolVersion::MAX_ALLOWED.0,
2483 );
2484
2485 let mut ret = Self::get_for_version_impl(version, chain);
2486 ret.version = version;
2487
2488 ret = CONFIG_OVERRIDE.with(|ovr| {
2489 if let Some(override_fn) = &*ovr.borrow() {
2490 warn!(
2491 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2492 );
2493 override_fn(version, ret)
2494 } else {
2495 ret
2496 }
2497 });
2498
2499 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2500 warn!(
2501 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2502 );
2503 let overrides: ProtocolConfigOptional =
2504 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2505 .expect("failed to parse ProtocolConfig override env variables");
2506 overrides.apply_to(&mut ret);
2507 }
2508
2509 ret
2510 }
2511
2512 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2515 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2516 let mut ret = Self::get_for_version_impl(version, chain);
2517 ret.version = version;
2518 Some(ret)
2519 } else {
2520 None
2521 }
2522 }
2523
2524 #[cfg(not(msim))]
2525 pub fn poison_get_for_min_version() {
2526 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2527 }
2528
2529 #[cfg(not(msim))]
2530 fn load_poison_get_for_min_version() -> bool {
2531 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2532 }
2533
2534 #[cfg(msim)]
2535 pub fn poison_get_for_min_version() {
2536 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2537 }
2538
2539 #[cfg(msim)]
2540 fn load_poison_get_for_min_version() -> bool {
2541 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2542 }
2543
2544 pub fn get_for_min_version() -> Self {
2547 if Self::load_poison_get_for_min_version() {
2548 panic!("get_for_min_version called on validator");
2549 }
2550 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2551 }
2552
2553 #[allow(non_snake_case)]
2563 pub fn get_for_max_version_UNSAFE() -> Self {
2564 if Self::load_poison_get_for_min_version() {
2565 panic!("get_for_max_version_UNSAFE called on validator");
2566 }
2567 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2568 }
2569
2570 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2571 #[cfg(msim)]
2572 {
2573 if version == ProtocolVersion::MAX_ALLOWED {
2575 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2576 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2577 return config;
2578 }
2579 }
2580
2581 let mut cfg = Self {
2584 version,
2586
2587 feature_flags: Default::default(),
2589
2590 max_tx_size_bytes: Some(128 * 1024),
2591 max_input_objects: Some(2048),
2593 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2594 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2595 max_gas_payment_objects: Some(256),
2596 max_modules_in_publish: Some(128),
2597 max_package_dependencies: None,
2598 max_arguments: Some(512),
2599 max_type_arguments: Some(16),
2600 max_type_argument_depth: Some(16),
2601 max_pure_argument_size: Some(16 * 1024),
2602 max_programmable_tx_commands: Some(1024),
2603 move_binary_format_version: Some(6),
2604 min_move_binary_format_version: None,
2605 binary_module_handles: None,
2606 binary_struct_handles: None,
2607 binary_function_handles: None,
2608 binary_function_instantiations: None,
2609 binary_signatures: None,
2610 binary_constant_pool: None,
2611 binary_identifiers: None,
2612 binary_address_identifiers: None,
2613 binary_struct_defs: None,
2614 binary_struct_def_instantiations: None,
2615 binary_function_defs: None,
2616 binary_field_handles: None,
2617 binary_field_instantiations: None,
2618 binary_friend_decls: None,
2619 binary_enum_defs: None,
2620 binary_enum_def_instantiations: None,
2621 binary_variant_handles: None,
2622 binary_variant_instantiation_handles: None,
2623 max_move_object_size: Some(250 * 1024),
2624 max_move_package_size: Some(100 * 1024),
2625 max_publish_or_upgrade_per_ptb: None,
2626 max_tx_gas: Some(10_000_000_000),
2627 max_gas_price: Some(100_000),
2628 max_gas_price_rgp_factor_for_aborted_transactions: None,
2629 max_gas_computation_bucket: Some(5_000_000),
2630 max_loop_depth: Some(5),
2631 max_generic_instantiation_length: Some(32),
2632 max_function_parameters: Some(128),
2633 max_basic_blocks: Some(1024),
2634 max_value_stack_size: Some(1024),
2635 max_type_nodes: Some(256),
2636 max_push_size: Some(10000),
2637 max_struct_definitions: Some(200),
2638 max_function_definitions: Some(1000),
2639 max_fields_in_struct: Some(32),
2640 max_dependency_depth: Some(100),
2641 max_num_event_emit: Some(256),
2642 max_num_new_move_object_ids: Some(2048),
2643 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2644 max_num_deleted_move_object_ids: Some(2048),
2645 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2646 max_num_transferred_move_object_ids: Some(2048),
2647 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2648 max_event_emit_size: Some(250 * 1024),
2649 max_move_vector_len: Some(256 * 1024),
2650 max_type_to_layout_nodes: None,
2651 max_ptb_value_size: None,
2652
2653 max_back_edges_per_function: Some(10_000),
2654 max_back_edges_per_module: Some(10_000),
2655 max_verifier_meter_ticks_per_function: Some(6_000_000),
2656 max_meter_ticks_per_module: Some(6_000_000),
2657 max_meter_ticks_per_package: None,
2658
2659 object_runtime_max_num_cached_objects: Some(1000),
2660 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2661 object_runtime_max_num_store_entries: Some(1000),
2662 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2663 base_tx_cost_fixed: Some(110_000),
2664 package_publish_cost_fixed: Some(1_000),
2665 base_tx_cost_per_byte: Some(0),
2666 package_publish_cost_per_byte: Some(80),
2667 obj_access_cost_read_per_byte: Some(15),
2668 obj_access_cost_mutate_per_byte: Some(40),
2669 obj_access_cost_delete_per_byte: Some(40),
2670 obj_access_cost_verify_per_byte: Some(200),
2671 obj_data_cost_refundable: Some(100),
2672 obj_metadata_cost_non_refundable: Some(50),
2673 gas_model_version: Some(1),
2674 storage_rebate_rate: Some(9900),
2675 storage_fund_reinvest_rate: Some(500),
2676 reward_slashing_rate: Some(5000),
2677 storage_gas_price: Some(1),
2678 max_transactions_per_checkpoint: Some(10_000),
2679 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2680
2681 buffer_stake_for_protocol_upgrade_bps: Some(0),
2684
2685 address_from_bytes_cost_base: Some(52),
2689 address_to_u256_cost_base: Some(52),
2691 address_from_u256_cost_base: Some(52),
2693
2694 config_read_setting_impl_cost_base: None,
2697 config_read_setting_impl_cost_per_byte: None,
2698
2699 dynamic_field_hash_type_and_key_cost_base: Some(100),
2702 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2703 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2704 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2705 dynamic_field_add_child_object_cost_base: Some(100),
2707 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2708 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2709 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2710 dynamic_field_borrow_child_object_cost_base: Some(100),
2712 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2713 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2714 dynamic_field_remove_child_object_cost_base: Some(100),
2716 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2717 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2718 dynamic_field_has_child_object_cost_base: Some(100),
2720 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2722 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2723 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2724
2725 event_emit_cost_base: Some(52),
2728 event_emit_value_size_derivation_cost_per_byte: Some(2),
2729 event_emit_tag_size_derivation_cost_per_byte: Some(5),
2730 event_emit_output_cost_per_byte: Some(10),
2731 event_emit_auth_stream_cost: None,
2732
2733 object_borrow_uid_cost_base: Some(52),
2736 object_delete_impl_cost_base: Some(52),
2738 object_record_new_uid_cost_base: Some(52),
2740
2741 transfer_transfer_internal_cost_base: Some(52),
2744 transfer_party_transfer_internal_cost_base: None,
2746 transfer_freeze_object_cost_base: Some(52),
2748 transfer_share_object_cost_base: Some(52),
2750 transfer_receive_object_cost_base: None,
2751
2752 tx_context_derive_id_cost_base: Some(52),
2755 tx_context_fresh_id_cost_base: None,
2756 tx_context_sender_cost_base: None,
2757 tx_context_epoch_cost_base: None,
2758 tx_context_epoch_timestamp_ms_cost_base: None,
2759 tx_context_sponsor_cost_base: None,
2760 tx_context_rgp_cost_base: None,
2761 tx_context_gas_price_cost_base: None,
2762 tx_context_gas_budget_cost_base: None,
2763 tx_context_ids_created_cost_base: None,
2764 tx_context_replace_cost_base: None,
2765
2766 types_is_one_time_witness_cost_base: Some(52),
2769 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
2770 types_is_one_time_witness_type_cost_per_byte: Some(2),
2771
2772 validator_validate_metadata_cost_base: Some(52),
2775 validator_validate_metadata_data_cost_per_byte: Some(2),
2776
2777 crypto_invalid_arguments_cost: Some(100),
2779 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
2781 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
2782 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
2783
2784 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
2786 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
2787 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
2788
2789 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
2791 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2792 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2793 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
2794 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2795 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
2796
2797 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
2799
2800 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
2802 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
2803 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
2804 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
2805 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
2806 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
2807
2808 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
2810 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
2811 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
2812 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
2813 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
2814 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
2815
2816 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
2818 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
2819 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
2820 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
2821 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
2822 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
2823
2824 ecvrf_ecvrf_verify_cost_base: Some(52),
2826 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
2827 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
2828
2829 ed25519_ed25519_verify_cost_base: Some(52),
2831 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
2832 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
2833
2834 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
2836 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
2837
2838 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
2840 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
2841 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
2842 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
2843 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
2844
2845 hash_blake2b256_cost_base: Some(52),
2847 hash_blake2b256_data_cost_per_byte: Some(2),
2848 hash_blake2b256_data_cost_per_block: Some(2),
2849 hash_keccak256_cost_base: Some(52),
2851 hash_keccak256_data_cost_per_byte: Some(2),
2852 hash_keccak256_data_cost_per_block: Some(2),
2853
2854 poseidon_bn254_cost_base: None,
2855 poseidon_bn254_cost_per_block: None,
2856
2857 hmac_hmac_sha3_256_cost_base: Some(52),
2859 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
2860 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
2861
2862 group_ops_bls12381_decode_scalar_cost: None,
2864 group_ops_bls12381_decode_g1_cost: None,
2865 group_ops_bls12381_decode_g2_cost: None,
2866 group_ops_bls12381_decode_gt_cost: None,
2867 group_ops_bls12381_scalar_add_cost: None,
2868 group_ops_bls12381_g1_add_cost: None,
2869 group_ops_bls12381_g2_add_cost: None,
2870 group_ops_bls12381_gt_add_cost: None,
2871 group_ops_bls12381_scalar_sub_cost: None,
2872 group_ops_bls12381_g1_sub_cost: None,
2873 group_ops_bls12381_g2_sub_cost: None,
2874 group_ops_bls12381_gt_sub_cost: None,
2875 group_ops_bls12381_scalar_mul_cost: None,
2876 group_ops_bls12381_g1_mul_cost: None,
2877 group_ops_bls12381_g2_mul_cost: None,
2878 group_ops_bls12381_gt_mul_cost: None,
2879 group_ops_bls12381_scalar_div_cost: None,
2880 group_ops_bls12381_g1_div_cost: None,
2881 group_ops_bls12381_g2_div_cost: None,
2882 group_ops_bls12381_gt_div_cost: None,
2883 group_ops_bls12381_g1_hash_to_base_cost: None,
2884 group_ops_bls12381_g2_hash_to_base_cost: None,
2885 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
2886 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
2887 group_ops_bls12381_g1_msm_base_cost: None,
2888 group_ops_bls12381_g2_msm_base_cost: None,
2889 group_ops_bls12381_g1_msm_base_cost_per_input: None,
2890 group_ops_bls12381_g2_msm_base_cost_per_input: None,
2891 group_ops_bls12381_msm_max_len: None,
2892 group_ops_bls12381_pairing_cost: None,
2893 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
2894 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
2895 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
2896 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
2897 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
2898
2899 check_zklogin_id_cost_base: None,
2901 check_zklogin_issuer_cost_base: None,
2903
2904 vdf_verify_vdf_cost: None,
2905 vdf_hash_to_input_cost: None,
2906
2907 nitro_attestation_parse_base_cost: None,
2909 nitro_attestation_parse_cost_per_byte: None,
2910 nitro_attestation_verify_base_cost: None,
2911 nitro_attestation_verify_cost_per_cert: None,
2912
2913 bcs_per_byte_serialized_cost: None,
2914 bcs_legacy_min_output_size_cost: None,
2915 bcs_failure_cost: None,
2916 hash_sha2_256_base_cost: None,
2917 hash_sha2_256_per_byte_cost: None,
2918 hash_sha2_256_legacy_min_input_len_cost: None,
2919 hash_sha3_256_base_cost: None,
2920 hash_sha3_256_per_byte_cost: None,
2921 hash_sha3_256_legacy_min_input_len_cost: None,
2922 type_name_get_base_cost: None,
2923 type_name_get_per_byte_cost: None,
2924 type_name_id_base_cost: None,
2925 string_check_utf8_base_cost: None,
2926 string_check_utf8_per_byte_cost: None,
2927 string_is_char_boundary_base_cost: None,
2928 string_sub_string_base_cost: None,
2929 string_sub_string_per_byte_cost: None,
2930 string_index_of_base_cost: None,
2931 string_index_of_per_byte_pattern_cost: None,
2932 string_index_of_per_byte_searched_cost: None,
2933 vector_empty_base_cost: None,
2934 vector_length_base_cost: None,
2935 vector_push_back_base_cost: None,
2936 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
2937 vector_borrow_base_cost: None,
2938 vector_pop_back_base_cost: None,
2939 vector_destroy_empty_base_cost: None,
2940 vector_swap_base_cost: None,
2941 debug_print_base_cost: None,
2942 debug_print_stack_trace_base_cost: None,
2943
2944 max_size_written_objects: None,
2945 max_size_written_objects_system_tx: None,
2946
2947 max_move_identifier_len: None,
2954 max_move_value_depth: None,
2955 max_move_enum_variants: None,
2956
2957 gas_rounding_step: None,
2958
2959 execution_version: None,
2960
2961 max_event_emit_size_total: None,
2962
2963 consensus_bad_nodes_stake_threshold: None,
2964
2965 max_jwk_votes_per_validator_per_epoch: None,
2966
2967 max_age_of_jwk_in_epochs: None,
2968
2969 random_beacon_reduction_allowed_delta: None,
2970
2971 random_beacon_reduction_lower_bound: None,
2972
2973 random_beacon_dkg_timeout_round: None,
2974
2975 random_beacon_min_round_interval_ms: None,
2976
2977 random_beacon_dkg_version: None,
2978
2979 consensus_max_transaction_size_bytes: None,
2980
2981 consensus_max_transactions_in_block_bytes: None,
2982
2983 consensus_max_num_transactions_in_block: None,
2984
2985 consensus_voting_rounds: None,
2986
2987 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
2988
2989 max_deferral_rounds_for_congestion_control: None,
2990
2991 max_txn_cost_overage_per_object_in_commit: None,
2992
2993 allowed_txn_cost_overage_burst_per_object_in_commit: None,
2994
2995 min_checkpoint_interval_ms: None,
2996
2997 checkpoint_summary_version_specific_data: None,
2998
2999 max_soft_bundle_size: None,
3000
3001 bridge_should_try_to_finalize_committee: None,
3002
3003 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3004
3005 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3006
3007 consensus_gc_depth: None,
3008
3009 gas_budget_based_txn_cost_cap_factor: None,
3010
3011 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3012
3013 sip_45_consensus_amplification_threshold: None,
3014
3015 use_object_per_epoch_marker_table_v2: None,
3016
3017 consensus_commit_rate_estimation_window_size: None,
3018
3019 aliased_addresses: vec![],
3020
3021 translation_per_command_base_charge: None,
3022 translation_per_input_base_charge: None,
3023 translation_pure_input_per_byte_charge: None,
3024 translation_per_type_node_charge: None,
3025 translation_per_reference_node_charge: None,
3026 translation_per_linkage_entry_charge: None,
3027
3028 max_updates_per_settlement_txn: None,
3029 };
3032 for cur in 2..=version.0 {
3033 match cur {
3034 1 => unreachable!(),
3035 2 => {
3036 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3037 }
3038 3 => {
3039 cfg.gas_model_version = Some(2);
3041 cfg.max_tx_gas = Some(50_000_000_000);
3043 cfg.base_tx_cost_fixed = Some(2_000);
3045 cfg.storage_gas_price = Some(76);
3047 cfg.feature_flags.loaded_child_objects_fixed = true;
3048 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3051 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3054 cfg.feature_flags.package_upgrades = true;
3055 }
3056 4 => {
3061 cfg.reward_slashing_rate = Some(10000);
3063 cfg.gas_model_version = Some(3);
3065 }
3066 5 => {
3067 cfg.feature_flags.missing_type_is_compatibility_error = true;
3068 cfg.gas_model_version = Some(4);
3069 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3070 }
3074 6 => {
3075 cfg.gas_model_version = Some(5);
3076 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3077 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3078 }
3079 7 => {
3080 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3081 cfg.feature_flags
3082 .disable_invariant_violation_check_in_swap_loc = true;
3083 cfg.feature_flags.ban_entry_init = true;
3084 cfg.feature_flags.package_digest_hash_module = true;
3085 }
3086 8 => {
3087 cfg.feature_flags
3088 .disallow_change_struct_type_params_on_upgrade = true;
3089 }
3090 9 => {
3091 cfg.max_move_identifier_len = Some(128);
3093 cfg.feature_flags.no_extraneous_module_bytes = true;
3094 cfg.feature_flags
3095 .advance_to_highest_supported_protocol_version = true;
3096 }
3097 10 => {
3098 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3099 cfg.max_meter_ticks_per_module = Some(16_000_000);
3100 }
3101 11 => {
3102 cfg.max_move_value_depth = Some(128);
3103 }
3104 12 => {
3105 cfg.feature_flags.narwhal_versioned_metadata = true;
3106 if chain != Chain::Mainnet {
3107 cfg.feature_flags.commit_root_state_digest = true;
3108 }
3109
3110 if chain != Chain::Mainnet && chain != Chain::Testnet {
3111 cfg.feature_flags.zklogin_auth = true;
3112 }
3113 }
3114 13 => {}
3115 14 => {
3116 cfg.gas_rounding_step = Some(1_000);
3117 cfg.gas_model_version = Some(6);
3118 }
3119 15 => {
3120 cfg.feature_flags.consensus_transaction_ordering =
3121 ConsensusTransactionOrdering::ByGasPrice;
3122 }
3123 16 => {
3124 cfg.feature_flags.simplified_unwrap_then_delete = true;
3125 }
3126 17 => {
3127 cfg.feature_flags.upgraded_multisig_supported = true;
3128 }
3129 18 => {
3130 cfg.execution_version = Some(1);
3131 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3140 cfg.base_tx_cost_fixed = Some(1_000);
3142 }
3143 19 => {
3144 cfg.max_num_event_emit = Some(1024);
3145 cfg.max_event_emit_size_total = Some(
3148 256 * 250 * 1024, );
3150 }
3151 20 => {
3152 cfg.feature_flags.commit_root_state_digest = true;
3153
3154 if chain != Chain::Mainnet {
3155 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3156 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3157 }
3158 }
3159
3160 21 => {
3161 if chain != Chain::Mainnet {
3162 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3163 "Google".to_string(),
3164 "Facebook".to_string(),
3165 "Twitch".to_string(),
3166 ]);
3167 }
3168 }
3169 22 => {
3170 cfg.feature_flags.loaded_child_object_format = true;
3171 }
3172 23 => {
3173 cfg.feature_flags.loaded_child_object_format_type = true;
3174 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3175 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3181 }
3182 24 => {
3183 cfg.feature_flags.simple_conservation_checks = true;
3184 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3185
3186 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3187
3188 if chain != Chain::Mainnet {
3189 cfg.feature_flags.enable_jwk_consensus_updates = true;
3190 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3192 cfg.max_age_of_jwk_in_epochs = Some(1);
3193 }
3194 }
3195 25 => {
3196 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3198 "Google".to_string(),
3199 "Facebook".to_string(),
3200 "Twitch".to_string(),
3201 ]);
3202 cfg.feature_flags.zklogin_auth = true;
3203
3204 cfg.feature_flags.enable_jwk_consensus_updates = true;
3206 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3207 cfg.max_age_of_jwk_in_epochs = Some(1);
3208 }
3209 26 => {
3210 cfg.gas_model_version = Some(7);
3211 if chain != Chain::Mainnet && chain != Chain::Testnet {
3213 cfg.transfer_receive_object_cost_base = Some(52);
3214 cfg.feature_flags.receive_objects = true;
3215 }
3216 }
3217 27 => {
3218 cfg.gas_model_version = Some(8);
3219 }
3220 28 => {
3221 cfg.check_zklogin_id_cost_base = Some(200);
3223 cfg.check_zklogin_issuer_cost_base = Some(200);
3225
3226 if chain != Chain::Mainnet && chain != Chain::Testnet {
3228 cfg.feature_flags.enable_effects_v2 = true;
3229 }
3230 }
3231 29 => {
3232 cfg.feature_flags.verify_legacy_zklogin_address = true;
3233 }
3234 30 => {
3235 if chain != Chain::Mainnet {
3237 cfg.feature_flags.narwhal_certificate_v2 = true;
3238 }
3239
3240 cfg.random_beacon_reduction_allowed_delta = Some(800);
3241 if chain != Chain::Mainnet {
3243 cfg.feature_flags.enable_effects_v2 = true;
3244 }
3245
3246 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3250
3251 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3252 }
3253 31 => {
3254 cfg.execution_version = Some(2);
3255 if chain != Chain::Mainnet && chain != Chain::Testnet {
3257 cfg.feature_flags.shared_object_deletion = true;
3258 }
3259 }
3260 32 => {
3261 if chain != Chain::Mainnet {
3263 cfg.feature_flags.accept_zklogin_in_multisig = true;
3264 }
3265 if chain != Chain::Mainnet {
3267 cfg.transfer_receive_object_cost_base = Some(52);
3268 cfg.feature_flags.receive_objects = true;
3269 }
3270 if chain != Chain::Mainnet && chain != Chain::Testnet {
3272 cfg.feature_flags.random_beacon = true;
3273 cfg.random_beacon_reduction_lower_bound = Some(1600);
3274 cfg.random_beacon_dkg_timeout_round = Some(3000);
3275 cfg.random_beacon_min_round_interval_ms = Some(150);
3276 }
3277 if chain != Chain::Testnet && chain != Chain::Mainnet {
3279 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3280 }
3281
3282 cfg.feature_flags.narwhal_certificate_v2 = true;
3284 }
3285 33 => {
3286 cfg.feature_flags.hardened_otw_check = true;
3287 cfg.feature_flags.allow_receiving_object_id = true;
3288
3289 cfg.transfer_receive_object_cost_base = Some(52);
3291 cfg.feature_flags.receive_objects = true;
3292
3293 if chain != Chain::Mainnet {
3295 cfg.feature_flags.shared_object_deletion = true;
3296 }
3297
3298 cfg.feature_flags.enable_effects_v2 = true;
3299 }
3300 34 => {}
3301 35 => {
3302 if chain != Chain::Mainnet && chain != Chain::Testnet {
3304 cfg.feature_flags.enable_poseidon = true;
3305 cfg.poseidon_bn254_cost_base = Some(260);
3306 cfg.poseidon_bn254_cost_per_block = Some(10);
3307 }
3308
3309 cfg.feature_flags.enable_coin_deny_list = true;
3310 }
3311 36 => {
3312 if chain != Chain::Mainnet && chain != Chain::Testnet {
3314 cfg.feature_flags.enable_group_ops_native_functions = true;
3315 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3316 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3318 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3319 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3320 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3321 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3322 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3323 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3324 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3325 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3326 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3327 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3328 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3329 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3330 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3331 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3332 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3333 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3334 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3335 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3336 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3337 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3338 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3339 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3340 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3341 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3342 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3343 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3344 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3345 cfg.group_ops_bls12381_msm_max_len = Some(32);
3346 cfg.group_ops_bls12381_pairing_cost = Some(52);
3347 }
3348 cfg.feature_flags.shared_object_deletion = true;
3350
3351 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3353 }
3355 37 => {
3356 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3357
3358 if chain != Chain::Mainnet {
3360 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3361 }
3362 }
3363 38 => {
3364 cfg.binary_module_handles = Some(100);
3365 cfg.binary_struct_handles = Some(300);
3366 cfg.binary_function_handles = Some(1500);
3367 cfg.binary_function_instantiations = Some(750);
3368 cfg.binary_signatures = Some(1000);
3369 cfg.binary_constant_pool = Some(4000);
3373 cfg.binary_identifiers = Some(10000);
3374 cfg.binary_address_identifiers = Some(100);
3375 cfg.binary_struct_defs = Some(200);
3376 cfg.binary_struct_def_instantiations = Some(100);
3377 cfg.binary_function_defs = Some(1000);
3378 cfg.binary_field_handles = Some(500);
3379 cfg.binary_field_instantiations = Some(250);
3380 cfg.binary_friend_decls = Some(100);
3381 cfg.max_package_dependencies = Some(32);
3383 cfg.max_modules_in_publish = Some(64);
3384 cfg.execution_version = Some(3);
3386 }
3387 39 => {
3388 }
3390 40 => {}
3391 41 => {
3392 cfg.feature_flags.enable_group_ops_native_functions = true;
3394 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3396 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3397 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3398 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3399 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3400 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3401 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3402 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3403 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3404 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3405 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3406 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3407 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3408 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3409 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3410 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3411 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3412 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3413 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3414 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3415 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3416 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3417 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3418 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3419 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3420 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3421 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3422 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3423 cfg.group_ops_bls12381_msm_max_len = Some(32);
3424 cfg.group_ops_bls12381_pairing_cost = Some(52);
3425 }
3426 42 => {}
3427 43 => {
3428 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3429 cfg.max_meter_ticks_per_package = Some(16_000_000);
3430 }
3431 44 => {
3432 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3434 if chain != Chain::Mainnet {
3436 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3437 }
3438 }
3439 45 => {
3440 if chain != Chain::Testnet && chain != Chain::Mainnet {
3442 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3443 }
3444
3445 if chain != Chain::Mainnet {
3446 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3448 }
3449 cfg.min_move_binary_format_version = Some(6);
3450 cfg.feature_flags.accept_zklogin_in_multisig = true;
3451
3452 if chain != Chain::Mainnet && chain != Chain::Testnet {
3456 cfg.feature_flags.bridge = true;
3457 }
3458 }
3459 46 => {
3460 if chain != Chain::Mainnet {
3462 cfg.feature_flags.bridge = true;
3463 }
3464
3465 cfg.feature_flags.reshare_at_same_initial_version = true;
3467 }
3468 47 => {}
3469 48 => {
3470 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3472
3473 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3475
3476 if chain != Chain::Mainnet {
3478 cfg.feature_flags.random_beacon = true;
3479 cfg.random_beacon_reduction_lower_bound = Some(1600);
3480 cfg.random_beacon_dkg_timeout_round = Some(3000);
3481 cfg.random_beacon_min_round_interval_ms = Some(200);
3482 }
3483
3484 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3486 }
3487 49 => {
3488 if chain != Chain::Testnet && chain != Chain::Mainnet {
3489 cfg.move_binary_format_version = Some(7);
3490 }
3491
3492 if chain != Chain::Mainnet && chain != Chain::Testnet {
3494 cfg.feature_flags.enable_vdf = true;
3495 cfg.vdf_verify_vdf_cost = Some(1500);
3498 cfg.vdf_hash_to_input_cost = Some(100);
3499 }
3500
3501 if chain != Chain::Testnet && chain != Chain::Mainnet {
3503 cfg.feature_flags
3504 .record_consensus_determined_version_assignments_in_prologue = true;
3505 }
3506
3507 if chain != Chain::Mainnet {
3509 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3510 }
3511
3512 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3514 }
3515 50 => {
3516 if chain != Chain::Mainnet {
3518 cfg.checkpoint_summary_version_specific_data = Some(1);
3519 cfg.min_checkpoint_interval_ms = Some(200);
3520 }
3521
3522 if chain != Chain::Testnet && chain != Chain::Mainnet {
3524 cfg.feature_flags
3525 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3526 }
3527
3528 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3529
3530 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3532 }
3533 51 => {
3534 cfg.random_beacon_dkg_version = Some(1);
3535
3536 if chain != Chain::Testnet && chain != Chain::Mainnet {
3537 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3538 }
3539 }
3540 52 => {
3541 if chain != Chain::Mainnet {
3542 cfg.feature_flags.soft_bundle = true;
3543 cfg.max_soft_bundle_size = Some(5);
3544 }
3545
3546 cfg.config_read_setting_impl_cost_base = Some(100);
3547 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3548
3549 if chain != Chain::Testnet && chain != Chain::Mainnet {
3551 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3552 cfg.feature_flags.per_object_congestion_control_mode =
3553 PerObjectCongestionControlMode::TotalTxCount;
3554 }
3555
3556 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3558
3559 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3561
3562 cfg.checkpoint_summary_version_specific_data = Some(1);
3564 cfg.min_checkpoint_interval_ms = Some(200);
3565
3566 if chain != Chain::Mainnet {
3568 cfg.feature_flags
3569 .record_consensus_determined_version_assignments_in_prologue = true;
3570 cfg.feature_flags
3571 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3572 }
3573 if chain != Chain::Mainnet {
3575 cfg.move_binary_format_version = Some(7);
3576 }
3577
3578 if chain != Chain::Testnet && chain != Chain::Mainnet {
3579 cfg.feature_flags.passkey_auth = true;
3580 }
3581 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3582 }
3583 53 => {
3584 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3586
3587 cfg.feature_flags
3589 .record_consensus_determined_version_assignments_in_prologue = true;
3590 cfg.feature_flags
3591 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3592
3593 if chain == Chain::Unknown {
3594 cfg.feature_flags.authority_capabilities_v2 = true;
3595 }
3596
3597 if chain != Chain::Mainnet {
3599 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3600 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3601 cfg.feature_flags.per_object_congestion_control_mode =
3602 PerObjectCongestionControlMode::TotalTxCount;
3603 }
3604
3605 cfg.bcs_per_byte_serialized_cost = Some(2);
3607 cfg.bcs_legacy_min_output_size_cost = Some(1);
3608 cfg.bcs_failure_cost = Some(52);
3609 cfg.debug_print_base_cost = Some(52);
3610 cfg.debug_print_stack_trace_base_cost = Some(52);
3611 cfg.hash_sha2_256_base_cost = Some(52);
3612 cfg.hash_sha2_256_per_byte_cost = Some(2);
3613 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3614 cfg.hash_sha3_256_base_cost = Some(52);
3615 cfg.hash_sha3_256_per_byte_cost = Some(2);
3616 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3617 cfg.type_name_get_base_cost = Some(52);
3618 cfg.type_name_get_per_byte_cost = Some(2);
3619 cfg.string_check_utf8_base_cost = Some(52);
3620 cfg.string_check_utf8_per_byte_cost = Some(2);
3621 cfg.string_is_char_boundary_base_cost = Some(52);
3622 cfg.string_sub_string_base_cost = Some(52);
3623 cfg.string_sub_string_per_byte_cost = Some(2);
3624 cfg.string_index_of_base_cost = Some(52);
3625 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3626 cfg.string_index_of_per_byte_searched_cost = Some(2);
3627 cfg.vector_empty_base_cost = Some(52);
3628 cfg.vector_length_base_cost = Some(52);
3629 cfg.vector_push_back_base_cost = Some(52);
3630 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3631 cfg.vector_borrow_base_cost = Some(52);
3632 cfg.vector_pop_back_base_cost = Some(52);
3633 cfg.vector_destroy_empty_base_cost = Some(52);
3634 cfg.vector_swap_base_cost = Some(52);
3635 }
3636 54 => {
3637 cfg.feature_flags.random_beacon = true;
3639 cfg.random_beacon_reduction_lower_bound = Some(1000);
3640 cfg.random_beacon_dkg_timeout_round = Some(3000);
3641 cfg.random_beacon_min_round_interval_ms = Some(500);
3642
3643 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3645 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3646 cfg.feature_flags.per_object_congestion_control_mode =
3647 PerObjectCongestionControlMode::TotalTxCount;
3648
3649 cfg.feature_flags.soft_bundle = true;
3651 cfg.max_soft_bundle_size = Some(5);
3652 }
3653 55 => {
3654 cfg.move_binary_format_version = Some(7);
3656
3657 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3659 cfg.consensus_max_num_transactions_in_block = Some(512);
3662
3663 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3664 }
3665 56 => {
3666 if chain == Chain::Mainnet {
3667 cfg.feature_flags.bridge = true;
3668 }
3669 }
3670 57 => {
3671 cfg.random_beacon_reduction_lower_bound = Some(800);
3673 }
3674 58 => {
3675 if chain == Chain::Mainnet {
3676 cfg.bridge_should_try_to_finalize_committee = Some(true);
3677 }
3678
3679 if chain != Chain::Mainnet && chain != Chain::Testnet {
3680 cfg.feature_flags
3682 .consensus_distributed_vote_scoring_strategy = true;
3683 }
3684 }
3685 59 => {
3686 cfg.feature_flags.consensus_round_prober = true;
3688 }
3689 60 => {
3690 cfg.max_type_to_layout_nodes = Some(512);
3691 cfg.feature_flags.validate_identifier_inputs = true;
3692 }
3693 61 => {
3694 if chain != Chain::Mainnet {
3695 cfg.feature_flags
3697 .consensus_distributed_vote_scoring_strategy = true;
3698 }
3699 cfg.random_beacon_reduction_lower_bound = Some(700);
3701
3702 if chain != Chain::Mainnet && chain != Chain::Testnet {
3703 cfg.feature_flags.mysticeti_fastpath = true;
3705 }
3706 }
3707 62 => {
3708 cfg.feature_flags.relocate_event_module = true;
3709 }
3710 63 => {
3711 cfg.feature_flags.per_object_congestion_control_mode =
3712 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3713 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3714 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3715 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
3716 }
3717 64 => {
3718 cfg.feature_flags.per_object_congestion_control_mode =
3719 PerObjectCongestionControlMode::TotalTxCount;
3720 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
3721 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
3722 }
3723 65 => {
3724 cfg.feature_flags
3726 .consensus_distributed_vote_scoring_strategy = true;
3727 }
3728 66 => {
3729 if chain == Chain::Mainnet {
3730 cfg.feature_flags
3732 .consensus_distributed_vote_scoring_strategy = false;
3733 }
3734 }
3735 67 => {
3736 cfg.feature_flags
3738 .consensus_distributed_vote_scoring_strategy = true;
3739 }
3740 68 => {
3741 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
3742 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
3743 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
3744 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
3745 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
3746
3747 if chain != Chain::Mainnet && chain != Chain::Testnet {
3748 cfg.feature_flags.uncompressed_g1_group_elements = true;
3749 }
3750
3751 cfg.feature_flags.per_object_congestion_control_mode =
3752 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3753 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3754 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
3755 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3756 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3758 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3759
3760 cfg.random_beacon_reduction_lower_bound = Some(500);
3762
3763 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
3764 }
3765 69 => {
3766 cfg.consensus_voting_rounds = Some(40);
3768
3769 if chain != Chain::Mainnet && chain != Chain::Testnet {
3770 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3772 }
3773
3774 if chain != Chain::Mainnet {
3775 cfg.feature_flags.uncompressed_g1_group_elements = true;
3776 }
3777 }
3778 70 => {
3779 if chain != Chain::Mainnet {
3780 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3782 cfg.feature_flags
3784 .consensus_round_prober_probe_accepted_rounds = true;
3785 }
3786
3787 cfg.poseidon_bn254_cost_per_block = Some(388);
3788
3789 cfg.gas_model_version = Some(9);
3790 cfg.feature_flags.native_charging_v2 = true;
3791 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
3792 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
3793 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
3794 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
3795 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
3796 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
3797 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
3798 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
3799
3800 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
3802 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
3803 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
3804 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
3805
3806 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
3807 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
3808 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
3809 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
3810 Some(8213);
3811 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
3812 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
3813 Some(9484);
3814
3815 cfg.hash_keccak256_cost_base = Some(10);
3816 cfg.hash_blake2b256_cost_base = Some(10);
3817
3818 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
3820 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
3821 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
3822 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
3823
3824 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
3825 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
3826 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
3827 cfg.group_ops_bls12381_gt_add_cost = Some(188);
3828
3829 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
3830 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
3831 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
3832 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
3833
3834 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
3835 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
3836 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
3837 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
3838
3839 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
3840 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
3841 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
3842 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
3843
3844 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
3845 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
3846
3847 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
3848 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
3849 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
3850 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
3851
3852 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
3853 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
3854 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
3855 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
3856
3857 cfg.group_ops_bls12381_pairing_cost = Some(26897);
3858 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
3859
3860 cfg.validator_validate_metadata_cost_base = Some(20000);
3861 }
3862 71 => {
3863 cfg.sip_45_consensus_amplification_threshold = Some(5);
3864
3865 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
3867 }
3868 72 => {
3869 cfg.feature_flags.convert_type_argument_error = true;
3870
3871 cfg.max_tx_gas = Some(50_000_000_000_000);
3874 cfg.max_gas_price = Some(50_000_000_000);
3876
3877 cfg.feature_flags.variant_nodes = true;
3878 }
3879 73 => {
3880 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
3882
3883 if chain != Chain::Mainnet && chain != Chain::Testnet {
3884 cfg.consensus_gc_depth = Some(60);
3887 }
3888
3889 if chain != Chain::Mainnet {
3890 cfg.feature_flags.consensus_zstd_compression = true;
3892 }
3893
3894 cfg.feature_flags.consensus_smart_ancestor_selection = true;
3896 cfg.feature_flags
3898 .consensus_round_prober_probe_accepted_rounds = true;
3899
3900 cfg.feature_flags.per_object_congestion_control_mode =
3902 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
3903 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
3904 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
3905 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
3906 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
3908 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
3909 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
3910 }
3911 74 => {
3912 if chain != Chain::Mainnet && chain != Chain::Testnet {
3914 cfg.feature_flags.enable_nitro_attestation = true;
3915 }
3916 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
3917 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
3918 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
3919 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
3920
3921 cfg.feature_flags.consensus_zstd_compression = true;
3923
3924 if chain != Chain::Mainnet && chain != Chain::Testnet {
3925 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
3926 }
3927 }
3928 75 => {
3929 if chain != Chain::Mainnet {
3930 cfg.feature_flags.passkey_auth = true;
3931 }
3932 }
3933 76 => {
3934 if chain != Chain::Mainnet && chain != Chain::Testnet {
3935 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
3936 cfg.consensus_commit_rate_estimation_window_size = Some(10);
3937 }
3938 cfg.feature_flags.minimize_child_object_mutations = true;
3939
3940 if chain != Chain::Mainnet {
3941 cfg.feature_flags.accept_passkey_in_multisig = true;
3942 }
3943 }
3944 77 => {
3945 cfg.feature_flags.uncompressed_g1_group_elements = true;
3946
3947 if chain != Chain::Mainnet {
3948 cfg.consensus_gc_depth = Some(60);
3949 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
3950 }
3951 }
3952 78 => {
3953 cfg.feature_flags.move_native_context = true;
3954 cfg.tx_context_fresh_id_cost_base = Some(52);
3955 cfg.tx_context_sender_cost_base = Some(30);
3956 cfg.tx_context_epoch_cost_base = Some(30);
3957 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
3958 cfg.tx_context_sponsor_cost_base = Some(30);
3959 cfg.tx_context_gas_price_cost_base = Some(30);
3960 cfg.tx_context_gas_budget_cost_base = Some(30);
3961 cfg.tx_context_ids_created_cost_base = Some(30);
3962 cfg.tx_context_replace_cost_base = Some(30);
3963 cfg.gas_model_version = Some(10);
3964
3965 if chain != Chain::Mainnet {
3966 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
3967 cfg.consensus_commit_rate_estimation_window_size = Some(10);
3968
3969 cfg.feature_flags.per_object_congestion_control_mode =
3971 PerObjectCongestionControlMode::ExecutionTimeEstimate(
3972 ExecutionTimeEstimateParams {
3973 target_utilization: 30,
3974 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
3976 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
3978 stored_observations_limit: u64::MAX,
3979 stake_weighted_median_threshold: 0,
3980 default_none_duration_for_new_keys: false,
3981 observations_chunk_size: None,
3982 },
3983 );
3984 }
3985 }
3986 79 => {
3987 if chain != Chain::Mainnet {
3988 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
3989
3990 cfg.consensus_bad_nodes_stake_threshold = Some(30);
3993
3994 cfg.feature_flags.consensus_batched_block_sync = true;
3995
3996 cfg.feature_flags.enable_nitro_attestation = true
3998 }
3999 cfg.feature_flags.normalize_ptb_arguments = true;
4000
4001 cfg.consensus_gc_depth = Some(60);
4002 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4003 }
4004 80 => {
4005 cfg.max_ptb_value_size = Some(1024 * 1024);
4006 }
4007 81 => {
4008 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4009 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4010 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4011 }
4012 82 => {
4013 cfg.feature_flags.max_ptb_value_size_v2 = true;
4014 }
4015 83 => {
4016 if chain == Chain::Mainnet {
4017 let aliased: [u8; 32] = Hex::decode(
4019 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4020 )
4021 .unwrap()
4022 .try_into()
4023 .unwrap();
4024
4025 cfg.aliased_addresses.push(AliasedAddress {
4027 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4028 aliased,
4029 allowed_tx_digests: vec![
4030 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4031 ],
4032 });
4033
4034 cfg.aliased_addresses.push(AliasedAddress {
4035 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4036 aliased,
4037 allowed_tx_digests: vec![
4038 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4039 ],
4040 });
4041 }
4042
4043 if chain != Chain::Mainnet {
4046 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4047 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4048
4049 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4051 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4052 cfg.feature_flags.per_object_congestion_control_mode =
4053 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4054 ExecutionTimeEstimateParams {
4055 target_utilization: 30,
4056 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4058 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4060 stored_observations_limit: u64::MAX,
4061 stake_weighted_median_threshold: 0,
4062 default_none_duration_for_new_keys: false,
4063 observations_chunk_size: None,
4064 },
4065 );
4066
4067 cfg.feature_flags.consensus_batched_block_sync = true;
4069
4070 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4073 cfg.feature_flags.enable_nitro_attestation = true;
4074 }
4075 }
4076 84 => {
4077 if chain == Chain::Mainnet {
4078 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4079 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4080
4081 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4083 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4084 cfg.feature_flags.per_object_congestion_control_mode =
4085 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4086 ExecutionTimeEstimateParams {
4087 target_utilization: 30,
4088 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4090 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4092 stored_observations_limit: u64::MAX,
4093 stake_weighted_median_threshold: 0,
4094 default_none_duration_for_new_keys: false,
4095 observations_chunk_size: None,
4096 },
4097 );
4098
4099 cfg.feature_flags.consensus_batched_block_sync = true;
4101
4102 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4105 cfg.feature_flags.enable_nitro_attestation = true;
4106 }
4107
4108 cfg.feature_flags.per_object_congestion_control_mode =
4110 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4111 ExecutionTimeEstimateParams {
4112 target_utilization: 30,
4113 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4115 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4117 stored_observations_limit: 20,
4118 stake_weighted_median_threshold: 0,
4119 default_none_duration_for_new_keys: false,
4120 observations_chunk_size: None,
4121 },
4122 );
4123 cfg.feature_flags.allow_unbounded_system_objects = true;
4124 }
4125 85 => {
4126 if chain != Chain::Mainnet && chain != Chain::Testnet {
4127 cfg.feature_flags.enable_party_transfer = true;
4128 }
4129
4130 cfg.feature_flags
4131 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4132 cfg.feature_flags.disallow_self_identifier = true;
4133 cfg.feature_flags.per_object_congestion_control_mode =
4134 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4135 ExecutionTimeEstimateParams {
4136 target_utilization: 50,
4137 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4139 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4141 stored_observations_limit: 20,
4142 stake_weighted_median_threshold: 0,
4143 default_none_duration_for_new_keys: false,
4144 observations_chunk_size: None,
4145 },
4146 );
4147 }
4148 86 => {
4149 cfg.feature_flags.type_tags_in_object_runtime = true;
4150 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4151
4152 cfg.feature_flags.per_object_congestion_control_mode =
4154 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4155 ExecutionTimeEstimateParams {
4156 target_utilization: 50,
4157 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4159 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4161 stored_observations_limit: 20,
4162 stake_weighted_median_threshold: 3334,
4163 default_none_duration_for_new_keys: false,
4164 observations_chunk_size: None,
4165 },
4166 );
4167 if chain != Chain::Mainnet {
4169 cfg.feature_flags.enable_party_transfer = true;
4170 }
4171 }
4172 87 => {
4173 if chain == Chain::Mainnet {
4174 cfg.feature_flags.record_time_estimate_processed = true;
4175 }
4176 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4177 }
4178 88 => {
4179 cfg.feature_flags.record_time_estimate_processed = true;
4180 cfg.tx_context_rgp_cost_base = Some(30);
4181 cfg.feature_flags
4182 .ignore_execution_time_observations_after_certs_closed = true;
4183
4184 cfg.feature_flags.per_object_congestion_control_mode =
4187 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4188 ExecutionTimeEstimateParams {
4189 target_utilization: 50,
4190 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4192 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4194 stored_observations_limit: 20,
4195 stake_weighted_median_threshold: 3334,
4196 default_none_duration_for_new_keys: true,
4197 observations_chunk_size: None,
4198 },
4199 );
4200 }
4201 89 => {
4202 cfg.feature_flags.dependency_linkage_error = true;
4203 cfg.feature_flags.additional_multisig_checks = true;
4204 }
4205 90 => {
4206 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4208 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4209 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4210 cfg.feature_flags.accept_passkey_in_multisig = true;
4211 cfg.feature_flags.passkey_auth = true;
4212 cfg.feature_flags.check_for_init_during_upgrade = true;
4213
4214 if chain != Chain::Mainnet {
4216 cfg.feature_flags.mysticeti_fastpath = true;
4217 }
4218 }
4219 91 => {
4220 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4221 }
4222 92 => {
4223 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4224 }
4225 93 => {
4226 cfg.feature_flags
4227 .consensus_checkpoint_signature_key_includes_digest = true;
4228 }
4229 94 => {
4230 cfg.feature_flags.per_object_congestion_control_mode =
4232 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4233 ExecutionTimeEstimateParams {
4234 target_utilization: 50,
4235 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4237 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4239 stored_observations_limit: 18,
4240 stake_weighted_median_threshold: 3334,
4241 default_none_duration_for_new_keys: true,
4242 observations_chunk_size: None,
4243 },
4244 );
4245
4246 cfg.feature_flags.enable_party_transfer = true;
4248 }
4249 95 => {
4250 cfg.type_name_id_base_cost = Some(52);
4251
4252 cfg.max_transactions_per_checkpoint = Some(20_000);
4254 }
4255 96 => {
4256 if chain != Chain::Mainnet && chain != Chain::Testnet {
4258 cfg.feature_flags
4259 .include_checkpoint_artifacts_digest_in_summary = true;
4260 }
4261 cfg.feature_flags.correct_gas_payment_limit_check = true;
4262 cfg.feature_flags.authority_capabilities_v2 = true;
4263 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4264 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4265 cfg.feature_flags.enable_coin_registry = true;
4266
4267 cfg.feature_flags.mysticeti_fastpath = true;
4269 }
4270 97 => {
4271 cfg.feature_flags.additional_borrow_checks = true;
4272 }
4273 98 => {
4274 cfg.event_emit_auth_stream_cost = Some(52);
4275 cfg.feature_flags.better_loader_errors = true;
4276 cfg.feature_flags.generate_df_type_layouts = true;
4277 }
4278 99 => {
4279 cfg.feature_flags.use_new_commit_handler = true;
4280 }
4281 100 => {
4282 cfg.feature_flags.private_generics_verifier_v2 = true;
4283 }
4284 101 => {
4285 cfg.feature_flags.create_root_accumulator_object = true;
4286 cfg.max_updates_per_settlement_txn = Some(100);
4287 if chain != Chain::Mainnet {
4288 cfg.feature_flags.enable_poseidon = true;
4289 }
4290 }
4291 102 => {
4292 cfg.feature_flags.per_object_congestion_control_mode =
4296 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4297 ExecutionTimeEstimateParams {
4298 target_utilization: 50,
4299 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4301 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4303 stored_observations_limit: 180,
4304 stake_weighted_median_threshold: 3334,
4305 default_none_duration_for_new_keys: true,
4306 observations_chunk_size: Some(18),
4307 },
4308 );
4309 cfg.feature_flags.deprecate_global_storage_ops = true;
4310 }
4311 103 => {}
4312 104 => {
4313 cfg.translation_per_command_base_charge = Some(1);
4314 cfg.translation_per_input_base_charge = Some(1);
4315 cfg.translation_pure_input_per_byte_charge = Some(1);
4316 cfg.translation_per_type_node_charge = Some(1);
4317 cfg.translation_per_reference_node_charge = Some(1);
4318 cfg.translation_per_linkage_entry_charge = Some(10);
4319 cfg.gas_model_version = Some(11);
4320 cfg.feature_flags.abstract_size_in_object_runtime = true;
4321 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4322 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4323 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4324 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4325 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4326 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4327 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4328 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4329 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4330 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4331 cfg.feature_flags.enable_ptb_execution_v2 = true;
4332
4333 cfg.poseidon_bn254_cost_base = Some(260);
4334
4335 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4336
4337 if chain != Chain::Mainnet {
4338 cfg.feature_flags
4339 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4340 }
4341
4342 cfg.feature_flags
4343 .include_cancelled_randomness_txns_in_prologue = true;
4344 }
4345 105 => {
4346 if chain != Chain::Mainnet && chain != Chain::Testnet {
4347 cfg.feature_flags.enable_accumulators = true;
4348 cfg.feature_flags.enable_address_balance_gas_payments = true;
4349 cfg.feature_flags.enable_authenticated_event_streams = true;
4350 cfg.feature_flags.enable_object_funds_withdraw = true;
4351 }
4352 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4353 }
4354 _ => panic!("unsupported version {:?}", version),
4365 }
4366 }
4367
4368 if cfg!(msim) {
4370 cfg.consensus_gc_depth = Some(5);
4372
4373 }
4378
4379 cfg
4380 }
4381
4382 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4388 let (
4389 max_back_edges_per_function,
4390 max_back_edges_per_module,
4391 sanity_check_with_regex_reference_safety,
4392 ) = if let Some((
4393 max_back_edges_per_function,
4394 max_back_edges_per_module,
4395 sanity_check_with_regex_reference_safety,
4396 )) = signing_limits
4397 {
4398 (
4399 Some(max_back_edges_per_function),
4400 Some(max_back_edges_per_module),
4401 Some(sanity_check_with_regex_reference_safety),
4402 )
4403 } else {
4404 (None, None, None)
4405 };
4406
4407 let additional_borrow_checks = if signing_limits.is_some() {
4408 true
4410 } else {
4411 self.additional_borrow_checks()
4412 };
4413 let deprecate_global_storage_ops = if signing_limits.is_some() {
4414 true
4416 } else {
4417 self.deprecate_global_storage_ops()
4418 };
4419
4420 VerifierConfig {
4421 max_loop_depth: Some(self.max_loop_depth() as usize),
4422 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4423 max_function_parameters: Some(self.max_function_parameters() as usize),
4424 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4425 max_value_stack_size: self.max_value_stack_size() as usize,
4426 max_type_nodes: Some(self.max_type_nodes() as usize),
4427 max_push_size: Some(self.max_push_size() as usize),
4428 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4429 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4430 max_function_definitions: Some(self.max_function_definitions() as usize),
4431 max_data_definitions: Some(self.max_struct_definitions() as usize),
4432 max_constant_vector_len: Some(self.max_move_vector_len()),
4433 max_back_edges_per_function,
4434 max_back_edges_per_module,
4435 max_basic_blocks_in_script: None,
4436 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4438 allow_receiving_object_id: self.allow_receiving_object_id(),
4439 reject_mutable_random_on_entry_functions: self
4440 .reject_mutable_random_on_entry_functions(),
4441 bytecode_version: self.move_binary_format_version(),
4442 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4443 additional_borrow_checks,
4444 better_loader_errors: self.better_loader_errors(),
4445 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4446 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4447 .map(|limit| limit as u128),
4448 deprecate_global_storage_ops,
4449 }
4450 }
4451
4452 pub fn binary_config(
4453 &self,
4454 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4455 ) -> BinaryConfig {
4456 let deprecate_global_storage_ops =
4457 override_deprecate_global_storage_ops_during_deserialization
4458 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4459 BinaryConfig::new(
4460 self.move_binary_format_version(),
4461 self.min_move_binary_format_version_as_option()
4462 .unwrap_or(VERSION_1),
4463 self.no_extraneous_module_bytes(),
4464 deprecate_global_storage_ops,
4465 TableConfig {
4466 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4467 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4468 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4469 function_instantiations: self
4470 .binary_function_instantiations_as_option()
4471 .unwrap_or(u16::MAX),
4472 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4473 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4474 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4475 address_identifiers: self
4476 .binary_address_identifiers_as_option()
4477 .unwrap_or(u16::MAX),
4478 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4479 struct_def_instantiations: self
4480 .binary_struct_def_instantiations_as_option()
4481 .unwrap_or(u16::MAX),
4482 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4483 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4484 field_instantiations: self
4485 .binary_field_instantiations_as_option()
4486 .unwrap_or(u16::MAX),
4487 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4488 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4489 enum_def_instantiations: self
4490 .binary_enum_def_instantiations_as_option()
4491 .unwrap_or(u16::MAX),
4492 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4493 variant_instantiation_handles: self
4494 .binary_variant_instantiation_handles_as_option()
4495 .unwrap_or(u16::MAX),
4496 },
4497 )
4498 }
4499
4500 pub fn apply_overrides_for_testing(
4504 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4505 ) -> OverrideGuard {
4506 CONFIG_OVERRIDE.with(|ovr| {
4507 let mut cur = ovr.borrow_mut();
4508 assert!(cur.is_none(), "config override already present");
4509 *cur = Some(Box::new(override_fn));
4510 OverrideGuard
4511 })
4512 }
4513}
4514
4515impl ProtocolConfig {
4519 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4520 self.feature_flags
4521 .advance_to_highest_supported_protocol_version = val
4522 }
4523 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4524 self.feature_flags.commit_root_state_digest = val
4525 }
4526 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4527 self.feature_flags.zklogin_auth = val
4528 }
4529 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4530 self.feature_flags.enable_jwk_consensus_updates = val
4531 }
4532 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4533 self.feature_flags.random_beacon = val
4534 }
4535
4536 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4537 self.feature_flags.upgraded_multisig_supported = val
4538 }
4539 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4540 self.feature_flags.accept_zklogin_in_multisig = val
4541 }
4542
4543 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4544 self.feature_flags.shared_object_deletion = val;
4545 }
4546
4547 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4548 self.feature_flags.narwhal_new_leader_election_schedule = val;
4549 }
4550
4551 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4552 self.feature_flags.receive_objects = val
4553 }
4554 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4555 self.feature_flags.narwhal_certificate_v2 = val
4556 }
4557 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4558 self.feature_flags.verify_legacy_zklogin_address = val
4559 }
4560
4561 pub fn set_per_object_congestion_control_mode_for_testing(
4562 &mut self,
4563 val: PerObjectCongestionControlMode,
4564 ) {
4565 self.feature_flags.per_object_congestion_control_mode = val;
4566 }
4567
4568 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
4569 self.feature_flags.consensus_choice = val;
4570 }
4571
4572 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
4573 self.feature_flags.consensus_network = val;
4574 }
4575
4576 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
4577 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
4578 }
4579
4580 pub fn set_disable_bridge_for_testing(&mut self) {
4581 self.feature_flags.bridge = false
4582 }
4583
4584 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
4585 self.feature_flags.mysticeti_num_leaders_per_round = val;
4586 }
4587
4588 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
4589 self.feature_flags.soft_bundle = val;
4590 }
4591
4592 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
4593 self.feature_flags.passkey_auth = val
4594 }
4595
4596 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
4597 self.feature_flags.enable_party_transfer = val
4598 }
4599
4600 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
4601 self.feature_flags
4602 .consensus_distributed_vote_scoring_strategy = val;
4603 }
4604
4605 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
4606 self.feature_flags.consensus_round_prober = val;
4607 }
4608
4609 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
4610 self.feature_flags
4611 .disallow_new_modules_in_deps_only_packages = val;
4612 }
4613
4614 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
4615 self.feature_flags.correct_gas_payment_limit_check = val;
4616 }
4617
4618 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
4619 self.feature_flags.address_aliases = val;
4620 }
4621
4622 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
4623 self.feature_flags
4624 .consensus_round_prober_probe_accepted_rounds = val;
4625 }
4626
4627 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
4628 self.feature_flags.mysticeti_fastpath = val;
4629 }
4630
4631 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
4632 self.feature_flags.accept_passkey_in_multisig = val;
4633 }
4634
4635 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
4636 self.feature_flags.consensus_batched_block_sync = val;
4637 }
4638
4639 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
4640 self.feature_flags.record_time_estimate_processed = val;
4641 }
4642
4643 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
4644 &mut self,
4645 val: bool,
4646 ) {
4647 self.feature_flags
4648 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
4649 }
4650
4651 pub fn enable_accumulators_for_testing(&mut self) {
4652 self.feature_flags.enable_accumulators = true;
4653 }
4654
4655 pub fn disable_accumulators_for_testing(&mut self) {
4656 self.feature_flags.enable_accumulators = false;
4657 self.feature_flags.enable_address_balance_gas_payments = false;
4658 }
4659
4660 pub fn enable_coin_reservation_for_testing(&mut self) {
4661 self.feature_flags.enable_coin_reservation_obj_refs = true;
4662 }
4663
4664 pub fn create_root_accumulator_object_for_testing(&mut self) {
4665 self.feature_flags.create_root_accumulator_object = true;
4666 }
4667
4668 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
4669 self.feature_flags.create_root_accumulator_object = false;
4670 }
4671
4672 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
4673 self.feature_flags.enable_accumulators = true;
4674 self.feature_flags.allow_private_accumulator_entrypoints = true;
4675 self.feature_flags.enable_address_balance_gas_payments = true;
4676 }
4677
4678 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
4679 self.feature_flags.enable_address_balance_gas_payments = false;
4680 }
4681
4682 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
4683 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
4684 }
4685
4686 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
4687 self.enable_accumulators_for_testing();
4688 self.feature_flags.enable_authenticated_event_streams = true;
4689 self.feature_flags
4690 .include_checkpoint_artifacts_digest_in_summary = true;
4691 }
4692
4693 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
4694 self.feature_flags.enable_authenticated_event_streams = false;
4695 }
4696
4697 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
4698 self.feature_flags.enable_non_exclusive_writes = true;
4699 }
4700
4701 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
4702 &mut self,
4703 val: bool,
4704 ) {
4705 self.feature_flags
4706 .ignore_execution_time_observations_after_certs_closed = val;
4707 }
4708
4709 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
4710 &mut self,
4711 val: bool,
4712 ) {
4713 self.feature_flags
4714 .consensus_checkpoint_signature_key_includes_digest = val;
4715 }
4716
4717 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
4718 self.feature_flags.cancel_for_failed_dkg_early = val;
4719 }
4720
4721 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
4722 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
4723 }
4724
4725 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
4726 self.feature_flags.authority_capabilities_v2 = val;
4727 }
4728
4729 pub fn allow_references_in_ptbs_for_testing(&mut self) {
4730 self.feature_flags.allow_references_in_ptbs = true;
4731 }
4732
4733 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
4734 self.feature_flags.consensus_skip_gced_accept_votes = val;
4735 }
4736
4737 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
4738 self.feature_flags.enable_object_funds_withdraw = val;
4739 }
4740}
4741
4742type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
4743
4744thread_local! {
4745 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
4746}
4747
4748#[must_use]
4749pub struct OverrideGuard;
4750
4751impl Drop for OverrideGuard {
4752 fn drop(&mut self) {
4753 info!("restoring override fn");
4754 CONFIG_OVERRIDE.with(|ovr| {
4755 *ovr.borrow_mut() = None;
4756 });
4757 }
4758}
4759
4760#[derive(PartialEq, Eq)]
4763pub enum LimitThresholdCrossed {
4764 None,
4765 Soft(u128, u128),
4766 Hard(u128, u128),
4767}
4768
4769pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
4772 x: T,
4773 soft_limit: U,
4774 hard_limit: V,
4775) -> LimitThresholdCrossed {
4776 let x: V = x.into();
4777 let soft_limit: V = soft_limit.into();
4778
4779 debug_assert!(soft_limit <= hard_limit);
4780
4781 if x >= hard_limit {
4784 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
4785 } else if x < soft_limit {
4786 LimitThresholdCrossed::None
4787 } else {
4788 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
4789 }
4790}
4791
4792#[macro_export]
4793macro_rules! check_limit {
4794 ($x:expr, $hard:expr) => {
4795 check_limit!($x, $hard, $hard)
4796 };
4797 ($x:expr, $soft:expr, $hard:expr) => {
4798 check_limit_in_range($x as u64, $soft, $hard)
4799 };
4800}
4801
4802#[macro_export]
4806macro_rules! check_limit_by_meter {
4807 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
4808 let (h, metered_str) = if $is_metered {
4810 ($metered_limit, "metered")
4811 } else {
4812 ($unmetered_hard_limit, "unmetered")
4814 };
4815 use sui_protocol_config::check_limit_in_range;
4816 let result = check_limit_in_range($x as u64, $metered_limit, h);
4817 match result {
4818 LimitThresholdCrossed::None => {}
4819 LimitThresholdCrossed::Soft(_, _) => {
4820 $metric.with_label_values(&[metered_str, "soft"]).inc();
4821 }
4822 LimitThresholdCrossed::Hard(_, _) => {
4823 $metric.with_label_values(&[metered_str, "hard"]).inc();
4824 }
4825 };
4826 result
4827 }};
4828}
4829#[cfg(all(test, not(msim)))]
4830mod test {
4831 use insta::assert_yaml_snapshot;
4832
4833 use super::*;
4834
4835 #[test]
4836 fn snapshot_tests() {
4837 println!("\n============================================================================");
4838 println!("! !");
4839 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
4840 println!("! !");
4841 println!("============================================================================\n");
4842 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
4843 let chain_str = match chain_id {
4847 Chain::Unknown => "".to_string(),
4848 _ => format!("{:?}_", chain_id),
4849 };
4850 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
4851 let cur = ProtocolVersion::new(i);
4852 assert_yaml_snapshot!(
4853 format!("{}version_{}", chain_str, cur.as_u64()),
4854 ProtocolConfig::get_for_version(cur, *chain_id)
4855 );
4856 }
4857 }
4858 }
4859
4860 #[test]
4861 fn test_getters() {
4862 let prot: ProtocolConfig =
4863 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4864 assert_eq!(
4865 prot.max_arguments(),
4866 prot.max_arguments_as_option().unwrap()
4867 );
4868 }
4869
4870 #[test]
4871 fn test_setters() {
4872 let mut prot: ProtocolConfig =
4873 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4874 prot.set_max_arguments_for_testing(123);
4875 assert_eq!(prot.max_arguments(), 123);
4876
4877 prot.set_max_arguments_from_str_for_testing("321".to_string());
4878 assert_eq!(prot.max_arguments(), 321);
4879
4880 prot.disable_max_arguments_for_testing();
4881 assert_eq!(prot.max_arguments_as_option(), None);
4882
4883 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
4884 assert_eq!(prot.max_arguments(), 456);
4885 }
4886
4887 #[test]
4888 #[should_panic(expected = "unsupported version")]
4889 fn max_version_test() {
4890 let _ = ProtocolConfig::get_for_version_impl(
4893 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
4894 Chain::Unknown,
4895 );
4896 }
4897
4898 #[test]
4899 fn lookup_by_string_test() {
4900 let prot: ProtocolConfig =
4901 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4902 assert!(prot.lookup_attr("some random string".to_string()).is_none());
4904
4905 assert!(
4906 prot.lookup_attr("max_arguments".to_string())
4907 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
4908 );
4909
4910 assert!(
4912 prot.lookup_attr("max_move_identifier_len".to_string())
4913 .is_none()
4914 );
4915
4916 let prot: ProtocolConfig =
4918 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
4919 assert!(
4920 prot.lookup_attr("max_move_identifier_len".to_string())
4921 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
4922 );
4923
4924 let prot: ProtocolConfig =
4925 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4926 assert!(
4928 prot.attr_map()
4929 .get("max_move_identifier_len")
4930 .unwrap()
4931 .is_none()
4932 );
4933 assert!(
4935 prot.attr_map().get("max_arguments").unwrap()
4936 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
4937 );
4938
4939 let prot: ProtocolConfig =
4941 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
4942 assert!(
4944 prot.feature_flags
4945 .lookup_attr("some random string".to_owned())
4946 .is_none()
4947 );
4948 assert!(
4949 !prot
4950 .feature_flags
4951 .attr_map()
4952 .contains_key("some random string")
4953 );
4954
4955 assert!(
4957 prot.feature_flags
4958 .lookup_attr("package_upgrades".to_owned())
4959 == Some(false)
4960 );
4961 assert!(
4962 prot.feature_flags
4963 .attr_map()
4964 .get("package_upgrades")
4965 .unwrap()
4966 == &false
4967 );
4968 let prot: ProtocolConfig =
4969 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
4970 assert!(
4972 prot.feature_flags
4973 .lookup_attr("package_upgrades".to_owned())
4974 == Some(true)
4975 );
4976 assert!(
4977 prot.feature_flags
4978 .attr_map()
4979 .get("package_upgrades")
4980 .unwrap()
4981 == &true
4982 );
4983 }
4984
4985 #[test]
4986 fn limit_range_fn_test() {
4987 let low = 100u32;
4988 let high = 10000u64;
4989
4990 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
4991 assert!(matches!(
4992 check_limit!(255u16, low, high),
4993 LimitThresholdCrossed::Soft(255u128, 100)
4994 ));
4995 assert!(matches!(
5001 check_limit!(2550000u64, low, high),
5002 LimitThresholdCrossed::Hard(2550000, 10000)
5003 ));
5004
5005 assert!(matches!(
5006 check_limit!(2550000u64, high, high),
5007 LimitThresholdCrossed::Hard(2550000, 10000)
5008 ));
5009
5010 assert!(matches!(
5011 check_limit!(1u8, high),
5012 LimitThresholdCrossed::None
5013 ));
5014
5015 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5016
5017 assert!(matches!(
5018 check_limit!(2550000u64, high),
5019 LimitThresholdCrossed::Hard(2550000, 10000)
5020 ));
5021 }
5022}