Skip to content

Commit

Permalink
feat(node): skip serialization for MoveVM protocol config flags (#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer authored Oct 25, 2024
1 parent 123b013 commit 6b93657
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
33 changes: 22 additions & 11 deletions crates/iota-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b93657

Please sign in to comment.