From 6b93657ab910c558729ea9f5febd8d6441a4e1b4 Mon Sep 17 00:00:00 2001 From: muXxer Date: Fri, 25 Oct 2024 14:46:56 +0200 Subject: [PATCH] feat(node): skip serialization for MoveVM protocol config flags (#3664) --- crates/iota-protocol-config/src/lib.rs | 33 ++++++++++++------- ...tocol_config__test__Mainnet_version_1.snap | 4 --- ...tocol_config__test__Testnet_version_1.snap | 4 --- ...iota_protocol_config__test__version_1.snap | 4 --- .../generated/2024.10/tsconfig.tada.json | 4 +-- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/crates/iota-protocol-config/src/lib.rs b/crates/iota-protocol-config/src/lib.rs index 00e2813baa2..102acdb7665 100644 --- a/crates/iota-protocol-config/src/lib.rs +++ b/crates/iota-protocol-config/src/lib.rs @@ -109,11 +109,14 @@ pub struct Error(pub String); struct FeatureFlags { // Add feature flags here, e.g.: // new_protocol_feature: bool, + // Disables unnecessary invariant check in the Move VM when swapping the value out of a local - #[serde(skip_serializing_if = "is_false")] + // This flag is used to provide the correct MoveVM configuration for clients. + #[serde(skip_serializing_if = "is_true")] disable_invariant_violation_check_in_swap_loc: bool, // If true, checks no extra bytes in a compiled module - #[serde(skip_serializing_if = "is_false")] + // This flag is used to provide the correct MoveVM configuration for clients. + #[serde(skip_serializing_if = "is_true")] no_extraneous_module_bytes: bool, // Enable zklogin auth @@ -135,7 +138,8 @@ struct FeatureFlags { accept_zklogin_in_multisig: bool, // If true, use the hardened OTW check - #[serde(skip_serializing_if = "is_false")] + // This flag is used to provide the correct MoveVM configuration for clients. + #[serde(skip_serializing_if = "is_true")] hardened_otw_check: bool, // Enable the poseidon hash function @@ -187,10 +191,15 @@ struct FeatureFlags { authority_capabilities_v2: bool, // Rethrow type layout errors during serialization instead of trying to convert them. - #[serde(skip_serializing_if = "is_false")] + // This flag is used to provide the correct MoveVM configuration for clients. + #[serde(skip_serializing_if = "is_true")] rethrow_serialization_type_layout_errors: bool, } +fn is_true(b: &bool) -> bool { + *b +} + fn is_false(b: &bool) -> bool { !b } @@ -1612,16 +1621,20 @@ impl ProtocolConfig { // new_constant: None, }; - cfg.feature_flags - .disable_invariant_violation_check_in_swap_loc = true; - cfg.feature_flags.no_extraneous_module_bytes = true; cfg.feature_flags.consensus_transaction_ordering = ConsensusTransactionOrdering::ByGasPrice; - cfg.feature_flags.hardened_otw_check = true; - // Enable group ops and all networks (but not msm) cfg.feature_flags.enable_group_ops_native_functions = true; + // MoveVM related flags + { + cfg.feature_flags + .disable_invariant_violation_check_in_swap_loc = true; + cfg.feature_flags.no_extraneous_module_bytes = true; + cfg.feature_flags.hardened_otw_check = true; + cfg.feature_flags.rethrow_serialization_type_layout_errors = true; + } + // zkLogin related flags { cfg.feature_flags.zklogin_auth = false; @@ -1645,8 +1658,6 @@ impl ProtocolConfig { // Do not allow bridge committee to finalize on mainnet. cfg.bridge_should_try_to_finalize_committee = Some(chain != Chain::Mainnet); - cfg.feature_flags.rethrow_serialization_type_layout_errors = true; - cfg.feature_flags.bridge = false; // Devnet diff --git a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Mainnet_version_1.snap b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Mainnet_version_1.snap index fd070c3f40b..d3a28ed0f71 100644 --- a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Mainnet_version_1.snap +++ b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Mainnet_version_1.snap @@ -4,16 +4,12 @@ expression: "ProtocolConfig::get_for_version(cur, *chain_id)" --- version: 1 feature_flags: - disable_invariant_violation_check_in_swap_loc: true - no_extraneous_module_bytes: true consensus_transaction_ordering: ByGasPrice - hardened_otw_check: true enable_group_ops_native_functions: true per_object_congestion_control_mode: TotalTxCount zklogin_max_epoch_upper_bound_delta: 30 mysticeti_leader_scoring_and_schedule: true mysticeti_num_leaders_per_round: 1 - rethrow_serialization_type_layout_errors: true max_tx_size_bytes: 131072 max_input_objects: 2048 max_size_written_objects: 5000000 diff --git a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Testnet_version_1.snap b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Testnet_version_1.snap index 2475526de01..c5b1553d010 100644 --- a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Testnet_version_1.snap +++ b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__Testnet_version_1.snap @@ -4,16 +4,12 @@ expression: "ProtocolConfig::get_for_version(cur, *chain_id)" --- version: 1 feature_flags: - disable_invariant_violation_check_in_swap_loc: true - no_extraneous_module_bytes: true consensus_transaction_ordering: ByGasPrice - hardened_otw_check: true enable_group_ops_native_functions: true per_object_congestion_control_mode: TotalTxCount zklogin_max_epoch_upper_bound_delta: 30 mysticeti_leader_scoring_and_schedule: true mysticeti_num_leaders_per_round: 1 - rethrow_serialization_type_layout_errors: true max_tx_size_bytes: 131072 max_input_objects: 2048 max_size_written_objects: 5000000 diff --git a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__version_1.snap b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__version_1.snap index d549bed5dc2..0e7e0f78d3c 100644 --- a/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__version_1.snap +++ b/crates/iota-protocol-config/src/snapshots/iota_protocol_config__test__version_1.snap @@ -4,10 +4,7 @@ expression: "ProtocolConfig::get_for_version(cur, *chain_id)" --- version: 1 feature_flags: - disable_invariant_violation_check_in_swap_loc: true - no_extraneous_module_bytes: true consensus_transaction_ordering: ByGasPrice - hardened_otw_check: true enable_poseidon: true enable_group_ops_native_functions: true enable_group_ops_native_function_msm: true @@ -18,7 +15,6 @@ feature_flags: mysticeti_num_leaders_per_round: 1 passkey_auth: true authority_capabilities_v2: true - rethrow_serialization_type_layout_errors: true max_tx_size_bytes: 131072 max_input_objects: 2048 max_size_written_objects: 5000000 diff --git a/sdk/typescript/src/graphql/generated/2024.10/tsconfig.tada.json b/sdk/typescript/src/graphql/generated/2024.10/tsconfig.tada.json index 038c86ba41f..1047b78a76c 100644 --- a/sdk/typescript/src/graphql/generated/2024.10/tsconfig.tada.json +++ b/sdk/typescript/src/graphql/generated/2024.10/tsconfig.tada.json @@ -2,10 +2,10 @@ "compilerOptions": { "plugins": [ { - "name": "@0no-co/graphqlsp", + "name": "gql.tada/ts-plugin", "schema": "./schema.graphql", "tadaOutputLocation": "src/graphql/generated/2024.10/tada-env.d.ts" } ] } -} +} \ No newline at end of file