From b164e321fc9c51745043a3dc148ef95d258a6b0c Mon Sep 17 00:00:00 2001 From: Andrew Schran Date: Thu, 21 Nov 2024 04:52:55 -0500 Subject: [PATCH] Change `bump_object_execution_cost` to use saturating add --- .../src/authority/shared_object_congestion_tracker.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/sui-core/src/authority/shared_object_congestion_tracker.rs b/crates/sui-core/src/authority/shared_object_congestion_tracker.rs index 2321f26801674..acad2fbf333bc 100644 --- a/crates/sui-core/src/authority/shared_object_congestion_tracker.rs +++ b/crates/sui-core/src/authority/shared_object_congestion_tracker.rs @@ -211,12 +211,12 @@ impl SharedObjectCongestionTracker { let shared_input_objects: Vec<_> = cert.shared_input_objects().collect(); let start_cost = self.compute_tx_start_at_cost(&shared_input_objects); - let end_cost = start_cost + tx_cost; + let end_cost = start_cost.saturating_add(tx_cost); for obj in shared_input_objects { if obj.mutable { let old_end_cost = self.object_execution_cost.insert(obj.id, end_cost); - assert!(old_end_cost.is_none() || old_end_cost.unwrap() < end_cost); + assert!(old_end_cost.is_none() || old_end_cost.unwrap() <= end_cost); } } }