From a139ef255ae7c123b356e131f7796cbe5283f194 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 0c19d5ff34394..4e21d8dca054d 100644 --- a/crates/sui-core/src/authority/shared_object_congestion_tracker.rs +++ b/crates/sui-core/src/authority/shared_object_congestion_tracker.rs @@ -197,12 +197,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); } } }