1use std::{
5 collections::{BTreeMap, BTreeSet},
6 sync::{
7 Arc, LazyLock,
8 atomic::{AtomicBool, Ordering},
9 },
10};
11
12#[cfg(msim)]
13use std::cell::RefCell;
14#[cfg(not(msim))]
15use std::sync::Mutex;
16
17use clap::*;
18use fastcrypto::encoding::{Base58, Encoding, Hex};
19use move_binary_format::{
20 binary_config::{BinaryConfig, TableConfig},
21 file_format_common::VERSION_1,
22};
23use move_core_types::account_address::AccountAddress;
24use move_vm_config::verifier::VerifierConfig;
25use mysten_common::in_integration_test;
26use serde::{Deserialize, Serialize};
27use serde_with::skip_serializing_none;
28use sui_protocol_config_macros::{
29 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
30};
31use tracing::{info, warn};
32
33const MIN_PROTOCOL_VERSION: u64 = 1;
35const MAX_PROTOCOL_VERSION: u64 = 122;
36
37const TESTNET_USDC: &str =
38 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
39
40#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
328pub struct ProtocolVersion(u64);
329
330impl ProtocolVersion {
331 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
336
337 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
338
339 #[cfg(not(msim))]
340 pub const MAX_ALLOWED: Self = Self::MAX;
341
342 #[cfg(msim)]
344 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
345
346 pub fn new(v: u64) -> Self {
347 Self(v)
348 }
349
350 pub const fn as_u64(&self) -> u64 {
351 self.0
352 }
353
354 pub fn max() -> Self {
357 Self::MAX
358 }
359
360 pub fn prev(self) -> Self {
361 Self(self.0.checked_sub(1).unwrap())
362 }
363}
364
365impl From<u64> for ProtocolVersion {
366 fn from(v: u64) -> Self {
367 Self::new(v)
368 }
369}
370
371impl std::ops::Sub<u64> for ProtocolVersion {
372 type Output = Self;
373 fn sub(self, rhs: u64) -> Self::Output {
374 Self::new(self.0 - rhs)
375 }
376}
377
378impl std::ops::Add<u64> for ProtocolVersion {
379 type Output = Self;
380 fn add(self, rhs: u64) -> Self::Output {
381 Self::new(self.0 + rhs)
382 }
383}
384
385#[derive(
386 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
387)]
388pub enum Chain {
389 Mainnet,
390 Testnet,
391 #[default]
392 Unknown,
393}
394
395impl Chain {
396 pub fn as_str(self) -> &'static str {
397 match self {
398 Chain::Mainnet => "mainnet",
399 Chain::Testnet => "testnet",
400 Chain::Unknown => "unknown",
401 }
402 }
403}
404
405pub struct Error(pub String);
406
407#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
410struct FeatureFlags {
411 #[serde(skip_serializing_if = "is_false")]
414 package_upgrades: bool,
415 #[serde(skip_serializing_if = "is_false")]
418 commit_root_state_digest: bool,
419 #[serde(skip_serializing_if = "is_false")]
421 advance_epoch_start_time_in_safe_mode: bool,
422 #[serde(skip_serializing_if = "is_false")]
425 loaded_child_objects_fixed: bool,
426 #[serde(skip_serializing_if = "is_false")]
429 missing_type_is_compatibility_error: bool,
430 #[serde(skip_serializing_if = "is_false")]
433 scoring_decision_with_validity_cutoff: bool,
434
435 #[serde(skip_serializing_if = "is_false")]
438 consensus_order_end_of_epoch_last: bool,
439
440 #[serde(skip_serializing_if = "is_false")]
442 disallow_adding_abilities_on_upgrade: bool,
443 #[serde(skip_serializing_if = "is_false")]
445 disable_invariant_violation_check_in_swap_loc: bool,
446 #[serde(skip_serializing_if = "is_false")]
449 advance_to_highest_supported_protocol_version: bool,
450 #[serde(skip_serializing_if = "is_false")]
452 ban_entry_init: bool,
453 #[serde(skip_serializing_if = "is_false")]
455 package_digest_hash_module: bool,
456 #[serde(skip_serializing_if = "is_false")]
458 disallow_change_struct_type_params_on_upgrade: bool,
459 #[serde(skip_serializing_if = "is_false")]
461 no_extraneous_module_bytes: bool,
462 #[serde(skip_serializing_if = "is_false")]
464 narwhal_versioned_metadata: bool,
465
466 #[serde(skip_serializing_if = "is_false")]
468 zklogin_auth: bool,
469 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
471 consensus_transaction_ordering: ConsensusTransactionOrdering,
472
473 #[serde(skip_serializing_if = "is_false")]
481 simplified_unwrap_then_delete: bool,
482 #[serde(skip_serializing_if = "is_false")]
484 upgraded_multisig_supported: bool,
485 #[serde(skip_serializing_if = "is_false")]
487 txn_base_cost_as_multiplier: bool,
488
489 #[serde(skip_serializing_if = "is_false")]
491 shared_object_deletion: bool,
492
493 #[serde(skip_serializing_if = "is_false")]
495 narwhal_new_leader_election_schedule: bool,
496
497 #[serde(skip_serializing_if = "is_empty")]
499 zklogin_supported_providers: BTreeSet<String>,
500
501 #[serde(skip_serializing_if = "is_false")]
503 loaded_child_object_format: bool,
504
505 #[serde(skip_serializing_if = "is_false")]
506 enable_jwk_consensus_updates: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
509 end_of_epoch_transaction_supported: bool,
510
511 #[serde(skip_serializing_if = "is_false")]
514 simple_conservation_checks: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 loaded_child_object_format_type: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 receive_objects: bool,
523
524 #[serde(skip_serializing_if = "is_false")]
526 consensus_checkpoint_signature_key_includes_digest: bool,
527
528 #[serde(skip_serializing_if = "is_false")]
530 random_beacon: bool,
531
532 #[serde(skip_serializing_if = "is_false")]
534 bridge: bool,
535
536 #[serde(skip_serializing_if = "is_false")]
537 enable_effects_v2: bool,
538
539 #[serde(skip_serializing_if = "is_false")]
541 narwhal_certificate_v2: bool,
542
543 #[serde(skip_serializing_if = "is_false")]
545 verify_legacy_zklogin_address: bool,
546
547 #[serde(skip_serializing_if = "is_false")]
549 throughput_aware_consensus_submission: bool,
550
551 #[serde(skip_serializing_if = "is_false")]
553 recompute_has_public_transfer_in_execution: bool,
554
555 #[serde(skip_serializing_if = "is_false")]
557 accept_zklogin_in_multisig: bool,
558
559 #[serde(skip_serializing_if = "is_false")]
561 accept_passkey_in_multisig: bool,
562
563 #[serde(skip_serializing_if = "is_false")]
565 validate_zklogin_public_identifier: bool,
566
567 #[serde(skip_serializing_if = "is_false")]
570 include_consensus_digest_in_prologue: bool,
571
572 #[serde(skip_serializing_if = "is_false")]
574 hardened_otw_check: bool,
575
576 #[serde(skip_serializing_if = "is_false")]
578 allow_receiving_object_id: bool,
579
580 #[serde(skip_serializing_if = "is_false")]
582 enable_poseidon: bool,
583
584 #[serde(skip_serializing_if = "is_false")]
586 enable_coin_deny_list: bool,
587
588 #[serde(skip_serializing_if = "is_false")]
590 enable_group_ops_native_functions: bool,
591
592 #[serde(skip_serializing_if = "is_false")]
594 enable_group_ops_native_function_msm: bool,
595
596 #[serde(skip_serializing_if = "is_false")]
598 enable_ristretto255_group_ops: bool,
599
600 #[serde(skip_serializing_if = "is_false")]
602 enable_verify_bulletproofs_ristretto255: bool,
603
604 #[serde(skip_serializing_if = "is_false")]
606 enable_nitro_attestation: bool,
607
608 #[serde(skip_serializing_if = "is_false")]
610 enable_nitro_attestation_upgraded_parsing: bool,
611
612 #[serde(skip_serializing_if = "is_false")]
614 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
615
616 #[serde(skip_serializing_if = "is_false")]
618 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
619
620 #[serde(skip_serializing_if = "is_false")]
622 reject_mutable_random_on_entry_functions: bool,
623
624 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
626 per_object_congestion_control_mode: PerObjectCongestionControlMode,
627
628 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
630 consensus_choice: ConsensusChoice,
631
632 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
634 consensus_network: ConsensusNetwork,
635
636 #[serde(skip_serializing_if = "is_false")]
638 correct_gas_payment_limit_check: bool,
639
640 #[serde(skip_serializing_if = "Option::is_none")]
642 zklogin_max_epoch_upper_bound_delta: Option<u64>,
643
644 #[serde(skip_serializing_if = "is_false")]
646 mysticeti_leader_scoring_and_schedule: bool,
647
648 #[serde(skip_serializing_if = "is_false")]
650 reshare_at_same_initial_version: bool,
651
652 #[serde(skip_serializing_if = "is_false")]
654 resolve_abort_locations_to_package_id: bool,
655
656 #[serde(skip_serializing_if = "is_false")]
660 mysticeti_use_committed_subdag_digest: bool,
661
662 #[serde(skip_serializing_if = "is_false")]
664 enable_vdf: bool,
665
666 #[serde(skip_serializing_if = "is_false")]
671 record_consensus_determined_version_assignments_in_prologue: bool,
672 #[serde(skip_serializing_if = "is_false")]
673 record_consensus_determined_version_assignments_in_prologue_v2: bool,
674
675 #[serde(skip_serializing_if = "is_false")]
677 fresh_vm_on_framework_upgrade: bool,
678
679 #[serde(skip_serializing_if = "is_false")]
687 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
688
689 #[serde(skip_serializing_if = "Option::is_none")]
691 mysticeti_num_leaders_per_round: Option<usize>,
692
693 #[serde(skip_serializing_if = "is_false")]
695 soft_bundle: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
699 enable_coin_deny_list_v2: bool,
700
701 #[serde(skip_serializing_if = "is_false")]
703 passkey_auth: bool,
704
705 #[serde(skip_serializing_if = "is_false")]
707 authority_capabilities_v2: bool,
708
709 #[serde(skip_serializing_if = "is_false")]
711 rethrow_serialization_type_layout_errors: bool,
712
713 #[serde(skip_serializing_if = "is_false")]
715 consensus_distributed_vote_scoring_strategy: bool,
716
717 #[serde(skip_serializing_if = "is_false")]
719 consensus_round_prober: bool,
720
721 #[serde(skip_serializing_if = "is_false")]
723 validate_identifier_inputs: bool,
724
725 #[serde(skip_serializing_if = "is_false")]
727 disallow_self_identifier: bool,
728
729 #[serde(skip_serializing_if = "is_false")]
731 mysticeti_fastpath: bool,
732
733 #[serde(skip_serializing_if = "is_false")]
737 disable_preconsensus_locking: bool,
738
739 #[serde(skip_serializing_if = "is_false")]
741 relocate_event_module: bool,
742
743 #[serde(skip_serializing_if = "is_false")]
745 uncompressed_g1_group_elements: bool,
746
747 #[serde(skip_serializing_if = "is_false")]
748 disallow_new_modules_in_deps_only_packages: bool,
749
750 #[serde(skip_serializing_if = "is_false")]
752 consensus_smart_ancestor_selection: bool,
753
754 #[serde(skip_serializing_if = "is_false")]
756 consensus_round_prober_probe_accepted_rounds: bool,
757
758 #[serde(skip_serializing_if = "is_false")]
760 native_charging_v2: bool,
761
762 #[serde(skip_serializing_if = "is_false")]
765 consensus_linearize_subdag_v2: bool,
766
767 #[serde(skip_serializing_if = "is_false")]
769 convert_type_argument_error: bool,
770
771 #[serde(skip_serializing_if = "is_false")]
773 variant_nodes: bool,
774
775 #[serde(skip_serializing_if = "is_false")]
777 consensus_zstd_compression: bool,
778
779 #[serde(skip_serializing_if = "is_false")]
781 minimize_child_object_mutations: bool,
782
783 #[serde(skip_serializing_if = "is_false")]
785 record_additional_state_digest_in_prologue: bool,
786
787 #[serde(skip_serializing_if = "is_false")]
789 move_native_context: bool,
790
791 #[serde(skip_serializing_if = "is_false")]
794 consensus_median_based_commit_timestamp: bool,
795
796 #[serde(skip_serializing_if = "is_false")]
799 normalize_ptb_arguments: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
803 consensus_batched_block_sync: bool,
804
805 #[serde(skip_serializing_if = "is_false")]
807 enforce_checkpoint_timestamp_monotonicity: bool,
808
809 #[serde(skip_serializing_if = "is_false")]
811 max_ptb_value_size_v2: bool,
812
813 #[serde(skip_serializing_if = "is_false")]
815 resolve_type_input_ids_to_defining_id: bool,
816
817 #[serde(skip_serializing_if = "is_false")]
819 enable_party_transfer: bool,
820
821 #[serde(skip_serializing_if = "is_false")]
823 allow_unbounded_system_objects: bool,
824
825 #[serde(skip_serializing_if = "is_false")]
827 type_tags_in_object_runtime: bool,
828
829 #[serde(skip_serializing_if = "is_false")]
831 enable_accumulators: bool,
832
833 #[serde(skip_serializing_if = "is_false")]
835 enable_coin_reservation_obj_refs: bool,
836
837 #[serde(skip_serializing_if = "is_false")]
840 create_root_accumulator_object: bool,
841
842 #[serde(skip_serializing_if = "is_false")]
844 enable_authenticated_event_streams: bool,
845
846 #[serde(skip_serializing_if = "is_false")]
848 enable_address_balance_gas_payments: bool,
849
850 #[serde(skip_serializing_if = "is_false")]
852 address_balance_gas_check_rgp_at_signing: bool,
853
854 #[serde(skip_serializing_if = "is_false")]
855 address_balance_gas_reject_gas_coin_arg: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 enable_multi_epoch_transaction_expiration: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 relax_valid_during_for_owned_inputs: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
867 enable_ptb_execution_v2: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
871 better_adapter_type_resolution_errors: bool,
872
873 #[serde(skip_serializing_if = "is_false")]
875 record_time_estimate_processed: bool,
876
877 #[serde(skip_serializing_if = "is_false")]
879 dependency_linkage_error: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
883 additional_multisig_checks: bool,
884
885 #[serde(skip_serializing_if = "is_false")]
887 ignore_execution_time_observations_after_certs_closed: bool,
888
889 #[serde(skip_serializing_if = "is_false")]
893 debug_fatal_on_move_invariant_violation: bool,
894
895 #[serde(skip_serializing_if = "is_false")]
898 allow_private_accumulator_entrypoints: bool,
899
900 #[serde(skip_serializing_if = "is_false")]
902 additional_consensus_digest_indirect_state: bool,
903
904 #[serde(skip_serializing_if = "is_false")]
906 check_for_init_during_upgrade: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 per_command_shared_object_transfer_rules: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 include_checkpoint_artifacts_digest_in_summary: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
918 use_mfp_txns_in_load_initial_object_debts: bool,
919
920 #[serde(skip_serializing_if = "is_false")]
922 cancel_for_failed_dkg_early: bool,
923
924 #[serde(skip_serializing_if = "is_false")]
926 enable_coin_registry: bool,
927
928 #[serde(skip_serializing_if = "is_false")]
930 abstract_size_in_object_runtime: bool,
931
932 #[serde(skip_serializing_if = "is_false")]
934 object_runtime_charge_cache_load_gas: bool,
935
936 #[serde(skip_serializing_if = "is_false")]
938 additional_borrow_checks: bool,
939
940 #[serde(skip_serializing_if = "is_false")]
942 use_new_commit_handler: bool,
943
944 #[serde(skip_serializing_if = "is_false")]
946 better_loader_errors: bool,
947
948 #[serde(skip_serializing_if = "is_false")]
950 generate_df_type_layouts: bool,
951
952 #[serde(skip_serializing_if = "is_false")]
954 allow_references_in_ptbs: bool,
955
956 #[serde(skip_serializing_if = "is_false")]
958 enable_display_registry: bool,
959
960 #[serde(skip_serializing_if = "is_false")]
962 private_generics_verifier_v2: bool,
963
964 #[serde(skip_serializing_if = "is_false")]
966 deprecate_global_storage_ops_during_deserialization: bool,
967
968 #[serde(skip_serializing_if = "is_false")]
971 enable_non_exclusive_writes: bool,
972
973 #[serde(skip_serializing_if = "is_false")]
975 deprecate_global_storage_ops: bool,
976
977 #[serde(skip_serializing_if = "is_false")]
979 normalize_depth_formula: bool,
980
981 #[serde(skip_serializing_if = "is_false")]
983 consensus_skip_gced_accept_votes: bool,
984
985 #[serde(skip_serializing_if = "is_false")]
987 include_cancelled_randomness_txns_in_prologue: bool,
988
989 #[serde(skip_serializing_if = "is_false")]
991 address_aliases: bool,
992
993 #[serde(skip_serializing_if = "is_false")]
996 fix_checkpoint_signature_mapping: bool,
997
998 #[serde(skip_serializing_if = "is_false")]
1000 enable_object_funds_withdraw: bool,
1001
1002 #[serde(skip_serializing_if = "is_false")]
1004 consensus_skip_gced_blocks_in_direct_finalization: bool,
1005
1006 #[serde(skip_serializing_if = "is_false")]
1008 gas_rounding_halve_digits: bool,
1009
1010 #[serde(skip_serializing_if = "is_false")]
1012 flexible_tx_context_positions: bool,
1013
1014 #[serde(skip_serializing_if = "is_false")]
1016 disable_entry_point_signature_check: bool,
1017
1018 #[serde(skip_serializing_if = "is_false")]
1020 convert_withdrawal_compatibility_ptb_arguments: bool,
1021
1022 #[serde(skip_serializing_if = "is_false")]
1024 restrict_hot_or_not_entry_functions: bool,
1025
1026 #[serde(skip_serializing_if = "is_false")]
1028 split_checkpoints_in_consensus_handler: bool,
1029
1030 #[serde(skip_serializing_if = "is_false")]
1032 consensus_always_accept_system_transactions: bool,
1033
1034 #[serde(skip_serializing_if = "is_false")]
1036 validator_metadata_verify_v2: bool,
1037
1038 #[serde(skip_serializing_if = "is_false")]
1041 defer_unpaid_amplification: bool,
1042
1043 #[serde(skip_serializing_if = "is_false")]
1044 randomize_checkpoint_tx_limit_in_tests: bool,
1045
1046 #[serde(skip_serializing_if = "is_false")]
1048 gasless_transaction_drop_safety: bool,
1049
1050 #[serde(skip_serializing_if = "is_false")]
1052 merge_randomness_into_checkpoint: bool,
1053
1054 #[serde(skip_serializing_if = "is_false")]
1056 use_coin_party_owner: bool,
1057
1058 #[serde(skip_serializing_if = "is_false")]
1059 enable_gasless: bool,
1060
1061 #[serde(skip_serializing_if = "is_false")]
1062 gasless_verify_remaining_balance: bool,
1063
1064 #[serde(skip_serializing_if = "is_false")]
1065 disallow_jump_orphans: bool,
1066
1067 #[serde(skip_serializing_if = "is_false")]
1069 early_return_receive_object_mismatched_type: bool,
1070}
1071
1072fn is_false(b: &bool) -> bool {
1073 !b
1074}
1075
1076fn is_empty(b: &BTreeSet<String>) -> bool {
1077 b.is_empty()
1078}
1079
1080fn is_zero(val: &u64) -> bool {
1081 *val == 0
1082}
1083
1084#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1086pub enum ConsensusTransactionOrdering {
1087 #[default]
1089 None,
1090 ByGasPrice,
1092}
1093
1094impl ConsensusTransactionOrdering {
1095 pub fn is_none(&self) -> bool {
1096 matches!(self, ConsensusTransactionOrdering::None)
1097 }
1098}
1099
1100#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1101pub struct ExecutionTimeEstimateParams {
1102 pub target_utilization: u64,
1104 pub allowed_txn_cost_overage_burst_limit_us: u64,
1108
1109 pub randomness_scalar: u64,
1112
1113 pub max_estimate_us: u64,
1115
1116 pub stored_observations_num_included_checkpoints: u64,
1119
1120 pub stored_observations_limit: u64,
1122
1123 #[serde(skip_serializing_if = "is_zero")]
1126 pub stake_weighted_median_threshold: u64,
1127
1128 #[serde(skip_serializing_if = "is_false")]
1132 pub default_none_duration_for_new_keys: bool,
1133
1134 #[serde(skip_serializing_if = "Option::is_none")]
1136 pub observations_chunk_size: Option<u64>,
1137}
1138
1139#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1141pub enum PerObjectCongestionControlMode {
1142 #[default]
1143 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1149
1150impl PerObjectCongestionControlMode {
1151 pub fn is_none(&self) -> bool {
1152 matches!(self, PerObjectCongestionControlMode::None)
1153 }
1154}
1155
1156#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1158pub enum ConsensusChoice {
1159 #[default]
1160 Narwhal,
1161 SwapEachEpoch,
1162 Mysticeti,
1163}
1164
1165impl ConsensusChoice {
1166 pub fn is_narwhal(&self) -> bool {
1167 matches!(self, ConsensusChoice::Narwhal)
1168 }
1169}
1170
1171#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1173pub enum ConsensusNetwork {
1174 #[default]
1175 Anemo,
1176 Tonic,
1177}
1178
1179impl ConsensusNetwork {
1180 pub fn is_anemo(&self) -> bool {
1181 matches!(self, ConsensusNetwork::Anemo)
1182 }
1183}
1184
1185#[skip_serializing_none]
1217#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1218pub struct ProtocolConfig {
1219 pub version: ProtocolVersion,
1220
1221 feature_flags: FeatureFlags,
1222
1223 max_tx_size_bytes: Option<u64>,
1226
1227 max_input_objects: Option<u64>,
1229
1230 max_size_written_objects: Option<u64>,
1234 max_size_written_objects_system_tx: Option<u64>,
1237
1238 max_serialized_tx_effects_size_bytes: Option<u64>,
1240
1241 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1243
1244 max_gas_payment_objects: Option<u32>,
1246
1247 max_modules_in_publish: Option<u32>,
1249
1250 max_package_dependencies: Option<u32>,
1252
1253 max_arguments: Option<u32>,
1256
1257 max_type_arguments: Option<u32>,
1259
1260 max_type_argument_depth: Option<u32>,
1262
1263 max_pure_argument_size: Option<u32>,
1265
1266 max_programmable_tx_commands: Option<u32>,
1268
1269 move_binary_format_version: Option<u32>,
1272 min_move_binary_format_version: Option<u32>,
1273
1274 binary_module_handles: Option<u16>,
1276 binary_struct_handles: Option<u16>,
1277 binary_function_handles: Option<u16>,
1278 binary_function_instantiations: Option<u16>,
1279 binary_signatures: Option<u16>,
1280 binary_constant_pool: Option<u16>,
1281 binary_identifiers: Option<u16>,
1282 binary_address_identifiers: Option<u16>,
1283 binary_struct_defs: Option<u16>,
1284 binary_struct_def_instantiations: Option<u16>,
1285 binary_function_defs: Option<u16>,
1286 binary_field_handles: Option<u16>,
1287 binary_field_instantiations: Option<u16>,
1288 binary_friend_decls: Option<u16>,
1289 binary_enum_defs: Option<u16>,
1290 binary_enum_def_instantiations: Option<u16>,
1291 binary_variant_handles: Option<u16>,
1292 binary_variant_instantiation_handles: Option<u16>,
1293
1294 max_move_object_size: Option<u64>,
1296
1297 max_move_package_size: Option<u64>,
1300
1301 max_publish_or_upgrade_per_ptb: Option<u64>,
1303
1304 max_tx_gas: Option<u64>,
1306
1307 max_gas_price: Option<u64>,
1309
1310 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1313
1314 max_gas_computation_bucket: Option<u64>,
1316
1317 gas_rounding_step: Option<u64>,
1319
1320 max_loop_depth: Option<u64>,
1322
1323 max_generic_instantiation_length: Option<u64>,
1325
1326 max_function_parameters: Option<u64>,
1328
1329 max_basic_blocks: Option<u64>,
1331
1332 max_value_stack_size: Option<u64>,
1334
1335 max_type_nodes: Option<u64>,
1337
1338 max_push_size: Option<u64>,
1340
1341 max_struct_definitions: Option<u64>,
1343
1344 max_function_definitions: Option<u64>,
1346
1347 max_fields_in_struct: Option<u64>,
1349
1350 max_dependency_depth: Option<u64>,
1352
1353 max_num_event_emit: Option<u64>,
1355
1356 max_num_new_move_object_ids: Option<u64>,
1358
1359 max_num_new_move_object_ids_system_tx: Option<u64>,
1361
1362 max_num_deleted_move_object_ids: Option<u64>,
1364
1365 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1367
1368 max_num_transferred_move_object_ids: Option<u64>,
1370
1371 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1373
1374 max_event_emit_size: Option<u64>,
1376
1377 max_event_emit_size_total: Option<u64>,
1379
1380 max_move_vector_len: Option<u64>,
1382
1383 max_move_identifier_len: Option<u64>,
1385
1386 max_move_value_depth: Option<u64>,
1388
1389 max_move_enum_variants: Option<u64>,
1391
1392 max_back_edges_per_function: Option<u64>,
1394
1395 max_back_edges_per_module: Option<u64>,
1397
1398 max_verifier_meter_ticks_per_function: Option<u64>,
1400
1401 max_meter_ticks_per_module: Option<u64>,
1403
1404 max_meter_ticks_per_package: Option<u64>,
1406
1407 object_runtime_max_num_cached_objects: Option<u64>,
1411
1412 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1414
1415 object_runtime_max_num_store_entries: Option<u64>,
1417
1418 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1420
1421 base_tx_cost_fixed: Option<u64>,
1424
1425 package_publish_cost_fixed: Option<u64>,
1428
1429 base_tx_cost_per_byte: Option<u64>,
1432
1433 package_publish_cost_per_byte: Option<u64>,
1435
1436 obj_access_cost_read_per_byte: Option<u64>,
1438
1439 obj_access_cost_mutate_per_byte: Option<u64>,
1441
1442 obj_access_cost_delete_per_byte: Option<u64>,
1444
1445 obj_access_cost_verify_per_byte: Option<u64>,
1455
1456 max_type_to_layout_nodes: Option<u64>,
1458
1459 max_ptb_value_size: Option<u64>,
1461
1462 gas_model_version: Option<u64>,
1465
1466 obj_data_cost_refundable: Option<u64>,
1469
1470 obj_metadata_cost_non_refundable: Option<u64>,
1474
1475 storage_rebate_rate: Option<u64>,
1481
1482 storage_fund_reinvest_rate: Option<u64>,
1485
1486 reward_slashing_rate: Option<u64>,
1489
1490 storage_gas_price: Option<u64>,
1492
1493 accumulator_object_storage_cost: Option<u64>,
1495
1496 max_transactions_per_checkpoint: Option<u64>,
1501
1502 max_checkpoint_size_bytes: Option<u64>,
1506
1507 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1512
1513 address_from_bytes_cost_base: Option<u64>,
1518 address_to_u256_cost_base: Option<u64>,
1520 address_from_u256_cost_base: Option<u64>,
1522
1523 config_read_setting_impl_cost_base: Option<u64>,
1528 config_read_setting_impl_cost_per_byte: Option<u64>,
1529
1530 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1533 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1534 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1535 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1536 dynamic_field_add_child_object_cost_base: Option<u64>,
1538 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1539 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1540 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1541 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1543 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1544 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1545 dynamic_field_remove_child_object_cost_base: Option<u64>,
1547 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1548 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1549 dynamic_field_has_child_object_cost_base: Option<u64>,
1551 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1553 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1554 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1555
1556 event_emit_cost_base: Option<u64>,
1559 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1560 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1561 event_emit_output_cost_per_byte: Option<u64>,
1562 event_emit_auth_stream_cost: Option<u64>,
1563
1564 object_borrow_uid_cost_base: Option<u64>,
1567 object_delete_impl_cost_base: Option<u64>,
1569 object_record_new_uid_cost_base: Option<u64>,
1571
1572 transfer_transfer_internal_cost_base: Option<u64>,
1575 transfer_party_transfer_internal_cost_base: Option<u64>,
1577 transfer_freeze_object_cost_base: Option<u64>,
1579 transfer_share_object_cost_base: Option<u64>,
1581 transfer_receive_object_cost_base: Option<u64>,
1584 transfer_receive_object_cost_per_byte: Option<u64>,
1585 transfer_receive_object_type_cost_per_byte: Option<u64>,
1586
1587 tx_context_derive_id_cost_base: Option<u64>,
1590 tx_context_fresh_id_cost_base: Option<u64>,
1591 tx_context_sender_cost_base: Option<u64>,
1592 tx_context_epoch_cost_base: Option<u64>,
1593 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1594 tx_context_sponsor_cost_base: Option<u64>,
1595 tx_context_rgp_cost_base: Option<u64>,
1596 tx_context_gas_price_cost_base: Option<u64>,
1597 tx_context_gas_budget_cost_base: Option<u64>,
1598 tx_context_ids_created_cost_base: Option<u64>,
1599 tx_context_replace_cost_base: Option<u64>,
1600
1601 types_is_one_time_witness_cost_base: Option<u64>,
1604 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1605 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1606
1607 validator_validate_metadata_cost_base: Option<u64>,
1610 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1611
1612 crypto_invalid_arguments_cost: Option<u64>,
1614 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1616 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1617 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1618
1619 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1621 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1622 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1623
1624 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1626 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1627 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1628 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1629 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1630 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1631
1632 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1634
1635 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1637 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1638 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1639 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1640 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1641 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1642
1643 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1645 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1646 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1647 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1648 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1649 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1650
1651 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1653 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1654 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1655 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1656 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1657 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1658
1659 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1661 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1662 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1663
1664 ed25519_ed25519_verify_cost_base: Option<u64>,
1666 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1667 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1668
1669 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1671 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1672
1673 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1675 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1676 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1677 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1678 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1679
1680 hash_blake2b256_cost_base: Option<u64>,
1682 hash_blake2b256_data_cost_per_byte: Option<u64>,
1683 hash_blake2b256_data_cost_per_block: Option<u64>,
1684
1685 hash_keccak256_cost_base: Option<u64>,
1687 hash_keccak256_data_cost_per_byte: Option<u64>,
1688 hash_keccak256_data_cost_per_block: Option<u64>,
1689
1690 poseidon_bn254_cost_base: Option<u64>,
1692 poseidon_bn254_cost_per_block: Option<u64>,
1693
1694 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1696 group_ops_bls12381_decode_g1_cost: Option<u64>,
1697 group_ops_bls12381_decode_g2_cost: Option<u64>,
1698 group_ops_bls12381_decode_gt_cost: Option<u64>,
1699 group_ops_bls12381_scalar_add_cost: Option<u64>,
1700 group_ops_bls12381_g1_add_cost: Option<u64>,
1701 group_ops_bls12381_g2_add_cost: Option<u64>,
1702 group_ops_bls12381_gt_add_cost: Option<u64>,
1703 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1704 group_ops_bls12381_g1_sub_cost: Option<u64>,
1705 group_ops_bls12381_g2_sub_cost: Option<u64>,
1706 group_ops_bls12381_gt_sub_cost: Option<u64>,
1707 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1708 group_ops_bls12381_g1_mul_cost: Option<u64>,
1709 group_ops_bls12381_g2_mul_cost: Option<u64>,
1710 group_ops_bls12381_gt_mul_cost: Option<u64>,
1711 group_ops_bls12381_scalar_div_cost: Option<u64>,
1712 group_ops_bls12381_g1_div_cost: Option<u64>,
1713 group_ops_bls12381_g2_div_cost: Option<u64>,
1714 group_ops_bls12381_gt_div_cost: Option<u64>,
1715 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1716 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1717 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1718 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1719 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1720 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1721 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1722 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1723 group_ops_bls12381_msm_max_len: Option<u32>,
1724 group_ops_bls12381_pairing_cost: Option<u64>,
1725 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1726 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1727 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1728 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1729 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1730
1731 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1732 group_ops_ristretto_decode_point_cost: Option<u64>,
1733 group_ops_ristretto_scalar_add_cost: Option<u64>,
1734 group_ops_ristretto_point_add_cost: Option<u64>,
1735 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1736 group_ops_ristretto_point_sub_cost: Option<u64>,
1737 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1738 group_ops_ristretto_point_mul_cost: Option<u64>,
1739 group_ops_ristretto_scalar_div_cost: Option<u64>,
1740 group_ops_ristretto_point_div_cost: Option<u64>,
1741
1742 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
1743 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
1744
1745 hmac_hmac_sha3_256_cost_base: Option<u64>,
1747 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1748 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1749
1750 check_zklogin_id_cost_base: Option<u64>,
1752 check_zklogin_issuer_cost_base: Option<u64>,
1754
1755 vdf_verify_vdf_cost: Option<u64>,
1756 vdf_hash_to_input_cost: Option<u64>,
1757
1758 nitro_attestation_parse_base_cost: Option<u64>,
1760 nitro_attestation_parse_cost_per_byte: Option<u64>,
1761 nitro_attestation_verify_base_cost: Option<u64>,
1762 nitro_attestation_verify_cost_per_cert: Option<u64>,
1763
1764 bcs_per_byte_serialized_cost: Option<u64>,
1766 bcs_legacy_min_output_size_cost: Option<u64>,
1767 bcs_failure_cost: Option<u64>,
1768
1769 hash_sha2_256_base_cost: Option<u64>,
1770 hash_sha2_256_per_byte_cost: Option<u64>,
1771 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1772 hash_sha3_256_base_cost: Option<u64>,
1773 hash_sha3_256_per_byte_cost: Option<u64>,
1774 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1775 type_name_get_base_cost: Option<u64>,
1776 type_name_get_per_byte_cost: Option<u64>,
1777 type_name_id_base_cost: Option<u64>,
1778
1779 string_check_utf8_base_cost: Option<u64>,
1780 string_check_utf8_per_byte_cost: Option<u64>,
1781 string_is_char_boundary_base_cost: Option<u64>,
1782 string_sub_string_base_cost: Option<u64>,
1783 string_sub_string_per_byte_cost: Option<u64>,
1784 string_index_of_base_cost: Option<u64>,
1785 string_index_of_per_byte_pattern_cost: Option<u64>,
1786 string_index_of_per_byte_searched_cost: Option<u64>,
1787
1788 vector_empty_base_cost: Option<u64>,
1789 vector_length_base_cost: Option<u64>,
1790 vector_push_back_base_cost: Option<u64>,
1791 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1792 vector_borrow_base_cost: Option<u64>,
1793 vector_pop_back_base_cost: Option<u64>,
1794 vector_destroy_empty_base_cost: Option<u64>,
1795 vector_swap_base_cost: Option<u64>,
1796 debug_print_base_cost: Option<u64>,
1797 debug_print_stack_trace_base_cost: Option<u64>,
1798
1799 execution_version: Option<u64>,
1808
1809 consensus_bad_nodes_stake_threshold: Option<u64>,
1813
1814 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1815 max_age_of_jwk_in_epochs: Option<u64>,
1819
1820 random_beacon_reduction_allowed_delta: Option<u16>,
1824
1825 random_beacon_reduction_lower_bound: Option<u32>,
1828
1829 random_beacon_dkg_timeout_round: Option<u32>,
1832
1833 random_beacon_min_round_interval_ms: Option<u64>,
1835
1836 random_beacon_dkg_version: Option<u64>,
1839
1840 consensus_max_transaction_size_bytes: Option<u64>,
1843 consensus_max_transactions_in_block_bytes: Option<u64>,
1845 consensus_max_num_transactions_in_block: Option<u64>,
1847
1848 consensus_voting_rounds: Option<u32>,
1850
1851 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1853
1854 max_deferral_rounds_for_congestion_control: Option<u64>,
1857
1858 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1860
1861 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1863
1864 min_checkpoint_interval_ms: Option<u64>,
1866
1867 checkpoint_summary_version_specific_data: Option<u64>,
1869
1870 max_soft_bundle_size: Option<u64>,
1872
1873 bridge_should_try_to_finalize_committee: Option<bool>,
1877
1878 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1884
1885 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1888
1889 consensus_gc_depth: Option<u32>,
1892
1893 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1895
1896 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1898
1899 sip_45_consensus_amplification_threshold: Option<u64>,
1902
1903 use_object_per_epoch_marker_table_v2: Option<bool>,
1906
1907 consensus_commit_rate_estimation_window_size: Option<u32>,
1909
1910 #[serde(skip_serializing_if = "Vec::is_empty")]
1914 aliased_addresses: Vec<AliasedAddress>,
1915
1916 translation_per_command_base_charge: Option<u64>,
1919
1920 translation_per_input_base_charge: Option<u64>,
1923
1924 translation_pure_input_per_byte_charge: Option<u64>,
1926
1927 translation_per_type_node_charge: Option<u64>,
1931
1932 translation_per_reference_node_charge: Option<u64>,
1935
1936 translation_per_linkage_entry_charge: Option<u64>,
1939
1940 max_updates_per_settlement_txn: Option<u32>,
1942
1943 gasless_max_computation_units: Option<u64>,
1945
1946 #[skip_accessor]
1948 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1949
1950 gasless_max_unused_inputs: Option<u64>,
1954
1955 gasless_max_pure_input_bytes: Option<u64>,
1958
1959 gasless_max_tps: Option<u64>,
1961
1962 #[serde(skip_serializing_if = "Option::is_none")]
1963 #[skip_accessor]
1964 include_special_package_amendments: Option<Arc<Amendments>>,
1965
1966 gasless_max_tx_size_bytes: Option<u64>,
1969}
1970
1971#[derive(Clone, Serialize, Deserialize, Debug)]
1973pub struct AliasedAddress {
1974 pub original: [u8; 32],
1976 pub aliased: [u8; 32],
1978 pub allowed_tx_digests: Vec<[u8; 32]>,
1980}
1981
1982impl ProtocolConfig {
1984 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1997 if self.feature_flags.package_upgrades {
1998 Ok(())
1999 } else {
2000 Err(Error(format!(
2001 "package upgrades are not supported at {:?}",
2002 self.version
2003 )))
2004 }
2005 }
2006
2007 pub fn allow_receiving_object_id(&self) -> bool {
2008 self.feature_flags.allow_receiving_object_id
2009 }
2010
2011 pub fn receiving_objects_supported(&self) -> bool {
2012 self.feature_flags.receive_objects
2013 }
2014
2015 pub fn package_upgrades_supported(&self) -> bool {
2016 self.feature_flags.package_upgrades
2017 }
2018
2019 pub fn check_commit_root_state_digest_supported(&self) -> bool {
2020 self.feature_flags.commit_root_state_digest
2021 }
2022
2023 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
2024 self.feature_flags.advance_epoch_start_time_in_safe_mode
2025 }
2026
2027 pub fn loaded_child_objects_fixed(&self) -> bool {
2028 self.feature_flags.loaded_child_objects_fixed
2029 }
2030
2031 pub fn missing_type_is_compatibility_error(&self) -> bool {
2032 self.feature_flags.missing_type_is_compatibility_error
2033 }
2034
2035 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
2036 self.feature_flags.scoring_decision_with_validity_cutoff
2037 }
2038
2039 pub fn narwhal_versioned_metadata(&self) -> bool {
2040 self.feature_flags.narwhal_versioned_metadata
2041 }
2042
2043 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2044 self.feature_flags.consensus_order_end_of_epoch_last
2045 }
2046
2047 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2048 self.feature_flags.disallow_adding_abilities_on_upgrade
2049 }
2050
2051 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2052 self.feature_flags
2053 .disable_invariant_violation_check_in_swap_loc
2054 }
2055
2056 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2057 self.feature_flags
2058 .advance_to_highest_supported_protocol_version
2059 }
2060
2061 pub fn ban_entry_init(&self) -> bool {
2062 self.feature_flags.ban_entry_init
2063 }
2064
2065 pub fn package_digest_hash_module(&self) -> bool {
2066 self.feature_flags.package_digest_hash_module
2067 }
2068
2069 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2070 self.feature_flags
2071 .disallow_change_struct_type_params_on_upgrade
2072 }
2073
2074 pub fn no_extraneous_module_bytes(&self) -> bool {
2075 self.feature_flags.no_extraneous_module_bytes
2076 }
2077
2078 pub fn zklogin_auth(&self) -> bool {
2079 self.feature_flags.zklogin_auth
2080 }
2081
2082 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2083 &self.feature_flags.zklogin_supported_providers
2084 }
2085
2086 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2087 self.feature_flags.consensus_transaction_ordering
2088 }
2089
2090 pub fn simplified_unwrap_then_delete(&self) -> bool {
2091 self.feature_flags.simplified_unwrap_then_delete
2092 }
2093
2094 pub fn supports_upgraded_multisig(&self) -> bool {
2095 self.feature_flags.upgraded_multisig_supported
2096 }
2097
2098 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2099 self.feature_flags.txn_base_cost_as_multiplier
2100 }
2101
2102 pub fn shared_object_deletion(&self) -> bool {
2103 self.feature_flags.shared_object_deletion
2104 }
2105
2106 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2107 self.feature_flags.narwhal_new_leader_election_schedule
2108 }
2109
2110 pub fn loaded_child_object_format(&self) -> bool {
2111 self.feature_flags.loaded_child_object_format
2112 }
2113
2114 pub fn enable_jwk_consensus_updates(&self) -> bool {
2115 let ret = self.feature_flags.enable_jwk_consensus_updates;
2116 if ret {
2117 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2119 }
2120 ret
2121 }
2122
2123 pub fn simple_conservation_checks(&self) -> bool {
2124 self.feature_flags.simple_conservation_checks
2125 }
2126
2127 pub fn loaded_child_object_format_type(&self) -> bool {
2128 self.feature_flags.loaded_child_object_format_type
2129 }
2130
2131 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2132 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2133 if !ret {
2134 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2136 }
2137 ret
2138 }
2139
2140 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2141 self.feature_flags
2142 .recompute_has_public_transfer_in_execution
2143 }
2144
2145 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2147 self.enable_jwk_consensus_updates()
2148 }
2149
2150 pub fn random_beacon(&self) -> bool {
2151 self.feature_flags.random_beacon
2152 }
2153
2154 pub fn dkg_version(&self) -> u64 {
2155 self.random_beacon_dkg_version.unwrap_or(1)
2157 }
2158
2159 pub fn enable_bridge(&self) -> bool {
2160 let ret = self.feature_flags.bridge;
2161 if ret {
2162 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2164 }
2165 ret
2166 }
2167
2168 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2169 if !self.enable_bridge() {
2170 return false;
2171 }
2172 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2174 }
2175
2176 pub fn enable_effects_v2(&self) -> bool {
2177 self.feature_flags.enable_effects_v2
2178 }
2179
2180 pub fn narwhal_certificate_v2(&self) -> bool {
2181 self.feature_flags.narwhal_certificate_v2
2182 }
2183
2184 pub fn verify_legacy_zklogin_address(&self) -> bool {
2185 self.feature_flags.verify_legacy_zklogin_address
2186 }
2187
2188 pub fn accept_zklogin_in_multisig(&self) -> bool {
2189 self.feature_flags.accept_zklogin_in_multisig
2190 }
2191
2192 pub fn accept_passkey_in_multisig(&self) -> bool {
2193 self.feature_flags.accept_passkey_in_multisig
2194 }
2195
2196 pub fn validate_zklogin_public_identifier(&self) -> bool {
2197 self.feature_flags.validate_zklogin_public_identifier
2198 }
2199
2200 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2201 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2202 }
2203
2204 pub fn throughput_aware_consensus_submission(&self) -> bool {
2205 self.feature_flags.throughput_aware_consensus_submission
2206 }
2207
2208 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2209 self.feature_flags.include_consensus_digest_in_prologue
2210 }
2211
2212 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2213 self.feature_flags
2214 .record_consensus_determined_version_assignments_in_prologue
2215 }
2216
2217 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2218 self.feature_flags
2219 .record_additional_state_digest_in_prologue
2220 }
2221
2222 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2223 self.feature_flags
2224 .record_consensus_determined_version_assignments_in_prologue_v2
2225 }
2226
2227 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2228 self.feature_flags
2229 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2230 }
2231
2232 pub fn hardened_otw_check(&self) -> bool {
2233 self.feature_flags.hardened_otw_check
2234 }
2235
2236 pub fn enable_poseidon(&self) -> bool {
2237 self.feature_flags.enable_poseidon
2238 }
2239
2240 pub fn enable_coin_deny_list_v1(&self) -> bool {
2241 self.feature_flags.enable_coin_deny_list
2242 }
2243
2244 pub fn enable_accumulators(&self) -> bool {
2245 self.feature_flags.enable_accumulators
2246 }
2247
2248 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2249 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2250 }
2251
2252 pub fn create_root_accumulator_object(&self) -> bool {
2253 self.feature_flags.create_root_accumulator_object
2254 }
2255
2256 pub fn enable_address_balance_gas_payments(&self) -> bool {
2257 self.feature_flags.enable_address_balance_gas_payments
2258 }
2259
2260 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2261 self.feature_flags.address_balance_gas_check_rgp_at_signing
2262 }
2263
2264 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2265 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2266 }
2267
2268 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2269 self.feature_flags.enable_multi_epoch_transaction_expiration
2270 }
2271
2272 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2273 self.feature_flags.relax_valid_during_for_owned_inputs
2274 }
2275
2276 pub fn enable_authenticated_event_streams(&self) -> bool {
2277 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2278 }
2279
2280 pub fn enable_non_exclusive_writes(&self) -> bool {
2281 self.feature_flags.enable_non_exclusive_writes
2282 }
2283
2284 pub fn enable_coin_registry(&self) -> bool {
2285 self.feature_flags.enable_coin_registry
2286 }
2287
2288 pub fn enable_display_registry(&self) -> bool {
2289 self.feature_flags.enable_display_registry
2290 }
2291
2292 pub fn enable_coin_deny_list_v2(&self) -> bool {
2293 self.feature_flags.enable_coin_deny_list_v2
2294 }
2295
2296 pub fn enable_group_ops_native_functions(&self) -> bool {
2297 self.feature_flags.enable_group_ops_native_functions
2298 }
2299
2300 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2301 self.feature_flags.enable_group_ops_native_function_msm
2302 }
2303
2304 pub fn enable_ristretto255_group_ops(&self) -> bool {
2305 self.feature_flags.enable_ristretto255_group_ops
2306 }
2307
2308 pub fn enable_verify_bulletproofs_ristretto255(&self) -> bool {
2309 self.feature_flags.enable_verify_bulletproofs_ristretto255
2310 }
2311
2312 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2313 self.feature_flags.reject_mutable_random_on_entry_functions
2314 }
2315
2316 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2317 self.feature_flags.per_object_congestion_control_mode
2318 }
2319
2320 pub fn consensus_choice(&self) -> ConsensusChoice {
2321 self.feature_flags.consensus_choice
2322 }
2323
2324 pub fn consensus_network(&self) -> ConsensusNetwork {
2325 self.feature_flags.consensus_network
2326 }
2327
2328 pub fn correct_gas_payment_limit_check(&self) -> bool {
2329 self.feature_flags.correct_gas_payment_limit_check
2330 }
2331
2332 pub fn reshare_at_same_initial_version(&self) -> bool {
2333 self.feature_flags.reshare_at_same_initial_version
2334 }
2335
2336 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2337 self.feature_flags.resolve_abort_locations_to_package_id
2338 }
2339
2340 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2341 self.feature_flags.mysticeti_use_committed_subdag_digest
2342 }
2343
2344 pub fn enable_vdf(&self) -> bool {
2345 self.feature_flags.enable_vdf
2346 }
2347
2348 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2349 self.feature_flags.fresh_vm_on_framework_upgrade
2350 }
2351
2352 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2353 self.feature_flags.mysticeti_num_leaders_per_round
2354 }
2355
2356 pub fn soft_bundle(&self) -> bool {
2357 self.feature_flags.soft_bundle
2358 }
2359
2360 pub fn passkey_auth(&self) -> bool {
2361 self.feature_flags.passkey_auth
2362 }
2363
2364 pub fn authority_capabilities_v2(&self) -> bool {
2365 self.feature_flags.authority_capabilities_v2
2366 }
2367
2368 pub fn max_transaction_size_bytes(&self) -> u64 {
2369 self.consensus_max_transaction_size_bytes
2371 .unwrap_or(256 * 1024)
2372 }
2373
2374 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2375 if cfg!(msim) {
2376 256 * 1024
2377 } else {
2378 self.consensus_max_transactions_in_block_bytes
2379 .unwrap_or(512 * 1024)
2380 }
2381 }
2382
2383 pub fn max_num_transactions_in_block(&self) -> u64 {
2384 if cfg!(msim) {
2385 8
2386 } else {
2387 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2388 }
2389 }
2390
2391 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2392 self.feature_flags.rethrow_serialization_type_layout_errors
2393 }
2394
2395 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2396 self.feature_flags
2397 .consensus_distributed_vote_scoring_strategy
2398 }
2399
2400 pub fn consensus_round_prober(&self) -> bool {
2401 self.feature_flags.consensus_round_prober
2402 }
2403
2404 pub fn validate_identifier_inputs(&self) -> bool {
2405 self.feature_flags.validate_identifier_inputs
2406 }
2407
2408 pub fn gc_depth(&self) -> u32 {
2409 self.consensus_gc_depth.unwrap_or(0)
2410 }
2411
2412 pub fn mysticeti_fastpath(&self) -> bool {
2413 self.feature_flags.mysticeti_fastpath
2414 }
2415
2416 pub fn relocate_event_module(&self) -> bool {
2417 self.feature_flags.relocate_event_module
2418 }
2419
2420 pub fn uncompressed_g1_group_elements(&self) -> bool {
2421 self.feature_flags.uncompressed_g1_group_elements
2422 }
2423
2424 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2425 self.feature_flags
2426 .disallow_new_modules_in_deps_only_packages
2427 }
2428
2429 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2430 self.feature_flags.consensus_smart_ancestor_selection
2431 }
2432
2433 pub fn disable_preconsensus_locking(&self) -> bool {
2434 self.feature_flags.disable_preconsensus_locking
2435 }
2436
2437 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2438 self.feature_flags
2439 .consensus_round_prober_probe_accepted_rounds
2440 }
2441
2442 pub fn native_charging_v2(&self) -> bool {
2443 self.feature_flags.native_charging_v2
2444 }
2445
2446 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2447 let res = self.feature_flags.consensus_linearize_subdag_v2;
2448 assert!(
2449 !res || self.gc_depth() > 0,
2450 "The consensus linearize sub dag V2 requires GC to be enabled"
2451 );
2452 res
2453 }
2454
2455 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2456 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2457 assert!(
2458 !res || self.gc_depth() > 0,
2459 "The consensus median based commit timestamp requires GC to be enabled"
2460 );
2461 res
2462 }
2463
2464 pub fn consensus_batched_block_sync(&self) -> bool {
2465 self.feature_flags.consensus_batched_block_sync
2466 }
2467
2468 pub fn convert_type_argument_error(&self) -> bool {
2469 self.feature_flags.convert_type_argument_error
2470 }
2471
2472 pub fn variant_nodes(&self) -> bool {
2473 self.feature_flags.variant_nodes
2474 }
2475
2476 pub fn consensus_zstd_compression(&self) -> bool {
2477 self.feature_flags.consensus_zstd_compression
2478 }
2479
2480 pub fn enable_nitro_attestation(&self) -> bool {
2481 self.feature_flags.enable_nitro_attestation
2482 }
2483
2484 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2485 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2486 }
2487
2488 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2489 self.feature_flags
2490 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2491 }
2492
2493 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2494 self.feature_flags
2495 .enable_nitro_attestation_always_include_required_pcrs_parsing
2496 }
2497
2498 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2499 self.consensus_commit_rate_estimation_window_size
2500 .unwrap_or(0)
2501 }
2502
2503 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2504 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2508 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2510 window_size
2511 }
2512
2513 pub fn minimize_child_object_mutations(&self) -> bool {
2514 self.feature_flags.minimize_child_object_mutations
2515 }
2516
2517 pub fn move_native_context(&self) -> bool {
2518 self.feature_flags.move_native_context
2519 }
2520
2521 pub fn normalize_ptb_arguments(&self) -> bool {
2522 self.feature_flags.normalize_ptb_arguments
2523 }
2524
2525 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2526 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2527 }
2528
2529 pub fn max_ptb_value_size_v2(&self) -> bool {
2530 self.feature_flags.max_ptb_value_size_v2
2531 }
2532
2533 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2534 self.feature_flags.resolve_type_input_ids_to_defining_id
2535 }
2536
2537 pub fn enable_party_transfer(&self) -> bool {
2538 self.feature_flags.enable_party_transfer
2539 }
2540
2541 pub fn allow_unbounded_system_objects(&self) -> bool {
2542 self.feature_flags.allow_unbounded_system_objects
2543 }
2544
2545 pub fn type_tags_in_object_runtime(&self) -> bool {
2546 self.feature_flags.type_tags_in_object_runtime
2547 }
2548
2549 pub fn enable_ptb_execution_v2(&self) -> bool {
2550 self.feature_flags.enable_ptb_execution_v2
2551 }
2552
2553 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2554 self.feature_flags.better_adapter_type_resolution_errors
2555 }
2556
2557 pub fn record_time_estimate_processed(&self) -> bool {
2558 self.feature_flags.record_time_estimate_processed
2559 }
2560
2561 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2562 self.feature_flags
2563 .ignore_execution_time_observations_after_certs_closed
2564 }
2565
2566 pub fn dependency_linkage_error(&self) -> bool {
2567 self.feature_flags.dependency_linkage_error
2568 }
2569
2570 pub fn additional_multisig_checks(&self) -> bool {
2571 self.feature_flags.additional_multisig_checks
2572 }
2573
2574 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2575 self.feature_flags.debug_fatal_on_move_invariant_violation
2576 }
2577
2578 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2579 self.feature_flags.allow_private_accumulator_entrypoints
2580 }
2581
2582 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2583 self.feature_flags
2584 .additional_consensus_digest_indirect_state
2585 }
2586
2587 pub fn check_for_init_during_upgrade(&self) -> bool {
2588 self.feature_flags.check_for_init_during_upgrade
2589 }
2590
2591 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2592 self.feature_flags.per_command_shared_object_transfer_rules
2593 }
2594
2595 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2596 self.feature_flags
2597 .consensus_checkpoint_signature_key_includes_digest
2598 }
2599
2600 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2601 self.feature_flags
2602 .include_checkpoint_artifacts_digest_in_summary
2603 }
2604
2605 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2606 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2607 }
2608
2609 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2610 self.feature_flags.cancel_for_failed_dkg_early
2611 }
2612
2613 pub fn abstract_size_in_object_runtime(&self) -> bool {
2614 self.feature_flags.abstract_size_in_object_runtime
2615 }
2616
2617 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2618 self.feature_flags.object_runtime_charge_cache_load_gas
2619 }
2620
2621 pub fn additional_borrow_checks(&self) -> bool {
2622 self.feature_flags.additional_borrow_checks
2623 }
2624
2625 pub fn use_new_commit_handler(&self) -> bool {
2626 self.feature_flags.use_new_commit_handler
2627 }
2628
2629 pub fn better_loader_errors(&self) -> bool {
2630 self.feature_flags.better_loader_errors
2631 }
2632
2633 pub fn generate_df_type_layouts(&self) -> bool {
2634 self.feature_flags.generate_df_type_layouts
2635 }
2636
2637 pub fn allow_references_in_ptbs(&self) -> bool {
2638 self.feature_flags.allow_references_in_ptbs
2639 }
2640
2641 pub fn private_generics_verifier_v2(&self) -> bool {
2642 self.feature_flags.private_generics_verifier_v2
2643 }
2644
2645 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2646 self.feature_flags
2647 .deprecate_global_storage_ops_during_deserialization
2648 }
2649
2650 pub fn enable_observation_chunking(&self) -> bool {
2651 matches!(self.feature_flags.per_object_congestion_control_mode,
2652 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2653 if params.observations_chunk_size.is_some()
2654 )
2655 }
2656
2657 pub fn deprecate_global_storage_ops(&self) -> bool {
2658 self.feature_flags.deprecate_global_storage_ops
2659 }
2660
2661 pub fn normalize_depth_formula(&self) -> bool {
2662 self.feature_flags.normalize_depth_formula
2663 }
2664
2665 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2666 self.feature_flags.consensus_skip_gced_accept_votes
2667 }
2668
2669 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2670 self.feature_flags
2671 .include_cancelled_randomness_txns_in_prologue
2672 }
2673
2674 pub fn address_aliases(&self) -> bool {
2675 let address_aliases = self.feature_flags.address_aliases;
2676 assert!(
2677 !address_aliases || self.mysticeti_fastpath(),
2678 "Address aliases requires Mysticeti fastpath to be enabled"
2679 );
2680 if address_aliases {
2681 assert!(
2682 self.feature_flags.disable_preconsensus_locking,
2683 "Address aliases requires CertifiedTransaction to be disabled"
2684 );
2685 }
2686 address_aliases
2687 }
2688
2689 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2690 self.feature_flags.fix_checkpoint_signature_mapping
2691 }
2692
2693 pub fn enable_object_funds_withdraw(&self) -> bool {
2694 self.feature_flags.enable_object_funds_withdraw
2695 }
2696
2697 pub fn gas_rounding_halve_digits(&self) -> bool {
2698 self.feature_flags.gas_rounding_halve_digits
2699 }
2700
2701 pub fn flexible_tx_context_positions(&self) -> bool {
2702 self.feature_flags.flexible_tx_context_positions
2703 }
2704
2705 pub fn disable_entry_point_signature_check(&self) -> bool {
2706 self.feature_flags.disable_entry_point_signature_check
2707 }
2708
2709 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2710 self.feature_flags
2711 .consensus_skip_gced_blocks_in_direct_finalization
2712 }
2713
2714 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2715 self.feature_flags
2716 .convert_withdrawal_compatibility_ptb_arguments
2717 }
2718
2719 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2720 self.feature_flags.restrict_hot_or_not_entry_functions
2721 }
2722
2723 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2724 self.feature_flags.split_checkpoints_in_consensus_handler
2725 }
2726
2727 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2728 self.feature_flags
2729 .consensus_always_accept_system_transactions
2730 }
2731
2732 pub fn validator_metadata_verify_v2(&self) -> bool {
2733 self.feature_flags.validator_metadata_verify_v2
2734 }
2735
2736 pub fn defer_unpaid_amplification(&self) -> bool {
2737 self.feature_flags.defer_unpaid_amplification
2738 }
2739
2740 pub fn gasless_transaction_drop_safety(&self) -> bool {
2741 self.feature_flags.gasless_transaction_drop_safety
2742 }
2743
2744 pub fn new_vm_enabled(&self) -> bool {
2745 self.execution_version.is_some_and(|v| v >= 4)
2746 }
2747
2748 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2749 self.feature_flags.merge_randomness_into_checkpoint
2750 }
2751
2752 pub fn use_coin_party_owner(&self) -> bool {
2753 self.feature_flags.use_coin_party_owner
2754 }
2755
2756 pub fn enable_gasless(&self) -> bool {
2757 self.feature_flags.enable_gasless
2758 }
2759
2760 pub fn gasless_verify_remaining_balance(&self) -> bool {
2761 self.feature_flags.gasless_verify_remaining_balance
2762 }
2763
2764 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2765 debug_assert!(self.gasless_allowed_token_types.is_some());
2766 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2767 }
2768
2769 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2770 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2771 }
2772
2773 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2774 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2775 }
2776
2777 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2778 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2779 }
2780
2781 pub fn disallow_jump_orphans(&self) -> bool {
2782 self.feature_flags.disallow_jump_orphans
2783 }
2784
2785 pub fn early_return_receive_object_mismatched_type(&self) -> bool {
2786 self.feature_flags
2787 .early_return_receive_object_mismatched_type
2788 }
2789
2790 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2791 &self.include_special_package_amendments
2792 }
2793}
2794
2795#[cfg(not(msim))]
2796static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2797
2798#[cfg(msim)]
2800thread_local! {
2801 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2802}
2803
2804impl ProtocolConfig {
2806 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2808 assert!(
2810 version >= ProtocolVersion::MIN,
2811 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2812 version,
2813 ProtocolVersion::MIN.0,
2814 );
2815 assert!(
2816 version <= ProtocolVersion::MAX_ALLOWED,
2817 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2818 version,
2819 ProtocolVersion::MAX_ALLOWED.0,
2820 );
2821
2822 let mut ret = Self::get_for_version_impl(version, chain);
2823 ret.version = version;
2824
2825 ret = Self::apply_config_override(version, ret);
2826
2827 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2828 warn!(
2829 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2830 );
2831 let overrides: ProtocolConfigOptional =
2832 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2833 .expect("failed to parse ProtocolConfig override env variables");
2834 overrides.apply_to(&mut ret);
2835 }
2836
2837 ret
2838 }
2839
2840 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2843 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2844 let mut ret = Self::get_for_version_impl(version, chain);
2845 ret.version = version;
2846 ret = Self::apply_config_override(version, ret);
2847 Some(ret)
2848 } else {
2849 None
2850 }
2851 }
2852
2853 #[cfg(not(msim))]
2854 pub fn poison_get_for_min_version() {
2855 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2856 }
2857
2858 #[cfg(not(msim))]
2859 fn load_poison_get_for_min_version() -> bool {
2860 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2861 }
2862
2863 #[cfg(msim)]
2864 pub fn poison_get_for_min_version() {
2865 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2866 }
2867
2868 #[cfg(msim)]
2869 fn load_poison_get_for_min_version() -> bool {
2870 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2871 }
2872
2873 pub fn get_for_min_version() -> Self {
2876 if Self::load_poison_get_for_min_version() {
2877 panic!("get_for_min_version called on validator");
2878 }
2879 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2880 }
2881
2882 #[allow(non_snake_case)]
2892 pub fn get_for_max_version_UNSAFE() -> Self {
2893 if Self::load_poison_get_for_min_version() {
2894 panic!("get_for_max_version_UNSAFE called on validator");
2895 }
2896 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2897 }
2898
2899 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2900 #[cfg(msim)]
2901 {
2902 if version == ProtocolVersion::MAX_ALLOWED {
2904 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2905 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2906 return config;
2907 }
2908 }
2909
2910 let mut cfg = Self {
2913 version,
2915
2916 feature_flags: Default::default(),
2918
2919 max_tx_size_bytes: Some(128 * 1024),
2920 max_input_objects: Some(2048),
2922 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2923 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2924 max_gas_payment_objects: Some(256),
2925 max_modules_in_publish: Some(128),
2926 max_package_dependencies: None,
2927 max_arguments: Some(512),
2928 max_type_arguments: Some(16),
2929 max_type_argument_depth: Some(16),
2930 max_pure_argument_size: Some(16 * 1024),
2931 max_programmable_tx_commands: Some(1024),
2932 move_binary_format_version: Some(6),
2933 min_move_binary_format_version: None,
2934 binary_module_handles: None,
2935 binary_struct_handles: None,
2936 binary_function_handles: None,
2937 binary_function_instantiations: None,
2938 binary_signatures: None,
2939 binary_constant_pool: None,
2940 binary_identifiers: None,
2941 binary_address_identifiers: None,
2942 binary_struct_defs: None,
2943 binary_struct_def_instantiations: None,
2944 binary_function_defs: None,
2945 binary_field_handles: None,
2946 binary_field_instantiations: None,
2947 binary_friend_decls: None,
2948 binary_enum_defs: None,
2949 binary_enum_def_instantiations: None,
2950 binary_variant_handles: None,
2951 binary_variant_instantiation_handles: None,
2952 max_move_object_size: Some(250 * 1024),
2953 max_move_package_size: Some(100 * 1024),
2954 max_publish_or_upgrade_per_ptb: None,
2955 max_tx_gas: Some(10_000_000_000),
2956 max_gas_price: Some(100_000),
2957 max_gas_price_rgp_factor_for_aborted_transactions: None,
2958 max_gas_computation_bucket: Some(5_000_000),
2959 max_loop_depth: Some(5),
2960 max_generic_instantiation_length: Some(32),
2961 max_function_parameters: Some(128),
2962 max_basic_blocks: Some(1024),
2963 max_value_stack_size: Some(1024),
2964 max_type_nodes: Some(256),
2965 max_push_size: Some(10000),
2966 max_struct_definitions: Some(200),
2967 max_function_definitions: Some(1000),
2968 max_fields_in_struct: Some(32),
2969 max_dependency_depth: Some(100),
2970 max_num_event_emit: Some(256),
2971 max_num_new_move_object_ids: Some(2048),
2972 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2973 max_num_deleted_move_object_ids: Some(2048),
2974 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2975 max_num_transferred_move_object_ids: Some(2048),
2976 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2977 max_event_emit_size: Some(250 * 1024),
2978 max_move_vector_len: Some(256 * 1024),
2979 max_type_to_layout_nodes: None,
2980 max_ptb_value_size: None,
2981
2982 max_back_edges_per_function: Some(10_000),
2983 max_back_edges_per_module: Some(10_000),
2984 max_verifier_meter_ticks_per_function: Some(6_000_000),
2985 max_meter_ticks_per_module: Some(6_000_000),
2986 max_meter_ticks_per_package: None,
2987
2988 object_runtime_max_num_cached_objects: Some(1000),
2989 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2990 object_runtime_max_num_store_entries: Some(1000),
2991 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2992 base_tx_cost_fixed: Some(110_000),
2993 package_publish_cost_fixed: Some(1_000),
2994 base_tx_cost_per_byte: Some(0),
2995 package_publish_cost_per_byte: Some(80),
2996 obj_access_cost_read_per_byte: Some(15),
2997 obj_access_cost_mutate_per_byte: Some(40),
2998 obj_access_cost_delete_per_byte: Some(40),
2999 obj_access_cost_verify_per_byte: Some(200),
3000 obj_data_cost_refundable: Some(100),
3001 obj_metadata_cost_non_refundable: Some(50),
3002 gas_model_version: Some(1),
3003 storage_rebate_rate: Some(9900),
3004 storage_fund_reinvest_rate: Some(500),
3005 reward_slashing_rate: Some(5000),
3006 storage_gas_price: Some(1),
3007 accumulator_object_storage_cost: None,
3008 max_transactions_per_checkpoint: Some(10_000),
3009 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
3010
3011 buffer_stake_for_protocol_upgrade_bps: Some(0),
3014
3015 address_from_bytes_cost_base: Some(52),
3019 address_to_u256_cost_base: Some(52),
3021 address_from_u256_cost_base: Some(52),
3023
3024 config_read_setting_impl_cost_base: None,
3027 config_read_setting_impl_cost_per_byte: None,
3028
3029 dynamic_field_hash_type_and_key_cost_base: Some(100),
3032 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
3033 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
3034 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
3035 dynamic_field_add_child_object_cost_base: Some(100),
3037 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
3038 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
3039 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
3040 dynamic_field_borrow_child_object_cost_base: Some(100),
3042 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3043 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3044 dynamic_field_remove_child_object_cost_base: Some(100),
3046 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3047 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3048 dynamic_field_has_child_object_cost_base: Some(100),
3050 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3052 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3053 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3054
3055 event_emit_cost_base: Some(52),
3058 event_emit_value_size_derivation_cost_per_byte: Some(2),
3059 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3060 event_emit_output_cost_per_byte: Some(10),
3061 event_emit_auth_stream_cost: None,
3062
3063 object_borrow_uid_cost_base: Some(52),
3066 object_delete_impl_cost_base: Some(52),
3068 object_record_new_uid_cost_base: Some(52),
3070
3071 transfer_transfer_internal_cost_base: Some(52),
3074 transfer_party_transfer_internal_cost_base: None,
3076 transfer_freeze_object_cost_base: Some(52),
3078 transfer_share_object_cost_base: Some(52),
3080 transfer_receive_object_cost_base: None,
3081 transfer_receive_object_type_cost_per_byte: None,
3082 transfer_receive_object_cost_per_byte: None,
3083
3084 tx_context_derive_id_cost_base: Some(52),
3087 tx_context_fresh_id_cost_base: None,
3088 tx_context_sender_cost_base: None,
3089 tx_context_epoch_cost_base: None,
3090 tx_context_epoch_timestamp_ms_cost_base: None,
3091 tx_context_sponsor_cost_base: None,
3092 tx_context_rgp_cost_base: None,
3093 tx_context_gas_price_cost_base: None,
3094 tx_context_gas_budget_cost_base: None,
3095 tx_context_ids_created_cost_base: None,
3096 tx_context_replace_cost_base: None,
3097
3098 types_is_one_time_witness_cost_base: Some(52),
3101 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3102 types_is_one_time_witness_type_cost_per_byte: Some(2),
3103
3104 validator_validate_metadata_cost_base: Some(52),
3107 validator_validate_metadata_data_cost_per_byte: Some(2),
3108
3109 crypto_invalid_arguments_cost: Some(100),
3111 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3113 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3114 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3115
3116 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3118 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3119 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3120
3121 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3123 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3124 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3125 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3126 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3127 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3128
3129 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3131
3132 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3134 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3135 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3136 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3137 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3138 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3139
3140 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3142 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3143 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3144 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3145 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3146 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3147
3148 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3150 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3151 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3152 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3153 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3154 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3155
3156 ecvrf_ecvrf_verify_cost_base: Some(52),
3158 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3159 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3160
3161 ed25519_ed25519_verify_cost_base: Some(52),
3163 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3164 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3165
3166 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3168 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3169
3170 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3172 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3173 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3174 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3175 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3176
3177 hash_blake2b256_cost_base: Some(52),
3179 hash_blake2b256_data_cost_per_byte: Some(2),
3180 hash_blake2b256_data_cost_per_block: Some(2),
3181
3182 hash_keccak256_cost_base: Some(52),
3184 hash_keccak256_data_cost_per_byte: Some(2),
3185 hash_keccak256_data_cost_per_block: Some(2),
3186
3187 poseidon_bn254_cost_base: None,
3188 poseidon_bn254_cost_per_block: None,
3189
3190 hmac_hmac_sha3_256_cost_base: Some(52),
3192 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3193 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3194
3195 group_ops_bls12381_decode_scalar_cost: None,
3197 group_ops_bls12381_decode_g1_cost: None,
3198 group_ops_bls12381_decode_g2_cost: None,
3199 group_ops_bls12381_decode_gt_cost: None,
3200 group_ops_bls12381_scalar_add_cost: None,
3201 group_ops_bls12381_g1_add_cost: None,
3202 group_ops_bls12381_g2_add_cost: None,
3203 group_ops_bls12381_gt_add_cost: None,
3204 group_ops_bls12381_scalar_sub_cost: None,
3205 group_ops_bls12381_g1_sub_cost: None,
3206 group_ops_bls12381_g2_sub_cost: None,
3207 group_ops_bls12381_gt_sub_cost: None,
3208 group_ops_bls12381_scalar_mul_cost: None,
3209 group_ops_bls12381_g1_mul_cost: None,
3210 group_ops_bls12381_g2_mul_cost: None,
3211 group_ops_bls12381_gt_mul_cost: None,
3212 group_ops_bls12381_scalar_div_cost: None,
3213 group_ops_bls12381_g1_div_cost: None,
3214 group_ops_bls12381_g2_div_cost: None,
3215 group_ops_bls12381_gt_div_cost: None,
3216 group_ops_bls12381_g1_hash_to_base_cost: None,
3217 group_ops_bls12381_g2_hash_to_base_cost: None,
3218 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3219 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3220 group_ops_bls12381_g1_msm_base_cost: None,
3221 group_ops_bls12381_g2_msm_base_cost: None,
3222 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3223 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3224 group_ops_bls12381_msm_max_len: None,
3225 group_ops_bls12381_pairing_cost: None,
3226 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3227 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3228 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3229 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3230 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3231
3232 group_ops_ristretto_decode_scalar_cost: None,
3233 group_ops_ristretto_decode_point_cost: None,
3234 group_ops_ristretto_scalar_add_cost: None,
3235 group_ops_ristretto_point_add_cost: None,
3236 group_ops_ristretto_scalar_sub_cost: None,
3237 group_ops_ristretto_point_sub_cost: None,
3238 group_ops_ristretto_scalar_mul_cost: None,
3239 group_ops_ristretto_point_mul_cost: None,
3240 group_ops_ristretto_scalar_div_cost: None,
3241 group_ops_ristretto_point_div_cost: None,
3242
3243 verify_bulletproofs_ristretto255_base_cost: None,
3244 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3245
3246 check_zklogin_id_cost_base: None,
3248 check_zklogin_issuer_cost_base: None,
3250
3251 vdf_verify_vdf_cost: None,
3252 vdf_hash_to_input_cost: None,
3253
3254 nitro_attestation_parse_base_cost: None,
3256 nitro_attestation_parse_cost_per_byte: None,
3257 nitro_attestation_verify_base_cost: None,
3258 nitro_attestation_verify_cost_per_cert: None,
3259
3260 bcs_per_byte_serialized_cost: None,
3261 bcs_legacy_min_output_size_cost: None,
3262 bcs_failure_cost: None,
3263 hash_sha2_256_base_cost: None,
3264 hash_sha2_256_per_byte_cost: None,
3265 hash_sha2_256_legacy_min_input_len_cost: None,
3266 hash_sha3_256_base_cost: None,
3267 hash_sha3_256_per_byte_cost: None,
3268 hash_sha3_256_legacy_min_input_len_cost: None,
3269 type_name_get_base_cost: None,
3270 type_name_get_per_byte_cost: None,
3271 type_name_id_base_cost: None,
3272 string_check_utf8_base_cost: None,
3273 string_check_utf8_per_byte_cost: None,
3274 string_is_char_boundary_base_cost: None,
3275 string_sub_string_base_cost: None,
3276 string_sub_string_per_byte_cost: None,
3277 string_index_of_base_cost: None,
3278 string_index_of_per_byte_pattern_cost: None,
3279 string_index_of_per_byte_searched_cost: None,
3280 vector_empty_base_cost: None,
3281 vector_length_base_cost: None,
3282 vector_push_back_base_cost: None,
3283 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3284 vector_borrow_base_cost: None,
3285 vector_pop_back_base_cost: None,
3286 vector_destroy_empty_base_cost: None,
3287 vector_swap_base_cost: None,
3288 debug_print_base_cost: None,
3289 debug_print_stack_trace_base_cost: None,
3290
3291 max_size_written_objects: None,
3292 max_size_written_objects_system_tx: None,
3293
3294 max_move_identifier_len: None,
3301 max_move_value_depth: None,
3302 max_move_enum_variants: None,
3303
3304 gas_rounding_step: None,
3305
3306 execution_version: None,
3307
3308 max_event_emit_size_total: None,
3309
3310 consensus_bad_nodes_stake_threshold: None,
3311
3312 max_jwk_votes_per_validator_per_epoch: None,
3313
3314 max_age_of_jwk_in_epochs: None,
3315
3316 random_beacon_reduction_allowed_delta: None,
3317
3318 random_beacon_reduction_lower_bound: None,
3319
3320 random_beacon_dkg_timeout_round: None,
3321
3322 random_beacon_min_round_interval_ms: None,
3323
3324 random_beacon_dkg_version: None,
3325
3326 consensus_max_transaction_size_bytes: None,
3327
3328 consensus_max_transactions_in_block_bytes: None,
3329
3330 consensus_max_num_transactions_in_block: None,
3331
3332 consensus_voting_rounds: None,
3333
3334 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3335
3336 max_deferral_rounds_for_congestion_control: None,
3337
3338 max_txn_cost_overage_per_object_in_commit: None,
3339
3340 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3341
3342 min_checkpoint_interval_ms: None,
3343
3344 checkpoint_summary_version_specific_data: None,
3345
3346 max_soft_bundle_size: None,
3347
3348 bridge_should_try_to_finalize_committee: None,
3349
3350 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3351
3352 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3353
3354 consensus_gc_depth: None,
3355
3356 gas_budget_based_txn_cost_cap_factor: None,
3357
3358 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3359
3360 sip_45_consensus_amplification_threshold: None,
3361
3362 use_object_per_epoch_marker_table_v2: None,
3363
3364 consensus_commit_rate_estimation_window_size: None,
3365
3366 aliased_addresses: vec![],
3367
3368 translation_per_command_base_charge: None,
3369 translation_per_input_base_charge: None,
3370 translation_pure_input_per_byte_charge: None,
3371 translation_per_type_node_charge: None,
3372 translation_per_reference_node_charge: None,
3373 translation_per_linkage_entry_charge: None,
3374
3375 max_updates_per_settlement_txn: None,
3376
3377 gasless_max_computation_units: None,
3378 gasless_allowed_token_types: None,
3379 gasless_max_unused_inputs: None,
3380 gasless_max_pure_input_bytes: None,
3381 gasless_max_tps: None,
3382 include_special_package_amendments: None,
3383 gasless_max_tx_size_bytes: None,
3384 };
3387 for cur in 2..=version.0 {
3388 match cur {
3389 1 => unreachable!(),
3390 2 => {
3391 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3392 }
3393 3 => {
3394 cfg.gas_model_version = Some(2);
3396 cfg.max_tx_gas = Some(50_000_000_000);
3398 cfg.base_tx_cost_fixed = Some(2_000);
3400 cfg.storage_gas_price = Some(76);
3402 cfg.feature_flags.loaded_child_objects_fixed = true;
3403 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3406 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3409 cfg.feature_flags.package_upgrades = true;
3410 }
3411 4 => {
3416 cfg.reward_slashing_rate = Some(10000);
3418 cfg.gas_model_version = Some(3);
3420 }
3421 5 => {
3422 cfg.feature_flags.missing_type_is_compatibility_error = true;
3423 cfg.gas_model_version = Some(4);
3424 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3425 }
3429 6 => {
3430 cfg.gas_model_version = Some(5);
3431 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3432 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3433 }
3434 7 => {
3435 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3436 cfg.feature_flags
3437 .disable_invariant_violation_check_in_swap_loc = true;
3438 cfg.feature_flags.ban_entry_init = true;
3439 cfg.feature_flags.package_digest_hash_module = true;
3440 }
3441 8 => {
3442 cfg.feature_flags
3443 .disallow_change_struct_type_params_on_upgrade = true;
3444 }
3445 9 => {
3446 cfg.max_move_identifier_len = Some(128);
3448 cfg.feature_flags.no_extraneous_module_bytes = true;
3449 cfg.feature_flags
3450 .advance_to_highest_supported_protocol_version = true;
3451 }
3452 10 => {
3453 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3454 cfg.max_meter_ticks_per_module = Some(16_000_000);
3455 }
3456 11 => {
3457 cfg.max_move_value_depth = Some(128);
3458 }
3459 12 => {
3460 cfg.feature_flags.narwhal_versioned_metadata = true;
3461 if chain != Chain::Mainnet {
3462 cfg.feature_flags.commit_root_state_digest = true;
3463 }
3464
3465 if chain != Chain::Mainnet && chain != Chain::Testnet {
3466 cfg.feature_flags.zklogin_auth = true;
3467 }
3468 }
3469 13 => {}
3470 14 => {
3471 cfg.gas_rounding_step = Some(1_000);
3472 cfg.gas_model_version = Some(6);
3473 }
3474 15 => {
3475 cfg.feature_flags.consensus_transaction_ordering =
3476 ConsensusTransactionOrdering::ByGasPrice;
3477 }
3478 16 => {
3479 cfg.feature_flags.simplified_unwrap_then_delete = true;
3480 }
3481 17 => {
3482 cfg.feature_flags.upgraded_multisig_supported = true;
3483 }
3484 18 => {
3485 cfg.execution_version = Some(1);
3486 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3495 cfg.base_tx_cost_fixed = Some(1_000);
3497 }
3498 19 => {
3499 cfg.max_num_event_emit = Some(1024);
3500 cfg.max_event_emit_size_total = Some(
3503 256 * 250 * 1024, );
3505 }
3506 20 => {
3507 cfg.feature_flags.commit_root_state_digest = true;
3508
3509 if chain != Chain::Mainnet {
3510 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3511 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3512 }
3513 }
3514
3515 21 => {
3516 if chain != Chain::Mainnet {
3517 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3518 "Google".to_string(),
3519 "Facebook".to_string(),
3520 "Twitch".to_string(),
3521 ]);
3522 }
3523 }
3524 22 => {
3525 cfg.feature_flags.loaded_child_object_format = true;
3526 }
3527 23 => {
3528 cfg.feature_flags.loaded_child_object_format_type = true;
3529 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3530 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3536 }
3537 24 => {
3538 cfg.feature_flags.simple_conservation_checks = true;
3539 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3540
3541 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3542
3543 if chain != Chain::Mainnet {
3544 cfg.feature_flags.enable_jwk_consensus_updates = true;
3545 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3547 cfg.max_age_of_jwk_in_epochs = Some(1);
3548 }
3549 }
3550 25 => {
3551 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3553 "Google".to_string(),
3554 "Facebook".to_string(),
3555 "Twitch".to_string(),
3556 ]);
3557 cfg.feature_flags.zklogin_auth = true;
3558
3559 cfg.feature_flags.enable_jwk_consensus_updates = true;
3561 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3562 cfg.max_age_of_jwk_in_epochs = Some(1);
3563 }
3564 26 => {
3565 cfg.gas_model_version = Some(7);
3566 if chain != Chain::Mainnet && chain != Chain::Testnet {
3568 cfg.transfer_receive_object_cost_base = Some(52);
3569 cfg.feature_flags.receive_objects = true;
3570 }
3571 }
3572 27 => {
3573 cfg.gas_model_version = Some(8);
3574 }
3575 28 => {
3576 cfg.check_zklogin_id_cost_base = Some(200);
3578 cfg.check_zklogin_issuer_cost_base = Some(200);
3580
3581 if chain != Chain::Mainnet && chain != Chain::Testnet {
3583 cfg.feature_flags.enable_effects_v2 = true;
3584 }
3585 }
3586 29 => {
3587 cfg.feature_flags.verify_legacy_zklogin_address = true;
3588 }
3589 30 => {
3590 if chain != Chain::Mainnet {
3592 cfg.feature_flags.narwhal_certificate_v2 = true;
3593 }
3594
3595 cfg.random_beacon_reduction_allowed_delta = Some(800);
3596 if chain != Chain::Mainnet {
3598 cfg.feature_flags.enable_effects_v2 = true;
3599 }
3600
3601 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3605
3606 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3607 }
3608 31 => {
3609 cfg.execution_version = Some(2);
3610 if chain != Chain::Mainnet && chain != Chain::Testnet {
3612 cfg.feature_flags.shared_object_deletion = true;
3613 }
3614 }
3615 32 => {
3616 if chain != Chain::Mainnet {
3618 cfg.feature_flags.accept_zklogin_in_multisig = true;
3619 }
3620 if chain != Chain::Mainnet {
3622 cfg.transfer_receive_object_cost_base = Some(52);
3623 cfg.feature_flags.receive_objects = true;
3624 }
3625 if chain != Chain::Mainnet && chain != Chain::Testnet {
3627 cfg.feature_flags.random_beacon = true;
3628 cfg.random_beacon_reduction_lower_bound = Some(1600);
3629 cfg.random_beacon_dkg_timeout_round = Some(3000);
3630 cfg.random_beacon_min_round_interval_ms = Some(150);
3631 }
3632 if chain != Chain::Testnet && chain != Chain::Mainnet {
3634 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3635 }
3636
3637 cfg.feature_flags.narwhal_certificate_v2 = true;
3639 }
3640 33 => {
3641 cfg.feature_flags.hardened_otw_check = true;
3642 cfg.feature_flags.allow_receiving_object_id = true;
3643
3644 cfg.transfer_receive_object_cost_base = Some(52);
3646 cfg.feature_flags.receive_objects = true;
3647
3648 if chain != Chain::Mainnet {
3650 cfg.feature_flags.shared_object_deletion = true;
3651 }
3652
3653 cfg.feature_flags.enable_effects_v2 = true;
3654 }
3655 34 => {}
3656 35 => {
3657 if chain != Chain::Mainnet && chain != Chain::Testnet {
3659 cfg.feature_flags.enable_poseidon = true;
3660 cfg.poseidon_bn254_cost_base = Some(260);
3661 cfg.poseidon_bn254_cost_per_block = Some(10);
3662 }
3663
3664 cfg.feature_flags.enable_coin_deny_list = true;
3665 }
3666 36 => {
3667 if chain != Chain::Mainnet && chain != Chain::Testnet {
3669 cfg.feature_flags.enable_group_ops_native_functions = true;
3670 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3671 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3673 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3674 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3675 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3676 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3677 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3678 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3679 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3680 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3681 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3682 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3683 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3684 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3685 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3686 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3687 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3688 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3689 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3690 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3691 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3692 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3693 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3694 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3695 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3696 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3697 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3698 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3699 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3700 cfg.group_ops_bls12381_msm_max_len = Some(32);
3701 cfg.group_ops_bls12381_pairing_cost = Some(52);
3702 }
3703 cfg.feature_flags.shared_object_deletion = true;
3705
3706 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3708 }
3710 37 => {
3711 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3712
3713 if chain != Chain::Mainnet {
3715 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3716 }
3717 }
3718 38 => {
3719 cfg.binary_module_handles = Some(100);
3720 cfg.binary_struct_handles = Some(300);
3721 cfg.binary_function_handles = Some(1500);
3722 cfg.binary_function_instantiations = Some(750);
3723 cfg.binary_signatures = Some(1000);
3724 cfg.binary_constant_pool = Some(4000);
3728 cfg.binary_identifiers = Some(10000);
3729 cfg.binary_address_identifiers = Some(100);
3730 cfg.binary_struct_defs = Some(200);
3731 cfg.binary_struct_def_instantiations = Some(100);
3732 cfg.binary_function_defs = Some(1000);
3733 cfg.binary_field_handles = Some(500);
3734 cfg.binary_field_instantiations = Some(250);
3735 cfg.binary_friend_decls = Some(100);
3736 cfg.max_package_dependencies = Some(32);
3738 cfg.max_modules_in_publish = Some(64);
3739 cfg.execution_version = Some(3);
3741 }
3742 39 => {
3743 }
3745 40 => {}
3746 41 => {
3747 cfg.feature_flags.enable_group_ops_native_functions = true;
3749 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3751 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3752 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3753 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3754 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3755 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3756 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3757 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3758 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3759 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3760 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3761 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3762 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3763 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3764 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3765 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3766 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3767 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3768 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3769 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3770 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3771 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3772 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3773 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3774 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3775 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3776 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3777 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3778 cfg.group_ops_bls12381_msm_max_len = Some(32);
3779 cfg.group_ops_bls12381_pairing_cost = Some(52);
3780 }
3781 42 => {}
3782 43 => {
3783 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3784 cfg.max_meter_ticks_per_package = Some(16_000_000);
3785 }
3786 44 => {
3787 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3789 if chain != Chain::Mainnet {
3791 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3792 }
3793 }
3794 45 => {
3795 if chain != Chain::Testnet && chain != Chain::Mainnet {
3797 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3798 }
3799
3800 if chain != Chain::Mainnet {
3801 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3803 }
3804 cfg.min_move_binary_format_version = Some(6);
3805 cfg.feature_flags.accept_zklogin_in_multisig = true;
3806
3807 if chain != Chain::Mainnet && chain != Chain::Testnet {
3811 cfg.feature_flags.bridge = true;
3812 }
3813 }
3814 46 => {
3815 if chain != Chain::Mainnet {
3817 cfg.feature_flags.bridge = true;
3818 }
3819
3820 cfg.feature_flags.reshare_at_same_initial_version = true;
3822 }
3823 47 => {}
3824 48 => {
3825 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3827
3828 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3830
3831 if chain != Chain::Mainnet {
3833 cfg.feature_flags.random_beacon = true;
3834 cfg.random_beacon_reduction_lower_bound = Some(1600);
3835 cfg.random_beacon_dkg_timeout_round = Some(3000);
3836 cfg.random_beacon_min_round_interval_ms = Some(200);
3837 }
3838
3839 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3841 }
3842 49 => {
3843 if chain != Chain::Testnet && chain != Chain::Mainnet {
3844 cfg.move_binary_format_version = Some(7);
3845 }
3846
3847 if chain != Chain::Mainnet && chain != Chain::Testnet {
3849 cfg.feature_flags.enable_vdf = true;
3850 cfg.vdf_verify_vdf_cost = Some(1500);
3853 cfg.vdf_hash_to_input_cost = Some(100);
3854 }
3855
3856 if chain != Chain::Testnet && chain != Chain::Mainnet {
3858 cfg.feature_flags
3859 .record_consensus_determined_version_assignments_in_prologue = true;
3860 }
3861
3862 if chain != Chain::Mainnet {
3864 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3865 }
3866
3867 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3869 }
3870 50 => {
3871 if chain != Chain::Mainnet {
3873 cfg.checkpoint_summary_version_specific_data = Some(1);
3874 cfg.min_checkpoint_interval_ms = Some(200);
3875 }
3876
3877 if chain != Chain::Testnet && chain != Chain::Mainnet {
3879 cfg.feature_flags
3880 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3881 }
3882
3883 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3884
3885 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3887 }
3888 51 => {
3889 cfg.random_beacon_dkg_version = Some(1);
3890
3891 if chain != Chain::Testnet && chain != Chain::Mainnet {
3892 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3893 }
3894 }
3895 52 => {
3896 if chain != Chain::Mainnet {
3897 cfg.feature_flags.soft_bundle = true;
3898 cfg.max_soft_bundle_size = Some(5);
3899 }
3900
3901 cfg.config_read_setting_impl_cost_base = Some(100);
3902 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3903
3904 if chain != Chain::Testnet && chain != Chain::Mainnet {
3906 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3907 cfg.feature_flags.per_object_congestion_control_mode =
3908 PerObjectCongestionControlMode::TotalTxCount;
3909 }
3910
3911 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3913
3914 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3916
3917 cfg.checkpoint_summary_version_specific_data = Some(1);
3919 cfg.min_checkpoint_interval_ms = Some(200);
3920
3921 if chain != Chain::Mainnet {
3923 cfg.feature_flags
3924 .record_consensus_determined_version_assignments_in_prologue = true;
3925 cfg.feature_flags
3926 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3927 }
3928 if chain != Chain::Mainnet {
3930 cfg.move_binary_format_version = Some(7);
3931 }
3932
3933 if chain != Chain::Testnet && chain != Chain::Mainnet {
3934 cfg.feature_flags.passkey_auth = true;
3935 }
3936 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3937 }
3938 53 => {
3939 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3941
3942 cfg.feature_flags
3944 .record_consensus_determined_version_assignments_in_prologue = true;
3945 cfg.feature_flags
3946 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3947
3948 if chain == Chain::Unknown {
3949 cfg.feature_flags.authority_capabilities_v2 = true;
3950 }
3951
3952 if chain != Chain::Mainnet {
3954 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3955 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3956 cfg.feature_flags.per_object_congestion_control_mode =
3957 PerObjectCongestionControlMode::TotalTxCount;
3958 }
3959
3960 cfg.bcs_per_byte_serialized_cost = Some(2);
3962 cfg.bcs_legacy_min_output_size_cost = Some(1);
3963 cfg.bcs_failure_cost = Some(52);
3964 cfg.debug_print_base_cost = Some(52);
3965 cfg.debug_print_stack_trace_base_cost = Some(52);
3966 cfg.hash_sha2_256_base_cost = Some(52);
3967 cfg.hash_sha2_256_per_byte_cost = Some(2);
3968 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3969 cfg.hash_sha3_256_base_cost = Some(52);
3970 cfg.hash_sha3_256_per_byte_cost = Some(2);
3971 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3972 cfg.type_name_get_base_cost = Some(52);
3973 cfg.type_name_get_per_byte_cost = Some(2);
3974 cfg.string_check_utf8_base_cost = Some(52);
3975 cfg.string_check_utf8_per_byte_cost = Some(2);
3976 cfg.string_is_char_boundary_base_cost = Some(52);
3977 cfg.string_sub_string_base_cost = Some(52);
3978 cfg.string_sub_string_per_byte_cost = Some(2);
3979 cfg.string_index_of_base_cost = Some(52);
3980 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3981 cfg.string_index_of_per_byte_searched_cost = Some(2);
3982 cfg.vector_empty_base_cost = Some(52);
3983 cfg.vector_length_base_cost = Some(52);
3984 cfg.vector_push_back_base_cost = Some(52);
3985 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3986 cfg.vector_borrow_base_cost = Some(52);
3987 cfg.vector_pop_back_base_cost = Some(52);
3988 cfg.vector_destroy_empty_base_cost = Some(52);
3989 cfg.vector_swap_base_cost = Some(52);
3990 }
3991 54 => {
3992 cfg.feature_flags.random_beacon = true;
3994 cfg.random_beacon_reduction_lower_bound = Some(1000);
3995 cfg.random_beacon_dkg_timeout_round = Some(3000);
3996 cfg.random_beacon_min_round_interval_ms = Some(500);
3997
3998 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
4000 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
4001 cfg.feature_flags.per_object_congestion_control_mode =
4002 PerObjectCongestionControlMode::TotalTxCount;
4003
4004 cfg.feature_flags.soft_bundle = true;
4006 cfg.max_soft_bundle_size = Some(5);
4007 }
4008 55 => {
4009 cfg.move_binary_format_version = Some(7);
4011
4012 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
4014 cfg.consensus_max_num_transactions_in_block = Some(512);
4017
4018 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
4019 }
4020 56 => {
4021 if chain == Chain::Mainnet {
4022 cfg.feature_flags.bridge = true;
4023 }
4024 }
4025 57 => {
4026 cfg.random_beacon_reduction_lower_bound = Some(800);
4028 }
4029 58 => {
4030 if chain == Chain::Mainnet {
4031 cfg.bridge_should_try_to_finalize_committee = Some(true);
4032 }
4033
4034 if chain != Chain::Mainnet && chain != Chain::Testnet {
4035 cfg.feature_flags
4037 .consensus_distributed_vote_scoring_strategy = true;
4038 }
4039 }
4040 59 => {
4041 cfg.feature_flags.consensus_round_prober = true;
4043 }
4044 60 => {
4045 cfg.max_type_to_layout_nodes = Some(512);
4046 cfg.feature_flags.validate_identifier_inputs = true;
4047 }
4048 61 => {
4049 if chain != Chain::Mainnet {
4050 cfg.feature_flags
4052 .consensus_distributed_vote_scoring_strategy = true;
4053 }
4054 cfg.random_beacon_reduction_lower_bound = Some(700);
4056
4057 if chain != Chain::Mainnet && chain != Chain::Testnet {
4058 cfg.feature_flags.mysticeti_fastpath = true;
4060 }
4061 }
4062 62 => {
4063 cfg.feature_flags.relocate_event_module = true;
4064 }
4065 63 => {
4066 cfg.feature_flags.per_object_congestion_control_mode =
4067 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4068 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4069 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4070 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4071 }
4072 64 => {
4073 cfg.feature_flags.per_object_congestion_control_mode =
4074 PerObjectCongestionControlMode::TotalTxCount;
4075 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4076 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4077 }
4078 65 => {
4079 cfg.feature_flags
4081 .consensus_distributed_vote_scoring_strategy = true;
4082 }
4083 66 => {
4084 if chain == Chain::Mainnet {
4085 cfg.feature_flags
4087 .consensus_distributed_vote_scoring_strategy = false;
4088 }
4089 }
4090 67 => {
4091 cfg.feature_flags
4093 .consensus_distributed_vote_scoring_strategy = true;
4094 }
4095 68 => {
4096 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4097 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4098 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4099 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4100 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4101
4102 if chain != Chain::Mainnet && chain != Chain::Testnet {
4103 cfg.feature_flags.uncompressed_g1_group_elements = true;
4104 }
4105
4106 cfg.feature_flags.per_object_congestion_control_mode =
4107 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4108 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4109 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4110 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4111 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4113 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4114
4115 cfg.random_beacon_reduction_lower_bound = Some(500);
4117
4118 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4119 }
4120 69 => {
4121 cfg.consensus_voting_rounds = Some(40);
4123
4124 if chain != Chain::Mainnet && chain != Chain::Testnet {
4125 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4127 }
4128
4129 if chain != Chain::Mainnet {
4130 cfg.feature_flags.uncompressed_g1_group_elements = true;
4131 }
4132 }
4133 70 => {
4134 if chain != Chain::Mainnet {
4135 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4137 cfg.feature_flags
4139 .consensus_round_prober_probe_accepted_rounds = true;
4140 }
4141
4142 cfg.poseidon_bn254_cost_per_block = Some(388);
4143
4144 cfg.gas_model_version = Some(9);
4145 cfg.feature_flags.native_charging_v2 = true;
4146 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4147 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4148 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4149 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4150 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4151 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4152 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4153 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4154
4155 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4157 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4158 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4159 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4160
4161 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4162 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4163 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4164 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4165 Some(8213);
4166 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4167 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4168 Some(9484);
4169
4170 cfg.hash_keccak256_cost_base = Some(10);
4171 cfg.hash_blake2b256_cost_base = Some(10);
4172
4173 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4175 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4176 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4177 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4178
4179 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4180 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4181 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4182 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4183
4184 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4185 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4186 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4187 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4188
4189 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4190 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4191 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4192 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4193
4194 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4195 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4196 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4197 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4198
4199 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4200 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4201
4202 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4203 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4204 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4205 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4206
4207 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4208 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4209 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4210 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4211
4212 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4213 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4214
4215 cfg.validator_validate_metadata_cost_base = Some(20000);
4216 }
4217 71 => {
4218 cfg.sip_45_consensus_amplification_threshold = Some(5);
4219
4220 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4222 }
4223 72 => {
4224 cfg.feature_flags.convert_type_argument_error = true;
4225
4226 cfg.max_tx_gas = Some(50_000_000_000_000);
4229 cfg.max_gas_price = Some(50_000_000_000);
4231
4232 cfg.feature_flags.variant_nodes = true;
4233 }
4234 73 => {
4235 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4237
4238 if chain != Chain::Mainnet && chain != Chain::Testnet {
4239 cfg.consensus_gc_depth = Some(60);
4242 }
4243
4244 if chain != Chain::Mainnet {
4245 cfg.feature_flags.consensus_zstd_compression = true;
4247 }
4248
4249 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4251 cfg.feature_flags
4253 .consensus_round_prober_probe_accepted_rounds = true;
4254
4255 cfg.feature_flags.per_object_congestion_control_mode =
4257 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4258 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4259 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4260 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4261 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4263 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4264 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4265 }
4266 74 => {
4267 if chain != Chain::Mainnet && chain != Chain::Testnet {
4269 cfg.feature_flags.enable_nitro_attestation = true;
4270 }
4271 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4272 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4273 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4274 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4275
4276 cfg.feature_flags.consensus_zstd_compression = true;
4278
4279 if chain != Chain::Mainnet && chain != Chain::Testnet {
4280 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4281 }
4282 }
4283 75 => {
4284 if chain != Chain::Mainnet {
4285 cfg.feature_flags.passkey_auth = true;
4286 }
4287 }
4288 76 => {
4289 if chain != Chain::Mainnet && chain != Chain::Testnet {
4290 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4291 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4292 }
4293 cfg.feature_flags.minimize_child_object_mutations = true;
4294
4295 if chain != Chain::Mainnet {
4296 cfg.feature_flags.accept_passkey_in_multisig = true;
4297 }
4298 }
4299 77 => {
4300 cfg.feature_flags.uncompressed_g1_group_elements = true;
4301
4302 if chain != Chain::Mainnet {
4303 cfg.consensus_gc_depth = Some(60);
4304 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4305 }
4306 }
4307 78 => {
4308 cfg.feature_flags.move_native_context = true;
4309 cfg.tx_context_fresh_id_cost_base = Some(52);
4310 cfg.tx_context_sender_cost_base = Some(30);
4311 cfg.tx_context_epoch_cost_base = Some(30);
4312 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4313 cfg.tx_context_sponsor_cost_base = Some(30);
4314 cfg.tx_context_gas_price_cost_base = Some(30);
4315 cfg.tx_context_gas_budget_cost_base = Some(30);
4316 cfg.tx_context_ids_created_cost_base = Some(30);
4317 cfg.tx_context_replace_cost_base = Some(30);
4318 cfg.gas_model_version = Some(10);
4319
4320 if chain != Chain::Mainnet {
4321 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4322 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4323
4324 cfg.feature_flags.per_object_congestion_control_mode =
4326 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4327 ExecutionTimeEstimateParams {
4328 target_utilization: 30,
4329 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4331 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4333 stored_observations_limit: u64::MAX,
4334 stake_weighted_median_threshold: 0,
4335 default_none_duration_for_new_keys: false,
4336 observations_chunk_size: None,
4337 },
4338 );
4339 }
4340 }
4341 79 => {
4342 if chain != Chain::Mainnet {
4343 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4344
4345 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4348
4349 cfg.feature_flags.consensus_batched_block_sync = true;
4350
4351 cfg.feature_flags.enable_nitro_attestation = true
4353 }
4354 cfg.feature_flags.normalize_ptb_arguments = true;
4355
4356 cfg.consensus_gc_depth = Some(60);
4357 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4358 }
4359 80 => {
4360 cfg.max_ptb_value_size = Some(1024 * 1024);
4361 }
4362 81 => {
4363 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4364 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4365 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4366 }
4367 82 => {
4368 cfg.feature_flags.max_ptb_value_size_v2 = true;
4369 }
4370 83 => {
4371 if chain == Chain::Mainnet {
4372 let aliased: [u8; 32] = Hex::decode(
4374 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4375 )
4376 .unwrap()
4377 .try_into()
4378 .unwrap();
4379
4380 cfg.aliased_addresses.push(AliasedAddress {
4382 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4383 aliased,
4384 allowed_tx_digests: vec![
4385 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4386 ],
4387 });
4388
4389 cfg.aliased_addresses.push(AliasedAddress {
4390 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4391 aliased,
4392 allowed_tx_digests: vec![
4393 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4394 ],
4395 });
4396 }
4397
4398 if chain != Chain::Mainnet {
4401 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4402 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4403
4404 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4406 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4407 cfg.feature_flags.per_object_congestion_control_mode =
4408 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4409 ExecutionTimeEstimateParams {
4410 target_utilization: 30,
4411 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4413 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4415 stored_observations_limit: u64::MAX,
4416 stake_weighted_median_threshold: 0,
4417 default_none_duration_for_new_keys: false,
4418 observations_chunk_size: None,
4419 },
4420 );
4421
4422 cfg.feature_flags.consensus_batched_block_sync = true;
4424
4425 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4428 cfg.feature_flags.enable_nitro_attestation = true;
4429 }
4430 }
4431 84 => {
4432 if chain == Chain::Mainnet {
4433 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4434 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4435
4436 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4438 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4439 cfg.feature_flags.per_object_congestion_control_mode =
4440 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4441 ExecutionTimeEstimateParams {
4442 target_utilization: 30,
4443 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4445 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4447 stored_observations_limit: u64::MAX,
4448 stake_weighted_median_threshold: 0,
4449 default_none_duration_for_new_keys: false,
4450 observations_chunk_size: None,
4451 },
4452 );
4453
4454 cfg.feature_flags.consensus_batched_block_sync = true;
4456
4457 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4460 cfg.feature_flags.enable_nitro_attestation = true;
4461 }
4462
4463 cfg.feature_flags.per_object_congestion_control_mode =
4465 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4466 ExecutionTimeEstimateParams {
4467 target_utilization: 30,
4468 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4470 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4472 stored_observations_limit: 20,
4473 stake_weighted_median_threshold: 0,
4474 default_none_duration_for_new_keys: false,
4475 observations_chunk_size: None,
4476 },
4477 );
4478 cfg.feature_flags.allow_unbounded_system_objects = true;
4479 }
4480 85 => {
4481 if chain != Chain::Mainnet && chain != Chain::Testnet {
4482 cfg.feature_flags.enable_party_transfer = true;
4483 }
4484
4485 cfg.feature_flags
4486 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4487 cfg.feature_flags.disallow_self_identifier = true;
4488 cfg.feature_flags.per_object_congestion_control_mode =
4489 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4490 ExecutionTimeEstimateParams {
4491 target_utilization: 50,
4492 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4494 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4496 stored_observations_limit: 20,
4497 stake_weighted_median_threshold: 0,
4498 default_none_duration_for_new_keys: false,
4499 observations_chunk_size: None,
4500 },
4501 );
4502 }
4503 86 => {
4504 cfg.feature_flags.type_tags_in_object_runtime = true;
4505 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4506
4507 cfg.feature_flags.per_object_congestion_control_mode =
4509 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4510 ExecutionTimeEstimateParams {
4511 target_utilization: 50,
4512 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4514 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4516 stored_observations_limit: 20,
4517 stake_weighted_median_threshold: 3334,
4518 default_none_duration_for_new_keys: false,
4519 observations_chunk_size: None,
4520 },
4521 );
4522 if chain != Chain::Mainnet {
4524 cfg.feature_flags.enable_party_transfer = true;
4525 }
4526 }
4527 87 => {
4528 if chain == Chain::Mainnet {
4529 cfg.feature_flags.record_time_estimate_processed = true;
4530 }
4531 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4532 }
4533 88 => {
4534 cfg.feature_flags.record_time_estimate_processed = true;
4535 cfg.tx_context_rgp_cost_base = Some(30);
4536 cfg.feature_flags
4537 .ignore_execution_time_observations_after_certs_closed = true;
4538
4539 cfg.feature_flags.per_object_congestion_control_mode =
4542 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4543 ExecutionTimeEstimateParams {
4544 target_utilization: 50,
4545 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4547 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4549 stored_observations_limit: 20,
4550 stake_weighted_median_threshold: 3334,
4551 default_none_duration_for_new_keys: true,
4552 observations_chunk_size: None,
4553 },
4554 );
4555 }
4556 89 => {
4557 cfg.feature_flags.dependency_linkage_error = true;
4558 cfg.feature_flags.additional_multisig_checks = true;
4559 }
4560 90 => {
4561 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4563 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4564 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4565 cfg.feature_flags.accept_passkey_in_multisig = true;
4566 cfg.feature_flags.passkey_auth = true;
4567 cfg.feature_flags.check_for_init_during_upgrade = true;
4568
4569 if chain != Chain::Mainnet {
4571 cfg.feature_flags.mysticeti_fastpath = true;
4572 }
4573 }
4574 91 => {
4575 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4576 }
4577 92 => {
4578 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4579 }
4580 93 => {
4581 cfg.feature_flags
4582 .consensus_checkpoint_signature_key_includes_digest = true;
4583 }
4584 94 => {
4585 cfg.feature_flags.per_object_congestion_control_mode =
4587 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4588 ExecutionTimeEstimateParams {
4589 target_utilization: 50,
4590 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4592 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4594 stored_observations_limit: 18,
4595 stake_weighted_median_threshold: 3334,
4596 default_none_duration_for_new_keys: true,
4597 observations_chunk_size: None,
4598 },
4599 );
4600
4601 cfg.feature_flags.enable_party_transfer = true;
4603 }
4604 95 => {
4605 cfg.type_name_id_base_cost = Some(52);
4606
4607 cfg.max_transactions_per_checkpoint = Some(20_000);
4609 }
4610 96 => {
4611 if chain != Chain::Mainnet && chain != Chain::Testnet {
4613 cfg.feature_flags
4614 .include_checkpoint_artifacts_digest_in_summary = true;
4615 }
4616 cfg.feature_flags.correct_gas_payment_limit_check = true;
4617 cfg.feature_flags.authority_capabilities_v2 = true;
4618 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4619 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4620 cfg.feature_flags.enable_coin_registry = true;
4621
4622 cfg.feature_flags.mysticeti_fastpath = true;
4624 }
4625 97 => {
4626 cfg.feature_flags.additional_borrow_checks = true;
4627 }
4628 98 => {
4629 cfg.event_emit_auth_stream_cost = Some(52);
4630 cfg.feature_flags.better_loader_errors = true;
4631 cfg.feature_flags.generate_df_type_layouts = true;
4632 }
4633 99 => {
4634 cfg.feature_flags.use_new_commit_handler = true;
4635 }
4636 100 => {
4637 cfg.feature_flags.private_generics_verifier_v2 = true;
4638 }
4639 101 => {
4640 cfg.feature_flags.create_root_accumulator_object = true;
4641 cfg.max_updates_per_settlement_txn = Some(100);
4642 if chain != Chain::Mainnet {
4643 cfg.feature_flags.enable_poseidon = true;
4644 }
4645 }
4646 102 => {
4647 cfg.feature_flags.per_object_congestion_control_mode =
4651 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4652 ExecutionTimeEstimateParams {
4653 target_utilization: 50,
4654 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4656 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4658 stored_observations_limit: 180,
4659 stake_weighted_median_threshold: 3334,
4660 default_none_duration_for_new_keys: true,
4661 observations_chunk_size: Some(18),
4662 },
4663 );
4664 cfg.feature_flags.deprecate_global_storage_ops = true;
4665 }
4666 103 => {}
4667 104 => {
4668 cfg.translation_per_command_base_charge = Some(1);
4669 cfg.translation_per_input_base_charge = Some(1);
4670 cfg.translation_pure_input_per_byte_charge = Some(1);
4671 cfg.translation_per_type_node_charge = Some(1);
4672 cfg.translation_per_reference_node_charge = Some(1);
4673 cfg.translation_per_linkage_entry_charge = Some(10);
4674 cfg.gas_model_version = Some(11);
4675 cfg.feature_flags.abstract_size_in_object_runtime = true;
4676 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4677 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4678 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4679 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4680 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4681 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4682 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4683 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4684 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4685 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4686 cfg.feature_flags.enable_ptb_execution_v2 = true;
4687
4688 cfg.poseidon_bn254_cost_base = Some(260);
4689
4690 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4691
4692 if chain != Chain::Mainnet {
4693 cfg.feature_flags
4694 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4695 }
4696
4697 cfg.feature_flags
4698 .include_cancelled_randomness_txns_in_prologue = true;
4699 }
4700 105 => {
4701 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4702 cfg.feature_flags.disable_preconsensus_locking = true;
4703
4704 if chain != Chain::Mainnet {
4705 cfg.feature_flags
4706 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4707 }
4708 }
4709 106 => {
4710 cfg.accumulator_object_storage_cost = Some(7600);
4712
4713 if chain != Chain::Mainnet && chain != Chain::Testnet {
4714 cfg.feature_flags.enable_accumulators = true;
4715 cfg.feature_flags.enable_address_balance_gas_payments = true;
4716 cfg.feature_flags.enable_authenticated_event_streams = true;
4717 cfg.feature_flags.enable_object_funds_withdraw = true;
4718 }
4719 }
4720 107 => {
4721 cfg.feature_flags
4722 .consensus_skip_gced_blocks_in_direct_finalization = true;
4723
4724 if in_integration_test() {
4726 cfg.consensus_gc_depth = Some(6);
4727 cfg.consensus_max_num_transactions_in_block = Some(8);
4728 }
4729 }
4730 108 => {
4731 cfg.feature_flags.gas_rounding_halve_digits = true;
4732 cfg.feature_flags.flexible_tx_context_positions = true;
4733 cfg.feature_flags.disable_entry_point_signature_check = true;
4734
4735 if chain != Chain::Mainnet {
4736 cfg.feature_flags.address_aliases = true;
4737
4738 cfg.feature_flags.enable_accumulators = true;
4739 cfg.feature_flags.enable_address_balance_gas_payments = true;
4740 }
4741
4742 cfg.feature_flags.enable_poseidon = true;
4743 }
4744 109 => {
4745 cfg.binary_variant_handles = Some(1024);
4746 cfg.binary_variant_instantiation_handles = Some(1024);
4747 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4748 }
4749 110 => {
4750 cfg.feature_flags
4751 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4752 cfg.feature_flags
4753 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4754 if chain != Chain::Mainnet && chain != Chain::Testnet {
4755 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4756 }
4757 cfg.feature_flags.validate_zklogin_public_identifier = true;
4758 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4759 cfg.feature_flags
4760 .consensus_always_accept_system_transactions = true;
4761 if chain != Chain::Mainnet {
4762 cfg.feature_flags.enable_object_funds_withdraw = true;
4763 }
4764 }
4765 111 => {
4766 cfg.feature_flags.validator_metadata_verify_v2 = true;
4767 }
4768 112 => {
4769 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4770 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4771 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4772 cfg.group_ops_ristretto_point_add_cost = Some(500);
4773 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4774 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4775 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4776 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4777 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4778 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4779
4780 if chain != Chain::Mainnet && chain != Chain::Testnet {
4781 cfg.feature_flags.enable_ristretto255_group_ops = true;
4782 }
4783 }
4784 113 => {
4785 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4786 if chain != Chain::Mainnet && chain != Chain::Testnet {
4787 cfg.feature_flags.defer_unpaid_amplification = true;
4788 }
4789 }
4790 114 => {
4791 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4792 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4793 if chain != Chain::Mainnet {
4794 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4795 cfg.feature_flags.enable_authenticated_event_streams = true;
4796 cfg.feature_flags
4797 .include_checkpoint_artifacts_digest_in_summary = true;
4798 }
4799 }
4800 115 => {
4801 cfg.feature_flags.normalize_depth_formula = true;
4802 }
4803 116 => {
4804 cfg.feature_flags.gasless_transaction_drop_safety = true;
4805 cfg.feature_flags.address_aliases = true;
4806 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4807 cfg.feature_flags.defer_unpaid_amplification = false;
4809 cfg.feature_flags.enable_display_registry = true;
4810 }
4811 117 => {}
4812 118 => {
4813 cfg.feature_flags.use_coin_party_owner = true;
4814 }
4815 119 => {
4816 cfg.execution_version = Some(4);
4818 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4819 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4820 if chain != Chain::Mainnet {
4821 cfg.feature_flags.enable_gasless = true;
4822 cfg.gasless_max_computation_units = Some(50_000);
4823 cfg.gasless_allowed_token_types = Some(vec![]);
4824 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4825 cfg.feature_flags
4826 .convert_withdrawal_compatibility_ptb_arguments = true;
4827 }
4828 cfg.gasless_max_unused_inputs = Some(1);
4829 cfg.gasless_max_pure_input_bytes = Some(32);
4830 if chain == Chain::Testnet {
4831 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4832 }
4833 cfg.transfer_receive_object_cost_per_byte = Some(1);
4834 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4835 }
4836 120 => {
4837 cfg.feature_flags.disallow_jump_orphans = true;
4838 }
4839 121 => {
4840 if chain != Chain::Mainnet {
4842 cfg.feature_flags.defer_unpaid_amplification = true;
4843 cfg.gasless_max_tps = Some(50);
4844 }
4845 cfg.feature_flags
4846 .early_return_receive_object_mismatched_type = true;
4847 }
4848 122 => {
4849 cfg.feature_flags.defer_unpaid_amplification = true;
4851 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4853 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4854 if chain != Chain::Mainnet && chain != Chain::Testnet {
4855 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4856 }
4857 cfg.feature_flags.gasless_verify_remaining_balance = true;
4858 cfg.include_special_package_amendments = match chain {
4859 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4860 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4861 Chain::Unknown => None,
4862 };
4863 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4864 cfg.gasless_max_tps = Some(300);
4865 cfg.gasless_max_computation_units = Some(5_000);
4866 }
4867 _ => panic!("unsupported version {:?}", version),
4878 }
4879 }
4880
4881 cfg
4882 }
4883
4884 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4885 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4886 || !self.feature_flags.split_checkpoints_in_consensus_handler
4887 {
4888 return;
4889 }
4890
4891 if !mysten_common::in_test_configuration() {
4892 return;
4893 }
4894
4895 use rand::{Rng, SeedableRng, rngs::StdRng};
4896 let mut rng = StdRng::from_seed(*seed);
4897 let max_txns = rng.gen_range(10..=100u64);
4898 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4899 self.max_transactions_per_checkpoint = Some(max_txns);
4900 }
4901
4902 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4908 let (
4909 max_back_edges_per_function,
4910 max_back_edges_per_module,
4911 sanity_check_with_regex_reference_safety,
4912 ) = if let Some((
4913 max_back_edges_per_function,
4914 max_back_edges_per_module,
4915 sanity_check_with_regex_reference_safety,
4916 )) = signing_limits
4917 {
4918 (
4919 Some(max_back_edges_per_function),
4920 Some(max_back_edges_per_module),
4921 Some(sanity_check_with_regex_reference_safety),
4922 )
4923 } else {
4924 (None, None, None)
4925 };
4926
4927 let additional_borrow_checks = if signing_limits.is_some() {
4928 true
4930 } else {
4931 self.additional_borrow_checks()
4932 };
4933 let deprecate_global_storage_ops = if signing_limits.is_some() {
4934 true
4936 } else {
4937 self.deprecate_global_storage_ops()
4938 };
4939
4940 VerifierConfig {
4941 max_loop_depth: Some(self.max_loop_depth() as usize),
4942 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4943 max_function_parameters: Some(self.max_function_parameters() as usize),
4944 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4945 max_value_stack_size: self.max_value_stack_size() as usize,
4946 max_type_nodes: Some(self.max_type_nodes() as usize),
4947 max_push_size: Some(self.max_push_size() as usize),
4948 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4949 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4950 max_function_definitions: Some(self.max_function_definitions() as usize),
4951 max_data_definitions: Some(self.max_struct_definitions() as usize),
4952 max_constant_vector_len: Some(self.max_move_vector_len()),
4953 max_back_edges_per_function,
4954 max_back_edges_per_module,
4955 max_basic_blocks_in_script: None,
4956 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4958 allow_receiving_object_id: self.allow_receiving_object_id(),
4959 reject_mutable_random_on_entry_functions: self
4960 .reject_mutable_random_on_entry_functions(),
4961 bytecode_version: self.move_binary_format_version(),
4962 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4963 additional_borrow_checks,
4964 better_loader_errors: self.better_loader_errors(),
4965 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4966 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4967 .map(|limit| limit as u128),
4968 deprecate_global_storage_ops,
4969 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4970 switch_to_regex_reference_safety: false,
4971 disallow_jump_orphans: self.disallow_jump_orphans(),
4972 }
4973 }
4974
4975 pub fn binary_config(
4976 &self,
4977 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4978 ) -> BinaryConfig {
4979 let deprecate_global_storage_ops =
4980 override_deprecate_global_storage_ops_during_deserialization
4981 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4982 BinaryConfig::new(
4983 self.move_binary_format_version(),
4984 self.min_move_binary_format_version_as_option()
4985 .unwrap_or(VERSION_1),
4986 self.no_extraneous_module_bytes(),
4987 deprecate_global_storage_ops,
4988 TableConfig {
4989 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4990 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4991 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4992 function_instantiations: self
4993 .binary_function_instantiations_as_option()
4994 .unwrap_or(u16::MAX),
4995 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4996 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4997 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4998 address_identifiers: self
4999 .binary_address_identifiers_as_option()
5000 .unwrap_or(u16::MAX),
5001 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5002 struct_def_instantiations: self
5003 .binary_struct_def_instantiations_as_option()
5004 .unwrap_or(u16::MAX),
5005 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5006 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5007 field_instantiations: self
5008 .binary_field_instantiations_as_option()
5009 .unwrap_or(u16::MAX),
5010 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5011 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5012 enum_def_instantiations: self
5013 .binary_enum_def_instantiations_as_option()
5014 .unwrap_or(u16::MAX),
5015 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5016 variant_instantiation_handles: self
5017 .binary_variant_instantiation_handles_as_option()
5018 .unwrap_or(u16::MAX),
5019 },
5020 )
5021 }
5022
5023 #[cfg(not(msim))]
5027 pub fn apply_overrides_for_testing(
5028 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5029 ) -> OverrideGuard {
5030 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5031 assert!(cur.is_none(), "config override already present");
5032 *cur = Some(Box::new(override_fn));
5033 OverrideGuard
5034 }
5035
5036 #[cfg(msim)]
5040 pub fn apply_overrides_for_testing(
5041 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
5042 ) -> OverrideGuard {
5043 CONFIG_OVERRIDE.with(|ovr| {
5044 let mut cur = ovr.borrow_mut();
5045 assert!(cur.is_none(), "config override already present");
5046 *cur = Some(Box::new(override_fn));
5047 OverrideGuard
5048 })
5049 }
5050
5051 #[cfg(not(msim))]
5052 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5053 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5054 warn!(
5055 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5056 );
5057 ret = override_fn(version, ret);
5058 }
5059 ret
5060 }
5061
5062 #[cfg(msim)]
5063 fn apply_config_override(version: ProtocolVersion, ret: Self) -> Self {
5064 CONFIG_OVERRIDE.with(|ovr| {
5065 if let Some(override_fn) = &*ovr.borrow() {
5066 warn!(
5067 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5068 );
5069 override_fn(version, ret)
5070 } else {
5071 ret
5072 }
5073 })
5074 }
5075}
5076
5077impl ProtocolConfig {
5081 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
5082 self.feature_flags
5083 .advance_to_highest_supported_protocol_version = val
5084 }
5085 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
5086 self.feature_flags.commit_root_state_digest = val
5087 }
5088 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
5089 self.feature_flags.zklogin_auth = val
5090 }
5091 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
5092 self.feature_flags.enable_jwk_consensus_updates = val
5093 }
5094 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
5095 self.feature_flags.random_beacon = val
5096 }
5097
5098 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
5099 self.feature_flags.upgraded_multisig_supported = val
5100 }
5101 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
5102 self.feature_flags.accept_zklogin_in_multisig = val
5103 }
5104
5105 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
5106 self.feature_flags.shared_object_deletion = val;
5107 }
5108
5109 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
5110 self.feature_flags.narwhal_new_leader_election_schedule = val;
5111 }
5112
5113 pub fn set_receive_object_for_testing(&mut self, val: bool) {
5114 self.feature_flags.receive_objects = val
5115 }
5116 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
5117 self.feature_flags.narwhal_certificate_v2 = val
5118 }
5119 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
5120 self.feature_flags.verify_legacy_zklogin_address = val
5121 }
5122
5123 pub fn set_per_object_congestion_control_mode_for_testing(
5124 &mut self,
5125 val: PerObjectCongestionControlMode,
5126 ) {
5127 self.feature_flags.per_object_congestion_control_mode = val;
5128 }
5129
5130 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5131 self.feature_flags.consensus_choice = val;
5132 }
5133
5134 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5135 self.feature_flags.consensus_network = val;
5136 }
5137
5138 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5139 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5140 }
5141
5142 pub fn set_disable_bridge_for_testing(&mut self) {
5143 self.feature_flags.bridge = false
5144 }
5145
5146 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5147 self.feature_flags.mysticeti_num_leaders_per_round = val;
5148 }
5149
5150 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5151 self.feature_flags.soft_bundle = val;
5152 }
5153
5154 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5155 self.feature_flags.passkey_auth = val
5156 }
5157
5158 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5159 self.feature_flags.enable_party_transfer = val
5160 }
5161
5162 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5163 self.feature_flags
5164 .consensus_distributed_vote_scoring_strategy = val;
5165 }
5166
5167 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5168 self.feature_flags.consensus_round_prober = val;
5169 }
5170
5171 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5172 self.feature_flags
5173 .disallow_new_modules_in_deps_only_packages = val;
5174 }
5175
5176 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5177 self.feature_flags.correct_gas_payment_limit_check = val;
5178 }
5179
5180 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5181 self.feature_flags.address_aliases = val;
5182 }
5183
5184 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5185 self.feature_flags
5186 .consensus_round_prober_probe_accepted_rounds = val;
5187 }
5188
5189 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5190 self.feature_flags.mysticeti_fastpath = val;
5191 }
5192
5193 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5194 self.feature_flags.accept_passkey_in_multisig = val;
5195 }
5196
5197 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5198 self.feature_flags.consensus_batched_block_sync = val;
5199 }
5200
5201 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5202 self.feature_flags.record_time_estimate_processed = val;
5203 }
5204
5205 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5206 &mut self,
5207 val: bool,
5208 ) {
5209 self.feature_flags
5210 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5211 }
5212
5213 pub fn enable_accumulators_for_testing(&mut self) {
5214 self.feature_flags.enable_accumulators = true;
5215 }
5216
5217 pub fn disable_accumulators_for_testing(&mut self) {
5218 self.feature_flags.enable_accumulators = false;
5219 self.feature_flags.enable_address_balance_gas_payments = false;
5220 }
5221
5222 pub fn enable_coin_reservation_for_testing(&mut self) {
5223 self.feature_flags.enable_coin_reservation_obj_refs = true;
5224 self.feature_flags
5225 .convert_withdrawal_compatibility_ptb_arguments = true;
5226 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5229 }
5230
5231 pub fn disable_coin_reservation_for_testing(&mut self) {
5232 self.feature_flags.enable_coin_reservation_obj_refs = false;
5233 self.feature_flags
5234 .convert_withdrawal_compatibility_ptb_arguments = false;
5235 }
5236
5237 pub fn create_root_accumulator_object_for_testing(&mut self) {
5238 self.feature_flags.create_root_accumulator_object = true;
5239 }
5240
5241 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5242 self.feature_flags.create_root_accumulator_object = false;
5243 }
5244
5245 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5246 self.feature_flags.enable_accumulators = true;
5247 self.feature_flags.allow_private_accumulator_entrypoints = true;
5248 self.feature_flags.enable_address_balance_gas_payments = true;
5249 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5250 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5251 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5252 }
5253
5254 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5255 self.feature_flags.enable_address_balance_gas_payments = false;
5256 }
5257
5258 pub fn enable_gasless_for_testing(&mut self) {
5259 self.enable_address_balance_gas_payments_for_testing();
5260 self.feature_flags.enable_gasless = true;
5261 self.feature_flags.gasless_verify_remaining_balance = true;
5262 self.gasless_max_computation_units = Some(5_000);
5263 self.gasless_allowed_token_types = Some(vec![]);
5264 self.gasless_max_tps = Some(1000);
5265 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5266 }
5267
5268 pub fn disable_gasless_for_testing(&mut self) {
5269 self.feature_flags.enable_gasless = false;
5270 self.gasless_max_computation_units = None;
5271 self.gasless_allowed_token_types = None;
5272 }
5273
5274 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5275 self.gasless_allowed_token_types = Some(types);
5276 }
5277
5278 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5279 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5280 }
5281
5282 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5283 self.enable_accumulators_for_testing();
5284 self.feature_flags.enable_authenticated_event_streams = true;
5285 self.feature_flags
5286 .include_checkpoint_artifacts_digest_in_summary = true;
5287 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5288 }
5289
5290 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5291 self.feature_flags.enable_authenticated_event_streams = false;
5292 }
5293
5294 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5295 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5296 }
5297
5298 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5299 self.feature_flags.enable_non_exclusive_writes = true;
5300 }
5301
5302 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5303 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5304 }
5305
5306 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5307 &mut self,
5308 val: bool,
5309 ) {
5310 self.feature_flags
5311 .ignore_execution_time_observations_after_certs_closed = val;
5312 }
5313
5314 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5315 &mut self,
5316 val: bool,
5317 ) {
5318 self.feature_flags
5319 .consensus_checkpoint_signature_key_includes_digest = val;
5320 }
5321
5322 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5323 self.feature_flags.cancel_for_failed_dkg_early = val;
5324 }
5325
5326 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5327 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5328 }
5329
5330 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5331 self.feature_flags.authority_capabilities_v2 = val;
5332 }
5333
5334 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5335 self.feature_flags.allow_references_in_ptbs = true;
5336 }
5337
5338 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5339 self.feature_flags.consensus_skip_gced_accept_votes = val;
5340 }
5341
5342 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5343 self.feature_flags.enable_object_funds_withdraw = val;
5344 }
5345
5346 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5347 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5348 }
5349
5350 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5351 self.feature_flags.merge_randomness_into_checkpoint = val;
5352 }
5353}
5354
5355#[cfg(not(msim))]
5356type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5357
5358#[cfg(not(msim))]
5359static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5360
5361#[cfg(msim)]
5362type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5363
5364#[cfg(msim)]
5365thread_local! {
5366 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5367}
5368
5369#[must_use]
5370pub struct OverrideGuard;
5371
5372#[cfg(not(msim))]
5373impl Drop for OverrideGuard {
5374 fn drop(&mut self) {
5375 info!("restoring override fn");
5376 *CONFIG_OVERRIDE.lock().unwrap() = None;
5377 }
5378}
5379
5380#[cfg(msim)]
5381impl Drop for OverrideGuard {
5382 fn drop(&mut self) {
5383 info!("restoring override fn");
5384 CONFIG_OVERRIDE.with(|ovr| {
5385 *ovr.borrow_mut() = None;
5386 });
5387 }
5388}
5389
5390#[derive(PartialEq, Eq)]
5393pub enum LimitThresholdCrossed {
5394 None,
5395 Soft(u128, u128),
5396 Hard(u128, u128),
5397}
5398
5399pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5402 x: T,
5403 soft_limit: U,
5404 hard_limit: V,
5405) -> LimitThresholdCrossed {
5406 let x: V = x.into();
5407 let soft_limit: V = soft_limit.into();
5408
5409 debug_assert!(soft_limit <= hard_limit);
5410
5411 if x >= hard_limit {
5414 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5415 } else if x < soft_limit {
5416 LimitThresholdCrossed::None
5417 } else {
5418 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5419 }
5420}
5421
5422#[macro_export]
5423macro_rules! check_limit {
5424 ($x:expr, $hard:expr) => {
5425 check_limit!($x, $hard, $hard)
5426 };
5427 ($x:expr, $soft:expr, $hard:expr) => {
5428 check_limit_in_range($x as u64, $soft, $hard)
5429 };
5430}
5431
5432#[macro_export]
5436macro_rules! check_limit_by_meter {
5437 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5438 let (h, metered_str) = if $is_metered {
5440 ($metered_limit, "metered")
5441 } else {
5442 ($unmetered_hard_limit, "unmetered")
5444 };
5445 use sui_protocol_config::check_limit_in_range;
5446 let result = check_limit_in_range($x as u64, $metered_limit, h);
5447 match result {
5448 LimitThresholdCrossed::None => {}
5449 LimitThresholdCrossed::Soft(_, _) => {
5450 $metric.with_label_values(&[metered_str, "soft"]).inc();
5451 }
5452 LimitThresholdCrossed::Hard(_, _) => {
5453 $metric.with_label_values(&[metered_str, "hard"]).inc();
5454 }
5455 };
5456 result
5457 }};
5458}
5459
5460pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5463
5464static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5465 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5466
5467static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5468 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5469
5470fn parse_amendments(json: &str) -> Arc<Amendments> {
5471 #[derive(serde::Deserialize)]
5472 struct AmendmentEntry {
5473 root: String,
5474 deps: Vec<DepEntry>,
5475 }
5476
5477 #[derive(serde::Deserialize)]
5478 struct DepEntry {
5479 original_id: String,
5480 version_id: String,
5481 }
5482
5483 let entries: Vec<AmendmentEntry> =
5484 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5485 let mut amendments = BTreeMap::new();
5486 for entry in entries {
5487 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5488 let mut dep_ids = BTreeMap::new();
5489 for dep in entry.deps {
5490 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5491 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5492 assert!(
5493 dep_ids.insert(orig_id, upgraded_id).is_none(),
5494 "Duplicate original ID in amendments table"
5495 );
5496 }
5497 assert!(
5498 amendments.insert(root_id, dep_ids).is_none(),
5499 "Duplicate root ID in amendments table"
5500 );
5501 }
5502 Arc::new(amendments)
5503}
5504
5505#[cfg(all(test, not(msim)))]
5506mod test {
5507 use insta::assert_yaml_snapshot;
5508
5509 use super::*;
5510
5511 #[test]
5512 fn snapshot_tests() {
5513 println!("\n============================================================================");
5514 println!("! !");
5515 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5516 println!("! !");
5517 println!("============================================================================\n");
5518 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5519 let chain_str = match chain_id {
5523 Chain::Unknown => "".to_string(),
5524 _ => format!("{:?}_", chain_id),
5525 };
5526 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5527 let cur = ProtocolVersion::new(i);
5528 assert_yaml_snapshot!(
5529 format!("{}version_{}", chain_str, cur.as_u64()),
5530 ProtocolConfig::get_for_version(cur, *chain_id)
5531 );
5532 }
5533 }
5534 }
5535
5536 #[test]
5537 fn test_getters() {
5538 let prot: ProtocolConfig =
5539 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5540 assert_eq!(
5541 prot.max_arguments(),
5542 prot.max_arguments_as_option().unwrap()
5543 );
5544 }
5545
5546 #[test]
5547 fn test_setters() {
5548 let mut prot: ProtocolConfig =
5549 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5550 prot.set_max_arguments_for_testing(123);
5551 assert_eq!(prot.max_arguments(), 123);
5552
5553 prot.set_max_arguments_from_str_for_testing("321".to_string());
5554 assert_eq!(prot.max_arguments(), 321);
5555
5556 prot.disable_max_arguments_for_testing();
5557 assert_eq!(prot.max_arguments_as_option(), None);
5558
5559 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5560 assert_eq!(prot.max_arguments(), 456);
5561 }
5562
5563 #[test]
5564 fn test_get_for_version_if_supported_applies_test_overrides() {
5565 let before =
5566 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5567 .unwrap();
5568
5569 assert!(!before.enable_coin_reservation_obj_refs());
5570
5571 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5572 cfg.enable_coin_reservation_for_testing();
5573 cfg
5574 });
5575
5576 let after =
5577 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5578 .unwrap();
5579
5580 assert!(after.enable_coin_reservation_obj_refs());
5581 }
5582
5583 #[test]
5584 #[should_panic(expected = "unsupported version")]
5585 fn max_version_test() {
5586 let _ = ProtocolConfig::get_for_version_impl(
5589 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5590 Chain::Unknown,
5591 );
5592 }
5593
5594 #[test]
5595 fn lookup_by_string_test() {
5596 let prot: ProtocolConfig =
5597 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5598 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5600
5601 assert!(
5602 prot.lookup_attr("max_arguments".to_string())
5603 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5604 );
5605
5606 assert!(
5608 prot.lookup_attr("max_move_identifier_len".to_string())
5609 .is_none()
5610 );
5611
5612 let prot: ProtocolConfig =
5614 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5615 assert!(
5616 prot.lookup_attr("max_move_identifier_len".to_string())
5617 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5618 );
5619
5620 let prot: ProtocolConfig =
5621 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5622 assert!(
5624 prot.attr_map()
5625 .get("max_move_identifier_len")
5626 .unwrap()
5627 .is_none()
5628 );
5629 assert!(
5631 prot.attr_map().get("max_arguments").unwrap()
5632 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5633 );
5634
5635 let prot: ProtocolConfig =
5637 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5638 assert!(
5640 prot.feature_flags
5641 .lookup_attr("some random string".to_owned())
5642 .is_none()
5643 );
5644 assert!(
5645 !prot
5646 .feature_flags
5647 .attr_map()
5648 .contains_key("some random string")
5649 );
5650
5651 assert!(
5653 prot.feature_flags
5654 .lookup_attr("package_upgrades".to_owned())
5655 == Some(false)
5656 );
5657 assert!(
5658 prot.feature_flags
5659 .attr_map()
5660 .get("package_upgrades")
5661 .unwrap()
5662 == &false
5663 );
5664 let prot: ProtocolConfig =
5665 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5666 assert!(
5668 prot.feature_flags
5669 .lookup_attr("package_upgrades".to_owned())
5670 == Some(true)
5671 );
5672 assert!(
5673 prot.feature_flags
5674 .attr_map()
5675 .get("package_upgrades")
5676 .unwrap()
5677 == &true
5678 );
5679 }
5680
5681 #[test]
5682 fn limit_range_fn_test() {
5683 let low = 100u32;
5684 let high = 10000u64;
5685
5686 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5687 assert!(matches!(
5688 check_limit!(255u16, low, high),
5689 LimitThresholdCrossed::Soft(255u128, 100)
5690 ));
5691 assert!(matches!(
5697 check_limit!(2550000u64, low, high),
5698 LimitThresholdCrossed::Hard(2550000, 10000)
5699 ));
5700
5701 assert!(matches!(
5702 check_limit!(2550000u64, high, high),
5703 LimitThresholdCrossed::Hard(2550000, 10000)
5704 ));
5705
5706 assert!(matches!(
5707 check_limit!(1u8, high),
5708 LimitThresholdCrossed::None
5709 ));
5710
5711 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5712
5713 assert!(matches!(
5714 check_limit!(2550000u64, high),
5715 LimitThresholdCrossed::Hard(2550000, 10000)
5716 ));
5717 }
5718
5719 #[test]
5720 fn linkage_amendments_load() {
5721 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5722 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5723 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5724 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5725 }
5726}