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)]
329pub struct ProtocolVersion(u64);
330
331impl ProtocolVersion {
332 pub const MIN: Self = Self(MIN_PROTOCOL_VERSION);
337
338 pub const MAX: Self = Self(MAX_PROTOCOL_VERSION);
339
340 #[cfg(not(msim))]
341 pub const MAX_ALLOWED: Self = Self::MAX;
342
343 #[cfg(msim)]
345 pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);
346
347 pub fn new(v: u64) -> Self {
348 Self(v)
349 }
350
351 pub const fn as_u64(&self) -> u64 {
352 self.0
353 }
354
355 pub fn max() -> Self {
358 Self::MAX
359 }
360
361 pub fn prev(self) -> Self {
362 Self(self.0.checked_sub(1).unwrap())
363 }
364}
365
366impl From<u64> for ProtocolVersion {
367 fn from(v: u64) -> Self {
368 Self::new(v)
369 }
370}
371
372impl std::ops::Sub<u64> for ProtocolVersion {
373 type Output = Self;
374 fn sub(self, rhs: u64) -> Self::Output {
375 Self::new(self.0 - rhs)
376 }
377}
378
379impl std::ops::Add<u64> for ProtocolVersion {
380 type Output = Self;
381 fn add(self, rhs: u64) -> Self::Output {
382 Self::new(self.0 + rhs)
383 }
384}
385
386#[derive(
387 Clone, Serialize, Deserialize, Debug, Default, PartialEq, Copy, PartialOrd, Ord, Eq, ValueEnum,
388)]
389pub enum Chain {
390 Mainnet,
391 Testnet,
392 #[default]
393 Unknown,
394}
395
396impl Chain {
397 pub fn as_str(self) -> &'static str {
398 match self {
399 Chain::Mainnet => "mainnet",
400 Chain::Testnet => "testnet",
401 Chain::Unknown => "unknown",
402 }
403 }
404}
405
406pub struct Error(pub String);
407
408#[derive(Default, Clone, Serialize, Deserialize, Debug, ProtocolConfigFeatureFlagsGetters)]
411struct FeatureFlags {
412 #[serde(skip_serializing_if = "is_false")]
415 package_upgrades: bool,
416 #[serde(skip_serializing_if = "is_false")]
419 commit_root_state_digest: bool,
420 #[serde(skip_serializing_if = "is_false")]
422 advance_epoch_start_time_in_safe_mode: bool,
423 #[serde(skip_serializing_if = "is_false")]
426 loaded_child_objects_fixed: bool,
427 #[serde(skip_serializing_if = "is_false")]
430 missing_type_is_compatibility_error: bool,
431 #[serde(skip_serializing_if = "is_false")]
434 scoring_decision_with_validity_cutoff: bool,
435
436 #[serde(skip_serializing_if = "is_false")]
439 consensus_order_end_of_epoch_last: bool,
440
441 #[serde(skip_serializing_if = "is_false")]
443 disallow_adding_abilities_on_upgrade: bool,
444 #[serde(skip_serializing_if = "is_false")]
446 disable_invariant_violation_check_in_swap_loc: bool,
447 #[serde(skip_serializing_if = "is_false")]
450 advance_to_highest_supported_protocol_version: bool,
451 #[serde(skip_serializing_if = "is_false")]
453 ban_entry_init: bool,
454 #[serde(skip_serializing_if = "is_false")]
456 package_digest_hash_module: bool,
457 #[serde(skip_serializing_if = "is_false")]
459 disallow_change_struct_type_params_on_upgrade: bool,
460 #[serde(skip_serializing_if = "is_false")]
462 no_extraneous_module_bytes: bool,
463 #[serde(skip_serializing_if = "is_false")]
465 narwhal_versioned_metadata: bool,
466
467 #[serde(skip_serializing_if = "is_false")]
469 zklogin_auth: bool,
470 #[serde(skip_serializing_if = "ConsensusTransactionOrdering::is_none")]
472 consensus_transaction_ordering: ConsensusTransactionOrdering,
473
474 #[serde(skip_serializing_if = "is_false")]
482 simplified_unwrap_then_delete: bool,
483 #[serde(skip_serializing_if = "is_false")]
485 upgraded_multisig_supported: bool,
486 #[serde(skip_serializing_if = "is_false")]
488 txn_base_cost_as_multiplier: bool,
489
490 #[serde(skip_serializing_if = "is_false")]
492 shared_object_deletion: bool,
493
494 #[serde(skip_serializing_if = "is_false")]
496 narwhal_new_leader_election_schedule: bool,
497
498 #[serde(skip_serializing_if = "is_empty")]
500 zklogin_supported_providers: BTreeSet<String>,
501
502 #[serde(skip_serializing_if = "is_false")]
504 loaded_child_object_format: bool,
505
506 #[serde(skip_serializing_if = "is_false")]
507 enable_jwk_consensus_updates: bool,
508
509 #[serde(skip_serializing_if = "is_false")]
510 end_of_epoch_transaction_supported: bool,
511
512 #[serde(skip_serializing_if = "is_false")]
515 simple_conservation_checks: bool,
516
517 #[serde(skip_serializing_if = "is_false")]
519 loaded_child_object_format_type: bool,
520
521 #[serde(skip_serializing_if = "is_false")]
523 receive_objects: bool,
524
525 #[serde(skip_serializing_if = "is_false")]
527 consensus_checkpoint_signature_key_includes_digest: bool,
528
529 #[serde(skip_serializing_if = "is_false")]
531 random_beacon: bool,
532
533 #[serde(skip_serializing_if = "is_false")]
535 bridge: bool,
536
537 #[serde(skip_serializing_if = "is_false")]
538 enable_effects_v2: bool,
539
540 #[serde(skip_serializing_if = "is_false")]
542 narwhal_certificate_v2: bool,
543
544 #[serde(skip_serializing_if = "is_false")]
546 verify_legacy_zklogin_address: bool,
547
548 #[serde(skip_serializing_if = "is_false")]
550 throughput_aware_consensus_submission: bool,
551
552 #[serde(skip_serializing_if = "is_false")]
554 recompute_has_public_transfer_in_execution: bool,
555
556 #[serde(skip_serializing_if = "is_false")]
558 accept_zklogin_in_multisig: bool,
559
560 #[serde(skip_serializing_if = "is_false")]
562 accept_passkey_in_multisig: bool,
563
564 #[serde(skip_serializing_if = "is_false")]
566 validate_zklogin_public_identifier: bool,
567
568 #[serde(skip_serializing_if = "is_false")]
571 include_consensus_digest_in_prologue: bool,
572
573 #[serde(skip_serializing_if = "is_false")]
575 hardened_otw_check: bool,
576
577 #[serde(skip_serializing_if = "is_false")]
579 allow_receiving_object_id: bool,
580
581 #[serde(skip_serializing_if = "is_false")]
583 enable_poseidon: bool,
584
585 #[serde(skip_serializing_if = "is_false")]
587 enable_coin_deny_list: bool,
588
589 #[serde(skip_serializing_if = "is_false")]
591 enable_group_ops_native_functions: bool,
592
593 #[serde(skip_serializing_if = "is_false")]
595 enable_group_ops_native_function_msm: bool,
596
597 #[serde(skip_serializing_if = "is_false")]
599 enable_ristretto255_group_ops: bool,
600
601 #[serde(skip_serializing_if = "is_false")]
603 enable_verify_bulletproofs_ristretto255: bool,
604
605 #[serde(skip_serializing_if = "is_false")]
607 enable_nitro_attestation: bool,
608
609 #[serde(skip_serializing_if = "is_false")]
611 enable_nitro_attestation_upgraded_parsing: bool,
612
613 #[serde(skip_serializing_if = "is_false")]
615 enable_nitro_attestation_all_nonzero_pcrs_parsing: bool,
616
617 #[serde(skip_serializing_if = "is_false")]
619 enable_nitro_attestation_always_include_required_pcrs_parsing: bool,
620
621 #[serde(skip_serializing_if = "is_false")]
623 reject_mutable_random_on_entry_functions: bool,
624
625 #[serde(skip_serializing_if = "PerObjectCongestionControlMode::is_none")]
627 per_object_congestion_control_mode: PerObjectCongestionControlMode,
628
629 #[serde(skip_serializing_if = "ConsensusChoice::is_narwhal")]
631 consensus_choice: ConsensusChoice,
632
633 #[serde(skip_serializing_if = "ConsensusNetwork::is_anemo")]
635 consensus_network: ConsensusNetwork,
636
637 #[serde(skip_serializing_if = "is_false")]
639 correct_gas_payment_limit_check: bool,
640
641 #[serde(skip_serializing_if = "Option::is_none")]
643 zklogin_max_epoch_upper_bound_delta: Option<u64>,
644
645 #[serde(skip_serializing_if = "is_false")]
647 mysticeti_leader_scoring_and_schedule: bool,
648
649 #[serde(skip_serializing_if = "is_false")]
651 reshare_at_same_initial_version: bool,
652
653 #[serde(skip_serializing_if = "is_false")]
655 resolve_abort_locations_to_package_id: bool,
656
657 #[serde(skip_serializing_if = "is_false")]
661 mysticeti_use_committed_subdag_digest: bool,
662
663 #[serde(skip_serializing_if = "is_false")]
665 enable_vdf: bool,
666
667 #[serde(skip_serializing_if = "is_false")]
672 record_consensus_determined_version_assignments_in_prologue: bool,
673 #[serde(skip_serializing_if = "is_false")]
674 record_consensus_determined_version_assignments_in_prologue_v2: bool,
675
676 #[serde(skip_serializing_if = "is_false")]
678 fresh_vm_on_framework_upgrade: bool,
679
680 #[serde(skip_serializing_if = "is_false")]
688 prepend_prologue_tx_in_consensus_commit_in_checkpoints: bool,
689
690 #[serde(skip_serializing_if = "Option::is_none")]
692 mysticeti_num_leaders_per_round: Option<usize>,
693
694 #[serde(skip_serializing_if = "is_false")]
696 soft_bundle: bool,
697
698 #[serde(skip_serializing_if = "is_false")]
700 enable_coin_deny_list_v2: bool,
701
702 #[serde(skip_serializing_if = "is_false")]
704 passkey_auth: bool,
705
706 #[serde(skip_serializing_if = "is_false")]
708 authority_capabilities_v2: bool,
709
710 #[serde(skip_serializing_if = "is_false")]
712 rethrow_serialization_type_layout_errors: bool,
713
714 #[serde(skip_serializing_if = "is_false")]
716 consensus_distributed_vote_scoring_strategy: bool,
717
718 #[serde(skip_serializing_if = "is_false")]
720 consensus_round_prober: bool,
721
722 #[serde(skip_serializing_if = "is_false")]
724 validate_identifier_inputs: bool,
725
726 #[serde(skip_serializing_if = "is_false")]
728 disallow_self_identifier: bool,
729
730 #[serde(skip_serializing_if = "is_false")]
732 mysticeti_fastpath: bool,
733
734 #[serde(skip_serializing_if = "is_false")]
738 disable_preconsensus_locking: bool,
739
740 #[serde(skip_serializing_if = "is_false")]
742 relocate_event_module: bool,
743
744 #[serde(skip_serializing_if = "is_false")]
746 uncompressed_g1_group_elements: bool,
747
748 #[serde(skip_serializing_if = "is_false")]
749 disallow_new_modules_in_deps_only_packages: bool,
750
751 #[serde(skip_serializing_if = "is_false")]
753 consensus_smart_ancestor_selection: bool,
754
755 #[serde(skip_serializing_if = "is_false")]
757 consensus_round_prober_probe_accepted_rounds: bool,
758
759 #[serde(skip_serializing_if = "is_false")]
761 native_charging_v2: bool,
762
763 #[serde(skip_serializing_if = "is_false")]
766 consensus_linearize_subdag_v2: bool,
767
768 #[serde(skip_serializing_if = "is_false")]
770 convert_type_argument_error: bool,
771
772 #[serde(skip_serializing_if = "is_false")]
774 variant_nodes: bool,
775
776 #[serde(skip_serializing_if = "is_false")]
778 consensus_zstd_compression: bool,
779
780 #[serde(skip_serializing_if = "is_false")]
782 minimize_child_object_mutations: bool,
783
784 #[serde(skip_serializing_if = "is_false")]
786 record_additional_state_digest_in_prologue: bool,
787
788 #[serde(skip_serializing_if = "is_false")]
790 move_native_context: bool,
791
792 #[serde(skip_serializing_if = "is_false")]
795 consensus_median_based_commit_timestamp: bool,
796
797 #[serde(skip_serializing_if = "is_false")]
800 normalize_ptb_arguments: bool,
801
802 #[serde(skip_serializing_if = "is_false")]
804 consensus_batched_block_sync: bool,
805
806 #[serde(skip_serializing_if = "is_false")]
808 enforce_checkpoint_timestamp_monotonicity: bool,
809
810 #[serde(skip_serializing_if = "is_false")]
812 max_ptb_value_size_v2: bool,
813
814 #[serde(skip_serializing_if = "is_false")]
816 resolve_type_input_ids_to_defining_id: bool,
817
818 #[serde(skip_serializing_if = "is_false")]
820 enable_party_transfer: bool,
821
822 #[serde(skip_serializing_if = "is_false")]
824 allow_unbounded_system_objects: bool,
825
826 #[serde(skip_serializing_if = "is_false")]
828 type_tags_in_object_runtime: bool,
829
830 #[serde(skip_serializing_if = "is_false")]
832 enable_accumulators: bool,
833
834 #[serde(skip_serializing_if = "is_false")]
836 enable_coin_reservation_obj_refs: bool,
837
838 #[serde(skip_serializing_if = "is_false")]
841 create_root_accumulator_object: bool,
842
843 #[serde(skip_serializing_if = "is_false")]
845 enable_authenticated_event_streams: bool,
846
847 #[serde(skip_serializing_if = "is_false")]
849 enable_address_balance_gas_payments: bool,
850
851 #[serde(skip_serializing_if = "is_false")]
853 address_balance_gas_check_rgp_at_signing: bool,
854
855 #[serde(skip_serializing_if = "is_false")]
856 address_balance_gas_reject_gas_coin_arg: bool,
857
858 #[serde(skip_serializing_if = "is_false")]
860 enable_multi_epoch_transaction_expiration: bool,
861
862 #[serde(skip_serializing_if = "is_false")]
864 relax_valid_during_for_owned_inputs: bool,
865
866 #[serde(skip_serializing_if = "is_false")]
868 enable_ptb_execution_v2: bool,
869
870 #[serde(skip_serializing_if = "is_false")]
872 better_adapter_type_resolution_errors: bool,
873
874 #[serde(skip_serializing_if = "is_false")]
876 record_time_estimate_processed: bool,
877
878 #[serde(skip_serializing_if = "is_false")]
880 dependency_linkage_error: bool,
881
882 #[serde(skip_serializing_if = "is_false")]
884 additional_multisig_checks: bool,
885
886 #[serde(skip_serializing_if = "is_false")]
888 ignore_execution_time_observations_after_certs_closed: bool,
889
890 #[serde(skip_serializing_if = "is_false")]
894 debug_fatal_on_move_invariant_violation: bool,
895
896 #[serde(skip_serializing_if = "is_false")]
899 allow_private_accumulator_entrypoints: bool,
900
901 #[serde(skip_serializing_if = "is_false")]
903 additional_consensus_digest_indirect_state: bool,
904
905 #[serde(skip_serializing_if = "is_false")]
907 check_for_init_during_upgrade: bool,
908
909 #[serde(skip_serializing_if = "is_false")]
911 per_command_shared_object_transfer_rules: bool,
912
913 #[serde(skip_serializing_if = "is_false")]
915 include_checkpoint_artifacts_digest_in_summary: bool,
916
917 #[serde(skip_serializing_if = "is_false")]
919 use_mfp_txns_in_load_initial_object_debts: bool,
920
921 #[serde(skip_serializing_if = "is_false")]
923 cancel_for_failed_dkg_early: bool,
924
925 #[serde(skip_serializing_if = "is_false")]
927 enable_coin_registry: bool,
928
929 #[serde(skip_serializing_if = "is_false")]
931 abstract_size_in_object_runtime: bool,
932
933 #[serde(skip_serializing_if = "is_false")]
935 object_runtime_charge_cache_load_gas: bool,
936
937 #[serde(skip_serializing_if = "is_false")]
939 additional_borrow_checks: bool,
940
941 #[serde(skip_serializing_if = "is_false")]
943 use_new_commit_handler: bool,
944
945 #[serde(skip_serializing_if = "is_false")]
947 better_loader_errors: bool,
948
949 #[serde(skip_serializing_if = "is_false")]
951 generate_df_type_layouts: bool,
952
953 #[serde(skip_serializing_if = "is_false")]
955 allow_references_in_ptbs: bool,
956
957 #[serde(skip_serializing_if = "is_false")]
959 enable_display_registry: bool,
960
961 #[serde(skip_serializing_if = "is_false")]
963 private_generics_verifier_v2: bool,
964
965 #[serde(skip_serializing_if = "is_false")]
967 deprecate_global_storage_ops_during_deserialization: bool,
968
969 #[serde(skip_serializing_if = "is_false")]
972 enable_non_exclusive_writes: bool,
973
974 #[serde(skip_serializing_if = "is_false")]
976 deprecate_global_storage_ops: bool,
977
978 #[serde(skip_serializing_if = "is_false")]
980 normalize_depth_formula: bool,
981
982 #[serde(skip_serializing_if = "is_false")]
984 consensus_skip_gced_accept_votes: bool,
985
986 #[serde(skip_serializing_if = "is_false")]
988 include_cancelled_randomness_txns_in_prologue: bool,
989
990 #[serde(skip_serializing_if = "is_false")]
992 address_aliases: bool,
993
994 #[serde(skip_serializing_if = "is_false")]
997 fix_checkpoint_signature_mapping: bool,
998
999 #[serde(skip_serializing_if = "is_false")]
1001 enable_object_funds_withdraw: bool,
1002
1003 #[serde(skip_serializing_if = "is_false")]
1005 consensus_skip_gced_blocks_in_direct_finalization: bool,
1006
1007 #[serde(skip_serializing_if = "is_false")]
1009 gas_rounding_halve_digits: bool,
1010
1011 #[serde(skip_serializing_if = "is_false")]
1013 flexible_tx_context_positions: bool,
1014
1015 #[serde(skip_serializing_if = "is_false")]
1017 disable_entry_point_signature_check: bool,
1018
1019 #[serde(skip_serializing_if = "is_false")]
1021 convert_withdrawal_compatibility_ptb_arguments: bool,
1022
1023 #[serde(skip_serializing_if = "is_false")]
1025 restrict_hot_or_not_entry_functions: bool,
1026
1027 #[serde(skip_serializing_if = "is_false")]
1029 split_checkpoints_in_consensus_handler: bool,
1030
1031 #[serde(skip_serializing_if = "is_false")]
1033 consensus_always_accept_system_transactions: bool,
1034
1035 #[serde(skip_serializing_if = "is_false")]
1037 validator_metadata_verify_v2: bool,
1038
1039 #[serde(skip_serializing_if = "is_false")]
1042 defer_unpaid_amplification: bool,
1043
1044 #[serde(skip_serializing_if = "is_false")]
1045 randomize_checkpoint_tx_limit_in_tests: bool,
1046
1047 #[serde(skip_serializing_if = "is_false")]
1049 gasless_transaction_drop_safety: bool,
1050
1051 #[serde(skip_serializing_if = "is_false")]
1053 merge_randomness_into_checkpoint: bool,
1054
1055 #[serde(skip_serializing_if = "is_false")]
1057 use_coin_party_owner: bool,
1058
1059 #[serde(skip_serializing_if = "is_false")]
1060 enable_gasless: bool,
1061
1062 #[serde(skip_serializing_if = "is_false")]
1063 gasless_verify_remaining_balance: bool,
1064
1065 #[serde(skip_serializing_if = "is_false")]
1066 disallow_jump_orphans: bool,
1067
1068 #[serde(skip_serializing_if = "is_false")]
1070 early_return_receive_object_mismatched_type: bool,
1071
1072 #[serde(skip_serializing_if = "is_false")]
1077 timestamp_based_epoch_close: bool,
1078}
1079
1080fn is_false(b: &bool) -> bool {
1081 !b
1082}
1083
1084fn is_empty(b: &BTreeSet<String>) -> bool {
1085 b.is_empty()
1086}
1087
1088fn is_zero(val: &u64) -> bool {
1089 *val == 0
1090}
1091
1092#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1094pub enum ConsensusTransactionOrdering {
1095 #[default]
1097 None,
1098 ByGasPrice,
1100}
1101
1102impl ConsensusTransactionOrdering {
1103 pub fn is_none(&self) -> bool {
1104 matches!(self, ConsensusTransactionOrdering::None)
1105 }
1106}
1107
1108#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1109pub struct ExecutionTimeEstimateParams {
1110 pub target_utilization: u64,
1112 pub allowed_txn_cost_overage_burst_limit_us: u64,
1116
1117 pub randomness_scalar: u64,
1120
1121 pub max_estimate_us: u64,
1123
1124 pub stored_observations_num_included_checkpoints: u64,
1127
1128 pub stored_observations_limit: u64,
1130
1131 #[serde(skip_serializing_if = "is_zero")]
1134 pub stake_weighted_median_threshold: u64,
1135
1136 #[serde(skip_serializing_if = "is_false")]
1140 pub default_none_duration_for_new_keys: bool,
1141
1142 #[serde(skip_serializing_if = "Option::is_none")]
1144 pub observations_chunk_size: Option<u64>,
1145}
1146
1147#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1149pub enum PerObjectCongestionControlMode {
1150 #[default]
1151 None, TotalGasBudget, TotalTxCount, TotalGasBudgetWithCap, ExecutionTimeEstimate(ExecutionTimeEstimateParams), }
1157
1158impl PerObjectCongestionControlMode {
1159 pub fn is_none(&self) -> bool {
1160 matches!(self, PerObjectCongestionControlMode::None)
1161 }
1162}
1163
1164#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1166pub enum ConsensusChoice {
1167 #[default]
1168 Narwhal,
1169 SwapEachEpoch,
1170 Mysticeti,
1171}
1172
1173impl ConsensusChoice {
1174 pub fn is_narwhal(&self) -> bool {
1175 matches!(self, ConsensusChoice::Narwhal)
1176 }
1177}
1178
1179#[derive(Default, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
1181pub enum ConsensusNetwork {
1182 #[default]
1183 Anemo,
1184 Tonic,
1185}
1186
1187impl ConsensusNetwork {
1188 pub fn is_anemo(&self) -> bool {
1189 matches!(self, ConsensusNetwork::Anemo)
1190 }
1191}
1192
1193#[skip_serializing_none]
1225#[derive(Clone, Serialize, Debug, ProtocolConfigAccessors, ProtocolConfigOverride)]
1226pub struct ProtocolConfig {
1227 pub version: ProtocolVersion,
1228
1229 feature_flags: FeatureFlags,
1230
1231 max_tx_size_bytes: Option<u64>,
1234
1235 max_input_objects: Option<u64>,
1237
1238 max_size_written_objects: Option<u64>,
1242 max_size_written_objects_system_tx: Option<u64>,
1245
1246 max_serialized_tx_effects_size_bytes: Option<u64>,
1248
1249 max_serialized_tx_effects_size_bytes_system_tx: Option<u64>,
1251
1252 max_gas_payment_objects: Option<u32>,
1254
1255 max_modules_in_publish: Option<u32>,
1257
1258 max_package_dependencies: Option<u32>,
1260
1261 max_arguments: Option<u32>,
1264
1265 max_type_arguments: Option<u32>,
1267
1268 max_type_argument_depth: Option<u32>,
1270
1271 max_pure_argument_size: Option<u32>,
1273
1274 max_programmable_tx_commands: Option<u32>,
1276
1277 move_binary_format_version: Option<u32>,
1280 min_move_binary_format_version: Option<u32>,
1281
1282 binary_module_handles: Option<u16>,
1284 binary_struct_handles: Option<u16>,
1285 binary_function_handles: Option<u16>,
1286 binary_function_instantiations: Option<u16>,
1287 binary_signatures: Option<u16>,
1288 binary_constant_pool: Option<u16>,
1289 binary_identifiers: Option<u16>,
1290 binary_address_identifiers: Option<u16>,
1291 binary_struct_defs: Option<u16>,
1292 binary_struct_def_instantiations: Option<u16>,
1293 binary_function_defs: Option<u16>,
1294 binary_field_handles: Option<u16>,
1295 binary_field_instantiations: Option<u16>,
1296 binary_friend_decls: Option<u16>,
1297 binary_enum_defs: Option<u16>,
1298 binary_enum_def_instantiations: Option<u16>,
1299 binary_variant_handles: Option<u16>,
1300 binary_variant_instantiation_handles: Option<u16>,
1301
1302 max_move_object_size: Option<u64>,
1304
1305 max_move_package_size: Option<u64>,
1308
1309 max_publish_or_upgrade_per_ptb: Option<u64>,
1311
1312 max_tx_gas: Option<u64>,
1314
1315 max_gas_price: Option<u64>,
1317
1318 max_gas_price_rgp_factor_for_aborted_transactions: Option<u64>,
1321
1322 max_gas_computation_bucket: Option<u64>,
1324
1325 gas_rounding_step: Option<u64>,
1327
1328 max_loop_depth: Option<u64>,
1330
1331 max_generic_instantiation_length: Option<u64>,
1333
1334 max_function_parameters: Option<u64>,
1336
1337 max_basic_blocks: Option<u64>,
1339
1340 max_value_stack_size: Option<u64>,
1342
1343 max_type_nodes: Option<u64>,
1345
1346 max_push_size: Option<u64>,
1348
1349 max_struct_definitions: Option<u64>,
1351
1352 max_function_definitions: Option<u64>,
1354
1355 max_fields_in_struct: Option<u64>,
1357
1358 max_dependency_depth: Option<u64>,
1360
1361 max_num_event_emit: Option<u64>,
1363
1364 max_num_new_move_object_ids: Option<u64>,
1366
1367 max_num_new_move_object_ids_system_tx: Option<u64>,
1369
1370 max_num_deleted_move_object_ids: Option<u64>,
1372
1373 max_num_deleted_move_object_ids_system_tx: Option<u64>,
1375
1376 max_num_transferred_move_object_ids: Option<u64>,
1378
1379 max_num_transferred_move_object_ids_system_tx: Option<u64>,
1381
1382 max_event_emit_size: Option<u64>,
1384
1385 max_event_emit_size_total: Option<u64>,
1387
1388 max_move_vector_len: Option<u64>,
1390
1391 max_move_identifier_len: Option<u64>,
1393
1394 max_move_value_depth: Option<u64>,
1396
1397 max_move_enum_variants: Option<u64>,
1399
1400 max_back_edges_per_function: Option<u64>,
1402
1403 max_back_edges_per_module: Option<u64>,
1405
1406 max_verifier_meter_ticks_per_function: Option<u64>,
1408
1409 max_meter_ticks_per_module: Option<u64>,
1411
1412 max_meter_ticks_per_package: Option<u64>,
1414
1415 object_runtime_max_num_cached_objects: Option<u64>,
1419
1420 object_runtime_max_num_cached_objects_system_tx: Option<u64>,
1422
1423 object_runtime_max_num_store_entries: Option<u64>,
1425
1426 object_runtime_max_num_store_entries_system_tx: Option<u64>,
1428
1429 base_tx_cost_fixed: Option<u64>,
1432
1433 package_publish_cost_fixed: Option<u64>,
1436
1437 base_tx_cost_per_byte: Option<u64>,
1440
1441 package_publish_cost_per_byte: Option<u64>,
1443
1444 obj_access_cost_read_per_byte: Option<u64>,
1446
1447 obj_access_cost_mutate_per_byte: Option<u64>,
1449
1450 obj_access_cost_delete_per_byte: Option<u64>,
1452
1453 obj_access_cost_verify_per_byte: Option<u64>,
1463
1464 max_type_to_layout_nodes: Option<u64>,
1466
1467 max_ptb_value_size: Option<u64>,
1469
1470 gas_model_version: Option<u64>,
1473
1474 obj_data_cost_refundable: Option<u64>,
1477
1478 obj_metadata_cost_non_refundable: Option<u64>,
1482
1483 storage_rebate_rate: Option<u64>,
1489
1490 storage_fund_reinvest_rate: Option<u64>,
1493
1494 reward_slashing_rate: Option<u64>,
1497
1498 storage_gas_price: Option<u64>,
1500
1501 accumulator_object_storage_cost: Option<u64>,
1503
1504 max_transactions_per_checkpoint: Option<u64>,
1509
1510 max_checkpoint_size_bytes: Option<u64>,
1514
1515 buffer_stake_for_protocol_upgrade_bps: Option<u64>,
1520
1521 address_from_bytes_cost_base: Option<u64>,
1526 address_to_u256_cost_base: Option<u64>,
1528 address_from_u256_cost_base: Option<u64>,
1530
1531 config_read_setting_impl_cost_base: Option<u64>,
1536 config_read_setting_impl_cost_per_byte: Option<u64>,
1537
1538 dynamic_field_hash_type_and_key_cost_base: Option<u64>,
1541 dynamic_field_hash_type_and_key_type_cost_per_byte: Option<u64>,
1542 dynamic_field_hash_type_and_key_value_cost_per_byte: Option<u64>,
1543 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Option<u64>,
1544 dynamic_field_add_child_object_cost_base: Option<u64>,
1546 dynamic_field_add_child_object_type_cost_per_byte: Option<u64>,
1547 dynamic_field_add_child_object_value_cost_per_byte: Option<u64>,
1548 dynamic_field_add_child_object_struct_tag_cost_per_byte: Option<u64>,
1549 dynamic_field_borrow_child_object_cost_base: Option<u64>,
1551 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Option<u64>,
1552 dynamic_field_borrow_child_object_type_cost_per_byte: Option<u64>,
1553 dynamic_field_remove_child_object_cost_base: Option<u64>,
1555 dynamic_field_remove_child_object_child_cost_per_byte: Option<u64>,
1556 dynamic_field_remove_child_object_type_cost_per_byte: Option<u64>,
1557 dynamic_field_has_child_object_cost_base: Option<u64>,
1559 dynamic_field_has_child_object_with_ty_cost_base: Option<u64>,
1561 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Option<u64>,
1562 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Option<u64>,
1563
1564 event_emit_cost_base: Option<u64>,
1567 event_emit_value_size_derivation_cost_per_byte: Option<u64>,
1568 event_emit_tag_size_derivation_cost_per_byte: Option<u64>,
1569 event_emit_output_cost_per_byte: Option<u64>,
1570 event_emit_auth_stream_cost: Option<u64>,
1571
1572 object_borrow_uid_cost_base: Option<u64>,
1575 object_delete_impl_cost_base: Option<u64>,
1577 object_record_new_uid_cost_base: Option<u64>,
1579
1580 transfer_transfer_internal_cost_base: Option<u64>,
1583 transfer_party_transfer_internal_cost_base: Option<u64>,
1585 transfer_freeze_object_cost_base: Option<u64>,
1587 transfer_share_object_cost_base: Option<u64>,
1589 transfer_receive_object_cost_base: Option<u64>,
1592 transfer_receive_object_cost_per_byte: Option<u64>,
1593 transfer_receive_object_type_cost_per_byte: Option<u64>,
1594
1595 tx_context_derive_id_cost_base: Option<u64>,
1598 tx_context_fresh_id_cost_base: Option<u64>,
1599 tx_context_sender_cost_base: Option<u64>,
1600 tx_context_epoch_cost_base: Option<u64>,
1601 tx_context_epoch_timestamp_ms_cost_base: Option<u64>,
1602 tx_context_sponsor_cost_base: Option<u64>,
1603 tx_context_rgp_cost_base: Option<u64>,
1604 tx_context_gas_price_cost_base: Option<u64>,
1605 tx_context_gas_budget_cost_base: Option<u64>,
1606 tx_context_ids_created_cost_base: Option<u64>,
1607 tx_context_replace_cost_base: Option<u64>,
1608
1609 types_is_one_time_witness_cost_base: Option<u64>,
1612 types_is_one_time_witness_type_tag_cost_per_byte: Option<u64>,
1613 types_is_one_time_witness_type_cost_per_byte: Option<u64>,
1614
1615 validator_validate_metadata_cost_base: Option<u64>,
1618 validator_validate_metadata_data_cost_per_byte: Option<u64>,
1619
1620 crypto_invalid_arguments_cost: Option<u64>,
1622 bls12381_bls12381_min_sig_verify_cost_base: Option<u64>,
1624 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Option<u64>,
1625 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Option<u64>,
1626
1627 bls12381_bls12381_min_pk_verify_cost_base: Option<u64>,
1629 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Option<u64>,
1630 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Option<u64>,
1631
1632 ecdsa_k1_ecrecover_keccak256_cost_base: Option<u64>,
1634 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1635 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1636 ecdsa_k1_ecrecover_sha256_cost_base: Option<u64>,
1637 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1638 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1639
1640 ecdsa_k1_decompress_pubkey_cost_base: Option<u64>,
1642
1643 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Option<u64>,
1645 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1646 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Option<u64>,
1647 ecdsa_k1_secp256k1_verify_sha256_cost_base: Option<u64>,
1648 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Option<u64>,
1649 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Option<u64>,
1650
1651 ecdsa_r1_ecrecover_keccak256_cost_base: Option<u64>,
1653 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Option<u64>,
1654 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Option<u64>,
1655 ecdsa_r1_ecrecover_sha256_cost_base: Option<u64>,
1656 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Option<u64>,
1657 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Option<u64>,
1658
1659 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Option<u64>,
1661 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Option<u64>,
1662 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Option<u64>,
1663 ecdsa_r1_secp256r1_verify_sha256_cost_base: Option<u64>,
1664 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Option<u64>,
1665 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Option<u64>,
1666
1667 ecvrf_ecvrf_verify_cost_base: Option<u64>,
1669 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Option<u64>,
1670 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Option<u64>,
1671
1672 ed25519_ed25519_verify_cost_base: Option<u64>,
1674 ed25519_ed25519_verify_msg_cost_per_byte: Option<u64>,
1675 ed25519_ed25519_verify_msg_cost_per_block: Option<u64>,
1676
1677 groth16_prepare_verifying_key_bls12381_cost_base: Option<u64>,
1679 groth16_prepare_verifying_key_bn254_cost_base: Option<u64>,
1680
1681 groth16_verify_groth16_proof_internal_bls12381_cost_base: Option<u64>,
1683 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Option<u64>,
1684 groth16_verify_groth16_proof_internal_bn254_cost_base: Option<u64>,
1685 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Option<u64>,
1686 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Option<u64>,
1687
1688 hash_blake2b256_cost_base: Option<u64>,
1690 hash_blake2b256_data_cost_per_byte: Option<u64>,
1691 hash_blake2b256_data_cost_per_block: Option<u64>,
1692
1693 hash_keccak256_cost_base: Option<u64>,
1695 hash_keccak256_data_cost_per_byte: Option<u64>,
1696 hash_keccak256_data_cost_per_block: Option<u64>,
1697
1698 poseidon_bn254_cost_base: Option<u64>,
1700 poseidon_bn254_cost_per_block: Option<u64>,
1701
1702 group_ops_bls12381_decode_scalar_cost: Option<u64>,
1704 group_ops_bls12381_decode_g1_cost: Option<u64>,
1705 group_ops_bls12381_decode_g2_cost: Option<u64>,
1706 group_ops_bls12381_decode_gt_cost: Option<u64>,
1707 group_ops_bls12381_scalar_add_cost: Option<u64>,
1708 group_ops_bls12381_g1_add_cost: Option<u64>,
1709 group_ops_bls12381_g2_add_cost: Option<u64>,
1710 group_ops_bls12381_gt_add_cost: Option<u64>,
1711 group_ops_bls12381_scalar_sub_cost: Option<u64>,
1712 group_ops_bls12381_g1_sub_cost: Option<u64>,
1713 group_ops_bls12381_g2_sub_cost: Option<u64>,
1714 group_ops_bls12381_gt_sub_cost: Option<u64>,
1715 group_ops_bls12381_scalar_mul_cost: Option<u64>,
1716 group_ops_bls12381_g1_mul_cost: Option<u64>,
1717 group_ops_bls12381_g2_mul_cost: Option<u64>,
1718 group_ops_bls12381_gt_mul_cost: Option<u64>,
1719 group_ops_bls12381_scalar_div_cost: Option<u64>,
1720 group_ops_bls12381_g1_div_cost: Option<u64>,
1721 group_ops_bls12381_g2_div_cost: Option<u64>,
1722 group_ops_bls12381_gt_div_cost: Option<u64>,
1723 group_ops_bls12381_g1_hash_to_base_cost: Option<u64>,
1724 group_ops_bls12381_g2_hash_to_base_cost: Option<u64>,
1725 group_ops_bls12381_g1_hash_to_cost_per_byte: Option<u64>,
1726 group_ops_bls12381_g2_hash_to_cost_per_byte: Option<u64>,
1727 group_ops_bls12381_g1_msm_base_cost: Option<u64>,
1728 group_ops_bls12381_g2_msm_base_cost: Option<u64>,
1729 group_ops_bls12381_g1_msm_base_cost_per_input: Option<u64>,
1730 group_ops_bls12381_g2_msm_base_cost_per_input: Option<u64>,
1731 group_ops_bls12381_msm_max_len: Option<u32>,
1732 group_ops_bls12381_pairing_cost: Option<u64>,
1733 group_ops_bls12381_g1_to_uncompressed_g1_cost: Option<u64>,
1734 group_ops_bls12381_uncompressed_g1_to_g1_cost: Option<u64>,
1735 group_ops_bls12381_uncompressed_g1_sum_base_cost: Option<u64>,
1736 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: Option<u64>,
1737 group_ops_bls12381_uncompressed_g1_sum_max_terms: Option<u64>,
1738
1739 group_ops_ristretto_decode_scalar_cost: Option<u64>,
1740 group_ops_ristretto_decode_point_cost: Option<u64>,
1741 group_ops_ristretto_scalar_add_cost: Option<u64>,
1742 group_ops_ristretto_point_add_cost: Option<u64>,
1743 group_ops_ristretto_scalar_sub_cost: Option<u64>,
1744 group_ops_ristretto_point_sub_cost: Option<u64>,
1745 group_ops_ristretto_scalar_mul_cost: Option<u64>,
1746 group_ops_ristretto_point_mul_cost: Option<u64>,
1747 group_ops_ristretto_scalar_div_cost: Option<u64>,
1748 group_ops_ristretto_point_div_cost: Option<u64>,
1749
1750 verify_bulletproofs_ristretto255_base_cost: Option<u64>,
1751 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: Option<u64>,
1752
1753 hmac_hmac_sha3_256_cost_base: Option<u64>,
1755 hmac_hmac_sha3_256_input_cost_per_byte: Option<u64>,
1756 hmac_hmac_sha3_256_input_cost_per_block: Option<u64>,
1757
1758 check_zklogin_id_cost_base: Option<u64>,
1760 check_zklogin_issuer_cost_base: Option<u64>,
1762
1763 vdf_verify_vdf_cost: Option<u64>,
1764 vdf_hash_to_input_cost: Option<u64>,
1765
1766 nitro_attestation_parse_base_cost: Option<u64>,
1768 nitro_attestation_parse_cost_per_byte: Option<u64>,
1769 nitro_attestation_verify_base_cost: Option<u64>,
1770 nitro_attestation_verify_cost_per_cert: Option<u64>,
1771
1772 bcs_per_byte_serialized_cost: Option<u64>,
1774 bcs_legacy_min_output_size_cost: Option<u64>,
1775 bcs_failure_cost: Option<u64>,
1776
1777 hash_sha2_256_base_cost: Option<u64>,
1778 hash_sha2_256_per_byte_cost: Option<u64>,
1779 hash_sha2_256_legacy_min_input_len_cost: Option<u64>,
1780 hash_sha3_256_base_cost: Option<u64>,
1781 hash_sha3_256_per_byte_cost: Option<u64>,
1782 hash_sha3_256_legacy_min_input_len_cost: Option<u64>,
1783 type_name_get_base_cost: Option<u64>,
1784 type_name_get_per_byte_cost: Option<u64>,
1785 type_name_id_base_cost: Option<u64>,
1786
1787 string_check_utf8_base_cost: Option<u64>,
1788 string_check_utf8_per_byte_cost: Option<u64>,
1789 string_is_char_boundary_base_cost: Option<u64>,
1790 string_sub_string_base_cost: Option<u64>,
1791 string_sub_string_per_byte_cost: Option<u64>,
1792 string_index_of_base_cost: Option<u64>,
1793 string_index_of_per_byte_pattern_cost: Option<u64>,
1794 string_index_of_per_byte_searched_cost: Option<u64>,
1795
1796 vector_empty_base_cost: Option<u64>,
1797 vector_length_base_cost: Option<u64>,
1798 vector_push_back_base_cost: Option<u64>,
1799 vector_push_back_legacy_per_abstract_memory_unit_cost: Option<u64>,
1800 vector_borrow_base_cost: Option<u64>,
1801 vector_pop_back_base_cost: Option<u64>,
1802 vector_destroy_empty_base_cost: Option<u64>,
1803 vector_swap_base_cost: Option<u64>,
1804 debug_print_base_cost: Option<u64>,
1805 debug_print_stack_trace_base_cost: Option<u64>,
1806
1807 execution_version: Option<u64>,
1816
1817 consensus_bad_nodes_stake_threshold: Option<u64>,
1821
1822 max_jwk_votes_per_validator_per_epoch: Option<u64>,
1823 max_age_of_jwk_in_epochs: Option<u64>,
1827
1828 random_beacon_reduction_allowed_delta: Option<u16>,
1832
1833 random_beacon_reduction_lower_bound: Option<u32>,
1836
1837 random_beacon_dkg_timeout_round: Option<u32>,
1840
1841 random_beacon_min_round_interval_ms: Option<u64>,
1843
1844 random_beacon_dkg_version: Option<u64>,
1847
1848 consensus_max_transaction_size_bytes: Option<u64>,
1851 consensus_max_transactions_in_block_bytes: Option<u64>,
1853 consensus_max_num_transactions_in_block: Option<u64>,
1855
1856 consensus_voting_rounds: Option<u32>,
1858
1859 max_accumulated_txn_cost_per_object_in_narwhal_commit: Option<u64>,
1861
1862 max_deferral_rounds_for_congestion_control: Option<u64>,
1865
1866 max_txn_cost_overage_per_object_in_commit: Option<u64>,
1868
1869 allowed_txn_cost_overage_burst_per_object_in_commit: Option<u64>,
1871
1872 min_checkpoint_interval_ms: Option<u64>,
1874
1875 checkpoint_summary_version_specific_data: Option<u64>,
1877
1878 max_soft_bundle_size: Option<u64>,
1880
1881 bridge_should_try_to_finalize_committee: Option<bool>,
1885
1886 max_accumulated_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1892
1893 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: Option<u64>,
1896
1897 consensus_gc_depth: Option<u32>,
1900
1901 gas_budget_based_txn_cost_cap_factor: Option<u64>,
1903
1904 gas_budget_based_txn_cost_absolute_cap_commit_count: Option<u64>,
1906
1907 sip_45_consensus_amplification_threshold: Option<u64>,
1910
1911 use_object_per_epoch_marker_table_v2: Option<bool>,
1914
1915 consensus_commit_rate_estimation_window_size: Option<u32>,
1917
1918 #[serde(skip_serializing_if = "Vec::is_empty")]
1922 aliased_addresses: Vec<AliasedAddress>,
1923
1924 translation_per_command_base_charge: Option<u64>,
1927
1928 translation_per_input_base_charge: Option<u64>,
1931
1932 translation_pure_input_per_byte_charge: Option<u64>,
1934
1935 translation_per_type_node_charge: Option<u64>,
1939
1940 translation_per_reference_node_charge: Option<u64>,
1943
1944 translation_per_linkage_entry_charge: Option<u64>,
1947
1948 max_updates_per_settlement_txn: Option<u32>,
1950
1951 gasless_max_computation_units: Option<u64>,
1953
1954 #[skip_accessor]
1956 gasless_allowed_token_types: Option<Vec<(String, u64)>>,
1957
1958 gasless_max_unused_inputs: Option<u64>,
1962
1963 gasless_max_pure_input_bytes: Option<u64>,
1966
1967 gasless_max_tps: Option<u64>,
1969
1970 #[serde(skip_serializing_if = "Option::is_none")]
1971 #[skip_accessor]
1972 include_special_package_amendments: Option<Arc<Amendments>>,
1973
1974 gasless_max_tx_size_bytes: Option<u64>,
1977}
1978
1979#[derive(Clone, Serialize, Deserialize, Debug)]
1981pub struct AliasedAddress {
1982 pub original: [u8; 32],
1984 pub aliased: [u8; 32],
1986 pub allowed_tx_digests: Vec<[u8; 32]>,
1988}
1989
1990impl ProtocolConfig {
1992 pub fn check_package_upgrades_supported(&self) -> Result<(), Error> {
2005 if self.feature_flags.package_upgrades {
2006 Ok(())
2007 } else {
2008 Err(Error(format!(
2009 "package upgrades are not supported at {:?}",
2010 self.version
2011 )))
2012 }
2013 }
2014
2015 pub fn allow_receiving_object_id(&self) -> bool {
2016 self.feature_flags.allow_receiving_object_id
2017 }
2018
2019 pub fn receiving_objects_supported(&self) -> bool {
2020 self.feature_flags.receive_objects
2021 }
2022
2023 pub fn package_upgrades_supported(&self) -> bool {
2024 self.feature_flags.package_upgrades
2025 }
2026
2027 pub fn check_commit_root_state_digest_supported(&self) -> bool {
2028 self.feature_flags.commit_root_state_digest
2029 }
2030
2031 pub fn get_advance_epoch_start_time_in_safe_mode(&self) -> bool {
2032 self.feature_flags.advance_epoch_start_time_in_safe_mode
2033 }
2034
2035 pub fn loaded_child_objects_fixed(&self) -> bool {
2036 self.feature_flags.loaded_child_objects_fixed
2037 }
2038
2039 pub fn missing_type_is_compatibility_error(&self) -> bool {
2040 self.feature_flags.missing_type_is_compatibility_error
2041 }
2042
2043 pub fn scoring_decision_with_validity_cutoff(&self) -> bool {
2044 self.feature_flags.scoring_decision_with_validity_cutoff
2045 }
2046
2047 pub fn narwhal_versioned_metadata(&self) -> bool {
2048 self.feature_flags.narwhal_versioned_metadata
2049 }
2050
2051 pub fn consensus_order_end_of_epoch_last(&self) -> bool {
2052 self.feature_flags.consensus_order_end_of_epoch_last
2053 }
2054
2055 pub fn disallow_adding_abilities_on_upgrade(&self) -> bool {
2056 self.feature_flags.disallow_adding_abilities_on_upgrade
2057 }
2058
2059 pub fn disable_invariant_violation_check_in_swap_loc(&self) -> bool {
2060 self.feature_flags
2061 .disable_invariant_violation_check_in_swap_loc
2062 }
2063
2064 pub fn advance_to_highest_supported_protocol_version(&self) -> bool {
2065 self.feature_flags
2066 .advance_to_highest_supported_protocol_version
2067 }
2068
2069 pub fn ban_entry_init(&self) -> bool {
2070 self.feature_flags.ban_entry_init
2071 }
2072
2073 pub fn package_digest_hash_module(&self) -> bool {
2074 self.feature_flags.package_digest_hash_module
2075 }
2076
2077 pub fn disallow_change_struct_type_params_on_upgrade(&self) -> bool {
2078 self.feature_flags
2079 .disallow_change_struct_type_params_on_upgrade
2080 }
2081
2082 pub fn no_extraneous_module_bytes(&self) -> bool {
2083 self.feature_flags.no_extraneous_module_bytes
2084 }
2085
2086 pub fn zklogin_auth(&self) -> bool {
2087 self.feature_flags.zklogin_auth
2088 }
2089
2090 pub fn zklogin_supported_providers(&self) -> &BTreeSet<String> {
2091 &self.feature_flags.zklogin_supported_providers
2092 }
2093
2094 pub fn consensus_transaction_ordering(&self) -> ConsensusTransactionOrdering {
2095 self.feature_flags.consensus_transaction_ordering
2096 }
2097
2098 pub fn simplified_unwrap_then_delete(&self) -> bool {
2099 self.feature_flags.simplified_unwrap_then_delete
2100 }
2101
2102 pub fn supports_upgraded_multisig(&self) -> bool {
2103 self.feature_flags.upgraded_multisig_supported
2104 }
2105
2106 pub fn txn_base_cost_as_multiplier(&self) -> bool {
2107 self.feature_flags.txn_base_cost_as_multiplier
2108 }
2109
2110 pub fn shared_object_deletion(&self) -> bool {
2111 self.feature_flags.shared_object_deletion
2112 }
2113
2114 pub fn narwhal_new_leader_election_schedule(&self) -> bool {
2115 self.feature_flags.narwhal_new_leader_election_schedule
2116 }
2117
2118 pub fn loaded_child_object_format(&self) -> bool {
2119 self.feature_flags.loaded_child_object_format
2120 }
2121
2122 pub fn enable_jwk_consensus_updates(&self) -> bool {
2123 let ret = self.feature_flags.enable_jwk_consensus_updates;
2124 if ret {
2125 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2127 }
2128 ret
2129 }
2130
2131 pub fn simple_conservation_checks(&self) -> bool {
2132 self.feature_flags.simple_conservation_checks
2133 }
2134
2135 pub fn loaded_child_object_format_type(&self) -> bool {
2136 self.feature_flags.loaded_child_object_format_type
2137 }
2138
2139 pub fn end_of_epoch_transaction_supported(&self) -> bool {
2140 let ret = self.feature_flags.end_of_epoch_transaction_supported;
2141 if !ret {
2142 assert!(!self.feature_flags.enable_jwk_consensus_updates);
2144 }
2145 ret
2146 }
2147
2148 pub fn recompute_has_public_transfer_in_execution(&self) -> bool {
2149 self.feature_flags
2150 .recompute_has_public_transfer_in_execution
2151 }
2152
2153 pub fn create_authenticator_state_in_genesis(&self) -> bool {
2155 self.enable_jwk_consensus_updates()
2156 }
2157
2158 pub fn random_beacon(&self) -> bool {
2159 self.feature_flags.random_beacon
2160 }
2161
2162 pub fn dkg_version(&self) -> u64 {
2163 self.random_beacon_dkg_version.unwrap_or(1)
2165 }
2166
2167 pub fn enable_bridge(&self) -> bool {
2168 let ret = self.feature_flags.bridge;
2169 if ret {
2170 assert!(self.feature_flags.end_of_epoch_transaction_supported);
2172 }
2173 ret
2174 }
2175
2176 pub fn should_try_to_finalize_bridge_committee(&self) -> bool {
2177 if !self.enable_bridge() {
2178 return false;
2179 }
2180 self.bridge_should_try_to_finalize_committee.unwrap_or(true)
2182 }
2183
2184 pub fn enable_effects_v2(&self) -> bool {
2185 self.feature_flags.enable_effects_v2
2186 }
2187
2188 pub fn narwhal_certificate_v2(&self) -> bool {
2189 self.feature_flags.narwhal_certificate_v2
2190 }
2191
2192 pub fn verify_legacy_zklogin_address(&self) -> bool {
2193 self.feature_flags.verify_legacy_zklogin_address
2194 }
2195
2196 pub fn accept_zklogin_in_multisig(&self) -> bool {
2197 self.feature_flags.accept_zklogin_in_multisig
2198 }
2199
2200 pub fn accept_passkey_in_multisig(&self) -> bool {
2201 self.feature_flags.accept_passkey_in_multisig
2202 }
2203
2204 pub fn validate_zklogin_public_identifier(&self) -> bool {
2205 self.feature_flags.validate_zklogin_public_identifier
2206 }
2207
2208 pub fn zklogin_max_epoch_upper_bound_delta(&self) -> Option<u64> {
2209 self.feature_flags.zklogin_max_epoch_upper_bound_delta
2210 }
2211
2212 pub fn throughput_aware_consensus_submission(&self) -> bool {
2213 self.feature_flags.throughput_aware_consensus_submission
2214 }
2215
2216 pub fn include_consensus_digest_in_prologue(&self) -> bool {
2217 self.feature_flags.include_consensus_digest_in_prologue
2218 }
2219
2220 pub fn record_consensus_determined_version_assignments_in_prologue(&self) -> bool {
2221 self.feature_flags
2222 .record_consensus_determined_version_assignments_in_prologue
2223 }
2224
2225 pub fn record_additional_state_digest_in_prologue(&self) -> bool {
2226 self.feature_flags
2227 .record_additional_state_digest_in_prologue
2228 }
2229
2230 pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
2231 self.feature_flags
2232 .record_consensus_determined_version_assignments_in_prologue_v2
2233 }
2234
2235 pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
2236 self.feature_flags
2237 .prepend_prologue_tx_in_consensus_commit_in_checkpoints
2238 }
2239
2240 pub fn hardened_otw_check(&self) -> bool {
2241 self.feature_flags.hardened_otw_check
2242 }
2243
2244 pub fn enable_poseidon(&self) -> bool {
2245 self.feature_flags.enable_poseidon
2246 }
2247
2248 pub fn enable_coin_deny_list_v1(&self) -> bool {
2249 self.feature_flags.enable_coin_deny_list
2250 }
2251
2252 pub fn enable_accumulators(&self) -> bool {
2253 self.feature_flags.enable_accumulators
2254 }
2255
2256 pub fn enable_coin_reservation_obj_refs(&self) -> bool {
2257 self.new_vm_enabled() && self.feature_flags.enable_coin_reservation_obj_refs
2258 }
2259
2260 pub fn create_root_accumulator_object(&self) -> bool {
2261 self.feature_flags.create_root_accumulator_object
2262 }
2263
2264 pub fn enable_address_balance_gas_payments(&self) -> bool {
2265 self.feature_flags.enable_address_balance_gas_payments
2266 }
2267
2268 pub fn address_balance_gas_check_rgp_at_signing(&self) -> bool {
2269 self.feature_flags.address_balance_gas_check_rgp_at_signing
2270 }
2271
2272 pub fn address_balance_gas_reject_gas_coin_arg(&self) -> bool {
2273 self.feature_flags.address_balance_gas_reject_gas_coin_arg
2274 }
2275
2276 pub fn enable_multi_epoch_transaction_expiration(&self) -> bool {
2277 self.feature_flags.enable_multi_epoch_transaction_expiration
2278 }
2279
2280 pub fn relax_valid_during_for_owned_inputs(&self) -> bool {
2281 self.feature_flags.relax_valid_during_for_owned_inputs
2282 }
2283
2284 pub fn enable_authenticated_event_streams(&self) -> bool {
2285 self.feature_flags.enable_authenticated_event_streams && self.enable_accumulators()
2286 }
2287
2288 pub fn enable_non_exclusive_writes(&self) -> bool {
2289 self.feature_flags.enable_non_exclusive_writes
2290 }
2291
2292 pub fn enable_coin_registry(&self) -> bool {
2293 self.feature_flags.enable_coin_registry
2294 }
2295
2296 pub fn enable_display_registry(&self) -> bool {
2297 self.feature_flags.enable_display_registry
2298 }
2299
2300 pub fn enable_coin_deny_list_v2(&self) -> bool {
2301 self.feature_flags.enable_coin_deny_list_v2
2302 }
2303
2304 pub fn enable_group_ops_native_functions(&self) -> bool {
2305 self.feature_flags.enable_group_ops_native_functions
2306 }
2307
2308 pub fn enable_group_ops_native_function_msm(&self) -> bool {
2309 self.feature_flags.enable_group_ops_native_function_msm
2310 }
2311
2312 pub fn enable_ristretto255_group_ops(&self) -> bool {
2313 self.feature_flags.enable_ristretto255_group_ops
2314 }
2315
2316 pub fn enable_verify_bulletproofs_ristretto255(&self) -> bool {
2317 self.feature_flags.enable_verify_bulletproofs_ristretto255
2318 }
2319
2320 pub fn reject_mutable_random_on_entry_functions(&self) -> bool {
2321 self.feature_flags.reject_mutable_random_on_entry_functions
2322 }
2323
2324 pub fn per_object_congestion_control_mode(&self) -> PerObjectCongestionControlMode {
2325 self.feature_flags.per_object_congestion_control_mode
2326 }
2327
2328 pub fn consensus_choice(&self) -> ConsensusChoice {
2329 self.feature_flags.consensus_choice
2330 }
2331
2332 pub fn consensus_network(&self) -> ConsensusNetwork {
2333 self.feature_flags.consensus_network
2334 }
2335
2336 pub fn correct_gas_payment_limit_check(&self) -> bool {
2337 self.feature_flags.correct_gas_payment_limit_check
2338 }
2339
2340 pub fn reshare_at_same_initial_version(&self) -> bool {
2341 self.feature_flags.reshare_at_same_initial_version
2342 }
2343
2344 pub fn resolve_abort_locations_to_package_id(&self) -> bool {
2345 self.feature_flags.resolve_abort_locations_to_package_id
2346 }
2347
2348 pub fn mysticeti_use_committed_subdag_digest(&self) -> bool {
2349 self.feature_flags.mysticeti_use_committed_subdag_digest
2350 }
2351
2352 pub fn enable_vdf(&self) -> bool {
2353 self.feature_flags.enable_vdf
2354 }
2355
2356 pub fn fresh_vm_on_framework_upgrade(&self) -> bool {
2357 self.feature_flags.fresh_vm_on_framework_upgrade
2358 }
2359
2360 pub fn mysticeti_num_leaders_per_round(&self) -> Option<usize> {
2361 self.feature_flags.mysticeti_num_leaders_per_round
2362 }
2363
2364 pub fn soft_bundle(&self) -> bool {
2365 self.feature_flags.soft_bundle
2366 }
2367
2368 pub fn passkey_auth(&self) -> bool {
2369 self.feature_flags.passkey_auth
2370 }
2371
2372 pub fn authority_capabilities_v2(&self) -> bool {
2373 self.feature_flags.authority_capabilities_v2
2374 }
2375
2376 pub fn max_transaction_size_bytes(&self) -> u64 {
2377 self.consensus_max_transaction_size_bytes
2379 .unwrap_or(256 * 1024)
2380 }
2381
2382 pub fn max_transactions_in_block_bytes(&self) -> u64 {
2383 if cfg!(msim) {
2384 256 * 1024
2385 } else {
2386 self.consensus_max_transactions_in_block_bytes
2387 .unwrap_or(512 * 1024)
2388 }
2389 }
2390
2391 pub fn max_num_transactions_in_block(&self) -> u64 {
2392 if cfg!(msim) {
2393 8
2394 } else {
2395 self.consensus_max_num_transactions_in_block.unwrap_or(512)
2396 }
2397 }
2398
2399 pub fn rethrow_serialization_type_layout_errors(&self) -> bool {
2400 self.feature_flags.rethrow_serialization_type_layout_errors
2401 }
2402
2403 pub fn consensus_distributed_vote_scoring_strategy(&self) -> bool {
2404 self.feature_flags
2405 .consensus_distributed_vote_scoring_strategy
2406 }
2407
2408 pub fn consensus_round_prober(&self) -> bool {
2409 self.feature_flags.consensus_round_prober
2410 }
2411
2412 pub fn validate_identifier_inputs(&self) -> bool {
2413 self.feature_flags.validate_identifier_inputs
2414 }
2415
2416 pub fn gc_depth(&self) -> u32 {
2417 self.consensus_gc_depth.unwrap_or(0)
2418 }
2419
2420 pub fn mysticeti_fastpath(&self) -> bool {
2421 self.feature_flags.mysticeti_fastpath
2422 }
2423
2424 pub fn relocate_event_module(&self) -> bool {
2425 self.feature_flags.relocate_event_module
2426 }
2427
2428 pub fn uncompressed_g1_group_elements(&self) -> bool {
2429 self.feature_flags.uncompressed_g1_group_elements
2430 }
2431
2432 pub fn disallow_new_modules_in_deps_only_packages(&self) -> bool {
2433 self.feature_flags
2434 .disallow_new_modules_in_deps_only_packages
2435 }
2436
2437 pub fn consensus_smart_ancestor_selection(&self) -> bool {
2438 self.feature_flags.consensus_smart_ancestor_selection
2439 }
2440
2441 pub fn disable_preconsensus_locking(&self) -> bool {
2442 self.feature_flags.disable_preconsensus_locking
2443 }
2444
2445 pub fn consensus_round_prober_probe_accepted_rounds(&self) -> bool {
2446 self.feature_flags
2447 .consensus_round_prober_probe_accepted_rounds
2448 }
2449
2450 pub fn native_charging_v2(&self) -> bool {
2451 self.feature_flags.native_charging_v2
2452 }
2453
2454 pub fn consensus_linearize_subdag_v2(&self) -> bool {
2455 let res = self.feature_flags.consensus_linearize_subdag_v2;
2456 assert!(
2457 !res || self.gc_depth() > 0,
2458 "The consensus linearize sub dag V2 requires GC to be enabled"
2459 );
2460 res
2461 }
2462
2463 pub fn consensus_median_based_commit_timestamp(&self) -> bool {
2464 let res = self.feature_flags.consensus_median_based_commit_timestamp;
2465 assert!(
2466 !res || self.gc_depth() > 0,
2467 "The consensus median based commit timestamp requires GC to be enabled"
2468 );
2469 res
2470 }
2471
2472 pub fn consensus_batched_block_sync(&self) -> bool {
2473 self.feature_flags.consensus_batched_block_sync
2474 }
2475
2476 pub fn convert_type_argument_error(&self) -> bool {
2477 self.feature_flags.convert_type_argument_error
2478 }
2479
2480 pub fn variant_nodes(&self) -> bool {
2481 self.feature_flags.variant_nodes
2482 }
2483
2484 pub fn consensus_zstd_compression(&self) -> bool {
2485 self.feature_flags.consensus_zstd_compression
2486 }
2487
2488 pub fn enable_nitro_attestation(&self) -> bool {
2489 self.feature_flags.enable_nitro_attestation
2490 }
2491
2492 pub fn enable_nitro_attestation_upgraded_parsing(&self) -> bool {
2493 self.feature_flags.enable_nitro_attestation_upgraded_parsing
2494 }
2495
2496 pub fn enable_nitro_attestation_all_nonzero_pcrs_parsing(&self) -> bool {
2497 self.feature_flags
2498 .enable_nitro_attestation_all_nonzero_pcrs_parsing
2499 }
2500
2501 pub fn enable_nitro_attestation_always_include_required_pcrs_parsing(&self) -> bool {
2502 self.feature_flags
2503 .enable_nitro_attestation_always_include_required_pcrs_parsing
2504 }
2505
2506 pub fn get_consensus_commit_rate_estimation_window_size(&self) -> u32 {
2507 self.consensus_commit_rate_estimation_window_size
2508 .unwrap_or(0)
2509 }
2510
2511 pub fn consensus_num_requested_prior_commits_at_startup(&self) -> u32 {
2512 let window_size = self.get_consensus_commit_rate_estimation_window_size();
2516 assert!(window_size == 0 || self.record_additional_state_digest_in_prologue());
2518 window_size
2519 }
2520
2521 pub fn minimize_child_object_mutations(&self) -> bool {
2522 self.feature_flags.minimize_child_object_mutations
2523 }
2524
2525 pub fn move_native_context(&self) -> bool {
2526 self.feature_flags.move_native_context
2527 }
2528
2529 pub fn normalize_ptb_arguments(&self) -> bool {
2530 self.feature_flags.normalize_ptb_arguments
2531 }
2532
2533 pub fn enforce_checkpoint_timestamp_monotonicity(&self) -> bool {
2534 self.feature_flags.enforce_checkpoint_timestamp_monotonicity
2535 }
2536
2537 pub fn max_ptb_value_size_v2(&self) -> bool {
2538 self.feature_flags.max_ptb_value_size_v2
2539 }
2540
2541 pub fn resolve_type_input_ids_to_defining_id(&self) -> bool {
2542 self.feature_flags.resolve_type_input_ids_to_defining_id
2543 }
2544
2545 pub fn enable_party_transfer(&self) -> bool {
2546 self.feature_flags.enable_party_transfer
2547 }
2548
2549 pub fn allow_unbounded_system_objects(&self) -> bool {
2550 self.feature_flags.allow_unbounded_system_objects
2551 }
2552
2553 pub fn type_tags_in_object_runtime(&self) -> bool {
2554 self.feature_flags.type_tags_in_object_runtime
2555 }
2556
2557 pub fn enable_ptb_execution_v2(&self) -> bool {
2558 self.feature_flags.enable_ptb_execution_v2
2559 }
2560
2561 pub fn better_adapter_type_resolution_errors(&self) -> bool {
2562 self.feature_flags.better_adapter_type_resolution_errors
2563 }
2564
2565 pub fn record_time_estimate_processed(&self) -> bool {
2566 self.feature_flags.record_time_estimate_processed
2567 }
2568
2569 pub fn ignore_execution_time_observations_after_certs_closed(&self) -> bool {
2570 self.feature_flags
2571 .ignore_execution_time_observations_after_certs_closed
2572 }
2573
2574 pub fn dependency_linkage_error(&self) -> bool {
2575 self.feature_flags.dependency_linkage_error
2576 }
2577
2578 pub fn additional_multisig_checks(&self) -> bool {
2579 self.feature_flags.additional_multisig_checks
2580 }
2581
2582 pub fn debug_fatal_on_move_invariant_violation(&self) -> bool {
2583 self.feature_flags.debug_fatal_on_move_invariant_violation
2584 }
2585
2586 pub fn allow_private_accumulator_entrypoints(&self) -> bool {
2587 self.feature_flags.allow_private_accumulator_entrypoints
2588 }
2589
2590 pub fn additional_consensus_digest_indirect_state(&self) -> bool {
2591 self.feature_flags
2592 .additional_consensus_digest_indirect_state
2593 }
2594
2595 pub fn check_for_init_during_upgrade(&self) -> bool {
2596 self.feature_flags.check_for_init_during_upgrade
2597 }
2598
2599 pub fn per_command_shared_object_transfer_rules(&self) -> bool {
2600 self.feature_flags.per_command_shared_object_transfer_rules
2601 }
2602
2603 pub fn consensus_checkpoint_signature_key_includes_digest(&self) -> bool {
2604 self.feature_flags
2605 .consensus_checkpoint_signature_key_includes_digest
2606 }
2607
2608 pub fn include_checkpoint_artifacts_digest_in_summary(&self) -> bool {
2609 self.feature_flags
2610 .include_checkpoint_artifacts_digest_in_summary
2611 }
2612
2613 pub fn use_mfp_txns_in_load_initial_object_debts(&self) -> bool {
2614 self.feature_flags.use_mfp_txns_in_load_initial_object_debts
2615 }
2616
2617 pub fn cancel_for_failed_dkg_early(&self) -> bool {
2618 self.feature_flags.cancel_for_failed_dkg_early
2619 }
2620
2621 pub fn abstract_size_in_object_runtime(&self) -> bool {
2622 self.feature_flags.abstract_size_in_object_runtime
2623 }
2624
2625 pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
2626 self.feature_flags.object_runtime_charge_cache_load_gas
2627 }
2628
2629 pub fn additional_borrow_checks(&self) -> bool {
2630 self.feature_flags.additional_borrow_checks
2631 }
2632
2633 pub fn use_new_commit_handler(&self) -> bool {
2634 self.feature_flags.use_new_commit_handler
2635 }
2636
2637 pub fn better_loader_errors(&self) -> bool {
2638 self.feature_flags.better_loader_errors
2639 }
2640
2641 pub fn generate_df_type_layouts(&self) -> bool {
2642 self.feature_flags.generate_df_type_layouts
2643 }
2644
2645 pub fn allow_references_in_ptbs(&self) -> bool {
2646 self.feature_flags.allow_references_in_ptbs
2647 }
2648
2649 pub fn private_generics_verifier_v2(&self) -> bool {
2650 self.feature_flags.private_generics_verifier_v2
2651 }
2652
2653 pub fn deprecate_global_storage_ops_during_deserialization(&self) -> bool {
2654 self.feature_flags
2655 .deprecate_global_storage_ops_during_deserialization
2656 }
2657
2658 pub fn enable_observation_chunking(&self) -> bool {
2659 matches!(self.feature_flags.per_object_congestion_control_mode,
2660 PerObjectCongestionControlMode::ExecutionTimeEstimate(ref params)
2661 if params.observations_chunk_size.is_some()
2662 )
2663 }
2664
2665 pub fn deprecate_global_storage_ops(&self) -> bool {
2666 self.feature_flags.deprecate_global_storage_ops
2667 }
2668
2669 pub fn normalize_depth_formula(&self) -> bool {
2670 self.feature_flags.normalize_depth_formula
2671 }
2672
2673 pub fn consensus_skip_gced_accept_votes(&self) -> bool {
2674 self.feature_flags.consensus_skip_gced_accept_votes
2675 }
2676
2677 pub fn include_cancelled_randomness_txns_in_prologue(&self) -> bool {
2678 self.feature_flags
2679 .include_cancelled_randomness_txns_in_prologue
2680 }
2681
2682 pub fn address_aliases(&self) -> bool {
2683 let address_aliases = self.feature_flags.address_aliases;
2684 assert!(
2685 !address_aliases || self.mysticeti_fastpath(),
2686 "Address aliases requires Mysticeti fastpath to be enabled"
2687 );
2688 if address_aliases {
2689 assert!(
2690 self.feature_flags.disable_preconsensus_locking,
2691 "Address aliases requires CertifiedTransaction to be disabled"
2692 );
2693 }
2694 address_aliases
2695 }
2696
2697 pub fn fix_checkpoint_signature_mapping(&self) -> bool {
2698 self.feature_flags.fix_checkpoint_signature_mapping
2699 }
2700
2701 pub fn enable_object_funds_withdraw(&self) -> bool {
2702 self.feature_flags.enable_object_funds_withdraw
2703 }
2704
2705 pub fn gas_rounding_halve_digits(&self) -> bool {
2706 self.feature_flags.gas_rounding_halve_digits
2707 }
2708
2709 pub fn flexible_tx_context_positions(&self) -> bool {
2710 self.feature_flags.flexible_tx_context_positions
2711 }
2712
2713 pub fn disable_entry_point_signature_check(&self) -> bool {
2714 self.feature_flags.disable_entry_point_signature_check
2715 }
2716
2717 pub fn consensus_skip_gced_blocks_in_direct_finalization(&self) -> bool {
2718 self.feature_flags
2719 .consensus_skip_gced_blocks_in_direct_finalization
2720 }
2721
2722 pub fn convert_withdrawal_compatibility_ptb_arguments(&self) -> bool {
2723 self.feature_flags
2724 .convert_withdrawal_compatibility_ptb_arguments
2725 }
2726
2727 pub fn restrict_hot_or_not_entry_functions(&self) -> bool {
2728 self.feature_flags.restrict_hot_or_not_entry_functions
2729 }
2730
2731 pub fn split_checkpoints_in_consensus_handler(&self) -> bool {
2732 self.feature_flags.split_checkpoints_in_consensus_handler
2733 }
2734
2735 pub fn consensus_always_accept_system_transactions(&self) -> bool {
2736 self.feature_flags
2737 .consensus_always_accept_system_transactions
2738 }
2739
2740 pub fn validator_metadata_verify_v2(&self) -> bool {
2741 self.feature_flags.validator_metadata_verify_v2
2742 }
2743
2744 pub fn defer_unpaid_amplification(&self) -> bool {
2745 self.feature_flags.defer_unpaid_amplification
2746 }
2747
2748 pub fn gasless_transaction_drop_safety(&self) -> bool {
2749 self.feature_flags.gasless_transaction_drop_safety
2750 }
2751
2752 pub fn new_vm_enabled(&self) -> bool {
2753 self.execution_version.is_some_and(|v| v >= 4)
2754 }
2755
2756 pub fn merge_randomness_into_checkpoint(&self) -> bool {
2757 self.feature_flags.merge_randomness_into_checkpoint
2758 }
2759
2760 pub fn use_coin_party_owner(&self) -> bool {
2761 self.feature_flags.use_coin_party_owner
2762 }
2763
2764 pub fn enable_gasless(&self) -> bool {
2765 self.feature_flags.enable_gasless
2766 }
2767
2768 pub fn gasless_verify_remaining_balance(&self) -> bool {
2769 self.feature_flags.gasless_verify_remaining_balance
2770 }
2771
2772 pub fn gasless_allowed_token_types(&self) -> &[(String, u64)] {
2773 debug_assert!(self.gasless_allowed_token_types.is_some());
2774 self.gasless_allowed_token_types.as_deref().unwrap_or(&[])
2775 }
2776
2777 pub fn get_gasless_max_unused_inputs(&self) -> u64 {
2778 self.gasless_max_unused_inputs.unwrap_or(u64::MAX)
2779 }
2780
2781 pub fn get_gasless_max_pure_input_bytes(&self) -> u64 {
2782 self.gasless_max_pure_input_bytes.unwrap_or(u64::MAX)
2783 }
2784
2785 pub fn get_gasless_max_tx_size_bytes(&self) -> u64 {
2786 self.gasless_max_tx_size_bytes.unwrap_or(u64::MAX)
2787 }
2788
2789 pub fn disallow_jump_orphans(&self) -> bool {
2790 self.feature_flags.disallow_jump_orphans
2791 }
2792
2793 pub fn early_return_receive_object_mismatched_type(&self) -> bool {
2794 self.feature_flags
2795 .early_return_receive_object_mismatched_type
2796 }
2797
2798 pub fn include_special_package_amendments_as_option(&self) -> &Option<Arc<Amendments>> {
2799 &self.include_special_package_amendments
2800 }
2801
2802 pub fn timestamp_based_epoch_close(&self) -> bool {
2803 self.feature_flags.timestamp_based_epoch_close
2804 }
2805}
2806
2807#[cfg(not(msim))]
2808static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2809
2810#[cfg(msim)]
2812thread_local! {
2813 static POISON_VERSION_METHODS: AtomicBool = AtomicBool::new(false);
2814}
2815
2816impl ProtocolConfig {
2818 pub fn get_for_version(version: ProtocolVersion, chain: Chain) -> Self {
2820 assert!(
2822 version >= ProtocolVersion::MIN,
2823 "Network protocol version is {:?}, but the minimum supported version by the binary is {:?}. Please upgrade the binary.",
2824 version,
2825 ProtocolVersion::MIN.0,
2826 );
2827 assert!(
2828 version <= ProtocolVersion::MAX_ALLOWED,
2829 "Network protocol version is {:?}, but the maximum supported version by the binary is {:?}. Please upgrade the binary.",
2830 version,
2831 ProtocolVersion::MAX_ALLOWED.0,
2832 );
2833
2834 let mut ret = Self::get_for_version_impl(version, chain);
2835 ret.version = version;
2836
2837 ret = Self::apply_config_override(version, ret);
2838
2839 if std::env::var("SUI_PROTOCOL_CONFIG_OVERRIDE_ENABLE").is_ok() {
2840 warn!(
2841 "overriding ProtocolConfig settings with custom settings; this may break non-local networks"
2842 );
2843 let overrides: ProtocolConfigOptional =
2844 serde_env::from_env_with_prefix("SUI_PROTOCOL_CONFIG_OVERRIDE")
2845 .expect("failed to parse ProtocolConfig override env variables");
2846 overrides.apply_to(&mut ret);
2847 }
2848
2849 ret
2850 }
2851
2852 pub fn get_for_version_if_supported(version: ProtocolVersion, chain: Chain) -> Option<Self> {
2855 if version.0 >= ProtocolVersion::MIN.0 && version.0 <= ProtocolVersion::MAX_ALLOWED.0 {
2856 let mut ret = Self::get_for_version_impl(version, chain);
2857 ret.version = version;
2858 ret = Self::apply_config_override(version, ret);
2859 Some(ret)
2860 } else {
2861 None
2862 }
2863 }
2864
2865 #[cfg(not(msim))]
2866 pub fn poison_get_for_min_version() {
2867 POISON_VERSION_METHODS.store(true, Ordering::Relaxed);
2868 }
2869
2870 #[cfg(not(msim))]
2871 fn load_poison_get_for_min_version() -> bool {
2872 POISON_VERSION_METHODS.load(Ordering::Relaxed)
2873 }
2874
2875 #[cfg(msim)]
2876 pub fn poison_get_for_min_version() {
2877 POISON_VERSION_METHODS.with(|p| p.store(true, Ordering::Relaxed));
2878 }
2879
2880 #[cfg(msim)]
2881 fn load_poison_get_for_min_version() -> bool {
2882 POISON_VERSION_METHODS.with(|p| p.load(Ordering::Relaxed))
2883 }
2884
2885 pub fn get_for_min_version() -> Self {
2888 if Self::load_poison_get_for_min_version() {
2889 panic!("get_for_min_version called on validator");
2890 }
2891 ProtocolConfig::get_for_version(ProtocolVersion::MIN, Chain::Unknown)
2892 }
2893
2894 #[allow(non_snake_case)]
2904 pub fn get_for_max_version_UNSAFE() -> Self {
2905 if Self::load_poison_get_for_min_version() {
2906 panic!("get_for_max_version_UNSAFE called on validator");
2907 }
2908 ProtocolConfig::get_for_version(ProtocolVersion::MAX, Chain::Unknown)
2909 }
2910
2911 fn get_for_version_impl(version: ProtocolVersion, chain: Chain) -> Self {
2912 #[cfg(msim)]
2913 {
2914 if version == ProtocolVersion::MAX_ALLOWED {
2916 let mut config = Self::get_for_version_impl(version - 1, Chain::Unknown);
2917 config.base_tx_cost_fixed = Some(config.base_tx_cost_fixed() + 1000);
2918 return config;
2919 }
2920 }
2921
2922 let mut cfg = Self {
2925 version,
2927
2928 feature_flags: Default::default(),
2930
2931 max_tx_size_bytes: Some(128 * 1024),
2932 max_input_objects: Some(2048),
2934 max_serialized_tx_effects_size_bytes: Some(512 * 1024),
2935 max_serialized_tx_effects_size_bytes_system_tx: Some(512 * 1024 * 16),
2936 max_gas_payment_objects: Some(256),
2937 max_modules_in_publish: Some(128),
2938 max_package_dependencies: None,
2939 max_arguments: Some(512),
2940 max_type_arguments: Some(16),
2941 max_type_argument_depth: Some(16),
2942 max_pure_argument_size: Some(16 * 1024),
2943 max_programmable_tx_commands: Some(1024),
2944 move_binary_format_version: Some(6),
2945 min_move_binary_format_version: None,
2946 binary_module_handles: None,
2947 binary_struct_handles: None,
2948 binary_function_handles: None,
2949 binary_function_instantiations: None,
2950 binary_signatures: None,
2951 binary_constant_pool: None,
2952 binary_identifiers: None,
2953 binary_address_identifiers: None,
2954 binary_struct_defs: None,
2955 binary_struct_def_instantiations: None,
2956 binary_function_defs: None,
2957 binary_field_handles: None,
2958 binary_field_instantiations: None,
2959 binary_friend_decls: None,
2960 binary_enum_defs: None,
2961 binary_enum_def_instantiations: None,
2962 binary_variant_handles: None,
2963 binary_variant_instantiation_handles: None,
2964 max_move_object_size: Some(250 * 1024),
2965 max_move_package_size: Some(100 * 1024),
2966 max_publish_or_upgrade_per_ptb: None,
2967 max_tx_gas: Some(10_000_000_000),
2968 max_gas_price: Some(100_000),
2969 max_gas_price_rgp_factor_for_aborted_transactions: None,
2970 max_gas_computation_bucket: Some(5_000_000),
2971 max_loop_depth: Some(5),
2972 max_generic_instantiation_length: Some(32),
2973 max_function_parameters: Some(128),
2974 max_basic_blocks: Some(1024),
2975 max_value_stack_size: Some(1024),
2976 max_type_nodes: Some(256),
2977 max_push_size: Some(10000),
2978 max_struct_definitions: Some(200),
2979 max_function_definitions: Some(1000),
2980 max_fields_in_struct: Some(32),
2981 max_dependency_depth: Some(100),
2982 max_num_event_emit: Some(256),
2983 max_num_new_move_object_ids: Some(2048),
2984 max_num_new_move_object_ids_system_tx: Some(2048 * 16),
2985 max_num_deleted_move_object_ids: Some(2048),
2986 max_num_deleted_move_object_ids_system_tx: Some(2048 * 16),
2987 max_num_transferred_move_object_ids: Some(2048),
2988 max_num_transferred_move_object_ids_system_tx: Some(2048 * 16),
2989 max_event_emit_size: Some(250 * 1024),
2990 max_move_vector_len: Some(256 * 1024),
2991 max_type_to_layout_nodes: None,
2992 max_ptb_value_size: None,
2993
2994 max_back_edges_per_function: Some(10_000),
2995 max_back_edges_per_module: Some(10_000),
2996 max_verifier_meter_ticks_per_function: Some(6_000_000),
2997 max_meter_ticks_per_module: Some(6_000_000),
2998 max_meter_ticks_per_package: None,
2999
3000 object_runtime_max_num_cached_objects: Some(1000),
3001 object_runtime_max_num_cached_objects_system_tx: Some(1000 * 16),
3002 object_runtime_max_num_store_entries: Some(1000),
3003 object_runtime_max_num_store_entries_system_tx: Some(1000 * 16),
3004 base_tx_cost_fixed: Some(110_000),
3005 package_publish_cost_fixed: Some(1_000),
3006 base_tx_cost_per_byte: Some(0),
3007 package_publish_cost_per_byte: Some(80),
3008 obj_access_cost_read_per_byte: Some(15),
3009 obj_access_cost_mutate_per_byte: Some(40),
3010 obj_access_cost_delete_per_byte: Some(40),
3011 obj_access_cost_verify_per_byte: Some(200),
3012 obj_data_cost_refundable: Some(100),
3013 obj_metadata_cost_non_refundable: Some(50),
3014 gas_model_version: Some(1),
3015 storage_rebate_rate: Some(9900),
3016 storage_fund_reinvest_rate: Some(500),
3017 reward_slashing_rate: Some(5000),
3018 storage_gas_price: Some(1),
3019 accumulator_object_storage_cost: None,
3020 max_transactions_per_checkpoint: Some(10_000),
3021 max_checkpoint_size_bytes: Some(30 * 1024 * 1024),
3022
3023 buffer_stake_for_protocol_upgrade_bps: Some(0),
3026
3027 address_from_bytes_cost_base: Some(52),
3031 address_to_u256_cost_base: Some(52),
3033 address_from_u256_cost_base: Some(52),
3035
3036 config_read_setting_impl_cost_base: None,
3039 config_read_setting_impl_cost_per_byte: None,
3040
3041 dynamic_field_hash_type_and_key_cost_base: Some(100),
3044 dynamic_field_hash_type_and_key_type_cost_per_byte: Some(2),
3045 dynamic_field_hash_type_and_key_value_cost_per_byte: Some(2),
3046 dynamic_field_hash_type_and_key_type_tag_cost_per_byte: Some(2),
3047 dynamic_field_add_child_object_cost_base: Some(100),
3049 dynamic_field_add_child_object_type_cost_per_byte: Some(10),
3050 dynamic_field_add_child_object_value_cost_per_byte: Some(10),
3051 dynamic_field_add_child_object_struct_tag_cost_per_byte: Some(10),
3052 dynamic_field_borrow_child_object_cost_base: Some(100),
3054 dynamic_field_borrow_child_object_child_ref_cost_per_byte: Some(10),
3055 dynamic_field_borrow_child_object_type_cost_per_byte: Some(10),
3056 dynamic_field_remove_child_object_cost_base: Some(100),
3058 dynamic_field_remove_child_object_child_cost_per_byte: Some(2),
3059 dynamic_field_remove_child_object_type_cost_per_byte: Some(2),
3060 dynamic_field_has_child_object_cost_base: Some(100),
3062 dynamic_field_has_child_object_with_ty_cost_base: Some(100),
3064 dynamic_field_has_child_object_with_ty_type_cost_per_byte: Some(2),
3065 dynamic_field_has_child_object_with_ty_type_tag_cost_per_byte: Some(2),
3066
3067 event_emit_cost_base: Some(52),
3070 event_emit_value_size_derivation_cost_per_byte: Some(2),
3071 event_emit_tag_size_derivation_cost_per_byte: Some(5),
3072 event_emit_output_cost_per_byte: Some(10),
3073 event_emit_auth_stream_cost: None,
3074
3075 object_borrow_uid_cost_base: Some(52),
3078 object_delete_impl_cost_base: Some(52),
3080 object_record_new_uid_cost_base: Some(52),
3082
3083 transfer_transfer_internal_cost_base: Some(52),
3086 transfer_party_transfer_internal_cost_base: None,
3088 transfer_freeze_object_cost_base: Some(52),
3090 transfer_share_object_cost_base: Some(52),
3092 transfer_receive_object_cost_base: None,
3093 transfer_receive_object_type_cost_per_byte: None,
3094 transfer_receive_object_cost_per_byte: None,
3095
3096 tx_context_derive_id_cost_base: Some(52),
3099 tx_context_fresh_id_cost_base: None,
3100 tx_context_sender_cost_base: None,
3101 tx_context_epoch_cost_base: None,
3102 tx_context_epoch_timestamp_ms_cost_base: None,
3103 tx_context_sponsor_cost_base: None,
3104 tx_context_rgp_cost_base: None,
3105 tx_context_gas_price_cost_base: None,
3106 tx_context_gas_budget_cost_base: None,
3107 tx_context_ids_created_cost_base: None,
3108 tx_context_replace_cost_base: None,
3109
3110 types_is_one_time_witness_cost_base: Some(52),
3113 types_is_one_time_witness_type_tag_cost_per_byte: Some(2),
3114 types_is_one_time_witness_type_cost_per_byte: Some(2),
3115
3116 validator_validate_metadata_cost_base: Some(52),
3119 validator_validate_metadata_data_cost_per_byte: Some(2),
3120
3121 crypto_invalid_arguments_cost: Some(100),
3123 bls12381_bls12381_min_sig_verify_cost_base: Some(52),
3125 bls12381_bls12381_min_sig_verify_msg_cost_per_byte: Some(2),
3126 bls12381_bls12381_min_sig_verify_msg_cost_per_block: Some(2),
3127
3128 bls12381_bls12381_min_pk_verify_cost_base: Some(52),
3130 bls12381_bls12381_min_pk_verify_msg_cost_per_byte: Some(2),
3131 bls12381_bls12381_min_pk_verify_msg_cost_per_block: Some(2),
3132
3133 ecdsa_k1_ecrecover_keccak256_cost_base: Some(52),
3135 ecdsa_k1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3136 ecdsa_k1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3137 ecdsa_k1_ecrecover_sha256_cost_base: Some(52),
3138 ecdsa_k1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3139 ecdsa_k1_ecrecover_sha256_msg_cost_per_block: Some(2),
3140
3141 ecdsa_k1_decompress_pubkey_cost_base: Some(52),
3143
3144 ecdsa_k1_secp256k1_verify_keccak256_cost_base: Some(52),
3146 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_byte: Some(2),
3147 ecdsa_k1_secp256k1_verify_keccak256_msg_cost_per_block: Some(2),
3148 ecdsa_k1_secp256k1_verify_sha256_cost_base: Some(52),
3149 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_byte: Some(2),
3150 ecdsa_k1_secp256k1_verify_sha256_msg_cost_per_block: Some(2),
3151
3152 ecdsa_r1_ecrecover_keccak256_cost_base: Some(52),
3154 ecdsa_r1_ecrecover_keccak256_msg_cost_per_byte: Some(2),
3155 ecdsa_r1_ecrecover_keccak256_msg_cost_per_block: Some(2),
3156 ecdsa_r1_ecrecover_sha256_cost_base: Some(52),
3157 ecdsa_r1_ecrecover_sha256_msg_cost_per_byte: Some(2),
3158 ecdsa_r1_ecrecover_sha256_msg_cost_per_block: Some(2),
3159
3160 ecdsa_r1_secp256r1_verify_keccak256_cost_base: Some(52),
3162 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_byte: Some(2),
3163 ecdsa_r1_secp256r1_verify_keccak256_msg_cost_per_block: Some(2),
3164 ecdsa_r1_secp256r1_verify_sha256_cost_base: Some(52),
3165 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_byte: Some(2),
3166 ecdsa_r1_secp256r1_verify_sha256_msg_cost_per_block: Some(2),
3167
3168 ecvrf_ecvrf_verify_cost_base: Some(52),
3170 ecvrf_ecvrf_verify_alpha_string_cost_per_byte: Some(2),
3171 ecvrf_ecvrf_verify_alpha_string_cost_per_block: Some(2),
3172
3173 ed25519_ed25519_verify_cost_base: Some(52),
3175 ed25519_ed25519_verify_msg_cost_per_byte: Some(2),
3176 ed25519_ed25519_verify_msg_cost_per_block: Some(2),
3177
3178 groth16_prepare_verifying_key_bls12381_cost_base: Some(52),
3180 groth16_prepare_verifying_key_bn254_cost_base: Some(52),
3181
3182 groth16_verify_groth16_proof_internal_bls12381_cost_base: Some(52),
3184 groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input: Some(2),
3185 groth16_verify_groth16_proof_internal_bn254_cost_base: Some(52),
3186 groth16_verify_groth16_proof_internal_bn254_cost_per_public_input: Some(2),
3187 groth16_verify_groth16_proof_internal_public_input_cost_per_byte: Some(2),
3188
3189 hash_blake2b256_cost_base: Some(52),
3191 hash_blake2b256_data_cost_per_byte: Some(2),
3192 hash_blake2b256_data_cost_per_block: Some(2),
3193
3194 hash_keccak256_cost_base: Some(52),
3196 hash_keccak256_data_cost_per_byte: Some(2),
3197 hash_keccak256_data_cost_per_block: Some(2),
3198
3199 poseidon_bn254_cost_base: None,
3200 poseidon_bn254_cost_per_block: None,
3201
3202 hmac_hmac_sha3_256_cost_base: Some(52),
3204 hmac_hmac_sha3_256_input_cost_per_byte: Some(2),
3205 hmac_hmac_sha3_256_input_cost_per_block: Some(2),
3206
3207 group_ops_bls12381_decode_scalar_cost: None,
3209 group_ops_bls12381_decode_g1_cost: None,
3210 group_ops_bls12381_decode_g2_cost: None,
3211 group_ops_bls12381_decode_gt_cost: None,
3212 group_ops_bls12381_scalar_add_cost: None,
3213 group_ops_bls12381_g1_add_cost: None,
3214 group_ops_bls12381_g2_add_cost: None,
3215 group_ops_bls12381_gt_add_cost: None,
3216 group_ops_bls12381_scalar_sub_cost: None,
3217 group_ops_bls12381_g1_sub_cost: None,
3218 group_ops_bls12381_g2_sub_cost: None,
3219 group_ops_bls12381_gt_sub_cost: None,
3220 group_ops_bls12381_scalar_mul_cost: None,
3221 group_ops_bls12381_g1_mul_cost: None,
3222 group_ops_bls12381_g2_mul_cost: None,
3223 group_ops_bls12381_gt_mul_cost: None,
3224 group_ops_bls12381_scalar_div_cost: None,
3225 group_ops_bls12381_g1_div_cost: None,
3226 group_ops_bls12381_g2_div_cost: None,
3227 group_ops_bls12381_gt_div_cost: None,
3228 group_ops_bls12381_g1_hash_to_base_cost: None,
3229 group_ops_bls12381_g2_hash_to_base_cost: None,
3230 group_ops_bls12381_g1_hash_to_cost_per_byte: None,
3231 group_ops_bls12381_g2_hash_to_cost_per_byte: None,
3232 group_ops_bls12381_g1_msm_base_cost: None,
3233 group_ops_bls12381_g2_msm_base_cost: None,
3234 group_ops_bls12381_g1_msm_base_cost_per_input: None,
3235 group_ops_bls12381_g2_msm_base_cost_per_input: None,
3236 group_ops_bls12381_msm_max_len: None,
3237 group_ops_bls12381_pairing_cost: None,
3238 group_ops_bls12381_g1_to_uncompressed_g1_cost: None,
3239 group_ops_bls12381_uncompressed_g1_to_g1_cost: None,
3240 group_ops_bls12381_uncompressed_g1_sum_base_cost: None,
3241 group_ops_bls12381_uncompressed_g1_sum_cost_per_term: None,
3242 group_ops_bls12381_uncompressed_g1_sum_max_terms: None,
3243
3244 group_ops_ristretto_decode_scalar_cost: None,
3245 group_ops_ristretto_decode_point_cost: None,
3246 group_ops_ristretto_scalar_add_cost: None,
3247 group_ops_ristretto_point_add_cost: None,
3248 group_ops_ristretto_scalar_sub_cost: None,
3249 group_ops_ristretto_point_sub_cost: None,
3250 group_ops_ristretto_scalar_mul_cost: None,
3251 group_ops_ristretto_point_mul_cost: None,
3252 group_ops_ristretto_scalar_div_cost: None,
3253 group_ops_ristretto_point_div_cost: None,
3254
3255 verify_bulletproofs_ristretto255_base_cost: None,
3256 verify_bulletproofs_ristretto255_cost_per_bit_and_commitment: None,
3257
3258 check_zklogin_id_cost_base: None,
3260 check_zklogin_issuer_cost_base: None,
3262
3263 vdf_verify_vdf_cost: None,
3264 vdf_hash_to_input_cost: None,
3265
3266 nitro_attestation_parse_base_cost: None,
3268 nitro_attestation_parse_cost_per_byte: None,
3269 nitro_attestation_verify_base_cost: None,
3270 nitro_attestation_verify_cost_per_cert: None,
3271
3272 bcs_per_byte_serialized_cost: None,
3273 bcs_legacy_min_output_size_cost: None,
3274 bcs_failure_cost: None,
3275 hash_sha2_256_base_cost: None,
3276 hash_sha2_256_per_byte_cost: None,
3277 hash_sha2_256_legacy_min_input_len_cost: None,
3278 hash_sha3_256_base_cost: None,
3279 hash_sha3_256_per_byte_cost: None,
3280 hash_sha3_256_legacy_min_input_len_cost: None,
3281 type_name_get_base_cost: None,
3282 type_name_get_per_byte_cost: None,
3283 type_name_id_base_cost: None,
3284 string_check_utf8_base_cost: None,
3285 string_check_utf8_per_byte_cost: None,
3286 string_is_char_boundary_base_cost: None,
3287 string_sub_string_base_cost: None,
3288 string_sub_string_per_byte_cost: None,
3289 string_index_of_base_cost: None,
3290 string_index_of_per_byte_pattern_cost: None,
3291 string_index_of_per_byte_searched_cost: None,
3292 vector_empty_base_cost: None,
3293 vector_length_base_cost: None,
3294 vector_push_back_base_cost: None,
3295 vector_push_back_legacy_per_abstract_memory_unit_cost: None,
3296 vector_borrow_base_cost: None,
3297 vector_pop_back_base_cost: None,
3298 vector_destroy_empty_base_cost: None,
3299 vector_swap_base_cost: None,
3300 debug_print_base_cost: None,
3301 debug_print_stack_trace_base_cost: None,
3302
3303 max_size_written_objects: None,
3304 max_size_written_objects_system_tx: None,
3305
3306 max_move_identifier_len: None,
3313 max_move_value_depth: None,
3314 max_move_enum_variants: None,
3315
3316 gas_rounding_step: None,
3317
3318 execution_version: None,
3319
3320 max_event_emit_size_total: None,
3321
3322 consensus_bad_nodes_stake_threshold: None,
3323
3324 max_jwk_votes_per_validator_per_epoch: None,
3325
3326 max_age_of_jwk_in_epochs: None,
3327
3328 random_beacon_reduction_allowed_delta: None,
3329
3330 random_beacon_reduction_lower_bound: None,
3331
3332 random_beacon_dkg_timeout_round: None,
3333
3334 random_beacon_min_round_interval_ms: None,
3335
3336 random_beacon_dkg_version: None,
3337
3338 consensus_max_transaction_size_bytes: None,
3339
3340 consensus_max_transactions_in_block_bytes: None,
3341
3342 consensus_max_num_transactions_in_block: None,
3343
3344 consensus_voting_rounds: None,
3345
3346 max_accumulated_txn_cost_per_object_in_narwhal_commit: None,
3347
3348 max_deferral_rounds_for_congestion_control: None,
3349
3350 max_txn_cost_overage_per_object_in_commit: None,
3351
3352 allowed_txn_cost_overage_burst_per_object_in_commit: None,
3353
3354 min_checkpoint_interval_ms: None,
3355
3356 checkpoint_summary_version_specific_data: None,
3357
3358 max_soft_bundle_size: None,
3359
3360 bridge_should_try_to_finalize_committee: None,
3361
3362 max_accumulated_txn_cost_per_object_in_mysticeti_commit: None,
3363
3364 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: None,
3365
3366 consensus_gc_depth: None,
3367
3368 gas_budget_based_txn_cost_cap_factor: None,
3369
3370 gas_budget_based_txn_cost_absolute_cap_commit_count: None,
3371
3372 sip_45_consensus_amplification_threshold: None,
3373
3374 use_object_per_epoch_marker_table_v2: None,
3375
3376 consensus_commit_rate_estimation_window_size: None,
3377
3378 aliased_addresses: vec![],
3379
3380 translation_per_command_base_charge: None,
3381 translation_per_input_base_charge: None,
3382 translation_pure_input_per_byte_charge: None,
3383 translation_per_type_node_charge: None,
3384 translation_per_reference_node_charge: None,
3385 translation_per_linkage_entry_charge: None,
3386
3387 max_updates_per_settlement_txn: None,
3388
3389 gasless_max_computation_units: None,
3390 gasless_allowed_token_types: None,
3391 gasless_max_unused_inputs: None,
3392 gasless_max_pure_input_bytes: None,
3393 gasless_max_tps: None,
3394 include_special_package_amendments: None,
3395 gasless_max_tx_size_bytes: None,
3396 };
3399 for cur in 2..=version.0 {
3400 match cur {
3401 1 => unreachable!(),
3402 2 => {
3403 cfg.feature_flags.advance_epoch_start_time_in_safe_mode = true;
3404 }
3405 3 => {
3406 cfg.gas_model_version = Some(2);
3408 cfg.max_tx_gas = Some(50_000_000_000);
3410 cfg.base_tx_cost_fixed = Some(2_000);
3412 cfg.storage_gas_price = Some(76);
3414 cfg.feature_flags.loaded_child_objects_fixed = true;
3415 cfg.max_size_written_objects = Some(5 * 1000 * 1000);
3418 cfg.max_size_written_objects_system_tx = Some(50 * 1000 * 1000);
3421 cfg.feature_flags.package_upgrades = true;
3422 }
3423 4 => {
3428 cfg.reward_slashing_rate = Some(10000);
3430 cfg.gas_model_version = Some(3);
3432 }
3433 5 => {
3434 cfg.feature_flags.missing_type_is_compatibility_error = true;
3435 cfg.gas_model_version = Some(4);
3436 cfg.feature_flags.scoring_decision_with_validity_cutoff = true;
3437 }
3441 6 => {
3442 cfg.gas_model_version = Some(5);
3443 cfg.buffer_stake_for_protocol_upgrade_bps = Some(5000);
3444 cfg.feature_flags.consensus_order_end_of_epoch_last = true;
3445 }
3446 7 => {
3447 cfg.feature_flags.disallow_adding_abilities_on_upgrade = true;
3448 cfg.feature_flags
3449 .disable_invariant_violation_check_in_swap_loc = true;
3450 cfg.feature_flags.ban_entry_init = true;
3451 cfg.feature_flags.package_digest_hash_module = true;
3452 }
3453 8 => {
3454 cfg.feature_flags
3455 .disallow_change_struct_type_params_on_upgrade = true;
3456 }
3457 9 => {
3458 cfg.max_move_identifier_len = Some(128);
3460 cfg.feature_flags.no_extraneous_module_bytes = true;
3461 cfg.feature_flags
3462 .advance_to_highest_supported_protocol_version = true;
3463 }
3464 10 => {
3465 cfg.max_verifier_meter_ticks_per_function = Some(16_000_000);
3466 cfg.max_meter_ticks_per_module = Some(16_000_000);
3467 }
3468 11 => {
3469 cfg.max_move_value_depth = Some(128);
3470 }
3471 12 => {
3472 cfg.feature_flags.narwhal_versioned_metadata = true;
3473 if chain != Chain::Mainnet {
3474 cfg.feature_flags.commit_root_state_digest = true;
3475 }
3476
3477 if chain != Chain::Mainnet && chain != Chain::Testnet {
3478 cfg.feature_flags.zklogin_auth = true;
3479 }
3480 }
3481 13 => {}
3482 14 => {
3483 cfg.gas_rounding_step = Some(1_000);
3484 cfg.gas_model_version = Some(6);
3485 }
3486 15 => {
3487 cfg.feature_flags.consensus_transaction_ordering =
3488 ConsensusTransactionOrdering::ByGasPrice;
3489 }
3490 16 => {
3491 cfg.feature_flags.simplified_unwrap_then_delete = true;
3492 }
3493 17 => {
3494 cfg.feature_flags.upgraded_multisig_supported = true;
3495 }
3496 18 => {
3497 cfg.execution_version = Some(1);
3498 cfg.feature_flags.txn_base_cost_as_multiplier = true;
3507 cfg.base_tx_cost_fixed = Some(1_000);
3509 }
3510 19 => {
3511 cfg.max_num_event_emit = Some(1024);
3512 cfg.max_event_emit_size_total = Some(
3515 256 * 250 * 1024, );
3517 }
3518 20 => {
3519 cfg.feature_flags.commit_root_state_digest = true;
3520
3521 if chain != Chain::Mainnet {
3522 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3523 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3524 }
3525 }
3526
3527 21 => {
3528 if chain != Chain::Mainnet {
3529 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3530 "Google".to_string(),
3531 "Facebook".to_string(),
3532 "Twitch".to_string(),
3533 ]);
3534 }
3535 }
3536 22 => {
3537 cfg.feature_flags.loaded_child_object_format = true;
3538 }
3539 23 => {
3540 cfg.feature_flags.loaded_child_object_format_type = true;
3541 cfg.feature_flags.narwhal_new_leader_election_schedule = true;
3542 cfg.consensus_bad_nodes_stake_threshold = Some(20);
3548 }
3549 24 => {
3550 cfg.feature_flags.simple_conservation_checks = true;
3551 cfg.max_publish_or_upgrade_per_ptb = Some(5);
3552
3553 cfg.feature_flags.end_of_epoch_transaction_supported = true;
3554
3555 if chain != Chain::Mainnet {
3556 cfg.feature_flags.enable_jwk_consensus_updates = true;
3557 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3559 cfg.max_age_of_jwk_in_epochs = Some(1);
3560 }
3561 }
3562 25 => {
3563 cfg.feature_flags.zklogin_supported_providers = BTreeSet::from([
3565 "Google".to_string(),
3566 "Facebook".to_string(),
3567 "Twitch".to_string(),
3568 ]);
3569 cfg.feature_flags.zklogin_auth = true;
3570
3571 cfg.feature_flags.enable_jwk_consensus_updates = true;
3573 cfg.max_jwk_votes_per_validator_per_epoch = Some(240);
3574 cfg.max_age_of_jwk_in_epochs = Some(1);
3575 }
3576 26 => {
3577 cfg.gas_model_version = Some(7);
3578 if chain != Chain::Mainnet && chain != Chain::Testnet {
3580 cfg.transfer_receive_object_cost_base = Some(52);
3581 cfg.feature_flags.receive_objects = true;
3582 }
3583 }
3584 27 => {
3585 cfg.gas_model_version = Some(8);
3586 }
3587 28 => {
3588 cfg.check_zklogin_id_cost_base = Some(200);
3590 cfg.check_zklogin_issuer_cost_base = Some(200);
3592
3593 if chain != Chain::Mainnet && chain != Chain::Testnet {
3595 cfg.feature_flags.enable_effects_v2 = true;
3596 }
3597 }
3598 29 => {
3599 cfg.feature_flags.verify_legacy_zklogin_address = true;
3600 }
3601 30 => {
3602 if chain != Chain::Mainnet {
3604 cfg.feature_flags.narwhal_certificate_v2 = true;
3605 }
3606
3607 cfg.random_beacon_reduction_allowed_delta = Some(800);
3608 if chain != Chain::Mainnet {
3610 cfg.feature_flags.enable_effects_v2 = true;
3611 }
3612
3613 cfg.feature_flags.zklogin_supported_providers = BTreeSet::default();
3617
3618 cfg.feature_flags.recompute_has_public_transfer_in_execution = true;
3619 }
3620 31 => {
3621 cfg.execution_version = Some(2);
3622 if chain != Chain::Mainnet && chain != Chain::Testnet {
3624 cfg.feature_flags.shared_object_deletion = true;
3625 }
3626 }
3627 32 => {
3628 if chain != Chain::Mainnet {
3630 cfg.feature_flags.accept_zklogin_in_multisig = true;
3631 }
3632 if chain != Chain::Mainnet {
3634 cfg.transfer_receive_object_cost_base = Some(52);
3635 cfg.feature_flags.receive_objects = true;
3636 }
3637 if chain != Chain::Mainnet && chain != Chain::Testnet {
3639 cfg.feature_flags.random_beacon = true;
3640 cfg.random_beacon_reduction_lower_bound = Some(1600);
3641 cfg.random_beacon_dkg_timeout_round = Some(3000);
3642 cfg.random_beacon_min_round_interval_ms = Some(150);
3643 }
3644 if chain != Chain::Testnet && chain != Chain::Mainnet {
3646 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3647 }
3648
3649 cfg.feature_flags.narwhal_certificate_v2 = true;
3651 }
3652 33 => {
3653 cfg.feature_flags.hardened_otw_check = true;
3654 cfg.feature_flags.allow_receiving_object_id = true;
3655
3656 cfg.transfer_receive_object_cost_base = Some(52);
3658 cfg.feature_flags.receive_objects = true;
3659
3660 if chain != Chain::Mainnet {
3662 cfg.feature_flags.shared_object_deletion = true;
3663 }
3664
3665 cfg.feature_flags.enable_effects_v2 = true;
3666 }
3667 34 => {}
3668 35 => {
3669 if chain != Chain::Mainnet && chain != Chain::Testnet {
3671 cfg.feature_flags.enable_poseidon = true;
3672 cfg.poseidon_bn254_cost_base = Some(260);
3673 cfg.poseidon_bn254_cost_per_block = Some(10);
3674 }
3675
3676 cfg.feature_flags.enable_coin_deny_list = true;
3677 }
3678 36 => {
3679 if chain != Chain::Mainnet && chain != Chain::Testnet {
3681 cfg.feature_flags.enable_group_ops_native_functions = true;
3682 cfg.feature_flags.enable_group_ops_native_function_msm = true;
3683 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3685 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3686 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3687 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3688 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3689 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3690 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3691 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3692 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3693 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3694 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3695 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3696 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3697 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3698 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3699 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3700 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3701 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3702 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3703 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3704 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3705 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3706 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3707 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3708 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3709 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3710 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3711 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3712 cfg.group_ops_bls12381_msm_max_len = Some(32);
3713 cfg.group_ops_bls12381_pairing_cost = Some(52);
3714 }
3715 cfg.feature_flags.shared_object_deletion = true;
3717
3718 cfg.consensus_max_transaction_size_bytes = Some(256 * 1024); cfg.consensus_max_transactions_in_block_bytes = Some(6 * 1_024 * 1024);
3720 }
3722 37 => {
3723 cfg.feature_flags.reject_mutable_random_on_entry_functions = true;
3724
3725 if chain != Chain::Mainnet {
3727 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3728 }
3729 }
3730 38 => {
3731 cfg.binary_module_handles = Some(100);
3732 cfg.binary_struct_handles = Some(300);
3733 cfg.binary_function_handles = Some(1500);
3734 cfg.binary_function_instantiations = Some(750);
3735 cfg.binary_signatures = Some(1000);
3736 cfg.binary_constant_pool = Some(4000);
3740 cfg.binary_identifiers = Some(10000);
3741 cfg.binary_address_identifiers = Some(100);
3742 cfg.binary_struct_defs = Some(200);
3743 cfg.binary_struct_def_instantiations = Some(100);
3744 cfg.binary_function_defs = Some(1000);
3745 cfg.binary_field_handles = Some(500);
3746 cfg.binary_field_instantiations = Some(250);
3747 cfg.binary_friend_decls = Some(100);
3748 cfg.max_package_dependencies = Some(32);
3750 cfg.max_modules_in_publish = Some(64);
3751 cfg.execution_version = Some(3);
3753 }
3754 39 => {
3755 }
3757 40 => {}
3758 41 => {
3759 cfg.feature_flags.enable_group_ops_native_functions = true;
3761 cfg.group_ops_bls12381_decode_scalar_cost = Some(52);
3763 cfg.group_ops_bls12381_decode_g1_cost = Some(52);
3764 cfg.group_ops_bls12381_decode_g2_cost = Some(52);
3765 cfg.group_ops_bls12381_decode_gt_cost = Some(52);
3766 cfg.group_ops_bls12381_scalar_add_cost = Some(52);
3767 cfg.group_ops_bls12381_g1_add_cost = Some(52);
3768 cfg.group_ops_bls12381_g2_add_cost = Some(52);
3769 cfg.group_ops_bls12381_gt_add_cost = Some(52);
3770 cfg.group_ops_bls12381_scalar_sub_cost = Some(52);
3771 cfg.group_ops_bls12381_g1_sub_cost = Some(52);
3772 cfg.group_ops_bls12381_g2_sub_cost = Some(52);
3773 cfg.group_ops_bls12381_gt_sub_cost = Some(52);
3774 cfg.group_ops_bls12381_scalar_mul_cost = Some(52);
3775 cfg.group_ops_bls12381_g1_mul_cost = Some(52);
3776 cfg.group_ops_bls12381_g2_mul_cost = Some(52);
3777 cfg.group_ops_bls12381_gt_mul_cost = Some(52);
3778 cfg.group_ops_bls12381_scalar_div_cost = Some(52);
3779 cfg.group_ops_bls12381_g1_div_cost = Some(52);
3780 cfg.group_ops_bls12381_g2_div_cost = Some(52);
3781 cfg.group_ops_bls12381_gt_div_cost = Some(52);
3782 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(52);
3783 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(52);
3784 cfg.group_ops_bls12381_g1_hash_to_cost_per_byte = Some(2);
3785 cfg.group_ops_bls12381_g2_hash_to_cost_per_byte = Some(2);
3786 cfg.group_ops_bls12381_g1_msm_base_cost = Some(52);
3787 cfg.group_ops_bls12381_g2_msm_base_cost = Some(52);
3788 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(52);
3789 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(52);
3790 cfg.group_ops_bls12381_msm_max_len = Some(32);
3791 cfg.group_ops_bls12381_pairing_cost = Some(52);
3792 }
3793 42 => {}
3794 43 => {
3795 cfg.feature_flags.zklogin_max_epoch_upper_bound_delta = Some(30);
3796 cfg.max_meter_ticks_per_package = Some(16_000_000);
3797 }
3798 44 => {
3799 cfg.feature_flags.include_consensus_digest_in_prologue = true;
3801 if chain != Chain::Mainnet {
3803 cfg.feature_flags.consensus_choice = ConsensusChoice::SwapEachEpoch;
3804 }
3805 }
3806 45 => {
3807 if chain != Chain::Testnet && chain != Chain::Mainnet {
3809 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3810 }
3811
3812 if chain != Chain::Mainnet {
3813 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3815 }
3816 cfg.min_move_binary_format_version = Some(6);
3817 cfg.feature_flags.accept_zklogin_in_multisig = true;
3818
3819 if chain != Chain::Mainnet && chain != Chain::Testnet {
3823 cfg.feature_flags.bridge = true;
3824 }
3825 }
3826 46 => {
3827 if chain != Chain::Mainnet {
3829 cfg.feature_flags.bridge = true;
3830 }
3831
3832 cfg.feature_flags.reshare_at_same_initial_version = true;
3834 }
3835 47 => {}
3836 48 => {
3837 cfg.feature_flags.consensus_network = ConsensusNetwork::Tonic;
3839
3840 cfg.feature_flags.resolve_abort_locations_to_package_id = true;
3842
3843 if chain != Chain::Mainnet {
3845 cfg.feature_flags.random_beacon = true;
3846 cfg.random_beacon_reduction_lower_bound = Some(1600);
3847 cfg.random_beacon_dkg_timeout_round = Some(3000);
3848 cfg.random_beacon_min_round_interval_ms = Some(200);
3849 }
3850
3851 cfg.feature_flags.mysticeti_use_committed_subdag_digest = true;
3853 }
3854 49 => {
3855 if chain != Chain::Testnet && chain != Chain::Mainnet {
3856 cfg.move_binary_format_version = Some(7);
3857 }
3858
3859 if chain != Chain::Mainnet && chain != Chain::Testnet {
3861 cfg.feature_flags.enable_vdf = true;
3862 cfg.vdf_verify_vdf_cost = Some(1500);
3865 cfg.vdf_hash_to_input_cost = Some(100);
3866 }
3867
3868 if chain != Chain::Testnet && chain != Chain::Mainnet {
3870 cfg.feature_flags
3871 .record_consensus_determined_version_assignments_in_prologue = true;
3872 }
3873
3874 if chain != Chain::Mainnet {
3876 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3877 }
3878
3879 cfg.feature_flags.fresh_vm_on_framework_upgrade = true;
3881 }
3882 50 => {
3883 if chain != Chain::Mainnet {
3885 cfg.checkpoint_summary_version_specific_data = Some(1);
3886 cfg.min_checkpoint_interval_ms = Some(200);
3887 }
3888
3889 if chain != Chain::Testnet && chain != Chain::Mainnet {
3891 cfg.feature_flags
3892 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3893 }
3894
3895 cfg.feature_flags.mysticeti_num_leaders_per_round = Some(1);
3896
3897 cfg.max_deferral_rounds_for_congestion_control = Some(10);
3899 }
3900 51 => {
3901 cfg.random_beacon_dkg_version = Some(1);
3902
3903 if chain != Chain::Testnet && chain != Chain::Mainnet {
3904 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3905 }
3906 }
3907 52 => {
3908 if chain != Chain::Mainnet {
3909 cfg.feature_flags.soft_bundle = true;
3910 cfg.max_soft_bundle_size = Some(5);
3911 }
3912
3913 cfg.config_read_setting_impl_cost_base = Some(100);
3914 cfg.config_read_setting_impl_cost_per_byte = Some(40);
3915
3916 if chain != Chain::Testnet && chain != Chain::Mainnet {
3918 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3919 cfg.feature_flags.per_object_congestion_control_mode =
3920 PerObjectCongestionControlMode::TotalTxCount;
3921 }
3922
3923 cfg.feature_flags.consensus_choice = ConsensusChoice::Mysticeti;
3925
3926 cfg.feature_flags.mysticeti_leader_scoring_and_schedule = true;
3928
3929 cfg.checkpoint_summary_version_specific_data = Some(1);
3931 cfg.min_checkpoint_interval_ms = Some(200);
3932
3933 if chain != Chain::Mainnet {
3935 cfg.feature_flags
3936 .record_consensus_determined_version_assignments_in_prologue = true;
3937 cfg.feature_flags
3938 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3939 }
3940 if chain != Chain::Mainnet {
3942 cfg.move_binary_format_version = Some(7);
3943 }
3944
3945 if chain != Chain::Testnet && chain != Chain::Mainnet {
3946 cfg.feature_flags.passkey_auth = true;
3947 }
3948 cfg.feature_flags.enable_coin_deny_list_v2 = true;
3949 }
3950 53 => {
3951 cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet);
3953
3954 cfg.feature_flags
3956 .record_consensus_determined_version_assignments_in_prologue = true;
3957 cfg.feature_flags
3958 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = true;
3959
3960 if chain == Chain::Unknown {
3961 cfg.feature_flags.authority_capabilities_v2 = true;
3962 }
3963
3964 if chain != Chain::Mainnet {
3966 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
3967 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
3968 cfg.feature_flags.per_object_congestion_control_mode =
3969 PerObjectCongestionControlMode::TotalTxCount;
3970 }
3971
3972 cfg.bcs_per_byte_serialized_cost = Some(2);
3974 cfg.bcs_legacy_min_output_size_cost = Some(1);
3975 cfg.bcs_failure_cost = Some(52);
3976 cfg.debug_print_base_cost = Some(52);
3977 cfg.debug_print_stack_trace_base_cost = Some(52);
3978 cfg.hash_sha2_256_base_cost = Some(52);
3979 cfg.hash_sha2_256_per_byte_cost = Some(2);
3980 cfg.hash_sha2_256_legacy_min_input_len_cost = Some(1);
3981 cfg.hash_sha3_256_base_cost = Some(52);
3982 cfg.hash_sha3_256_per_byte_cost = Some(2);
3983 cfg.hash_sha3_256_legacy_min_input_len_cost = Some(1);
3984 cfg.type_name_get_base_cost = Some(52);
3985 cfg.type_name_get_per_byte_cost = Some(2);
3986 cfg.string_check_utf8_base_cost = Some(52);
3987 cfg.string_check_utf8_per_byte_cost = Some(2);
3988 cfg.string_is_char_boundary_base_cost = Some(52);
3989 cfg.string_sub_string_base_cost = Some(52);
3990 cfg.string_sub_string_per_byte_cost = Some(2);
3991 cfg.string_index_of_base_cost = Some(52);
3992 cfg.string_index_of_per_byte_pattern_cost = Some(2);
3993 cfg.string_index_of_per_byte_searched_cost = Some(2);
3994 cfg.vector_empty_base_cost = Some(52);
3995 cfg.vector_length_base_cost = Some(52);
3996 cfg.vector_push_back_base_cost = Some(52);
3997 cfg.vector_push_back_legacy_per_abstract_memory_unit_cost = Some(2);
3998 cfg.vector_borrow_base_cost = Some(52);
3999 cfg.vector_pop_back_base_cost = Some(52);
4000 cfg.vector_destroy_empty_base_cost = Some(52);
4001 cfg.vector_swap_base_cost = Some(52);
4002 }
4003 54 => {
4004 cfg.feature_flags.random_beacon = true;
4006 cfg.random_beacon_reduction_lower_bound = Some(1000);
4007 cfg.random_beacon_dkg_timeout_round = Some(3000);
4008 cfg.random_beacon_min_round_interval_ms = Some(500);
4009
4010 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(100);
4012 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(10);
4013 cfg.feature_flags.per_object_congestion_control_mode =
4014 PerObjectCongestionControlMode::TotalTxCount;
4015
4016 cfg.feature_flags.soft_bundle = true;
4018 cfg.max_soft_bundle_size = Some(5);
4019 }
4020 55 => {
4021 cfg.move_binary_format_version = Some(7);
4023
4024 cfg.consensus_max_transactions_in_block_bytes = Some(512 * 1024);
4026 cfg.consensus_max_num_transactions_in_block = Some(512);
4029
4030 cfg.feature_flags.rethrow_serialization_type_layout_errors = true;
4031 }
4032 56 => {
4033 if chain == Chain::Mainnet {
4034 cfg.feature_flags.bridge = true;
4035 }
4036 }
4037 57 => {
4038 cfg.random_beacon_reduction_lower_bound = Some(800);
4040 }
4041 58 => {
4042 if chain == Chain::Mainnet {
4043 cfg.bridge_should_try_to_finalize_committee = Some(true);
4044 }
4045
4046 if chain != Chain::Mainnet && chain != Chain::Testnet {
4047 cfg.feature_flags
4049 .consensus_distributed_vote_scoring_strategy = true;
4050 }
4051 }
4052 59 => {
4053 cfg.feature_flags.consensus_round_prober = true;
4055 }
4056 60 => {
4057 cfg.max_type_to_layout_nodes = Some(512);
4058 cfg.feature_flags.validate_identifier_inputs = true;
4059 }
4060 61 => {
4061 if chain != Chain::Mainnet {
4062 cfg.feature_flags
4064 .consensus_distributed_vote_scoring_strategy = true;
4065 }
4066 cfg.random_beacon_reduction_lower_bound = Some(700);
4068
4069 if chain != Chain::Mainnet && chain != Chain::Testnet {
4070 cfg.feature_flags.mysticeti_fastpath = true;
4072 }
4073 }
4074 62 => {
4075 cfg.feature_flags.relocate_event_module = true;
4076 }
4077 63 => {
4078 cfg.feature_flags.per_object_congestion_control_mode =
4079 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4080 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4081 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4082 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(240_000_000);
4083 }
4084 64 => {
4085 cfg.feature_flags.per_object_congestion_control_mode =
4086 PerObjectCongestionControlMode::TotalTxCount;
4087 cfg.max_accumulated_txn_cost_per_object_in_narwhal_commit = Some(40);
4088 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(3);
4089 }
4090 65 => {
4091 cfg.feature_flags
4093 .consensus_distributed_vote_scoring_strategy = true;
4094 }
4095 66 => {
4096 if chain == Chain::Mainnet {
4097 cfg.feature_flags
4099 .consensus_distributed_vote_scoring_strategy = false;
4100 }
4101 }
4102 67 => {
4103 cfg.feature_flags
4105 .consensus_distributed_vote_scoring_strategy = true;
4106 }
4107 68 => {
4108 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(26);
4109 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(52);
4110 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(26);
4111 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(13);
4112 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(2000);
4113
4114 if chain != Chain::Mainnet && chain != Chain::Testnet {
4115 cfg.feature_flags.uncompressed_g1_group_elements = true;
4116 }
4117
4118 cfg.feature_flags.per_object_congestion_control_mode =
4119 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4120 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4121 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(18_500_000);
4122 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4123 Some(3_700_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4125 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4126
4127 cfg.random_beacon_reduction_lower_bound = Some(500);
4129
4130 cfg.feature_flags.disallow_new_modules_in_deps_only_packages = true;
4131 }
4132 69 => {
4133 cfg.consensus_voting_rounds = Some(40);
4135
4136 if chain != Chain::Mainnet && chain != Chain::Testnet {
4137 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4139 }
4140
4141 if chain != Chain::Mainnet {
4142 cfg.feature_flags.uncompressed_g1_group_elements = true;
4143 }
4144 }
4145 70 => {
4146 if chain != Chain::Mainnet {
4147 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4149 cfg.feature_flags
4151 .consensus_round_prober_probe_accepted_rounds = true;
4152 }
4153
4154 cfg.poseidon_bn254_cost_per_block = Some(388);
4155
4156 cfg.gas_model_version = Some(9);
4157 cfg.feature_flags.native_charging_v2 = true;
4158 cfg.bls12381_bls12381_min_sig_verify_cost_base = Some(44064);
4159 cfg.bls12381_bls12381_min_pk_verify_cost_base = Some(49282);
4160 cfg.ecdsa_k1_secp256k1_verify_keccak256_cost_base = Some(1470);
4161 cfg.ecdsa_k1_secp256k1_verify_sha256_cost_base = Some(1470);
4162 cfg.ecdsa_r1_secp256r1_verify_sha256_cost_base = Some(4225);
4163 cfg.ecdsa_r1_secp256r1_verify_keccak256_cost_base = Some(4225);
4164 cfg.ecvrf_ecvrf_verify_cost_base = Some(4848);
4165 cfg.ed25519_ed25519_verify_cost_base = Some(1802);
4166
4167 cfg.ecdsa_r1_ecrecover_keccak256_cost_base = Some(1173);
4169 cfg.ecdsa_r1_ecrecover_sha256_cost_base = Some(1173);
4170 cfg.ecdsa_k1_ecrecover_keccak256_cost_base = Some(500);
4171 cfg.ecdsa_k1_ecrecover_sha256_cost_base = Some(500);
4172
4173 cfg.groth16_prepare_verifying_key_bls12381_cost_base = Some(53838);
4174 cfg.groth16_prepare_verifying_key_bn254_cost_base = Some(82010);
4175 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_base = Some(72090);
4176 cfg.groth16_verify_groth16_proof_internal_bls12381_cost_per_public_input =
4177 Some(8213);
4178 cfg.groth16_verify_groth16_proof_internal_bn254_cost_base = Some(115502);
4179 cfg.groth16_verify_groth16_proof_internal_bn254_cost_per_public_input =
4180 Some(9484);
4181
4182 cfg.hash_keccak256_cost_base = Some(10);
4183 cfg.hash_blake2b256_cost_base = Some(10);
4184
4185 cfg.group_ops_bls12381_decode_scalar_cost = Some(7);
4187 cfg.group_ops_bls12381_decode_g1_cost = Some(2848);
4188 cfg.group_ops_bls12381_decode_g2_cost = Some(3770);
4189 cfg.group_ops_bls12381_decode_gt_cost = Some(3068);
4190
4191 cfg.group_ops_bls12381_scalar_add_cost = Some(10);
4192 cfg.group_ops_bls12381_g1_add_cost = Some(1556);
4193 cfg.group_ops_bls12381_g2_add_cost = Some(3048);
4194 cfg.group_ops_bls12381_gt_add_cost = Some(188);
4195
4196 cfg.group_ops_bls12381_scalar_sub_cost = Some(10);
4197 cfg.group_ops_bls12381_g1_sub_cost = Some(1550);
4198 cfg.group_ops_bls12381_g2_sub_cost = Some(3019);
4199 cfg.group_ops_bls12381_gt_sub_cost = Some(497);
4200
4201 cfg.group_ops_bls12381_scalar_mul_cost = Some(11);
4202 cfg.group_ops_bls12381_g1_mul_cost = Some(4842);
4203 cfg.group_ops_bls12381_g2_mul_cost = Some(9108);
4204 cfg.group_ops_bls12381_gt_mul_cost = Some(27490);
4205
4206 cfg.group_ops_bls12381_scalar_div_cost = Some(91);
4207 cfg.group_ops_bls12381_g1_div_cost = Some(5091);
4208 cfg.group_ops_bls12381_g2_div_cost = Some(9206);
4209 cfg.group_ops_bls12381_gt_div_cost = Some(27804);
4210
4211 cfg.group_ops_bls12381_g1_hash_to_base_cost = Some(2962);
4212 cfg.group_ops_bls12381_g2_hash_to_base_cost = Some(8688);
4213
4214 cfg.group_ops_bls12381_g1_msm_base_cost = Some(62648);
4215 cfg.group_ops_bls12381_g2_msm_base_cost = Some(131192);
4216 cfg.group_ops_bls12381_g1_msm_base_cost_per_input = Some(1333);
4217 cfg.group_ops_bls12381_g2_msm_base_cost_per_input = Some(3216);
4218
4219 cfg.group_ops_bls12381_uncompressed_g1_to_g1_cost = Some(677);
4220 cfg.group_ops_bls12381_g1_to_uncompressed_g1_cost = Some(2099);
4221 cfg.group_ops_bls12381_uncompressed_g1_sum_base_cost = Some(77);
4222 cfg.group_ops_bls12381_uncompressed_g1_sum_cost_per_term = Some(26);
4223
4224 cfg.group_ops_bls12381_pairing_cost = Some(26897);
4225 cfg.group_ops_bls12381_uncompressed_g1_sum_max_terms = Some(1200);
4226
4227 cfg.validator_validate_metadata_cost_base = Some(20000);
4228 }
4229 71 => {
4230 cfg.sip_45_consensus_amplification_threshold = Some(5);
4231
4232 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
4234 }
4235 72 => {
4236 cfg.feature_flags.convert_type_argument_error = true;
4237
4238 cfg.max_tx_gas = Some(50_000_000_000_000);
4241 cfg.max_gas_price = Some(50_000_000_000);
4243
4244 cfg.feature_flags.variant_nodes = true;
4245 }
4246 73 => {
4247 cfg.use_object_per_epoch_marker_table_v2 = Some(true);
4249
4250 if chain != Chain::Mainnet && chain != Chain::Testnet {
4251 cfg.consensus_gc_depth = Some(60);
4254 }
4255
4256 if chain != Chain::Mainnet {
4257 cfg.feature_flags.consensus_zstd_compression = true;
4259 }
4260
4261 cfg.feature_flags.consensus_smart_ancestor_selection = true;
4263 cfg.feature_flags
4265 .consensus_round_prober_probe_accepted_rounds = true;
4266
4267 cfg.feature_flags.per_object_congestion_control_mode =
4269 PerObjectCongestionControlMode::TotalGasBudgetWithCap;
4270 cfg.gas_budget_based_txn_cost_cap_factor = Some(400_000);
4271 cfg.max_accumulated_txn_cost_per_object_in_mysticeti_commit = Some(37_000_000);
4272 cfg.max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit =
4273 Some(7_400_000); cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX);
4275 cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50);
4276 cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(370_000_000);
4277 }
4278 74 => {
4279 if chain != Chain::Mainnet && chain != Chain::Testnet {
4281 cfg.feature_flags.enable_nitro_attestation = true;
4282 }
4283 cfg.nitro_attestation_parse_base_cost = Some(53 * 50);
4284 cfg.nitro_attestation_parse_cost_per_byte = Some(50);
4285 cfg.nitro_attestation_verify_base_cost = Some(49632 * 50);
4286 cfg.nitro_attestation_verify_cost_per_cert = Some(52369 * 50);
4287
4288 cfg.feature_flags.consensus_zstd_compression = true;
4290
4291 if chain != Chain::Mainnet && chain != Chain::Testnet {
4292 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4293 }
4294 }
4295 75 => {
4296 if chain != Chain::Mainnet {
4297 cfg.feature_flags.passkey_auth = true;
4298 }
4299 }
4300 76 => {
4301 if chain != Chain::Mainnet && chain != Chain::Testnet {
4302 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4303 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4304 }
4305 cfg.feature_flags.minimize_child_object_mutations = true;
4306
4307 if chain != Chain::Mainnet {
4308 cfg.feature_flags.accept_passkey_in_multisig = true;
4309 }
4310 }
4311 77 => {
4312 cfg.feature_flags.uncompressed_g1_group_elements = true;
4313
4314 if chain != Chain::Mainnet {
4315 cfg.consensus_gc_depth = Some(60);
4316 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4317 }
4318 }
4319 78 => {
4320 cfg.feature_flags.move_native_context = true;
4321 cfg.tx_context_fresh_id_cost_base = Some(52);
4322 cfg.tx_context_sender_cost_base = Some(30);
4323 cfg.tx_context_epoch_cost_base = Some(30);
4324 cfg.tx_context_epoch_timestamp_ms_cost_base = Some(30);
4325 cfg.tx_context_sponsor_cost_base = Some(30);
4326 cfg.tx_context_gas_price_cost_base = Some(30);
4327 cfg.tx_context_gas_budget_cost_base = Some(30);
4328 cfg.tx_context_ids_created_cost_base = Some(30);
4329 cfg.tx_context_replace_cost_base = Some(30);
4330 cfg.gas_model_version = Some(10);
4331
4332 if chain != Chain::Mainnet {
4333 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4334 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4335
4336 cfg.feature_flags.per_object_congestion_control_mode =
4338 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4339 ExecutionTimeEstimateParams {
4340 target_utilization: 30,
4341 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4343 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4345 stored_observations_limit: u64::MAX,
4346 stake_weighted_median_threshold: 0,
4347 default_none_duration_for_new_keys: false,
4348 observations_chunk_size: None,
4349 },
4350 );
4351 }
4352 }
4353 79 => {
4354 if chain != Chain::Mainnet {
4355 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4356
4357 cfg.consensus_bad_nodes_stake_threshold = Some(30);
4360
4361 cfg.feature_flags.consensus_batched_block_sync = true;
4362
4363 cfg.feature_flags.enable_nitro_attestation = true
4365 }
4366 cfg.feature_flags.normalize_ptb_arguments = true;
4367
4368 cfg.consensus_gc_depth = Some(60);
4369 cfg.feature_flags.consensus_linearize_subdag_v2 = true;
4370 }
4371 80 => {
4372 cfg.max_ptb_value_size = Some(1024 * 1024);
4373 }
4374 81 => {
4375 cfg.feature_flags.consensus_median_based_commit_timestamp = true;
4376 cfg.feature_flags.enforce_checkpoint_timestamp_monotonicity = true;
4377 cfg.consensus_bad_nodes_stake_threshold = Some(30)
4378 }
4379 82 => {
4380 cfg.feature_flags.max_ptb_value_size_v2 = true;
4381 }
4382 83 => {
4383 if chain == Chain::Mainnet {
4384 let aliased: [u8; 32] = Hex::decode(
4386 "0x0b2da327ba6a4cacbe75dddd50e6e8bbf81d6496e92d66af9154c61c77f7332f",
4387 )
4388 .unwrap()
4389 .try_into()
4390 .unwrap();
4391
4392 cfg.aliased_addresses.push(AliasedAddress {
4394 original: Hex::decode("0xcd8962dad278d8b50fa0f9eb0186bfa4cbdecc6d59377214c88d0286a0ac9562").unwrap().try_into().unwrap(),
4395 aliased,
4396 allowed_tx_digests: vec![
4397 Base58::decode("B2eGLFoMHgj93Ni8dAJBfqGzo8EWSTLBesZzhEpTPA4").unwrap().try_into().unwrap(),
4398 ],
4399 });
4400
4401 cfg.aliased_addresses.push(AliasedAddress {
4402 original: Hex::decode("0xe28b50cef1d633ea43d3296a3f6b67ff0312a5f1a99f0af753c85b8b5de8ff06").unwrap().try_into().unwrap(),
4403 aliased,
4404 allowed_tx_digests: vec![
4405 Base58::decode("J4QqSAgp7VrQtQpMy5wDX4QGsCSEZu3U5KuDAkbESAge").unwrap().try_into().unwrap(),
4406 ],
4407 });
4408 }
4409
4410 if chain != Chain::Mainnet {
4413 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4414 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4415
4416 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4418 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4419 cfg.feature_flags.per_object_congestion_control_mode =
4420 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4421 ExecutionTimeEstimateParams {
4422 target_utilization: 30,
4423 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4425 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4427 stored_observations_limit: u64::MAX,
4428 stake_weighted_median_threshold: 0,
4429 default_none_duration_for_new_keys: false,
4430 observations_chunk_size: None,
4431 },
4432 );
4433
4434 cfg.feature_flags.consensus_batched_block_sync = true;
4436
4437 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4440 cfg.feature_flags.enable_nitro_attestation = true;
4441 }
4442 }
4443 84 => {
4444 if chain == Chain::Mainnet {
4445 cfg.feature_flags.resolve_type_input_ids_to_defining_id = true;
4446 cfg.transfer_party_transfer_internal_cost_base = Some(52);
4447
4448 cfg.feature_flags.record_additional_state_digest_in_prologue = true;
4450 cfg.consensus_commit_rate_estimation_window_size = Some(10);
4451 cfg.feature_flags.per_object_congestion_control_mode =
4452 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4453 ExecutionTimeEstimateParams {
4454 target_utilization: 30,
4455 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4457 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4459 stored_observations_limit: u64::MAX,
4460 stake_weighted_median_threshold: 0,
4461 default_none_duration_for_new_keys: false,
4462 observations_chunk_size: None,
4463 },
4464 );
4465
4466 cfg.feature_flags.consensus_batched_block_sync = true;
4468
4469 cfg.feature_flags.enable_nitro_attestation_upgraded_parsing = true;
4472 cfg.feature_flags.enable_nitro_attestation = true;
4473 }
4474
4475 cfg.feature_flags.per_object_congestion_control_mode =
4477 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4478 ExecutionTimeEstimateParams {
4479 target_utilization: 30,
4480 allowed_txn_cost_overage_burst_limit_us: 100_000, randomness_scalar: 20,
4482 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4484 stored_observations_limit: 20,
4485 stake_weighted_median_threshold: 0,
4486 default_none_duration_for_new_keys: false,
4487 observations_chunk_size: None,
4488 },
4489 );
4490 cfg.feature_flags.allow_unbounded_system_objects = true;
4491 }
4492 85 => {
4493 if chain != Chain::Mainnet && chain != Chain::Testnet {
4494 cfg.feature_flags.enable_party_transfer = true;
4495 }
4496
4497 cfg.feature_flags
4498 .record_consensus_determined_version_assignments_in_prologue_v2 = true;
4499 cfg.feature_flags.disallow_self_identifier = true;
4500 cfg.feature_flags.per_object_congestion_control_mode =
4501 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4502 ExecutionTimeEstimateParams {
4503 target_utilization: 50,
4504 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4506 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4508 stored_observations_limit: 20,
4509 stake_weighted_median_threshold: 0,
4510 default_none_duration_for_new_keys: false,
4511 observations_chunk_size: None,
4512 },
4513 );
4514 }
4515 86 => {
4516 cfg.feature_flags.type_tags_in_object_runtime = true;
4517 cfg.max_move_enum_variants = Some(move_core_types::VARIANT_COUNT_MAX);
4518
4519 cfg.feature_flags.per_object_congestion_control_mode =
4521 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4522 ExecutionTimeEstimateParams {
4523 target_utilization: 50,
4524 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4526 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4528 stored_observations_limit: 20,
4529 stake_weighted_median_threshold: 3334,
4530 default_none_duration_for_new_keys: false,
4531 observations_chunk_size: None,
4532 },
4533 );
4534 if chain != Chain::Mainnet {
4536 cfg.feature_flags.enable_party_transfer = true;
4537 }
4538 }
4539 87 => {
4540 if chain == Chain::Mainnet {
4541 cfg.feature_flags.record_time_estimate_processed = true;
4542 }
4543 cfg.feature_flags.better_adapter_type_resolution_errors = true;
4544 }
4545 88 => {
4546 cfg.feature_flags.record_time_estimate_processed = true;
4547 cfg.tx_context_rgp_cost_base = Some(30);
4548 cfg.feature_flags
4549 .ignore_execution_time_observations_after_certs_closed = true;
4550
4551 cfg.feature_flags.per_object_congestion_control_mode =
4554 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4555 ExecutionTimeEstimateParams {
4556 target_utilization: 50,
4557 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4559 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4561 stored_observations_limit: 20,
4562 stake_weighted_median_threshold: 3334,
4563 default_none_duration_for_new_keys: true,
4564 observations_chunk_size: None,
4565 },
4566 );
4567 }
4568 89 => {
4569 cfg.feature_flags.dependency_linkage_error = true;
4570 cfg.feature_flags.additional_multisig_checks = true;
4571 }
4572 90 => {
4573 cfg.max_gas_price_rgp_factor_for_aborted_transactions = Some(100);
4575 cfg.feature_flags.debug_fatal_on_move_invariant_violation = true;
4576 cfg.feature_flags.additional_consensus_digest_indirect_state = true;
4577 cfg.feature_flags.accept_passkey_in_multisig = true;
4578 cfg.feature_flags.passkey_auth = true;
4579 cfg.feature_flags.check_for_init_during_upgrade = true;
4580
4581 if chain != Chain::Mainnet {
4583 cfg.feature_flags.mysticeti_fastpath = true;
4584 }
4585 }
4586 91 => {
4587 cfg.feature_flags.per_command_shared_object_transfer_rules = true;
4588 }
4589 92 => {
4590 cfg.feature_flags.per_command_shared_object_transfer_rules = false;
4591 }
4592 93 => {
4593 cfg.feature_flags
4594 .consensus_checkpoint_signature_key_includes_digest = true;
4595 }
4596 94 => {
4597 cfg.feature_flags.per_object_congestion_control_mode =
4599 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4600 ExecutionTimeEstimateParams {
4601 target_utilization: 50,
4602 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4604 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4606 stored_observations_limit: 18,
4607 stake_weighted_median_threshold: 3334,
4608 default_none_duration_for_new_keys: true,
4609 observations_chunk_size: None,
4610 },
4611 );
4612
4613 cfg.feature_flags.enable_party_transfer = true;
4615 }
4616 95 => {
4617 cfg.type_name_id_base_cost = Some(52);
4618
4619 cfg.max_transactions_per_checkpoint = Some(20_000);
4621 }
4622 96 => {
4623 if chain != Chain::Mainnet && chain != Chain::Testnet {
4625 cfg.feature_flags
4626 .include_checkpoint_artifacts_digest_in_summary = true;
4627 }
4628 cfg.feature_flags.correct_gas_payment_limit_check = true;
4629 cfg.feature_flags.authority_capabilities_v2 = true;
4630 cfg.feature_flags.use_mfp_txns_in_load_initial_object_debts = true;
4631 cfg.feature_flags.cancel_for_failed_dkg_early = true;
4632 cfg.feature_flags.enable_coin_registry = true;
4633
4634 cfg.feature_flags.mysticeti_fastpath = true;
4636 }
4637 97 => {
4638 cfg.feature_flags.additional_borrow_checks = true;
4639 }
4640 98 => {
4641 cfg.event_emit_auth_stream_cost = Some(52);
4642 cfg.feature_flags.better_loader_errors = true;
4643 cfg.feature_flags.generate_df_type_layouts = true;
4644 }
4645 99 => {
4646 cfg.feature_flags.use_new_commit_handler = true;
4647 }
4648 100 => {
4649 cfg.feature_flags.private_generics_verifier_v2 = true;
4650 }
4651 101 => {
4652 cfg.feature_flags.create_root_accumulator_object = true;
4653 cfg.max_updates_per_settlement_txn = Some(100);
4654 if chain != Chain::Mainnet {
4655 cfg.feature_flags.enable_poseidon = true;
4656 }
4657 }
4658 102 => {
4659 cfg.feature_flags.per_object_congestion_control_mode =
4663 PerObjectCongestionControlMode::ExecutionTimeEstimate(
4664 ExecutionTimeEstimateParams {
4665 target_utilization: 50,
4666 allowed_txn_cost_overage_burst_limit_us: 500_000, randomness_scalar: 20,
4668 max_estimate_us: 1_500_000, stored_observations_num_included_checkpoints: 10,
4670 stored_observations_limit: 180,
4671 stake_weighted_median_threshold: 3334,
4672 default_none_duration_for_new_keys: true,
4673 observations_chunk_size: Some(18),
4674 },
4675 );
4676 cfg.feature_flags.deprecate_global_storage_ops = true;
4677 }
4678 103 => {}
4679 104 => {
4680 cfg.translation_per_command_base_charge = Some(1);
4681 cfg.translation_per_input_base_charge = Some(1);
4682 cfg.translation_pure_input_per_byte_charge = Some(1);
4683 cfg.translation_per_type_node_charge = Some(1);
4684 cfg.translation_per_reference_node_charge = Some(1);
4685 cfg.translation_per_linkage_entry_charge = Some(10);
4686 cfg.gas_model_version = Some(11);
4687 cfg.feature_flags.abstract_size_in_object_runtime = true;
4688 cfg.feature_flags.object_runtime_charge_cache_load_gas = true;
4689 cfg.dynamic_field_hash_type_and_key_cost_base = Some(52);
4690 cfg.dynamic_field_add_child_object_cost_base = Some(52);
4691 cfg.dynamic_field_add_child_object_value_cost_per_byte = Some(1);
4692 cfg.dynamic_field_borrow_child_object_cost_base = Some(52);
4693 cfg.dynamic_field_borrow_child_object_child_ref_cost_per_byte = Some(1);
4694 cfg.dynamic_field_remove_child_object_cost_base = Some(52);
4695 cfg.dynamic_field_remove_child_object_child_cost_per_byte = Some(1);
4696 cfg.dynamic_field_has_child_object_cost_base = Some(52);
4697 cfg.dynamic_field_has_child_object_with_ty_cost_base = Some(52);
4698 cfg.feature_flags.enable_ptb_execution_v2 = true;
4699
4700 cfg.poseidon_bn254_cost_base = Some(260);
4701
4702 cfg.feature_flags.consensus_skip_gced_accept_votes = true;
4703
4704 if chain != Chain::Mainnet {
4705 cfg.feature_flags
4706 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4707 }
4708
4709 cfg.feature_flags
4710 .include_cancelled_randomness_txns_in_prologue = true;
4711 }
4712 105 => {
4713 cfg.feature_flags.enable_multi_epoch_transaction_expiration = true;
4714 cfg.feature_flags.disable_preconsensus_locking = true;
4715
4716 if chain != Chain::Mainnet {
4717 cfg.feature_flags
4718 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4719 }
4720 }
4721 106 => {
4722 cfg.accumulator_object_storage_cost = Some(7600);
4724
4725 if chain != Chain::Mainnet && chain != Chain::Testnet {
4726 cfg.feature_flags.enable_accumulators = true;
4727 cfg.feature_flags.enable_address_balance_gas_payments = true;
4728 cfg.feature_flags.enable_authenticated_event_streams = true;
4729 cfg.feature_flags.enable_object_funds_withdraw = true;
4730 }
4731 }
4732 107 => {
4733 cfg.feature_flags
4734 .consensus_skip_gced_blocks_in_direct_finalization = true;
4735
4736 if in_integration_test() {
4738 cfg.consensus_gc_depth = Some(6);
4739 cfg.consensus_max_num_transactions_in_block = Some(8);
4740 }
4741 }
4742 108 => {
4743 cfg.feature_flags.gas_rounding_halve_digits = true;
4744 cfg.feature_flags.flexible_tx_context_positions = true;
4745 cfg.feature_flags.disable_entry_point_signature_check = true;
4746
4747 if chain != Chain::Mainnet {
4748 cfg.feature_flags.address_aliases = true;
4749
4750 cfg.feature_flags.enable_accumulators = true;
4751 cfg.feature_flags.enable_address_balance_gas_payments = true;
4752 }
4753
4754 cfg.feature_flags.enable_poseidon = true;
4755 }
4756 109 => {
4757 cfg.binary_variant_handles = Some(1024);
4758 cfg.binary_variant_instantiation_handles = Some(1024);
4759 cfg.feature_flags.restrict_hot_or_not_entry_functions = true;
4760 }
4761 110 => {
4762 cfg.feature_flags
4763 .enable_nitro_attestation_all_nonzero_pcrs_parsing = true;
4764 cfg.feature_flags
4765 .enable_nitro_attestation_always_include_required_pcrs_parsing = true;
4766 if chain != Chain::Mainnet && chain != Chain::Testnet {
4767 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4768 }
4769 cfg.feature_flags.validate_zklogin_public_identifier = true;
4770 cfg.feature_flags.fix_checkpoint_signature_mapping = true;
4771 cfg.feature_flags
4772 .consensus_always_accept_system_transactions = true;
4773 if chain != Chain::Mainnet {
4774 cfg.feature_flags.enable_object_funds_withdraw = true;
4775 }
4776 }
4777 111 => {
4778 cfg.feature_flags.validator_metadata_verify_v2 = true;
4779 }
4780 112 => {
4781 cfg.group_ops_ristretto_decode_scalar_cost = Some(7);
4782 cfg.group_ops_ristretto_decode_point_cost = Some(200);
4783 cfg.group_ops_ristretto_scalar_add_cost = Some(10);
4784 cfg.group_ops_ristretto_point_add_cost = Some(500);
4785 cfg.group_ops_ristretto_scalar_sub_cost = Some(10);
4786 cfg.group_ops_ristretto_point_sub_cost = Some(500);
4787 cfg.group_ops_ristretto_scalar_mul_cost = Some(11);
4788 cfg.group_ops_ristretto_point_mul_cost = Some(1200);
4789 cfg.group_ops_ristretto_scalar_div_cost = Some(151);
4790 cfg.group_ops_ristretto_point_div_cost = Some(2500);
4791
4792 if chain != Chain::Mainnet && chain != Chain::Testnet {
4793 cfg.feature_flags.enable_ristretto255_group_ops = true;
4794 }
4795 }
4796 113 => {
4797 cfg.feature_flags.address_balance_gas_check_rgp_at_signing = true;
4798 if chain != Chain::Mainnet && chain != Chain::Testnet {
4799 cfg.feature_flags.defer_unpaid_amplification = true;
4800 }
4801 }
4802 114 => {
4803 cfg.feature_flags.randomize_checkpoint_tx_limit_in_tests = true;
4804 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = true;
4805 if chain != Chain::Mainnet {
4806 cfg.feature_flags.split_checkpoints_in_consensus_handler = true;
4807 cfg.feature_flags.enable_authenticated_event_streams = true;
4808 cfg.feature_flags
4809 .include_checkpoint_artifacts_digest_in_summary = true;
4810 }
4811 }
4812 115 => {
4813 cfg.feature_flags.normalize_depth_formula = true;
4814 }
4815 116 => {
4816 cfg.feature_flags.gasless_transaction_drop_safety = true;
4817 cfg.feature_flags.address_aliases = true;
4818 cfg.feature_flags.relax_valid_during_for_owned_inputs = true;
4819 cfg.feature_flags.defer_unpaid_amplification = false;
4821 cfg.feature_flags.enable_display_registry = true;
4822 }
4823 117 => {}
4824 118 => {
4825 cfg.feature_flags.use_coin_party_owner = true;
4826 }
4827 119 => {
4828 cfg.execution_version = Some(4);
4830 cfg.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
4831 cfg.feature_flags.merge_randomness_into_checkpoint = true;
4832 if chain != Chain::Mainnet {
4833 cfg.feature_flags.enable_gasless = true;
4834 cfg.gasless_max_computation_units = Some(50_000);
4835 cfg.gasless_allowed_token_types = Some(vec![]);
4836 cfg.feature_flags.enable_coin_reservation_obj_refs = true;
4837 cfg.feature_flags
4838 .convert_withdrawal_compatibility_ptb_arguments = true;
4839 }
4840 cfg.gasless_max_unused_inputs = Some(1);
4841 cfg.gasless_max_pure_input_bytes = Some(32);
4842 if chain == Chain::Testnet {
4843 cfg.gasless_allowed_token_types = Some(vec![(TESTNET_USDC.to_string(), 0)]);
4844 }
4845 cfg.transfer_receive_object_cost_per_byte = Some(1);
4846 cfg.transfer_receive_object_type_cost_per_byte = Some(2);
4847 }
4848 120 => {
4849 cfg.feature_flags.disallow_jump_orphans = true;
4850 }
4851 121 => {
4852 if chain != Chain::Mainnet {
4854 cfg.feature_flags.defer_unpaid_amplification = true;
4855 cfg.gasless_max_tps = Some(50);
4856 }
4857 cfg.feature_flags
4858 .early_return_receive_object_mismatched_type = true;
4859 }
4860 122 => {
4861 cfg.feature_flags.defer_unpaid_amplification = true;
4863 cfg.verify_bulletproofs_ristretto255_base_cost = Some(30000);
4865 cfg.verify_bulletproofs_ristretto255_cost_per_bit_and_commitment = Some(6500);
4866 if chain != Chain::Mainnet && chain != Chain::Testnet {
4867 cfg.feature_flags.enable_verify_bulletproofs_ristretto255 = true;
4868 }
4869 cfg.feature_flags.gasless_verify_remaining_balance = true;
4870 cfg.include_special_package_amendments = match chain {
4871 Chain::Mainnet => Some(MAINNET_LINKAGE_AMENDMENTS.clone()),
4872 Chain::Testnet => Some(TESTNET_LINKAGE_AMENDMENTS.clone()),
4873 Chain::Unknown => None,
4874 };
4875 cfg.gasless_max_tx_size_bytes = Some(16 * 1024);
4876 cfg.gasless_max_tps = Some(300);
4877 cfg.gasless_max_computation_units = Some(5_000);
4878 }
4879 123 => {
4880 if chain != Chain::Mainnet && chain != Chain::Testnet {
4881 cfg.feature_flags.timestamp_based_epoch_close = true;
4882 }
4883 }
4884 _ => panic!("unsupported version {:?}", version),
4895 }
4896 }
4897
4898 cfg
4899 }
4900
4901 pub fn apply_seeded_test_overrides(&mut self, seed: &[u8; 32]) {
4902 if !self.feature_flags.randomize_checkpoint_tx_limit_in_tests
4903 || !self.feature_flags.split_checkpoints_in_consensus_handler
4904 {
4905 return;
4906 }
4907
4908 if !mysten_common::in_test_configuration() {
4909 return;
4910 }
4911
4912 use rand::{Rng, SeedableRng, rngs::StdRng};
4913 let mut rng = StdRng::from_seed(*seed);
4914 let max_txns = rng.gen_range(10..=100u64);
4915 info!("seeded test override: max_transactions_per_checkpoint = {max_txns}");
4916 self.max_transactions_per_checkpoint = Some(max_txns);
4917 }
4918
4919 pub fn verifier_config(&self, signing_limits: Option<(usize, usize, usize)>) -> VerifierConfig {
4925 let (
4926 max_back_edges_per_function,
4927 max_back_edges_per_module,
4928 sanity_check_with_regex_reference_safety,
4929 ) = if let Some((
4930 max_back_edges_per_function,
4931 max_back_edges_per_module,
4932 sanity_check_with_regex_reference_safety,
4933 )) = signing_limits
4934 {
4935 (
4936 Some(max_back_edges_per_function),
4937 Some(max_back_edges_per_module),
4938 Some(sanity_check_with_regex_reference_safety),
4939 )
4940 } else {
4941 (None, None, None)
4942 };
4943
4944 let additional_borrow_checks = if signing_limits.is_some() {
4945 true
4947 } else {
4948 self.additional_borrow_checks()
4949 };
4950 let deprecate_global_storage_ops = if signing_limits.is_some() {
4951 true
4953 } else {
4954 self.deprecate_global_storage_ops()
4955 };
4956
4957 VerifierConfig {
4958 max_loop_depth: Some(self.max_loop_depth() as usize),
4959 max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
4960 max_function_parameters: Some(self.max_function_parameters() as usize),
4961 max_basic_blocks: Some(self.max_basic_blocks() as usize),
4962 max_value_stack_size: self.max_value_stack_size() as usize,
4963 max_type_nodes: Some(self.max_type_nodes() as usize),
4964 max_push_size: Some(self.max_push_size() as usize),
4965 max_dependency_depth: Some(self.max_dependency_depth() as usize),
4966 max_fields_in_struct: Some(self.max_fields_in_struct() as usize),
4967 max_function_definitions: Some(self.max_function_definitions() as usize),
4968 max_data_definitions: Some(self.max_struct_definitions() as usize),
4969 max_constant_vector_len: Some(self.max_move_vector_len()),
4970 max_back_edges_per_function,
4971 max_back_edges_per_module,
4972 max_basic_blocks_in_script: None,
4973 max_identifier_len: self.max_move_identifier_len_as_option(), disallow_self_identifier: self.feature_flags.disallow_self_identifier,
4975 allow_receiving_object_id: self.allow_receiving_object_id(),
4976 reject_mutable_random_on_entry_functions: self
4977 .reject_mutable_random_on_entry_functions(),
4978 bytecode_version: self.move_binary_format_version(),
4979 max_variants_in_enum: self.max_move_enum_variants_as_option(),
4980 additional_borrow_checks,
4981 better_loader_errors: self.better_loader_errors(),
4982 private_generics_verifier_v2: self.private_generics_verifier_v2(),
4983 sanity_check_with_regex_reference_safety: sanity_check_with_regex_reference_safety
4984 .map(|limit| limit as u128),
4985 deprecate_global_storage_ops,
4986 disable_entry_point_signature_check: self.disable_entry_point_signature_check(),
4987 switch_to_regex_reference_safety: false,
4988 disallow_jump_orphans: self.disallow_jump_orphans(),
4989 }
4990 }
4991
4992 pub fn binary_config(
4993 &self,
4994 override_deprecate_global_storage_ops_during_deserialization: Option<bool>,
4995 ) -> BinaryConfig {
4996 let deprecate_global_storage_ops =
4997 override_deprecate_global_storage_ops_during_deserialization
4998 .unwrap_or_else(|| self.deprecate_global_storage_ops());
4999 BinaryConfig::new(
5000 self.move_binary_format_version(),
5001 self.min_move_binary_format_version_as_option()
5002 .unwrap_or(VERSION_1),
5003 self.no_extraneous_module_bytes(),
5004 deprecate_global_storage_ops,
5005 TableConfig {
5006 module_handles: self.binary_module_handles_as_option().unwrap_or(u16::MAX),
5007 datatype_handles: self.binary_struct_handles_as_option().unwrap_or(u16::MAX),
5008 function_handles: self.binary_function_handles_as_option().unwrap_or(u16::MAX),
5009 function_instantiations: self
5010 .binary_function_instantiations_as_option()
5011 .unwrap_or(u16::MAX),
5012 signatures: self.binary_signatures_as_option().unwrap_or(u16::MAX),
5013 constant_pool: self.binary_constant_pool_as_option().unwrap_or(u16::MAX),
5014 identifiers: self.binary_identifiers_as_option().unwrap_or(u16::MAX),
5015 address_identifiers: self
5016 .binary_address_identifiers_as_option()
5017 .unwrap_or(u16::MAX),
5018 struct_defs: self.binary_struct_defs_as_option().unwrap_or(u16::MAX),
5019 struct_def_instantiations: self
5020 .binary_struct_def_instantiations_as_option()
5021 .unwrap_or(u16::MAX),
5022 function_defs: self.binary_function_defs_as_option().unwrap_or(u16::MAX),
5023 field_handles: self.binary_field_handles_as_option().unwrap_or(u16::MAX),
5024 field_instantiations: self
5025 .binary_field_instantiations_as_option()
5026 .unwrap_or(u16::MAX),
5027 friend_decls: self.binary_friend_decls_as_option().unwrap_or(u16::MAX),
5028 enum_defs: self.binary_enum_defs_as_option().unwrap_or(u16::MAX),
5029 enum_def_instantiations: self
5030 .binary_enum_def_instantiations_as_option()
5031 .unwrap_or(u16::MAX),
5032 variant_handles: self.binary_variant_handles_as_option().unwrap_or(u16::MAX),
5033 variant_instantiation_handles: self
5034 .binary_variant_instantiation_handles_as_option()
5035 .unwrap_or(u16::MAX),
5036 },
5037 )
5038 }
5039
5040 #[cfg(not(msim))]
5044 pub fn apply_overrides_for_testing(
5045 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + Sync + 'static,
5046 ) -> OverrideGuard {
5047 let mut cur = CONFIG_OVERRIDE.lock().unwrap();
5048 assert!(cur.is_none(), "config override already present");
5049 *cur = Some(Box::new(override_fn));
5050 OverrideGuard
5051 }
5052
5053 #[cfg(msim)]
5057 pub fn apply_overrides_for_testing(
5058 override_fn: impl Fn(ProtocolVersion, Self) -> Self + Send + 'static,
5059 ) -> OverrideGuard {
5060 CONFIG_OVERRIDE.with(|ovr| {
5061 let mut cur = ovr.borrow_mut();
5062 assert!(cur.is_none(), "config override already present");
5063 *cur = Some(Box::new(override_fn));
5064 OverrideGuard
5065 })
5066 }
5067
5068 #[cfg(not(msim))]
5069 fn apply_config_override(version: ProtocolVersion, mut ret: Self) -> Self {
5070 if let Some(override_fn) = CONFIG_OVERRIDE.lock().unwrap().as_ref() {
5071 warn!(
5072 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5073 );
5074 ret = override_fn(version, ret);
5075 }
5076 ret
5077 }
5078
5079 #[cfg(msim)]
5080 fn apply_config_override(version: ProtocolVersion, ret: Self) -> Self {
5081 CONFIG_OVERRIDE.with(|ovr| {
5082 if let Some(override_fn) = &*ovr.borrow() {
5083 warn!(
5084 "overriding ProtocolConfig settings with custom settings (you should not see this log outside of tests)"
5085 );
5086 override_fn(version, ret)
5087 } else {
5088 ret
5089 }
5090 })
5091 }
5092}
5093
5094impl ProtocolConfig {
5098 pub fn set_advance_to_highest_supported_protocol_version_for_testing(&mut self, val: bool) {
5099 self.feature_flags
5100 .advance_to_highest_supported_protocol_version = val
5101 }
5102 pub fn set_commit_root_state_digest_supported_for_testing(&mut self, val: bool) {
5103 self.feature_flags.commit_root_state_digest = val
5104 }
5105 pub fn set_zklogin_auth_for_testing(&mut self, val: bool) {
5106 self.feature_flags.zklogin_auth = val
5107 }
5108 pub fn set_enable_jwk_consensus_updates_for_testing(&mut self, val: bool) {
5109 self.feature_flags.enable_jwk_consensus_updates = val
5110 }
5111 pub fn set_random_beacon_for_testing(&mut self, val: bool) {
5112 self.feature_flags.random_beacon = val
5113 }
5114
5115 pub fn set_upgraded_multisig_for_testing(&mut self, val: bool) {
5116 self.feature_flags.upgraded_multisig_supported = val
5117 }
5118 pub fn set_accept_zklogin_in_multisig_for_testing(&mut self, val: bool) {
5119 self.feature_flags.accept_zklogin_in_multisig = val
5120 }
5121
5122 pub fn set_shared_object_deletion_for_testing(&mut self, val: bool) {
5123 self.feature_flags.shared_object_deletion = val;
5124 }
5125
5126 pub fn set_narwhal_new_leader_election_schedule_for_testing(&mut self, val: bool) {
5127 self.feature_flags.narwhal_new_leader_election_schedule = val;
5128 }
5129
5130 pub fn set_receive_object_for_testing(&mut self, val: bool) {
5131 self.feature_flags.receive_objects = val
5132 }
5133 pub fn set_narwhal_certificate_v2_for_testing(&mut self, val: bool) {
5134 self.feature_flags.narwhal_certificate_v2 = val
5135 }
5136 pub fn set_verify_legacy_zklogin_address_for_testing(&mut self, val: bool) {
5137 self.feature_flags.verify_legacy_zklogin_address = val
5138 }
5139
5140 pub fn set_per_object_congestion_control_mode_for_testing(
5141 &mut self,
5142 val: PerObjectCongestionControlMode,
5143 ) {
5144 self.feature_flags.per_object_congestion_control_mode = val;
5145 }
5146
5147 pub fn set_consensus_choice_for_testing(&mut self, val: ConsensusChoice) {
5148 self.feature_flags.consensus_choice = val;
5149 }
5150
5151 pub fn set_consensus_network_for_testing(&mut self, val: ConsensusNetwork) {
5152 self.feature_flags.consensus_network = val;
5153 }
5154
5155 pub fn set_zklogin_max_epoch_upper_bound_delta_for_testing(&mut self, val: Option<u64>) {
5156 self.feature_flags.zklogin_max_epoch_upper_bound_delta = val
5157 }
5158
5159 pub fn set_disable_bridge_for_testing(&mut self) {
5160 self.feature_flags.bridge = false
5161 }
5162
5163 pub fn set_mysticeti_num_leaders_per_round_for_testing(&mut self, val: Option<usize>) {
5164 self.feature_flags.mysticeti_num_leaders_per_round = val;
5165 }
5166
5167 pub fn set_enable_soft_bundle_for_testing(&mut self, val: bool) {
5168 self.feature_flags.soft_bundle = val;
5169 }
5170
5171 pub fn set_passkey_auth_for_testing(&mut self, val: bool) {
5172 self.feature_flags.passkey_auth = val
5173 }
5174
5175 pub fn set_enable_party_transfer_for_testing(&mut self, val: bool) {
5176 self.feature_flags.enable_party_transfer = val
5177 }
5178
5179 pub fn set_consensus_distributed_vote_scoring_strategy_for_testing(&mut self, val: bool) {
5180 self.feature_flags
5181 .consensus_distributed_vote_scoring_strategy = val;
5182 }
5183
5184 pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) {
5185 self.feature_flags.consensus_round_prober = val;
5186 }
5187
5188 pub fn set_disallow_new_modules_in_deps_only_packages_for_testing(&mut self, val: bool) {
5189 self.feature_flags
5190 .disallow_new_modules_in_deps_only_packages = val;
5191 }
5192
5193 pub fn set_correct_gas_payment_limit_check_for_testing(&mut self, val: bool) {
5194 self.feature_flags.correct_gas_payment_limit_check = val;
5195 }
5196
5197 pub fn set_address_aliases_for_testing(&mut self, val: bool) {
5198 self.feature_flags.address_aliases = val;
5199 }
5200
5201 pub fn set_consensus_round_prober_probe_accepted_rounds(&mut self, val: bool) {
5202 self.feature_flags
5203 .consensus_round_prober_probe_accepted_rounds = val;
5204 }
5205
5206 pub fn set_mysticeti_fastpath_for_testing(&mut self, val: bool) {
5207 self.feature_flags.mysticeti_fastpath = val;
5208 }
5209
5210 pub fn set_accept_passkey_in_multisig_for_testing(&mut self, val: bool) {
5211 self.feature_flags.accept_passkey_in_multisig = val;
5212 }
5213
5214 pub fn set_consensus_batched_block_sync_for_testing(&mut self, val: bool) {
5215 self.feature_flags.consensus_batched_block_sync = val;
5216 }
5217
5218 pub fn set_record_time_estimate_processed_for_testing(&mut self, val: bool) {
5219 self.feature_flags.record_time_estimate_processed = val;
5220 }
5221
5222 pub fn set_prepend_prologue_tx_in_consensus_commit_in_checkpoints_for_testing(
5223 &mut self,
5224 val: bool,
5225 ) {
5226 self.feature_flags
5227 .prepend_prologue_tx_in_consensus_commit_in_checkpoints = val;
5228 }
5229
5230 pub fn enable_accumulators_for_testing(&mut self) {
5231 self.feature_flags.enable_accumulators = true;
5232 }
5233
5234 pub fn disable_accumulators_for_testing(&mut self) {
5235 self.feature_flags.enable_accumulators = false;
5236 self.feature_flags.enable_address_balance_gas_payments = false;
5237 }
5238
5239 pub fn enable_coin_reservation_for_testing(&mut self) {
5240 self.feature_flags.enable_coin_reservation_obj_refs = true;
5241 self.feature_flags
5242 .convert_withdrawal_compatibility_ptb_arguments = true;
5243 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)));
5246 }
5247
5248 pub fn disable_coin_reservation_for_testing(&mut self) {
5249 self.feature_flags.enable_coin_reservation_obj_refs = false;
5250 self.feature_flags
5251 .convert_withdrawal_compatibility_ptb_arguments = false;
5252 }
5253
5254 pub fn create_root_accumulator_object_for_testing(&mut self) {
5255 self.feature_flags.create_root_accumulator_object = true;
5256 }
5257
5258 pub fn disable_create_root_accumulator_object_for_testing(&mut self) {
5259 self.feature_flags.create_root_accumulator_object = false;
5260 }
5261
5262 pub fn enable_address_balance_gas_payments_for_testing(&mut self) {
5263 self.feature_flags.enable_accumulators = true;
5264 self.feature_flags.allow_private_accumulator_entrypoints = true;
5265 self.feature_flags.enable_address_balance_gas_payments = true;
5266 self.feature_flags.address_balance_gas_check_rgp_at_signing = true;
5267 self.feature_flags.address_balance_gas_reject_gas_coin_arg = false;
5268 self.execution_version = Some(self.execution_version.map_or(4, |v| v.max(4)))
5269 }
5270
5271 pub fn disable_address_balance_gas_payments_for_testing(&mut self) {
5272 self.feature_flags.enable_address_balance_gas_payments = false;
5273 }
5274
5275 pub fn enable_gasless_for_testing(&mut self) {
5276 self.enable_address_balance_gas_payments_for_testing();
5277 self.feature_flags.enable_gasless = true;
5278 self.feature_flags.gasless_verify_remaining_balance = true;
5279 self.gasless_max_computation_units = Some(5_000);
5280 self.gasless_allowed_token_types = Some(vec![]);
5281 self.gasless_max_tps = Some(1000);
5282 self.gasless_max_tx_size_bytes = Some(16 * 1024);
5283 }
5284
5285 pub fn disable_gasless_for_testing(&mut self) {
5286 self.feature_flags.enable_gasless = false;
5287 self.gasless_max_computation_units = None;
5288 self.gasless_allowed_token_types = None;
5289 }
5290
5291 pub fn set_gasless_allowed_token_types_for_testing(&mut self, types: Vec<(String, u64)>) {
5292 self.gasless_allowed_token_types = Some(types);
5293 }
5294
5295 pub fn enable_multi_epoch_transaction_expiration_for_testing(&mut self) {
5296 self.feature_flags.enable_multi_epoch_transaction_expiration = true;
5297 }
5298
5299 pub fn enable_authenticated_event_streams_for_testing(&mut self) {
5300 self.enable_accumulators_for_testing();
5301 self.feature_flags.enable_authenticated_event_streams = true;
5302 self.feature_flags
5303 .include_checkpoint_artifacts_digest_in_summary = true;
5304 self.feature_flags.split_checkpoints_in_consensus_handler = true;
5305 }
5306
5307 pub fn disable_authenticated_event_streams_for_testing(&mut self) {
5308 self.feature_flags.enable_authenticated_event_streams = false;
5309 }
5310
5311 pub fn disable_randomize_checkpoint_tx_limit_for_testing(&mut self) {
5312 self.feature_flags.randomize_checkpoint_tx_limit_in_tests = false;
5313 }
5314
5315 pub fn enable_non_exclusive_writes_for_testing(&mut self) {
5316 self.feature_flags.enable_non_exclusive_writes = true;
5317 }
5318
5319 pub fn set_relax_valid_during_for_owned_inputs_for_testing(&mut self, val: bool) {
5320 self.feature_flags.relax_valid_during_for_owned_inputs = val;
5321 }
5322
5323 pub fn set_ignore_execution_time_observations_after_certs_closed_for_testing(
5324 &mut self,
5325 val: bool,
5326 ) {
5327 self.feature_flags
5328 .ignore_execution_time_observations_after_certs_closed = val;
5329 }
5330
5331 pub fn set_consensus_checkpoint_signature_key_includes_digest_for_testing(
5332 &mut self,
5333 val: bool,
5334 ) {
5335 self.feature_flags
5336 .consensus_checkpoint_signature_key_includes_digest = val;
5337 }
5338
5339 pub fn set_cancel_for_failed_dkg_early_for_testing(&mut self, val: bool) {
5340 self.feature_flags.cancel_for_failed_dkg_early = val;
5341 }
5342
5343 pub fn set_use_mfp_txns_in_load_initial_object_debts_for_testing(&mut self, val: bool) {
5344 self.feature_flags.use_mfp_txns_in_load_initial_object_debts = val;
5345 }
5346
5347 pub fn set_authority_capabilities_v2_for_testing(&mut self, val: bool) {
5348 self.feature_flags.authority_capabilities_v2 = val;
5349 }
5350
5351 pub fn allow_references_in_ptbs_for_testing(&mut self) {
5352 self.feature_flags.allow_references_in_ptbs = true;
5353 }
5354
5355 pub fn set_consensus_skip_gced_accept_votes_for_testing(&mut self, val: bool) {
5356 self.feature_flags.consensus_skip_gced_accept_votes = val;
5357 }
5358
5359 pub fn set_enable_object_funds_withdraw_for_testing(&mut self, val: bool) {
5360 self.feature_flags.enable_object_funds_withdraw = val;
5361 }
5362
5363 pub fn set_split_checkpoints_in_consensus_handler_for_testing(&mut self, val: bool) {
5364 self.feature_flags.split_checkpoints_in_consensus_handler = val;
5365 }
5366
5367 pub fn set_merge_randomness_into_checkpoint_for_testing(&mut self, val: bool) {
5368 self.feature_flags.merge_randomness_into_checkpoint = val;
5369 }
5370}
5371
5372#[cfg(not(msim))]
5373type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send + Sync;
5374
5375#[cfg(not(msim))]
5376static CONFIG_OVERRIDE: Mutex<Option<Box<OverrideFn>>> = Mutex::new(None);
5377
5378#[cfg(msim)]
5379type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send;
5380
5381#[cfg(msim)]
5382thread_local! {
5383 static CONFIG_OVERRIDE: RefCell<Option<Box<OverrideFn>>> = RefCell::new(None);
5384}
5385
5386#[must_use]
5387pub struct OverrideGuard;
5388
5389#[cfg(not(msim))]
5390impl Drop for OverrideGuard {
5391 fn drop(&mut self) {
5392 info!("restoring override fn");
5393 *CONFIG_OVERRIDE.lock().unwrap() = None;
5394 }
5395}
5396
5397#[cfg(msim)]
5398impl Drop for OverrideGuard {
5399 fn drop(&mut self) {
5400 info!("restoring override fn");
5401 CONFIG_OVERRIDE.with(|ovr| {
5402 *ovr.borrow_mut() = None;
5403 });
5404 }
5405}
5406
5407#[derive(PartialEq, Eq)]
5410pub enum LimitThresholdCrossed {
5411 None,
5412 Soft(u128, u128),
5413 Hard(u128, u128),
5414}
5415
5416pub fn check_limit_in_range<T: Into<V>, U: Into<V>, V: PartialOrd + Into<u128>>(
5419 x: T,
5420 soft_limit: U,
5421 hard_limit: V,
5422) -> LimitThresholdCrossed {
5423 let x: V = x.into();
5424 let soft_limit: V = soft_limit.into();
5425
5426 debug_assert!(soft_limit <= hard_limit);
5427
5428 if x >= hard_limit {
5431 LimitThresholdCrossed::Hard(x.into(), hard_limit.into())
5432 } else if x < soft_limit {
5433 LimitThresholdCrossed::None
5434 } else {
5435 LimitThresholdCrossed::Soft(x.into(), soft_limit.into())
5436 }
5437}
5438
5439#[macro_export]
5440macro_rules! check_limit {
5441 ($x:expr, $hard:expr) => {
5442 check_limit!($x, $hard, $hard)
5443 };
5444 ($x:expr, $soft:expr, $hard:expr) => {
5445 check_limit_in_range($x as u64, $soft, $hard)
5446 };
5447}
5448
5449#[macro_export]
5453macro_rules! check_limit_by_meter {
5454 ($is_metered:expr, $x:expr, $metered_limit:expr, $unmetered_hard_limit:expr, $metric:expr) => {{
5455 let (h, metered_str) = if $is_metered {
5457 ($metered_limit, "metered")
5458 } else {
5459 ($unmetered_hard_limit, "unmetered")
5461 };
5462 use sui_protocol_config::check_limit_in_range;
5463 let result = check_limit_in_range($x as u64, $metered_limit, h);
5464 match result {
5465 LimitThresholdCrossed::None => {}
5466 LimitThresholdCrossed::Soft(_, _) => {
5467 $metric.with_label_values(&[metered_str, "soft"]).inc();
5468 }
5469 LimitThresholdCrossed::Hard(_, _) => {
5470 $metric.with_label_values(&[metered_str, "hard"]).inc();
5471 }
5472 };
5473 result
5474 }};
5475}
5476
5477pub type Amendments = BTreeMap<AccountAddress, BTreeMap<AccountAddress, AccountAddress>>;
5480
5481static MAINNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5482 LazyLock::new(|| parse_amendments(include_str!("mainnet_amendments.json")));
5483
5484static TESTNET_LINKAGE_AMENDMENTS: LazyLock<Arc<Amendments>> =
5485 LazyLock::new(|| parse_amendments(include_str!("testnet_amendments.json")));
5486
5487fn parse_amendments(json: &str) -> Arc<Amendments> {
5488 #[derive(serde::Deserialize)]
5489 struct AmendmentEntry {
5490 root: String,
5491 deps: Vec<DepEntry>,
5492 }
5493
5494 #[derive(serde::Deserialize)]
5495 struct DepEntry {
5496 original_id: String,
5497 version_id: String,
5498 }
5499
5500 let entries: Vec<AmendmentEntry> =
5501 serde_json::from_str(json).expect("Failed to parse amendments JSON");
5502 let mut amendments = BTreeMap::new();
5503 for entry in entries {
5504 let root_id = AccountAddress::from_hex_literal(&entry.root).unwrap();
5505 let mut dep_ids = BTreeMap::new();
5506 for dep in entry.deps {
5507 let orig_id = AccountAddress::from_hex_literal(&dep.original_id).unwrap();
5508 let upgraded_id = AccountAddress::from_hex_literal(&dep.version_id).unwrap();
5509 assert!(
5510 dep_ids.insert(orig_id, upgraded_id).is_none(),
5511 "Duplicate original ID in amendments table"
5512 );
5513 }
5514 assert!(
5515 amendments.insert(root_id, dep_ids).is_none(),
5516 "Duplicate root ID in amendments table"
5517 );
5518 }
5519 Arc::new(amendments)
5520}
5521
5522#[cfg(all(test, not(msim)))]
5523mod test {
5524 use insta::assert_yaml_snapshot;
5525
5526 use super::*;
5527
5528 #[test]
5529 fn snapshot_tests() {
5530 println!("\n============================================================================");
5531 println!("! !");
5532 println!("! IMPORTANT: never update snapshots from this test. only add new versions! !");
5533 println!("! !");
5534 println!("============================================================================\n");
5535 for chain_id in &[Chain::Unknown, Chain::Mainnet, Chain::Testnet] {
5536 let chain_str = match chain_id {
5540 Chain::Unknown => "".to_string(),
5541 _ => format!("{:?}_", chain_id),
5542 };
5543 for i in MIN_PROTOCOL_VERSION..=MAX_PROTOCOL_VERSION {
5544 let cur = ProtocolVersion::new(i);
5545 assert_yaml_snapshot!(
5546 format!("{}version_{}", chain_str, cur.as_u64()),
5547 ProtocolConfig::get_for_version(cur, *chain_id)
5548 );
5549 }
5550 }
5551 }
5552
5553 #[test]
5554 fn test_getters() {
5555 let prot: ProtocolConfig =
5556 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5557 assert_eq!(
5558 prot.max_arguments(),
5559 prot.max_arguments_as_option().unwrap()
5560 );
5561 }
5562
5563 #[test]
5564 fn test_setters() {
5565 let mut prot: ProtocolConfig =
5566 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5567 prot.set_max_arguments_for_testing(123);
5568 assert_eq!(prot.max_arguments(), 123);
5569
5570 prot.set_max_arguments_from_str_for_testing("321".to_string());
5571 assert_eq!(prot.max_arguments(), 321);
5572
5573 prot.disable_max_arguments_for_testing();
5574 assert_eq!(prot.max_arguments_as_option(), None);
5575
5576 prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string());
5577 assert_eq!(prot.max_arguments(), 456);
5578 }
5579
5580 #[test]
5581 fn test_get_for_version_if_supported_applies_test_overrides() {
5582 let before =
5583 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5584 .unwrap();
5585
5586 assert!(!before.enable_coin_reservation_obj_refs());
5587
5588 let _guard = ProtocolConfig::apply_overrides_for_testing(|_, mut cfg| {
5589 cfg.enable_coin_reservation_for_testing();
5590 cfg
5591 });
5592
5593 let after =
5594 ProtocolConfig::get_for_version_if_supported(ProtocolVersion::new(1), Chain::Unknown)
5595 .unwrap();
5596
5597 assert!(after.enable_coin_reservation_obj_refs());
5598 }
5599
5600 #[test]
5601 #[should_panic(expected = "unsupported version")]
5602 fn max_version_test() {
5603 let _ = ProtocolConfig::get_for_version_impl(
5606 ProtocolVersion::new(MAX_PROTOCOL_VERSION + 1),
5607 Chain::Unknown,
5608 );
5609 }
5610
5611 #[test]
5612 fn lookup_by_string_test() {
5613 let prot: ProtocolConfig =
5614 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5615 assert!(prot.lookup_attr("some random string".to_string()).is_none());
5617
5618 assert!(
5619 prot.lookup_attr("max_arguments".to_string())
5620 == Some(ProtocolConfigValue::u32(prot.max_arguments())),
5621 );
5622
5623 assert!(
5625 prot.lookup_attr("max_move_identifier_len".to_string())
5626 .is_none()
5627 );
5628
5629 let prot: ProtocolConfig =
5631 ProtocolConfig::get_for_version(ProtocolVersion::new(9), Chain::Unknown);
5632 assert!(
5633 prot.lookup_attr("max_move_identifier_len".to_string())
5634 == Some(ProtocolConfigValue::u64(prot.max_move_identifier_len()))
5635 );
5636
5637 let prot: ProtocolConfig =
5638 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5639 assert!(
5641 prot.attr_map()
5642 .get("max_move_identifier_len")
5643 .unwrap()
5644 .is_none()
5645 );
5646 assert!(
5648 prot.attr_map().get("max_arguments").unwrap()
5649 == &Some(ProtocolConfigValue::u32(prot.max_arguments()))
5650 );
5651
5652 let prot: ProtocolConfig =
5654 ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown);
5655 assert!(
5657 prot.feature_flags
5658 .lookup_attr("some random string".to_owned())
5659 .is_none()
5660 );
5661 assert!(
5662 !prot
5663 .feature_flags
5664 .attr_map()
5665 .contains_key("some random string")
5666 );
5667
5668 assert!(
5670 prot.feature_flags
5671 .lookup_attr("package_upgrades".to_owned())
5672 == Some(false)
5673 );
5674 assert!(
5675 prot.feature_flags
5676 .attr_map()
5677 .get("package_upgrades")
5678 .unwrap()
5679 == &false
5680 );
5681 let prot: ProtocolConfig =
5682 ProtocolConfig::get_for_version(ProtocolVersion::new(4), Chain::Unknown);
5683 assert!(
5685 prot.feature_flags
5686 .lookup_attr("package_upgrades".to_owned())
5687 == Some(true)
5688 );
5689 assert!(
5690 prot.feature_flags
5691 .attr_map()
5692 .get("package_upgrades")
5693 .unwrap()
5694 == &true
5695 );
5696 }
5697
5698 #[test]
5699 fn limit_range_fn_test() {
5700 let low = 100u32;
5701 let high = 10000u64;
5702
5703 assert!(check_limit!(1u8, low, high) == LimitThresholdCrossed::None);
5704 assert!(matches!(
5705 check_limit!(255u16, low, high),
5706 LimitThresholdCrossed::Soft(255u128, 100)
5707 ));
5708 assert!(matches!(
5714 check_limit!(2550000u64, low, high),
5715 LimitThresholdCrossed::Hard(2550000, 10000)
5716 ));
5717
5718 assert!(matches!(
5719 check_limit!(2550000u64, high, high),
5720 LimitThresholdCrossed::Hard(2550000, 10000)
5721 ));
5722
5723 assert!(matches!(
5724 check_limit!(1u8, high),
5725 LimitThresholdCrossed::None
5726 ));
5727
5728 assert!(check_limit!(255u16, high) == LimitThresholdCrossed::None);
5729
5730 assert!(matches!(
5731 check_limit!(2550000u64, high),
5732 LimitThresholdCrossed::Hard(2550000, 10000)
5733 ));
5734 }
5735
5736 #[test]
5737 fn linkage_amendments_load() {
5738 let mainnet = LazyLock::force(&MAINNET_LINKAGE_AMENDMENTS);
5739 let testnet = LazyLock::force(&TESTNET_LINKAGE_AMENDMENTS);
5740 assert!(!mainnet.is_empty(), "mainnet amendments must not be empty");
5741 assert!(!testnet.is_empty(), "testnet amendments must not be empty");
5742 }
5743}