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