1use std::{
5 cell::RefCell,
6 collections::BTreeSet,
7 sync::atomic::{AtomicBool, Ordering},
8};
9
10use clap::*;
11use fastcrypto::encoding::{Base58, Encoding, Hex};
12use move_binary_format::{
13 binary_config::{BinaryConfig, TableConfig},
14 file_format_common::VERSION_1,
15};
16use move_vm_config::verifier::VerifierConfig;
17use mysten_common::in_integration_test;
18use serde::{Deserialize, Serialize};
19use serde_with::skip_serializing_none;
20use sui_protocol_config_macros::{
21 ProtocolConfigAccessors, ProtocolConfigFeatureFlagsGetters, ProtocolConfigOverride,
22};
23use tracing::{info, warn};
24
25const MIN_PROTOCOL_VERSION: u64 = 1;
27const MAX_PROTOCOL_VERSION: u64 = 120;
28
29const TESTNET_USDC: &str =
30 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
31
32#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
316pub struct ProtocolVersion(u64);
317
318impl ProtocolVersion {
319 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
324
325 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
326
327 #[cfg(not(msim))]
328 pub const MAX_ALLOWED: Self = Self::MAX;
329
330 #[cfg(msim)]
332 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
333
334 pub fn new(v: u64) -> Self {
335 Self(v)
336 }
337
338 pub const fn as_u64(&self) -> u64 {
339 self.0
340 }
341
342 pub fn max() -> Self {
345 Self::MAX
346 }
347
348 pub fn prev(self) -> Self {
349 Self(self.0.checked_sub(1).unwrap())
350 }
351}
352
353impl From<u64> for ProtocolVersion {
354 fn from(v: u64) -> Self {
355 Self::new(v)
356 }
357}
358
359impl std::ops::Sub<u64> for ProtocolVersion {
360 type Output = Self;
361 fn sub(self, rhs: u64) -> Self::Output {
362 Self::new(self.0 - rhs)
363 }
364}
365
366impl std::ops::Add<u64> for ProtocolVersion {
367 type Output = Self;
368 fn add(self, rhs: u64) -> Self::Output {
369 Self::new(self.0 + rhs)
370 }
371}
372
373#[derive(
374 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
375)]
376pub enum Chain {
377 Mainnet,
378 Testnet,
379 #[default]
380 Unknown,
381}
382
383impl Chain {
384 pub fn as_str(self) -> &'static str {
385 match self {
386 Chain::Mainnet => "mainnet",
387 Chain::Testnet => "testnet",
388 Chain::Unknown => "unknown",
389 }
390 }
391}
392
393pub struct Error(pub String);
394
395#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
398struct FeatureFlags {
399 #[serde(skip_serializing_if = "is_false")]
402 package_upgrades: bool,
403 #[serde(skip_serializing_if = "is_false")]
406 commit_root_state_digest: bool,
407 #[serde(skip_serializing_if = "is_false")]
409 advance_epoch_start_time_in_safe_mode: bool,
410 #[serde(skip_serializing_if = "is_false")]
413 loaded_child_objects_fixed: bool,
414 #[serde(skip_serializing_if = "is_false")]
417 missing_type_is_compatibility_error: bool,
418 #[serde(skip_serializing_if = "is_false")]
421 scoring_decision_with_validity_cutoff: bool,
422
423 #[serde(skip_serializing_if = "is_false")]
426 consensus_order_end_of_epoch_last: bool,
427
428 #[serde(skip_serializing_if = "is_false")]
430 disallow_adding_abilities_on_upgrade: bool,
431 #[serde(skip_serializing_if = "is_false")]
433 disable_invariant_violation_check_in_swap_loc: bool,
434 #[serde(skip_serializing_if = "is_false")]
437 advance_to_highest_supported_protocol_version: bool,
438 #[serde(skip_serializing_if = "is_false")]
440 ban_entry_init: bool,
441 #[serde(skip_serializing_if = "is_false")]
443 package_digest_hash_module: bool,
444 #[serde(skip_serializing_if = "is_false")]
446 disallow_change_struct_type_params_on_upgrade: bool,
447 #[serde(skip_serializing_if = "is_false")]
449 no_extraneous_module_bytes: bool,
450 #[serde(skip_serializing_if = "is_false")]
452 narwhal_versioned_metadata: bool,
453
454 #[serde(skip_serializing_if = "is_false")]
456 zklogin_auth: bool,
457 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
459 consensus_transaction_ordering: ConsensusTransactionOrdering,
460
461 #[serde(skip_serializing_if = "is_false")]
469 simplified_unwrap_then_delete: bool,
470 #[serde(skip_serializing_if = "is_false")]
472 upgraded_multisig_supported: bool,
473 #[serde(skip_serializing_if = "is_false")]
475 txn_base_cost_as_multiplier: bool,
476
477 #[serde(skip_serializing_if = "is_false")]
479 shared_object_deletion: bool,
480
481 #[serde(skip_serializing_if = "is_false")]
483 narwhal_new_leader_election_schedule: bool,
484
485 #[serde(skip_serializing_if = "is_empty")]
487 zklogin_supported_providers: BTreeSet<String>,
488
489 #[serde(skip_serializing_if = "is_false")]
491 loaded_child_object_format: bool,
492
493 #[serde(skip_serializing_if = "is_false")]
494 enable_jwk_consensus_updates: bool,
495
496 #[serde(skip_serializing_if = "is_false")]
497 end_of_epoch_transaction_supported: bool,
498
499 #[serde(skip_serializing_if = "is_false")]
502 simple_conservation_checks: bool,
503
504 #[serde(skip_serializing_if = "is_false")]
506 loaded_child_object_format_type: bool,
507
508 #[serde(skip_serializing_if = "is_false")]
510 receive_objects: bool,
511
512 #[serde(skip_serializing_if = "is_false")]
514 consensus_checkpoint_signature_key_includes_digest: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 random_beacon: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 bridge: bool,
523
524 #[serde(skip_serializing_if = "is_false")]
525 enable_effects_v2: bool,
526
527 #[serde(skip_serializing_if = "is_false")]
529 narwhal_certificate_v2: bool,
530
531 #[serde(skip_serializing_if = "is_false")]
533 verify_legacy_zklogin_address: bool,
534
535 #[serde(skip_serializing_if = "is_false")]
537 throughput_aware_consensus_submission: bool,
538
539 #[serde(skip_serializing_if = "is_false")]
541 recompute_has_public_transfer_in_execution: bool,
542
543 #[serde(skip_serializing_if = "is_false")]
545 accept_zklogin_in_multisig: bool,
546
547 #[serde(skip_serializing_if = "is_false")]
549 accept_passkey_in_multisig: bool,
550
551 #[serde(skip_serializing_if = "is_false")]
553 validate_zklogin_public_identifier: bool,
554
555 #[serde(skip_serializing_if = "is_false")]
558 include_consensus_digest_in_prologue: bool,
559
560 #[serde(skip_serializing_if = "is_false")]
562 hardened_otw_check: bool,
563
564 #[serde(skip_serializing_if = "is_false")]
566 allow_receiving_object_id: bool,
567
568 #[serde(skip_serializing_if = "is_false")]
570 enable_poseidon: bool,
571
572 #[serde(skip_serializing_if = "is_false")]
574 enable_coin_deny_list: bool,
575
576 #[serde(skip_serializing_if = "is_false")]
578 enable_group_ops_native_functions: bool,
579
580 #[serde(skip_serializing_if = "is_false")]
582 enable_group_ops_native_function_msm: bool,
583
584 #[serde(skip_serializing_if = "is_false")]
586 enable_ristretto255_group_ops: bool,
587
588 #[serde(skip_serializing_if = "is_false")]
590 enable_nitro_attestation: bool,
591
592 #[serde(skip_serializing_if = "is_false")]
594 enable_nitro_attestation_upgraded_parsing: bool,
595
596 #[serde(skip_serializing_if = "is_false")]
598 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
599
600 #[serde(skip_serializing_if = "is_false")]
602 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
603
604 #[serde(skip_serializing_if = "is_false")]
606 reject_mutable_random_on_entry_functions: bool,
607
608 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
610 per_object_congestion_control_mode: PerObjectCongestionControlMode,
611
612 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
614 consensus_choice: ConsensusChoice,
615
616 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
618 consensus_network: ConsensusNetwork,
619
620 #[serde(skip_serializing_if = "is_false")]
622 correct_gas_payment_limit_check: bool,
623
624 #[serde(skip_serializing_if = "Option::is_none")]
626 zklogin_max_epoch_upper_bound_delta: Option<u64>,
627
628 #[serde(skip_serializing_if = "is_false")]
630 mysticeti_leader_scoring_and_schedule: bool,
631
632 #[serde(skip_serializing_if = "is_false")]
634 reshare_at_same_initial_version: bool,
635
636 #[serde(skip_serializing_if = "is_false")]
638 resolve_abort_locations_to_package_id: bool,
639
640 #[serde(skip_serializing_if = "is_false")]
644 mysticeti_use_committed_subdag_digest: bool,
645
646 #[serde(skip_serializing_if = "is_false")]
648 enable_vdf: bool,
649
650 #[serde(skip_serializing_if = "is_false")]
655 record_consensus_determined_version_assignments_in_prologue: bool,
656 #[serde(skip_serializing_if = "is_false")]
657 record_consensus_determined_version_assignments_in_prologue_v2: bool,
658
659 #[serde(skip_serializing_if = "is_false")]
661 fresh_vm_on_framework_upgrade: bool,
662
663 #[serde(skip_serializing_if = "is_false")]
671 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
672
673 #[serde(skip_serializing_if = "Option::is_none")]
675 mysticeti_num_leaders_per_round: Option<usize>,
676
677 #[serde(skip_serializing_if = "is_false")]
679 soft_bundle: bool,
680
681 #[serde(skip_serializing_if = "is_false")]
683 enable_coin_deny_list_v2: bool,
684
685 #[serde(skip_serializing_if = "is_false")]
687 passkey_auth: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 authority_capabilities_v2: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
695 rethrow_serialization_type_layout_errors: bool,
696
697 #[serde(skip_serializing_if = "is_false")]
699 consensus_distributed_vote_scoring_strategy: bool,
700
701 #[serde(skip_serializing_if = "is_false")]
703 consensus_round_prober: bool,
704
705 #[serde(skip_serializing_if = "is_false")]
707 validate_identifier_inputs: bool,
708
709 #[serde(skip_serializing_if = "is_false")]
711 disallow_self_identifier: bool,
712
713 #[serde(skip_serializing_if = "is_false")]
715 mysticeti_fastpath: bool,
716
717 #[serde(skip_serializing_if = "is_false")]
721 disable_preconsensus_locking: bool,
722
723 #[serde(skip_serializing_if = "is_false")]
725 relocate_event_module: bool,
726
727 #[serde(skip_serializing_if = "is_false")]
729 uncompressed_g1_group_elements: bool,
730
731 #[serde(skip_serializing_if = "is_false")]
732 disallow_new_modules_in_deps_only_packages: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
736 consensus_smart_ancestor_selection: bool,
737
738 #[serde(skip_serializing_if = "is_false")]
740 consensus_round_prober_probe_accepted_rounds: bool,
741
742 #[serde(skip_serializing_if = "is_false")]
744 native_charging_v2: bool,
745
746 #[serde(skip_serializing_if = "is_false")]
749 consensus_linearize_subdag_v2: bool,
750
751 #[serde(skip_serializing_if = "is_false")]
753 convert_type_argument_error: bool,
754
755 #[serde(skip_serializing_if = "is_false")]
757 variant_nodes: bool,
758
759 #[serde(skip_serializing_if = "is_false")]
761 consensus_zstd_compression: bool,
762
763 #[serde(skip_serializing_if = "is_false")]
765 minimize_child_object_mutations: bool,
766
767 #[serde(skip_serializing_if = "is_false")]
769 record_additional_state_digest_in_prologue: bool,
770
771 #[serde(skip_serializing_if = "is_false")]
773 move_native_context: bool,
774
775 #[serde(skip_serializing_if = "is_false")]
778 consensus_median_based_commit_timestamp: bool,
779
780 #[serde(skip_serializing_if = "is_false")]
783 normalize_ptb_arguments: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 consensus_batched_block_sync: bool,
788
789 #[serde(skip_serializing_if = "is_false")]
791 enforce_checkpoint_timestamp_monotonicity: bool,
792
793 #[serde(skip_serializing_if = "is_false")]
795 max_ptb_value_size_v2: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
799 resolve_type_input_ids_to_defining_id: bool,
800
801 #[serde(skip_serializing_if = "is_false")]
803 enable_party_transfer: bool,
804
805 #[serde(skip_serializing_if = "is_false")]
807 allow_unbounded_system_objects: bool,
808
809 #[serde(skip_serializing_if = "is_false")]
811 type_tags_in_object_runtime: bool,
812
813 #[serde(skip_serializing_if = "is_false")]
815 enable_accumulators: bool,
816
817 #[serde(skip_serializing_if = "is_false")]
819 enable_coin_reservation_obj_refs: bool,
820
821 #[serde(skip_serializing_if = "is_false")]
824 create_root_accumulator_object: bool,
825
826 #[serde(skip_serializing_if = "is_false")]
828 enable_authenticated_event_streams: bool,
829
830 #[serde(skip_serializing_if = "is_false")]
832 enable_address_balance_gas_payments: bool,
833
834 #[serde(skip_serializing_if = "is_false")]
836 address_balance_gas_check_rgp_at_signing: bool,
837
838 #[serde(skip_serializing_if = "is_false")]
839 address_balance_gas_reject_gas_coin_arg: bool,
840
841 #[serde(skip_serializing_if = "is_false")]
843 enable_multi_epoch_transaction_expiration: bool,
844
845 #[serde(skip_serializing_if = "is_false")]
847 relax_valid_during_for_owned_inputs: bool,
848
849 #[serde(skip_serializing_if = "is_false")]
851 enable_ptb_execution_v2: bool,
852
853 #[serde(skip_serializing_if = "is_false")]
855 better_adapter_type_resolution_errors: bool,
856
857 #[serde(skip_serializing_if = "is_false")]
859 record_time_estimate_processed: bool,
860
861 #[serde(skip_serializing_if = "is_false")]
863 dependency_linkage_error: bool,
864
865 #[serde(skip_serializing_if = "is_false")]
867 additional_multisig_checks: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
871 ignore_execution_time_observations_after_certs_closed: bool,
872
873 #[serde(skip_serializing_if = "is_false")]
877 debug_fatal_on_move_invariant_violation: bool,
878
879 #[serde(skip_serializing_if = "is_false")]
882 allow_private_accumulator_entrypoints: bool,
883
884 #[serde(skip_serializing_if = "is_false")]
886 additional_consensus_digest_indirect_state: bool,
887
888 #[serde(skip_serializing_if = "is_false")]
890 check_for_init_during_upgrade: bool,
891
892 #[serde(skip_serializing_if = "is_false")]
894 per_command_shared_object_transfer_rules: bool,
895
896 #[serde(skip_serializing_if = "is_false")]
898 include_checkpoint_artifacts_digest_in_summary: bool,
899
900 #[serde(skip_serializing_if = "is_false")]
902 use_mfp_txns_in_load_initial_object_debts: bool,
903
904 #[serde(skip_serializing_if = "is_false")]
906 cancel_for_failed_dkg_early: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 enable_coin_registry: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 abstract_size_in_object_runtime: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
918 object_runtime_charge_cache_load_gas: bool,
919
920 #[serde(skip_serializing_if = "is_false")]
922 additional_borrow_checks: bool,
923
924 #[serde(skip_serializing_if = "is_false")]
926 use_new_commit_handler: bool,
927
928 #[serde(skip_serializing_if = "is_false")]
930 better_loader_errors: bool,
931
932 #[serde(skip_serializing_if = "is_false")]
934 generate_df_type_layouts: bool,
935
936 #[serde(skip_serializing_if = "is_false")]
938 allow_references_in_ptbs: bool,
939
940 #[serde(skip_serializing_if = "is_false")]
942 enable_display_registry: bool,
943
944 #[serde(skip_serializing_if = "is_false")]
946 private_generics_verifier_v2: bool,
947
948 #[serde(skip_serializing_if = "is_false")]
950 deprecate_global_storage_ops_during_deserialization: bool,
951
952 #[serde(skip_serializing_if = "is_false")]
955 enable_non_exclusive_writes: bool,
956
957 #[serde(skip_serializing_if = "is_false")]
959 deprecate_global_storage_ops: bool,
960
961 #[serde(skip_serializing_if = "is_false")]
963 normalize_depth_formula: bool,
964
965 #[serde(skip_serializing_if = "is_false")]
967 consensus_skip_gced_accept_votes: bool,
968
969 #[serde(skip_serializing_if = "is_false")]
971 include_cancelled_randomness_txns_in_prologue: bool,
972
973 #[serde(skip_serializing_if = "is_false")]
975 address_aliases: bool,
976
977 #[serde(skip_serializing_if = "is_false")]
980 fix_checkpoint_signature_mapping: bool,
981
982 #[serde(skip_serializing_if = "is_false")]
984 enable_object_funds_withdraw: bool,
985
986 #[serde(skip_serializing_if = "is_false")]
988 consensus_skip_gced_blocks_in_direct_finalization: bool,
989
990 #[serde(skip_serializing_if = "is_false")]
992 gas_rounding_halve_digits: bool,
993
994 #[serde(skip_serializing_if = "is_false")]
996 flexible_tx_context_positions: bool,
997
998 #[serde(skip_serializing_if = "is_false")]
1000 disable_entry_point_signature_check: bool,
1001
1002 #[serde(skip_serializing_if = "is_false")]
1004 convert_withdrawal_compatibility_ptb_arguments: bool,
1005
1006 #[serde(skip_serializing_if = "is_false")]
1008 restrict_hot_or_not_entry_functions: bool,
1009
1010 #[serde(skip_serializing_if = "is_false")]
1012 split_checkpoints_in_consensus_handler: bool,
1013
1014 #[serde(skip_serializing_if = "is_false")]
1016 consensus_always_accept_system_transactions: bool,
1017
1018 #[serde(skip_serializing_if = "is_false")]
1020 validator_metadata_verify_v2: bool,
1021
1022 #[serde(skip_serializing_if = "is_false")]
1025 defer_unpaid_amplification: bool,
1026
1027 #[serde(skip_serializing_if = "is_false")]
1028 randomize_checkpoint_tx_limit_in_tests: bool,
1029
1030 #[serde(skip_serializing_if = "is_false")]
1032 gasless_transaction_drop_safety: bool,
1033
1034 #[serde(skip_serializing_if = "is_false")]
1036 merge_randomness_into_checkpoint: bool,
1037
1038 #[serde(skip_serializing_if = "is_false")]
1040 use_coin_party_owner: bool,
1041
1042 #[serde(skip_serializing_if = "is_false")]
1043 enable_gasless: bool,
1044}
1045
1046fn is_false(b: &bool) -> bool {
1047 !b
1048}
1049
1050fn is_empty(b: &BTreeSet<String>) -> bool {
1051 b.is_empty()
1052}
1053
1054fn is_zero(val: &u64) -> bool {
1055 *val == 0
1056}
1057
1058#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1060pub enum ConsensusTransactionOrdering {
1061 #[default]
1063 None,
1064 ByGasPrice,
1066}
1067
1068impl ConsensusTransactionOrdering {
1069 pub fn is_none(&self) -> bool {
1070 matches!(self, ConsensusTransactionOrdering::None)
1071 }
1072}
1073
1074#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1075pub struct ExecutionTimeEstimateParams {
1076 pub target_utilization: u64,
1078 pub allowed_txn_cost_overage_burst_limit_us: u64,
1082
1083 pub randomness_scalar: u64,
1086
1087 pub max_estimate_us: u64,
1089
1090 pub stored_observations_num_included_checkpoints: u64,
1093
1094 pub stored_observations_limit: u64,
1096
1097 #[serde(skip_serializing_if = "is_zero")]
1100 pub stake_weighted_median_threshold: u64,
1101
1102 #[serde(skip_serializing_if = "is_false")]
1106 pub default_none_duration_for_new_keys: bool,
1107
1108 #[serde(skip_serializing_if = "Option::is_none")]
1110 pub observations_chunk_size: Option<u64>,
1111}
1112
1113#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1115pub enum PerObjectCongestionControlMode {
1116 #[default]
1117 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1123
1124impl PerObjectCongestionControlMode {
1125 pub fn is_none(&self) -> bool {
1126 matches!(self, PerObjectCongestionControlMode::None)
1127 }
1128}
1129
1130#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1132pub enum ConsensusChoice {
1133 #[default]
1134 Narwhal,
1135 SwapEachEpoch,
1136 Mysticeti,
1137}
1138
1139impl ConsensusChoice {
1140 pub fn is_narwhal(&self) -> bool {
1141 matches!(self, ConsensusChoice::Narwhal)
1142 }
1143}
1144
1145#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1147pub enum ConsensusNetwork {
1148 #[default]
1149 Anemo,
1150 Tonic,
1151}
1152
1153impl ConsensusNetwork {
1154 pub fn is_anemo(&self) -> bool {
1155 matches!(self, ConsensusNetwork::Anemo)
1156 }
1157}
1158
1159#[skip_serializing_none]
1191#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1192pub struct ProtocolConfig {
1193 pub version: ProtocolVersion,
1194
1195 feature_flags: FeatureFlags,
1196
1197 max_tx_size_bytes: Option<u64>,
1200
1201 max_input_objects: Option<u64>,
1203
1204 max_size_written_objects: Option<u64>,
1208 max_size_written_objects_system_tx: Option<u64>,
1211
1212 max_serialized_tx_effects_size_bytes: Option<u64>,
1214
1215 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1217
1218 max_gas_payment_objects: Option<u32>,
1220
1221 max_modules_in_publish: Option<u32>,
1223
1224 max_package_dependencies: Option<u32>,
1226
1227 max_arguments: Option<u32>,
1230
1231 max_type_arguments: Option<u32>,
1233
1234 max_type_argument_depth: Option<u32>,
1236
1237 max_pure_argument_size: Option<u32>,
1239
1240 max_programmable_tx_commands: Option<u32>,
1242
1243 move_binary_format_version: Option<u32>,
1246 min_move_binary_format_version: Option<u32>,
1247
1248 binary_module_handles: Option<u16>,
1250 binary_struct_handles: Option<u16>,
1251 binary_function_handles: Option<u16>,
1252 binary_function_instantiations: Option<u16>,
1253 binary_signatures: Option<u16>,
1254 binary_constant_pool: Option<u16>,
1255 binary_identifiers: Option<u16>,
1256 binary_address_identifiers: Option<u16>,
1257 binary_struct_defs: Option<u16>,
1258 binary_struct_def_instantiations: Option<u16>,
1259 binary_function_defs: Option<u16>,
1260 binary_field_handles: Option<u16>,
1261 binary_field_instantiations: Option<u16>,
1262 binary_friend_decls: Option<u16>,
1263 binary_enum_defs: Option<u16>,
1264 binary_enum_def_instantiations: Option<u16>,
1265 binary_variant_handles: Option<u16>,
1266 binary_variant_instantiation_handles: Option<u16>,
1267
1268 max_move_object_size: Option<u64>,
1270
1271 max_move_package_size: Option<u64>,
1274
1275 max_publish_or_upgrade_per_ptb: Option<u64>,
1277
1278 max_tx_gas: Option<u64>,
1280
1281 max_gas_price: Option<u64>,
1283
1284 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1287
1288 max_gas_computation_bucket: Option<u64>,
1290
1291 gas_rounding_step: Option<u64>,
1293
1294 max_loop_depth: Option<u64>,
1296
1297 max_generic_instantiation_length: Option<u64>,
1299
1300 max_function_parameters: Option<u64>,
1302
1303 max_basic_blocks: Option<u64>,
1305
1306 max_value_stack_size: Option<u64>,
1308
1309 max_type_nodes: Option<u64>,
1311
1312 max_push_size: Option<u64>,
1314
1315 max_struct_definitions: Option<u64>,
1317
1318 max_function_definitions: Option<u64>,
1320
1321 max_fields_in_struct: Option<u64>,
1323
1324 max_dependency_depth: Option<u64>,
1326
1327 max_num_event_emit: Option<u64>,
1329
1330 max_num_new_move_object_ids: Option<u64>,
1332
1333 max_num_new_move_object_ids_system_tx: Option<u64>,
1335
1336 max_num_deleted_move_object_ids: Option<u64>,
1338
1339 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1341
1342 max_num_transferred_move_object_ids: Option<u64>,
1344
1345 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1347
1348 max_event_emit_size: Option<u64>,
1350
1351 max_event_emit_size_total: Option<u64>,
1353
1354 max_move_vector_len: Option<u64>,
1356
1357 max_move_identifier_len: Option<u64>,
1359
1360 max_move_value_depth: Option<u64>,
1362
1363 max_move_enum_variants: Option<u64>,
1365
1366 max_back_edges_per_function: Option<u64>,
1368
1369 max_back_edges_per_module: Option<u64>,
1371
1372 max_verifier_meter_ticks_per_function: Option<u64>,
1374
1375 max_meter_ticks_per_module: Option<u64>,
1377
1378 max_meter_ticks_per_package: Option<u64>,
1380
1381 object_runtime_max_num_cached_objects: Option<u64>,
1385
1386 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1388
1389 object_runtime_max_num_store_entries: Option<u64>,
1391
1392 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1394
1395 base_tx_cost_fixed: Option<u64>,
1398
1399 package_publish_cost_fixed: Option<u64>,
1402
1403 base_tx_cost_per_byte: Option<u64>,
1406
1407 package_publish_cost_per_byte: Option<u64>,
1409
1410 obj_access_cost_read_per_byte: Option<u64>,
1412
1413 obj_access_cost_mutate_per_byte: Option<u64>,
1415
1416 obj_access_cost_delete_per_byte: Option<u64>,
1418
1419 obj_access_cost_verify_per_byte: Option<u64>,
1429
1430 max_type_to_layout_nodes: Option<u64>,
1432
1433 max_ptb_value_size: Option<u64>,
1435
1436 gas_model_version: Option<u64>,
1439
1440 obj_data_cost_refundable: Option<u64>,
1443
1444 obj_metadata_cost_non_refundable: Option<u64>,
1448
1449 storage_rebate_rate: Option<u64>,
1455
1456 storage_fund_reinvest_rate: Option<u64>,
1459
1460 reward_slashing_rate: Option<u64>,
1463
1464 storage_gas_price: Option<u64>,
1466
1467 accumulator_object_storage_cost: Option<u64>,
1469
1470 max_transactions_per_checkpoint: Option<u64>,
1475
1476 max_checkpoint_size_bytes: Option<u64>,
1480
1481 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1486
1487 address_from_bytes_cost_base: Option<u64>,
1492 address_to_u256_cost_base: Option<u64>,
1494 address_from_u256_cost_base: Option<u64>,
1496
1497 config_read_setting_impl_cost_base: Option<u64>,
1502 config_read_setting_impl_cost_per_byte: Option<u64>,
1503
1504 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1507 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1508 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1509 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1510 dynamic_field_add_child_object_cost_base: Option<u64>,
1512 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1513 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1514 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1515 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1517 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1518 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1519 dynamic_field_remove_child_object_cost_base: Option<u64>,
1521 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1522 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1523 dynamic_field_has_child_object_cost_base: Option<u64>,
1525 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1527 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1528 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1529
1530 event_emit_cost_base: Option<u64>,
1533 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1534 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1535 event_emit_output_cost_per_byte: Option<u64>,
1536 event_emit_auth_stream_cost: Option<u64>,
1537
1538 object_borrow_uid_cost_base: Option<u64>,
1541 object_delete_impl_cost_base: Option<u64>,
1543 object_record_new_uid_cost_base: Option<u64>,
1545
1546 transfer_transfer_internal_cost_base: Option<u64>,
1549 transfer_party_transfer_internal_cost_base: Option<u64>,
1551 transfer_freeze_object_cost_base: Option<u64>,
1553 transfer_share_object_cost_base: Option<u64>,
1555 transfer_receive_object_cost_base: Option<u64>,
1558 transfer_receive_object_cost_per_byte: Option<u64>,
1559 transfer_receive_object_type_cost_per_byte: Option<u64>,
1560
1561 tx_context_derive_id_cost_base: Option<u64>,
1564 tx_context_fresh_id_cost_base: Option<u64>,
1565 tx_context_sender_cost_base: Option<u64>,
1566 tx_context_epoch_cost_base: Option<u64>,
1567 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1568 tx_context_sponsor_cost_base: Option<u64>,
1569 tx_context_rgp_cost_base: Option<u64>,
1570 tx_context_gas_price_cost_base: Option<u64>,
1571 tx_context_gas_budget_cost_base: Option<u64>,
1572 tx_context_ids_created_cost_base: Option<u64>,
1573 tx_context_replace_cost_base: Option<u64>,
1574
1575 types_is_one_time_witness_cost_base: Option<u64>,
1578 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1579 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1580
1581 validator_validate_metadata_cost_base: Option<u64>,
1584 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1585
1586 crypto_invalid_arguments_cost: Option<u64>,
1588 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1590 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1591 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1592
1593 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1595 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1596 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1597
1598 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1600 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1601 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1602 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1603 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1604 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1605
1606 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1608
1609 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1611 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1612 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1613 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1614 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1615 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1616
1617 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1619 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1620 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1621 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1622 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1623 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1624
1625 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1627 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1628 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1629 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1630 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1631 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1632
1633 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1635 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1636 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1637
1638 ed25519_ed25519_verify_cost_base: Option<u64>,
1640 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1641 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1642
1643 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1645 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1646
1647 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1649 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1650 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1651 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1652 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1653
1654 hash_blake2b256_cost_base: Option<u64>,
1656 hash_blake2b256_data_cost_per_byte: Option<u64>,
1657 hash_blake2b256_data_cost_per_block: Option<u64>,
1658
1659 hash_keccak256_cost_base: Option<u64>,
1661 hash_keccak256_data_cost_per_byte: Option<u64>,
1662 hash_keccak256_data_cost_per_block: Option<u64>,
1663
1664 poseidon_bn254_cost_base: Option<u64>,
1666 poseidon_bn254_cost_per_block: Option<u64>,
1667
1668 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1670 group_ops_bls12381_decode_g1_cost: Option<u64>,
1671 group_ops_bls12381_decode_g2_cost: Option<u64>,
1672 group_ops_bls12381_decode_gt_cost: Option<u64>,
1673 group_ops_bls12381_scalar_add_cost: Option<u64>,
1674 group_ops_bls12381_g1_add_cost: Option<u64>,
1675 group_ops_bls12381_g2_add_cost: Option<u64>,
1676 group_ops_bls12381_gt_add_cost: Option<u64>,
1677 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1678 group_ops_bls12381_g1_sub_cost: Option<u64>,
1679 group_ops_bls12381_g2_sub_cost: Option<u64>,
1680 group_ops_bls12381_gt_sub_cost: Option<u64>,
1681 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1682 group_ops_bls12381_g1_mul_cost: Option<u64>,
1683 group_ops_bls12381_g2_mul_cost: Option<u64>,
1684 group_ops_bls12381_gt_mul_cost: Option<u64>,
1685 group_ops_bls12381_scalar_div_cost: Option<u64>,
1686 group_ops_bls12381_g1_div_cost: Option<u64>,
1687 group_ops_bls12381_g2_div_cost: Option<u64>,
1688 group_ops_bls12381_gt_div_cost: Option<u64>,
1689 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1690 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1691 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1692 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1693 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1694 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1695 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1696 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1697 group_ops_bls12381_msm_max_len: Option<u32>,
1698 group_ops_bls12381_pairing_cost: Option<u64>,
1699 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1700 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1701 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1702 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1703 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1704
1705 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1706 group_ops_ristretto_decode_point_cost: Option<u64>,
1707 group_ops_ristretto_scalar_add_cost: Option<u64>,
1708 group_ops_ristretto_point_add_cost: Option<u64>,
1709 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1710 group_ops_ristretto_point_sub_cost: Option<u64>,
1711 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1712 group_ops_ristretto_point_mul_cost: Option<u64>,
1713 group_ops_ristretto_scalar_div_cost: Option<u64>,
1714 group_ops_ristretto_point_div_cost: Option<u64>,
1715
1716 hmac_hmac_sha3_256_cost_base: Option<u64>,
1718 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1719 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1720
1721 check_zklogin_id_cost_base: Option<u64>,
1723 check_zklogin_issuer_cost_base: Option<u64>,
1725
1726 vdf_verify_vdf_cost: Option<u64>,
1727 vdf_hash_to_input_cost: Option<u64>,
1728
1729 nitro_attestation_parse_base_cost: Option<u64>,
1731 nitro_attestation_parse_cost_per_byte: Option<u64>,
1732 nitro_attestation_verify_base_cost: Option<u64>,
1733 nitro_attestation_verify_cost_per_cert: Option<u64>,
1734
1735 bcs_per_byte_serialized_cost: Option<u64>,
1737 bcs_legacy_min_output_size_cost: Option<u64>,
1738 bcs_failure_cost: Option<u64>,
1739
1740 hash_sha2_256_base_cost: Option<u64>,
1741 hash_sha2_256_per_byte_cost: Option<u64>,
1742 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1743 hash_sha3_256_base_cost: Option<u64>,
1744 hash_sha3_256_per_byte_cost: Option<u64>,
1745 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1746 type_name_get_base_cost: Option<u64>,
1747 type_name_get_per_byte_cost: Option<u64>,
1748 type_name_id_base_cost: Option<u64>,
1749
1750 string_check_utf8_base_cost: Option<u64>,
1751 string_check_utf8_per_byte_cost: Option<u64>,
1752 string_is_char_boundary_base_cost: Option<u64>,
1753 string_sub_string_base_cost: Option<u64>,
1754 string_sub_string_per_byte_cost: Option<u64>,
1755 string_index_of_base_cost: Option<u64>,
1756 string_index_of_per_byte_pattern_cost: Option<u64>,
1757 string_index_of_per_byte_searched_cost: Option<u64>,
1758
1759 vector_empty_base_cost: Option<u64>,
1760 vector_length_base_cost: Option<u64>,
1761 vector_push_back_base_cost: Option<u64>,
1762 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1763 vector_borrow_base_cost: Option<u64>,
1764 vector_pop_back_base_cost: Option<u64>,
1765 vector_destroy_empty_base_cost: Option<u64>,
1766 vector_swap_base_cost: Option<u64>,
1767 debug_print_base_cost: Option<u64>,
1768 debug_print_stack_trace_base_cost: Option<u64>,
1769
1770 execution_version: Option<u64>,
1779
1780 consensus_bad_nodes_stake_threshold: Option<u64>,
1784
1785 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1786 max_age_of_jwk_in_epochs: Option<u64>,
1790
1791 random_beacon_reduction_allowed_delta: Option<u16>,
1795
1796 random_beacon_reduction_lower_bound: Option<u32>,
1799
1800 random_beacon_dkg_timeout_round: Option<u32>,
1803
1804 random_beacon_min_round_interval_ms: Option<u64>,
1806
1807 random_beacon_dkg_version: Option<u64>,
1810
1811 consensus_max_transaction_size_bytes: Option<u64>,
1814 consensus_max_transactions_in_block_bytes: Option<u64>,
1816 consensus_max_num_transactions_in_block: Option<u64>,
1818
1819 consensus_voting_rounds: Option<u32>,
1821
1822 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1824
1825 max_deferral_rounds_for_congestion_control: Option<u64>,
1828
1829 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1831
1832 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1834
1835 min_checkpoint_interval_ms: Option<u64>,
1837
1838 checkpoint_summary_version_specific_data: Option<u64>,
1840
1841 max_soft_bundle_size: Option<u64>,
1843
1844 bridge_should_try_to_finalize_committee: Option<bool>,
1848
1849 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1855
1856 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1859
1860 consensus_gc_depth: Option<u32>,
1863
1864 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1866
1867 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1869
1870 sip_45_consensus_amplification_threshold: Option<u64>,
1873
1874 use_object_per_epoch_marker_table_v2: Option<bool>,
1877
1878 consensus_commit_rate_estimation_window_size: Option<u32>,
1880
1881 #[serde(skip_serializing_if = "Vec::is_empty")]
1885 aliased_addresses: Vec<AliasedAddress>,
1886
1887 translation_per_command_base_charge: Option<u64>,
1890
1891 translation_per_input_base_charge: Option<u64>,
1894
1895 translation_pure_input_per_byte_charge: Option<u64>,
1897
1898 translation_per_type_node_charge: Option<u64>,
1902
1903 translation_per_reference_node_charge: Option<u64>,
1906
1907 translation_per_linkage_entry_charge: Option<u64>,
1910
1911 max_updates_per_settlement_txn: Option<u32>,
1913
1914 gasless_max_computation_units: Option<u64>,
1916
1917 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1919
1920 gasless_max_unused_inputs: Option<u64>,
1924
1925 gasless_max_pure_input_bytes: Option<u64>,
1928}
1929
1930#[derive(Clone, Serialize, Deserialize, Debug)]
1932pub struct AliasedAddress {
1933 pub original: [u8; 32],
1935 pub aliased: [u8; 32],
1937 pub allowed_tx_digests: Vec<[u8; 32]>,
1939}
1940
1941impl ProtocolConfig {
1943 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
1956 if self.feature_flags.package_upgrades {
1957 Ok(())
1958 } else {
1959 Err(Error(format!(
1960 "package upgrades are not supported at {:?}",
1961 self.version
1962 )))
1963 }
1964 }
1965
1966 pub fn allow_receiving_object_id(&self) -> bool {
1967 self.feature_flags.allow_receiving_object_id
1968 }
1969
1970 pub fn receiving_objects_supported(&self) -> bool {
1971 self.feature_flags.receive_objects
1972 }
1973
1974 pub fn package_upgrades_supported(&self) -> bool {
1975 self.feature_flags.package_upgrades
1976 }
1977
1978 pub fn check_commit_root_state_digest_supported(&self) -> bool {
1979 self.feature_flags.commit_root_state_digest
1980 }
1981
1982 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
1983 self.feature_flags.advance_epoch_start_time_in_safe_mode
1984 }
1985
1986 pub fn loaded_child_objects_fixed(&self) -> bool {
1987 self.feature_flags.loaded_child_objects_fixed
1988 }
1989
1990 pub fn missing_type_is_compatibility_error(&self) -> bool {
1991 self.feature_flags.missing_type_is_compatibility_error
1992 }
1993
1994 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
1995 self.feature_flags.scoring_decision_with_validity_cutoff
1996 }
1997
1998 pub fn narwhal_versioned_metadata(&self) -> bool {
1999 self.feature_flags.narwhal_versioned_metadata
2000 }
2001
2002 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2003 self.feature_flags.consensus_order_end_of_epoch_last
2004 }
2005
2006 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2007 self.feature_flags.disallow_adding_abilities_on_upgrade
2008 }
2009
2010 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2011 self.feature_flags
2012 .disable_invariant_violation_check_in_swap_loc
2013 }
2014
2015 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2016 self.feature_flags
2017 .advance_to_highest_supported_protocol_version
2018 }
2019
2020 pub fn ban_entry_init(&self) -> bool {
2021 self.feature_flags.ban_entry_init
2022 }
2023
2024 pub fn package_digest_hash_module(&self) -> bool {
2025 self.feature_flags.package_digest_hash_module
2026 }
2027
2028 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2029 self.feature_flags
2030 .disallow_change_struct_type_params_on_upgrade
2031 }
2032
2033 pub fn no_extraneous_module_bytes(&self) -> bool {
2034 self.feature_flags.no_extraneous_module_bytes
2035 }
2036
2037 pub fn zklogin_auth(&self) -> bool {
2038 self.feature_flags.zklogin_auth
2039 }
2040
2041 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2042 &self.feature_flags.zklogin_supported_providers
2043 }
2044
2045 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2046 self.feature_flags.consensus_transaction_ordering
2047 }
2048
2049 pub fn simplified_unwrap_then_delete(&self) -> bool {
2050 self.feature_flags.simplified_unwrap_then_delete
2051 }
2052
2053 pub fn supports_upgraded_multisig(&self) -> bool {
2054 self.feature_flags.upgraded_multisig_supported
2055 }
2056
2057 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2058 self.feature_flags.txn_base_cost_as_multiplier
2059 }
2060
2061 pub fn shared_object_deletion(&self) -> bool {
2062 self.feature_flags.shared_object_deletion
2063 }
2064
2065 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2066 self.feature_flags.narwhal_new_leader_election_schedule
2067 }
2068
2069 pub fn loaded_child_object_format(&self) -> bool {
2070 self.feature_flags.loaded_child_object_format
2071 }
2072
2073 pub fn enable_jwk_consensus_updates(&self) -> bool {
2074 let ret = self.feature_flags.enable_jwk_consensus_updates;
2075 if ret {
2076 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2078 }
2079 ret
2080 }
2081
2082 pub fn simple_conservation_checks(&self) -> bool {
2083 self.feature_flags.simple_conservation_checks
2084 }
2085
2086 pub fn loaded_child_object_format_type(&self) -> bool {
2087 self.feature_flags.loaded_child_object_format_type
2088 }
2089
2090 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2091 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2092 if !ret {
2093 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2095 }
2096 ret
2097 }
2098
2099 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2100 self.feature_flags
2101 .recompute_has_public_transfer_in_execution
2102 }
2103
2104 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2106 self.enable_jwk_consensus_updates()
2107 }
2108
2109 pub fn random_beacon(&self) -> bool {
2110 self.feature_flags.random_beacon
2111 }
2112
2113 pub fn dkg_version(&self) -> u64 {
2114 self.random_beacon_dkg_version.unwrap_or(1)
2116 }
2117
2118 pub fn enable_bridge(&self) -> bool {
2119 let ret = self.feature_flags.bridge;
2120 if ret {
2121 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2123 }
2124 ret
2125 }
2126
2127 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2128 if !self.enable_bridge() {
2129 return false;
2130 }
2131 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2133 }
2134
2135 pub fn enable_effects_v2(&self) -> bool {
2136 self.feature_flags.enable_effects_v2
2137 }
2138
2139 pub fn narwhal_certificate_v2(&self) -> bool {
2140 self.feature_flags.narwhal_certificate_v2
2141 }
2142
2143 pub fn verify_legacy_zklogin_address(&self) -> bool {
2144 self.feature_flags.verify_legacy_zklogin_address
2145 }
2146
2147 pub fn accept_zklogin_in_multisig(&self) -> bool {
2148 self.feature_flags.accept_zklogin_in_multisig
2149 }
2150
2151 pub fn accept_passkey_in_multisig(&self) -> bool {
2152 self.feature_flags.accept_passkey_in_multisig
2153 }
2154
2155 pub fn validate_zklogin_public_identifier(&self) -> bool {
2156 self.feature_flags.validate_zklogin_public_identifier
2157 }
2158
2159 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2160 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2161 }
2162
2163 pub fn throughput_aware_consensus_submission(&self) -> bool {
2164 self.feature_flags.throughput_aware_consensus_submission
2165 }
2166
2167 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2168 self.feature_flags.include_consensus_digest_in_prologue
2169 }
2170
2171 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2172 self.feature_flags
2173 .record_consensus_determined_version_assignments_in_prologue
2174 }
2175
2176 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2177 self.feature_flags
2178 .record_additional_state_digest_in_prologue
2179 }
2180
2181 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2182 self.feature_flags
2183 .record_consensus_determined_version_assignments_in_prologue_v2
2184 }
2185
2186 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2187 self.feature_flags
2188 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2189 }
2190
2191 pub fn hardened_otw_check(&self) -> bool {
2192 self.feature_flags.hardened_otw_check
2193 }
2194
2195 pub fn enable_poseidon(&self) -> bool {
2196 self.feature_flags.enable_poseidon
2197 }
2198
2199 pub fn enable_coin_deny_list_v1(&self) -> bool {
2200 self.feature_flags.enable_coin_deny_list
2201 }
2202
2203 pub fn enable_accumulators(&self) -> bool {
2204 self.feature_flags.enable_accumulators
2205 }
2206
2207 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2208 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2209 }
2210
2211 pub fn create_root_accumulator_object(&self) -> bool {
2212 self.feature_flags.create_root_accumulator_object
2213 }
2214
2215 pub fn enable_address_balance_gas_payments(&self) -> bool {
2216 self.feature_flags.enable_address_balance_gas_payments
2217 }
2218
2219 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2220 self.feature_flags.address_balance_gas_check_rgp_at_signing
2221 }
2222
2223 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2224 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2225 }
2226
2227 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2228 self.feature_flags.enable_multi_epoch_transaction_expiration
2229 }
2230
2231 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2232 self.feature_flags.relax_valid_during_for_owned_inputs
2233 }
2234
2235 pub fn enable_authenticated_event_streams(&self) -> bool {
2236 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2237 }
2238
2239 pub fn enable_non_exclusive_writes(&self) -> bool {
2240 self.feature_flags.enable_non_exclusive_writes
2241 }
2242
2243 pub fn enable_coin_registry(&self) -> bool {
2244 self.feature_flags.enable_coin_registry
2245 }
2246
2247 pub fn enable_display_registry(&self) -> bool {
2248 self.feature_flags.enable_display_registry
2249 }
2250
2251 pub fn enable_coin_deny_list_v2(&self) -> bool {
2252 self.feature_flags.enable_coin_deny_list_v2
2253 }
2254
2255 pub fn enable_group_ops_native_functions(&self) -> bool {
2256 self.feature_flags.enable_group_ops_native_functions
2257 }
2258
2259 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2260 self.feature_flags.enable_group_ops_native_function_msm
2261 }
2262
2263 pub fn enable_ristretto255_group_ops(&self) -> bool {
2264 self.feature_flags.enable_ristretto255_group_ops
2265 }
2266
2267 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2268 self.feature_flags.reject_mutable_random_on_entry_functions
2269 }
2270
2271 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2272 self.feature_flags.per_object_congestion_control_mode
2273 }
2274
2275 pub fn consensus_choice(&self) -> ConsensusChoice {
2276 self.feature_flags.consensus_choice
2277 }
2278
2279 pub fn consensus_network(&self) -> ConsensusNetwork {
2280 self.feature_flags.consensus_network
2281 }
2282
2283 pub fn correct_gas_payment_limit_check(&self) -> bool {
2284 self.feature_flags.correct_gas_payment_limit_check
2285 }
2286
2287 pub fn reshare_at_same_initial_version(&self) -> bool {
2288 self.feature_flags.reshare_at_same_initial_version
2289 }
2290
2291 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2292 self.feature_flags.resolve_abort_locations_to_package_id
2293 }
2294
2295 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2296 self.feature_flags.mysticeti_use_committed_subdag_digest
2297 }
2298
2299 pub fn enable_vdf(&self) -> bool {
2300 self.feature_flags.enable_vdf
2301 }
2302
2303 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2304 self.feature_flags.fresh_vm_on_framework_upgrade
2305 }
2306
2307 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2308 self.feature_flags.mysticeti_num_leaders_per_round
2309 }
2310
2311 pub fn soft_bundle(&self) -> bool {
2312 self.feature_flags.soft_bundle
2313 }
2314
2315 pub fn passkey_auth(&self) -> bool {
2316 self.feature_flags.passkey_auth
2317 }
2318
2319 pub fn authority_capabilities_v2(&self) -> bool {
2320 self.feature_flags.authority_capabilities_v2
2321 }
2322
2323 pub fn max_transaction_size_bytes(&self) -> u64 {
2324 self.consensus_max_transaction_size_bytes
2326 .unwrap_or(256 * 1024)
2327 }
2328
2329 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2330 if cfg!(msim) {
2331 256 * 1024
2332 } else {
2333 self.consensus_max_transactions_in_block_bytes
2334 .unwrap_or(512 * 1024)
2335 }
2336 }
2337
2338 pub fn max_num_transactions_in_block(&self) -> u64 {
2339 if cfg!(msim) {
2340 8
2341 } else {
2342 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2343 }
2344 }
2345
2346 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2347 self.feature_flags.rethrow_serialization_type_layout_errors
2348 }
2349
2350 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2351 self.feature_flags
2352 .consensus_distributed_vote_scoring_strategy
2353 }
2354
2355 pub fn consensus_round_prober(&self) -> bool {
2356 self.feature_flags.consensus_round_prober
2357 }
2358
2359 pub fn validate_identifier_inputs(&self) -> bool {
2360 self.feature_flags.validate_identifier_inputs
2361 }
2362
2363 pub fn gc_depth(&self) -> u32 {
2364 self.consensus_gc_depth.unwrap_or(0)
2365 }
2366
2367 pub fn mysticeti_fastpath(&self) -> bool {
2368 self.feature_flags.mysticeti_fastpath
2369 }
2370
2371 pub fn relocate_event_module(&self) -> bool {
2372 self.feature_flags.relocate_event_module
2373 }
2374
2375 pub fn uncompressed_g1_group_elements(&self) -> bool {
2376 self.feature_flags.uncompressed_g1_group_elements
2377 }
2378
2379 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2380 self.feature_flags
2381 .disallow_new_modules_in_deps_only_packages
2382 }
2383
2384 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2385 self.feature_flags.consensus_smart_ancestor_selection
2386 }
2387
2388 pub fn disable_preconsensus_locking(&self) -> bool {
2389 self.feature_flags.disable_preconsensus_locking
2390 }
2391
2392 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2393 self.feature_flags
2394 .consensus_round_prober_probe_accepted_rounds
2395 }
2396
2397 pub fn native_charging_v2(&self) -> bool {
2398 self.feature_flags.native_charging_v2
2399 }
2400
2401 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2402 let res = self.feature_flags.consensus_linearize_subdag_v2;
2403 assert!(
2404 !res || self.gc_depth() > 0,
2405 "The consensus linearize sub dag V2 requires GC to be enabled"
2406 );
2407 res
2408 }
2409
2410 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2411 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2412 assert!(
2413 !res || self.gc_depth() > 0,
2414 "The consensus median based commit timestamp requires GC to be enabled"
2415 );
2416 res
2417 }
2418
2419 pub fn consensus_batched_block_sync(&self) -> bool {
2420 self.feature_flags.consensus_batched_block_sync
2421 }
2422
2423 pub fn convert_type_argument_error(&self) -> bool {
2424 self.feature_flags.convert_type_argument_error
2425 }
2426
2427 pub fn variant_nodes(&self) -> bool {
2428 self.feature_flags.variant_nodes
2429 }
2430
2431 pub fn consensus_zstd_compression(&self) -> bool {
2432 self.feature_flags.consensus_zstd_compression
2433 }
2434
2435 pub fn enable_nitro_attestation(&self) -> bool {
2436 self.feature_flags.enable_nitro_attestation
2437 }
2438
2439 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2440 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2441 }
2442
2443 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2444 self.feature_flags
2445 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2446 }
2447
2448 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2449 self.feature_flags
2450 .enable_nitro_attestation_always_include_required_pcrs_parsing
2451 }
2452
2453 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2454 self.consensus_commit_rate_estimation_window_size
2455 .unwrap_or(0)
2456 }
2457
2458 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2459 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2463 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2465 window_size
2466 }
2467
2468 pub fn minimize_child_object_mutations(&self) -> bool {
2469 self.feature_flags.minimize_child_object_mutations
2470 }
2471
2472 pub fn move_native_context(&self) -> bool {
2473 self.feature_flags.move_native_context
2474 }
2475
2476 pub fn normalize_ptb_arguments(&self) -> bool {
2477 self.feature_flags.normalize_ptb_arguments
2478 }
2479
2480 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2481 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2482 }
2483
2484 pub fn max_ptb_value_size_v2(&self) -> bool {
2485 self.feature_flags.max_ptb_value_size_v2
2486 }
2487
2488 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2489 self.feature_flags.resolve_type_input_ids_to_defining_id
2490 }
2491
2492 pub fn enable_party_transfer(&self) -> bool {
2493 self.feature_flags.enable_party_transfer
2494 }
2495
2496 pub fn allow_unbounded_system_objects(&self) -> bool {
2497 self.feature_flags.allow_unbounded_system_objects
2498 }
2499
2500 pub fn type_tags_in_object_runtime(&self) -> bool {
2501 self.feature_flags.type_tags_in_object_runtime
2502 }
2503
2504 pub fn enable_ptb_execution_v2(&self) -> bool {
2505 self.feature_flags.enable_ptb_execution_v2
2506 }
2507
2508 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2509 self.feature_flags.better_adapter_type_resolution_errors
2510 }
2511
2512 pub fn record_time_estimate_processed(&self) -> bool {
2513 self.feature_flags.record_time_estimate_processed
2514 }
2515
2516 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2517 self.feature_flags
2518 .ignore_execution_time_observations_after_certs_closed
2519 }
2520
2521 pub fn dependency_linkage_error(&self) -> bool {
2522 self.feature_flags.dependency_linkage_error
2523 }
2524
2525 pub fn additional_multisig_checks(&self) -> bool {
2526 self.feature_flags.additional_multisig_checks
2527 }
2528
2529 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2530 self.feature_flags.debug_fatal_on_move_invariant_violation
2531 }
2532
2533 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2534 self.feature_flags.allow_private_accumulator_entrypoints
2535 }
2536
2537 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2538 self.feature_flags
2539 .additional_consensus_digest_indirect_state
2540 }
2541
2542 pub fn check_for_init_during_upgrade(&self) -> bool {
2543 self.feature_flags.check_for_init_during_upgrade
2544 }
2545
2546 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2547 self.feature_flags.per_command_shared_object_transfer_rules
2548 }
2549
2550 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2551 self.feature_flags
2552 .consensus_checkpoint_signature_key_includes_digest
2553 }
2554
2555 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2556 self.feature_flags
2557 .include_checkpoint_artifacts_digest_in_summary
2558 }
2559
2560 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2561 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2562 }
2563
2564 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2565 self.feature_flags.cancel_for_failed_dkg_early
2566 }
2567
2568 pub fn abstract_size_in_object_runtime(&self) -> bool {
2569 self.feature_flags.abstract_size_in_object_runtime
2570 }
2571
2572 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2573 self.feature_flags.object_runtime_charge_cache_load_gas
2574 }
2575
2576 pub fn additional_borrow_checks(&self) -> bool {
2577 self.feature_flags.additional_borrow_checks
2578 }
2579
2580 pub fn use_new_commit_handler(&self) -> bool {
2581 self.feature_flags.use_new_commit_handler
2582 }
2583
2584 pub fn better_loader_errors(&self) -> bool {
2585 self.feature_flags.better_loader_errors
2586 }
2587
2588 pub fn generate_df_type_layouts(&self) -> bool {
2589 self.feature_flags.generate_df_type_layouts
2590 }
2591
2592 pub fn allow_references_in_ptbs(&self) -> bool {
2593 self.feature_flags.allow_references_in_ptbs
2594 }
2595
2596 pub fn private_generics_verifier_v2(&self) -> bool {
2597 self.feature_flags.private_generics_verifier_v2
2598 }
2599
2600 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2601 self.feature_flags
2602 .deprecate_global_storage_ops_during_deserialization
2603 }
2604
2605 pub fn enable_observation_chunking(&self) -> bool {
2606 matches!(self.feature_flags.per_object_congestion_control_mode,
2607 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2608 if params.observations_chunk_size.is_some()
2609 )
2610 }
2611
2612 pub fn deprecate_global_storage_ops(&self) -> bool {
2613 self.feature_flags.deprecate_global_storage_ops
2614 }
2615
2616 pub fn normalize_depth_formula(&self) -> bool {
2617 self.feature_flags.normalize_depth_formula
2618 }
2619
2620 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2621 self.feature_flags.consensus_skip_gced_accept_votes
2622 }
2623
2624 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2625 self.feature_flags
2626 .include_cancelled_randomness_txns_in_prologue
2627 }
2628
2629 pub fn address_aliases(&self) -> bool {
2630 let address_aliases = self.feature_flags.address_aliases;
2631 assert!(
2632 !address_aliases || self.mysticeti_fastpath(),
2633 "Address aliases requires Mysticeti fastpath to be enabled"
2634 );
2635 if address_aliases {
2636 assert!(
2637 self.feature_flags.disable_preconsensus_locking,
2638 "Address aliases requires CertifiedTransaction to be disabled"
2639 );
2640 }
2641 address_aliases
2642 }
2643
2644 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2645 self.feature_flags.fix_checkpoint_signature_mapping
2646 }
2647
2648 pub fn enable_object_funds_withdraw(&self) -> bool {
2649 self.feature_flags.enable_object_funds_withdraw
2650 }
2651
2652 pub fn gas_rounding_halve_digits(&self) -> bool {
2653 self.feature_flags.gas_rounding_halve_digits
2654 }
2655
2656 pub fn flexible_tx_context_positions(&self) -> bool {
2657 self.feature_flags.flexible_tx_context_positions
2658 }
2659
2660 pub fn disable_entry_point_signature_check(&self) -> bool {
2661 self.feature_flags.disable_entry_point_signature_check
2662 }
2663
2664 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2665 self.feature_flags
2666 .consensus_skip_gced_blocks_in_direct_finalization
2667 }
2668
2669 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2670 self.feature_flags
2671 .convert_withdrawal_compatibility_ptb_arguments
2672 }
2673
2674 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2675 self.feature_flags.restrict_hot_or_not_entry_functions
2676 }
2677
2678 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2679 self.feature_flags.split_checkpoints_in_consensus_handler
2680 }
2681
2682 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2683 self.feature_flags
2684 .consensus_always_accept_system_transactions
2685 }
2686
2687 pub fn validator_metadata_verify_v2(&self) -> bool {
2688 self.feature_flags.validator_metadata_verify_v2
2689 }
2690
2691 pub fn defer_unpaid_amplification(&self) -> bool {
2692 self.feature_flags.defer_unpaid_amplification
2693 }
2694
2695 pub fn gasless_transaction_drop_safety(&self) -> bool {
2696 self.feature_flags.gasless_transaction_drop_safety
2697 }
2698
2699 pub fn new_vm_enabled(&self) -> bool {
2700 self.execution_version.is_some_and(|v| v >= 4)
2701 }
2702
2703 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2704 self.feature_flags.merge_randomness_into_checkpoint
2705 }
2706
2707 pub fn use_coin_party_owner(&self) -> bool {
2708 self.feature_flags.use_coin_party_owner
2709 }
2710
2711 pub fn enable_gasless(&self) -> bool {
2712 self.feature_flags.enable_gasless
2713 }
2714
2715 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2716 debug_assert!(self.gasless_allowed_token_types.is_some());
2717 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2718 }
2719
2720 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2721 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2722 }
2723
2724 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2725 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2726 }
2727}
2728
2729#[cfg(not(msim))]
2730static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2731
2732#[cfg(msim)]
2734thread_local! {
2735 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2736}
2737
2738impl ProtocolConfig {
2740 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2742 assert!(
2744 version >= ProtocolVersion::MIN,
2745 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2746 version,
2747 ProtocolVersion::MIN.0,
2748 );
2749 assert!(
2750 version <= ProtocolVersion::MAX_ALLOWED,
2751 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2752 version,
2753 ProtocolVersion::MAX_ALLOWED.0,
2754 );
2755
2756 let mut ret = Self::get_for_version_impl(version, chain);
2757 ret.version = version;
2758
2759 ret = CONFIG_OVERRIDE.with(|ovr| {
2760 if let Some(override_fn) = &*ovr.borrow() {
2761 warn!(
2762 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
2763 );
2764 override_fn(version, ret)
2765 } else {
2766 ret
2767 }
2768 });
2769
2770 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2771 warn!(
2772 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2773 );
2774 let overrides: ProtocolConfigOptional =
2775 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2776 .expect("failed to parse ProtocolConfig override env variables");
2777 overrides.apply_to(&mut ret);
2778 }
2779
2780 ret
2781 }
2782
2783 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2786 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2787 let mut ret = Self::get_for_version_impl(version, chain);
2788 ret.version = version;
2789 Some(ret)
2790 } else {
2791 None
2792 }
2793 }
2794
2795 #[cfg(not(msim))]
2796 pub fn poison_get_for_min_version() {
2797 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2798 }
2799
2800 #[cfg(not(msim))]
2801 fn load_poison_get_for_min_version() -> bool {
2802 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2803 }
2804
2805 #[cfg(msim)]
2806 pub fn poison_get_for_min_version() {
2807 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2808 }
2809
2810 #[cfg(msim)]
2811 fn load_poison_get_for_min_version() -> bool {
2812 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2813 }
2814
2815 pub fn get_for_min_version() -> Self {
2818 if Self::load_poison_get_for_min_version() {
2819 panic!("get_for_min_version called on validator");
2820 }
2821 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2822 }
2823
2824 #[allow(non_snake_case)]
2834 pub fn get_for_max_version_UNSAFE() -> Self {
2835 if Self::load_poison_get_for_min_version() {
2836 panic!("get_for_max_version_UNSAFE called on validator");
2837 }
2838 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2839 }
2840
2841 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2842 #[cfg(msim)]
2843 {
2844 if version == ProtocolVersion::MAX_ALLOWED {
2846 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2847 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2848 return config;
2849 }
2850 }
2851
2852 let mut cfg = Self {
2855 version,
2857
2858 feature_flags: Default::default(),
2860
2861 max_tx_size_bytes: Some(128 * 1024),
2862 max_input_objects: Some(2048),
2864 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2865 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2866 max_gas_payment_objects: Some(256),
2867 max_modules_in_publish: Some(128),
2868 max_package_dependencies: None,
2869 max_arguments: Some(512),
2870 max_type_arguments: Some(16),
2871 max_type_argument_depth: Some(16),
2872 max_pure_argument_size: Some(16 * 1024),
2873 max_programmable_tx_commands: Some(1024),
2874 move_binary_format_version: Some(6),
2875 min_move_binary_format_version: None,
2876 binary_module_handles: None,
2877 binary_struct_handles: None,
2878 binary_function_handles: None,
2879 binary_function_instantiations: None,
2880 binary_signatures: None,
2881 binary_constant_pool: None,
2882 binary_identifiers: None,
2883 binary_address_identifiers: None,
2884 binary_struct_defs: None,
2885 binary_struct_def_instantiations: None,
2886 binary_function_defs: None,
2887 binary_field_handles: None,
2888 binary_field_instantiations: None,
2889 binary_friend_decls: None,
2890 binary_enum_defs: None,
2891 binary_enum_def_instantiations: None,
2892 binary_variant_handles: None,
2893 binary_variant_instantiation_handles: None,
2894 max_move_object_size: Some(250 * 1024),
2895 max_move_package_size: Some(100 * 1024),
2896 max_publish_or_upgrade_per_ptb: None,
2897 max_tx_gas: Some(10_000_000_000),
2898 max_gas_price: Some(100_000),
2899 max_gas_price_rgp_factor_for_aborted_transactions: None,
2900 max_gas_computation_bucket: Some(5_000_000),
2901 max_loop_depth: Some(5),
2902 max_generic_instantiation_length: Some(32),
2903 max_function_parameters: Some(128),
2904 max_basic_blocks: Some(1024),
2905 max_value_stack_size: Some(1024),
2906 max_type_nodes: Some(256),
2907 max_push_size: Some(10000),
2908 max_struct_definitions: Some(200),
2909 max_function_definitions: Some(1000),
2910 max_fields_in_struct: Some(32),
2911 max_dependency_depth: Some(100),
2912 max_num_event_emit: Some(256),
2913 max_num_new_move_object_ids: Some(2048),
2914 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2915 max_num_deleted_move_object_ids: Some(2048),
2916 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2917 max_num_transferred_move_object_ids: Some(2048),
2918 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2919 max_event_emit_size: Some(250 * 1024),
2920 max_move_vector_len: Some(256 * 1024),
2921 max_type_to_layout_nodes: None,
2922 max_ptb_value_size: None,
2923
2924 max_back_edges_per_function: Some(10_000),
2925 max_back_edges_per_module: Some(10_000),
2926 max_verifier_meter_ticks_per_function: Some(6_000_000),
2927 max_meter_ticks_per_module: Some(6_000_000),
2928 max_meter_ticks_per_package: None,
2929
2930 object_runtime_max_num_cached_objects: Some(1000),
2931 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
2932 object_runtime_max_num_store_entries: Some(1000),
2933 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
2934 base_tx_cost_fixed: Some(110_000),
2935 package_publish_cost_fixed: Some(1_000),
2936 base_tx_cost_per_byte: Some(0),
2937 package_publish_cost_per_byte: Some(80),
2938 obj_access_cost_read_per_byte: Some(15),
2939 obj_access_cost_mutate_per_byte: Some(40),
2940 obj_access_cost_delete_per_byte: Some(40),
2941 obj_access_cost_verify_per_byte: Some(200),
2942 obj_data_cost_refundable: Some(100),
2943 obj_metadata_cost_non_refundable: Some(50),
2944 gas_model_version: Some(1),
2945 storage_rebate_rate: Some(9900),
2946 storage_fund_reinvest_rate: Some(500),
2947 reward_slashing_rate: Some(5000),
2948 storage_gas_price: Some(1),
2949 accumulator_object_storage_cost: None,
2950 max_transactions_per_checkpoint: Some(10_000),
2951 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
2952
2953 buffer_stake_for_protocol_upgrade_bps: Some(0),
2956
2957 address_from_bytes_cost_base: Some(52),
2961 address_to_u256_cost_base: Some(52),
2963 address_from_u256_cost_base: Some(52),
2965
2966 config_read_setting_impl_cost_base: None,
2969 config_read_setting_impl_cost_per_byte: None,
2970
2971 dynamic_field_hash_type_and_key_cost_base: Some(100),
2974 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
2975 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
2976 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
2977 dynamic_field_add_child_object_cost_base: Some(100),
2979 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
2980 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
2981 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
2982 dynamic_field_borrow_child_object_cost_base: Some(100),
2984 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
2985 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
2986 dynamic_field_remove_child_object_cost_base: Some(100),
2988 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
2989 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
2990 dynamic_field_has_child_object_cost_base: Some(100),
2992 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
2994 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
2995 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
2996
2997 event_emit_cost_base: Some(52),
3000 event_emit_value_size_derivation_cost_per_byte: Some(2),
3001 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3002 event_emit_output_cost_per_byte: Some(10),
3003 event_emit_auth_stream_cost: None,
3004
3005 object_borrow_uid_cost_base: Some(52),
3008 object_delete_impl_cost_base: Some(52),
3010 object_record_new_uid_cost_base: Some(52),
3012
3013 transfer_transfer_internal_cost_base: Some(52),
3016 transfer_party_transfer_internal_cost_base: None,
3018 transfer_freeze_object_cost_base: Some(52),
3020 transfer_share_object_cost_base: Some(52),
3022 transfer_receive_object_cost_base: None,
3023 transfer_receive_object_type_cost_per_byte: None,
3024 transfer_receive_object_cost_per_byte: None,
3025
3026 tx_context_derive_id_cost_base: Some(52),
3029 tx_context_fresh_id_cost_base: None,
3030 tx_context_sender_cost_base: None,
3031 tx_context_epoch_cost_base: None,
3032 tx_context_epoch_timestamp_ms_cost_base: None,
3033 tx_context_sponsor_cost_base: None,
3034 tx_context_rgp_cost_base: None,
3035 tx_context_gas_price_cost_base: None,
3036 tx_context_gas_budget_cost_base: None,
3037 tx_context_ids_created_cost_base: None,
3038 tx_context_replace_cost_base: None,
3039
3040 types_is_one_time_witness_cost_base: Some(52),
3043 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3044 types_is_one_time_witness_type_cost_per_byte: Some(2),
3045
3046 validator_validate_metadata_cost_base: Some(52),
3049 validator_validate_metadata_data_cost_per_byte: Some(2),
3050
3051 crypto_invalid_arguments_cost: Some(100),
3053 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3055 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3056 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3057
3058 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3060 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3061 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3062
3063 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3065 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3066 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3067 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3068 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3069 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3070
3071 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3073
3074 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3076 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3077 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3078 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3079 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3080 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3081
3082 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3084 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3085 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3086 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3087 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3088 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3089
3090 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3092 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3093 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3094 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3095 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3096 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3097
3098 ecvrf_ecvrf_verify_cost_base: Some(52),
3100 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3101 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3102
3103 ed25519_ed25519_verify_cost_base: Some(52),
3105 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3106 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3107
3108 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3110 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3111
3112 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3114 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3115 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3116 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3117 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3118
3119 hash_blake2b256_cost_base: Some(52),
3121 hash_blake2b256_data_cost_per_byte: Some(2),
3122 hash_blake2b256_data_cost_per_block: Some(2),
3123
3124 hash_keccak256_cost_base: Some(52),
3126 hash_keccak256_data_cost_per_byte: Some(2),
3127 hash_keccak256_data_cost_per_block: Some(2),
3128
3129 poseidon_bn254_cost_base: None,
3130 poseidon_bn254_cost_per_block: None,
3131
3132 hmac_hmac_sha3_256_cost_base: Some(52),
3134 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3135 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3136
3137 group_ops_bls12381_decode_scalar_cost: None,
3139 group_ops_bls12381_decode_g1_cost: None,
3140 group_ops_bls12381_decode_g2_cost: None,
3141 group_ops_bls12381_decode_gt_cost: None,
3142 group_ops_bls12381_scalar_add_cost: None,
3143 group_ops_bls12381_g1_add_cost: None,
3144 group_ops_bls12381_g2_add_cost: None,
3145 group_ops_bls12381_gt_add_cost: None,
3146 group_ops_bls12381_scalar_sub_cost: None,
3147 group_ops_bls12381_g1_sub_cost: None,
3148 group_ops_bls12381_g2_sub_cost: None,
3149 group_ops_bls12381_gt_sub_cost: None,
3150 group_ops_bls12381_scalar_mul_cost: None,
3151 group_ops_bls12381_g1_mul_cost: None,
3152 group_ops_bls12381_g2_mul_cost: None,
3153 group_ops_bls12381_gt_mul_cost: None,
3154 group_ops_bls12381_scalar_div_cost: None,
3155 group_ops_bls12381_g1_div_cost: None,
3156 group_ops_bls12381_g2_div_cost: None,
3157 group_ops_bls12381_gt_div_cost: None,
3158 group_ops_bls12381_g1_hash_to_base_cost: None,
3159 group_ops_bls12381_g2_hash_to_base_cost: None,
3160 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3161 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3162 group_ops_bls12381_g1_msm_base_cost: None,
3163 group_ops_bls12381_g2_msm_base_cost: None,
3164 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3165 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3166 group_ops_bls12381_msm_max_len: None,
3167 group_ops_bls12381_pairing_cost: None,
3168 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3169 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3170 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3171 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3172 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3173
3174 group_ops_ristretto_decode_scalar_cost: None,
3175 group_ops_ristretto_decode_point_cost: None,
3176 group_ops_ristretto_scalar_add_cost: None,
3177 group_ops_ristretto_point_add_cost: None,
3178 group_ops_ristretto_scalar_sub_cost: None,
3179 group_ops_ristretto_point_sub_cost: None,
3180 group_ops_ristretto_scalar_mul_cost: None,
3181 group_ops_ristretto_point_mul_cost: None,
3182 group_ops_ristretto_scalar_div_cost: None,
3183 group_ops_ristretto_point_div_cost: None,
3184
3185 check_zklogin_id_cost_base: None,
3187 check_zklogin_issuer_cost_base: None,
3189
3190 vdf_verify_vdf_cost: None,
3191 vdf_hash_to_input_cost: None,
3192
3193 nitro_attestation_parse_base_cost: None,
3195 nitro_attestation_parse_cost_per_byte: None,
3196 nitro_attestation_verify_base_cost: None,
3197 nitro_attestation_verify_cost_per_cert: None,
3198
3199 bcs_per_byte_serialized_cost: None,
3200 bcs_legacy_min_output_size_cost: None,
3201 bcs_failure_cost: None,
3202 hash_sha2_256_base_cost: None,
3203 hash_sha2_256_per_byte_cost: None,
3204 hash_sha2_256_legacy_min_input_len_cost: None,
3205 hash_sha3_256_base_cost: None,
3206 hash_sha3_256_per_byte_cost: None,
3207 hash_sha3_256_legacy_min_input_len_cost: None,
3208 type_name_get_base_cost: None,
3209 type_name_get_per_byte_cost: None,
3210 type_name_id_base_cost: None,
3211 string_check_utf8_base_cost: None,
3212 string_check_utf8_per_byte_cost: None,
3213 string_is_char_boundary_base_cost: None,
3214 string_sub_string_base_cost: None,
3215 string_sub_string_per_byte_cost: None,
3216 string_index_of_base_cost: None,
3217 string_index_of_per_byte_pattern_cost: None,
3218 string_index_of_per_byte_searched_cost: None,
3219 vector_empty_base_cost: None,
3220 vector_length_base_cost: None,
3221 vector_push_back_base_cost: None,
3222 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3223 vector_borrow_base_cost: None,
3224 vector_pop_back_base_cost: None,
3225 vector_destroy_empty_base_cost: None,
3226 vector_swap_base_cost: None,
3227 debug_print_base_cost: None,
3228 debug_print_stack_trace_base_cost: None,
3229
3230 max_size_written_objects: None,
3231 max_size_written_objects_system_tx: None,
3232
3233 max_move_identifier_len: None,
3240 max_move_value_depth: None,
3241 max_move_enum_variants: None,
3242
3243 gas_rounding_step: None,
3244
3245 execution_version: None,
3246
3247 max_event_emit_size_total: None,
3248
3249 consensus_bad_nodes_stake_threshold: None,
3250
3251 max_jwk_votes_per_validator_per_epoch: None,
3252
3253 max_age_of_jwk_in_epochs: None,
3254
3255 random_beacon_reduction_allowed_delta: None,
3256
3257 random_beacon_reduction_lower_bound: None,
3258
3259 random_beacon_dkg_timeout_round: None,
3260
3261 random_beacon_min_round_interval_ms: None,
3262
3263 random_beacon_dkg_version: None,
3264
3265 consensus_max_transaction_size_bytes: None,
3266
3267 consensus_max_transactions_in_block_bytes: None,
3268
3269 consensus_max_num_transactions_in_block: None,
3270
3271 consensus_voting_rounds: None,
3272
3273 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3274
3275 max_deferral_rounds_for_congestion_control: None,
3276
3277 max_txn_cost_overage_per_object_in_commit: None,
3278
3279 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3280
3281 min_checkpoint_interval_ms: None,
3282
3283 checkpoint_summary_version_specific_data: None,
3284
3285 max_soft_bundle_size: None,
3286
3287 bridge_should_try_to_finalize_committee: None,
3288
3289 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3290
3291 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3292
3293 consensus_gc_depth: None,
3294
3295 gas_budget_based_txn_cost_cap_factor: None,
3296
3297 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3298
3299 sip_45_consensus_amplification_threshold: None,
3300
3301 use_object_per_epoch_marker_table_v2: None,
3302
3303 consensus_commit_rate_estimation_window_size: None,
3304
3305 aliased_addresses: vec![],
3306
3307 translation_per_command_base_charge: None,
3308 translation_per_input_base_charge: None,
3309 translation_pure_input_per_byte_charge: None,
3310 translation_per_type_node_charge: None,
3311 translation_per_reference_node_charge: None,
3312 translation_per_linkage_entry_charge: None,
3313
3314 max_updates_per_settlement_txn: None,
3315
3316 gasless_max_computation_units: None,
3317 gasless_allowed_token_types: None,
3318 gasless_max_unused_inputs: None,
3319 gasless_max_pure_input_bytes: None,
3320 };
3323 for cur in 2..=version.0 {
3324 match cur {
3325 1 => unreachable!(),
3326 2 => {
3327 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3328 }
3329 3 => {
3330 cfg.gas_model_version = Some(2);
3332 cfg.max_tx_gas = Some(50_000_000_000);
3334 cfg.base_tx_cost_fixed = Some(2_000);
3336 cfg.storage_gas_price = Some(76);
3338 cfg.feature_flags.loaded_child_objects_fixed = true;
3339 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3342 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3345 cfg.feature_flags.package_upgrades = true;
3346 }
3347 4 => {
3352 cfg.reward_slashing_rate = Some(10000);
3354 cfg.gas_model_version = Some(3);
3356 }
3357 5 => {
3358 cfg.feature_flags.missing_type_is_compatibility_error = true;
3359 cfg.gas_model_version = Some(4);
3360 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3361 }
3365 6 => {
3366 cfg.gas_model_version = Some(5);
3367 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3368 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3369 }
3370 7 => {
3371 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3372 cfg.feature_flags
3373 .disable_invariant_violation_check_in_swap_loc = true;
3374 cfg.feature_flags.ban_entry_init = true;
3375 cfg.feature_flags.package_digest_hash_module = true;
3376 }
3377 8 => {
3378 cfg.feature_flags
3379 .disallow_change_struct_type_params_on_upgrade = true;
3380 }
3381 9 => {
3382 cfg.max_move_identifier_len = Some(128);
3384 cfg.feature_flags.no_extraneous_module_bytes = true;
3385 cfg.feature_flags
3386 .advance_to_highest_supported_protocol_version = true;
3387 }
3388 10 => {
3389 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3390 cfg.max_meter_ticks_per_module = Some(16_000_000);
3391 }
3392 11 => {
3393 cfg.max_move_value_depth = Some(128);
3394 }
3395 12 => {
3396 cfg.feature_flags.narwhal_versioned_metadata = true;
3397 if chain != Chain::Mainnet {
3398 cfg.feature_flags.commit_root_state_digest = true;
3399 }
3400
3401 if chain != Chain::Mainnet && chain != Chain::Testnet {
3402 cfg.feature_flags.zklogin_auth = true;
3403 }
3404 }
3405 13 => {}
3406 14 => {
3407 cfg.gas_rounding_step = Some(1_000);
3408 cfg.gas_model_version = Some(6);
3409 }
3410 15 => {
3411 cfg.feature_flags.consensus_transaction_ordering =
3412 ConsensusTransactionOrdering::ByGasPrice;
3413 }
3414 16 => {
3415 cfg.feature_flags.simplified_unwrap_then_delete = true;
3416 }
3417 17 => {
3418 cfg.feature_flags.upgraded_multisig_supported = true;
3419 }
3420 18 => {
3421 cfg.execution_version = Some(1);
3422 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3431 cfg.base_tx_cost_fixed = Some(1_000);
3433 }
3434 19 => {
3435 cfg.max_num_event_emit = Some(1024);
3436 cfg.max_event_emit_size_total = Some(
3439 256 * 250 * 1024, );
3441 }
3442 20 => {
3443 cfg.feature_flags.commit_root_state_digest = true;
3444
3445 if chain != Chain::Mainnet {
3446 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3447 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3448 }
3449 }
3450
3451 21 => {
3452 if chain != Chain::Mainnet {
3453 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3454 "Google".to_string(),
3455 "Facebook".to_string(),
3456 "Twitch".to_string(),
3457 ]);
3458 }
3459 }
3460 22 => {
3461 cfg.feature_flags.loaded_child_object_format = true;
3462 }
3463 23 => {
3464 cfg.feature_flags.loaded_child_object_format_type = true;
3465 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3466 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3472 }
3473 24 => {
3474 cfg.feature_flags.simple_conservation_checks = true;
3475 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3476
3477 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3478
3479 if chain != Chain::Mainnet {
3480 cfg.feature_flags.enable_jwk_consensus_updates = true;
3481 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3483 cfg.max_age_of_jwk_in_epochs = Some(1);
3484 }
3485 }
3486 25 => {
3487 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3489 "Google".to_string(),
3490 "Facebook".to_string(),
3491 "Twitch".to_string(),
3492 ]);
3493 cfg.feature_flags.zklogin_auth = true;
3494
3495 cfg.feature_flags.enable_jwk_consensus_updates = true;
3497 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3498 cfg.max_age_of_jwk_in_epochs = Some(1);
3499 }
3500 26 => {
3501 cfg.gas_model_version = Some(7);
3502 if chain != Chain::Mainnet && chain != Chain::Testnet {
3504 cfg.transfer_receive_object_cost_base = Some(52);
3505 cfg.feature_flags.receive_objects = true;
3506 }
3507 }
3508 27 => {
3509 cfg.gas_model_version = Some(8);
3510 }
3511 28 => {
3512 cfg.check_zklogin_id_cost_base = Some(200);
3514 cfg.check_zklogin_issuer_cost_base = Some(200);
3516
3517 if chain != Chain::Mainnet && chain != Chain::Testnet {
3519 cfg.feature_flags.enable_effects_v2 = true;
3520 }
3521 }
3522 29 => {
3523 cfg.feature_flags.verify_legacy_zklogin_address = true;
3524 }
3525 30 => {
3526 if chain != Chain::Mainnet {
3528 cfg.feature_flags.narwhal_certificate_v2 = true;
3529 }
3530
3531 cfg.random_beacon_reduction_allowed_delta = Some(800);
3532 if chain != Chain::Mainnet {
3534 cfg.feature_flags.enable_effects_v2 = true;
3535 }
3536
3537 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3541
3542 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3543 }
3544 31 => {
3545 cfg.execution_version = Some(2);
3546 if chain != Chain::Mainnet && chain != Chain::Testnet {
3548 cfg.feature_flags.shared_object_deletion = true;
3549 }
3550 }
3551 32 => {
3552 if chain != Chain::Mainnet {
3554 cfg.feature_flags.accept_zklogin_in_multisig = true;
3555 }
3556 if chain != Chain::Mainnet {
3558 cfg.transfer_receive_object_cost_base = Some(52);
3559 cfg.feature_flags.receive_objects = true;
3560 }
3561 if chain != Chain::Mainnet && chain != Chain::Testnet {
3563 cfg.feature_flags.random_beacon = true;
3564 cfg.random_beacon_reduction_lower_bound = Some(1600);
3565 cfg.random_beacon_dkg_timeout_round = Some(3000);
3566 cfg.random_beacon_min_round_interval_ms = Some(150);
3567 }
3568 if chain != Chain::Testnet && chain != Chain::Mainnet {
3570 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3571 }
3572
3573 cfg.feature_flags.narwhal_certificate_v2 = true;
3575 }
3576 33 => {
3577 cfg.feature_flags.hardened_otw_check = true;
3578 cfg.feature_flags.allow_receiving_object_id = true;
3579
3580 cfg.transfer_receive_object_cost_base = Some(52);
3582 cfg.feature_flags.receive_objects = true;
3583
3584 if chain != Chain::Mainnet {
3586 cfg.feature_flags.shared_object_deletion = true;
3587 }
3588
3589 cfg.feature_flags.enable_effects_v2 = true;
3590 }
3591 34 => {}
3592 35 => {
3593 if chain != Chain::Mainnet && chain != Chain::Testnet {
3595 cfg.feature_flags.enable_poseidon = true;
3596 cfg.poseidon_bn254_cost_base = Some(260);
3597 cfg.poseidon_bn254_cost_per_block = Some(10);
3598 }
3599
3600 cfg.feature_flags.enable_coin_deny_list = true;
3601 }
3602 36 => {
3603 if chain != Chain::Mainnet && chain != Chain::Testnet {
3605 cfg.feature_flags.enable_group_ops_native_functions = true;
3606 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3607 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3609 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3610 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3611 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3612 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3613 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3614 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3615 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3616 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3617 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3618 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3619 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3620 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3621 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3622 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3623 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3624 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3625 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3626 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3627 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3628 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3629 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3630 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3631 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3632 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3633 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3634 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3635 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3636 cfg.group_ops_bls12381_msm_max_len = Some(32);
3637 cfg.group_ops_bls12381_pairing_cost = Some(52);
3638 }
3639 cfg.feature_flags.shared_object_deletion = true;
3641
3642 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3644 }
3646 37 => {
3647 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3648
3649 if chain != Chain::Mainnet {
3651 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3652 }
3653 }
3654 38 => {
3655 cfg.binary_module_handles = Some(100);
3656 cfg.binary_struct_handles = Some(300);
3657 cfg.binary_function_handles = Some(1500);
3658 cfg.binary_function_instantiations = Some(750);
3659 cfg.binary_signatures = Some(1000);
3660 cfg.binary_constant_pool = Some(4000);
3664 cfg.binary_identifiers = Some(10000);
3665 cfg.binary_address_identifiers = Some(100);
3666 cfg.binary_struct_defs = Some(200);
3667 cfg.binary_struct_def_instantiations = Some(100);
3668 cfg.binary_function_defs = Some(1000);
3669 cfg.binary_field_handles = Some(500);
3670 cfg.binary_field_instantiations = Some(250);
3671 cfg.binary_friend_decls = Some(100);
3672 cfg.max_package_dependencies = Some(32);
3674 cfg.max_modules_in_publish = Some(64);
3675 cfg.execution_version = Some(3);
3677 }
3678 39 => {
3679 }
3681 40 => {}
3682 41 => {
3683 cfg.feature_flags.enable_group_ops_native_functions = true;
3685 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3687 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3688 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3689 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3690 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3691 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3692 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3693 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3694 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3695 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3696 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3697 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3698 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3699 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3700 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3701 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3702 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3703 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3704 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3705 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3706 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3707 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3708 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3709 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3710 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3711 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3712 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3713 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3714 cfg.group_ops_bls12381_msm_max_len = Some(32);
3715 cfg.group_ops_bls12381_pairing_cost = Some(52);
3716 }
3717 42 => {}
3718 43 => {
3719 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3720 cfg.max_meter_ticks_per_package = Some(16_000_000);
3721 }
3722 44 => {
3723 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3725 if chain != Chain::Mainnet {
3727 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3728 }
3729 }
3730 45 => {
3731 if chain != Chain::Testnet && chain != Chain::Mainnet {
3733 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3734 }
3735
3736 if chain != Chain::Mainnet {
3737 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3739 }
3740 cfg.min_move_binary_format_version = Some(6);
3741 cfg.feature_flags.accept_zklogin_in_multisig = true;
3742
3743 if chain != Chain::Mainnet && chain != Chain::Testnet {
3747 cfg.feature_flags.bridge = true;
3748 }
3749 }
3750 46 => {
3751 if chain != Chain::Mainnet {
3753 cfg.feature_flags.bridge = true;
3754 }
3755
3756 cfg.feature_flags.reshare_at_same_initial_version = true;
3758 }
3759 47 => {}
3760 48 => {
3761 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3763
3764 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3766
3767 if chain != Chain::Mainnet {
3769 cfg.feature_flags.random_beacon = true;
3770 cfg.random_beacon_reduction_lower_bound = Some(1600);
3771 cfg.random_beacon_dkg_timeout_round = Some(3000);
3772 cfg.random_beacon_min_round_interval_ms = Some(200);
3773 }
3774
3775 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3777 }
3778 49 => {
3779 if chain != Chain::Testnet && chain != Chain::Mainnet {
3780 cfg.move_binary_format_version = Some(7);
3781 }
3782
3783 if chain != Chain::Mainnet && chain != Chain::Testnet {
3785 cfg.feature_flags.enable_vdf = true;
3786 cfg.vdf_verify_vdf_cost = Some(1500);
3789 cfg.vdf_hash_to_input_cost = Some(100);
3790 }
3791
3792 if chain != Chain::Testnet && chain != Chain::Mainnet {
3794 cfg.feature_flags
3795 .record_consensus_determined_version_assignments_in_prologue = true;
3796 }
3797
3798 if chain != Chain::Mainnet {
3800 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3801 }
3802
3803 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3805 }
3806 50 => {
3807 if chain != Chain::Mainnet {
3809 cfg.checkpoint_summary_version_specific_data = Some(1);
3810 cfg.min_checkpoint_interval_ms = Some(200);
3811 }
3812
3813 if chain != Chain::Testnet && chain != Chain::Mainnet {
3815 cfg.feature_flags
3816 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3817 }
3818
3819 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3820
3821 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3823 }
3824 51 => {
3825 cfg.random_beacon_dkg_version = Some(1);
3826
3827 if chain != Chain::Testnet && chain != Chain::Mainnet {
3828 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3829 }
3830 }
3831 52 => {
3832 if chain != Chain::Mainnet {
3833 cfg.feature_flags.soft_bundle = true;
3834 cfg.max_soft_bundle_size = Some(5);
3835 }
3836
3837 cfg.config_read_setting_impl_cost_base = Some(100);
3838 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3839
3840 if chain != Chain::Testnet && chain != Chain::Mainnet {
3842 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3843 cfg.feature_flags.per_object_congestion_control_mode =
3844 PerObjectCongestionControlMode::TotalTxCount;
3845 }
3846
3847 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3849
3850 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3852
3853 cfg.checkpoint_summary_version_specific_data = Some(1);
3855 cfg.min_checkpoint_interval_ms = Some(200);
3856
3857 if chain != Chain::Mainnet {
3859 cfg.feature_flags
3860 .record_consensus_determined_version_assignments_in_prologue = true;
3861 cfg.feature_flags
3862 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3863 }
3864 if chain != Chain::Mainnet {
3866 cfg.move_binary_format_version = Some(7);
3867 }
3868
3869 if chain != Chain::Testnet && chain != Chain::Mainnet {
3870 cfg.feature_flags.passkey_auth = true;
3871 }
3872 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3873 }
3874 53 => {
3875 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3877
3878 cfg.feature_flags
3880 .record_consensus_determined_version_assignments_in_prologue = true;
3881 cfg.feature_flags
3882 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3883
3884 if chain == Chain::Unknown {
3885 cfg.feature_flags.authority_capabilities_v2 = true;
3886 }
3887
3888 if chain != Chain::Mainnet {
3890 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3891 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3892 cfg.feature_flags.per_object_congestion_control_mode =
3893 PerObjectCongestionControlMode::TotalTxCount;
3894 }
3895
3896 cfg.bcs_per_byte_serialized_cost = Some(2);
3898 cfg.bcs_legacy_min_output_size_cost = Some(1);
3899 cfg.bcs_failure_cost = Some(52);
3900 cfg.debug_print_base_cost = Some(52);
3901 cfg.debug_print_stack_trace_base_cost = Some(52);
3902 cfg.hash_sha2_256_base_cost = Some(52);
3903 cfg.hash_sha2_256_per_byte_cost = Some(2);
3904 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3905 cfg.hash_sha3_256_base_cost = Some(52);
3906 cfg.hash_sha3_256_per_byte_cost = Some(2);
3907 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3908 cfg.type_name_get_base_cost = Some(52);
3909 cfg.type_name_get_per_byte_cost = Some(2);
3910 cfg.string_check_utf8_base_cost = Some(52);
3911 cfg.string_check_utf8_per_byte_cost = Some(2);
3912 cfg.string_is_char_boundary_base_cost = Some(52);
3913 cfg.string_sub_string_base_cost = Some(52);
3914 cfg.string_sub_string_per_byte_cost = Some(2);
3915 cfg.string_index_of_base_cost = Some(52);
3916 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3917 cfg.string_index_of_per_byte_searched_cost = Some(2);
3918 cfg.vector_empty_base_cost = Some(52);
3919 cfg.vector_length_base_cost = Some(52);
3920 cfg.vector_push_back_base_cost = Some(52);
3921 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3922 cfg.vector_borrow_base_cost = Some(52);
3923 cfg.vector_pop_back_base_cost = Some(52);
3924 cfg.vector_destroy_empty_base_cost = Some(52);
3925 cfg.vector_swap_base_cost = Some(52);
3926 }
3927 54 => {
3928 cfg.feature_flags.random_beacon = true;
3930 cfg.random_beacon_reduction_lower_bound = Some(1000);
3931 cfg.random_beacon_dkg_timeout_round = Some(3000);
3932 cfg.random_beacon_min_round_interval_ms = Some(500);
3933
3934 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3936 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3937 cfg.feature_flags.per_object_congestion_control_mode =
3938 PerObjectCongestionControlMode::TotalTxCount;
3939
3940 cfg.feature_flags.soft_bundle = true;
3942 cfg.max_soft_bundle_size = Some(5);
3943 }
3944 55 => {
3945 cfg.move_binary_format_version = Some(7);
3947
3948 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
3950 cfg.consensus_max_num_transactions_in_block = Some(512);
3953
3954 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
3955 }
3956 56 => {
3957 if chain == Chain::Mainnet {
3958 cfg.feature_flags.bridge = true;
3959 }
3960 }
3961 57 => {
3962 cfg.random_beacon_reduction_lower_bound = Some(800);
3964 }
3965 58 => {
3966 if chain == Chain::Mainnet {
3967 cfg.bridge_should_try_to_finalize_committee = Some(true);
3968 }
3969
3970 if chain != Chain::Mainnet && chain != Chain::Testnet {
3971 cfg.feature_flags
3973 .consensus_distributed_vote_scoring_strategy = true;
3974 }
3975 }
3976 59 => {
3977 cfg.feature_flags.consensus_round_prober = true;
3979 }
3980 60 => {
3981 cfg.max_type_to_layout_nodes = Some(512);
3982 cfg.feature_flags.validate_identifier_inputs = true;
3983 }
3984 61 => {
3985 if chain != Chain::Mainnet {
3986 cfg.feature_flags
3988 .consensus_distributed_vote_scoring_strategy = true;
3989 }
3990 cfg.random_beacon_reduction_lower_bound = Some(700);
3992
3993 if chain != Chain::Mainnet && chain != Chain::Testnet {
3994 cfg.feature_flags.mysticeti_fastpath = true;
3996 }
3997 }
3998 62 => {
3999 cfg.feature_flags.relocate_event_module = true;
4000 }
4001 63 => {
4002 cfg.feature_flags.per_object_congestion_control_mode =
4003 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4004 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4005 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4006 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4007 }
4008 64 => {
4009 cfg.feature_flags.per_object_congestion_control_mode =
4010 PerObjectCongestionControlMode::TotalTxCount;
4011 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4012 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4013 }
4014 65 => {
4015 cfg.feature_flags
4017 .consensus_distributed_vote_scoring_strategy = true;
4018 }
4019 66 => {
4020 if chain == Chain::Mainnet {
4021 cfg.feature_flags
4023 .consensus_distributed_vote_scoring_strategy = false;
4024 }
4025 }
4026 67 => {
4027 cfg.feature_flags
4029 .consensus_distributed_vote_scoring_strategy = true;
4030 }
4031 68 => {
4032 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4033 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4034 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4035 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4036 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4037
4038 if chain != Chain::Mainnet && chain != Chain::Testnet {
4039 cfg.feature_flags.uncompressed_g1_group_elements = true;
4040 }
4041
4042 cfg.feature_flags.per_object_congestion_control_mode =
4043 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4044 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4045 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4046 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4047 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4049 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4050
4051 cfg.random_beacon_reduction_lower_bound = Some(500);
4053
4054 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4055 }
4056 69 => {
4057 cfg.consensus_voting_rounds = Some(40);
4059
4060 if chain != Chain::Mainnet && chain != Chain::Testnet {
4061 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4063 }
4064
4065 if chain != Chain::Mainnet {
4066 cfg.feature_flags.uncompressed_g1_group_elements = true;
4067 }
4068 }
4069 70 => {
4070 if chain != Chain::Mainnet {
4071 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4073 cfg.feature_flags
4075 .consensus_round_prober_probe_accepted_rounds = true;
4076 }
4077
4078 cfg.poseidon_bn254_cost_per_block = Some(388);
4079
4080 cfg.gas_model_version = Some(9);
4081 cfg.feature_flags.native_charging_v2 = true;
4082 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4083 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4084 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4085 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4086 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4087 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4088 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4089 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4090
4091 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4093 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4094 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4095 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4096
4097 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4098 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4099 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4100 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4101 Some(8213);
4102 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4103 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4104 Some(9484);
4105
4106 cfg.hash_keccak256_cost_base = Some(10);
4107 cfg.hash_blake2b256_cost_base = Some(10);
4108
4109 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4111 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4112 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4113 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4114
4115 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4116 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4117 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4118 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4119
4120 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4121 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4122 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4123 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4124
4125 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4126 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4127 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4128 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4129
4130 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4131 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4132 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4133 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4134
4135 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4136 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4137
4138 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4139 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4140 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4141 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4142
4143 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4144 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4145 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4146 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4147
4148 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4149 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4150
4151 cfg.validator_validate_metadata_cost_base = Some(20000);
4152 }
4153 71 => {
4154 cfg.sip_45_consensus_amplification_threshold = Some(5);
4155
4156 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4158 }
4159 72 => {
4160 cfg.feature_flags.convert_type_argument_error = true;
4161
4162 cfg.max_tx_gas = Some(50_000_000_000_000);
4165 cfg.max_gas_price = Some(50_000_000_000);
4167
4168 cfg.feature_flags.variant_nodes = true;
4169 }
4170 73 => {
4171 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4173
4174 if chain != Chain::Mainnet && chain != Chain::Testnet {
4175 cfg.consensus_gc_depth = Some(60);
4178 }
4179
4180 if chain != Chain::Mainnet {
4181 cfg.feature_flags.consensus_zstd_compression = true;
4183 }
4184
4185 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4187 cfg.feature_flags
4189 .consensus_round_prober_probe_accepted_rounds = true;
4190
4191 cfg.feature_flags.per_object_congestion_control_mode =
4193 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4194 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4195 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4196 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4197 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4199 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4200 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4201 }
4202 74 => {
4203 if chain != Chain::Mainnet && chain != Chain::Testnet {
4205 cfg.feature_flags.enable_nitro_attestation = true;
4206 }
4207 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4208 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4209 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4210 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4211
4212 cfg.feature_flags.consensus_zstd_compression = true;
4214
4215 if chain != Chain::Mainnet && chain != Chain::Testnet {
4216 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4217 }
4218 }
4219 75 => {
4220 if chain != Chain::Mainnet {
4221 cfg.feature_flags.passkey_auth = true;
4222 }
4223 }
4224 76 => {
4225 if chain != Chain::Mainnet && chain != Chain::Testnet {
4226 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4227 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4228 }
4229 cfg.feature_flags.minimize_child_object_mutations = true;
4230
4231 if chain != Chain::Mainnet {
4232 cfg.feature_flags.accept_passkey_in_multisig = true;
4233 }
4234 }
4235 77 => {
4236 cfg.feature_flags.uncompressed_g1_group_elements = true;
4237
4238 if chain != Chain::Mainnet {
4239 cfg.consensus_gc_depth = Some(60);
4240 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4241 }
4242 }
4243 78 => {
4244 cfg.feature_flags.move_native_context = true;
4245 cfg.tx_context_fresh_id_cost_base = Some(52);
4246 cfg.tx_context_sender_cost_base = Some(30);
4247 cfg.tx_context_epoch_cost_base = Some(30);
4248 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4249 cfg.tx_context_sponsor_cost_base = Some(30);
4250 cfg.tx_context_gas_price_cost_base = Some(30);
4251 cfg.tx_context_gas_budget_cost_base = Some(30);
4252 cfg.tx_context_ids_created_cost_base = Some(30);
4253 cfg.tx_context_replace_cost_base = Some(30);
4254 cfg.gas_model_version = Some(10);
4255
4256 if chain != Chain::Mainnet {
4257 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4258 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4259
4260 cfg.feature_flags.per_object_congestion_control_mode =
4262 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4263 ExecutionTimeEstimateParams {
4264 target_utilization: 30,
4265 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4267 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4269 stored_observations_limit: u64::MAX,
4270 stake_weighted_median_threshold: 0,
4271 default_none_duration_for_new_keys: false,
4272 observations_chunk_size: None,
4273 },
4274 );
4275 }
4276 }
4277 79 => {
4278 if chain != Chain::Mainnet {
4279 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4280
4281 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4284
4285 cfg.feature_flags.consensus_batched_block_sync = true;
4286
4287 cfg.feature_flags.enable_nitro_attestation = true
4289 }
4290 cfg.feature_flags.normalize_ptb_arguments = true;
4291
4292 cfg.consensus_gc_depth = Some(60);
4293 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4294 }
4295 80 => {
4296 cfg.max_ptb_value_size = Some(1024 * 1024);
4297 }
4298 81 => {
4299 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4300 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4301 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4302 }
4303 82 => {
4304 cfg.feature_flags.max_ptb_value_size_v2 = true;
4305 }
4306 83 => {
4307 if chain == Chain::Mainnet {
4308 let aliased: [u8; 32] = Hex::decode(
4310 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4311 )
4312 .unwrap()
4313 .try_into()
4314 .unwrap();
4315
4316 cfg.aliased_addresses.push(AliasedAddress {
4318 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4319 aliased,
4320 allowed_tx_digests: vec![
4321 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4322 ],
4323 });
4324
4325 cfg.aliased_addresses.push(AliasedAddress {
4326 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4327 aliased,
4328 allowed_tx_digests: vec![
4329 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4330 ],
4331 });
4332 }
4333
4334 if chain != Chain::Mainnet {
4337 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4338 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4339
4340 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4342 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4343 cfg.feature_flags.per_object_congestion_control_mode =
4344 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4345 ExecutionTimeEstimateParams {
4346 target_utilization: 30,
4347 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4349 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4351 stored_observations_limit: u64::MAX,
4352 stake_weighted_median_threshold: 0,
4353 default_none_duration_for_new_keys: false,
4354 observations_chunk_size: None,
4355 },
4356 );
4357
4358 cfg.feature_flags.consensus_batched_block_sync = true;
4360
4361 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4364 cfg.feature_flags.enable_nitro_attestation = true;
4365 }
4366 }
4367 84 => {
4368 if chain == Chain::Mainnet {
4369 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4370 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4371
4372 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4374 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4375 cfg.feature_flags.per_object_congestion_control_mode =
4376 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4377 ExecutionTimeEstimateParams {
4378 target_utilization: 30,
4379 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4381 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4383 stored_observations_limit: u64::MAX,
4384 stake_weighted_median_threshold: 0,
4385 default_none_duration_for_new_keys: false,
4386 observations_chunk_size: None,
4387 },
4388 );
4389
4390 cfg.feature_flags.consensus_batched_block_sync = true;
4392
4393 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4396 cfg.feature_flags.enable_nitro_attestation = true;
4397 }
4398
4399 cfg.feature_flags.per_object_congestion_control_mode =
4401 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4402 ExecutionTimeEstimateParams {
4403 target_utilization: 30,
4404 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4406 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4408 stored_observations_limit: 20,
4409 stake_weighted_median_threshold: 0,
4410 default_none_duration_for_new_keys: false,
4411 observations_chunk_size: None,
4412 },
4413 );
4414 cfg.feature_flags.allow_unbounded_system_objects = true;
4415 }
4416 85 => {
4417 if chain != Chain::Mainnet && chain != Chain::Testnet {
4418 cfg.feature_flags.enable_party_transfer = true;
4419 }
4420
4421 cfg.feature_flags
4422 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4423 cfg.feature_flags.disallow_self_identifier = true;
4424 cfg.feature_flags.per_object_congestion_control_mode =
4425 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4426 ExecutionTimeEstimateParams {
4427 target_utilization: 50,
4428 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4430 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4432 stored_observations_limit: 20,
4433 stake_weighted_median_threshold: 0,
4434 default_none_duration_for_new_keys: false,
4435 observations_chunk_size: None,
4436 },
4437 );
4438 }
4439 86 => {
4440 cfg.feature_flags.type_tags_in_object_runtime = true;
4441 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4442
4443 cfg.feature_flags.per_object_congestion_control_mode =
4445 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4446 ExecutionTimeEstimateParams {
4447 target_utilization: 50,
4448 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4450 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4452 stored_observations_limit: 20,
4453 stake_weighted_median_threshold: 3334,
4454 default_none_duration_for_new_keys: false,
4455 observations_chunk_size: None,
4456 },
4457 );
4458 if chain != Chain::Mainnet {
4460 cfg.feature_flags.enable_party_transfer = true;
4461 }
4462 }
4463 87 => {
4464 if chain == Chain::Mainnet {
4465 cfg.feature_flags.record_time_estimate_processed = true;
4466 }
4467 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4468 }
4469 88 => {
4470 cfg.feature_flags.record_time_estimate_processed = true;
4471 cfg.tx_context_rgp_cost_base = Some(30);
4472 cfg.feature_flags
4473 .ignore_execution_time_observations_after_certs_closed = true;
4474
4475 cfg.feature_flags.per_object_congestion_control_mode =
4478 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4479 ExecutionTimeEstimateParams {
4480 target_utilization: 50,
4481 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4483 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4485 stored_observations_limit: 20,
4486 stake_weighted_median_threshold: 3334,
4487 default_none_duration_for_new_keys: true,
4488 observations_chunk_size: None,
4489 },
4490 );
4491 }
4492 89 => {
4493 cfg.feature_flags.dependency_linkage_error = true;
4494 cfg.feature_flags.additional_multisig_checks = true;
4495 }
4496 90 => {
4497 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4499 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4500 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4501 cfg.feature_flags.accept_passkey_in_multisig = true;
4502 cfg.feature_flags.passkey_auth = true;
4503 cfg.feature_flags.check_for_init_during_upgrade = true;
4504
4505 if chain != Chain::Mainnet {
4507 cfg.feature_flags.mysticeti_fastpath = true;
4508 }
4509 }
4510 91 => {
4511 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4512 }
4513 92 => {
4514 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4515 }
4516 93 => {
4517 cfg.feature_flags
4518 .consensus_checkpoint_signature_key_includes_digest = true;
4519 }
4520 94 => {
4521 cfg.feature_flags.per_object_congestion_control_mode =
4523 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4524 ExecutionTimeEstimateParams {
4525 target_utilization: 50,
4526 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4528 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4530 stored_observations_limit: 18,
4531 stake_weighted_median_threshold: 3334,
4532 default_none_duration_for_new_keys: true,
4533 observations_chunk_size: None,
4534 },
4535 );
4536
4537 cfg.feature_flags.enable_party_transfer = true;
4539 }
4540 95 => {
4541 cfg.type_name_id_base_cost = Some(52);
4542
4543 cfg.max_transactions_per_checkpoint = Some(20_000);
4545 }
4546 96 => {
4547 if chain != Chain::Mainnet && chain != Chain::Testnet {
4549 cfg.feature_flags
4550 .include_checkpoint_artifacts_digest_in_summary = true;
4551 }
4552 cfg.feature_flags.correct_gas_payment_limit_check = true;
4553 cfg.feature_flags.authority_capabilities_v2 = true;
4554 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4555 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4556 cfg.feature_flags.enable_coin_registry = true;
4557
4558 cfg.feature_flags.mysticeti_fastpath = true;
4560 }
4561 97 => {
4562 cfg.feature_flags.additional_borrow_checks = true;
4563 }
4564 98 => {
4565 cfg.event_emit_auth_stream_cost = Some(52);
4566 cfg.feature_flags.better_loader_errors = true;
4567 cfg.feature_flags.generate_df_type_layouts = true;
4568 }
4569 99 => {
4570 cfg.feature_flags.use_new_commit_handler = true;
4571 }
4572 100 => {
4573 cfg.feature_flags.private_generics_verifier_v2 = true;
4574 }
4575 101 => {
4576 cfg.feature_flags.create_root_accumulator_object = true;
4577 cfg.max_updates_per_settlement_txn = Some(100);
4578 if chain != Chain::Mainnet {
4579 cfg.feature_flags.enable_poseidon = true;
4580 }
4581 }
4582 102 => {
4583 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: 180,
4595 stake_weighted_median_threshold: 3334,
4596 default_none_duration_for_new_keys: true,
4597 observations_chunk_size: Some(18),
4598 },
4599 );
4600 cfg.feature_flags.deprecate_global_storage_ops = true;
4601 }
4602 103 => {}
4603 104 => {
4604 cfg.translation_per_command_base_charge = Some(1);
4605 cfg.translation_per_input_base_charge = Some(1);
4606 cfg.translation_pure_input_per_byte_charge = Some(1);
4607 cfg.translation_per_type_node_charge = Some(1);
4608 cfg.translation_per_reference_node_charge = Some(1);
4609 cfg.translation_per_linkage_entry_charge = Some(10);
4610 cfg.gas_model_version = Some(11);
4611 cfg.feature_flags.abstract_size_in_object_runtime = true;
4612 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4613 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4614 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4615 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4616 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4617 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4618 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4619 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4620 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4621 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4622 cfg.feature_flags.enable_ptb_execution_v2 = true;
4623
4624 cfg.poseidon_bn254_cost_base = Some(260);
4625
4626 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4627
4628 if chain != Chain::Mainnet {
4629 cfg.feature_flags
4630 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4631 }
4632
4633 cfg.feature_flags
4634 .include_cancelled_randomness_txns_in_prologue = true;
4635 }
4636 105 => {
4637 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4638 cfg.feature_flags.disable_preconsensus_locking = true;
4639
4640 if chain != Chain::Mainnet {
4641 cfg.feature_flags
4642 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4643 }
4644 }
4645 106 => {
4646 cfg.accumulator_object_storage_cost = Some(7600);
4648
4649 if chain != Chain::Mainnet && chain != Chain::Testnet {
4650 cfg.feature_flags.enable_accumulators = true;
4651 cfg.feature_flags.enable_address_balance_gas_payments = true;
4652 cfg.feature_flags.enable_authenticated_event_streams = true;
4653 cfg.feature_flags.enable_object_funds_withdraw = true;
4654 }
4655 }
4656 107 => {
4657 cfg.feature_flags
4658 .consensus_skip_gced_blocks_in_direct_finalization = true;
4659
4660 if in_integration_test() {
4662 cfg.consensus_gc_depth = Some(6);
4663 cfg.consensus_max_num_transactions_in_block = Some(8);
4664 }
4665 }
4666 108 => {
4667 cfg.feature_flags.gas_rounding_halve_digits = true;
4668 cfg.feature_flags.flexible_tx_context_positions = true;
4669 cfg.feature_flags.disable_entry_point_signature_check = true;
4670
4671 if chain != Chain::Mainnet {
4672 cfg.feature_flags.address_aliases = true;
4673
4674 cfg.feature_flags.enable_accumulators = true;
4675 cfg.feature_flags.enable_address_balance_gas_payments = true;
4676 }
4677
4678 cfg.feature_flags.enable_poseidon = true;
4679 }
4680 109 => {
4681 cfg.binary_variant_handles = Some(1024);
4682 cfg.binary_variant_instantiation_handles = Some(1024);
4683 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4684 }
4685 110 => {
4686 cfg.feature_flags
4687 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4688 cfg.feature_flags
4689 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4690 if chain != Chain::Mainnet && chain != Chain::Testnet {
4691 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4692 }
4693 cfg.feature_flags.validate_zklogin_public_identifier = true;
4694 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4695 cfg.feature_flags
4696 .consensus_always_accept_system_transactions = true;
4697 if chain != Chain::Mainnet {
4698 cfg.feature_flags.enable_object_funds_withdraw = true;
4699 }
4700 }
4701 111 => {
4702 cfg.feature_flags.validator_metadata_verify_v2 = true;
4703 }
4704 112 => {
4705 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4706 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4707 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4708 cfg.group_ops_ristretto_point_add_cost = Some(500);
4709 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4710 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4711 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4712 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4713 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4714 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4715
4716 if chain != Chain::Mainnet && chain != Chain::Testnet {
4717 cfg.feature_flags.enable_ristretto255_group_ops = true;
4718 }
4719 }
4720 113 => {
4721 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4722 if chain != Chain::Mainnet && chain != Chain::Testnet {
4723 cfg.feature_flags.defer_unpaid_amplification = true;
4724 }
4725 }
4726 114 => {
4727 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4728 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4729 if chain != Chain::Mainnet {
4730 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4731 cfg.feature_flags.enable_authenticated_event_streams = true;
4732 cfg.feature_flags
4733 .include_checkpoint_artifacts_digest_in_summary = true;
4734 }
4735 }
4736 115 => {
4737 cfg.feature_flags.normalize_depth_formula = true;
4738 }
4739 116 => {
4740 cfg.feature_flags.gasless_transaction_drop_safety = true;
4741 cfg.feature_flags.address_aliases = true;
4742 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4743 cfg.feature_flags.defer_unpaid_amplification = false;
4745 cfg.feature_flags.enable_display_registry = true;
4746 }
4747 117 => {}
4748 118 => {
4749 cfg.feature_flags.use_coin_party_owner = true;
4750 }
4751 119 => {
4752 cfg.execution_version = Some(4);
4754 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4755 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4756 if chain != Chain::Mainnet {
4757 cfg.feature_flags.enable_gasless = true;
4758 cfg.gasless_max_computation_units = Some(50_000);
4759 cfg.gasless_allowed_token_types = Some(vec![]);
4760 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4761 cfg.feature_flags
4762 .convert_withdrawal_compatibility_ptb_arguments = true;
4763 }
4764 cfg.gasless_max_unused_inputs = Some(1);
4765 cfg.gasless_max_pure_input_bytes = Some(32);
4766 if chain == Chain::Testnet {
4767 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4768 }
4769 cfg.transfer_receive_object_cost_per_byte = Some(1);
4770 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4771 }
4772 120 => {
4773 if chain != Chain::Mainnet {
4775 cfg.feature_flags.defer_unpaid_amplification = true;
4776 }
4777 }
4778 _ => panic!("unsupported version {:?}", version),
4789 }
4790 }
4791
4792 cfg
4793 }
4794
4795 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4796 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4797 || !self.feature_flags.split_checkpoints_in_consensus_handler
4798 {
4799 return;
4800 }
4801
4802 if !mysten_common::in_test_configuration() {
4803 return;
4804 }
4805
4806 use rand::{Rng, SeedableRng, rngs::StdRng};
4807 let mut rng = StdRng::from_seed(*seed);
4808 let max_txns = rng.gen_range(10..=100u64);
4809 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4810 self.max_transactions_per_checkpoint = Some(max_txns);
4811 }
4812
4813 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4819 let (
4820 max_back_edges_per_function,
4821 max_back_edges_per_module,
4822 sanity_check_with_regex_reference_safety,
4823 ) = if let Some((
4824 max_back_edges_per_function,
4825 max_back_edges_per_module,
4826 sanity_check_with_regex_reference_safety,
4827 )) = signing_limits
4828 {
4829 (
4830 Some(max_back_edges_per_function),
4831 Some(max_back_edges_per_module),
4832 Some(sanity_check_with_regex_reference_safety),
4833 )
4834 } else {
4835 (None, None, None)
4836 };
4837
4838 let additional_borrow_checks = if signing_limits.is_some() {
4839 true
4841 } else {
4842 self.additional_borrow_checks()
4843 };
4844 let deprecate_global_storage_ops = if signing_limits.is_some() {
4845 true
4847 } else {
4848 self.deprecate_global_storage_ops()
4849 };
4850
4851 VerifierConfig {
4852 max_loop_depth: Some(self.max_loop_depth() as usize),
4853 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4854 max_function_parameters: Some(self.max_function_parameters() as usize),
4855 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4856 max_value_stack_size: self.max_value_stack_size() as usize,
4857 max_type_nodes: Some(self.max_type_nodes() as usize),
4858 max_push_size: Some(self.max_push_size() as usize),
4859 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4860 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4861 max_function_definitions: Some(self.max_function_definitions() as usize),
4862 max_data_definitions: Some(self.max_struct_definitions() as usize),
4863 max_constant_vector_len: Some(self.max_move_vector_len()),
4864 max_back_edges_per_function,
4865 max_back_edges_per_module,
4866 max_basic_blocks_in_script: None,
4867 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4869 allow_receiving_object_id: self.allow_receiving_object_id(),
4870 reject_mutable_random_on_entry_functions: self
4871 .reject_mutable_random_on_entry_functions(),
4872 bytecode_version: self.move_binary_format_version(),
4873 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4874 additional_borrow_checks,
4875 better_loader_errors: self.better_loader_errors(),
4876 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4877 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4878 .map(|limit| limit as u128),
4879 deprecate_global_storage_ops,
4880 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4881 switch_to_regex_reference_safety: false,
4882 }
4883 }
4884
4885 pub fn binary_config(
4886 &self,
4887 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4888 ) -> BinaryConfig {
4889 let deprecate_global_storage_ops =
4890 override_deprecate_global_storage_ops_during_deserialization
4891 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4892 BinaryConfig::new(
4893 self.move_binary_format_version(),
4894 self.min_move_binary_format_version_as_option()
4895 .unwrap_or(VERSION_1),
4896 self.no_extraneous_module_bytes(),
4897 deprecate_global_storage_ops,
4898 TableConfig {
4899 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
4900 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
4901 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
4902 function_instantiations: self
4903 .binary_function_instantiations_as_option()
4904 .unwrap_or(u16::MAX),
4905 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
4906 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
4907 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
4908 address_identifiers: self
4909 .binary_address_identifiers_as_option()
4910 .unwrap_or(u16::MAX),
4911 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
4912 struct_def_instantiations: self
4913 .binary_struct_def_instantiations_as_option()
4914 .unwrap_or(u16::MAX),
4915 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
4916 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
4917 field_instantiations: self
4918 .binary_field_instantiations_as_option()
4919 .unwrap_or(u16::MAX),
4920 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
4921 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
4922 enum_def_instantiations: self
4923 .binary_enum_def_instantiations_as_option()
4924 .unwrap_or(u16::MAX),
4925 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
4926 variant_instantiation_handles: self
4927 .binary_variant_instantiation_handles_as_option()
4928 .unwrap_or(u16::MAX),
4929 },
4930 )
4931 }
4932
4933 pub fn apply_overrides_for_testing(
4937 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
4938 ) -> OverrideGuard {
4939 CONFIG_OVERRIDE.with(|ovr| {
4940 let mut cur = ovr.borrow_mut();
4941 assert!(cur.is_none(), "config override already present");
4942 *cur = Some(Box::new(override_fn));
4943 OverrideGuard
4944 })
4945 }
4946}
4947
4948impl ProtocolConfig {
4952 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
4953 self.feature_flags
4954 .advance_to_highest_supported_protocol_version = val
4955 }
4956 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
4957 self.feature_flags.commit_root_state_digest = val
4958 }
4959 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
4960 self.feature_flags.zklogin_auth = val
4961 }
4962 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
4963 self.feature_flags.enable_jwk_consensus_updates = val
4964 }
4965 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
4966 self.feature_flags.random_beacon = val
4967 }
4968
4969 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
4970 self.feature_flags.upgraded_multisig_supported = val
4971 }
4972 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
4973 self.feature_flags.accept_zklogin_in_multisig = val
4974 }
4975
4976 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
4977 self.feature_flags.shared_object_deletion = val;
4978 }
4979
4980 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
4981 self.feature_flags.narwhal_new_leader_election_schedule = val;
4982 }
4983
4984 pub fn set_receive_object_for_testing(&mut self, val: bool) {
4985 self.feature_flags.receive_objects = val
4986 }
4987 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
4988 self.feature_flags.narwhal_certificate_v2 = val
4989 }
4990 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
4991 self.feature_flags.verify_legacy_zklogin_address = val
4992 }
4993
4994 pub fn set_per_object_congestion_control_mode_for_testing(
4995 &mut self,
4996 val: PerObjectCongestionControlMode,
4997 ) {
4998 self.feature_flags.per_object_congestion_control_mode = val;
4999 }
5000
5001 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5002 self.feature_flags.consensus_choice = val;
5003 }
5004
5005 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5006 self.feature_flags.consensus_network = val;
5007 }
5008
5009 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5010 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5011 }
5012
5013 pub fn set_disable_bridge_for_testing(&mut self) {
5014 self.feature_flags.bridge = false
5015 }
5016
5017 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5018 self.feature_flags.mysticeti_num_leaders_per_round = val;
5019 }
5020
5021 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5022 self.feature_flags.soft_bundle = val;
5023 }
5024
5025 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5026 self.feature_flags.passkey_auth = val
5027 }
5028
5029 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5030 self.feature_flags.enable_party_transfer = val
5031 }
5032
5033 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5034 self.feature_flags
5035 .consensus_distributed_vote_scoring_strategy = val;
5036 }
5037
5038 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5039 self.feature_flags.consensus_round_prober = val;
5040 }
5041
5042 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5043 self.feature_flags
5044 .disallow_new_modules_in_deps_only_packages = val;
5045 }
5046
5047 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5048 self.feature_flags.correct_gas_payment_limit_check = val;
5049 }
5050
5051 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5052 self.feature_flags.address_aliases = val;
5053 }
5054
5055 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5056 self.feature_flags
5057 .consensus_round_prober_probe_accepted_rounds = val;
5058 }
5059
5060 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5061 self.feature_flags.mysticeti_fastpath = val;
5062 }
5063
5064 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5065 self.feature_flags.accept_passkey_in_multisig = val;
5066 }
5067
5068 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5069 self.feature_flags.consensus_batched_block_sync = val;
5070 }
5071
5072 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5073 self.feature_flags.record_time_estimate_processed = val;
5074 }
5075
5076 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5077 &mut self,
5078 val: bool,
5079 ) {
5080 self.feature_flags
5081 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5082 }
5083
5084 pub fn enable_accumulators_for_testing(&mut self) {
5085 self.feature_flags.enable_accumulators = true;
5086 }
5087
5088 pub fn disable_accumulators_for_testing(&mut self) {
5089 self.feature_flags.enable_accumulators = false;
5090 self.feature_flags.enable_address_balance_gas_payments = false;
5091 }
5092
5093 pub fn enable_coin_reservation_for_testing(&mut self) {
5094 self.feature_flags.enable_coin_reservation_obj_refs = true;
5095 self.feature_flags
5096 .convert_withdrawal_compatibility_ptb_arguments = true;
5097 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5100 }
5101
5102 pub fn disable_coin_reservation_for_testing(&mut self) {
5103 self.feature_flags.enable_coin_reservation_obj_refs = false;
5104 self.feature_flags
5105 .convert_withdrawal_compatibility_ptb_arguments = false;
5106 }
5107
5108 pub fn create_root_accumulator_object_for_testing(&mut self) {
5109 self.feature_flags.create_root_accumulator_object = true;
5110 }
5111
5112 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5113 self.feature_flags.create_root_accumulator_object = false;
5114 }
5115
5116 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5117 self.feature_flags.enable_accumulators = true;
5118 self.feature_flags.allow_private_accumulator_entrypoints = true;
5119 self.feature_flags.enable_address_balance_gas_payments = true;
5120 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5121 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5122 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5123 }
5124
5125 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5126 self.feature_flags.enable_address_balance_gas_payments = false;
5127 }
5128
5129 pub fn enable_gasless_for_testing(&mut self) {
5130 self.enable_address_balance_gas_payments_for_testing();
5131 self.feature_flags.enable_gasless = true;
5132 self.gasless_max_computation_units = Some(50_000);
5133 self.gasless_allowed_token_types = Some(vec![]);
5134 }
5135
5136 pub fn disable_gasless_for_testing(&mut self) {
5137 self.feature_flags.enable_gasless = false;
5138 self.gasless_max_computation_units = None;
5139 self.gasless_allowed_token_types = None;
5140 }
5141
5142 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5143 self.gasless_allowed_token_types = Some(types);
5144 }
5145
5146 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5147 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5148 }
5149
5150 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5151 self.enable_accumulators_for_testing();
5152 self.feature_flags.enable_authenticated_event_streams = true;
5153 self.feature_flags
5154 .include_checkpoint_artifacts_digest_in_summary = true;
5155 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5156 }
5157
5158 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5159 self.feature_flags.enable_authenticated_event_streams = false;
5160 }
5161
5162 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5163 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5164 }
5165
5166 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5167 self.feature_flags.enable_non_exclusive_writes = true;
5168 }
5169
5170 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5171 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5172 }
5173
5174 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5175 &mut self,
5176 val: bool,
5177 ) {
5178 self.feature_flags
5179 .ignore_execution_time_observations_after_certs_closed = val;
5180 }
5181
5182 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5183 &mut self,
5184 val: bool,
5185 ) {
5186 self.feature_flags
5187 .consensus_checkpoint_signature_key_includes_digest = val;
5188 }
5189
5190 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5191 self.feature_flags.cancel_for_failed_dkg_early = val;
5192 }
5193
5194 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5195 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5196 }
5197
5198 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5199 self.feature_flags.authority_capabilities_v2 = val;
5200 }
5201
5202 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5203 self.feature_flags.allow_references_in_ptbs = true;
5204 }
5205
5206 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5207 self.feature_flags.consensus_skip_gced_accept_votes = val;
5208 }
5209
5210 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5211 self.feature_flags.enable_object_funds_withdraw = val;
5212 }
5213
5214 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5215 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5216 }
5217
5218 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5219 self.feature_flags.merge_randomness_into_checkpoint = val;
5220 }
5221}
5222
5223type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5224
5225thread_local! {
5226 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5227}
5228
5229#[must_use]
5230pub struct OverrideGuard;
5231
5232impl Drop for OverrideGuard {
5233 fn drop(&mut self) {
5234 info!("restoring override fn");
5235 CONFIG_OVERRIDE.with(|ovr| {
5236 *ovr.borrow_mut() = None;
5237 });
5238 }
5239}
5240
5241#[derive(PartialEq, Eq)]
5244pub enum LimitThresholdCrossed {
5245 None,
5246 Soft(u128, u128),
5247 Hard(u128, u128),
5248}
5249
5250pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5253 x: T,
5254 soft_limit: U,
5255 hard_limit: V,
5256) -> LimitThresholdCrossed {
5257 let x: V = x.into();
5258 let soft_limit: V = soft_limit.into();
5259
5260 debug_assert!(soft_limit <= hard_limit);
5261
5262 if x >= hard_limit {
5265 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5266 } else if x < soft_limit {
5267 LimitThresholdCrossed::None
5268 } else {
5269 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5270 }
5271}
5272
5273#[macro_export]
5274macro_rules! check_limit {
5275 ($x:expr, $hard:expr) => {
5276 check_limit!($x, $hard, $hard)
5277 };
5278 ($x:expr, $soft:expr, $hard:expr) => {
5279 check_limit_in_range($x as u64, $soft, $hard)
5280 };
5281}
5282
5283#[macro_export]
5287macro_rules! check_limit_by_meter {
5288 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5289 let (h, metered_str) = if $is_metered {
5291 ($metered_limit, "metered")
5292 } else {
5293 ($unmetered_hard_limit, "unmetered")
5295 };
5296 use sui_protocol_config::check_limit_in_range;
5297 let result = check_limit_in_range($x as u64, $metered_limit, h);
5298 match result {
5299 LimitThresholdCrossed::None => {}
5300 LimitThresholdCrossed::Soft(_, _) => {
5301 $metric.with_label_values(&[metered_str, "soft"]).inc();
5302 }
5303 LimitThresholdCrossed::Hard(_, _) => {
5304 $metric.with_label_values(&[metered_str, "hard"]).inc();
5305 }
5306 };
5307 result
5308 }};
5309}
5310#[cfg(all(test, not(msim)))]
5311mod test {
5312 use insta::assert_yaml_snapshot;
5313
5314 use super::*;
5315
5316 #[test]
5317 fn snapshot_tests() {
5318 println!("\n============================================================================");
5319 println!("! !");
5320 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5321 println!("! !");
5322 println!("============================================================================\n");
5323 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5324 let chain_str = match chain_id {
5328 Chain::Unknown => "".to_string(),
5329 _ => format!("{:?}_", chain_id),
5330 };
5331 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5332 let cur = ProtocolVersion::new(i);
5333 assert_yaml_snapshot!(
5334 format!("{}version_{}", chain_str, cur.as_u64()),
5335 ProtocolConfig::get_for_version(cur, *chain_id)
5336 );
5337 }
5338 }
5339 }
5340
5341 #[test]
5342 fn test_getters() {
5343 let prot: ProtocolConfig =
5344 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5345 assert_eq!(
5346 prot.max_arguments(),
5347 prot.max_arguments_as_option().unwrap()
5348 );
5349 }
5350
5351 #[test]
5352 fn test_setters() {
5353 let mut prot: ProtocolConfig =
5354 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5355 prot.set_max_arguments_for_testing(123);
5356 assert_eq!(prot.max_arguments(), 123);
5357
5358 prot.set_max_arguments_from_str_for_testing("321".to_string());
5359 assert_eq!(prot.max_arguments(), 321);
5360
5361 prot.disable_max_arguments_for_testing();
5362 assert_eq!(prot.max_arguments_as_option(), None);
5363
5364 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5365 assert_eq!(prot.max_arguments(), 456);
5366 }
5367
5368 #[test]
5369 #[should_panic(expected = "unsupported version")]
5370 fn max_version_test() {
5371 let _ = ProtocolConfig::get_for_version_impl(
5374 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5375 Chain::Unknown,
5376 );
5377 }
5378
5379 #[test]
5380 fn lookup_by_string_test() {
5381 let prot: ProtocolConfig =
5382 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5383 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5385
5386 assert!(
5387 prot.lookup_attr("max_arguments".to_string())
5388 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5389 );
5390
5391 assert!(
5393 prot.lookup_attr("max_move_identifier_len".to_string())
5394 .is_none()
5395 );
5396
5397 let prot: ProtocolConfig =
5399 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5400 assert!(
5401 prot.lookup_attr("max_move_identifier_len".to_string())
5402 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5403 );
5404
5405 let prot: ProtocolConfig =
5406 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5407 assert!(
5409 prot.attr_map()
5410 .get("max_move_identifier_len")
5411 .unwrap()
5412 .is_none()
5413 );
5414 assert!(
5416 prot.attr_map().get("max_arguments").unwrap()
5417 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5418 );
5419
5420 let prot: ProtocolConfig =
5422 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5423 assert!(
5425 prot.feature_flags
5426 .lookup_attr("some random string".to_owned())
5427 .is_none()
5428 );
5429 assert!(
5430 !prot
5431 .feature_flags
5432 .attr_map()
5433 .contains_key("some random string")
5434 );
5435
5436 assert!(
5438 prot.feature_flags
5439 .lookup_attr("package_upgrades".to_owned())
5440 == Some(false)
5441 );
5442 assert!(
5443 prot.feature_flags
5444 .attr_map()
5445 .get("package_upgrades")
5446 .unwrap()
5447 == &false
5448 );
5449 let prot: ProtocolConfig =
5450 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5451 assert!(
5453 prot.feature_flags
5454 .lookup_attr("package_upgrades".to_owned())
5455 == Some(true)
5456 );
5457 assert!(
5458 prot.feature_flags
5459 .attr_map()
5460 .get("package_upgrades")
5461 .unwrap()
5462 == &true
5463 );
5464 }
5465
5466 #[test]
5467 fn limit_range_fn_test() {
5468 let low = 100u32;
5469 let high = 10000u64;
5470
5471 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5472 assert!(matches!(
5473 check_limit!(255u16, low, high),
5474 LimitThresholdCrossed::Soft(255u128, 100)
5475 ));
5476 assert!(matches!(
5482 check_limit!(2550000u64, low, high),
5483 LimitThresholdCrossed::Hard(2550000, 10000)
5484 ));
5485
5486 assert!(matches!(
5487 check_limit!(2550000u64, high, high),
5488 LimitThresholdCrossed::Hard(2550000, 10000)
5489 ));
5490
5491 assert!(matches!(
5492 check_limit!(1u8, high),
5493 LimitThresholdCrossed::None
5494 ));
5495
5496 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5497
5498 assert!(matches!(
5499 check_limit!(2550000u64, high),
5500 LimitThresholdCrossed::Hard(2550000, 10000)
5501 ));
5502 }
5503}