diff --git a/consensus/core/src/linearizer.rs b/consensus/core/src/linearizer.rs index dba030d05271ed..ec87c2b41f453a 100644 --- a/consensus/core/src/linearizer.rs +++ b/consensus/core/src/linearizer.rs @@ -540,7 +540,9 @@ mod tests { let num_authorities = 4; let (mut context, _keys) = Context::new_for_test(num_authorities); - context.protocol_config.set_gc_depth_for_testing(gc_depth); + context + .protocol_config + .set_consensus_gc_depth_for_testing(gc_depth); let context = Arc::new(context); let dag_state = Arc::new(RwLock::new(DagState::new( context.clone(), diff --git a/crates/sui-open-rpc/spec/openrpc.json b/crates/sui-open-rpc/spec/openrpc.json index d504bad18c95c7..fc75e8e38d97c5 100644 --- a/crates/sui-open-rpc/spec/openrpc.json +++ b/crates/sui-open-rpc/spec/openrpc.json @@ -1428,6 +1428,7 @@ "consensus_max_num_transactions_in_block": null, "consensus_max_transaction_size_bytes": null, "consensus_max_transactions_in_block_bytes": null, + "consensus_voting_rounds": null, "crypto_invalid_arguments_cost": { "u64": "100" }, diff --git a/crates/sui-protocol-config/src/lib.rs b/crates/sui-protocol-config/src/lib.rs index 11a1e238e09716..d24bff1e59311d 100644 --- a/crates/sui-protocol-config/src/lib.rs +++ b/crates/sui-protocol-config/src/lib.rs @@ -1251,6 +1251,9 @@ pub struct ProtocolConfig { /// The maximum number of transactions included in a consensus block. consensus_max_num_transactions_in_block: Option, + /// The maximum number of rounds where transaction voting is allowed. + consensus_voting_rounds: Option, + /// DEPRECATED. Do not use. max_accumulated_txn_cost_per_object_in_narwhal_commit: Option, @@ -1648,6 +1651,9 @@ impl ProtocolConfig { } pub fn mysticeti_fastpath(&self) -> bool { + if let Some(enabled) = is_mysticeti_fpc_enabled_in_env() { + return enabled; + } self.feature_flags.mysticeti_fastpath } @@ -2163,6 +2169,8 @@ impl ProtocolConfig { consensus_max_num_transactions_in_block: None, + consensus_voting_rounds: None, + max_accumulated_txn_cost_per_object_in_narwhal_commit: None, max_deferral_rounds_for_congestion_control: None, @@ -2916,6 +2924,8 @@ impl ProtocolConfig { Some(3_700_000); // 20% of above cfg.max_txn_cost_overage_per_object_in_commit = Some(u64::MAX); cfg.gas_budget_based_txn_cost_absolute_cap_commit_count = Some(50); + + cfg.consensus_voting_rounds = Some(40); } // Use this template when making changes: // @@ -3078,10 +3088,6 @@ impl ProtocolConfig { pub fn set_consensus_round_prober_for_testing(&mut self, val: bool) { self.feature_flags.consensus_round_prober = val; } - - pub fn set_gc_depth_for_testing(&mut self, val: u32) { - self.consensus_gc_depth = Some(val); - } } type OverrideFn = dyn Fn(ProtocolVersion, ProtocolConfig) -> ProtocolConfig + Send; @@ -3172,6 +3178,17 @@ macro_rules! check_limit_by_meter { }}; } +pub fn is_mysticeti_fpc_enabled_in_env() -> Option { + if let Ok(v) = std::env::var("CONSENSUS") { + if v == "mysticeti_fpc" { + return Some(true); + } else if v == "mysticeti" { + return Some(false); + } + } + None +} + #[cfg(all(test, not(msim)))] mod test { use insta::assert_yaml_snapshot; diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_68.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_68.snap index f2728360df9464..40ce05ad3fe226 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_68.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_68.snap @@ -324,6 +324,7 @@ random_beacon_dkg_version: 1 consensus_max_transaction_size_bytes: 262144 consensus_max_transactions_in_block_bytes: 524288 consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 max_deferral_rounds_for_congestion_control: 10 max_txn_cost_overage_per_object_in_commit: 18446744073709551615 @@ -335,4 +336,3 @@ max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 gas_budget_based_txn_cost_cap_factor: 400000 gas_budget_based_txn_cost_absolute_cap_commit_count: 50 - diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_68.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_68.snap index f2728360df9464..40ce05ad3fe226 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_68.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_68.snap @@ -324,6 +324,7 @@ random_beacon_dkg_version: 1 consensus_max_transaction_size_bytes: 262144 consensus_max_transactions_in_block_bytes: 524288 consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 max_deferral_rounds_for_congestion_control: 10 max_txn_cost_overage_per_object_in_commit: 18446744073709551615 @@ -335,4 +336,3 @@ max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 gas_budget_based_txn_cost_cap_factor: 400000 gas_budget_based_txn_cost_absolute_cap_commit_count: 50 - diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_68.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_68.snap index f93b6bf75b2327..b2ac18545cb82d 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_68.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_68.snap @@ -335,6 +335,7 @@ random_beacon_dkg_version: 1 consensus_max_transaction_size_bytes: 262144 consensus_max_transactions_in_block_bytes: 524288 consensus_max_num_transactions_in_block: 512 +consensus_voting_rounds: 40 max_accumulated_txn_cost_per_object_in_narwhal_commit: 40 max_deferral_rounds_for_congestion_control: 10 max_txn_cost_overage_per_object_in_commit: 18446744073709551615 @@ -346,4 +347,3 @@ max_accumulated_txn_cost_per_object_in_mysticeti_commit: 18500000 max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit: 3700000 gas_budget_based_txn_cost_cap_factor: 400000 gas_budget_based_txn_cost_absolute_cap_commit_count: 50 - diff --git a/sdk/graphql-transport/src/methods.ts b/sdk/graphql-transport/src/methods.ts index 982940aeaefe54..3f5c2404015bac 100644 --- a/sdk/graphql-transport/src/methods.ts +++ b/sdk/graphql-transport/src/methods.ts @@ -1363,6 +1363,7 @@ export const RPC_METHODS: { binary_friend_decls: 'u16', max_package_dependencies: 'u32', bridge_should_try_to_finalize_committee: 'bool', + consensus_voting_rounds: 'u32', }; for (const { key, value } of protocolConfig.configs) { diff --git a/sdk/graphql-transport/test/compatability.test.ts b/sdk/graphql-transport/test/compatability.test.ts index d8a0fbee58d817..e91456e11365ec 100644 --- a/sdk/graphql-transport/test/compatability.test.ts +++ b/sdk/graphql-transport/test/compatability.test.ts @@ -729,6 +729,9 @@ describe('GraphQL SuiClient compatibility', () => { const rpc = await toolbox.client.getProtocolConfig(); const graphql = await graphQLClient!.getProtocolConfig(); + // If this check fails and the difference is due to types, + // the config field type may need to overridden if it is not u64, + // in sdk/graphql-transport/src/methods.ts getProtocolConfig(). expect(graphql).toEqual(rpc); });