From ed3b7c509e60f0aef2b4ed0e72a8c2ec7ee5cfec Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Fri, 22 Aug 2025 20:19:43 +0300 Subject: [PATCH] refactor: :recycle: use saturating sub for refund computation --- src/executor/stack/executor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/executor/stack/executor.rs b/src/executor/stack/executor.rs index 4b21b79c..f0d74e91 100644 --- a/src/executor/stack/executor.rs +++ b/src/executor/stack/executor.rs @@ -852,8 +852,10 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> if !is_empty_account { // Issue refund for this non-empty account - let refund_amount = - self.config.gas_per_empty_account_cost - self.config.gas_auth_base_cost; + let refund_amount = self + .config + .gas_per_empty_account_cost + .saturating_sub(self.config.gas_auth_base_cost); self.state .metadata_mut() .gasometer