From abeabc75f9781a45d55cbd6b9f379c985264194d Mon Sep 17 00:00:00 2001 From: Andrew Schran Date: Thu, 2 Jan 2025 12:06:48 -0500 Subject: [PATCH] Enable burst mode for congestion control at 10x per-commit rate (#20755) --- crates/sui-core/src/unit_tests/authority_tests.rs | 2 ++ crates/sui-protocol-config/src/lib.rs | 3 +++ .../sui_protocol_config__test__Mainnet_version_71.snap | 3 ++- .../sui_protocol_config__test__Testnet_version_71.snap | 3 ++- .../src/snapshots/sui_protocol_config__test__version_71.snap | 3 ++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/sui-core/src/unit_tests/authority_tests.rs b/crates/sui-core/src/unit_tests/authority_tests.rs index a7cc0b5590bc3..a93781c125d47 100644 --- a/crates/sui-core/src/unit_tests/authority_tests.rs +++ b/crates/sui-core/src/unit_tests/authority_tests.rs @@ -5736,6 +5736,7 @@ async fn test_consensus_handler_per_object_congestion_control( } protocol_config.set_max_deferral_rounds_for_congestion_control_for_testing(1000); // Set to a large number so that we don't hit this limit. protocol_config.set_max_txn_cost_overage_per_object_in_commit_for_testing(0); + protocol_config.set_allowed_txn_cost_overage_burst_per_object_in_commit_for_testing(0); let authority = TestAuthorityBuilder::new() .with_reference_gas_price(1000) .with_protocol_config(protocol_config) @@ -5965,6 +5966,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { .set_max_accumulated_txn_cost_per_object_in_mysticeti_commit_for_testing(100_000_000); protocol_config.set_max_deferral_rounds_for_congestion_control_for_testing(2); protocol_config.set_max_txn_cost_overage_per_object_in_commit_for_testing(0); + protocol_config.set_allowed_txn_cost_overage_burst_per_object_in_commit_for_testing(0); let authority = TestAuthorityBuilder::new() .with_reference_gas_price(1000) .with_protocol_config(protocol_config) diff --git a/crates/sui-protocol-config/src/lib.rs b/crates/sui-protocol-config/src/lib.rs index 12eeda60cb939..101d5cb3c9f88 100644 --- a/crates/sui-protocol-config/src/lib.rs +++ b/crates/sui-protocol-config/src/lib.rs @@ -3093,6 +3093,9 @@ impl ProtocolConfig { } 71 => { cfg.sip_45_consensus_amplification_threshold = Some(5); + + // Enable bursts for congestion control. (10x the per-commit budget) + cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000); } // Use this template when making changes: // diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_71.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_71.snap index da60e40a70a2d..3fc06416c2131 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_71.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Mainnet_version_71.snap @@ -1,7 +1,6 @@ --- source: crates/sui-protocol-config/src/lib.rs expression: "ProtocolConfig::get_for_version(cur, *chain_id)" -snapshot_kind: text --- version: 71 feature_flags: @@ -332,6 +331,7 @@ 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 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 min_checkpoint_interval_ms: 200 checkpoint_summary_version_specific_data: 1 max_soft_bundle_size: 5 @@ -341,3 +341,4 @@ 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 sip_45_consensus_amplification_threshold: 5 + diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_71.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_71.snap index f991ccca7c4de..a36eaeb0a01e5 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_71.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__Testnet_version_71.snap @@ -1,7 +1,6 @@ --- source: crates/sui-protocol-config/src/lib.rs expression: "ProtocolConfig::get_for_version(cur, *chain_id)" -snapshot_kind: text --- version: 71 feature_flags: @@ -335,6 +334,7 @@ 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 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 min_checkpoint_interval_ms: 200 checkpoint_summary_version_specific_data: 1 max_soft_bundle_size: 5 @@ -344,3 +344,4 @@ 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 sip_45_consensus_amplification_threshold: 5 + diff --git a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_71.snap b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_71.snap index c64bf5b86add9..30dce33ec0fe9 100644 --- a/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_71.snap +++ b/crates/sui-protocol-config/src/snapshots/sui_protocol_config__test__version_71.snap @@ -1,7 +1,6 @@ --- source: crates/sui-protocol-config/src/lib.rs expression: "ProtocolConfig::get_for_version(cur, *chain_id)" -snapshot_kind: text --- version: 71 feature_flags: @@ -344,6 +343,7 @@ 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 +allowed_txn_cost_overage_burst_per_object_in_commit: 185000000 min_checkpoint_interval_ms: 200 checkpoint_summary_version_specific_data: 1 max_soft_bundle_size: 5 @@ -353,3 +353,4 @@ 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 sip_45_consensus_amplification_threshold: 5 +