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 = 124;
36
37const TESTNET_USDC: &str =
38 "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
39
40const MAINNET_USDC: &str =
41 "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
42const MAINNET_USDSUI: &str =
43 "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
44const MAINNET_SUI_USDE: &str =
45 "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
46const MAINNET_USDY: &str =
47 "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY";
48const MAINNET_FDUSD: &str =
49 "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD";
50const MAINNET_AUSD: &str =
51 "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD";
52const MAINNET_USDB: &str =
53 "0xe14726c336e81b32328e92afc37345d159f5b550b09fa92bd43640cfdd0a0cfd::usdb::USDB";
54
55#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
355pub struct ProtocolVersion(u64);
356
357impl ProtocolVersion {
358 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
363
364 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
365
366 #[cfg(not(msim))]
367 pub const MAX_ALLOWED: Self = Self::MAX;
368
369 #[cfg(msim)]
371 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
372
373 pub fn new(v: u64) -> Self {
374 Self(v)
375 }
376
377 pub const fn as_u64(&self) -> u64 {
378 self.0
379 }
380
381 pub fn max() -> Self {
384 Self::MAX
385 }
386
387 pub fn prev(self) -> Self {
388 Self(self.0.checked_sub(1).unwrap())
389 }
390}
391
392impl From<u64> for ProtocolVersion {
393 fn from(v: u64) -> Self {
394 Self::new(v)
395 }
396}
397
398impl std::ops::Sub<u64> for ProtocolVersion {
399 type Output = Self;
400 fn sub(self, rhs: u64) -> Self::Output {
401 Self::new(self.0 - rhs)
402 }
403}
404
405impl std::ops::Add<u64> for ProtocolVersion {
406 type Output = Self;
407 fn add(self, rhs: u64) -> Self::Output {
408 Self::new(self.0 + rhs)
409 }
410}
411
412#[derive(
413 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
414)]
415pub enum Chain {
416 Mainnet,
417 Testnet,
418 #[default]
419 Unknown,
420}
421
422impl Chain {
423 pub fn as_str(self) -> &'static str {
424 match self {
425 Chain::Mainnet => "mainnet",
426 Chain::Testnet => "testnet",
427 Chain::Unknown => "unknown",
428 }
429 }
430}
431
432pub struct Error(pub String);
433
434#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
437struct FeatureFlags {
438 #[serde(skip_serializing_if = "is_false")]
441 package_upgrades: bool,
442 #[serde(skip_serializing_if = "is_false")]
445 commit_root_state_digest: bool,
446 #[serde(skip_serializing_if = "is_false")]
448 advance_epoch_start_time_in_safe_mode: bool,
449 #[serde(skip_serializing_if = "is_false")]
452 loaded_child_objects_fixed: bool,
453 #[serde(skip_serializing_if = "is_false")]
456 missing_type_is_compatibility_error: bool,
457 #[serde(skip_serializing_if = "is_false")]
460 scoring_decision_with_validity_cutoff: bool,
461
462 #[serde(skip_serializing_if = "is_false")]
465 consensus_order_end_of_epoch_last: bool,
466
467 #[serde(skip_serializing_if = "is_false")]
469 disallow_adding_abilities_on_upgrade: bool,
470 #[serde(skip_serializing_if = "is_false")]
472 disable_invariant_violation_check_in_swap_loc: bool,
473 #[serde(skip_serializing_if = "is_false")]
476 advance_to_highest_supported_protocol_version: bool,
477 #[serde(skip_serializing_if = "is_false")]
479 ban_entry_init: bool,
480 #[serde(skip_serializing_if = "is_false")]
482 package_digest_hash_module: bool,
483 #[serde(skip_serializing_if = "is_false")]
485 disallow_change_struct_type_params_on_upgrade: bool,
486 #[serde(skip_serializing_if = "is_false")]
488 no_extraneous_module_bytes: bool,
489 #[serde(skip_serializing_if = "is_false")]
491 narwhal_versioned_metadata: bool,
492
493 #[serde(skip_serializing_if = "is_false")]
495 zklogin_auth: bool,
496 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
498 consensus_transaction_ordering: ConsensusTransactionOrdering,
499
500 #[serde(skip_serializing_if = "is_false")]
508 simplified_unwrap_then_delete: bool,
509 #[serde(skip_serializing_if = "is_false")]
511 upgraded_multisig_supported: bool,
512 #[serde(skip_serializing_if = "is_false")]
514 txn_base_cost_as_multiplier: bool,
515
516 #[serde(skip_serializing_if = "is_false")]
518 shared_object_deletion: bool,
519
520 #[serde(skip_serializing_if = "is_false")]
522 narwhal_new_leader_election_schedule: bool,
523
524 #[serde(skip_serializing_if = "is_empty")]
526 zklogin_supported_providers: BTreeSet<String>,
527
528 #[serde(skip_serializing_if = "is_false")]
530 loaded_child_object_format: bool,
531
532 #[serde(skip_serializing_if = "is_false")]
533 enable_jwk_consensus_updates: bool,
534
535 #[serde(skip_serializing_if = "is_false")]
536 end_of_epoch_transaction_supported: bool,
537
538 #[serde(skip_serializing_if = "is_false")]
541 simple_conservation_checks: bool,
542
543 #[serde(skip_serializing_if = "is_false")]
545 loaded_child_object_format_type: bool,
546
547 #[serde(skip_serializing_if = "is_false")]
549 receive_objects: bool,
550
551 #[serde(skip_serializing_if = "is_false")]
553 consensus_checkpoint_signature_key_includes_digest: bool,
554
555 #[serde(skip_serializing_if = "is_false")]
557 random_beacon: bool,
558
559 #[serde(skip_serializing_if = "is_false")]
561 bridge: bool,
562
563 #[serde(skip_serializing_if = "is_false")]
564 enable_effects_v2: bool,
565
566 #[serde(skip_serializing_if = "is_false")]
568 narwhal_certificate_v2: bool,
569
570 #[serde(skip_serializing_if = "is_false")]
572 verify_legacy_zklogin_address: bool,
573
574 #[serde(skip_serializing_if = "is_false")]
576 throughput_aware_consensus_submission: bool,
577
578 #[serde(skip_serializing_if = "is_false")]
580 recompute_has_public_transfer_in_execution: bool,
581
582 #[serde(skip_serializing_if = "is_false")]
584 accept_zklogin_in_multisig: bool,
585
586 #[serde(skip_serializing_if = "is_false")]
588 accept_passkey_in_multisig: bool,
589
590 #[serde(skip_serializing_if = "is_false")]
592 validate_zklogin_public_identifier: bool,
593
594 #[serde(skip_serializing_if = "is_false")]
597 include_consensus_digest_in_prologue: bool,
598
599 #[serde(skip_serializing_if = "is_false")]
601 hardened_otw_check: bool,
602
603 #[serde(skip_serializing_if = "is_false")]
605 allow_receiving_object_id: bool,
606
607 #[serde(skip_serializing_if = "is_false")]
609 enable_poseidon: bool,
610
611 #[serde(skip_serializing_if = "is_false")]
613 enable_coin_deny_list: bool,
614
615 #[serde(skip_serializing_if = "is_false")]
617 enable_group_ops_native_functions: bool,
618
619 #[serde(skip_serializing_if = "is_false")]
621 enable_group_ops_native_function_msm: bool,
622
623 #[serde(skip_serializing_if = "is_false")]
625 enable_ristretto255_group_ops: bool,
626
627 #[serde(skip_serializing_if = "is_false")]
629 enable_verify_bulletproofs_ristretto255: bool,
630
631 #[serde(skip_serializing_if = "is_false")]
633 enable_nitro_attestation: bool,
634
635 #[serde(skip_serializing_if = "is_false")]
637 enable_nitro_attestation_upgraded_parsing: bool,
638
639 #[serde(skip_serializing_if = "is_false")]
641 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
642
643 #[serde(skip_serializing_if = "is_false")]
645 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
646
647 #[serde(skip_serializing_if = "is_false")]
649 reject_mutable_random_on_entry_functions: bool,
650
651 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
653 per_object_congestion_control_mode: PerObjectCongestionControlMode,
654
655 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
657 consensus_choice: ConsensusChoice,
658
659 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
661 consensus_network: ConsensusNetwork,
662
663 #[serde(skip_serializing_if = "is_false")]
665 correct_gas_payment_limit_check: bool,
666
667 #[serde(skip_serializing_if = "Option::is_none")]
669 zklogin_max_epoch_upper_bound_delta: Option<u64>,
670
671 #[serde(skip_serializing_if = "is_false")]
673 mysticeti_leader_scoring_and_schedule: bool,
674
675 #[serde(skip_serializing_if = "is_false")]
677 reshare_at_same_initial_version: bool,
678
679 #[serde(skip_serializing_if = "is_false")]
681 resolve_abort_locations_to_package_id: bool,
682
683 #[serde(skip_serializing_if = "is_false")]
687 mysticeti_use_committed_subdag_digest: bool,
688
689 #[serde(skip_serializing_if = "is_false")]
691 enable_vdf: bool,
692
693 #[serde(skip_serializing_if = "is_false")]
698 record_consensus_determined_version_assignments_in_prologue: bool,
699 #[serde(skip_serializing_if = "is_false")]
700 record_consensus_determined_version_assignments_in_prologue_v2: bool,
701
702 #[serde(skip_serializing_if = "is_false")]
704 fresh_vm_on_framework_upgrade: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
714 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
715
716 #[serde(skip_serializing_if = "Option::is_none")]
718 mysticeti_num_leaders_per_round: Option<usize>,
719
720 #[serde(skip_serializing_if = "is_false")]
722 soft_bundle: bool,
723
724 #[serde(skip_serializing_if = "is_false")]
726 enable_coin_deny_list_v2: bool,
727
728 #[serde(skip_serializing_if = "is_false")]
730 passkey_auth: bool,
731
732 #[serde(skip_serializing_if = "is_false")]
734 authority_capabilities_v2: bool,
735
736 #[serde(skip_serializing_if = "is_false")]
738 rethrow_serialization_type_layout_errors: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 consensus_distributed_vote_scoring_strategy: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 consensus_round_prober: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
750 validate_identifier_inputs: bool,
751
752 #[serde(skip_serializing_if = "is_false")]
754 disallow_self_identifier: bool,
755
756 #[serde(skip_serializing_if = "is_false")]
758 mysticeti_fastpath: bool,
759
760 #[serde(skip_serializing_if = "is_false")]
764 disable_preconsensus_locking: bool,
765
766 #[serde(skip_serializing_if = "is_false")]
768 relocate_event_module: bool,
769
770 #[serde(skip_serializing_if = "is_false")]
772 uncompressed_g1_group_elements: bool,
773
774 #[serde(skip_serializing_if = "is_false")]
775 disallow_new_modules_in_deps_only_packages: bool,
776
777 #[serde(skip_serializing_if = "is_false")]
779 consensus_smart_ancestor_selection: bool,
780
781 #[serde(skip_serializing_if = "is_false")]
783 consensus_round_prober_probe_accepted_rounds: bool,
784
785 #[serde(skip_serializing_if = "is_false")]
787 native_charging_v2: bool,
788
789 #[serde(skip_serializing_if = "is_false")]
792 consensus_linearize_subdag_v2: bool,
793
794 #[serde(skip_serializing_if = "is_false")]
796 convert_type_argument_error: bool,
797
798 #[serde(skip_serializing_if = "is_false")]
800 variant_nodes: bool,
801
802 #[serde(skip_serializing_if = "is_false")]
804 consensus_zstd_compression: bool,
805
806 #[serde(skip_serializing_if = "is_false")]
808 minimize_child_object_mutations: bool,
809
810 #[serde(skip_serializing_if = "is_false")]
812 record_additional_state_digest_in_prologue: bool,
813
814 #[serde(skip_serializing_if = "is_false")]
816 move_native_context: bool,
817
818 #[serde(skip_serializing_if = "is_false")]
821 consensus_median_based_commit_timestamp: bool,
822
823 #[serde(skip_serializing_if = "is_false")]
826 normalize_ptb_arguments: bool,
827
828 #[serde(skip_serializing_if = "is_false")]
830 consensus_batched_block_sync: bool,
831
832 #[serde(skip_serializing_if = "is_false")]
834 enforce_checkpoint_timestamp_monotonicity: bool,
835
836 #[serde(skip_serializing_if = "is_false")]
838 max_ptb_value_size_v2: bool,
839
840 #[serde(skip_serializing_if = "is_false")]
842 resolve_type_input_ids_to_defining_id: bool,
843
844 #[serde(skip_serializing_if = "is_false")]
846 enable_party_transfer: bool,
847
848 #[serde(skip_serializing_if = "is_false")]
850 allow_unbounded_system_objects: bool,
851
852 #[serde(skip_serializing_if = "is_false")]
854 type_tags_in_object_runtime: bool,
855
856 #[serde(skip_serializing_if = "is_false")]
858 enable_accumulators: bool,
859
860 #[serde(skip_serializing_if = "is_false")]
862 enable_coin_reservation_obj_refs: bool,
863
864 #[serde(skip_serializing_if = "is_false")]
867 create_root_accumulator_object: bool,
868
869 #[serde(skip_serializing_if = "is_false")]
871 enable_authenticated_event_streams: bool,
872
873 #[serde(skip_serializing_if = "is_false")]
875 enable_address_balance_gas_payments: bool,
876
877 #[serde(skip_serializing_if = "is_false")]
879 address_balance_gas_check_rgp_at_signing: bool,
880
881 #[serde(skip_serializing_if = "is_false")]
882 address_balance_gas_reject_gas_coin_arg: bool,
883
884 #[serde(skip_serializing_if = "is_false")]
886 enable_multi_epoch_transaction_expiration: bool,
887
888 #[serde(skip_serializing_if = "is_false")]
890 relax_valid_during_for_owned_inputs: bool,
891
892 #[serde(skip_serializing_if = "is_false")]
894 enable_ptb_execution_v2: bool,
895
896 #[serde(skip_serializing_if = "is_false")]
898 better_adapter_type_resolution_errors: bool,
899
900 #[serde(skip_serializing_if = "is_false")]
902 record_time_estimate_processed: bool,
903
904 #[serde(skip_serializing_if = "is_false")]
906 dependency_linkage_error: bool,
907
908 #[serde(skip_serializing_if = "is_false")]
910 additional_multisig_checks: bool,
911
912 #[serde(skip_serializing_if = "is_false")]
914 ignore_execution_time_observations_after_certs_closed: bool,
915
916 #[serde(skip_serializing_if = "is_false")]
920 debug_fatal_on_move_invariant_violation: bool,
921
922 #[serde(skip_serializing_if = "is_false")]
925 allow_private_accumulator_entrypoints: bool,
926
927 #[serde(skip_serializing_if = "is_false")]
929 additional_consensus_digest_indirect_state: bool,
930
931 #[serde(skip_serializing_if = "is_false")]
933 check_for_init_during_upgrade: bool,
934
935 #[serde(skip_serializing_if = "is_false")]
937 per_command_shared_object_transfer_rules: bool,
938
939 #[serde(skip_serializing_if = "is_false")]
941 include_checkpoint_artifacts_digest_in_summary: bool,
942
943 #[serde(skip_serializing_if = "is_false")]
945 use_mfp_txns_in_load_initial_object_debts: bool,
946
947 #[serde(skip_serializing_if = "is_false")]
949 cancel_for_failed_dkg_early: bool,
950
951 #[serde(skip_serializing_if = "is_false")]
953 enable_coin_registry: bool,
954
955 #[serde(skip_serializing_if = "is_false")]
957 abstract_size_in_object_runtime: bool,
958
959 #[serde(skip_serializing_if = "is_false")]
961 object_runtime_charge_cache_load_gas: bool,
962
963 #[serde(skip_serializing_if = "is_false")]
965 additional_borrow_checks: bool,
966
967 #[serde(skip_serializing_if = "is_false")]
969 use_new_commit_handler: bool,
970
971 #[serde(skip_serializing_if = "is_false")]
973 better_loader_errors: bool,
974
975 #[serde(skip_serializing_if = "is_false")]
977 generate_df_type_layouts: bool,
978
979 #[serde(skip_serializing_if = "is_false")]
981 allow_references_in_ptbs: bool,
982
983 #[serde(skip_serializing_if = "is_false")]
985 enable_display_registry: bool,
986
987 #[serde(skip_serializing_if = "is_false")]
989 private_generics_verifier_v2: bool,
990
991 #[serde(skip_serializing_if = "is_false")]
993 deprecate_global_storage_ops_during_deserialization: bool,
994
995 #[serde(skip_serializing_if = "is_false")]
998 enable_non_exclusive_writes: bool,
999
1000 #[serde(skip_serializing_if = "is_false")]
1002 deprecate_global_storage_ops: bool,
1003
1004 #[serde(skip_serializing_if = "is_false")]
1006 normalize_depth_formula: bool,
1007
1008 #[serde(skip_serializing_if = "is_false")]
1010 consensus_skip_gced_accept_votes: bool,
1011
1012 #[serde(skip_serializing_if = "is_false")]
1014 include_cancelled_randomness_txns_in_prologue: bool,
1015
1016 #[serde(skip_serializing_if = "is_false")]
1018 address_aliases: bool,
1019
1020 #[serde(skip_serializing_if = "is_false")]
1023 fix_checkpoint_signature_mapping: bool,
1024
1025 #[serde(skip_serializing_if = "is_false")]
1027 enable_object_funds_withdraw: bool,
1028
1029 #[serde(skip_serializing_if = "is_false")]
1031 consensus_skip_gced_blocks_in_direct_finalization: bool,
1032
1033 #[serde(skip_serializing_if = "is_false")]
1035 gas_rounding_halve_digits: bool,
1036
1037 #[serde(skip_serializing_if = "is_false")]
1039 flexible_tx_context_positions: bool,
1040
1041 #[serde(skip_serializing_if = "is_false")]
1043 disable_entry_point_signature_check: bool,
1044
1045 #[serde(skip_serializing_if = "is_false")]
1047 convert_withdrawal_compatibility_ptb_arguments: bool,
1048
1049 #[serde(skip_serializing_if = "is_false")]
1051 restrict_hot_or_not_entry_functions: bool,
1052
1053 #[serde(skip_serializing_if = "is_false")]
1055 split_checkpoints_in_consensus_handler: bool,
1056
1057 #[serde(skip_serializing_if = "is_false")]
1059 consensus_always_accept_system_transactions: bool,
1060
1061 #[serde(skip_serializing_if = "is_false")]
1063 validator_metadata_verify_v2: bool,
1064
1065 #[serde(skip_serializing_if = "is_false")]
1068 defer_unpaid_amplification: bool,
1069
1070 #[serde(skip_serializing_if = "is_false")]
1071 randomize_checkpoint_tx_limit_in_tests: bool,
1072
1073 #[serde(skip_serializing_if = "is_false")]
1075 gasless_transaction_drop_safety: bool,
1076
1077 #[serde(skip_serializing_if = "is_false")]
1079 merge_randomness_into_checkpoint: bool,
1080
1081 #[serde(skip_serializing_if = "is_false")]
1083 use_coin_party_owner: bool,
1084
1085 #[serde(skip_serializing_if = "is_false")]
1086 enable_gasless: bool,
1087
1088 #[serde(skip_serializing_if = "is_false")]
1089 gasless_verify_remaining_balance: bool,
1090
1091 #[serde(skip_serializing_if = "is_false")]
1092 disallow_jump_orphans: bool,
1093
1094 #[serde(skip_serializing_if = "is_false")]
1096 early_return_receive_object_mismatched_type: bool,
1097
1098 #[serde(skip_serializing_if = "is_false")]
1103 timestamp_based_epoch_close: bool,
1104
1105 #[serde(skip_serializing_if = "is_false")]
1108 limit_groth16_pvk_inputs: bool,
1109}
1110
1111fn is_false(b: &bool) -> bool {
1112 !b
1113}
1114
1115fn is_empty(b: &BTreeSet<String>) -> bool {
1116 b.is_empty()
1117}
1118
1119fn is_zero(val: &u64) -> bool {
1120 *val == 0
1121}
1122
1123#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1125pub enum ConsensusTransactionOrdering {
1126 #[default]
1128 None,
1129 ByGasPrice,
1131}
1132
1133impl ConsensusTransactionOrdering {
1134 pub fn is_none(&self) -> bool {
1135 matches!(self, ConsensusTransactionOrdering::None)
1136 }
1137}
1138
1139#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1140pub struct ExecutionTimeEstimateParams {
1141 pub target_utilization: u64,
1143 pub allowed_txn_cost_overage_burst_limit_us: u64,
1147
1148 pub randomness_scalar: u64,
1151
1152 pub max_estimate_us: u64,
1154
1155 pub stored_observations_num_included_checkpoints: u64,
1158
1159 pub stored_observations_limit: u64,
1161
1162 #[serde(skip_serializing_if = "is_zero")]
1165 pub stake_weighted_median_threshold: u64,
1166
1167 #[serde(skip_serializing_if = "is_false")]
1171 pub default_none_duration_for_new_keys: bool,
1172
1173 #[serde(skip_serializing_if = "Option::is_none")]
1175 pub observations_chunk_size: Option<u64>,
1176}
1177
1178#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1180pub enum PerObjectCongestionControlMode {
1181 #[default]
1182 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1188
1189impl PerObjectCongestionControlMode {
1190 pub fn is_none(&self) -> bool {
1191 matches!(self, PerObjectCongestionControlMode::None)
1192 }
1193}
1194
1195#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1197pub enum ConsensusChoice {
1198 #[default]
1199 Narwhal,
1200 SwapEachEpoch,
1201 Mysticeti,
1202}
1203
1204impl ConsensusChoice {
1205 pub fn is_narwhal(&self) -> bool {
1206 matches!(self, ConsensusChoice::Narwhal)
1207 }
1208}
1209
1210#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1212pub enum ConsensusNetwork {
1213 #[default]
1214 Anemo,
1215 Tonic,
1216}
1217
1218impl ConsensusNetwork {
1219 pub fn is_anemo(&self) -> bool {
1220 matches!(self, ConsensusNetwork::Anemo)
1221 }
1222}
1223
1224#[skip_serializing_none]
1256#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1257pub struct ProtocolConfig {
1258 pub version: ProtocolVersion,
1259
1260 feature_flags: FeatureFlags,
1261
1262 max_tx_size_bytes: Option<u64>,
1265
1266 max_input_objects: Option<u64>,
1268
1269 max_size_written_objects: Option<u64>,
1273 max_size_written_objects_system_tx: Option<u64>,
1276
1277 max_serialized_tx_effects_size_bytes: Option<u64>,
1279
1280 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1282
1283 max_gas_payment_objects: Option<u32>,
1285
1286 max_modules_in_publish: Option<u32>,
1288
1289 max_package_dependencies: Option<u32>,
1291
1292 max_arguments: Option<u32>,
1295
1296 max_type_arguments: Option<u32>,
1298
1299 max_type_argument_depth: Option<u32>,
1301
1302 max_pure_argument_size: Option<u32>,
1304
1305 max_programmable_tx_commands: Option<u32>,
1307
1308 move_binary_format_version: Option<u32>,
1311 min_move_binary_format_version: Option<u32>,
1312
1313 binary_module_handles: Option<u16>,
1315 binary_struct_handles: Option<u16>,
1316 binary_function_handles: Option<u16>,
1317 binary_function_instantiations: Option<u16>,
1318 binary_signatures: Option<u16>,
1319 binary_constant_pool: Option<u16>,
1320 binary_identifiers: Option<u16>,
1321 binary_address_identifiers: Option<u16>,
1322 binary_struct_defs: Option<u16>,
1323 binary_struct_def_instantiations: Option<u16>,
1324 binary_function_defs: Option<u16>,
1325 binary_field_handles: Option<u16>,
1326 binary_field_instantiations: Option<u16>,
1327 binary_friend_decls: Option<u16>,
1328 binary_enum_defs: Option<u16>,
1329 binary_enum_def_instantiations: Option<u16>,
1330 binary_variant_handles: Option<u16>,
1331 binary_variant_instantiation_handles: Option<u16>,
1332
1333 max_move_object_size: Option<u64>,
1335
1336 max_move_package_size: Option<u64>,
1339
1340 max_publish_or_upgrade_per_ptb: Option<u64>,
1342
1343 max_tx_gas: Option<u64>,
1345
1346 max_gas_price: Option<u64>,
1348
1349 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1352
1353 max_gas_computation_bucket: Option<u64>,
1355
1356 gas_rounding_step: Option<u64>,
1358
1359 max_loop_depth: Option<u64>,
1361
1362 max_generic_instantiation_length: Option<u64>,
1364
1365 max_function_parameters: Option<u64>,
1367
1368 max_basic_blocks: Option<u64>,
1370
1371 max_value_stack_size: Option<u64>,
1373
1374 max_type_nodes: Option<u64>,
1376
1377 max_push_size: Option<u64>,
1379
1380 max_struct_definitions: Option<u64>,
1382
1383 max_function_definitions: Option<u64>,
1385
1386 max_fields_in_struct: Option<u64>,
1388
1389 max_dependency_depth: Option<u64>,
1391
1392 max_num_event_emit: Option<u64>,
1394
1395 max_num_new_move_object_ids: Option<u64>,
1397
1398 max_num_new_move_object_ids_system_tx: Option<u64>,
1400
1401 max_num_deleted_move_object_ids: Option<u64>,
1403
1404 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1406
1407 max_num_transferred_move_object_ids: Option<u64>,
1409
1410 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1412
1413 max_event_emit_size: Option<u64>,
1415
1416 max_event_emit_size_total: Option<u64>,
1418
1419 max_move_vector_len: Option<u64>,
1421
1422 max_move_identifier_len: Option<u64>,
1424
1425 max_move_value_depth: Option<u64>,
1427
1428 max_move_enum_variants: Option<u64>,
1430
1431 max_back_edges_per_function: Option<u64>,
1433
1434 max_back_edges_per_module: Option<u64>,
1436
1437 max_verifier_meter_ticks_per_function: Option<u64>,
1439
1440 max_meter_ticks_per_module: Option<u64>,
1442
1443 max_meter_ticks_per_package: Option<u64>,
1445
1446 object_runtime_max_num_cached_objects: Option<u64>,
1450
1451 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1453
1454 object_runtime_max_num_store_entries: Option<u64>,
1456
1457 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1459
1460 base_tx_cost_fixed: Option<u64>,
1463
1464 package_publish_cost_fixed: Option<u64>,
1467
1468 base_tx_cost_per_byte: Option<u64>,
1471
1472 package_publish_cost_per_byte: Option<u64>,
1474
1475 obj_access_cost_read_per_byte: Option<u64>,
1477
1478 obj_access_cost_mutate_per_byte: Option<u64>,
1480
1481 obj_access_cost_delete_per_byte: Option<u64>,
1483
1484 obj_access_cost_verify_per_byte: Option<u64>,
1494
1495 max_type_to_layout_nodes: Option<u64>,
1497
1498 max_ptb_value_size: Option<u64>,
1500
1501 gas_model_version: Option<u64>,
1504
1505 obj_data_cost_refundable: Option<u64>,
1508
1509 obj_metadata_cost_non_refundable: Option<u64>,
1513
1514 storage_rebate_rate: Option<u64>,
1520
1521 storage_fund_reinvest_rate: Option<u64>,
1524
1525 reward_slashing_rate: Option<u64>,
1528
1529 storage_gas_price: Option<u64>,
1531
1532 accumulator_object_storage_cost: Option<u64>,
1534
1535 max_transactions_per_checkpoint: Option<u64>,
1540
1541 max_checkpoint_size_bytes: Option<u64>,
1545
1546 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1551
1552 address_from_bytes_cost_base: Option<u64>,
1557 address_to_u256_cost_base: Option<u64>,
1559 address_from_u256_cost_base: Option<u64>,
1561
1562 config_read_setting_impl_cost_base: Option<u64>,
1567 config_read_setting_impl_cost_per_byte: Option<u64>,
1568
1569 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1572 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1573 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1574 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1575 dynamic_field_add_child_object_cost_base: Option<u64>,
1577 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1578 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1579 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1580 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1582 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1583 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1584 dynamic_field_remove_child_object_cost_base: Option<u64>,
1586 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1587 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1588 dynamic_field_has_child_object_cost_base: Option<u64>,
1590 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1592 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1593 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1594
1595 event_emit_cost_base: Option<u64>,
1598 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1599 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1600 event_emit_output_cost_per_byte: Option<u64>,
1601 event_emit_auth_stream_cost: Option<u64>,
1602
1603 object_borrow_uid_cost_base: Option<u64>,
1606 object_delete_impl_cost_base: Option<u64>,
1608 object_record_new_uid_cost_base: Option<u64>,
1610
1611 transfer_transfer_internal_cost_base: Option<u64>,
1614 transfer_party_transfer_internal_cost_base: Option<u64>,
1616 transfer_freeze_object_cost_base: Option<u64>,
1618 transfer_share_object_cost_base: Option<u64>,
1620 transfer_receive_object_cost_base: Option<u64>,
1623 transfer_receive_object_cost_per_byte: Option<u64>,
1624 transfer_receive_object_type_cost_per_byte: Option<u64>,
1625
1626 tx_context_derive_id_cost_base: Option<u64>,
1629 tx_context_fresh_id_cost_base: Option<u64>,
1630 tx_context_sender_cost_base: Option<u64>,
1631 tx_context_epoch_cost_base: Option<u64>,
1632 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1633 tx_context_sponsor_cost_base: Option<u64>,
1634 tx_context_rgp_cost_base: Option<u64>,
1635 tx_context_gas_price_cost_base: Option<u64>,
1636 tx_context_gas_budget_cost_base: Option<u64>,
1637 tx_context_ids_created_cost_base: Option<u64>,
1638 tx_context_replace_cost_base: Option<u64>,
1639
1640 types_is_one_time_witness_cost_base: Option<u64>,
1643 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1644 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1645
1646 validator_validate_metadata_cost_base: Option<u64>,
1649 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1650
1651 crypto_invalid_arguments_cost: Option<u64>,
1653 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1655 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1656 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1657
1658 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1660 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1661 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1662
1663 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1665 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1666 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1667 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1668 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1669 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1670
1671 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1673
1674 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1676 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1677 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1678 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1679 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1680 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1681
1682 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1684 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1685 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1686 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1687 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1688 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1689
1690 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1692 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1693 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1694 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1695 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1696 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1697
1698 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1700 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1701 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1702
1703 ed25519_ed25519_verify_cost_base: Option<u64>,
1705 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1706 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1707
1708 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1710 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1711
1712 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1714 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1715 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1716 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1717 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1718
1719 hash_blake2b256_cost_base: Option<u64>,
1721 hash_blake2b256_data_cost_per_byte: Option<u64>,
1722 hash_blake2b256_data_cost_per_block: Option<u64>,
1723
1724 hash_keccak256_cost_base: Option<u64>,
1726 hash_keccak256_data_cost_per_byte: Option<u64>,
1727 hash_keccak256_data_cost_per_block: Option<u64>,
1728
1729 poseidon_bn254_cost_base: Option<u64>,
1731 poseidon_bn254_cost_per_block: Option<u64>,
1732
1733 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1735 group_ops_bls12381_decode_g1_cost: Option<u64>,
1736 group_ops_bls12381_decode_g2_cost: Option<u64>,
1737 group_ops_bls12381_decode_gt_cost: Option<u64>,
1738 group_ops_bls12381_scalar_add_cost: Option<u64>,
1739 group_ops_bls12381_g1_add_cost: Option<u64>,
1740 group_ops_bls12381_g2_add_cost: Option<u64>,
1741 group_ops_bls12381_gt_add_cost: Option<u64>,
1742 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1743 group_ops_bls12381_g1_sub_cost: Option<u64>,
1744 group_ops_bls12381_g2_sub_cost: Option<u64>,
1745 group_ops_bls12381_gt_sub_cost: Option<u64>,
1746 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1747 group_ops_bls12381_g1_mul_cost: Option<u64>,
1748 group_ops_bls12381_g2_mul_cost: Option<u64>,
1749 group_ops_bls12381_gt_mul_cost: Option<u64>,
1750 group_ops_bls12381_scalar_div_cost: Option<u64>,
1751 group_ops_bls12381_g1_div_cost: Option<u64>,
1752 group_ops_bls12381_g2_div_cost: Option<u64>,
1753 group_ops_bls12381_gt_div_cost: Option<u64>,
1754 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1755 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1756 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1757 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1758 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1759 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1760 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1761 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1762 group_ops_bls12381_msm_max_len: Option<u32>,
1763 group_ops_bls12381_pairing_cost: Option<u64>,
1764 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1765 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1766 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1767 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1768 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1769
1770 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1771 group_ops_ristretto_decode_point_cost: Option<u64>,
1772 group_ops_ristretto_scalar_add_cost: Option<u64>,
1773 group_ops_ristretto_point_add_cost: Option<u64>,
1774 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1775 group_ops_ristretto_point_sub_cost: Option<u64>,
1776 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1777 group_ops_ristretto_point_mul_cost: Option<u64>,
1778 group_ops_ristretto_scalar_div_cost: Option<u64>,
1779 group_ops_ristretto_point_div_cost: Option<u64>,
1780
1781 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
1782 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
1783
1784 hmac_hmac_sha3_256_cost_base: Option<u64>,
1786 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1787 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1788
1789 check_zklogin_id_cost_base: Option<u64>,
1791 check_zklogin_issuer_cost_base: Option<u64>,
1793
1794 vdf_verify_vdf_cost: Option<u64>,
1795 vdf_hash_to_input_cost: Option<u64>,
1796
1797 nitro_attestation_parse_base_cost: Option<u64>,
1799 nitro_attestation_parse_cost_per_byte: Option<u64>,
1800 nitro_attestation_verify_base_cost: Option<u64>,
1801 nitro_attestation_verify_cost_per_cert: Option<u64>,
1802
1803 bcs_per_byte_serialized_cost: Option<u64>,
1805 bcs_legacy_min_output_size_cost: Option<u64>,
1806 bcs_failure_cost: Option<u64>,
1807
1808 hash_sha2_256_base_cost: Option<u64>,
1809 hash_sha2_256_per_byte_cost: Option<u64>,
1810 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1811 hash_sha3_256_base_cost: Option<u64>,
1812 hash_sha3_256_per_byte_cost: Option<u64>,
1813 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1814 type_name_get_base_cost: Option<u64>,
1815 type_name_get_per_byte_cost: Option<u64>,
1816 type_name_id_base_cost: Option<u64>,
1817
1818 string_check_utf8_base_cost: Option<u64>,
1819 string_check_utf8_per_byte_cost: Option<u64>,
1820 string_is_char_boundary_base_cost: Option<u64>,
1821 string_sub_string_base_cost: Option<u64>,
1822 string_sub_string_per_byte_cost: Option<u64>,
1823 string_index_of_base_cost: Option<u64>,
1824 string_index_of_per_byte_pattern_cost: Option<u64>,
1825 string_index_of_per_byte_searched_cost: Option<u64>,
1826
1827 vector_empty_base_cost: Option<u64>,
1828 vector_length_base_cost: Option<u64>,
1829 vector_push_back_base_cost: Option<u64>,
1830 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1831 vector_borrow_base_cost: Option<u64>,
1832 vector_pop_back_base_cost: Option<u64>,
1833 vector_destroy_empty_base_cost: Option<u64>,
1834 vector_swap_base_cost: Option<u64>,
1835 debug_print_base_cost: Option<u64>,
1836 debug_print_stack_trace_base_cost: Option<u64>,
1837
1838 execution_version: Option<u64>,
1847
1848 consensus_bad_nodes_stake_threshold: Option<u64>,
1852
1853 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1854 max_age_of_jwk_in_epochs: Option<u64>,
1858
1859 random_beacon_reduction_allowed_delta: Option<u16>,
1863
1864 random_beacon_reduction_lower_bound: Option<u32>,
1867
1868 random_beacon_dkg_timeout_round: Option<u32>,
1871
1872 random_beacon_min_round_interval_ms: Option<u64>,
1874
1875 random_beacon_dkg_version: Option<u64>,
1878
1879 consensus_max_transaction_size_bytes: Option<u64>,
1882 consensus_max_transactions_in_block_bytes: Option<u64>,
1884 consensus_max_num_transactions_in_block: Option<u64>,
1886
1887 consensus_voting_rounds: Option<u32>,
1889
1890 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1892
1893 max_deferral_rounds_for_congestion_control: Option<u64>,
1896
1897 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1899
1900 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1902
1903 min_checkpoint_interval_ms: Option<u64>,
1905
1906 checkpoint_summary_version_specific_data: Option<u64>,
1908
1909 max_soft_bundle_size: Option<u64>,
1911
1912 bridge_should_try_to_finalize_committee: Option<bool>,
1916
1917 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1923
1924 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1927
1928 consensus_gc_depth: Option<u32>,
1931
1932 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1934
1935 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1937
1938 sip_45_consensus_amplification_threshold: Option<u64>,
1941
1942 use_object_per_epoch_marker_table_v2: Option<bool>,
1945
1946 consensus_commit_rate_estimation_window_size: Option<u32>,
1948
1949 #[serde(skip_serializing_if = "Vec::is_empty")]
1953 aliased_addresses: Vec<AliasedAddress>,
1954
1955 translation_per_command_base_charge: Option<u64>,
1958
1959 translation_per_input_base_charge: Option<u64>,
1962
1963 translation_pure_input_per_byte_charge: Option<u64>,
1965
1966 translation_per_type_node_charge: Option<u64>,
1970
1971 translation_per_reference_node_charge: Option<u64>,
1974
1975 translation_per_linkage_entry_charge: Option<u64>,
1978
1979 max_updates_per_settlement_txn: Option<u32>,
1981
1982 gasless_max_computation_units: Option<u64>,
1984
1985 #[skip_accessor]
1987 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1988
1989 gasless_max_unused_inputs: Option<u64>,
1993
1994 gasless_max_pure_input_bytes: Option<u64>,
1997
1998 gasless_max_tps: Option<u64>,
2000
2001 #[serde(skip_serializing_if = "Option::is_none")]
2002 #[skip_accessor]
2003 include_special_package_amendments: Option<Arc<Amendments>>,
2004
2005 gasless_max_tx_size_bytes: Option<u64>,
2008}
2009
2010#[derive(Clone, Serialize, Deserialize, Debug)]
2012pub struct AliasedAddress {
2013 pub original: [u8; 32],
2015 pub aliased: [u8; 32],
2017 pub allowed_tx_digests: Vec<[u8; 32]>,
2019}
2020
2021impl ProtocolConfig {
2023 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2036 if self.feature_flags.package_upgrades {
2037 Ok(())
2038 } else {
2039 Err(Error(format!(
2040 "package upgrades are not supported at {:?}",
2041 self.version
2042 )))
2043 }
2044 }
2045
2046 pub fn allow_receiving_object_id(&self) -> bool {
2047 self.feature_flags.allow_receiving_object_id
2048 }
2049
2050 pub fn receiving_objects_supported(&self) -> bool {
2051 self.feature_flags.receive_objects
2052 }
2053
2054 pub fn package_upgrades_supported(&self) -> bool {
2055 self.feature_flags.package_upgrades
2056 }
2057
2058 pub fn check_commit_root_state_digest_supported(&self) -> bool {
2059 self.feature_flags.commit_root_state_digest
2060 }
2061
2062 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
2063 self.feature_flags.advance_epoch_start_time_in_safe_mode
2064 }
2065
2066 pub fn loaded_child_objects_fixed(&self) -> bool {
2067 self.feature_flags.loaded_child_objects_fixed
2068 }
2069
2070 pub fn missing_type_is_compatibility_error(&self) -> bool {
2071 self.feature_flags.missing_type_is_compatibility_error
2072 }
2073
2074 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
2075 self.feature_flags.scoring_decision_with_validity_cutoff
2076 }
2077
2078 pub fn narwhal_versioned_metadata(&self) -> bool {
2079 self.feature_flags.narwhal_versioned_metadata
2080 }
2081
2082 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2083 self.feature_flags.consensus_order_end_of_epoch_last
2084 }
2085
2086 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2087 self.feature_flags.disallow_adding_abilities_on_upgrade
2088 }
2089
2090 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2091 self.feature_flags
2092 .disable_invariant_violation_check_in_swap_loc
2093 }
2094
2095 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2096 self.feature_flags
2097 .advance_to_highest_supported_protocol_version
2098 }
2099
2100 pub fn ban_entry_init(&self) -> bool {
2101 self.feature_flags.ban_entry_init
2102 }
2103
2104 pub fn package_digest_hash_module(&self) -> bool {
2105 self.feature_flags.package_digest_hash_module
2106 }
2107
2108 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2109 self.feature_flags
2110 .disallow_change_struct_type_params_on_upgrade
2111 }
2112
2113 pub fn no_extraneous_module_bytes(&self) -> bool {
2114 self.feature_flags.no_extraneous_module_bytes
2115 }
2116
2117 pub fn zklogin_auth(&self) -> bool {
2118 self.feature_flags.zklogin_auth
2119 }
2120
2121 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2122 &self.feature_flags.zklogin_supported_providers
2123 }
2124
2125 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2126 self.feature_flags.consensus_transaction_ordering
2127 }
2128
2129 pub fn simplified_unwrap_then_delete(&self) -> bool {
2130 self.feature_flags.simplified_unwrap_then_delete
2131 }
2132
2133 pub fn supports_upgraded_multisig(&self) -> bool {
2134 self.feature_flags.upgraded_multisig_supported
2135 }
2136
2137 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2138 self.feature_flags.txn_base_cost_as_multiplier
2139 }
2140
2141 pub fn shared_object_deletion(&self) -> bool {
2142 self.feature_flags.shared_object_deletion
2143 }
2144
2145 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2146 self.feature_flags.narwhal_new_leader_election_schedule
2147 }
2148
2149 pub fn loaded_child_object_format(&self) -> bool {
2150 self.feature_flags.loaded_child_object_format
2151 }
2152
2153 pub fn enable_jwk_consensus_updates(&self) -> bool {
2154 let ret = self.feature_flags.enable_jwk_consensus_updates;
2155 if ret {
2156 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2158 }
2159 ret
2160 }
2161
2162 pub fn simple_conservation_checks(&self) -> bool {
2163 self.feature_flags.simple_conservation_checks
2164 }
2165
2166 pub fn loaded_child_object_format_type(&self) -> bool {
2167 self.feature_flags.loaded_child_object_format_type
2168 }
2169
2170 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2171 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2172 if !ret {
2173 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2175 }
2176 ret
2177 }
2178
2179 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2180 self.feature_flags
2181 .recompute_has_public_transfer_in_execution
2182 }
2183
2184 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2186 self.enable_jwk_consensus_updates()
2187 }
2188
2189 pub fn random_beacon(&self) -> bool {
2190 self.feature_flags.random_beacon
2191 }
2192
2193 pub fn dkg_version(&self) -> u64 {
2194 self.random_beacon_dkg_version.unwrap_or(1)
2196 }
2197
2198 pub fn enable_bridge(&self) -> bool {
2199 let ret = self.feature_flags.bridge;
2200 if ret {
2201 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2203 }
2204 ret
2205 }
2206
2207 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2208 if !self.enable_bridge() {
2209 return false;
2210 }
2211 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2213 }
2214
2215 pub fn enable_effects_v2(&self) -> bool {
2216 self.feature_flags.enable_effects_v2
2217 }
2218
2219 pub fn narwhal_certificate_v2(&self) -> bool {
2220 self.feature_flags.narwhal_certificate_v2
2221 }
2222
2223 pub fn verify_legacy_zklogin_address(&self) -> bool {
2224 self.feature_flags.verify_legacy_zklogin_address
2225 }
2226
2227 pub fn accept_zklogin_in_multisig(&self) -> bool {
2228 self.feature_flags.accept_zklogin_in_multisig
2229 }
2230
2231 pub fn accept_passkey_in_multisig(&self) -> bool {
2232 self.feature_flags.accept_passkey_in_multisig
2233 }
2234
2235 pub fn validate_zklogin_public_identifier(&self) -> bool {
2236 self.feature_flags.validate_zklogin_public_identifier
2237 }
2238
2239 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2240 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2241 }
2242
2243 pub fn throughput_aware_consensus_submission(&self) -> bool {
2244 self.feature_flags.throughput_aware_consensus_submission
2245 }
2246
2247 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2248 self.feature_flags.include_consensus_digest_in_prologue
2249 }
2250
2251 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2252 self.feature_flags
2253 .record_consensus_determined_version_assignments_in_prologue
2254 }
2255
2256 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2257 self.feature_flags
2258 .record_additional_state_digest_in_prologue
2259 }
2260
2261 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2262 self.feature_flags
2263 .record_consensus_determined_version_assignments_in_prologue_v2
2264 }
2265
2266 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2267 self.feature_flags
2268 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2269 }
2270
2271 pub fn hardened_otw_check(&self) -> bool {
2272 self.feature_flags.hardened_otw_check
2273 }
2274
2275 pub fn enable_poseidon(&self) -> bool {
2276 self.feature_flags.enable_poseidon
2277 }
2278
2279 pub fn enable_coin_deny_list_v1(&self) -> bool {
2280 self.feature_flags.enable_coin_deny_list
2281 }
2282
2283 pub fn enable_accumulators(&self) -> bool {
2284 self.feature_flags.enable_accumulators
2285 }
2286
2287 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2288 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2289 }
2290
2291 pub fn create_root_accumulator_object(&self) -> bool {
2292 self.feature_flags.create_root_accumulator_object
2293 }
2294
2295 pub fn enable_address_balance_gas_payments(&self) -> bool {
2296 self.feature_flags.enable_address_balance_gas_payments
2297 }
2298
2299 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2300 self.feature_flags.address_balance_gas_check_rgp_at_signing
2301 }
2302
2303 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2304 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2305 }
2306
2307 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2308 self.feature_flags.enable_multi_epoch_transaction_expiration
2309 }
2310
2311 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2312 self.feature_flags.relax_valid_during_for_owned_inputs
2313 }
2314
2315 pub fn enable_authenticated_event_streams(&self) -> bool {
2316 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2317 }
2318
2319 pub fn enable_non_exclusive_writes(&self) -> bool {
2320 self.feature_flags.enable_non_exclusive_writes
2321 }
2322
2323 pub fn enable_coin_registry(&self) -> bool {
2324 self.feature_flags.enable_coin_registry
2325 }
2326
2327 pub fn enable_display_registry(&self) -> bool {
2328 self.feature_flags.enable_display_registry
2329 }
2330
2331 pub fn enable_coin_deny_list_v2(&self) -> bool {
2332 self.feature_flags.enable_coin_deny_list_v2
2333 }
2334
2335 pub fn enable_group_ops_native_functions(&self) -> bool {
2336 self.feature_flags.enable_group_ops_native_functions
2337 }
2338
2339 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2340 self.feature_flags.enable_group_ops_native_function_msm
2341 }
2342
2343 pub fn enable_ristretto255_group_ops(&self) -> bool {
2344 self.feature_flags.enable_ristretto255_group_ops
2345 }
2346
2347 pub fn enable_verify_bulletproofs_ristretto255(&self) -> bool {
2348 self.feature_flags.enable_verify_bulletproofs_ristretto255
2349 }
2350
2351 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2352 self.feature_flags.reject_mutable_random_on_entry_functions
2353 }
2354
2355 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2356 self.feature_flags.per_object_congestion_control_mode
2357 }
2358
2359 pub fn consensus_choice(&self) -> ConsensusChoice {
2360 self.feature_flags.consensus_choice
2361 }
2362
2363 pub fn consensus_network(&self) -> ConsensusNetwork {
2364 self.feature_flags.consensus_network
2365 }
2366
2367 pub fn correct_gas_payment_limit_check(&self) -> bool {
2368 self.feature_flags.correct_gas_payment_limit_check
2369 }
2370
2371 pub fn reshare_at_same_initial_version(&self) -> bool {
2372 self.feature_flags.reshare_at_same_initial_version
2373 }
2374
2375 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2376 self.feature_flags.resolve_abort_locations_to_package_id
2377 }
2378
2379 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2380 self.feature_flags.mysticeti_use_committed_subdag_digest
2381 }
2382
2383 pub fn enable_vdf(&self) -> bool {
2384 self.feature_flags.enable_vdf
2385 }
2386
2387 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2388 self.feature_flags.fresh_vm_on_framework_upgrade
2389 }
2390
2391 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2392 self.feature_flags.mysticeti_num_leaders_per_round
2393 }
2394
2395 pub fn soft_bundle(&self) -> bool {
2396 self.feature_flags.soft_bundle
2397 }
2398
2399 pub fn passkey_auth(&self) -> bool {
2400 self.feature_flags.passkey_auth
2401 }
2402
2403 pub fn authority_capabilities_v2(&self) -> bool {
2404 self.feature_flags.authority_capabilities_v2
2405 }
2406
2407 pub fn max_transaction_size_bytes(&self) -> u64 {
2408 self.consensus_max_transaction_size_bytes
2410 .unwrap_or(256 * 1024)
2411 }
2412
2413 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2414 if cfg!(msim) {
2415 256 * 1024
2416 } else {
2417 self.consensus_max_transactions_in_block_bytes
2418 .unwrap_or(512 * 1024)
2419 }
2420 }
2421
2422 pub fn max_num_transactions_in_block(&self) -> u64 {
2423 if cfg!(msim) {
2424 8
2425 } else {
2426 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2427 }
2428 }
2429
2430 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2431 self.feature_flags.rethrow_serialization_type_layout_errors
2432 }
2433
2434 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2435 self.feature_flags
2436 .consensus_distributed_vote_scoring_strategy
2437 }
2438
2439 pub fn consensus_round_prober(&self) -> bool {
2440 self.feature_flags.consensus_round_prober
2441 }
2442
2443 pub fn validate_identifier_inputs(&self) -> bool {
2444 self.feature_flags.validate_identifier_inputs
2445 }
2446
2447 pub fn gc_depth(&self) -> u32 {
2448 self.consensus_gc_depth.unwrap_or(0)
2449 }
2450
2451 pub fn mysticeti_fastpath(&self) -> bool {
2452 self.feature_flags.mysticeti_fastpath
2453 }
2454
2455 pub fn relocate_event_module(&self) -> bool {
2456 self.feature_flags.relocate_event_module
2457 }
2458
2459 pub fn uncompressed_g1_group_elements(&self) -> bool {
2460 self.feature_flags.uncompressed_g1_group_elements
2461 }
2462
2463 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2464 self.feature_flags
2465 .disallow_new_modules_in_deps_only_packages
2466 }
2467
2468 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2469 self.feature_flags.consensus_smart_ancestor_selection
2470 }
2471
2472 pub fn disable_preconsensus_locking(&self) -> bool {
2473 self.feature_flags.disable_preconsensus_locking
2474 }
2475
2476 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2477 self.feature_flags
2478 .consensus_round_prober_probe_accepted_rounds
2479 }
2480
2481 pub fn native_charging_v2(&self) -> bool {
2482 self.feature_flags.native_charging_v2
2483 }
2484
2485 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2486 let res = self.feature_flags.consensus_linearize_subdag_v2;
2487 assert!(
2488 !res || self.gc_depth() > 0,
2489 "The consensus linearize sub dag V2 requires GC to be enabled"
2490 );
2491 res
2492 }
2493
2494 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2495 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2496 assert!(
2497 !res || self.gc_depth() > 0,
2498 "The consensus median based commit timestamp requires GC to be enabled"
2499 );
2500 res
2501 }
2502
2503 pub fn consensus_batched_block_sync(&self) -> bool {
2504 self.feature_flags.consensus_batched_block_sync
2505 }
2506
2507 pub fn convert_type_argument_error(&self) -> bool {
2508 self.feature_flags.convert_type_argument_error
2509 }
2510
2511 pub fn variant_nodes(&self) -> bool {
2512 self.feature_flags.variant_nodes
2513 }
2514
2515 pub fn consensus_zstd_compression(&self) -> bool {
2516 self.feature_flags.consensus_zstd_compression
2517 }
2518
2519 pub fn enable_nitro_attestation(&self) -> bool {
2520 self.feature_flags.enable_nitro_attestation
2521 }
2522
2523 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2524 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2525 }
2526
2527 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2528 self.feature_flags
2529 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2530 }
2531
2532 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2533 self.feature_flags
2534 .enable_nitro_attestation_always_include_required_pcrs_parsing
2535 }
2536
2537 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2538 self.consensus_commit_rate_estimation_window_size
2539 .unwrap_or(0)
2540 }
2541
2542 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2543 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2547 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2549 window_size
2550 }
2551
2552 pub fn minimize_child_object_mutations(&self) -> bool {
2553 self.feature_flags.minimize_child_object_mutations
2554 }
2555
2556 pub fn move_native_context(&self) -> bool {
2557 self.feature_flags.move_native_context
2558 }
2559
2560 pub fn normalize_ptb_arguments(&self) -> bool {
2561 self.feature_flags.normalize_ptb_arguments
2562 }
2563
2564 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2565 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2566 }
2567
2568 pub fn max_ptb_value_size_v2(&self) -> bool {
2569 self.feature_flags.max_ptb_value_size_v2
2570 }
2571
2572 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2573 self.feature_flags.resolve_type_input_ids_to_defining_id
2574 }
2575
2576 pub fn enable_party_transfer(&self) -> bool {
2577 self.feature_flags.enable_party_transfer
2578 }
2579
2580 pub fn allow_unbounded_system_objects(&self) -> bool {
2581 self.feature_flags.allow_unbounded_system_objects
2582 }
2583
2584 pub fn type_tags_in_object_runtime(&self) -> bool {
2585 self.feature_flags.type_tags_in_object_runtime
2586 }
2587
2588 pub fn enable_ptb_execution_v2(&self) -> bool {
2589 self.feature_flags.enable_ptb_execution_v2
2590 }
2591
2592 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2593 self.feature_flags.better_adapter_type_resolution_errors
2594 }
2595
2596 pub fn record_time_estimate_processed(&self) -> bool {
2597 self.feature_flags.record_time_estimate_processed
2598 }
2599
2600 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2601 self.feature_flags
2602 .ignore_execution_time_observations_after_certs_closed
2603 }
2604
2605 pub fn dependency_linkage_error(&self) -> bool {
2606 self.feature_flags.dependency_linkage_error
2607 }
2608
2609 pub fn additional_multisig_checks(&self) -> bool {
2610 self.feature_flags.additional_multisig_checks
2611 }
2612
2613 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2614 self.feature_flags.debug_fatal_on_move_invariant_violation
2615 }
2616
2617 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2618 self.feature_flags.allow_private_accumulator_entrypoints
2619 }
2620
2621 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2622 self.feature_flags
2623 .additional_consensus_digest_indirect_state
2624 }
2625
2626 pub fn check_for_init_during_upgrade(&self) -> bool {
2627 self.feature_flags.check_for_init_during_upgrade
2628 }
2629
2630 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2631 self.feature_flags.per_command_shared_object_transfer_rules
2632 }
2633
2634 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2635 self.feature_flags
2636 .consensus_checkpoint_signature_key_includes_digest
2637 }
2638
2639 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2640 self.feature_flags
2641 .include_checkpoint_artifacts_digest_in_summary
2642 }
2643
2644 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2645 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2646 }
2647
2648 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2649 self.feature_flags.cancel_for_failed_dkg_early
2650 }
2651
2652 pub fn abstract_size_in_object_runtime(&self) -> bool {
2653 self.feature_flags.abstract_size_in_object_runtime
2654 }
2655
2656 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2657 self.feature_flags.object_runtime_charge_cache_load_gas
2658 }
2659
2660 pub fn additional_borrow_checks(&self) -> bool {
2661 self.feature_flags.additional_borrow_checks
2662 }
2663
2664 pub fn use_new_commit_handler(&self) -> bool {
2665 self.feature_flags.use_new_commit_handler
2666 }
2667
2668 pub fn better_loader_errors(&self) -> bool {
2669 self.feature_flags.better_loader_errors
2670 }
2671
2672 pub fn generate_df_type_layouts(&self) -> bool {
2673 self.feature_flags.generate_df_type_layouts
2674 }
2675
2676 pub fn allow_references_in_ptbs(&self) -> bool {
2677 self.feature_flags.allow_references_in_ptbs
2678 }
2679
2680 pub fn private_generics_verifier_v2(&self) -> bool {
2681 self.feature_flags.private_generics_verifier_v2
2682 }
2683
2684 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2685 self.feature_flags
2686 .deprecate_global_storage_ops_during_deserialization
2687 }
2688
2689 pub fn enable_observation_chunking(&self) -> bool {
2690 matches!(self.feature_flags.per_object_congestion_control_mode,
2691 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2692 if params.observations_chunk_size.is_some()
2693 )
2694 }
2695
2696 pub fn deprecate_global_storage_ops(&self) -> bool {
2697 self.feature_flags.deprecate_global_storage_ops
2698 }
2699
2700 pub fn normalize_depth_formula(&self) -> bool {
2701 self.feature_flags.normalize_depth_formula
2702 }
2703
2704 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2705 self.feature_flags.consensus_skip_gced_accept_votes
2706 }
2707
2708 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2709 self.feature_flags
2710 .include_cancelled_randomness_txns_in_prologue
2711 }
2712
2713 pub fn address_aliases(&self) -> bool {
2714 let address_aliases = self.feature_flags.address_aliases;
2715 assert!(
2716 !address_aliases || self.mysticeti_fastpath(),
2717 "Address aliases requires Mysticeti fastpath to be enabled"
2718 );
2719 if address_aliases {
2720 assert!(
2721 self.feature_flags.disable_preconsensus_locking,
2722 "Address aliases requires CertifiedTransaction to be disabled"
2723 );
2724 }
2725 address_aliases
2726 }
2727
2728 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2729 self.feature_flags.fix_checkpoint_signature_mapping
2730 }
2731
2732 pub fn enable_object_funds_withdraw(&self) -> bool {
2733 self.feature_flags.enable_object_funds_withdraw
2734 }
2735
2736 pub fn gas_rounding_halve_digits(&self) -> bool {
2737 self.feature_flags.gas_rounding_halve_digits
2738 }
2739
2740 pub fn flexible_tx_context_positions(&self) -> bool {
2741 self.feature_flags.flexible_tx_context_positions
2742 }
2743
2744 pub fn disable_entry_point_signature_check(&self) -> bool {
2745 self.feature_flags.disable_entry_point_signature_check
2746 }
2747
2748 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2749 self.feature_flags
2750 .consensus_skip_gced_blocks_in_direct_finalization
2751 }
2752
2753 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2754 self.feature_flags
2755 .convert_withdrawal_compatibility_ptb_arguments
2756 }
2757
2758 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2759 self.feature_flags.restrict_hot_or_not_entry_functions
2760 }
2761
2762 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2763 self.feature_flags.split_checkpoints_in_consensus_handler
2764 }
2765
2766 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2767 self.feature_flags
2768 .consensus_always_accept_system_transactions
2769 }
2770
2771 pub fn validator_metadata_verify_v2(&self) -> bool {
2772 self.feature_flags.validator_metadata_verify_v2
2773 }
2774
2775 pub fn defer_unpaid_amplification(&self) -> bool {
2776 self.feature_flags.defer_unpaid_amplification
2777 }
2778
2779 pub fn gasless_transaction_drop_safety(&self) -> bool {
2780 self.feature_flags.gasless_transaction_drop_safety
2781 }
2782
2783 pub fn new_vm_enabled(&self) -> bool {
2784 self.execution_version.is_some_and(|v| v >= 4)
2785 }
2786
2787 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2788 self.feature_flags.merge_randomness_into_checkpoint
2789 }
2790
2791 pub fn use_coin_party_owner(&self) -> bool {
2792 self.feature_flags.use_coin_party_owner
2793 }
2794
2795 pub fn enable_gasless(&self) -> bool {
2796 self.feature_flags.enable_gasless
2797 }
2798
2799 pub fn gasless_verify_remaining_balance(&self) -> bool {
2800 self.feature_flags.gasless_verify_remaining_balance
2801 }
2802
2803 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2804 debug_assert!(self.gasless_allowed_token_types.is_some());
2805 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2806 }
2807
2808 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2809 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2810 }
2811
2812 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2813 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2814 }
2815
2816 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2817 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2818 }
2819
2820 pub fn disallow_jump_orphans(&self) -> bool {
2821 self.feature_flags.disallow_jump_orphans
2822 }
2823
2824 pub fn early_return_receive_object_mismatched_type(&self) -> bool {
2825 self.feature_flags
2826 .early_return_receive_object_mismatched_type
2827 }
2828
2829 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2830 &self.include_special_package_amendments
2831 }
2832
2833 pub fn timestamp_based_epoch_close(&self) -> bool {
2834 self.feature_flags.timestamp_based_epoch_close
2835 }
2836
2837 pub fn limit_groth16_pvk_inputs(&self) -> bool {
2838 self.feature_flags.limit_groth16_pvk_inputs
2839 }
2840}
2841
2842#[cfg(not(msim))]
2843static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2844
2845#[cfg(msim)]
2847thread_local! {
2848 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2849}
2850
2851impl ProtocolConfig {
2853 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2855 assert!(
2857 version >= ProtocolVersion::MIN,
2858 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2859 version,
2860 ProtocolVersion::MIN.0,
2861 );
2862 assert!(
2863 version <= ProtocolVersion::MAX_ALLOWED,
2864 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2865 version,
2866 ProtocolVersion::MAX_ALLOWED.0,
2867 );
2868
2869 let mut ret = Self::get_for_version_impl(version, chain);
2870 ret.version = version;
2871
2872 ret = Self::apply_config_override(version, ret);
2873
2874 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2875 warn!(
2876 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2877 );
2878 let overrides: ProtocolConfigOptional =
2879 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2880 .expect("failed to parse ProtocolConfig override env variables");
2881 overrides.apply_to(&mut ret);
2882 }
2883
2884 ret
2885 }
2886
2887 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2890 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2891 let mut ret = Self::get_for_version_impl(version, chain);
2892 ret.version = version;
2893 ret = Self::apply_config_override(version, ret);
2894 Some(ret)
2895 } else {
2896 None
2897 }
2898 }
2899
2900 #[cfg(not(msim))]
2901 pub fn poison_get_for_min_version() {
2902 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2903 }
2904
2905 #[cfg(not(msim))]
2906 fn load_poison_get_for_min_version() -> bool {
2907 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2908 }
2909
2910 #[cfg(msim)]
2911 pub fn poison_get_for_min_version() {
2912 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2913 }
2914
2915 #[cfg(msim)]
2916 fn load_poison_get_for_min_version() -> bool {
2917 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2918 }
2919
2920 pub fn get_for_min_version() -> Self {
2923 if Self::load_poison_get_for_min_version() {
2924 panic!("get_for_min_version called on validator");
2925 }
2926 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2927 }
2928
2929 #[allow(non_snake_case)]
2939 pub fn get_for_max_version_UNSAFE() -> Self {
2940 if Self::load_poison_get_for_min_version() {
2941 panic!("get_for_max_version_UNSAFE called on validator");
2942 }
2943 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2944 }
2945
2946 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2947 #[cfg(msim)]
2948 {
2949 if version == ProtocolVersion::MAX_ALLOWED {
2951 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2952 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2953 return config;
2954 }
2955 }
2956
2957 let mut cfg = Self {
2960 version,
2962
2963 feature_flags: Default::default(),
2965
2966 max_tx_size_bytes: Some(128 * 1024),
2967 max_input_objects: Some(2048),
2969 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2970 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2971 max_gas_payment_objects: Some(256),
2972 max_modules_in_publish: Some(128),
2973 max_package_dependencies: None,
2974 max_arguments: Some(512),
2975 max_type_arguments: Some(16),
2976 max_type_argument_depth: Some(16),
2977 max_pure_argument_size: Some(16 * 1024),
2978 max_programmable_tx_commands: Some(1024),
2979 move_binary_format_version: Some(6),
2980 min_move_binary_format_version: None,
2981 binary_module_handles: None,
2982 binary_struct_handles: None,
2983 binary_function_handles: None,
2984 binary_function_instantiations: None,
2985 binary_signatures: None,
2986 binary_constant_pool: None,
2987 binary_identifiers: None,
2988 binary_address_identifiers: None,
2989 binary_struct_defs: None,
2990 binary_struct_def_instantiations: None,
2991 binary_function_defs: None,
2992 binary_field_handles: None,
2993 binary_field_instantiations: None,
2994 binary_friend_decls: None,
2995 binary_enum_defs: None,
2996 binary_enum_def_instantiations: None,
2997 binary_variant_handles: None,
2998 binary_variant_instantiation_handles: None,
2999 max_move_object_size: Some(250 * 1024),
3000 max_move_package_size: Some(100 * 1024),
3001 max_publish_or_upgrade_per_ptb: None,
3002 max_tx_gas: Some(10_000_000_000),
3003 max_gas_price: Some(100_000),
3004 max_gas_price_rgp_factor_for_aborted_transactions: None,
3005 max_gas_computation_bucket: Some(5_000_000),
3006 max_loop_depth: Some(5),
3007 max_generic_instantiation_length: Some(32),
3008 max_function_parameters: Some(128),
3009 max_basic_blocks: Some(1024),
3010 max_value_stack_size: Some(1024),
3011 max_type_nodes: Some(256),
3012 max_push_size: Some(10000),
3013 max_struct_definitions: Some(200),
3014 max_function_definitions: Some(1000),
3015 max_fields_in_struct: Some(32),
3016 max_dependency_depth: Some(100),
3017 max_num_event_emit: Some(256),
3018 max_num_new_move_object_ids: Some(2048),
3019 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
3020 max_num_deleted_move_object_ids: Some(2048),
3021 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
3022 max_num_transferred_move_object_ids: Some(2048),
3023 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
3024 max_event_emit_size: Some(250 * 1024),
3025 max_move_vector_len: Some(256 * 1024),
3026 max_type_to_layout_nodes: None,
3027 max_ptb_value_size: None,
3028
3029 max_back_edges_per_function: Some(10_000),
3030 max_back_edges_per_module: Some(10_000),
3031 max_verifier_meter_ticks_per_function: Some(6_000_000),
3032 max_meter_ticks_per_module: Some(6_000_000),
3033 max_meter_ticks_per_package: None,
3034
3035 object_runtime_max_num_cached_objects: Some(1000),
3036 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
3037 object_runtime_max_num_store_entries: Some(1000),
3038 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
3039 base_tx_cost_fixed: Some(110_000),
3040 package_publish_cost_fixed: Some(1_000),
3041 base_tx_cost_per_byte: Some(0),
3042 package_publish_cost_per_byte: Some(80),
3043 obj_access_cost_read_per_byte: Some(15),
3044 obj_access_cost_mutate_per_byte: Some(40),
3045 obj_access_cost_delete_per_byte: Some(40),
3046 obj_access_cost_verify_per_byte: Some(200),
3047 obj_data_cost_refundable: Some(100),
3048 obj_metadata_cost_non_refundable: Some(50),
3049 gas_model_version: Some(1),
3050 storage_rebate_rate: Some(9900),
3051 storage_fund_reinvest_rate: Some(500),
3052 reward_slashing_rate: Some(5000),
3053 storage_gas_price: Some(1),
3054 accumulator_object_storage_cost: None,
3055 max_transactions_per_checkpoint: Some(10_000),
3056 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
3057
3058 buffer_stake_for_protocol_upgrade_bps: Some(0),
3061
3062 address_from_bytes_cost_base: Some(52),
3066 address_to_u256_cost_base: Some(52),
3068 address_from_u256_cost_base: Some(52),
3070
3071 config_read_setting_impl_cost_base: None,
3074 config_read_setting_impl_cost_per_byte: None,
3075
3076 dynamic_field_hash_type_and_key_cost_base: Some(100),
3079 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
3080 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
3081 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
3082 dynamic_field_add_child_object_cost_base: Some(100),
3084 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
3085 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
3086 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
3087 dynamic_field_borrow_child_object_cost_base: Some(100),
3089 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3090 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3091 dynamic_field_remove_child_object_cost_base: Some(100),
3093 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3094 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3095 dynamic_field_has_child_object_cost_base: Some(100),
3097 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3099 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3100 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3101
3102 event_emit_cost_base: Some(52),
3105 event_emit_value_size_derivation_cost_per_byte: Some(2),
3106 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3107 event_emit_output_cost_per_byte: Some(10),
3108 event_emit_auth_stream_cost: None,
3109
3110 object_borrow_uid_cost_base: Some(52),
3113 object_delete_impl_cost_base: Some(52),
3115 object_record_new_uid_cost_base: Some(52),
3117
3118 transfer_transfer_internal_cost_base: Some(52),
3121 transfer_party_transfer_internal_cost_base: None,
3123 transfer_freeze_object_cost_base: Some(52),
3125 transfer_share_object_cost_base: Some(52),
3127 transfer_receive_object_cost_base: None,
3128 transfer_receive_object_type_cost_per_byte: None,
3129 transfer_receive_object_cost_per_byte: None,
3130
3131 tx_context_derive_id_cost_base: Some(52),
3134 tx_context_fresh_id_cost_base: None,
3135 tx_context_sender_cost_base: None,
3136 tx_context_epoch_cost_base: None,
3137 tx_context_epoch_timestamp_ms_cost_base: None,
3138 tx_context_sponsor_cost_base: None,
3139 tx_context_rgp_cost_base: None,
3140 tx_context_gas_price_cost_base: None,
3141 tx_context_gas_budget_cost_base: None,
3142 tx_context_ids_created_cost_base: None,
3143 tx_context_replace_cost_base: None,
3144
3145 types_is_one_time_witness_cost_base: Some(52),
3148 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3149 types_is_one_time_witness_type_cost_per_byte: Some(2),
3150
3151 validator_validate_metadata_cost_base: Some(52),
3154 validator_validate_metadata_data_cost_per_byte: Some(2),
3155
3156 crypto_invalid_arguments_cost: Some(100),
3158 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3160 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3161 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3162
3163 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3165 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3166 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3167
3168 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3170 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3171 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3172 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3173 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3174 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3175
3176 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3178
3179 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3181 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3182 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3183 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3184 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3185 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3186
3187 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3189 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3190 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3191 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3192 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3193 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3194
3195 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3197 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3198 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3199 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3200 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3201 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3202
3203 ecvrf_ecvrf_verify_cost_base: Some(52),
3205 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3206 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3207
3208 ed25519_ed25519_verify_cost_base: Some(52),
3210 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3211 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3212
3213 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3215 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3216
3217 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3219 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3220 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3221 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3222 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3223
3224 hash_blake2b256_cost_base: Some(52),
3226 hash_blake2b256_data_cost_per_byte: Some(2),
3227 hash_blake2b256_data_cost_per_block: Some(2),
3228
3229 hash_keccak256_cost_base: Some(52),
3231 hash_keccak256_data_cost_per_byte: Some(2),
3232 hash_keccak256_data_cost_per_block: Some(2),
3233
3234 poseidon_bn254_cost_base: None,
3235 poseidon_bn254_cost_per_block: None,
3236
3237 hmac_hmac_sha3_256_cost_base: Some(52),
3239 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3240 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3241
3242 group_ops_bls12381_decode_scalar_cost: None,
3244 group_ops_bls12381_decode_g1_cost: None,
3245 group_ops_bls12381_decode_g2_cost: None,
3246 group_ops_bls12381_decode_gt_cost: None,
3247 group_ops_bls12381_scalar_add_cost: None,
3248 group_ops_bls12381_g1_add_cost: None,
3249 group_ops_bls12381_g2_add_cost: None,
3250 group_ops_bls12381_gt_add_cost: None,
3251 group_ops_bls12381_scalar_sub_cost: None,
3252 group_ops_bls12381_g1_sub_cost: None,
3253 group_ops_bls12381_g2_sub_cost: None,
3254 group_ops_bls12381_gt_sub_cost: None,
3255 group_ops_bls12381_scalar_mul_cost: None,
3256 group_ops_bls12381_g1_mul_cost: None,
3257 group_ops_bls12381_g2_mul_cost: None,
3258 group_ops_bls12381_gt_mul_cost: None,
3259 group_ops_bls12381_scalar_div_cost: None,
3260 group_ops_bls12381_g1_div_cost: None,
3261 group_ops_bls12381_g2_div_cost: None,
3262 group_ops_bls12381_gt_div_cost: None,
3263 group_ops_bls12381_g1_hash_to_base_cost: None,
3264 group_ops_bls12381_g2_hash_to_base_cost: None,
3265 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3266 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3267 group_ops_bls12381_g1_msm_base_cost: None,
3268 group_ops_bls12381_g2_msm_base_cost: None,
3269 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3270 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3271 group_ops_bls12381_msm_max_len: None,
3272 group_ops_bls12381_pairing_cost: None,
3273 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3274 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3275 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3276 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3277 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3278
3279 group_ops_ristretto_decode_scalar_cost: None,
3280 group_ops_ristretto_decode_point_cost: None,
3281 group_ops_ristretto_scalar_add_cost: None,
3282 group_ops_ristretto_point_add_cost: None,
3283 group_ops_ristretto_scalar_sub_cost: None,
3284 group_ops_ristretto_point_sub_cost: None,
3285 group_ops_ristretto_scalar_mul_cost: None,
3286 group_ops_ristretto_point_mul_cost: None,
3287 group_ops_ristretto_scalar_div_cost: None,
3288 group_ops_ristretto_point_div_cost: None,
3289
3290 verify_bulletproofs_ristretto255_base_cost: None,
3291 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3292
3293 check_zklogin_id_cost_base: None,
3295 check_zklogin_issuer_cost_base: None,
3297
3298 vdf_verify_vdf_cost: None,
3299 vdf_hash_to_input_cost: None,
3300
3301 nitro_attestation_parse_base_cost: None,
3303 nitro_attestation_parse_cost_per_byte: None,
3304 nitro_attestation_verify_base_cost: None,
3305 nitro_attestation_verify_cost_per_cert: None,
3306
3307 bcs_per_byte_serialized_cost: None,
3308 bcs_legacy_min_output_size_cost: None,
3309 bcs_failure_cost: None,
3310 hash_sha2_256_base_cost: None,
3311 hash_sha2_256_per_byte_cost: None,
3312 hash_sha2_256_legacy_min_input_len_cost: None,
3313 hash_sha3_256_base_cost: None,
3314 hash_sha3_256_per_byte_cost: None,
3315 hash_sha3_256_legacy_min_input_len_cost: None,
3316 type_name_get_base_cost: None,
3317 type_name_get_per_byte_cost: None,
3318 type_name_id_base_cost: None,
3319 string_check_utf8_base_cost: None,
3320 string_check_utf8_per_byte_cost: None,
3321 string_is_char_boundary_base_cost: None,
3322 string_sub_string_base_cost: None,
3323 string_sub_string_per_byte_cost: None,
3324 string_index_of_base_cost: None,
3325 string_index_of_per_byte_pattern_cost: None,
3326 string_index_of_per_byte_searched_cost: None,
3327 vector_empty_base_cost: None,
3328 vector_length_base_cost: None,
3329 vector_push_back_base_cost: None,
3330 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3331 vector_borrow_base_cost: None,
3332 vector_pop_back_base_cost: None,
3333 vector_destroy_empty_base_cost: None,
3334 vector_swap_base_cost: None,
3335 debug_print_base_cost: None,
3336 debug_print_stack_trace_base_cost: None,
3337
3338 max_size_written_objects: None,
3339 max_size_written_objects_system_tx: None,
3340
3341 max_move_identifier_len: None,
3348 max_move_value_depth: None,
3349 max_move_enum_variants: None,
3350
3351 gas_rounding_step: None,
3352
3353 execution_version: None,
3354
3355 max_event_emit_size_total: None,
3356
3357 consensus_bad_nodes_stake_threshold: None,
3358
3359 max_jwk_votes_per_validator_per_epoch: None,
3360
3361 max_age_of_jwk_in_epochs: None,
3362
3363 random_beacon_reduction_allowed_delta: None,
3364
3365 random_beacon_reduction_lower_bound: None,
3366
3367 random_beacon_dkg_timeout_round: None,
3368
3369 random_beacon_min_round_interval_ms: None,
3370
3371 random_beacon_dkg_version: None,
3372
3373 consensus_max_transaction_size_bytes: None,
3374
3375 consensus_max_transactions_in_block_bytes: None,
3376
3377 consensus_max_num_transactions_in_block: None,
3378
3379 consensus_voting_rounds: None,
3380
3381 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3382
3383 max_deferral_rounds_for_congestion_control: None,
3384
3385 max_txn_cost_overage_per_object_in_commit: None,
3386
3387 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3388
3389 min_checkpoint_interval_ms: None,
3390
3391 checkpoint_summary_version_specific_data: None,
3392
3393 max_soft_bundle_size: None,
3394
3395 bridge_should_try_to_finalize_committee: None,
3396
3397 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3398
3399 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3400
3401 consensus_gc_depth: None,
3402
3403 gas_budget_based_txn_cost_cap_factor: None,
3404
3405 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3406
3407 sip_45_consensus_amplification_threshold: None,
3408
3409 use_object_per_epoch_marker_table_v2: None,
3410
3411 consensus_commit_rate_estimation_window_size: None,
3412
3413 aliased_addresses: vec![],
3414
3415 translation_per_command_base_charge: None,
3416 translation_per_input_base_charge: None,
3417 translation_pure_input_per_byte_charge: None,
3418 translation_per_type_node_charge: None,
3419 translation_per_reference_node_charge: None,
3420 translation_per_linkage_entry_charge: None,
3421
3422 max_updates_per_settlement_txn: None,
3423
3424 gasless_max_computation_units: None,
3425 gasless_allowed_token_types: None,
3426 gasless_max_unused_inputs: None,
3427 gasless_max_pure_input_bytes: None,
3428 gasless_max_tps: None,
3429 include_special_package_amendments: None,
3430 gasless_max_tx_size_bytes: None,
3431 };
3434 for cur in 2..=version.0 {
3435 match cur {
3436 1 => unreachable!(),
3437 2 => {
3438 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3439 }
3440 3 => {
3441 cfg.gas_model_version = Some(2);
3443 cfg.max_tx_gas = Some(50_000_000_000);
3445 cfg.base_tx_cost_fixed = Some(2_000);
3447 cfg.storage_gas_price = Some(76);
3449 cfg.feature_flags.loaded_child_objects_fixed = true;
3450 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3453 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3456 cfg.feature_flags.package_upgrades = true;
3457 }
3458 4 => {
3463 cfg.reward_slashing_rate = Some(10000);
3465 cfg.gas_model_version = Some(3);
3467 }
3468 5 => {
3469 cfg.feature_flags.missing_type_is_compatibility_error = true;
3470 cfg.gas_model_version = Some(4);
3471 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3472 }
3476 6 => {
3477 cfg.gas_model_version = Some(5);
3478 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3479 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3480 }
3481 7 => {
3482 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3483 cfg.feature_flags
3484 .disable_invariant_violation_check_in_swap_loc = true;
3485 cfg.feature_flags.ban_entry_init = true;
3486 cfg.feature_flags.package_digest_hash_module = true;
3487 }
3488 8 => {
3489 cfg.feature_flags
3490 .disallow_change_struct_type_params_on_upgrade = true;
3491 }
3492 9 => {
3493 cfg.max_move_identifier_len = Some(128);
3495 cfg.feature_flags.no_extraneous_module_bytes = true;
3496 cfg.feature_flags
3497 .advance_to_highest_supported_protocol_version = true;
3498 }
3499 10 => {
3500 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3501 cfg.max_meter_ticks_per_module = Some(16_000_000);
3502 }
3503 11 => {
3504 cfg.max_move_value_depth = Some(128);
3505 }
3506 12 => {
3507 cfg.feature_flags.narwhal_versioned_metadata = true;
3508 if chain != Chain::Mainnet {
3509 cfg.feature_flags.commit_root_state_digest = true;
3510 }
3511
3512 if chain != Chain::Mainnet && chain != Chain::Testnet {
3513 cfg.feature_flags.zklogin_auth = true;
3514 }
3515 }
3516 13 => {}
3517 14 => {
3518 cfg.gas_rounding_step = Some(1_000);
3519 cfg.gas_model_version = Some(6);
3520 }
3521 15 => {
3522 cfg.feature_flags.consensus_transaction_ordering =
3523 ConsensusTransactionOrdering::ByGasPrice;
3524 }
3525 16 => {
3526 cfg.feature_flags.simplified_unwrap_then_delete = true;
3527 }
3528 17 => {
3529 cfg.feature_flags.upgraded_multisig_supported = true;
3530 }
3531 18 => {
3532 cfg.execution_version = Some(1);
3533 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3542 cfg.base_tx_cost_fixed = Some(1_000);
3544 }
3545 19 => {
3546 cfg.max_num_event_emit = Some(1024);
3547 cfg.max_event_emit_size_total = Some(
3550 256 * 250 * 1024, );
3552 }
3553 20 => {
3554 cfg.feature_flags.commit_root_state_digest = true;
3555
3556 if chain != Chain::Mainnet {
3557 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3558 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3559 }
3560 }
3561
3562 21 => {
3563 if chain != Chain::Mainnet {
3564 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3565 "Google".to_string(),
3566 "Facebook".to_string(),
3567 "Twitch".to_string(),
3568 ]);
3569 }
3570 }
3571 22 => {
3572 cfg.feature_flags.loaded_child_object_format = true;
3573 }
3574 23 => {
3575 cfg.feature_flags.loaded_child_object_format_type = true;
3576 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3577 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3583 }
3584 24 => {
3585 cfg.feature_flags.simple_conservation_checks = true;
3586 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3587
3588 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3589
3590 if chain != Chain::Mainnet {
3591 cfg.feature_flags.enable_jwk_consensus_updates = true;
3592 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3594 cfg.max_age_of_jwk_in_epochs = Some(1);
3595 }
3596 }
3597 25 => {
3598 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3600 "Google".to_string(),
3601 "Facebook".to_string(),
3602 "Twitch".to_string(),
3603 ]);
3604 cfg.feature_flags.zklogin_auth = true;
3605
3606 cfg.feature_flags.enable_jwk_consensus_updates = true;
3608 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3609 cfg.max_age_of_jwk_in_epochs = Some(1);
3610 }
3611 26 => {
3612 cfg.gas_model_version = Some(7);
3613 if chain != Chain::Mainnet && chain != Chain::Testnet {
3615 cfg.transfer_receive_object_cost_base = Some(52);
3616 cfg.feature_flags.receive_objects = true;
3617 }
3618 }
3619 27 => {
3620 cfg.gas_model_version = Some(8);
3621 }
3622 28 => {
3623 cfg.check_zklogin_id_cost_base = Some(200);
3625 cfg.check_zklogin_issuer_cost_base = Some(200);
3627
3628 if chain != Chain::Mainnet && chain != Chain::Testnet {
3630 cfg.feature_flags.enable_effects_v2 = true;
3631 }
3632 }
3633 29 => {
3634 cfg.feature_flags.verify_legacy_zklogin_address = true;
3635 }
3636 30 => {
3637 if chain != Chain::Mainnet {
3639 cfg.feature_flags.narwhal_certificate_v2 = true;
3640 }
3641
3642 cfg.random_beacon_reduction_allowed_delta = Some(800);
3643 if chain != Chain::Mainnet {
3645 cfg.feature_flags.enable_effects_v2 = true;
3646 }
3647
3648 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3652
3653 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3654 }
3655 31 => {
3656 cfg.execution_version = Some(2);
3657 if chain != Chain::Mainnet && chain != Chain::Testnet {
3659 cfg.feature_flags.shared_object_deletion = true;
3660 }
3661 }
3662 32 => {
3663 if chain != Chain::Mainnet {
3665 cfg.feature_flags.accept_zklogin_in_multisig = true;
3666 }
3667 if chain != Chain::Mainnet {
3669 cfg.transfer_receive_object_cost_base = Some(52);
3670 cfg.feature_flags.receive_objects = true;
3671 }
3672 if chain != Chain::Mainnet && chain != Chain::Testnet {
3674 cfg.feature_flags.random_beacon = true;
3675 cfg.random_beacon_reduction_lower_bound = Some(1600);
3676 cfg.random_beacon_dkg_timeout_round = Some(3000);
3677 cfg.random_beacon_min_round_interval_ms = Some(150);
3678 }
3679 if chain != Chain::Testnet && chain != Chain::Mainnet {
3681 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3682 }
3683
3684 cfg.feature_flags.narwhal_certificate_v2 = true;
3686 }
3687 33 => {
3688 cfg.feature_flags.hardened_otw_check = true;
3689 cfg.feature_flags.allow_receiving_object_id = true;
3690
3691 cfg.transfer_receive_object_cost_base = Some(52);
3693 cfg.feature_flags.receive_objects = true;
3694
3695 if chain != Chain::Mainnet {
3697 cfg.feature_flags.shared_object_deletion = true;
3698 }
3699
3700 cfg.feature_flags.enable_effects_v2 = true;
3701 }
3702 34 => {}
3703 35 => {
3704 if chain != Chain::Mainnet && chain != Chain::Testnet {
3706 cfg.feature_flags.enable_poseidon = true;
3707 cfg.poseidon_bn254_cost_base = Some(260);
3708 cfg.poseidon_bn254_cost_per_block = Some(10);
3709 }
3710
3711 cfg.feature_flags.enable_coin_deny_list = true;
3712 }
3713 36 => {
3714 if chain != Chain::Mainnet && chain != Chain::Testnet {
3716 cfg.feature_flags.enable_group_ops_native_functions = true;
3717 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3718 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3720 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3721 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3722 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3723 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3724 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3725 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3726 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3727 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3728 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3729 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3730 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3731 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3732 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3733 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3734 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3735 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3736 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3737 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3738 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3739 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3740 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3741 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3742 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3743 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3744 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3745 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3746 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3747 cfg.group_ops_bls12381_msm_max_len = Some(32);
3748 cfg.group_ops_bls12381_pairing_cost = Some(52);
3749 }
3750 cfg.feature_flags.shared_object_deletion = true;
3752
3753 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3755 }
3757 37 => {
3758 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3759
3760 if chain != Chain::Mainnet {
3762 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3763 }
3764 }
3765 38 => {
3766 cfg.binary_module_handles = Some(100);
3767 cfg.binary_struct_handles = Some(300);
3768 cfg.binary_function_handles = Some(1500);
3769 cfg.binary_function_instantiations = Some(750);
3770 cfg.binary_signatures = Some(1000);
3771 cfg.binary_constant_pool = Some(4000);
3775 cfg.binary_identifiers = Some(10000);
3776 cfg.binary_address_identifiers = Some(100);
3777 cfg.binary_struct_defs = Some(200);
3778 cfg.binary_struct_def_instantiations = Some(100);
3779 cfg.binary_function_defs = Some(1000);
3780 cfg.binary_field_handles = Some(500);
3781 cfg.binary_field_instantiations = Some(250);
3782 cfg.binary_friend_decls = Some(100);
3783 cfg.max_package_dependencies = Some(32);
3785 cfg.max_modules_in_publish = Some(64);
3786 cfg.execution_version = Some(3);
3788 }
3789 39 => {
3790 }
3792 40 => {}
3793 41 => {
3794 cfg.feature_flags.enable_group_ops_native_functions = true;
3796 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3798 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3799 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3800 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3801 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3802 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3803 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3804 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3805 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3806 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3807 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3808 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3809 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3810 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3811 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3812 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3813 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3814 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3815 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3816 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3817 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3818 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3819 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3820 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3821 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3822 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3823 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3824 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3825 cfg.group_ops_bls12381_msm_max_len = Some(32);
3826 cfg.group_ops_bls12381_pairing_cost = Some(52);
3827 }
3828 42 => {}
3829 43 => {
3830 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3831 cfg.max_meter_ticks_per_package = Some(16_000_000);
3832 }
3833 44 => {
3834 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3836 if chain != Chain::Mainnet {
3838 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3839 }
3840 }
3841 45 => {
3842 if chain != Chain::Testnet && chain != Chain::Mainnet {
3844 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3845 }
3846
3847 if chain != Chain::Mainnet {
3848 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3850 }
3851 cfg.min_move_binary_format_version = Some(6);
3852 cfg.feature_flags.accept_zklogin_in_multisig = true;
3853
3854 if chain != Chain::Mainnet && chain != Chain::Testnet {
3858 cfg.feature_flags.bridge = true;
3859 }
3860 }
3861 46 => {
3862 if chain != Chain::Mainnet {
3864 cfg.feature_flags.bridge = true;
3865 }
3866
3867 cfg.feature_flags.reshare_at_same_initial_version = true;
3869 }
3870 47 => {}
3871 48 => {
3872 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3874
3875 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3877
3878 if chain != Chain::Mainnet {
3880 cfg.feature_flags.random_beacon = true;
3881 cfg.random_beacon_reduction_lower_bound = Some(1600);
3882 cfg.random_beacon_dkg_timeout_round = Some(3000);
3883 cfg.random_beacon_min_round_interval_ms = Some(200);
3884 }
3885
3886 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3888 }
3889 49 => {
3890 if chain != Chain::Testnet && chain != Chain::Mainnet {
3891 cfg.move_binary_format_version = Some(7);
3892 }
3893
3894 if chain != Chain::Mainnet && chain != Chain::Testnet {
3896 cfg.feature_flags.enable_vdf = true;
3897 cfg.vdf_verify_vdf_cost = Some(1500);
3900 cfg.vdf_hash_to_input_cost = Some(100);
3901 }
3902
3903 if chain != Chain::Testnet && chain != Chain::Mainnet {
3905 cfg.feature_flags
3906 .record_consensus_determined_version_assignments_in_prologue = true;
3907 }
3908
3909 if chain != Chain::Mainnet {
3911 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3912 }
3913
3914 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3916 }
3917 50 => {
3918 if chain != Chain::Mainnet {
3920 cfg.checkpoint_summary_version_specific_data = Some(1);
3921 cfg.min_checkpoint_interval_ms = Some(200);
3922 }
3923
3924 if chain != Chain::Testnet && chain != Chain::Mainnet {
3926 cfg.feature_flags
3927 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3928 }
3929
3930 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3931
3932 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3934 }
3935 51 => {
3936 cfg.random_beacon_dkg_version = Some(1);
3937
3938 if chain != Chain::Testnet && chain != Chain::Mainnet {
3939 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3940 }
3941 }
3942 52 => {
3943 if chain != Chain::Mainnet {
3944 cfg.feature_flags.soft_bundle = true;
3945 cfg.max_soft_bundle_size = Some(5);
3946 }
3947
3948 cfg.config_read_setting_impl_cost_base = Some(100);
3949 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3950
3951 if chain != Chain::Testnet && chain != Chain::Mainnet {
3953 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3954 cfg.feature_flags.per_object_congestion_control_mode =
3955 PerObjectCongestionControlMode::TotalTxCount;
3956 }
3957
3958 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3960
3961 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3963
3964 cfg.checkpoint_summary_version_specific_data = Some(1);
3966 cfg.min_checkpoint_interval_ms = Some(200);
3967
3968 if chain != Chain::Mainnet {
3970 cfg.feature_flags
3971 .record_consensus_determined_version_assignments_in_prologue = true;
3972 cfg.feature_flags
3973 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3974 }
3975 if chain != Chain::Mainnet {
3977 cfg.move_binary_format_version = Some(7);
3978 }
3979
3980 if chain != Chain::Testnet && chain != Chain::Mainnet {
3981 cfg.feature_flags.passkey_auth = true;
3982 }
3983 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3984 }
3985 53 => {
3986 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3988
3989 cfg.feature_flags
3991 .record_consensus_determined_version_assignments_in_prologue = true;
3992 cfg.feature_flags
3993 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3994
3995 if chain == Chain::Unknown {
3996 cfg.feature_flags.authority_capabilities_v2 = true;
3997 }
3998
3999 if chain != Chain::Mainnet {
4001 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
4002 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
4003 cfg.feature_flags.per_object_congestion_control_mode =
4004 PerObjectCongestionControlMode::TotalTxCount;
4005 }
4006
4007 cfg.bcs_per_byte_serialized_cost = Some(2);
4009 cfg.bcs_legacy_min_output_size_cost = Some(1);
4010 cfg.bcs_failure_cost = Some(52);
4011 cfg.debug_print_base_cost = Some(52);
4012 cfg.debug_print_stack_trace_base_cost = Some(52);
4013 cfg.hash_sha2_256_base_cost = Some(52);
4014 cfg.hash_sha2_256_per_byte_cost = Some(2);
4015 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
4016 cfg.hash_sha3_256_base_cost = Some(52);
4017 cfg.hash_sha3_256_per_byte_cost = Some(2);
4018 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
4019 cfg.type_name_get_base_cost = Some(52);
4020 cfg.type_name_get_per_byte_cost = Some(2);
4021 cfg.string_check_utf8_base_cost = Some(52);
4022 cfg.string_check_utf8_per_byte_cost = Some(2);
4023 cfg.string_is_char_boundary_base_cost = Some(52);
4024 cfg.string_sub_string_base_cost = Some(52);
4025 cfg.string_sub_string_per_byte_cost = Some(2);
4026 cfg.string_index_of_base_cost = Some(52);
4027 cfg.string_index_of_per_byte_pattern_cost = Some(2);
4028 cfg.string_index_of_per_byte_searched_cost = Some(2);
4029 cfg.vector_empty_base_cost = Some(52);
4030 cfg.vector_length_base_cost = Some(52);
4031 cfg.vector_push_back_base_cost = Some(52);
4032 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
4033 cfg.vector_borrow_base_cost = Some(52);
4034 cfg.vector_pop_back_base_cost = Some(52);
4035 cfg.vector_destroy_empty_base_cost = Some(52);
4036 cfg.vector_swap_base_cost = Some(52);
4037 }
4038 54 => {
4039 cfg.feature_flags.random_beacon = true;
4041 cfg.random_beacon_reduction_lower_bound = Some(1000);
4042 cfg.random_beacon_dkg_timeout_round = Some(3000);
4043 cfg.random_beacon_min_round_interval_ms = Some(500);
4044
4045 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
4047 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
4048 cfg.feature_flags.per_object_congestion_control_mode =
4049 PerObjectCongestionControlMode::TotalTxCount;
4050
4051 cfg.feature_flags.soft_bundle = true;
4053 cfg.max_soft_bundle_size = Some(5);
4054 }
4055 55 => {
4056 cfg.move_binary_format_version = Some(7);
4058
4059 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
4061 cfg.consensus_max_num_transactions_in_block = Some(512);
4064
4065 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
4066 }
4067 56 => {
4068 if chain == Chain::Mainnet {
4069 cfg.feature_flags.bridge = true;
4070 }
4071 }
4072 57 => {
4073 cfg.random_beacon_reduction_lower_bound = Some(800);
4075 }
4076 58 => {
4077 if chain == Chain::Mainnet {
4078 cfg.bridge_should_try_to_finalize_committee = Some(true);
4079 }
4080
4081 if chain != Chain::Mainnet && chain != Chain::Testnet {
4082 cfg.feature_flags
4084 .consensus_distributed_vote_scoring_strategy = true;
4085 }
4086 }
4087 59 => {
4088 cfg.feature_flags.consensus_round_prober = true;
4090 }
4091 60 => {
4092 cfg.max_type_to_layout_nodes = Some(512);
4093 cfg.feature_flags.validate_identifier_inputs = true;
4094 }
4095 61 => {
4096 if chain != Chain::Mainnet {
4097 cfg.feature_flags
4099 .consensus_distributed_vote_scoring_strategy = true;
4100 }
4101 cfg.random_beacon_reduction_lower_bound = Some(700);
4103
4104 if chain != Chain::Mainnet && chain != Chain::Testnet {
4105 cfg.feature_flags.mysticeti_fastpath = true;
4107 }
4108 }
4109 62 => {
4110 cfg.feature_flags.relocate_event_module = true;
4111 }
4112 63 => {
4113 cfg.feature_flags.per_object_congestion_control_mode =
4114 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4115 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4116 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4117 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4118 }
4119 64 => {
4120 cfg.feature_flags.per_object_congestion_control_mode =
4121 PerObjectCongestionControlMode::TotalTxCount;
4122 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4123 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4124 }
4125 65 => {
4126 cfg.feature_flags
4128 .consensus_distributed_vote_scoring_strategy = true;
4129 }
4130 66 => {
4131 if chain == Chain::Mainnet {
4132 cfg.feature_flags
4134 .consensus_distributed_vote_scoring_strategy = false;
4135 }
4136 }
4137 67 => {
4138 cfg.feature_flags
4140 .consensus_distributed_vote_scoring_strategy = true;
4141 }
4142 68 => {
4143 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4144 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4145 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4146 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4147 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4148
4149 if chain != Chain::Mainnet && chain != Chain::Testnet {
4150 cfg.feature_flags.uncompressed_g1_group_elements = true;
4151 }
4152
4153 cfg.feature_flags.per_object_congestion_control_mode =
4154 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4155 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4156 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4157 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4158 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4160 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4161
4162 cfg.random_beacon_reduction_lower_bound = Some(500);
4164
4165 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4166 }
4167 69 => {
4168 cfg.consensus_voting_rounds = Some(40);
4170
4171 if chain != Chain::Mainnet && chain != Chain::Testnet {
4172 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4174 }
4175
4176 if chain != Chain::Mainnet {
4177 cfg.feature_flags.uncompressed_g1_group_elements = true;
4178 }
4179 }
4180 70 => {
4181 if chain != Chain::Mainnet {
4182 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4184 cfg.feature_flags
4186 .consensus_round_prober_probe_accepted_rounds = true;
4187 }
4188
4189 cfg.poseidon_bn254_cost_per_block = Some(388);
4190
4191 cfg.gas_model_version = Some(9);
4192 cfg.feature_flags.native_charging_v2 = true;
4193 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4194 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4195 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4196 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4197 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4198 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4199 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4200 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4201
4202 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4204 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4205 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4206 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4207
4208 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4209 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4210 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4211 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4212 Some(8213);
4213 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4214 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4215 Some(9484);
4216
4217 cfg.hash_keccak256_cost_base = Some(10);
4218 cfg.hash_blake2b256_cost_base = Some(10);
4219
4220 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4222 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4223 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4224 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4225
4226 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4227 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4228 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4229 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4230
4231 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4232 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4233 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4234 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4235
4236 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4237 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4238 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4239 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4240
4241 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4242 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4243 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4244 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4245
4246 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4247 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4248
4249 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4250 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4251 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4252 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4253
4254 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4255 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4256 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4257 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4258
4259 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4260 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4261
4262 cfg.validator_validate_metadata_cost_base = Some(20000);
4263 }
4264 71 => {
4265 cfg.sip_45_consensus_amplification_threshold = Some(5);
4266
4267 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4269 }
4270 72 => {
4271 cfg.feature_flags.convert_type_argument_error = true;
4272
4273 cfg.max_tx_gas = Some(50_000_000_000_000);
4276 cfg.max_gas_price = Some(50_000_000_000);
4278
4279 cfg.feature_flags.variant_nodes = true;
4280 }
4281 73 => {
4282 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4284
4285 if chain != Chain::Mainnet && chain != Chain::Testnet {
4286 cfg.consensus_gc_depth = Some(60);
4289 }
4290
4291 if chain != Chain::Mainnet {
4292 cfg.feature_flags.consensus_zstd_compression = true;
4294 }
4295
4296 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4298 cfg.feature_flags
4300 .consensus_round_prober_probe_accepted_rounds = true;
4301
4302 cfg.feature_flags.per_object_congestion_control_mode =
4304 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4305 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4306 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4307 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4308 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4310 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4311 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4312 }
4313 74 => {
4314 if chain != Chain::Mainnet && chain != Chain::Testnet {
4316 cfg.feature_flags.enable_nitro_attestation = true;
4317 }
4318 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4319 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4320 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4321 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4322
4323 cfg.feature_flags.consensus_zstd_compression = true;
4325
4326 if chain != Chain::Mainnet && chain != Chain::Testnet {
4327 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4328 }
4329 }
4330 75 => {
4331 if chain != Chain::Mainnet {
4332 cfg.feature_flags.passkey_auth = true;
4333 }
4334 }
4335 76 => {
4336 if chain != Chain::Mainnet && chain != Chain::Testnet {
4337 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4338 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4339 }
4340 cfg.feature_flags.minimize_child_object_mutations = true;
4341
4342 if chain != Chain::Mainnet {
4343 cfg.feature_flags.accept_passkey_in_multisig = true;
4344 }
4345 }
4346 77 => {
4347 cfg.feature_flags.uncompressed_g1_group_elements = true;
4348
4349 if chain != Chain::Mainnet {
4350 cfg.consensus_gc_depth = Some(60);
4351 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4352 }
4353 }
4354 78 => {
4355 cfg.feature_flags.move_native_context = true;
4356 cfg.tx_context_fresh_id_cost_base = Some(52);
4357 cfg.tx_context_sender_cost_base = Some(30);
4358 cfg.tx_context_epoch_cost_base = Some(30);
4359 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4360 cfg.tx_context_sponsor_cost_base = Some(30);
4361 cfg.tx_context_gas_price_cost_base = Some(30);
4362 cfg.tx_context_gas_budget_cost_base = Some(30);
4363 cfg.tx_context_ids_created_cost_base = Some(30);
4364 cfg.tx_context_replace_cost_base = Some(30);
4365 cfg.gas_model_version = Some(10);
4366
4367 if chain != Chain::Mainnet {
4368 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4369 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4370
4371 cfg.feature_flags.per_object_congestion_control_mode =
4373 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4374 ExecutionTimeEstimateParams {
4375 target_utilization: 30,
4376 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4378 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4380 stored_observations_limit: u64::MAX,
4381 stake_weighted_median_threshold: 0,
4382 default_none_duration_for_new_keys: false,
4383 observations_chunk_size: None,
4384 },
4385 );
4386 }
4387 }
4388 79 => {
4389 if chain != Chain::Mainnet {
4390 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4391
4392 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4395
4396 cfg.feature_flags.consensus_batched_block_sync = true;
4397
4398 cfg.feature_flags.enable_nitro_attestation = true
4400 }
4401 cfg.feature_flags.normalize_ptb_arguments = true;
4402
4403 cfg.consensus_gc_depth = Some(60);
4404 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4405 }
4406 80 => {
4407 cfg.max_ptb_value_size = Some(1024 * 1024);
4408 }
4409 81 => {
4410 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4411 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4412 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4413 }
4414 82 => {
4415 cfg.feature_flags.max_ptb_value_size_v2 = true;
4416 }
4417 83 => {
4418 if chain == Chain::Mainnet {
4419 let aliased: [u8; 32] = Hex::decode(
4421 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4422 )
4423 .unwrap()
4424 .try_into()
4425 .unwrap();
4426
4427 cfg.aliased_addresses.push(AliasedAddress {
4429 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4430 aliased,
4431 allowed_tx_digests: vec![
4432 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4433 ],
4434 });
4435
4436 cfg.aliased_addresses.push(AliasedAddress {
4437 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4438 aliased,
4439 allowed_tx_digests: vec![
4440 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4441 ],
4442 });
4443 }
4444
4445 if chain != Chain::Mainnet {
4448 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4449 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4450
4451 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4453 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4454 cfg.feature_flags.per_object_congestion_control_mode =
4455 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4456 ExecutionTimeEstimateParams {
4457 target_utilization: 30,
4458 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4460 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4462 stored_observations_limit: u64::MAX,
4463 stake_weighted_median_threshold: 0,
4464 default_none_duration_for_new_keys: false,
4465 observations_chunk_size: None,
4466 },
4467 );
4468
4469 cfg.feature_flags.consensus_batched_block_sync = true;
4471
4472 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4475 cfg.feature_flags.enable_nitro_attestation = true;
4476 }
4477 }
4478 84 => {
4479 if chain == Chain::Mainnet {
4480 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4481 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4482
4483 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4485 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4486 cfg.feature_flags.per_object_congestion_control_mode =
4487 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4488 ExecutionTimeEstimateParams {
4489 target_utilization: 30,
4490 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4492 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4494 stored_observations_limit: u64::MAX,
4495 stake_weighted_median_threshold: 0,
4496 default_none_duration_for_new_keys: false,
4497 observations_chunk_size: None,
4498 },
4499 );
4500
4501 cfg.feature_flags.consensus_batched_block_sync = true;
4503
4504 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4507 cfg.feature_flags.enable_nitro_attestation = true;
4508 }
4509
4510 cfg.feature_flags.per_object_congestion_control_mode =
4512 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4513 ExecutionTimeEstimateParams {
4514 target_utilization: 30,
4515 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4517 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4519 stored_observations_limit: 20,
4520 stake_weighted_median_threshold: 0,
4521 default_none_duration_for_new_keys: false,
4522 observations_chunk_size: None,
4523 },
4524 );
4525 cfg.feature_flags.allow_unbounded_system_objects = true;
4526 }
4527 85 => {
4528 if chain != Chain::Mainnet && chain != Chain::Testnet {
4529 cfg.feature_flags.enable_party_transfer = true;
4530 }
4531
4532 cfg.feature_flags
4533 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4534 cfg.feature_flags.disallow_self_identifier = true;
4535 cfg.feature_flags.per_object_congestion_control_mode =
4536 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4537 ExecutionTimeEstimateParams {
4538 target_utilization: 50,
4539 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4541 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4543 stored_observations_limit: 20,
4544 stake_weighted_median_threshold: 0,
4545 default_none_duration_for_new_keys: false,
4546 observations_chunk_size: None,
4547 },
4548 );
4549 }
4550 86 => {
4551 cfg.feature_flags.type_tags_in_object_runtime = true;
4552 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4553
4554 cfg.feature_flags.per_object_congestion_control_mode =
4556 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4557 ExecutionTimeEstimateParams {
4558 target_utilization: 50,
4559 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4561 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4563 stored_observations_limit: 20,
4564 stake_weighted_median_threshold: 3334,
4565 default_none_duration_for_new_keys: false,
4566 observations_chunk_size: None,
4567 },
4568 );
4569 if chain != Chain::Mainnet {
4571 cfg.feature_flags.enable_party_transfer = true;
4572 }
4573 }
4574 87 => {
4575 if chain == Chain::Mainnet {
4576 cfg.feature_flags.record_time_estimate_processed = true;
4577 }
4578 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4579 }
4580 88 => {
4581 cfg.feature_flags.record_time_estimate_processed = true;
4582 cfg.tx_context_rgp_cost_base = Some(30);
4583 cfg.feature_flags
4584 .ignore_execution_time_observations_after_certs_closed = true;
4585
4586 cfg.feature_flags.per_object_congestion_control_mode =
4589 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4590 ExecutionTimeEstimateParams {
4591 target_utilization: 50,
4592 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4594 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4596 stored_observations_limit: 20,
4597 stake_weighted_median_threshold: 3334,
4598 default_none_duration_for_new_keys: true,
4599 observations_chunk_size: None,
4600 },
4601 );
4602 }
4603 89 => {
4604 cfg.feature_flags.dependency_linkage_error = true;
4605 cfg.feature_flags.additional_multisig_checks = true;
4606 }
4607 90 => {
4608 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4610 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4611 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4612 cfg.feature_flags.accept_passkey_in_multisig = true;
4613 cfg.feature_flags.passkey_auth = true;
4614 cfg.feature_flags.check_for_init_during_upgrade = true;
4615
4616 if chain != Chain::Mainnet {
4618 cfg.feature_flags.mysticeti_fastpath = true;
4619 }
4620 }
4621 91 => {
4622 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4623 }
4624 92 => {
4625 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4626 }
4627 93 => {
4628 cfg.feature_flags
4629 .consensus_checkpoint_signature_key_includes_digest = true;
4630 }
4631 94 => {
4632 cfg.feature_flags.per_object_congestion_control_mode =
4634 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4635 ExecutionTimeEstimateParams {
4636 target_utilization: 50,
4637 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4639 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4641 stored_observations_limit: 18,
4642 stake_weighted_median_threshold: 3334,
4643 default_none_duration_for_new_keys: true,
4644 observations_chunk_size: None,
4645 },
4646 );
4647
4648 cfg.feature_flags.enable_party_transfer = true;
4650 }
4651 95 => {
4652 cfg.type_name_id_base_cost = Some(52);
4653
4654 cfg.max_transactions_per_checkpoint = Some(20_000);
4656 }
4657 96 => {
4658 if chain != Chain::Mainnet && chain != Chain::Testnet {
4660 cfg.feature_flags
4661 .include_checkpoint_artifacts_digest_in_summary = true;
4662 }
4663 cfg.feature_flags.correct_gas_payment_limit_check = true;
4664 cfg.feature_flags.authority_capabilities_v2 = true;
4665 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4666 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4667 cfg.feature_flags.enable_coin_registry = true;
4668
4669 cfg.feature_flags.mysticeti_fastpath = true;
4671 }
4672 97 => {
4673 cfg.feature_flags.additional_borrow_checks = true;
4674 }
4675 98 => {
4676 cfg.event_emit_auth_stream_cost = Some(52);
4677 cfg.feature_flags.better_loader_errors = true;
4678 cfg.feature_flags.generate_df_type_layouts = true;
4679 }
4680 99 => {
4681 cfg.feature_flags.use_new_commit_handler = true;
4682 }
4683 100 => {
4684 cfg.feature_flags.private_generics_verifier_v2 = true;
4685 }
4686 101 => {
4687 cfg.feature_flags.create_root_accumulator_object = true;
4688 cfg.max_updates_per_settlement_txn = Some(100);
4689 if chain != Chain::Mainnet {
4690 cfg.feature_flags.enable_poseidon = true;
4691 }
4692 }
4693 102 => {
4694 cfg.feature_flags.per_object_congestion_control_mode =
4698 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4699 ExecutionTimeEstimateParams {
4700 target_utilization: 50,
4701 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4703 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4705 stored_observations_limit: 180,
4706 stake_weighted_median_threshold: 3334,
4707 default_none_duration_for_new_keys: true,
4708 observations_chunk_size: Some(18),
4709 },
4710 );
4711 cfg.feature_flags.deprecate_global_storage_ops = true;
4712 }
4713 103 => {}
4714 104 => {
4715 cfg.translation_per_command_base_charge = Some(1);
4716 cfg.translation_per_input_base_charge = Some(1);
4717 cfg.translation_pure_input_per_byte_charge = Some(1);
4718 cfg.translation_per_type_node_charge = Some(1);
4719 cfg.translation_per_reference_node_charge = Some(1);
4720 cfg.translation_per_linkage_entry_charge = Some(10);
4721 cfg.gas_model_version = Some(11);
4722 cfg.feature_flags.abstract_size_in_object_runtime = true;
4723 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4724 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4725 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4726 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4727 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4728 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4729 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4730 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4731 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4732 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4733 cfg.feature_flags.enable_ptb_execution_v2 = true;
4734
4735 cfg.poseidon_bn254_cost_base = Some(260);
4736
4737 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4738
4739 if chain != Chain::Mainnet {
4740 cfg.feature_flags
4741 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4742 }
4743
4744 cfg.feature_flags
4745 .include_cancelled_randomness_txns_in_prologue = true;
4746 }
4747 105 => {
4748 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4749 cfg.feature_flags.disable_preconsensus_locking = true;
4750
4751 if chain != Chain::Mainnet {
4752 cfg.feature_flags
4753 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4754 }
4755 }
4756 106 => {
4757 cfg.accumulator_object_storage_cost = Some(7600);
4759
4760 if chain != Chain::Mainnet && chain != Chain::Testnet {
4761 cfg.feature_flags.enable_accumulators = true;
4762 cfg.feature_flags.enable_address_balance_gas_payments = true;
4763 cfg.feature_flags.enable_authenticated_event_streams = true;
4764 cfg.feature_flags.enable_object_funds_withdraw = true;
4765 }
4766 }
4767 107 => {
4768 cfg.feature_flags
4769 .consensus_skip_gced_blocks_in_direct_finalization = true;
4770
4771 if in_integration_test() {
4773 cfg.consensus_gc_depth = Some(6);
4774 cfg.consensus_max_num_transactions_in_block = Some(8);
4775 }
4776 }
4777 108 => {
4778 cfg.feature_flags.gas_rounding_halve_digits = true;
4779 cfg.feature_flags.flexible_tx_context_positions = true;
4780 cfg.feature_flags.disable_entry_point_signature_check = true;
4781
4782 if chain != Chain::Mainnet {
4783 cfg.feature_flags.address_aliases = true;
4784
4785 cfg.feature_flags.enable_accumulators = true;
4786 cfg.feature_flags.enable_address_balance_gas_payments = true;
4787 }
4788
4789 cfg.feature_flags.enable_poseidon = true;
4790 }
4791 109 => {
4792 cfg.binary_variant_handles = Some(1024);
4793 cfg.binary_variant_instantiation_handles = Some(1024);
4794 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4795 }
4796 110 => {
4797 cfg.feature_flags
4798 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4799 cfg.feature_flags
4800 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4801 if chain != Chain::Mainnet && chain != Chain::Testnet {
4802 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4803 }
4804 cfg.feature_flags.validate_zklogin_public_identifier = true;
4805 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4806 cfg.feature_flags
4807 .consensus_always_accept_system_transactions = true;
4808 if chain != Chain::Mainnet {
4809 cfg.feature_flags.enable_object_funds_withdraw = true;
4810 }
4811 }
4812 111 => {
4813 cfg.feature_flags.validator_metadata_verify_v2 = true;
4814 }
4815 112 => {
4816 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4817 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4818 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4819 cfg.group_ops_ristretto_point_add_cost = Some(500);
4820 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4821 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4822 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4823 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4824 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4825 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4826
4827 if chain != Chain::Mainnet && chain != Chain::Testnet {
4828 cfg.feature_flags.enable_ristretto255_group_ops = true;
4829 }
4830 }
4831 113 => {
4832 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4833 if chain != Chain::Mainnet && chain != Chain::Testnet {
4834 cfg.feature_flags.defer_unpaid_amplification = true;
4835 }
4836 }
4837 114 => {
4838 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4839 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4840 if chain != Chain::Mainnet {
4841 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4842 cfg.feature_flags.enable_authenticated_event_streams = true;
4843 cfg.feature_flags
4844 .include_checkpoint_artifacts_digest_in_summary = true;
4845 }
4846 }
4847 115 => {
4848 cfg.feature_flags.normalize_depth_formula = true;
4849 }
4850 116 => {
4851 cfg.feature_flags.gasless_transaction_drop_safety = true;
4852 cfg.feature_flags.address_aliases = true;
4853 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4854 cfg.feature_flags.defer_unpaid_amplification = false;
4856 cfg.feature_flags.enable_display_registry = true;
4857 }
4858 117 => {}
4859 118 => {
4860 cfg.feature_flags.use_coin_party_owner = true;
4861 }
4862 119 => {
4863 cfg.execution_version = Some(4);
4865 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4866 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4867 if chain != Chain::Mainnet {
4868 cfg.feature_flags.enable_gasless = true;
4869 cfg.gasless_max_computation_units = Some(50_000);
4870 cfg.gasless_allowed_token_types = Some(vec![]);
4871 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4872 cfg.feature_flags
4873 .convert_withdrawal_compatibility_ptb_arguments = true;
4874 }
4875 cfg.gasless_max_unused_inputs = Some(1);
4876 cfg.gasless_max_pure_input_bytes = Some(32);
4877 if chain == Chain::Testnet {
4878 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4879 }
4880 cfg.transfer_receive_object_cost_per_byte = Some(1);
4881 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4882 }
4883 120 => {
4884 cfg.feature_flags.disallow_jump_orphans = true;
4885 }
4886 121 => {
4887 if chain != Chain::Mainnet {
4889 cfg.feature_flags.defer_unpaid_amplification = true;
4890 cfg.gasless_max_tps = Some(50);
4891 }
4892 cfg.feature_flags
4893 .early_return_receive_object_mismatched_type = true;
4894 }
4895 122 => {
4896 cfg.feature_flags.defer_unpaid_amplification = true;
4898 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4900 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4901 if chain != Chain::Mainnet && chain != Chain::Testnet {
4902 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4903 }
4904 cfg.feature_flags.gasless_verify_remaining_balance = true;
4905 cfg.include_special_package_amendments = match chain {
4906 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4907 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4908 Chain::Unknown => None,
4909 };
4910 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4911 cfg.gasless_max_tps = Some(300);
4912 cfg.gasless_max_computation_units = Some(5_000);
4913 }
4914 123 => {
4915 cfg.gas_model_version = Some(13);
4916 }
4917 124 => {
4918 if chain != Chain::Mainnet && chain != Chain::Testnet {
4919 cfg.feature_flags.timestamp_based_epoch_close = true;
4920 }
4921 cfg.gas_model_version = Some(14);
4922 cfg.feature_flags.limit_groth16_pvk_inputs = true;
4923
4924 cfg.feature_flags.enable_accumulators = true;
4930 cfg.feature_flags.enable_address_balance_gas_payments = true;
4931 cfg.feature_flags.enable_authenticated_event_streams = true;
4932 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4933 cfg.feature_flags.enable_object_funds_withdraw = true;
4934 cfg.feature_flags
4935 .convert_withdrawal_compatibility_ptb_arguments = true;
4936 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4937 cfg.feature_flags
4938 .include_checkpoint_artifacts_digest_in_summary = true;
4939 cfg.feature_flags.enable_gasless = true;
4940
4941 if chain == Chain::Mainnet {
4946 cfg.gasless_allowed_token_types = Some(vec![
4947 (MAINNET_USDC.to_string(), 10_000),
4948 (MAINNET_USDSUI.to_string(), 10_000),
4949 (MAINNET_SUI_USDE.to_string(), 10_000),
4950 (MAINNET_USDY.to_string(), 10_000),
4951 (MAINNET_FDUSD.to_string(), 10_000),
4952 (MAINNET_AUSD.to_string(), 10_000),
4953 (MAINNET_USDB.to_string(), 10_000),
4954 ]);
4955 }
4956 }
4957 _ => panic!("unsupported version {:?}", version),
4968 }
4969 }
4970
4971 cfg
4972 }
4973
4974 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4975 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4976 || !self.feature_flags.split_checkpoints_in_consensus_handler
4977 {
4978 return;
4979 }
4980
4981 if !mysten_common::in_test_configuration() {
4982 return;
4983 }
4984
4985 use rand::{Rng, SeedableRng, rngs::StdRng};
4986 let mut rng = StdRng::from_seed(*seed);
4987 let max_txns = rng.gen_range(10..=100u64);
4988 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4989 self.max_transactions_per_checkpoint = Some(max_txns);
4990 }
4991
4992 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4998 let (
4999 max_back_edges_per_function,
5000 max_back_edges_per_module,
5001 sanity_check_with_regex_reference_safety,
5002 ) = if let Some((
5003 max_back_edges_per_function,
5004 max_back_edges_per_module,
5005 sanity_check_with_regex_reference_safety,
5006 )) = signing_limits
5007 {
5008 (
5009 Some(max_back_edges_per_function),
5010 Some(max_back_edges_per_module),
5011 Some(sanity_check_with_regex_reference_safety),
5012 )
5013 } else {
5014 (None, None, None)
5015 };
5016
5017 let additional_borrow_checks = if signing_limits.is_some() {
5018 true
5020 } else {
5021 self.additional_borrow_checks()
5022 };
5023 let deprecate_global_storage_ops = if signing_limits.is_some() {
5024 true
5026 } else {
5027 self.deprecate_global_storage_ops()
5028 };
5029
5030 VerifierConfig {
5031 max_loop_depth: Some(self.max_loop_depth() as usize),
5032 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
5033 max_function_parameters: Some(self.max_function_parameters() as usize),
5034 max_basic_blocks: Some(self.max_basic_blocks() as usize),
5035 max_value_stack_size: self.max_value_stack_size() as usize,
5036 max_type_nodes: Some(self.max_type_nodes() as usize),
5037 max_push_size: Some(self.max_push_size() as usize),
5038 max_dependency_depth: Some(self.max_dependency_depth() as usize),
5039 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
5040 max_function_definitions: Some(self.max_function_definitions() as usize),
5041 max_data_definitions: Some(self.max_struct_definitions() as usize),
5042 max_constant_vector_len: Some(self.max_move_vector_len()),
5043 max_back_edges_per_function,
5044 max_back_edges_per_module,
5045 max_basic_blocks_in_script: None,
5046 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
5048 allow_receiving_object_id: self.allow_receiving_object_id(),
5049 reject_mutable_random_on_entry_functions: self
5050 .reject_mutable_random_on_entry_functions(),
5051 bytecode_version: self.move_binary_format_version(),
5052 max_variants_in_enum: self.max_move_enum_variants_as_option(),
5053 additional_borrow_checks,
5054 better_loader_errors: self.better_loader_errors(),
5055 private_generics_verifier_v2: self.private_generics_verifier_v2(),
5056 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
5057 .map(|limit| limit as u128),
5058 deprecate_global_storage_ops,
5059 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
5060 switch_to_regex_reference_safety: false,
5061 disallow_jump_orphans: self.disallow_jump_orphans(),
5062 }
5063 }
5064
5065 pub fn binary_config(
5066 &self,
5067 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
5068 ) -> BinaryConfig {
5069 let deprecate_global_storage_ops =
5070 override_deprecate_global_storage_ops_during_deserialization
5071 .unwrap_or_else(|| self.deprecate_global_storage_ops());
5072 BinaryConfig::new(
5073 self.move_binary_format_version(),
5074 self.min_move_binary_format_version_as_option()
5075 .unwrap_or(VERSION_1),
5076 self.no_extraneous_module_bytes(),
5077 deprecate_global_storage_ops,
5078 TableConfig {
5079 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5080 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5081 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5082 function_instantiations: self
5083 .binary_function_instantiations_as_option()
5084 .unwrap_or(u16::MAX),
5085 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5086 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5087 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5088 address_identifiers: self
5089 .binary_address_identifiers_as_option()
5090 .unwrap_or(u16::MAX),
5091 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5092 struct_def_instantiations: self
5093 .binary_struct_def_instantiations_as_option()
5094 .unwrap_or(u16::MAX),
5095 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5096 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5097 field_instantiations: self
5098 .binary_field_instantiations_as_option()
5099 .unwrap_or(u16::MAX),
5100 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5101 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5102 enum_def_instantiations: self
5103 .binary_enum_def_instantiations_as_option()
5104 .unwrap_or(u16::MAX),
5105 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5106 variant_instantiation_handles: self
5107 .binary_variant_instantiation_handles_as_option()
5108 .unwrap_or(u16::MAX),
5109 },
5110 )
5111 }
5112
5113 #[cfg(not(msim))]
5117 pub fn apply_overrides_for_testing(
5118 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5119 ) -> OverrideGuard {
5120 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5121 assert!(cur.is_none(), "config override already present");
5122 *cur = Some(Box::new(override_fn));
5123 OverrideGuard
5124 }
5125
5126 #[cfg(msim)]
5130 pub fn apply_overrides_for_testing(
5131 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
5132 ) -> OverrideGuard {
5133 CONFIG_OVERRIDE.with(|ovr| {
5134 let mut cur = ovr.borrow_mut();
5135 assert!(cur.is_none(), "config override already present");
5136 *cur = Some(Box::new(override_fn));
5137 OverrideGuard
5138 })
5139 }
5140
5141 #[cfg(not(msim))]
5142 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5143 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5144 warn!(
5145 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5146 );
5147 ret = override_fn(version, ret);
5148 }
5149 ret
5150 }
5151
5152 #[cfg(msim)]
5153 fn apply_config_override(version: ProtocolVersion, ret: Self) -> Self {
5154 CONFIG_OVERRIDE.with(|ovr| {
5155 if let Some(override_fn) = &*ovr.borrow() {
5156 warn!(
5157 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5158 );
5159 override_fn(version, ret)
5160 } else {
5161 ret
5162 }
5163 })
5164 }
5165}
5166
5167impl ProtocolConfig {
5171 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
5172 self.feature_flags
5173 .advance_to_highest_supported_protocol_version = val
5174 }
5175 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
5176 self.feature_flags.commit_root_state_digest = val
5177 }
5178 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
5179 self.feature_flags.zklogin_auth = val
5180 }
5181 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
5182 self.feature_flags.enable_jwk_consensus_updates = val
5183 }
5184 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
5185 self.feature_flags.random_beacon = val
5186 }
5187
5188 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
5189 self.feature_flags.upgraded_multisig_supported = val
5190 }
5191 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
5192 self.feature_flags.accept_zklogin_in_multisig = val
5193 }
5194
5195 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
5196 self.feature_flags.shared_object_deletion = val;
5197 }
5198
5199 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
5200 self.feature_flags.narwhal_new_leader_election_schedule = val;
5201 }
5202
5203 pub fn set_receive_object_for_testing(&mut self, val: bool) {
5204 self.feature_flags.receive_objects = val
5205 }
5206 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
5207 self.feature_flags.narwhal_certificate_v2 = val
5208 }
5209 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
5210 self.feature_flags.verify_legacy_zklogin_address = val
5211 }
5212
5213 pub fn set_per_object_congestion_control_mode_for_testing(
5214 &mut self,
5215 val: PerObjectCongestionControlMode,
5216 ) {
5217 self.feature_flags.per_object_congestion_control_mode = val;
5218 }
5219
5220 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5221 self.feature_flags.consensus_choice = val;
5222 }
5223
5224 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5225 self.feature_flags.consensus_network = val;
5226 }
5227
5228 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5229 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5230 }
5231
5232 pub fn set_disable_bridge_for_testing(&mut self) {
5233 self.feature_flags.bridge = false
5234 }
5235
5236 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5237 self.feature_flags.mysticeti_num_leaders_per_round = val;
5238 }
5239
5240 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5241 self.feature_flags.soft_bundle = val;
5242 }
5243
5244 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5245 self.feature_flags.passkey_auth = val
5246 }
5247
5248 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5249 self.feature_flags.enable_party_transfer = val
5250 }
5251
5252 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5253 self.feature_flags
5254 .consensus_distributed_vote_scoring_strategy = val;
5255 }
5256
5257 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5258 self.feature_flags.consensus_round_prober = val;
5259 }
5260
5261 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5262 self.feature_flags
5263 .disallow_new_modules_in_deps_only_packages = val;
5264 }
5265
5266 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5267 self.feature_flags.correct_gas_payment_limit_check = val;
5268 }
5269
5270 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5271 self.feature_flags.address_aliases = val;
5272 }
5273
5274 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5275 self.feature_flags
5276 .consensus_round_prober_probe_accepted_rounds = val;
5277 }
5278
5279 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5280 self.feature_flags.mysticeti_fastpath = val;
5281 }
5282
5283 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5284 self.feature_flags.accept_passkey_in_multisig = val;
5285 }
5286
5287 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5288 self.feature_flags.consensus_batched_block_sync = val;
5289 }
5290
5291 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5292 self.feature_flags.record_time_estimate_processed = val;
5293 }
5294
5295 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5296 &mut self,
5297 val: bool,
5298 ) {
5299 self.feature_flags
5300 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5301 }
5302
5303 pub fn enable_accumulators_for_testing(&mut self) {
5304 self.feature_flags.enable_accumulators = true;
5305 }
5306
5307 pub fn disable_accumulators_for_testing(&mut self) {
5308 self.feature_flags.enable_accumulators = false;
5309 self.feature_flags.enable_address_balance_gas_payments = false;
5310 }
5311
5312 pub fn enable_coin_reservation_for_testing(&mut self) {
5313 self.feature_flags.enable_coin_reservation_obj_refs = true;
5314 self.feature_flags
5315 .convert_withdrawal_compatibility_ptb_arguments = true;
5316 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5319 }
5320
5321 pub fn disable_coin_reservation_for_testing(&mut self) {
5322 self.feature_flags.enable_coin_reservation_obj_refs = false;
5323 self.feature_flags
5324 .convert_withdrawal_compatibility_ptb_arguments = false;
5325 }
5326
5327 pub fn create_root_accumulator_object_for_testing(&mut self) {
5328 self.feature_flags.create_root_accumulator_object = true;
5329 }
5330
5331 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5332 self.feature_flags.create_root_accumulator_object = false;
5333 }
5334
5335 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5336 self.feature_flags.enable_accumulators = true;
5337 self.feature_flags.allow_private_accumulator_entrypoints = true;
5338 self.feature_flags.enable_address_balance_gas_payments = true;
5339 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5340 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5341 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5342 }
5343
5344 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5345 self.feature_flags.enable_address_balance_gas_payments = false;
5346 }
5347
5348 pub fn enable_gasless_for_testing(&mut self) {
5349 self.enable_address_balance_gas_payments_for_testing();
5350 self.feature_flags.enable_gasless = true;
5351 self.feature_flags.gasless_verify_remaining_balance = true;
5352 self.gasless_max_computation_units = Some(5_000);
5353 self.gasless_allowed_token_types = Some(vec![]);
5354 self.gasless_max_tps = Some(1000);
5355 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5356 }
5357
5358 pub fn disable_gasless_for_testing(&mut self) {
5359 self.feature_flags.enable_gasless = false;
5360 self.gasless_max_computation_units = None;
5361 self.gasless_allowed_token_types = None;
5362 }
5363
5364 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5365 self.gasless_allowed_token_types = Some(types);
5366 }
5367
5368 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5369 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5370 }
5371
5372 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5373 self.enable_accumulators_for_testing();
5374 self.feature_flags.enable_authenticated_event_streams = true;
5375 self.feature_flags
5376 .include_checkpoint_artifacts_digest_in_summary = true;
5377 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5378 }
5379
5380 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5381 self.feature_flags.enable_authenticated_event_streams = false;
5382 }
5383
5384 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5385 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5386 }
5387
5388 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5389 self.feature_flags.enable_non_exclusive_writes = true;
5390 }
5391
5392 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5393 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5394 }
5395
5396 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5397 &mut self,
5398 val: bool,
5399 ) {
5400 self.feature_flags
5401 .ignore_execution_time_observations_after_certs_closed = val;
5402 }
5403
5404 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5405 &mut self,
5406 val: bool,
5407 ) {
5408 self.feature_flags
5409 .consensus_checkpoint_signature_key_includes_digest = val;
5410 }
5411
5412 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5413 self.feature_flags.cancel_for_failed_dkg_early = val;
5414 }
5415
5416 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5417 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5418 }
5419
5420 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5421 self.feature_flags.authority_capabilities_v2 = val;
5422 }
5423
5424 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5425 self.feature_flags.allow_references_in_ptbs = true;
5426 }
5427
5428 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5429 self.feature_flags.consensus_skip_gced_accept_votes = val;
5430 }
5431
5432 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5433 self.feature_flags.enable_object_funds_withdraw = val;
5434 }
5435
5436 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5437 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5438 }
5439
5440 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5441 self.feature_flags.merge_randomness_into_checkpoint = val;
5442 }
5443}
5444
5445#[cfg(not(msim))]
5446type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5447
5448#[cfg(not(msim))]
5449static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5450
5451#[cfg(msim)]
5452type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5453
5454#[cfg(msim)]
5455thread_local! {
5456 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5457}
5458
5459#[must_use]
5460pub struct OverrideGuard;
5461
5462#[cfg(not(msim))]
5463impl Drop for OverrideGuard {
5464 fn drop(&mut self) {
5465 info!("restoring override fn");
5466 *CONFIG_OVERRIDE.lock().unwrap() = None;
5467 }
5468}
5469
5470#[cfg(msim)]
5471impl Drop for OverrideGuard {
5472 fn drop(&mut self) {
5473 info!("restoring override fn");
5474 CONFIG_OVERRIDE.with(|ovr| {
5475 *ovr.borrow_mut() = None;
5476 });
5477 }
5478}
5479
5480#[derive(PartialEq, Eq)]
5483pub enum LimitThresholdCrossed {
5484 None,
5485 Soft(u128, u128),
5486 Hard(u128, u128),
5487}
5488
5489pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5492 x: T,
5493 soft_limit: U,
5494 hard_limit: V,
5495) -> LimitThresholdCrossed {
5496 let x: V = x.into();
5497 let soft_limit: V = soft_limit.into();
5498
5499 debug_assert!(soft_limit <= hard_limit);
5500
5501 if x >= hard_limit {
5504 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5505 } else if x < soft_limit {
5506 LimitThresholdCrossed::None
5507 } else {
5508 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5509 }
5510}
5511
5512#[macro_export]
5513macro_rules! check_limit {
5514 ($x:expr, $hard:expr) => {
5515 check_limit!($x, $hard, $hard)
5516 };
5517 ($x:expr, $soft:expr, $hard:expr) => {
5518 check_limit_in_range($x as u64, $soft, $hard)
5519 };
5520}
5521
5522#[macro_export]
5526macro_rules! check_limit_by_meter {
5527 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5528 let (h, metered_str) = if $is_metered {
5530 ($metered_limit, "metered")
5531 } else {
5532 ($unmetered_hard_limit, "unmetered")
5534 };
5535 use sui_protocol_config::check_limit_in_range;
5536 let result = check_limit_in_range($x as u64, $metered_limit, h);
5537 match result {
5538 LimitThresholdCrossed::None => {}
5539 LimitThresholdCrossed::Soft(_, _) => {
5540 $metric.with_label_values(&[metered_str, "soft"]).inc();
5541 }
5542 LimitThresholdCrossed::Hard(_, _) => {
5543 $metric.with_label_values(&[metered_str, "hard"]).inc();
5544 }
5545 };
5546 result
5547 }};
5548}
5549
5550pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5553
5554static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5555 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5556
5557static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5558 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5559
5560fn parse_amendments(json: &str) -> Arc<Amendments> {
5561 #[derive(serde::Deserialize)]
5562 struct AmendmentEntry {
5563 root: String,
5564 deps: Vec<DepEntry>,
5565 }
5566
5567 #[derive(serde::Deserialize)]
5568 struct DepEntry {
5569 original_id: String,
5570 version_id: String,
5571 }
5572
5573 let entries: Vec<AmendmentEntry> =
5574 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5575 let mut amendments = BTreeMap::new();
5576 for entry in entries {
5577 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5578 let mut dep_ids = BTreeMap::new();
5579 for dep in entry.deps {
5580 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5581 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5582 assert!(
5583 dep_ids.insert(orig_id, upgraded_id).is_none(),
5584 "Duplicate original ID in amendments table"
5585 );
5586 }
5587 assert!(
5588 amendments.insert(root_id, dep_ids).is_none(),
5589 "Duplicate root ID in amendments table"
5590 );
5591 }
5592 Arc::new(amendments)
5593}
5594
5595#[cfg(all(test, not(msim)))]
5596mod test {
5597 use insta::assert_yaml_snapshot;
5598
5599 use super::*;
5600
5601 #[test]
5602 fn snapshot_tests() {
5603 println!("\n============================================================================");
5604 println!("! !");
5605 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5606 println!("! !");
5607 println!("============================================================================\n");
5608 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5609 let chain_str = match chain_id {
5613 Chain::Unknown => "".to_string(),
5614 _ => format!("{:?}_", chain_id),
5615 };
5616 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5617 let cur = ProtocolVersion::new(i);
5618 assert_yaml_snapshot!(
5619 format!("{}version_{}", chain_str, cur.as_u64()),
5620 ProtocolConfig::get_for_version(cur, *chain_id)
5621 );
5622 }
5623 }
5624 }
5625
5626 #[test]
5627 fn test_getters() {
5628 let prot: ProtocolConfig =
5629 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5630 assert_eq!(
5631 prot.max_arguments(),
5632 prot.max_arguments_as_option().unwrap()
5633 );
5634 }
5635
5636 #[test]
5637 fn test_setters() {
5638 let mut prot: ProtocolConfig =
5639 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5640 prot.set_max_arguments_for_testing(123);
5641 assert_eq!(prot.max_arguments(), 123);
5642
5643 prot.set_max_arguments_from_str_for_testing("321".to_string());
5644 assert_eq!(prot.max_arguments(), 321);
5645
5646 prot.disable_max_arguments_for_testing();
5647 assert_eq!(prot.max_arguments_as_option(), None);
5648
5649 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5650 assert_eq!(prot.max_arguments(), 456);
5651 }
5652
5653 #[test]
5654 fn test_get_for_version_if_supported_applies_test_overrides() {
5655 let before =
5656 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5657 .unwrap();
5658
5659 assert!(!before.enable_coin_reservation_obj_refs());
5660
5661 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5662 cfg.enable_coin_reservation_for_testing();
5663 cfg
5664 });
5665
5666 let after =
5667 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5668 .unwrap();
5669
5670 assert!(after.enable_coin_reservation_obj_refs());
5671 }
5672
5673 #[test]
5674 #[should_panic(expected = "unsupported version")]
5675 fn max_version_test() {
5676 let _ = ProtocolConfig::get_for_version_impl(
5679 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5680 Chain::Unknown,
5681 );
5682 }
5683
5684 #[test]
5685 fn lookup_by_string_test() {
5686 let prot: ProtocolConfig =
5687 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5688 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5690
5691 assert!(
5692 prot.lookup_attr("max_arguments".to_string())
5693 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5694 );
5695
5696 assert!(
5698 prot.lookup_attr("max_move_identifier_len".to_string())
5699 .is_none()
5700 );
5701
5702 let prot: ProtocolConfig =
5704 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5705 assert!(
5706 prot.lookup_attr("max_move_identifier_len".to_string())
5707 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5708 );
5709
5710 let prot: ProtocolConfig =
5711 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5712 assert!(
5714 prot.attr_map()
5715 .get("max_move_identifier_len")
5716 .unwrap()
5717 .is_none()
5718 );
5719 assert!(
5721 prot.attr_map().get("max_arguments").unwrap()
5722 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5723 );
5724
5725 let prot: ProtocolConfig =
5727 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5728 assert!(
5730 prot.feature_flags
5731 .lookup_attr("some random string".to_owned())
5732 .is_none()
5733 );
5734 assert!(
5735 !prot
5736 .feature_flags
5737 .attr_map()
5738 .contains_key("some random string")
5739 );
5740
5741 assert!(
5743 prot.feature_flags
5744 .lookup_attr("package_upgrades".to_owned())
5745 == Some(false)
5746 );
5747 assert!(
5748 prot.feature_flags
5749 .attr_map()
5750 .get("package_upgrades")
5751 .unwrap()
5752 == &false
5753 );
5754 let prot: ProtocolConfig =
5755 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5756 assert!(
5758 prot.feature_flags
5759 .lookup_attr("package_upgrades".to_owned())
5760 == Some(true)
5761 );
5762 assert!(
5763 prot.feature_flags
5764 .attr_map()
5765 .get("package_upgrades")
5766 .unwrap()
5767 == &true
5768 );
5769 }
5770
5771 #[test]
5772 fn limit_range_fn_test() {
5773 let low = 100u32;
5774 let high = 10000u64;
5775
5776 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5777 assert!(matches!(
5778 check_limit!(255u16, low, high),
5779 LimitThresholdCrossed::Soft(255u128, 100)
5780 ));
5781 assert!(matches!(
5787 check_limit!(2550000u64, low, high),
5788 LimitThresholdCrossed::Hard(2550000, 10000)
5789 ));
5790
5791 assert!(matches!(
5792 check_limit!(2550000u64, high, high),
5793 LimitThresholdCrossed::Hard(2550000, 10000)
5794 ));
5795
5796 assert!(matches!(
5797 check_limit!(1u8, high),
5798 LimitThresholdCrossed::None
5799 ));
5800
5801 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5802
5803 assert!(matches!(
5804 check_limit!(2550000u64, high),
5805 LimitThresholdCrossed::Hard(2550000, 10000)
5806 ));
5807 }
5808
5809 #[test]
5810 fn linkage_amendments_load() {
5811 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5812 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5813 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5814 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5815 }
5816}