From 89753d9f970f86f5b38f6d9a5f7ace000832ed48 Mon Sep 17 00:00:00 2001 From: crazywriter1 Date: Fri, 3 Jul 2026 17:25:25 +0300 Subject: [PATCH] fix: propagate cumulative gas overflow in block executor (#42 follow-up) --- crates/evm/src/executor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/evm/src/executor.rs b/crates/evm/src/executor.rs index 87eb283..1b3cc38 100644 --- a/crates/evm/src/executor.rs +++ b/crates/evm/src/executor.rs @@ -65,6 +65,7 @@ use revm::DatabaseCommit; const ERR_BLOCKLIST_READ_FAILED: &str = "Failed to read beneficiary blocklist status"; const ERR_BLOCK_NUMBER_CONVERSION_FAILED: &str = "Failed to convert block number to u64"; const ERR_BLOCK_TIMESTAMP_CONVERSION_FAILED: &str = "Failed to convert block timestamp to u64"; +const ERR_CUMULATIVE_GAS_OVERFLOW: &str = "cumulative gas overflow while executing block"; /// Result of executing an Arc transaction. #[derive(Debug)] @@ -456,7 +457,7 @@ where self.gas_used = self .gas_used .checked_add(gas_used) - .expect("cumulative gas overflow"); + .ok_or_else(|| BlockExecutionError::msg(ERR_CUMULATIVE_GAS_OVERFLOW))?; // Cancun is always active for arc self.blob_gas_used = self.blob_gas_used.saturating_add(blob_gas_used);