Skip to content

Commit

Permalink
Optimize gas cost subtraction by using checked_sub for safer arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushdubey86 committed Feb 8, 2025
1 parent 3365e2b commit 872e7c8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/interpreter/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ impl Gas {
if let Some(new_remaining) = self.remaining.checked_sub(cost) {
self.remaining = new_remaining;
true
}
else {
false //OO Gas
} else {
false
}
}

Expand Down

0 comments on commit 872e7c8

Please sign in to comment.