Skip to content

Commit

Permalink
Change bump_object_execution_cost to use saturating add
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran authored and ebmifa committed Nov 21, 2024
1 parent c072489 commit b164e32
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit b164e32

Please sign in to comment.