From 15566df5c35ea0c0b29f3c1c0861f84555516d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20P=C5=82askonka?= Date: Tue, 25 Nov 2025 16:45:07 +0100 Subject: [PATCH] Check if remainder is empty in event parsing. --- core/src/host.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/host.rs b/core/src/host.rs index 7bed01a9..0c577a01 100644 --- a/core/src/host.rs +++ b/core/src/host.rs @@ -695,9 +695,13 @@ impl HostEnv { .ok_or(EventError::IndexOutOfBounds)?; let bytes = backend.get_event(&contract_address, event_absolute_position)?; - T::from_bytes(&bytes) - .map_err(|_| EventError::Parsing) - .map(|r| r.0) + let (event, remainder) = T::from_bytes(&bytes).map_err(|_| EventError::Parsing)?; + + if remainder.is_empty() { + Ok(event) + } else { + Err(EventError::Formatting) + } } /// Retrieves a native event with the specified index from the specified contract.