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