From 874edde48e4500b6e3e2d3daa9da9c83f1545119 Mon Sep 17 00:00:00 2001 From: Himess <95512809+Himess@users.noreply.github.com> Date: Sat, 31 Jan 2026 20:44:54 +0300 Subject: [PATCH] fix(revme): validate state root hash for invalid transactions Previously, when a test expected an exception and one occurred, the state root validation was skipped entirely. This fix ensures that post-state root hash is always validated, even when the transaction is invalid and expected to fail. --- bins/revme/src/cmd/statetest/runner.rs | 38 ++++++++++++-------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/bins/revme/src/cmd/statetest/runner.rs b/bins/revme/src/cmd/statetest/runner.rs index 757bfac0d2..0cdb8b2312 100644 --- a/bins/revme/src/cmd/statetest/runner.rs +++ b/bins/revme/src/cmd/statetest/runner.rs @@ -238,30 +238,26 @@ fn check_evm_execution( print_json(Some(e)); })?; - // If exception was expected and occurred, we're done - if exception_expected { - print_json(None); - return Ok(()); - } - - // Validate output if execution succeeded - if let Ok(result) = exec_result { - validate_output(expected_output, result).inspect_err(|e| { - print_json(Some(e)); - })?; - } + // Validate output if execution succeeded (skip if exception was expected) + if !exception_expected { + if let Ok(result) = exec_result { + validate_output(expected_output, result).inspect_err(|e| { + print_json(Some(e)); + })?; + } - // Validate logs root - if validation.logs_root != test.logs { - let error = TestErrorKind::LogsRootMismatch { - got: validation.logs_root, - expected: test.logs, - }; - print_json(Some(&error)); - return Err(error); + // Validate logs root (only when no exception expected) + if validation.logs_root != test.logs { + let error = TestErrorKind::LogsRootMismatch { + got: validation.logs_root, + expected: test.logs, + }; + print_json(Some(&error)); + return Err(error); + } } - // Validate state root + // Validate state root (always, even when exception was expected) if validation.state_root != test.hash { let error = TestErrorKind::StateRootMismatch { got: validation.state_root,