Skip to content

Commit 8975194

Browse files
authored
refactor: ♻️ use saturating sub for refund computation (#385)
1 parent e3f0e92 commit 8975194

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/executor/stack/executor.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,10 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
852852

853853
if !is_empty_account {
854854
// Issue refund for this non-empty account
855-
let refund_amount =
856-
self.config.gas_per_empty_account_cost - self.config.gas_auth_base_cost;
855+
let refund_amount = self
856+
.config
857+
.gas_per_empty_account_cost
858+
.saturating_sub(self.config.gas_auth_base_cost);
857859
self.state
858860
.metadata_mut()
859861
.gasometer

0 commit comments

Comments
 (0)